MADNESS 0.10.1
madness::CC2 Class Reference

#include <CC2.h>

Inheritance diagram for madness::CC2:
Collaboration diagram for madness::CC2:

Public Member Functions

 CC2 (World &world, const CCParameters &cc_param, const TDHFParameters &tdhf_param, const LowRankFunctionParameters &lrfparam, const std::shared_ptr< const Nemo > nemo)
 CC2 (World &world_, const commandlineparser &parser, const std::shared_ptr< Nemo > nemo_)
virtual ~CC2 ()
bool check_core_valence_separation (const Tensor< double > &fmat) const
double compute_mp3 (const Pairs< CCPair > &mp2pairs, const Info &info) const
Tensor< double > enforce_core_valence_separation (const Tensor< double > &fmat)
 make sure the orbitals are block diagonalized
void initialize ()
bool initialize_pairs (Pairs< CCPair > &pairs, const CCState ftype, const CalcType ctype, const CC_vecfunction &tau, const CC_vecfunction &x, const size_t extitation, const Info &info) const
 read pairs from file or initialize new ones
bool iterate_adc2_pairs (Pairs< CCPair > &cispd, const CC_vecfunction &ccs)
bool iterate_adc2_singles (Pairs< CCPair > &mp2, CC_vecfunction &singles, Pairs< CCPair > &x, Info &info)
bool iterate_ccs_singles (CC_vecfunction &x, Info &info) const
bool iterate_pair (CCPair &pair, const CC_vecfunction &singles=CC_vecfunction(UNDEFINED)) const
 Iterates a pair of the CC2 doubles equations.
std::string name () const
void output_calc_info_schema (const std::string model, const double &energy) const
void plot (const real_function_3d &f, const std::string &msg="unspecified function") const
virtual bool selftest ()
nlohmann::json solve ()
 solve the CC2 ground state equations, returns the correlation energy
double solve_cc2 (CC_vecfunction &tau, Pairs< CCPair > &u, Info &info) const
std::vector< CC_vecfunction > solve_ccs () const
double solve_cispd (Pairs< CCPair > &doubles, const Pairs< CCPair > &mp2_pairs, const CC_vecfunction &cis_singles)
std::tuple< Pairs< CCPair >, CC_vecfunction, double > solve_lrcc2 (Pairs< CCPair > &gs_doubles, const CC_vecfunction &gs_singles, const CC_vecfunction &cis, const std::size_t excitation, Info &info) const
 solve the excited state LR-CC2 equations for a given excitation
double solve_mp2_coupled (Pairs< CCPair > &doubles, Info &info)
bool update_constant_part_adc2 (const CC_vecfunction &ccs, CCPair &pair)
bool update_constant_part_cispd (const CC_vecfunction &ccs, CCPair &pair)
double value ()
double value (const Tensor< double > &x)
 Should return the value of the objective function.
Public Member Functions inherited from madness::OptimizationTargetInterface
virtual ~OptimizationTargetInterface ()
virtual Tensor< double > gradient (const Tensor< double > &x)
 Should return the derivative of the function.
virtual bool provides_gradient () const
 Override this to return true if the derivative is implemented.
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.
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.

Static Public Member Functions

static double compute_cc2_energy (const CC_vecfunction &singles, const Pairs< CCPair > &pairs, const Info &info, const std::string msg="")
 compute the CC2 correlation energy
static double compute_cc2_energy (const CC_vecfunction &singles, const std::vector< CCPair > &pairs, const Info &info, const std::string msg="")
static Pairs< real_function_6d > compute_local_coupling (const Pairs< real_function_6d > &pairs, const Info &info)
 add the coupling terms for local MP2
static Pairs< real_function_6d > compute_local_coupling (const std::vector< CCPair > &vpairs, const Info &info)
 forward to the other function (converting CCPair to real_function)
static std::vector< real_function_3d > compute_local_coupling (const std::vector< real_function_3d > &singles, const Info &info)
 compute the coupling of singles function if orbitals are localized
