ergo
integrator.h
Go to the documentation of this file.
1/* Ergo, version 3.8.2, a program for linear scaling electronic structure
2 * calculations.
3 * Copyright (C) 2023 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
33
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
42typedef ergo_real real;
44
45/* =================================================================== */
46/* BLOCKED INTEGRATORS */
47/* =================================================================== */
48
49typedef 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;
80 }r;
81 union {
82 real (*grad)[3]; /*total density gradient; used in closed shell code.*/
83 struct {
84 real (*a)[3], (*b)[3];
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*/
97typedef void (*DftBlockCallback)(DftIntegratorBl* grid, real *tmp,
98 int bllen, int blstart, int blend,
99 void* cb_data);
100
103 int bllen, int needlondon, const BasisInfoStruct& bis);
104
105void
107
108class Molecule;
109namespace Dft {
110class FullMatrix;
111class SparseMatrix;
112
113real 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
118real 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_ */
Code for setting up basis functions starting from shells.
Definition grid_matrix.h:53
Representation of a molecule as a set of nuclei and total charge.
Definition molecule.h:87
Sparse matrix structure optimized for XC data access pattern.
Definition sparse_matrix.h:56
ergo_real real
Definition test.cc:46
Functional library interface.
struct Functional_ Functional
Definition functionals.h:361
ergo_long_real long_real
Definition grid_atomic.h:43
Streaming grid generator.
void dft_integrator_bl_free(DftIntegratorBl *res)
Definition integrator.cc:151
DftIntegratorBl * dft_integrator_bl_new(Functional *f, int ndmat, int bllen, int needlondon, const BasisInfoStruct &bis)
Definition integrator.cc:109
void(* DftBlockCallback)(DftIntegratorBl *grid, real *tmp, int bllen, int blstart, int blend, void *cb_data)
Definition integrator.h:97
struct DftIntegratorBl_ DftIntegratorBl
Header file with typedefs for matrix and vector types.
Definition grid_matrix.h:42
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)
double ergo_real
Definition realtype.h:69
double ergo_long_real
Definition realtype.h:70
Definition basisinfo.h:112
Definition integrator.h:49
real tgrad[3]
Definition integrator.h:88
int nbast
Definition integrator.h:72
int(* basblocks)[2]
Definition integrator.h:60
real * rho
Definition integrator.h:76
int nsym
Definition integrator.h:58
real * a
Definition integrator.h:78
int dogga
Definition integrator.h:91
real * weight
Definition integrator.h:52
real dfthri
Definition integrator.h:57
int needlap
Definition integrator.h:91
struct DftIntegratorBl_::@023001315371363217074352364022166037240265162246::@276204005362136055261243374047031356047066277014 ho
int ntypso
Definition integrator.h:63
int london_off
Definition integrator.h:68
real * atv
Definition integrator.h:53
real(* coor)[3]
Definition integrator.h:51
real curr_weight
Definition integrator.h:90
int ndmat
Definition integrator.h:71
union DftIntegratorBl_::@023001315371363217074352364022166037240265162246 r
int shl_bl_cnt
Definition integrator.h:58
int(* shlblocks)[2]
Definition integrator.h:59
int curr_point
Definition integrator.h:89
int needgb
Definition integrator.h:91
union DftIntegratorBl_::@011041251170175353217056224236370062213300362173 g
real(* grad)[3]
Definition integrator.h:82
int bas_bl_cnt[8]
Definition integrator.h:58
struct DftIntegratorBl_::@011041251170175353217056224236370062213300362173::@004116310127164346067362212136047010144001344166 rad
real * b
Definition integrator.h:78
A structure describing the grid settings.
Definition grid_params.h:59