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