static double compute_mp2_energy (const Pairs< CCPair > &pairs, const Info &info, const std::string msg="")
 compute the MP2 correlation energy
static double compute_mp2_energy (const std::vector< CCPair > &pairs, const Info &info, const std::string msg="")
static void help ()
static CC_vecfunction initialize_singles (World &, const CalcType &ctype, const FuncType type, int ex=-1)
 read singles from file or initialize new ones
static CC_vecfunction initialize_singles_to_zero (World &world, const CalcType &ctype, const FuncType type, const Info &info)
static bool iterate_cc2_singles (World &world, CC_vecfunction &singles, Pairs< CCPair > &doubles, Info &info)
static bool iterate_lrcc2_pairs (World &world, const CC_vecfunction &cc2_s, const CC_vecfunction lrcc2_s, Pairs< CCPair > &lrcc2_d, const Info &info)
static bool iterate_lrcc2_singles (World &world, const CC_vecfunction &cc2_s, Pairs< CCPair > &cc2_d, CC_vecfunction &lrcc2_s, Pairs< CCPair > lrcc2_d, Info &info)
static bool iterate_singles (World &world, CC_vecfunction &singles, const CC_vecfunction singles2, const Pairs< CCPair > &gs_doubles, const Pairs< CCPair > &ex_doubles, const CalcType ctype, const std::size_t maxiter, Info &info)
static void print_parameters ()
static std::string singles_name (const CalcType &ctype, const FuncType &type, int ex=-1)
 return the file name for singles

Public Attributes

CCPotentials CCOPS
 The CC Operator Class.
LowRankFunctionParameters lrfparameters
std::shared_ptr< const Nemo > nemo
 The SCF Calculation.
CCMessenger & output
 Formated Output (same as used in CC2Potentials structure).
CCParameters parameters
 Structure holds all the parameters used in the CC2 calculation.
std::shared_ptr< TDHF > tdhf
 The excited state cis calculation.
PairVectorMap triangular_map
 map Pair struct to vector
World & world
 The World.

Constructor & Destructor Documentation

◆ CC2() [1/2]

madness::CC2::CC2 ( World & world,
const CCParameters & cc_param,
const TDHFParameters & tdhf_param,
const LowRankFunctionParameters & lrfparam,
const std::shared_ptr< const Nemo > nemo )
inline

◆ CC2() [2/2]

madness::CC2::CC2 ( World & world_,
const commandlineparser & parser,
const std::shared_ptr< Nemo > nemo_ )
inline

◆ ~CC2()

virtual madness::CC2::~CC2 ( )
inlinevirtual

Member Function Documentation

◆ check_core_valence_separation()

◆ compute_cc2_energy() [1/2]

double madness::CC2::compute_cc2_energy ( const CC_vecfunction & singles,
const Pairs< CCPair > & pairs,
const Info & info,
const std::string msg = "" )
static

◆ compute_cc2_energy() [2/2]

double madness::CC2::compute_cc2_energy ( const CC_vecfunction & singles,
const std::vector< CCPair > & pairs,
const Info & info,
const std::string msg = "" )
static

◆ compute_local_coupling() [1/3]

Pairs< real_function_6d > madness::CC2::compute_local_coupling ( const Pairs< real_function_6d > & pairs,
const Info & info )
static

add the coupling terms for local MP2

\sum_{k\neq i} f_ki |u_kj> + \sum_{l\neq j} f_lj |u_il>

Returns
\sum_{k\neq i} f_ki |u_kj> + \sum_{l\neq j} f_lj |u_il>

References madness::Pairs< T >::allpairs, madness::copy(), madness::FunctionDefaults< NDIM >::k, madness::FunctionDefaults< NDIM >::thresh, madness::FunctionDefaults< NDIM >::get_thresh(), madness::Pairs< T >::insert(), MADNESS_EXCEPTION, q(), madness::swap_particles(), and world.

◆ compute_local_coupling() [2/3]

