ergo
integrator.h
Go to the documentation of this file.
1 /* Ergo, version 3.4, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2014 Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek.
4  *
5  * This program is free software: you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation, either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  *
18  * Primary academic reference:
19  * Kohn−Sham Density Functional Theory Electronic Structure Calculations
20  * with Linearly Scaling Computational Time and Memory Usage,
21  * Elias Rudberg, Emanuel H. Rubensson, and Pawel Salek,
22  * J. Chem. Theory Comput. 7, 340 (2011),
23  * <http://dx.doi.org/10.1021/ct100611z>
24  *
25  * For further information about Ergo, see <http://www.ergoscf.org>.
26  */
27 
32 #ifndef _INTEGRATOR_H_
33 #define _INTEGRATOR_H_
34 
35 #include "basisinfo.h"
36 #include "matrix_typedefs.h"
37 #include "grid_stream.h"
38 #include "functionals.h"
39 
40 typedef ergo_real real;
42 
43 /* =================================================================== */
44 /* BLOCKED INTEGRATORS */
45 /* =================================================================== */
46 
47 typedef struct DftIntegratorBl_ {
48  /* private to integrator */
49  real (*coor)[3];
51  real* atv; /* the orbital values and their derivatives at given
52  * grid point. The vector is indexed by dftinf_.kso1, etc
53  * the dimensioning is (C syntax) [ntypso][nbast][bllen].
54  */
55  real dfthri; /* threshold on orbital values */
57  int (*shlblocks)[2]; /* shell blocks */
58  int (*basblocks)[2]; /* basis function blocks */
59 #define BASBLOCK(grid,isym) ((grid)->basblocks + (isym)*(grid)->shl_bl_cnt)
60 
61  int ntypso; /* how many different vectors are computed for each
62  * (point,orbital) pair. i.e whether only orbital values
63  * are computed (1), orbital values and first derivatives
64  * (4), etc. */
65 
66  int london_off; /* offset of the "london" orbital derivatives */
67  /* 1 - only values; 4 - values + (x,y,z) derivatives, etc */
68 
69  int ndmat; /* 1 for closed shell, 2 for open shell */
70  int nbast; /* number of basis functions */
71  /* for closed shell, only rho is set. For open shell, only rhoa and rhob
72  * is set. */
73  union {
74  real *rho; /* total density vector; used in closed shell code. */
75  struct { /* used in open-shell code. */
76  real *a, *b;
77  }ho;
78  }r;
79  union {
80  real (*grad)[3]; /*total density gradient; used in closed shell code.*/
81  struct {
82  real (*a)[3], (*b)[3];
83  }rad;
84  }g;
85  /* public, read only */
86  real tgrad[3];/* alpha, also used in closed-shell code */
87  int curr_point; /* index of the current point */
88  real curr_weight; /* the weight at current grid point */
91 
92 /* dft_integrate_ao_bl:
93  numerical integration in atomic orbitals, blocked scheme.
94 */
95 typedef void (*DftBlockCallback)(DftIntegratorBl* grid, real *tmp,
96  int bllen, int blstart, int blend,
97  void* cb_data);
98 
101  int bllen, int needlondon, const BasisInfoStruct& bis);
102 
103 void
105 
106 class Molecule;
107 namespace Dft {
108 class FullMatrix;
109 class SparseMatrix;
110 
111 real integrate(int ndmat, const FullMatrix * const*dmat,
112  const BasisInfoStruct& bis,
113  const Molecule& mol, const Dft::GridParams& gss,
114  int nThreads, DftBlockCallback cb, void *cb_data);
115 
116 real integrate(int nDmat, const SparseMatrix * const *dmat,
117  const BasisInfoStruct& bis,
118  const Molecule& mol, const Dft::GridParams& gss,
119  int nThreads, DftBlockCallback cb, void *cb_data);
120 
121 }
122 
123 #endif /* _INTEGRATOR_H_ */
int needgb
Definition: integrator.h:89
int needlap
Definition: integrator.h:89
double ergo_real
Definition: realtype.h:53
int bas_bl_cnt[8]
Definition: integrator.h:56
A structure describing the grid settings.
Definition: grid_params.h:49
real * weight
Definition: integrator.h:50
Streaming grid generator.
struct DftIntegratorBl_::@0::@2 ho
union DftIntegratorBl_::@1 g
int(* shlblocks)[2]
Definition: integrator.h:57
Definition: integrator.h:47
real * b
Definition: integrator.h:76
real integrate(int nDmat, const SparseMatrix *const *dmat, const BasisInfoStruct &bis, const Molecule &mol, const Dft::GridParams &gss, int nThreads, DftBlockCallback cb, void *cb_data)
Definition: integrator.cc:306
Representation of a molecule as a set of nuclei and total charge.
Definition: molecule.h:76
int ndmat
Definition: integrator.h:69
real(* grad)[3]
Definition: integrator.h:80
struct DftIntegratorBl_::@1::@3 rad
real * atv
Definition: integrator.h:51
int curr_point
Definition: integrator.h:87
int nbast
Definition: integrator.h:70
struct DftIntegratorBl_ DftIntegratorBl
Sparse matrix structure optimized for XC data access pattern.
Definition: sparse_matrix.h:54
int shl_bl_cnt
Definition: integrator.h:56
double ergo_long_real
Definition: realtype.h:54
DftIntegratorBl * dft_integrator_bl_new(Functional *f, int ndmat, int bllen, int needlondon, const BasisInfoStruct &bis)
Definition: integrator.cc:114
real * rho
Definition: integrator.h:74
real curr_weight
Definition: integrator.h:88
int ntypso
Definition: integrator.h:61
void(* DftBlockCallback)(DftIntegratorBl *grid, real *tmp, int bllen, int blstart, int blend, void *cb_data)
Definition: integrator.h:95
Definition: basisinfo.h:111
ergo_real real
Definition: cubature_rules.h:33
void dft_integrator_bl_free(DftIntegratorBl *res)
Definition: integrator.cc:156
int dogga
Definition: integrator.h:89
Header file with typedefs for matrix and vector types.
real tgrad[3]
Definition: integrator.h:86
ergo_long_real long_real
Definition: integrator.h:41
ergo_real real
Definition: integrator.h:40
int london_off
Definition: integrator.h:66
int(* basblocks)[2]
Definition: integrator.h:58
Functional library interface.
Definition: functionals.h:373
union DftIntegratorBl_::@0 r
real(* coor)[3]
Definition: integrator.h:49
int nsym
Definition: integrator.h:56
Definition: grid_matrix.h:32
real dfthri
Definition: integrator.h:55
real * a
Definition: integrator.h:76