MADNESS
0.10.1
|
a class for computing the first order wave function and MP2 pair energies More...
#include <mp2.h>
Classes | |
struct | Pairs |
POD holding all electron pairs with easy access. More... | |
struct | Parameters |
POD for MP2 keywords. More... | |
Public Member Functions | |
MP2 (World &world, const commandlineparser &parser) | |
ctor More... | |
double | asymmetry (const real_function_6d &f, const std::string s) const |
bool | check_core_valence_separation () const |
make sure frozen orbitals don't couple with correlated ones – relocalize if necessary More... | |
double | compute_gQf (const int i, const int j, ElectronPair &pair) const |
compute the matrix element <ij | g12 Q12 f12 | phi^0> More... | |
double | compute_gQf_cc2interface (const int i, const int j, const real_function_6d &f) const |
compute the matrix element <ij | g12 Q12 f12 | phi^0> More... | |
double | coord_chksum () const |
return a checksum for the geometry More... | |
real_function_6d | debug_cc2 (const real_function_6d &f, const size_t &i, const size_t &j) const |
void | enforce_core_valence_separation () |
make sure frozen orbitals don't couple with correlated ones – relocalize if necessary More... | |
HartreeFock & | get_hf () |
return the underlying HF reference More... | |
real_function_6d | get_residue (const real_function_6d &f, const int i, const int j) |
void | increment (ElectronPair &pair, real_convolution_6d &green) |
compute increments: psi^1 = C + GV C + GVGV C + GVGVGV C + .. More... | |
real_function_6d | iterate (const real_function_6d &f) const |
solve the residual equation for electron pair (i,j) More... | |
template<typename T , size_t NDIM> | |
void | load_function (Function< T, NDIM > &f, const std::string name) const |
load a function More... | |
std::string | name () const |
template<typename T > | |
void | print_options (const std::string option, const T val) const |
pretty print the options More... | |
template<typename T , size_t NDIM> | |
void | save_function (const Function< T, NDIM > &f, const std::string name) const |
save a function More... | |
virtual bool | selftest () |
double | solve_coupled_equations (Pairs< ElectronPair > &pairs, const double econv, const double dconv) const |
solve the coupled MP1 equations (e.g. for local orbitals) More... | |
void | solve_residual_equations (ElectronPair &pair, const double econv, const double dconv) const |
solve the residual equation for electron pair (i,j) More... | |
double | value () |
return the molecular correlation energy energy (without the HF energy) More... | |
double | value (const Tensor< double > &x) |
return the molecular correlation energy as a function of the coordinates More... | |
double | zeroth_order_energy (const int i, const int j) const |
return the 0th order energy of pair ij (= sum of orbital energies) More... | |
Public Member Functions inherited from madness::OptimizationTargetInterface | |
virtual | ~OptimizationTargetInterface () |
virtual Tensor< double > | gradient (const Tensor< double > &x) |
Should return the derivative of the function. More... | |
virtual bool | provides_gradient () const |
Override this to return true if the derivative is implemented. More... | |
double | test_gradient (Tensor< double > &x, double value_precision, bool doprint=true) |
Numerical test of the derivative ... optionally prints to stdout, returns max abs error. More... | |
virtual void | value_and_gradient (const Tensor< double > &x, double &value, Tensor< double > &gradient) |
Reimplement if more efficient to evaluate both value and gradient in one call. More... | |
Static Public Member Functions | |
static void | help () |
static void | print_parameters () |
Private Member Functions | |
void | add_local_coupling (const Pairs< ElectronPair > &pairs, Pairs< real_function_6d > &coupling) const |
add the coupling terms for local MP2 More... | |
real_function_6d | apply_exchange (const real_function_6d &f, const real_function_3d &orbital_ket, const real_function_3d &orbital_bra, const int particle) const |
apply the exchange operator on f More... | |
real_function_6d | apply_exchange_vector (const real_function_6d &f, const int particle) const |
double | compute_energy (ElectronPair &pair) const |
compute the singlet and triplet energy for a given electron pair More... | |
void | END_TIMER (World &world, const char *msg) const |
Tensor< double > | get_fock_matrix () const |
void | guess_mp1_3 (ElectronPair &pair) const |
compute the first iteration of the residual equations and all intermediates More... | |
real_function_3d | J (const real_function_3d &phi) const |
apply the Coulomb operator a on orbital More... | |
real_function_6d | JK1phi0_on_demand (const int i, const int j, const bool hc=false) const |
return the function (J(1)-K(1)) |phi0> as on-demand function More... | |
real_function_6d | JK2phi0_on_demand (const int i, const int j, const bool hc=false) const |
return the function (J(2)-K(2)) |phi0> as on-demand function More... | |
real_function_3d | K (const real_function_3d &phi, const bool hc=false) const |
apply the exchange operator on an orbital More... | |
real_function_6d | K (const real_function_6d &phi, const bool is_symmetric=false) const |
apply the exchange operator on a pair function More... | |
std::vector< real_function_3d > | make_chi (const real_function_3d &phi, const real_convolution_3d &op, const bool hc=false) const |
make the quantity chi_k More... | |
real_function_6d | make_fKphi0 (const int i, const int j) const |
apply the operator K on the reference and multiply with f; fK |phi^0> More... | |
real_function_6d | make_KffKphi0 (const ElectronPair &pair) const |
return the function [K,f] phi0; load from disk if available More... | |
ElectronPair | make_pair (const int i, const int j) const |
compute some matrix elements that don't change during the SCF More... | |
real_function_6d | make_Uphi0 (ElectronPair &pair) const |
return the function Uphi0; load from disk if available More... | |
std::vector< real_function_3d > | make_xi (const real_function_3d &phi_i, const real_function_3d &phi_j, const real_convolution_3d &op, const bool hc=false) const |
make the quantity xi_k More... | |
real_function_6d | multiply_with_0th_order_Hamiltonian (const real_function_6d &f, const int i, const int j) const |
multiply the given function with the 0th order Hamiltonian, exluding the 0th order energy More... | |
real_function_6d | nemo0_on_demand (const int i, const int j) const |
return the function |F1F2> as on-demand function More... | |
real_function_6d | phi0_on_demand (const int i, const int j) const |
return the function |phi0> as on-demand function More... | |
void | START_TIMER (World &world) const |
Private Attributes | |
double | coords_sum |
check sum for the geometry More... | |
double | correlation_energy |
the correlation energy More... | |
CorrelationFactor | corrfac |
correlation factor: Slater More... | |
Tensor< double > | fock |
the Fock matrix More... | |
std::shared_ptr< HartreeFock > | hf |
our reference More... | |
std::shared_ptr< NuclearCorrelationFactor > | nuclear_corrfac |
Pairs< ElectronPair > | pairs |
pair functions and energies More... | |
Parameters | param |
SCF parameters for MP2. More... | |
std::shared_ptr< real_convolution_3d > | poisson |
StrongOrthogonalityProjector< double, 3 > | Q12 |
double | sss |
double | ttt |
World & | world |
the world More... | |
a class for computing the first order wave function and MP2 pair energies
madness::MP2::MP2 | ( | World & | world, |
const commandlineparser & | parser | ||
) |
ctor
References madness::MP2::Parameters::check_input(), corrfac, madness::CoulombOperatorPtr(), dcut, madness::MP2::Parameters::freeze(), hf, pairs, param, poisson, madness::QCCalculationParametersBase::print(), madness::print(), madness::World::rank(), madness::MP2::Parameters::restart(), madness::FunctionDefaults< NDIM >::set_truncate_mode(), madness::MP2::Parameters::thresh(), and world.
|
private |
add the coupling terms for local MP2
\sum_{k\neq i} f_ki |u_kj> + \sum_{l\neq j} f_lj |u_il>
Referenced by solve_coupled_equations().
|
private |
apply the exchange operator on f
if the exchange operator is similarity transformed (R-1 K R) the orbital spaces differ for the orbitals underneath the integral sign R-1 K R = \phi-ket(1) * \int \phi-bra(1') * f(1',2)
[in] | f | the pair function |
[in] | orbital_bra | the orbital underneath the integral sign (typically R2orbitals) |
[in] | orbital_ket | the orbital to be pre-multiplied with (typically orbitals) |
|
private |
double madness::MP2::asymmetry | ( | const real_function_6d & | f, |
const std::string | s | ||
) | const |
References diff(), madness::f, madness::norm2(), madness::print(), madness::World::rank(), madness::swap_particles(), and world.
Referenced by make_Uphi0().
bool madness::MP2::check_core_valence_separation | ( | ) | const |
make sure frozen orbitals don't couple with correlated ones – relocalize if necessary
References madness::Localizer::check_core_valence_separation(), madness::MolecularOrbitals< T, NDIM >::convert_set_to_slice(), madness::MP2::Parameters::freeze(), get_fock_matrix(), madness::MolecularOrbitals< T, NDIM >::get_localize_sets(), hf, param, madness::MolecularOrbitals< T, NDIM >::pretty_print(), madness::print(), and madness::MolecularOrbitals< T, NDIM >::recompute_localize_sets().
Referenced by value().
|
private |
compute the singlet and triplet energy for a given electron pair
Referenced by increment(), solve_coupled_equations(), and solve_residual_equations().
double madness::MP2::compute_gQf | ( | const int | i, |
const int | j, | ||
ElectronPair & | pair | ||
) | const |
compute the matrix element <ij | g12 Q12 f12 | phi^0>
scales quartically. I think I can get this down to cubically by setting Q12 = (1 - O1)(1 - O2) = 1- O1(1 - 0.5 O2) - O2 (1 - 0.5 O1) as for the formulas cf the article mra_molecule
References a, bsh_eps, corrfac, madness::CoulombOperator(), e(), madness::f, madness::g, hf, madness::ElectronPair::i, madness::inner(), madness::ElectronPair::j, k, lo, make_xi(), madness::matrix_inner(), madness::OT_F12, madness::OT_G12, param, madness::constants::pi, poisson, madness::print(), Q12, madness::World::rank(), madness::CCTimer::reset(), madness::SlaterF12Operator(), timer(), madness::Tensor< T >::trace(), and world.
Referenced by compute_gQf_cc2interface(), and iterate().
|
inline |
compute the matrix element <ij | g12 Q12 f12 | phi^0>
scales quartically. I think I can get this down to cubically by setting Q12 = (1 - O1)(1 - O2) = 1- O1(1 - 0.5 O2) - O2 (1 - 0.5 O1) as for the formulas cf the article mra_molecule
References compute_gQf(), madness::ElectronPair::constant_term, madness::copy(), madness::f, and madness::ElectronPair::function.
|
inline |
|
inline |
References madness::f, and multiply_with_0th_order_Hamiltonian().
|
inlineprivate |
References madness::cpu_time(), madness::World::rank(), sss, ttt, madness::wall_time(), and world.
Referenced by solve_coupled_equations().
void madness::MP2::enforce_core_valence_separation | ( | ) |
make sure frozen orbitals don't couple with correlated ones – relocalize if necessary
References madness::Localizer::check_core_valence_separation(), madness::Tensor< T >::clear(), fock, get_fock_matrix(), hf, madness::Localizer::localize(), MADNESS_CHECK, madness::print(), madness::MolecularOrbitals< T, NDIM >::recompute_localize_sets(), madness::Localizer::set_enforce_core_valence_separation(), madness::Localizer::set_method(), madness::Localizer::set_metric(), and world.
Referenced by value().
|
inlineprivate |
References madness::copy(), fock, madness::Tensor< T >::has_data(), hf, madness::print(), madness::World::rank(), and world.
Referenced by check_core_valence_separation(), and enforce_core_valence_separation().
|
inline |
return the underlying HF reference
References hf.
|
inline |
|
private |
compute the first iteration of the residual equations and all intermediates
Referenced by solve_residual_equations().
|
inlinestatic |
References madness::print(), and madness::print_header2().
void madness::MP2::increment | ( | ElectronPair & | pair, |
real_convolution_6d & | green | ||
) |
compute increments: psi^1 = C + GV C + GVGV C + GVGVGV C + ..
for pre-optimization of the mp1 wave function no restart option here for now param[inout] pair the electron pair param[in] green the Green's function
apply the convolution
References compute_energy(), madness::ElectronPair::function, madness::ElectronPair::i, madness::ElectronPair::iteration, madness::ElectronPair::j, madness::load_balance(), load_function(), multiply_with_0th_order_Hamiltonian(), madness::Function< T, NDIM >::norm2(), madness::print(), madness::Function< T, NDIM >::print_size(), Q12, madness::World::rank(), madness::Function< T, NDIM >::scale(), madness::Function< T, NDIM >::thresh(), madness::Function< T, NDIM >::truncate(), madness::wall_time(), and world.
|
inline |
solve the residual equation for electron pair (i,j)
References compute_gQf(), madness::ElectronPair::constant_term, madness::copy(), madness::f, madness::ElectronPair::function, madness::ElectronPair::ij_gQf_ij, madness::ElectronPair::ji_gQf_ij, and solve_residual_equations().
|
private |
|
private |
return the function (J(1)-K(1)) |phi0> as on-demand function
[in] | hc | compute hermitian conjugate -> swap bra and ket space |
|
private |
return the function (J(2)-K(2)) |phi0> as on-demand function
|
private |
apply the exchange operator on an orbital
[in] | phi | the orbital |
[in] | hc | hermitian conjugate -> swap bra and ket space |
|
private |
apply the exchange operator on a pair function
[in] | phi | the pair function |
[in] | is_symmetric | is the function symmetric wrt particle exchange |
void madness::MP2::load_function | ( | Function< T, NDIM > & | f, |
const std::string | name | ||
) | const |
load a function
References madness::f, name(), madness::print(), madness::World::rank(), and world.
Referenced by increment().
|
private |
make the quantity chi_k
chi is the Poisson kernel applied on an orbital product of the input function and the vector of orbitals
if hc
[in] | phi | orbital phi_i |
[in] | op | the operator in SeparatedConvolution form |
[in] | hc | compute hermitian conjugate -> pass the correct phi! |
|
private |
apply the operator K on the reference and multiply with f; fK |phi^0>
[in] | i | index of orbital i |
[in] | j | index of orbital j |
|
private |
return the function [K,f] phi0; load from disk if available
|
private |
|
private |
return the function Uphi0; load from disk if available
References a, aa, asymmetry(), axis, madness::copy(), corrfac, diff(), e(), madness::error(), madness::Function< T, NDIM >::fill_cuspy_tree(), madness::CompositeFactory< T, NDIM, MDIM >::g12(), madness::FunctionDefaults< NDIM >::get_thresh(), hf, madness::ElectronPair::i, madness::inner(), madness::ElectronPair::j, MADNESS_EXCEPTION, madness::SeparatedConvolution< Q, NDIM >::modified(), madness::CompositeFactory< T, NDIM, MDIM >::particle1(), madness::CompositeFactory< T, NDIM, MDIM >::particle2(), madness::print(), madness::Function< T, NDIM >::print_size(), madness::World::rank(), madness::scale(), madness::Function< T, NDIM >::set_thresh(), thresh, madness::FunctionFactory< T, NDIM >::thresh(), madness::truncate(), world, and zeroth_order_energy().
|
private |
make the quantity xi_k
xi is chi multiplied with an orbital j
if hc
[in] | phi_i | orbital i |
[in] | phi_j | orbital j |
[in] | op | the operator in SeparatedConvolution form |
[in] | hc | compute hermitian conjugate -> pass the correct phi! |
Referenced by compute_gQf().
|
private |
multiply the given function with the 0th order Hamiltonian, exluding the 0th order energy
[in] | f | the function we apply H^0 on |
Referenced by debug_cc2(), get_residue(), increment(), solve_coupled_equations(), and solve_residual_equations().
|
inlinevirtual |
Implements madness::QCPropertyInterface.
Referenced by load_function(), save_function(), and solve_residual_equations().
|
private |
return the function |F1F2> as on-demand function
|
private |
return the function |phi0> as on-demand function
|
inline |
pretty print the options
invoke only in (world.rank()==0) !!
|
inlinestatic |
void madness::MP2::save_function | ( | const Function< T, NDIM > & | f, |
const std::string | name | ||
) | const |
save a function
References madness::f, name(), madness::print(), madness::World::rank(), and world.
Referenced by solve_residual_equations().
|
inlinevirtual |
Implements madness::QCPropertyInterface.
double madness::MP2::solve_coupled_equations | ( | Pairs< ElectronPair > & | pairs, |
const double | econv, | ||
const double | dconv | ||
) | const |
solve the coupled MP1 equations (e.g. for local orbitals)
solve the coupled MP1 equations for local orbitals
[in] | pairs | set of (coupled) electron pairs to solve |
[in] | econv | energy convergence criterion (for all pairs) |
[in] | dconv | density convergence criterion (for all pairs) |
[in] | pairs | solved decoupled electron pairs |
References std::abs(), add_local_coupling(), bsh_eps, compute_energy(), END_TIMER(), energy, madness::MP2::Parameters::freeze(), hf, lo, madness::MP2::Parameters::maxiter(), multiply_with_0th_order_Hamiltonian(), pairs, param, Q12, madness::World::rank(), residual(), madness::Function< T, NDIM >::scale(), START_TIMER(), madness::stringify(), madness::Function< T, NDIM >::truncate(), madness::truncate(), madness::wall_time(), world, and zeroth_order_energy().
Referenced by value().
void madness::MP2::solve_residual_equations | ( | ElectronPair & | pair, |
const double | econv, | ||
const double | dconv | ||
) | const |
solve the residual equation for electron pair (i,j)
References std::abs(), bsh_eps, compute_energy(), madness::ElectronPair::constant_term, madness::ElectronPair::converged, madness::SeparatedConvolution< Q, NDIM >::destructive(), madness::NonlinearSolverND< NDIM >::do_print, energy, madness::ElectronPair::function, guess_mp1_3(), madness::ElectronPair::i, madness::ElectronPair::iteration, madness::ElectronPair::j, lo, madness::load_balance(), madness::MP2::Parameters::maxiter(), madness::MP2::Parameters::maxsub(), multiply_with_0th_order_Hamiltonian(), name(), madness::MP2::Parameters::no_compute(), madness::Function< T, NDIM >::norm2(), param, madness::print(), madness::ElectronPair::print_energy(), madness::Function< T, NDIM >::print_size(), Q12, madness::World::rank(), residual(), save_function(), madness::Function< T, NDIM >::scale(), madness::ElectronPair::store_pair(), madness::stringify(), madness::Function< T, NDIM >::truncate(), madness::truncate(), madness::NonlinearSolverND< NDIM >::update(), madness::wall_time(), world, and zeroth_order_energy().
|
inlineprivate |
References madness::cpu_time(), madness::WorldGopInterface::fence(), madness::World::gop, sss, ttt, madness::wall_time(), and world.
Referenced by solve_coupled_equations().
double madness::MP2::value | ( | ) |
return the molecular correlation energy energy (without the HF energy)
References check_core_valence_separation(), enforce_core_valence_separation(), and hf.
|
virtual |
return the molecular correlation energy as a function of the coordinates
Implements madness::OptimizationTargetInterface.
References coord_chksum(), coords_sum, correlation_energy, madness::MP2::Parameters::dconv(), madness::MP2::Parameters::econv(), madness::MP2::Parameters::freeze(), hf, madness::MP2::Parameters::i(), madness::MP2::Parameters::j(), MADNESS_CHECK, make_pair(), madness::MP2::Parameters::no_compute(), madness::NuclearCorrelationFactor::None, nuclear_corrfac, pairs, param, madness::print(), Q12, madness::World::rank(), madness::StrongOrthogonalityProjector< T, NDIM >::set_spaces(), solve_coupled_equations(), solve_residual_equations(), madness::Tensor< T >::sumsq(), and world.
|
inline |
return the 0th order energy of pair ij (= sum of orbital energies)
References hf.
Referenced by make_Uphi0(), solve_coupled_equations(), and solve_residual_equations().
|
private |
check sum for the geometry
Referenced by coord_chksum(), and value().
|
private |
the correlation energy
Referenced by value().
|
private |
correlation factor: Slater
Referenced by MP2(), compute_gQf(), and make_Uphi0().
|
mutableprivate |
the Fock matrix
Referenced by enforce_core_valence_separation(), and get_fock_matrix().
|
private |
|
private |
Referenced by get_residue(), and value().
|
private |
pair functions and energies
Referenced by MP2(), solve_coupled_equations(), and value().
|
private |
|
private |
Referenced by MP2(), and compute_gQf().
|
private |
Referenced by compute_gQf(), get_residue(), increment(), solve_coupled_equations(), solve_residual_equations(), and value().
|
private |
Referenced by END_TIMER(), and START_TIMER().
|
mutableprivate |
Referenced by END_TIMER(), and START_TIMER().
|
private |
the world
Referenced by MP2(), madness::MP2::Parameters::Parameters(), asymmetry(), compute_gQf(), END_TIMER(), enforce_core_valence_separation(), get_fock_matrix(), get_residue(), increment(), load_function(), make_Uphi0(), madness::MP2::Parameters::read_and_set_derived_values(), save_function(), solve_coupled_equations(), solve_residual_equations(), START_TIMER(), and value().