Pairs< real_function_6d > madness::CC2::compute_local_coupling ( const std::vector< CCPair > & vpairs,
const Info & info )
inlinestatic

◆ compute_local_coupling() [3/3]

std::vector< real_function_3d > madness::CC2::compute_local_coupling ( const std::vector< real_function_3d > & singles,
const Info & info )
inlinestatic

compute the coupling of singles function if orbitals are localized

Returns
the coupling terms c_i = -\sum_(j\neq i) f_ij |\phi_j> (for whatever phi is)

References madness::BaseTensor::dim(), MADNESS_CHECK_THROW, madness::transform(), and world.

◆ compute_mp2_energy() [1/2]

double madness::CC2::compute_mp2_energy ( const Pairs< CCPair > & pairs,
const Info & info,
const std::string msg = "" )
static

compute the MP2 correlation energy

References compute_cc2_energy(), and madness::PARTICLE.

Referenced by solve(), and solve_mp2_coupled().

◆ compute_mp2_energy() [2/2]

double madness::CC2::compute_mp2_energy ( const std::vector< CCPair > & pairs,
const Info & info,
const std::string msg = "" )
static

◆ compute_mp3()

double madness::CC2::compute_mp3 ( const Pairs< CCPair > & mp2pairs,
const Info & info ) const
inline

◆ enforce_core_valence_separation()

◆ help()

void madness::CC2::help ( )
inlinestatic

◆ initialize()

◆ initialize_pairs()

bool madness::CC2::initialize_pairs ( Pairs< CCPair > & pairs,
const CCState ftype,
const CalcType ctype,
const CC_vecfunction & tau,
const CC_vecfunction & x,
const size_t extitation,
const Info & info ) const

◆ initialize_singles()

CC_vecfunction madness::CC2::initialize_singles ( World & world,
const CalcType & ctype,
const FuncType type,
int ex = -1 )
static

read singles from file or initialize new ones

type: PARTICLE (cc2) or RESPONSE (lrcc2) default_to_zero: if true, initialize with zero functions, otherwise return empty vector ex: if type is RESPONSE, the excitation number

References madness::CC_vecfunction::load_restartdata(), MADNESS_CHECK_THROW, madness::PARTICLE, madness::print(), singles_name(), and world.

Referenced by solve(), and solve_lrcc2().

◆ initialize_singles_to_zero()

CC_vecfunction madness::CC2::initialize_singles_to_zero ( World & world,
const CalcType & ctype,
const FuncType type,
const Info & info )
static

◆ iterate_adc2_pairs()

◆ iterate_adc2_singles()

bool madness::CC2::iterate_adc2_singles ( Pairs< CCPair > & mp2,
CC_vecfunction & singles,
Pairs< CCPair > & x,
Info & info )
inline

◆ iterate_cc2_singles()

bool madness::CC2::iterate_cc2_singles ( World & world,
CC_vecfunction & singles,
Pairs< CCPair > & doubles,
Info & info )
inlinestatic

convencience function to iterate the CC2 ground state singles, makes the right call on the iterate_singles functions

References madness::CT_CC2, iterate_singles(), madness::RESPONSE, and world.

Referenced by solve(), and solve_cc2().

◆ iterate_ccs_singles()

bool madness::CC2::iterate_ccs_singles ( CC_vecfunction & x,
Info & info ) const
inline

convenience function to iterate the CCS Response singles, makes the right call on the iterate_singles functions

References madness::CT_LRCCS, iterate_singles(), madness::PARTICLE, and world.

Referenced by solve(), and solve_lrcc2().

◆ iterate_lrcc2_pairs()

◆ iterate_lrcc2_singles()

bool madness::CC2::iterate_lrcc2_singles ( World & world,
const CC_vecfunction & cc2_s,
Pairs< CCPair > & cc2_d,
CC_vecfunction & lrcc2_s,
Pairs< CCPair > lrcc2_d,
Info & info )
inlinestatic

