ergo
integrals_1el_potential.h
Go to the documentation of this file.
1 /* Ergo, version 3.8, a program for linear scaling electronic structure
2  * calculations.
3  * Copyright (C) 2019 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 
38 #ifndef INTEGRALS_1EL_POTENTIAL
39 #define INTEGRALS_1EL_POTENTIAL
40 
41 #include "basisinfo.h"
43 #include "csr_matrix.h"
44 
46  int nPrims,
47  const Atom & atom,
48  const IntegralInfo & integralInfo);
49 
50 int compute_V_matrix_full(const BasisInfoStruct& basisInfo,
51  const IntegralInfo& integralInfo,
52  int nAtoms,
53  const Atom* atomList,
54  ergo_real threshold,
55  ergo_real* result);
56 
58  const IntegralInfo& integralInfo,
59  const Molecule& molecule,
60  ergo_real threshold,
61  ergo_real boxSize,
62  const basis_func_index_pair_struct_1el* basisFuncIndexPairList,
63  ergo_real* V_list,
64  int noOfBasisFuncIndexPairs,
65  bool compute_gradient_also,
66  const ergo_real* D_list, // List of corresponding density matrix elemets; used for compute_gradient_also case, NULL otherwise
67  ergo_real* result_gradient_list, // list of result gradient values; used for compute_gradient_also case, NULL otherwise
68  ergo_real & result_nuclearRepulsionEnergy
69  );
70 
71 int compute_V_hierarchical(const BasisInfoStruct& basisInfo,
72  const IntegralInfo& integralInfo,
73  const Molecule& molecule,
74  ergo_real threshold,
75  ergo_real boxSize,
76  const basis_func_index_pair_struct_1el* basisFuncIndexPairList,
77  int noOfBasisFuncIndexPairs,
78  csr_matrix_struct* V_CSR,
79  ergo_real & result_nuclearRepulsionEnergy
80  );
81 
82 
83 #endif
BasisFuncStruct::noOfSimplePrimitives
int noOfSimplePrimitives
Definition: basisinfo.h:93
multipole_struct_large::degree
int degree
Definition: multipole_prep.h:54
template_blas_sqrt
Treal template_blas_sqrt(Treal x)
IntegralInfo::GetMMLimitTable
const MMLimitTable & GetMMLimitTable() const
Definition: integral_info.h:110
MMTranslator
Definition: multipole.h:51
multipole.h
Code for computing multipole moments, and multipole interaction and translation matrices.
integrals_2el_single.h
Functionality for computing a single 2-electron integral, for two given primitive Gaussian distributi...
atom_box_struct::derivatives_wrt_multipole_moments
ergo_real * derivatives_wrt_multipole_moments
Definition: integrals_1el_potential.cc:100
box_struct_basic::firstChildBoxIndex
int firstChildBoxIndex
Definition: box_system.h:59
BoxSystem::noOfLevels
int noOfLevels
Definition: box_system.h:74
integrals_1el_potential.h
Code for 1-electron integrals, computation of electron-nuclear potential energy matrix V.
BasisInfoStruct::noOfBasisFuncs
int noOfBasisFuncs
Definition: basisinfo.h:120
pi.h
Constants for the number pi and some related numbers like sqrt(pi).
DistributionSpecStruct
Definition: basisinfo.h:50
simplePrimVintegral_list
ergo_real simplePrimVintegral_list(const DistributionSpecStruct *list, int nPrims, const Atom &atom, const IntegralInfo &integralInfo)
Definition: integrals_1el_potential.cc:1556
csr_matrix.h
Compressed sparse row (CSR) matrix functionality.
simplePrimVintegralSingle
static ergo_real simplePrimVintegralSingle(const DistributionSpecStruct &prim, const Atom &atom, const IntegralInfo &integralInfo)
Definition: integrals_1el_potential.cc:1545
box_item_struct::originalIndex
int originalIndex
Definition: box_system.h:48
memorymanag.h
Memory allocation/deallocation routines.
MAX_MULTIPOLE_DEGREE_BASIC
#define MAX_MULTIPOLE_DEGREE_BASIC
Definition: multipole_prep.h:48
BoxSystem::totNoOfBoxes
int totNoOfBoxes
Definition: box_system.h:73
integrals_1el_potential_prep.h
Code for 1-electron integrals, preparatory work for computation of electron-nuclear potential energy ...
LOG_CAT_ERROR
#define LOG_CAT_ERROR
Definition: output.h:47
multipole_struct_large::centerCoords
ergo_real centerCoords[3]
Definition: multipole_prep.h:53
DistributionSpecStruct::centerCoords
ergo_real centerCoords[3]
x0, y0, z0
Definition: basisinfo.h:54
DistributionSpecStructWithIndexes2::basisFuncIdx2
int basisFuncIdx2
Definition: integrals_1el_potential_prep.h:47
ergo_real
double ergo_real
Definition: realtype.h:69
atom_box_struct::centerOfChargeCoords
ergo_real centerOfChargeCoords[3]
Definition: integrals_1el_potential.cc:97
get_distance_3d
static ergo_real get_distance_3d(const ergo_real *x, const ergo_real *y)
Definition: integrals_1el_potential.cc:105
BoxSystem::boxList
box_struct_basic * boxList
Definition: box_system.h:76
boysfunction.h
Code for Boys function evaluation.
box_level_struct::noOfBoxes
int noOfBoxes
Definition: box_system.h:64
box_system.h
BoxSystem class representing a hierarchical data structure of boxes in 3D space (an oct-tree).
MMInteractor
Definition: multipole.h:69
do_1e_repulsion_integral_using_symb_info
ergo_real do_1e_repulsion_integral_using_symb_info(const DistributionSpecStruct &psi, ergo_real pointCharge, const ergo_real *pointChargeCoords, const IntegralInfo &integralInfo)
Definition: integrals_1el_single.cc:189
integrals_general.h
General functionality related to computation of integrals involving Gaussian basis functions.
BasisInfoStruct
Definition: basisinfo.h:112
Molecule::getNoOfAtoms
int getNoOfAtoms() const
Definition: molecule.h:114
get_product_simple_primitives
int get_product_simple_primitives(const BasisInfoStruct &basisInfoA, int iA, const BasisInfoStruct &basisInfoB, int iB, DistributionSpecStruct resultList[], int maxCount, ergo_real threshold)
Definition: integrals_general.cc:268
Atom
Simple atom representation by its charge and cartesian coordinates.
Definition: molecule.h:51
BoxSystem::levelList
box_level_struct levelList[MAX_NO_OF_BOX_LEVELS]
Definition: box_system.h:75
box_struct_basic::noOfItems
int noOfItems
Definition: box_system.h:56
DistributionSpecStructWithIndexes::basisFuncIdx2
int basisFuncIdx2
Definition: integrals_1el_potential.cc:455
atom_box_struct::multipole
multipole_struct_large multipole
Definition: integrals_1el_potential.cc:98
template_blas_fabs
Treal template_blas_fabs(Treal x)
MAX_MULTIPOLE_DEGREE
#define MAX_MULTIPOLE_DEGREE
Definition: multipole_prep.h:45
box_struct_basic::centerCoords
ergo_real centerCoords[3]
Definition: box_system.h:54
B
#define B
IntegralInfo::monomial_info
monomial_info_struct monomial_info
Definition: integral_info.h:105
pi
#define pi
Definition: pi.h:57
basis_func_index_pair_struct_1el::index_2
int index_2
Definition: basis_func_pair_list_1el.h:50
do_interaction_recursive_2
static int do_interaction_recursive_2(const IntegralInfo &integralInfo, csr_matrix_struct *V_CSR, int noOfBasisFuncIndexPairs, const basis_func_index_pair_struct_1el *basisFuncIndexPairList, const DistributionSpecStructWithIndexes2 *list, int nDistrs, const multipole_struct_small *multipoleList, const ergo_real *maxMomentVectorNormForDistrsList, int maxNoOfMomentsForDistrs, int maxDegreeForDistrs, ergo_real distrExtent, const Atom *atomListReordered, const int *atomPermutation, ergo_real threshold, const atom_box_struct *boxList, MMInteractor &interactor, int boxIndex, int currLevel, int numberOfLevels)
Take care of interaction between list of distrs and box.
Definition: integrals_1el_potential.cc:761
monomial_info_struct::no_of_monomials_list
int no_of_monomials_list[MONOMIAL_N_MAX+1]
Definition: monomial_info.h:61
get_list_of_distrs_for_V
static int get_list_of_distrs_for_V(const BasisInfoStruct &basisInfo, const basis_func_index_pair_struct_1el *basisFuncIndexPairList, int noOfBasisFuncIndexPairs, ergo_real threshold, ergo_real maxCharge, DistributionSpecStructWithIndexes *resultList, int maxCountResult)
Definition: integrals_1el_potential.cc:952
DistributionSpecStructWithIndexes::pairIdx
int pairIdx
Definition: integrals_1el_potential.cc:453
multipole_struct_large::momentList
ergo_real momentList[MAX_NO_OF_MOMENTS_PER_MULTIPOLE]
Definition: multipole_prep.h:56
matrix_norm.h
Code for computing Euclidean norm of a dense matrix.
multipole_struct_large::noOfMoments
int noOfMoments
Definition: multipole_prep.h:55
MMInteractor::getInteractionMatrix
int getInteractionMatrix(ergo_real dx, ergo_real dy, ergo_real dz, int l_1, int l_2, ergo_real *result_T)
Definition: multipole.cc:293
monomial_info_struct::monomial_index_list
int monomial_index_list[MONOMIAL_N_MAX+1][MONOMIAL_N_MAX+1][MONOMIAL_N_MAX+1]
Definition: monomial_info.h:62
get_related_integrals_hermite
int get_related_integrals_hermite(const IntegralInfo &integralInfo, const JK::ExchWeights &paramsCAM, int n1max, int noOfMonomials_1, int n2max, int noOfMonomials_2, ergo_real dx0, ergo_real dx1, ergo_real dx2, ergo_real alpha0, ergo_real resultPreFactor, ergo_real *primitiveIntegralList)
Definition: integrals_hermite.cc:53
multipole_struct_large
Definition: multipole_prep.h:52
box_level_struct::startIndexInBoxList
int startIndexInBoxList
Definition: box_system.h:65
IntegralInfo
Contains coefficients needed for quick integral evaluation.
Definition: integral_info.h:94
basis_func_pair_list_1el.h
Functions for setting up lists of non-negligible basis function pairs, for 1-electron integrals.
compute_V_and_gradient_linear
int compute_V_and_gradient_linear(const BasisInfoStruct &basisInfo, const IntegralInfo &integralInfo, const Molecule &molecule, ergo_real threshold, ergo_real boxSize, const basis_func_index_pair_struct_1el *basisFuncIndexPairList, ergo_real *V_list, int noOfBasisFuncIndexPairs, bool compute_gradient_also, const ergo_real *D_list, ergo_real *gradient_list, ergo_real &result_nuclearRepulsionEnergy)
Definition: integrals_1el_potential.cc:1108
sort_distr_list
int sort_distr_list(DistributionSpecStructType *list, int n)
Definition: integrals_1el_potential_prep.h:130
BasisInfoStruct::simplePrimitiveList
DistributionSpecStruct * simplePrimitiveList
Definition: basisinfo.h:123
box_item_struct
Definition: box_system.h:46
BasisFuncStruct::simplePrimitiveIndex
int simplePrimitiveIndex
Definition: basisinfo.h:94
do_interaction_recursive
static int do_interaction_recursive(const IntegralInfo &integralInfo, ergo_real *V_list, int noOfBasisFuncIndexPairs, const basis_func_index_pair_struct_1el *basisFuncIndexPairList, const DistributionSpecStructWithIndexes *list, int nDistrs, const multipole_struct_small *multipoleList, const ergo_real *maxMomentVectorNormForDistrsList, int maxNoOfMomentsForDistrs, int maxDegreeForDistrs, ergo_real distrExtent, const Atom *atomListReordered, const int *atomPermutation, ergo_real threshold, const atom_box_struct *boxList, MMInteractor &interactor, int boxIndex, int currLevel, int numberOfLevels, bool compute_gradient_also, const ergo_real *D_list, ergo_real *result_gradient_list)
Take care of interaction between list of distrs and box.
Definition: integrals_1el_potential.cc:463
Molecule::getNuclearRepulsionEnergyGradientContribQuadratic
void getNuclearRepulsionEnergyGradientContribQuadratic(ergo_real *resultGradient) const
Compute gradient of nuclear repulsion energy w.r.t.
Definition: molecule.cc:111
POLY_PRODUCT_MAX_DISTRS
const int POLY_PRODUCT_MAX_DISTRS
Definition: integrals_general.h:48
SetOfDistrsForV::multipoleList
std::vector< multipole_struct_small > multipoleList
Definition: integrals_1el_potential_prep.h:71
get_product_simple_prims
int get_product_simple_prims(const DistributionSpecStruct &primA_in, const DistributionSpecStruct &primB_in, DistributionSpecStruct resultList[], int maxCount, ergo_real threshold)
Definition: integrals_general.cc:91
csr_matrix_struct
Definition: csr_matrix.h:51
Util::TimeMeter::print
void print(int area, const char *routine)
Definition: utilities.h:111
integrals_1el_single.h
Functionality for computing a single 1-electron integral, for a given primitive Gaussian distribution...
MAX_NO_OF_MOMENTS_PER_MULTIPOLE
#define MAX_NO_OF_MOMENTS_PER_MULTIPOLE
Definition: multipole_prep.h:46
Molecule::getAtom
const Atom & getAtom(int i) const
Definition: molecule.h:113
box_struct_basic::firstItemIndex
int firstItemIndex
Definition: box_system.h:57
IntegralInfo::GetMultipolePrep
const MultipolePrepManager & GetMultipolePrep() const
Definition: integral_info.h:109
integral_info.h
Defines IntegralInfo object, providing the coefficients needed for integral evaluation.
simplePrimVintegral_list
ergo_real simplePrimVintegral_list(const DistributionSpecStruct *list, int nPrims, const Atom &atom, const IntegralInfo &integralInfo)
Definition: integrals_1el_potential.cc:1556
utilities.h
Basic OS access utilities.
ergo_CSR_add_to_element
int ergo_CSR_add_to_element(csr_matrix_struct *csr, int row, int col, ergo_real value)
Definition: csr_matrix.cc:252
A
#define A
LOG_CAT_INFO
#define LOG_CAT_INFO
Definition: output.h:49
template_blas_log
Treal template_blas_log(Treal x)
DistributionSpecStructWithIndexes2::distr
DistributionSpecStruct distr
Definition: integrals_1el_potential_prep.h:45
multipole_struct_small::noOfMoments
int noOfMoments
Definition: multipole_prep.h:65
BasisFuncStruct
Definition: basisinfo.h:85
integrals_1el.h
Code for 1-electron integrals; dense matrix variant of H_core matrix computation.
compute_V_hierarchical
int compute_V_hierarchical(const BasisInfoStruct &basisInfo, const IntegralInfo &integralInfo, const Molecule &molecule, ergo_real threshold, ergo_real boxSize, const basis_func_index_pair_struct_1el *basisFuncIndexPairList, int noOfBasisFuncIndexPairs, csr_matrix_struct *V_CSR, ergo_real &result_nuclearRepulsionEnergy)
Definition: integrals_1el_potential.cc:1415
compute_V_hierarchical
int compute_V_hierarchical(const BasisInfoStruct &basisInfo, const IntegralInfo &integralInfo, const Molecule &molecule, ergo_real threshold, ergo_real boxSize, const basis_func_index_pair_struct_1el *basisFuncIndexPairList, int noOfBasisFuncIndexPairs, csr_matrix_struct *V_CSR, ergo_real &result_nuclearRepulsionEnergy)
Definition: integrals_1el_potential.cc:1415
basisinfo.h
Code for setting up basis functions starting from shells.
BasisInfoStruct::basisFuncList
BasisFuncStruct * basisFuncList
Definition: basisinfo.h:121
basis_func_index_pair_struct_1el::index_1
int index_1
Definition: basis_func_pair_list_1el.h:49
atom_box_struct::basicBox
box_struct_basic basicBox
Definition: integrals_1el_potential.cc:96
integrals_hermite.h
Code for computation of Coulomb integrals of Hermite Gaussians, using the the McMurchie-Davidson sche...
init_multipole_struct_large
static void init_multipole_struct_large(multipole_struct_large &boxMultipole, const ergo_real *multipolePointCoords)
Definition: integrals_1el_potential.cc:149
LOG_AREA_INTEGRALS
#define LOG_AREA_INTEGRALS
Definition: output.h:60
JK::ExchWeights
Definition: integral_info.h:148
compute_multipole_moments
int compute_multipole_moments(const IntegralInfo &integralInfo, const DistributionSpecStruct *distr, multipole_struct_small *result)
Definition: multipole.cc:49
box_struct_basic::noOfChildBoxes
int noOfChildBoxes
Definition: box_system.h:58
multipole_struct_small::degree
int degree
Definition: multipole_prep.h:64
multipole_struct_small
Definition: multipole_prep.h:62
get_multipole_contribs_for_atom
static void get_multipole_contribs_for_atom(multipole_struct_large &boxMultipole, ergo_real *multipolePointCoords, const Atom &currAtom, const MMTranslator &translator)
Definition: integrals_1el_potential.cc:117
SetOfDistrsForV::groupList
std::vector< group_struct > groupList
Definition: integrals_1el_potential_prep.h:72
DistributionSpecStruct::monomialInts
char monomialInts[4]
nx, ny, nz
Definition: basisinfo.h:55
Atom::charge
ergo_real charge
Definition: molecule.h:52
DistributionSpecStructWithIndexes2
Definition: integrals_1el_potential_prep.h:44
MMLimitTable::get_minimum_multipole_degree_needed
int get_minimum_multipole_degree_needed(ergo_real distance, const multipole_struct_large *boxMultipole, int maxDegreeForDistrs, const ergo_real *maxMomentVectorNormForDistrsList, ergo_real threshold) const
Definition: mm_limit_table.cc:220
DistributionSpecStructWithIndexes
Definition: integrals_1el_potential.cc:451
DistributionSpecStruct::coeff
ergo_real coeff
Coefficient A.
Definition: basisinfo.h:51
box_struct_basic
Definition: box_system.h:53
Molecule
Representation of a molecule as a set of nuclei and total charge.
Definition: molecule.h:87
get_nucl_repulsion_energy_using_multipoles
static ergo_real get_nucl_repulsion_energy_using_multipoles(const Atom *atomListReordered, const int *atomPermutation, ergo_real threshold, const atom_box_struct *boxList, MMInteractor &interactor, int boxIndex1, int boxIndex2, int currLevel, int numberOfLevels)
Definition: integrals_1el_potential.cc:1006
SetOfDistrsForV::distrList
std::vector< DistributionSpecStructWithIndexes2 > distrList
Definition: integrals_1el_potential_prep.h:70
BoxSystem
Definition: box_system.h:71
multipole_struct_small::momentList
ergo_real momentList[MAX_NO_OF_MOMENTS_PER_MULTIPOLE_BASIC]
Definition: multipole_prep.h:66
Molecule::getAtomListPtr
const Atom * getAtomListPtr() const
Definition: molecule.h:112
MMTranslator::getTranslationMatrix
int getTranslationMatrix(ergo_real dx, ergo_real dy, ergo_real dz, int l_1, int l_2, ergo_real *result_W) const
Definition: multipole.cc:146
box_struct_basic::width
ergo_real width
Definition: box_system.h:55
atom_box_struct::multipole_moment_derivatives
ergo_real * multipole_moment_derivatives
Definition: integrals_1el_potential.cc:99
distance
static ergo_real distance(const ergo_real *a, const ergo_real *b)
Coomputes distance between two points, they do not need to be of the Vector3D type.
Definition: dft_common.cc:526
setup_multipole_maxAbsMomentList
int setup_multipole_maxAbsMomentList(multipole_struct_large *multipole)
Definition: multipole.cc:418
basis_func_index_pair_struct_1el
Definition: basis_func_pair_list_1el.h:48
Atom::coords
ergo_real coords[3]
Definition: molecule.h:53
compute_V_and_gradient_linear
int compute_V_and_gradient_linear(const BasisInfoStruct &basisInfo, const IntegralInfo &integralInfo, const Molecule &molecule, ergo_real threshold, ergo_real boxSize, const basis_func_index_pair_struct_1el *basisFuncIndexPairList, ergo_real *V_list, int noOfBasisFuncIndexPairs, bool compute_gradient_also, const ergo_real *D_list, ergo_real *result_gradient_list, ergo_real &result_nuclearRepulsionEnergy)
Definition: integrals_1el_potential.cc:1108
DistributionSpecStructWithIndexes::basisFuncIdx1
int basisFuncIdx1
Definition: integrals_1el_potential.cc:454
IntegralInfo::multiply_by_hermite_conversion_matrix_from_right
int multiply_by_hermite_conversion_matrix_from_right(int n1max, int n2max, ergo_real a, ergo_real *A, ergo_real *result) const
Definition: integral_info.cc:253
create_nuclei_mm_tree
static int create_nuclei_mm_tree(const IntegralInfo &integralInfo, int nAtoms, const Atom *atomList, ergo_real boxSize, BoxSystem &boxSystem, atom_box_struct **return_boxList, int *return_numberOfLevels, Atom **return_atomListReordered, int *return_atomPermutation, bool compute_gradient_also)
Definition: integrals_1el_potential.cc:159
do_output
void do_output(int logCategory, int logArea, const char *format,...)
Definition: output.cc:53
mm_limit_table.h
MMLimitTable class used to predict the magnitude of contributions when using truncated multipole expa...
SetOfDistrsForV::maxMomentVectorNormList
std::vector< maxMomentVectorNormStruct > maxMomentVectorNormList
Definition: integrals_1el_potential_prep.h:73
compute_V_matrix_full
int compute_V_matrix_full(const BasisInfoStruct &basisInfo, const IntegralInfo &integralInfo, int nAtoms, const Atom *atomList, ergo_real threshold, ergo_real *result)
Definition: integrals_1el_potential.cc:1570
organize_distrs_for_V
void organize_distrs_for_V(const IntegralInfo &integralInfo, SetOfDistrsForV &setOfDistrsForV, const std::vector< DistributionSpecStructWithIndexes2 > &inputList, ergo_real threshold, ergo_real maxCharge)
Definition: integrals_1el_potential_prep.cc:141
DistributionSpecStruct::exponent
ergo_real exponent
exponent alfa
Definition: basisinfo.h:52
compute_V_matrix_full
int compute_V_matrix_full(const BasisInfoStruct &basisInfo, const IntegralInfo &integralInfo, int nAtoms, const Atom *atomList, ergo_real threshold, ergo_real *result)
Definition: integrals_1el_potential.cc:1570
Util::TimeMeter
Time-measuring class.
Definition: utilities.h:80
output.h
Functionality for writing output messages to a text file.
DistributionSpecStructWithIndexes2::basisFuncIdx1
int basisFuncIdx1
Definition: integrals_1el_potential_prep.h:46
SetOfDistrsForV
Definition: integrals_1el_potential_prep.h:69
atom_box_struct
Definition: integrals_1el_potential.cc:95
BoxSystem::create_box_system
int create_box_system(box_item_struct *itemList, int noOfItems, ergo_real toplevelBoxSize)
Creates the box system.
Definition: box_system.cc:74
DistributionSpecStructWithIndexes::distr
DistributionSpecStruct distr
Definition: integrals_1el_potential.cc:452