integrator.h

Go to the documentation of this file.
00001 /* Ergo, version 3.2, a program for linear scaling electronic structure
00002  * calculations.
00003  * Copyright (C) 2012 Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek.
00004  * 
00005  * This program is free software: you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation, either version 3 of the License, or
00008  * (at your option) any later version.
00009  * 
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  * 
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
00017  * 
00018  * Primary academic reference:
00019  * Kohn−Sham Density Functional Theory Electronic Structure Calculations 
00020  * with Linearly Scaling Computational Time and Memory Usage,
00021  * Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek,
00022  * J. Chem. Theory Comput. 7, 340 (2011),
00023  * <http://dx.doi.org/10.1021/ct100611z>
00024  * 
00025  * For further information about Ergo, see <http://www.ergoscf.org>.
00026  */
00027 
00032 #ifndef _INTEGRATOR_H_
00033 #define _INTEGRATOR_H_
00034 
00035 #include "basisinfo.h"
00036 #include "matrix_typedefs.h"
00037 #include "grid_stream.h"
00038 #include "functionals.h"
00039 
00040 typedef ergo_real      real;
00041 typedef ergo_long_real long_real;
00042 
00043 /* =================================================================== */
00044 /*                     BLOCKED INTEGRATORS                             */
00045 /* =================================================================== */
00046 
00047 typedef struct DftIntegratorBl_ {
00048     /* private to integrator */
00049     real (*coor)[3];
00050     real* weight;
00051     real* atv; /* the orbital values and their derivatives at given 
00052                 * grid point. The vector is indexed by dftinf_.kso1, etc
00053                 * the dimensioning is (C syntax) [ntypso][nbast][bllen].
00054                 */
00055     real dfthri; /* threshold on orbital values */
00056     int nsym, shl_bl_cnt, bas_bl_cnt[8];
00057     int (*shlblocks)[2]; /* shell blocks   */
00058     int (*basblocks)[2]; /* basis function blocks */
00059 #define BASBLOCK(grid,isym) ((grid)->basblocks + (isym)*(grid)->shl_bl_cnt)
00060 
00061     int ntypso; /* how many different vectors are computed for each
00062                  * (point,orbital) pair. i.e whether only orbital values
00063                  * are computed (1), orbital values and first derivatives 
00064                  * (4), etc. */
00065 
00066     int london_off; /* offset of the "london" orbital derivatives */
00067     /* 1 - only values; 4 - values + (x,y,z) derivatives, etc */
00068 
00069     int ndmat; /* 1 for closed shell, 2 for open shell */
00070     int nbast; /* number of basis functions */
00071     /* for closed shell, only rho is set. For open shell, only rhoa and rhob
00072      * is set. */
00073     union {
00074         real *rho; /* total density vector; used in closed shell code. */
00075         struct {  /* used in open-shell code.    */
00076             real *a, *b;
00077         }ho;
00078     }r;
00079     union {
00080         real (*grad)[3]; /*total density gradient; used in closed shell code.*/
00081         struct {
00082             real (*a)[3], (*b)[3];
00083         }rad;
00084     }g;
00085     /* public, read only */
00086     real tgrad[3];/* alpha, also used in closed-shell code */
00087     int  curr_point;  /* index of the current point */
00088     real curr_weight; /* the weight at current grid point */
00089     int dogga, needlap, needgb;
00090 } DftIntegratorBl;
00091 
00092 /* dft_integrate_ao_bl:
00093    numerical integration in atomic orbitals, blocked scheme.
00094 */
00095 typedef void (*DftBlockCallback)(DftIntegratorBl* grid, real *tmp, 
00096                                  int bllen, int blstart, int blend,
00097                                  void* cb_data);
00098 
00099 DftIntegratorBl*
00100 dft_integrator_bl_new(Functional* f, int ndmat,
00101                       int bllen, int needlondon, const BasisInfoStruct& bis);
00102 
00103 void
00104 dft_integrator_bl_free(DftIntegratorBl *res);
00105 
00106 class Molecule;
00107 namespace Dft {
00108 class FullMatrix;
00109 class SparseMatrix;
00110 
00111 real integrate(int ndmat, const FullMatrix * const*dmat,
00112                const BasisInfoStruct& bis,
00113                const Molecule& mol, const Dft::GridParams& gss,
00114                int nThreads, DftBlockCallback cb, void *cb_data);
00115 
00116 real integrate(int nDmat, const SparseMatrix * const *dmat,
00117                const BasisInfoStruct& bis,
00118                const Molecule& mol, const Dft::GridParams& gss,
00119                int nThreads, DftBlockCallback cb, void *cb_data);
00120 
00121 }
00122 
00123 #endif /* _INTEGRATOR_H_ */

Generated on Mon Sep 17 14:30:39 2012 for ergo by  doxygen 1.4.7