◆ iterate_pair()

◆ iterate_singles()

bool madness::CC2::iterate_singles ( World & world,
CC_vecfunction & singles,
const CC_vecfunction singles2,
const Pairs< CCPair > & gs_doubles,
const Pairs< CCPair > & ex_doubles,
const CalcType ctype,
const std::size_t maxiter,
Info & info )
static

Iterates the singles equations for CCS, CC2, LRCC2 The corresponding regulairzation tails of the doubles are updated in every iteration (therefore doubles are not marked as const)

Parameters
[in]singles, the singles that are iterated
[in]singles2, additional set of singles for potential (in LRCC2 this are the Ground State singles)
[in]gs_doubles, Ground State doubles (Needed for CC2 and LRCC2)
[in]ex_doubles, Excited State doubles (Needed for LRCC2)
[in]ctype: the calculation type: CCS, CC2, CC2_response_
[in]maxiter: maxmial number of iterations
[out]

true if the overall change of the singles is below 10*donv_6D

References std::abs(), madness::CCSize::add(), madness::Pairs< T >::allpairs, madness::apply(), madness::assign_name(), bsh_eps, madness::BSHOperatorPtr3D(), madness::CCPotentials::compute_cis_expectation_value(), compute_local_coupling(), madness::copy(), madness::CT_ADC2, madness::CT_CC2, madness::CT_CISPD, madness::CT_LRCC2, madness::CT_LRCCS, madness::CT_MP2, madness::CT_TEST, madness::CC_vecfunction::functions, G, madness::CC_vecfunction::get_vecfunction(), madness::CCTimer::info(), initialize_singles_to_zero(), madness::inner(), MADNESS_ASSERT, MADNESS_EXCEPTION, maxiter, madness::CC_vecfunction::name(), norm(), madness::norm2(), madness::CC_vecfunction::omega, omega, output, p(), madness::Pairs< T >::pairs2vector(), madness::PARTICLE, madness::CCSize::print(), madness::print(), madness::print_header2(), madness::print_size(), Q(), madness::reconstruct(), residual(), madness::RESPONSE, madness::scale(), madness::CC_vecfunction::size(), madness::sub(), madness::Tensor< T >::sum(), triangular_map, madness::PairVectorMap::triangular_map(), madness::truncate(), madness::CC_vecfunction::type, V(), and world.

Referenced by iterate_adc2_singles(), iterate_cc2_singles(), iterate_ccs_singles(), and iterate_lrcc2_singles().

◆ name()

std::string madness::CC2::name ( ) const
inlinevirtual

◆ output_calc_info_schema()

void madness::CC2::output_calc_info_schema ( const std::string model,
const double & energy ) const

References energy, nemo, and world.

Referenced by solve().

◆ plot()

void madness::CC2::plot ( const real_function_3d & f,
const std::string & msg = "unspecified function" ) const
inline

◆ print_parameters()

void madness::CC2::print_parameters ( )
inlinestatic

◆ selftest()

virtual bool madness::CC2::selftest ( )
inlinevirtual

◆ singles_name()

std::string madness::CC2::singles_name ( const CalcType & ctype,
const FuncType & type,
int ex = -1 )
inlinestatic

return the file name for singles

References madness::assign_name(), and madness::name().

Referenced by initialize_singles(), solve_cc2(), and solve_lrcc2().

◆ solve()

nlohmann::json madness::CC2::solve ( )

solve the CC2 ground state equations, returns the correlation energy

