ergo
integral_info.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 BASISINFO_BASIC_HEADER
39 #define BASISINFO_BASIC_HEADER
40 
41 
42 #include "realtype.h"
43 #include "monomial_info.h"
45 #include "boysfunction.h"
46 #include "multipole_prep.h"
47 #include "mm_limit_table.h"
48 
49 #ifndef BASIS_FUNC_POLY_MAX_DEGREE
50 #error The constant BASIS_FUNC_POLY_MAX_DEGREE must be defined.
51 #endif
52 #if BASIS_FUNC_POLY_MAX_DEGREE<6
53 #define MAX_NO_OF_TERMS_IN_BASIS_FUNC_POLY 12
54 #define MAX_NO_OF_POLY_12_TERMS 180
55 #define MAX_NO_OF_BASIS_FUNC_POLYS 50
56 #else
57 #define MAX_NO_OF_TERMS_IN_BASIS_FUNC_POLY 16
58 #define MAX_NO_OF_POLY_12_TERMS 360
59 #define MAX_NO_OF_BASIS_FUNC_POLYS 100
60 #endif
61 
62 typedef struct
63 {
65  char monomialInts[4]; /* nx, ny, nz */
68 
69 typedef struct
70 {
71  int noOfTerms;
75 
76 typedef struct
77 {
78  int id_1;
79  int id_2;
82 
83 typedef struct
84 {
85  int noOfTerms;
88 
94 {
95  private:
101  IntegralInfo(); // This is to make it forbidden to create it without argument.
102  public:
106  void init();
107  ergo_real BoysFunction(int n, ergo_real x) const;
108  ergo_real BoysFunction_expensive(int n, ergo_real x, int noOfIntegrationIntervals) const;
110  const MMLimitTable & GetMMLimitTable() const { return mmLimitTable; }
112  int n2max,
113  ergo_real a,
114  ergo_real* A,
115  ergo_real* result) const;
117  int n2max,
118  ergo_real a,
119  ergo_real* A,
120  ergo_real* result) const;
122  ergo_real a,
123  ergo_real* result) const;
125  ergo_real a,
126  ergo_real* result) const;
128  ergo_real a,
129  i_j_val_struct* result) const;
130 
131  IntegralInfo(bool initialize);
132  ~IntegralInfo();
133 
134  // Stuff needed for Chunks&Tasks usage
135  IntegralInfo(const IntegralInfo & ii);
136  void write_to_buffer ( char * dataBuffer, size_t const bufferSize ) const;
137  size_t get_size() const;
138  void assign_from_buffer ( char const * dataBuffer, size_t const bufferSize);
139 };
140 
141 
142 namespace JK {
143 /* Struct ExchWeights holds parameters for CAM-style range-separated HF
144  exchange. We use the following short-long range split
145  (alpha+beta*erf(mu*r))*HF_exchange.
146  */
148 {
155  alpha(0),
156  beta(0),
157  mu(0),
159  {}
160 
161 };
162 
163 }
164 
165 
166 int get_poly_info_from_shell_type(int* polyid_start, int* poly_count, int shellType);
167 
169 
171 
172 
173 #endif
template_blas_pow
Treal template_blas_pow(Treal x, Treal y)
BASIS_FUNC_POLY_MAX_DEGREE
#define BASIS_FUNC_POLY_MAX_DEGREE
Definition: polydegree.h:51
basis_func_poly_struct
Definition: integral_info.h:70
template_blas_sqrt
Treal template_blas_sqrt(Treal x)
IntegralInfo::GetMMLimitTable
const MMLimitTable & GetMMLimitTable() const
Definition: integral_info.h:110
JK::ExchWeights::mu
ergo_real mu
Definition: integral_info.h:151
realtype.h
Definition of the main floating-point datatype used; the ergo_real type.
BinCoeffs
static int BinCoeffs[NBIN *NBIN]
Definition: integral_info.cc:54
monomial_info_struct::write_to_buffer
void write_to_buffer(char *dataBuffer, size_t const bufferSize) const
Function needed for Chunks&Tasks usage.
Definition: monomial_info.cc:110
BoysFunctionManager::assign_from_buffer
void assign_from_buffer(char const *dataBuffer, size_t const bufferSize)
Function needed for Chunks&Tasks usage.
Definition: boysfunction.cc:303
basis_func_term_struct::monomialID
int monomialID
Definition: integral_info.h:66
multipole_prep.h
This file contains preparatory stuff for computing multipole moments and related things.
poly_12_term_struct::id_2
int id_2
Definition: integral_info.h:79
JK
Definition: integral_info.h:142
basis_func_poly_struct::noOfTerms
int noOfTerms
Definition: integral_info.h:71
memorymanag.h
Memory allocation/deallocation routines.
MMLimitTable::inittt
void inittt(const MultipolePrepManager &multipolePrep)
Definition: mm_limit_table.cc:65
hermite_conversion_prep.h
Code for conversion between integrals computed for Hermite Gaussians and Cartesian Gaussians,...
MultipolePrepManager::assign_from_buffer
void assign_from_buffer(char const *dataBuffer, size_t const bufferSize)
Definition: multipole_prep.cc:116
monomial_info_struct::init
void init()
Definition: monomial_info.cc:45
LOG_CAT_ERROR
#define LOG_CAT_ERROR
Definition: output.h:47
hermite_conversion_info_struct::write_to_buffer
void write_to_buffer(char *dataBuffer, size_t const bufferSize) const
Function needed for Chunks&Tasks usage.
Definition: hermite_conversion_prep.cc:372
poly_12_struct::noOfTerms
int noOfTerms
Definition: integral_info.h:85
ergo_real
double ergo_real
Definition: realtype.h:69
poly_12_term_struct
Definition: integral_info.h:77
IntegralInfo::get_hermite_conversion_matrix_right_sparse
int get_hermite_conversion_matrix_right_sparse(int nmax, ergo_real a, i_j_val_struct *result) const
Definition: integral_info.cc:281
IntegralInfo::boysFunctionManager
BoysFunctionManager boysFunctionManager
Definition: integral_info.h:96
boysfunction.h
Code for Boys function evaluation.
poly_12_struct
Definition: integral_info.h:84
BoysFunctionManager::BoysFunction_expensive
ergo_real BoysFunction_expensive(int n, ergo_real x, int noOfIntegrationIntervals, int method=0) const
Definition: boysfunction.cc:256
IntegralInfo::BoysFunction_expensive
ergo_real BoysFunction_expensive(int n, ergo_real x, int noOfIntegrationIntervals) const
Definition: integral_info.cc:249
IntegralInfo::multiply_by_hermite_conversion_matrix_from_left
int multiply_by_hermite_conversion_matrix_from_left(int n1max, int n2max, ergo_real a, ergo_real *A, ergo_real *result) const
Definition: integral_info.cc:261
MAX_NO_OF_TERMS_IN_BASIS_FUNC_POLY
#define MAX_NO_OF_TERMS_IN_BASIS_FUNC_POLY
Definition: integral_info.h:53
MultipolePrepManager
Definition: multipole_prep.h:69
get_real_solid_harmonic_poly
static int get_real_solid_harmonic_poly(int l, int m, basis_func_poly_struct *result)
Definition: integral_info.cc:87
BoysFunctionManager::get_size
size_t get_size() const
Function needed for Chunks&Tasks usage.
Definition: boysfunction.cc:298
hermite_conversion_info_struct::multiply_by_hermite_conversion_matrix_from_left
int multiply_by_hermite_conversion_matrix_from_left(const monomial_info_struct &monomial_info, int n1max, int n2max, ergo_real a, ergo_real *A, ergo_real *result) const
Definition: hermite_conversion_prep.cc:242
getBinCoeff
static int getBinCoeff(int i, int j)
Definition: integral_info.cc:70
mat_gblas.h
basis_func_term_struct::monomialInts
char monomialInts[4]
Definition: integral_info.h:65
JK::ExchWeights::alpha
ergo_real alpha
Definition: integral_info.h:149
BoysFunctionManager
Definition: boysfunction.h:73
MultipolePrepManager::write_to_buffer
void write_to_buffer(char *dataBuffer, size_t const bufferSize) const
Definition: multipole_prep.cc:105
BoysFunctionManager::init
void init()
Definition: boysfunction.cc:177
IntegralInfo::get_size
size_t get_size() const
Function needed for Chunks&Tasks usage.
Definition: integral_info.cc:365
IntegralInfo::monomial_info
monomial_info_struct monomial_info
Definition: integral_info.h:105
MAX_NO_OF_POLY_12_TERMS
#define MAX_NO_OF_POLY_12_TERMS
Definition: integral_info.h:54
basis_func_term_struct
Definition: integral_info.h:63
monomial_info_struct::get_size
size_t get_size() const
Function needed for Chunks&Tasks usage.
Definition: monomial_info.cc:130
MMLimitTable::write_to_buffer
void write_to_buffer(char *dataBuffer, size_t const bufferSize) const
Definition: mm_limit_table.cc:248
IntegralInfo::assign_from_buffer
void assign_from_buffer(char const *dataBuffer, size_t const bufferSize)
Function needed for Chunks&Tasks usage.
Definition: integral_info.cc:377
poly_12_term_struct::id_1
int id_1
Definition: integral_info.h:78
IntegralInfo::IntegralInfo
IntegralInfo()
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
JK::ExchWeights::beta
ergo_real beta
Definition: integral_info.h:150
hermite_conversion_info_struct::assign_from_buffer
void assign_from_buffer(char const *dataBuffer, size_t const bufferSize)
Function needed for Chunks&Tasks usage.
Definition: hermite_conversion_prep.cc:428
IntegralInfo
Contains coefficients needed for quick integral evaluation.
Definition: integral_info.h:94
hermite_conversion_info_struct::get_size
size_t get_size() const
Function needed for Chunks&Tasks usage.
Definition: hermite_conversion_prep.cc:408
BoysFunctionManager::write_to_buffer
void write_to_buffer(char *dataBuffer, size_t const bufferSize) const
Function needed for Chunks&Tasks usage.
Definition: boysfunction.cc:281
MMLimitTable::assign_from_buffer
void assign_from_buffer(char const *dataBuffer, size_t const bufferSize)
Definition: mm_limit_table.cc:259
MAX_NO_OF_BASIS_FUNC_POLYS
#define MAX_NO_OF_BASIS_FUNC_POLYS
Definition: integral_info.h:55
MMLimitTable
Definition: mm_limit_table.h:45
hermite_conversion_info_struct
Definition: hermite_conversion_prep.h:71
JK::ExchWeights::ExchWeights
ExchWeights()
Definition: integral_info.h:154
get_shell_type_from_basis_func_poly_id
int get_shell_type_from_basis_func_poly_id(int basfuncpolyid)
MMLimitTable::get_size
size_t get_size() const
Definition: mm_limit_table.cc:255
monomial_info.h
Code used to organize monomials; contributions like x, y, z, xy, xz etc. that can be used to describe...
basis_func_term_struct::coeff
ergo_real coeff
Definition: integral_info.h:64
IntegralInfo::GetMultipolePrep
const MultipolePrepManager & GetMultipolePrep() const
Definition: integral_info.h:109
integral_info.h
Defines IntegralInfo object, providing the coefficients needed for integral evaluation.
A
#define A
LOG_CAT_INFO
#define LOG_CAT_INFO
Definition: output.h:49
IntegralInfo::hermite_conversion_info
hermite_conversion_info_struct hermite_conversion_info
Definition: integral_info.h:99
monomial_info_struct::assign_from_buffer
void assign_from_buffer(char const *dataBuffer, size_t const bufferSize)
Function needed for Chunks&Tasks usage.
Definition: monomial_info.cc:138
IntegralInfo::get_hermite_conversion_matrix_right
int get_hermite_conversion_matrix_right(int nmax, ergo_real a, ergo_real *result) const
Definition: integral_info.cc:269
IntegralInfo::no_of_basis_func_polys
int no_of_basis_func_polys
Definition: integral_info.h:104
LOG_AREA_INTEGRALS
#define LOG_AREA_INTEGRALS
Definition: output.h:60
JK::ExchWeights
Definition: integral_info.h:148
setup_bin_coeffs
static void setup_bin_coeffs()
Definition: integral_info.cc:57
IntegralInfo::mmLimitTable
MMLimitTable mmLimitTable
Definition: integral_info.h:98
setup_basis_func_polys
int setup_basis_func_polys(IntegralInfo *b)
Definition: integral_info.cc:180
BoysFunctionManager::BoysFunction
ergo_real BoysFunction(int n, ergo_real x) const
Definition: boysfunction.cc:252
hermite_conversion_info_struct::get_hermite_conversion_matrix_right_sparse
int get_hermite_conversion_matrix_right_sparse(const monomial_info_struct &monomial_info, int nmax, ergo_real a, i_j_val_struct *result) const
Definition: hermite_conversion_prep.cc:295
IntegralInfo::get_hermite_conversion_matrix_left
int get_hermite_conversion_matrix_left(int nmax, ergo_real a, ergo_real *result) const
Definition: integral_info.cc:275
hermite_conversion_info_struct::get_hermite_conversion_matrix_right
int get_hermite_conversion_matrix_right(const monomial_info_struct &monomial_info, int nmax, ergo_real a, ergo_real *result) const
Definition: hermite_conversion_prep.cc:272
hermite_conversion_info_struct::multiply_by_hermite_conversion_matrix_from_right
int multiply_by_hermite_conversion_matrix_from_right(const monomial_info_struct &monomial_info, int n1max, int n2max, ergo_real a, ergo_real *A, ergo_real *result) const
Definition: hermite_conversion_prep.cc:212
JK::ExchWeights::computeRangeSeparatedExchange
int computeRangeSeparatedExchange
shortcut for |beta| != 0
Definition: integral_info.h:152
IntegralInfo::initialized
bool initialized
Definition: integral_info.h:100
hermite_conversion_info_struct::get_hermite_conversion_matrix_left
int get_hermite_conversion_matrix_left(const monomial_info_struct &monomial_info, int nmax, ergo_real a, ergo_real *result) const
Definition: hermite_conversion_prep.cc:320
monomial_info_struct
Definition: monomial_info.h:58
factorial
static ergo_real factorial(int n)
Definition: integral_info.cc:80
get_no_of_basis_func_polys_used_from_no_of_shell_types
int get_no_of_basis_func_polys_used_from_no_of_shell_types(int no_of_shell_types)
IntegralInfo::BoysFunction
ergo_real BoysFunction(int n, ergo_real x) const
Definition: integral_info.cc:243
IntegralInfo::basis_func_poly_list
basis_func_poly_struct basis_func_poly_list[MAX_NO_OF_BASIS_FUNC_POLYS]
Definition: integral_info.h:103
hermite_conversion_info_struct::init
void init(const monomial_info_struct &monomial_info)
Definition: hermite_conversion_prep.cc:56
get_poly_info_from_shell_type
int get_poly_info_from_shell_type(int *polyid_start, int *poly_count, int shellType)
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
MultipolePrepManager::init
void init()
Definition: multipole_prep.cc:79
NBIN
#define NBIN
Definition: integral_info.cc:53
do_output
void do_output(int logCategory, int logArea, const char *format,...)
Definition: output.cc:53
basis_func_poly_struct::termList
basis_func_term_struct termList[MAX_NO_OF_TERMS_IN_BASIS_FUNC_POLY]
Definition: integral_info.h:72
IntegralInfo::write_to_buffer
void write_to_buffer(char *dataBuffer, size_t const bufferSize) const
Function needed for Chunks&Tasks usage.
Definition: integral_info.cc:331
mm_limit_table.h
MMLimitTable class used to predict the magnitude of contributions when using truncated multipole expa...
poly_12_term_struct::coeff
ergo_real coeff
Definition: integral_info.h:80
IntegralInfo::init
void init()
Definition: integral_info.cc:287
MultipolePrepManager::get_size
size_t get_size() const
Definition: multipole_prep.cc:112
basis_func_poly_struct::scaledSolidHarmonicPrefactor
ergo_real scaledSolidHarmonicPrefactor
Definition: integral_info.h:73
i_j_val_struct
Definition: simple_sparse_mat.h:42
IntegralInfo::multipolePrep
MultipolePrepManager multipolePrep
Definition: integral_info.h:97
output.h
Functionality for writing output messages to a text file.
IntegralInfo::~IntegralInfo
~IntegralInfo()
Definition: integral_info.cc:312