Class BaseIntegrals
Defined in File base_integrals.hpp
Class Documentation
-
class BaseIntegrals
Class for calculating and storing ao/ri integrals for density-fitted UW12 calculations
Density-fitting a two-electron integral is usually performed using:
\[(\mu\nu|\rho\sigma) = \sum_{AB} J_{\mu\nu, A}^{0} [ J_2^{-1} ]_{A,B} J_{B, \rho\sigma}^{0} \]where \(J_{\mu\nu, A}^{0} = (\mu\nu | A)\) are the three-index integrals in the space of the density-fitting basisA.For numerical stability, the two-index integrals in the UW12 approximation are decomposed as:
\[J_2^{-1} = J_2^{-1} J_2 J_2^{-1} = J_2^{-1} Q \Lambda Q^{T} J_2^{-1} \]where \(\Lambda, Q\) are the matrices of eigenvalues and eigenvectors of \(J_2\). By setting \(P_2 = J_2^{-1} Q = Q \Lambda^{-1}\). The two-electron integrals may be evaluated as:\[(\mu\nu | \rho\sigma) = \sum_{A} J_{\mu\nu}^A \Lambda_{A} J_{\rho\sigma}^B \]where \(J_{\mu\nu}^A = \sum_B J_{\mu\nu, B}^0 P_{BA}\) are the three-index integrals in the eigen-space ofA.This class can be used to calculate and store the integrals
J3( \(J_{\mu\nu}^{A}\)),P2( \(J_2^{-1} Q\)), and the eigenvaluesdf_vals( \(\Lambda_A\)). In addition, if using the density-fitted RI approach, the RI analogue ofJ3may also be accessed.If the original
J3_0integrals are given, these will be stored and used to calculate the transformedJ3integrals when requested.Unless supplied, no three-index integrals are stored unless requested.
Public Functions
-
BaseIntegrals()
Default constructor.
-
BaseIntegrals(const TwoIndexFn &two_index_fn, const ThreeIndexFn &three_index_fn, const ThreeIndexFn &three_index_ri_fn, const std::vector<size_t> &df_sizes, size_t n_ao, size_t n_df, size_t n_ri, bool store_ao_integrals = true, bool store_ri_integrals = true)
Standard constructor using functions to calculate integrals.
-
BaseIntegrals(const TwoIndexFn &two_index_fn, const ThreeIndexFn &three_index_fn, const std::vector<size_t> &df_sizes, size_t n_ao, size_t n_df, bool store_ao_integrals = true)
Wrapper for above constructor with no ri.
-
BaseIntegrals(const linalg::Mat &J3_0, const linalg::Mat &J2, const ThreeIndexFn &three_index_ri, const std::vector<size_t> &df_sizes, bool use_ri, size_t n_ao, size_t n_df, size_t n_ri, bool store_ri_integrals = false)
Constructor used if the standard three-index integrals
J3_0and the two-index density-fitting integrals are already calculated. In this case,J2is immediately decomposed intoP2anddf_vals, andJ3_0is stored.
-
BaseIntegrals(const linalg::Mat &J3_0, const linalg::Mat &J2, const linalg::Mat &J3_ri_0)
Constructor used if the standard three-index integrals
J3_0and the two-index density-fitting integrals are already calculated. As well as the ri integrals J3_ri_0. In this case,J2is immediately decomposed intoP2anddf_vals, andJ3_0is stored.
-
BaseIntegrals(const linalg::Mat &J3_0, const linalg::Mat &J2)
Wrapper for previous constructor without ri.
-
BaseIntegrals(const linalg::Mat &J3, const linalg::Vec &df_vals)
Constructor if the three-index integrals in the density-fitting eigenspace are already available. Since no basis sets or projection matrix
P2can be specified, this constructor cannot be used for RI.
-
linalg::Mat two_index() const
Call the two_index_fn to return the two-index density fitting integrals \((A|w|B)\), the resulting square matrix should be of size
n_df * n_dfwheren_dfis the number of density_fitting basis functions
-
linalg::Mat three_index(size_t A) const
Call the three_index_fn to obtain the three index density-fitting integrals in the ao basis for the density-fitting basis shell index
AThe resulting matrix should have
n_ao * (n_ao + 1) / 2rows andnAcolumns, wheren_aois the number of ao basis functions andnAis the number of basis functions in density-fitting basis shellA.Each column contains the upper triangular elements of a real symmetric matrix of size
n_ao * n_ao, the full matrix may be obtained usinglinalg::square.- Parameters
A – Index of density-fitting shell
- Returns
Density-fitting integrals \((\rho\sigma | w | A)\)
-
linalg::Mat three_index_ri(size_t A) const
Call the three_index_fn to obtain the three index density-fitting ri integrals in the ao basis and ri basis for the density-fitting basis shell index
AThe resulting matrix should have
n_ri * n_aorows andnAcolumns, wheren_aois the number of ao basis functions,n_riis the number of ri basis functions andnAis the number of basis functions in density-fitting basis shellA.Each column contains a matrix of size
n_ri * n_ao.- Parameters
A – Index of density-fitting shell
- Returns
Density-fitting ri integrals \((\mu\rho | w | A)\)
-
bool has_two_index_fn() const
Check whether a
two_index_fnis provided.
-
bool has_three_index_fn() const
Check whether a
three_index_fnis provided.
-
bool has_three_index_ri_fn() const
Check whether a
three_index_ri_fnis provided.
-
const linalg::Mat &get_P2() const
Return the projection matrix
P2. If not already calculated, the two-index matrixJ2is calculated and decomposed intoP2anddf_vals.
-
const std::vector<size_t> &get_df_sizes() const
Obtain the vector of density-fitting basis set shell sizes.
-
std::vector<size_t> get_df_offsets() const
Obtain the vector of density-fitting basis set shell offsets. This vector is determined using
df_sizesand is of lengthn_shfor number of df basis set shells. Th vector determines the first column index in the finalJ3matrix where the first column of a given df shell is assigned.
-
const linalg::Vec &get_df_vals() const
Return the density-fitting eigenvalues
df_vals. If not already calculated, the two-index matrixJ2is calculated and decomposed intoP2anddf_vals.
-
const linalg::Mat &get_J3_0() const
Return the three-index integrals
J3in the original space of density-fitting function. If stored, a reference to the shared pointer is returned, otherwise an error is thrown.
-
const linalg::Mat &get_J3() const
Return the three-index integrals
J3in the space of density-fitting eigenvalues. If stored, a reference to the shared pointer is returned. If not stored, the integrals are calculated. IfJ3_0is stored, this is transformed to the space ofdf_vals.
-
const linalg::Mat &get_J3_ri_0() const
Return the three-index integrals
J3_riin the original space of density-fitting functions. If stored, a reference to the shared pointer is returned, otherwise an error is thrown.
-
const linalg::Mat &get_J3_ri() const
Return the three-index ri integrals
J3_riin the space of density-fitting eigenvalues. If stored, a reference to the shared pointer is returned. If not stored, the integrals are calculated and stored.The size of the
ribasis can be large, storing these integrals should be avoided for large systems.
-
size_t get_number_ao() const
Get the number of ao basis functions.
-
size_t get_number_df() const
Get the number of df basis functions.
-
size_t get_number_ri() const
Get the number of ri basis functions.
-
bool storing_ri() const
Check whether
riintegrals should be stored. If false a warning is given when callingget_J3_ri
-
bool storing_ao() const
Check whether
aointegrals should be stored. If false a warning is given when callingget_J3_ao.
-
bool has_P2() const
Check whether
P2is stored.
-
bool has_df_vals() const
Check whether
df_valsis stored.
-
bool has_J3_0() const
Check whether the standard density-fitting integrals in the space of the density-fitting basis set.
-
bool has_J3() const
Check whether
J3is stored.
-
bool has_J3_ri() const
Check whether
J3_riis stored.
-
bool has_J3_ri_0() const
Check whether
J3_ri_0is stored.
-
BaseIntegrals()