References a, madness::Pairs< T >::allpairs, madness::assign_name(), b, c, CCOPS, check_core_valence_separation(), compute_cc2_energy(), compute_mp2_energy(), compute_mp3(), madness::copy(), madness::CT_ADC2, madness::CT_CC2, madness::CT_CISPD, madness::CT_LRCC2, madness::CT_LRCCS, madness::CT_MP2, madness::CT_MP3, madness::Localizer::determine_frozen_orbitals(), enforce_core_valence_separation(), madness::EXCITED_STATE, function(), madness::FunctionDefaults< NDIM >::k, madness::GROUND_STATE, madness::CCTimer::info(), initialize_pairs(), initialize_singles(), iterate_adc2_pairs(), iterate_adc2_singles(), iterate_cc2_singles(), iterate_ccs_singles(), MADNESS_CHECK, MADNESS_EXCEPTION, nemo, madness::CC_vecfunction::omega, madness::CISResults::excitation_info::omega, omega, output, output_calc_info_schema(), p(), parameters, madness::PARTICLE, madness::POT_singles_, madness::print(), madness::MolecularOrbitals< T, NDIM >::print_frozen_orbitals(), madness::print_header1(), madness::print_header2(), madness::print_header3(), madness::printf_msg_energy_time(), madness::RESPONSE, madness::CC2Results::set_energies(), madness::FunctionDefaults< NDIM >::set_thresh(), madness::CC_vecfunction::size(), solve_cc2(), solve_ccs(), solve_cispd(), solve_lrcc2(), solve_mp2_coupled(), tdhf, triangular_map, madness::PairVectorMap::triangular_map(), madness::wall_time(), world, and madness::zero_functions().

Referenced by value().

◆ solve_cc2()

◆ solve_ccs()

std::vector< CC_vecfunction > madness::CC2::solve_ccs ( ) const

References MADNESS_EXCEPTION, parameters, and tdhf.

Referenced by solve().

◆ solve_cispd()

◆ solve_lrcc2()

std::tuple< Pairs< CCPair >, CC_vecfunction, double > madness::CC2::solve_lrcc2 ( Pairs< CCPair > & gs_doubles,
const CC_vecfunction & gs_singles,
const CC_vecfunction & cis,
const std::size_t excitation,
Info & info ) const

solve the excited state LR-CC2 equations for a given excitation

Parameters
[in]gs_doublesthe ground state doubles
[in]gs_singlesthe ground state singles
[in]cisthe CIS singles
[in]excitationthe excitation number
Returns
a tuple with the excited state doubles, the excited state singles and the excitation energy

read LRCC2 singles from file or use the CIS vectors as guess

References madness::assign_name(), madness::copy(), madness::CT_LRCC2, madness::CT_LRCCS, madness::CCTimer::current_time(), madness::EXCITED_STATE, madness::filename, madness::constants::hartree_electron_volt_relationship, initialize_pairs(), initialize_singles(), iterate_ccs_singles(), iterate_lrcc2_pairs(), iterate_lrcc2_singles(), madness::CC_vecfunction::omega, output, parameters, madness::print(), madness::print_header2(), madness::RESPONSE, singles_name(), madness::wall_time(), and world.

Referenced by solve().

◆ solve_mp2_coupled()

◆ update_constant_part_adc2()

◆ update_constant_part_cispd()

◆ value() [1/2]

double madness::CC2::value ( )
inline

References nemo, and value().

Referenced by value().

◆ value() [2/2]

double madness::CC2::value ( const Tensor< double > & x)
inlinevirtual

Should return the value of the objective function.

Implements madness::OptimizationTargetInterface.

References solve().

Member Data Documentation

◆ CCOPS

◆ lrfparameters

LowRankFunctionParameters madness::CC2::lrfparameters

Referenced by CC2(), and CC2().

◆ nemo

◆ output

CCMessenger& madness::CC2::output

Formated Output (same as used in CC2Potentials structure).

Referenced by CC2(), CC2(), initialize(), iterate_adc2_pairs(), iterate_pair(), iterate_singles(), plot(), solve(), solve_cc2(), solve_cispd(), and solve_lrcc2().

◆ parameters

◆ tdhf

std::shared_ptr<TDHF> madness::CC2::tdhf

The excited state cis calculation.

Referenced by CC2(), CC2(), solve(), and solve_ccs().

◆ triangular_map

PairVectorMap madness::CC2::triangular_map

◆ world


The documentation for this class was generated from the following files: