MADNESS 0.10.1
|
class for holding the parameters for calculation More...
#include <QCCalculationParametersBase.h>
Public Member Functions | |
bool | file_exists (World &world, std::string filename) const |
void | from_json (const json &j) |
template<typename T > | |
T | get (const std::string key) const |
ParameterContainerT | get_all_parameters () const |
QCParameter & | get_parameter (const std::string key) |
hashT | hash () const |
bool | is_user_defined (std::string key) const |
bool | operator== (const QCCalculationParametersBase &other) const |
bool | parameter_exists (const std::string &key) const |
void | print (const std::string header="", const std::string footer="") const |
print all parameters | |
std::string | print_to_string (bool non_defaults_only=false) const |
virtual void | read_internal (World &world, std::string &filecontents, std::string tag) |
read the stream, starting from tag | |
template<typename Archive > | |
void | serialize (Archive &ar) |
template<typename T > | |
void | set_derived_value (const std::string &key, const T &value) |
template<typename T > | |
void | set_user_defined_value (const std::string &key, const T &value) |
json | to_json () const |
void | to_json (json &j) const |
Static Public Member Functions | |
static std::string | add_quotes (const std::string arg) |
template<typename T > | |
static bool | check_type (const std::string key, const QCParameter ¶meter) |
template<typename T > | |
static bool | check_type_silent (const QCParameter ¶meter) |
template<typename T > | |
static std::enable_if<!std::is_same< T, bool >::value, T >::type | fromstring (const std::string &arg) |
template<typename T > | |
static std::enable_if< std::is_same< T, bool >::value, T >::type | fromstring (const std::string &arg) |
template<typename T > | |
static std::enable_if< std::is_floating_point< T >::value, void >::type | overwrite_if_inf (std::string &str, const T &arg) |
template<typename T > | |
static std::enable_if<!std::is_floating_point< T >::value, void >::type | overwrite_if_inf (std::string &str, const T &arg) |
template<typename T > | |
static std::enable_if< std::is_same< T, std::string >::value, T >::type | read_quotes (std::stringstream &ssvalue) |
template<typename T > | |
static std::enable_if<!std::is_same< T, std::string >::value, T >::type | read_quotes (std::stringstream &ssvalue) |
static std::string | tostring (const bool &arg) |
template<typename T > | |
static std::string | tostring (const T &arg) |
static std::string | trim_blanks (const std::string arg) |
static std::string | trim_quotes (const std::string arg) |
Protected Types | |
typedef std::map< std::string, QCParameter > | ParameterContainerT |
Protected Member Functions | |
QCCalculationParametersBase () | |
ctor for testing | |
QCCalculationParametersBase (const QCCalculationParametersBase &other) | |
copy ctor | |
virtual | ~QCCalculationParametersBase () |
destructor | |
const QCParameter & | get_parameter (const std::string key) const |
template<typename T > | |
void | initialize (const std::string &key, const T &value, const std::string comment="", const std::vector< T > allowed_values={}) |
virtual void | read_input_and_commandline_options (World &world, const commandlineparser &parser, const std::string tag) |
template<typename T > | |
bool | try_setting_user_defined_value (const std::string &key, const std::string &val) |
Protected Attributes | |
bool | ignore_unknown_keys =true |
bool | ignore_unknown_keys_silently =false |
ParameterContainerT | parameters |
bool | print_debug =false |
bool | throw_if_datagroup_not_found =true |
Private Member Functions | |
void | read_commandline_options (World &world, const commandlineparser &parser, const std::string tag) |
read the parameters from the command line and broadcast | |
void | read_input (World &world, const std::string filename, const std::string tag) |
read the parameters from file | |
class for holding the parameters for calculation
Actual parameter classes will be derived from this class with a simple constructor (see test_QCCalculationParametersBase.cc for an example) and convenience getters for the parameters of each parameter class. Having the base class will allow consistent parameter input/output handling for all madness programs and reuse of the parsing methods. Even if the same parameter is used in different programs, default might differ (i.e. econv for 3D/6D calculations). The parameter class will effectively serve as a factory for the calculation classes (SCF, nemo, mp2, etc)
parameters are kept in a map with key (string) and value (QCParameter), types are converted whenever a parameter is accessed (i.e. should not be done too frequently in an inner loop)
|
protected |
|
inlineprotected |
ctor for testing
|
inlineprotected |
copy ctor
|
inlineprotectedvirtual |
destructor
|
inlinestatic |
References madness::arg().
Referenced by get().
|
inlinestatic |
|
inlinestatic |
References madness::QCParameter::get_type(), and T().
bool madness::QCCalculationParametersBase::file_exists | ( | World & | world, |
std::string | filename | ||
) | const |
References madness::WorldGopInterface::broadcast_serializable(), file_exists(), madness::filename, madness::World::gop, and madness::World::rank().
Referenced by file_exists(), and read_input_and_commandline_options().
|
inline |
References get_parameter(), madness::QCParameter::set_user_defined_value(), and tostring().
|
inlinestatic |
References madness::arg(), errmsg(), T(), and tostring().
|
inlinestatic |
References madness::arg(), errmsg(), and T().
|
inline |
References add_quotes(), get_parameter(), madness::QCParameter::get_value(), and MADNESS_ASSERT.
Referenced by madness::OEP::OEP(), madness::Nemo::compute_all_cphf(), madness::F12Potentials::compute_hylleraas_f12_energies(), madness::SCF::do_plots(), madness::Molecule::get_structure(), madness::Nemo::hessian(), madness::SCF::initial_guess(), madness::SCF::is_spin_restricted(), operator==(), madness::SCF::save_mos(), madness::SCF::solve(), and test_lowrank_function().
|
inline |
References parameters.
Referenced by madness::Molecule::read().
|
inline |
References parameter_exists(), parameters, and madness::print().
|
inlineprotected |
References parameter_exists(), and parameters.
Referenced by TestCalculationParameters::copy_and_replace_key_in_parameters(), TestCalculationParameters::extend_parameters(), from_json(), get(), is_user_defined(), read_internal(), set_derived_value(), set_user_defined_value(), and try_setting_user_defined_value().
|
inline |
References madness::hash_range(), and parameters.
|
inlineprotected |
|
inline |
References get_parameter(), and madness::QCParameter::is_user_defined().
Referenced by madness::Molecule::GeometryParameters::set_derived_values().
|
inline |
References get(), p(), and parameters.
|
inlinestatic |
References madness::arg().
Referenced by tostring().
|
inlinestatic |
|
inline |
References parameters.
Referenced by get_parameter(), get_parameter(), and read_internal().
void madness::QCCalculationParametersBase::print | ( | const std::string | header = "" , |
const std::string | footer = "" |
||
) | const |
print all parameters
References madness::print(), and print_to_string().
Referenced by madness::Molecule::Molecule(), madness::MP2::MP2(), madness::MP2::Parameters::Parameters(), madness::Zcis::Zcis(), madness::Znemo::Znemo(), main(), main(), madness::MP2::print_parameters(), madness::Nemo::print_parameters(), madness::OEP::print_parameters(), madness::PNO::print_parameters(), madness::SCF::print_parameters(), madness::Znemo::print_parameters(), madness::OEP::print_parameters(), madness::OEP_Parameters::set_derived_values(), madness::PNO::solve(), madness::TDHF::test(), test_Kcommutator(), test_lowrank_function(), test_molecular_grid(), and test_serialize().
std::string madness::QCCalculationParametersBase::print_to_string | ( | bool | non_defaults_only = false | ) | const |
References madness::QCParameter::def, p(), param, and parameters.
Referenced by madness::Molecule::print(), and print().
|
private |
read the parameters from the command line and broadcast
syntax is: qcprogram –mp2='maxiter 10; freeze 1' –dft:maxiter=20 –Xmpi:debug=true the argument in quotes is the value of the parser keys
References madness::WorldGopInterface::broadcast_serializable(), madness::World::gop, madness::commandlineparser::key_exists(), q(), madness::World::rank(), read_internal(), and madness::commandlineparser::value().
Referenced by read_input_and_commandline_options().
|
private |
read the parameters from file
read the parameters from file and broadcast
only world.rank()==0 reads the input file and broadcasts to all other nodes, so we don't need to serialize the ParameterMap
References madness::WorldGopInterface::broadcast_serializable(), e(), errmsg(), madness::f, madness::filename, madness::World::gop, madness::World::rank(), and read_internal().
Referenced by read_input_and_commandline_options().
|
inlineprotectedvirtual |
Reimplemented in madness::ResponseParameters, and madness::CalculationParameters.
References e(), file_exists(), madness::commandlineparser::key_exists(), madness::print(), read_commandline_options(), read_input(), and madness::commandlineparser::value().
Referenced by madness::CCParameters::CCParameters(), madness::Complex_CIS_Parameters::Complex_CIS_Parameters(), DiracParameters::DiracParameters(), madness::F12Parameters::F12Parameters(), madness::Molecule::GeometryParameters::GeometryParameters(), madness::MolecularOptimizationParameters::MolecularOptimizationParameters(), madness::Nemo_complex_Parameters::Nemo_complex_Parameters(), madness::OEP_Parameters::OEP_Parameters(), madness::PlotParameters::PlotParameters(), madness::PNOParameters::PNOParameters(), madness::PNOParameters::PNOParameters(), madness::TDHF::TDHFParameters::TDHFParameters(), madness::MP2::Parameters::read_and_set_derived_values(), madness::LowRankFunctionParameters::read_and_set_derived_values(), and Parameters::read_and_set_derived_values().
|
virtual |
read the stream, starting from tag
only parameters that are defined in the constructor will be processed, all others will be discarded.
References e(), errmsg(), madness::f, get_parameter(), madness::QCParameter::get_type(), ignore_unknown_keys, ignore_unknown_keys_silently, parameter_exists(), madness::position_stream_to_word(), madness::print(), print_debug, and madness::World::rank().
Referenced by read_commandline_options(), and read_input().
|
inlinestatic |
References madness::arg(), errmsg(), T(), trim_blanks(), and trim_quotes().
|
inlinestatic |
References T().
|
inline |
References parameters, and print_debug.
|
inline |
References get_parameter(), madness::QCParameter::set_derived_value(), and tostring().
Referenced by madness::OEP::OEP(), madness::Znemo::Znemo(), madness::Nemo::NemoCalculationParameters::initialize_nemo_parameters(), main(), madness::CCPairFunction< T, NDIM >::op_dec_to_dec(), madness::TDHF::prepare_calculation(), madness::MP2::Parameters::read_and_set_derived_values(), Parameters::read_and_set_derived_values(), madness::CCParameters::set_derived_values(), madness::F12Parameters::set_derived_values(), madness::Nemo_complex_Parameters::set_derived_values(), madness::Molecule::GeometryParameters::set_derived_values(), madness::PNOParameters::set_derived_values(), madness::CalculationParameters::set_derived_values(), madness::OEP_Parameters::set_derived_values(), madness::TDHF::TDHFParameters::set_derived_values(), and madness::CC2::solve().
|
inline |
References get_parameter(), madness::QCParameter::set_user_defined_value(), and tostring().
Referenced by madness::CalculationParameters::CalculationParameters(), main(), madness::Molecule::GeometryParameters::set_global_convenience_options(), madness::PlotParameters::set_npoints(), madness::PlotParameters::set_origin(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::set_orthomethod(), madness::PlotParameters::set_plane(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::set_radius(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::set_rank_revealing_tol(), madness::LowRankFunctionFactory< T, NDIM, LDIM >::set_volume_element(), madness::PlotParameters::set_zoom(), madness::TDHF::test(), madness::Molecule::update_rcut_with_eprec(), and madness::MolecularEnergy::value().
|
inline |
References p(), and parameters.
Referenced by madness::operator==(), madness::SCF::output_calc_info_schema(), and TEST_CASE().
|
inline |
Adds the response parameters to an existing json under key "parameters"
j |
References p(), and parameters.
|
inlinestatic |
References madness::arg().
Referenced by TestCalculationParameters::extend_parameters(), from_json(), fromstring(), set_derived_value(), and set_user_defined_value().
|
inlinestatic |
References madness::arg(), and overwrite_if_inf().
|
inlinestatic |
References madness::arg().
Referenced by read_quotes().
|
inlinestatic |
References madness::arg().
Referenced by read_quotes().
|
inlineprotected |
References get_parameter(), madness::name(), madness::print(), print_debug, and T().
|
protected |
Referenced by madness::Molecule::GeometryParameters::GeometryParameters(), and read_internal().
|
protected |
Referenced by madness::Molecule::GeometryParameters::GeometryParameters(), and read_internal().
|
protected |
Referenced by get_all_parameters(), get_parameter(), get_parameter(), hash(), operator==(), parameter_exists(), print_to_string(), serialize(), to_json(), and to_json().
|
protected |
Referenced by read_internal(), serialize(), and try_setting_user_defined_value().
|
protected |
Referenced by madness::Molecule::GeometryParameters::GeometryParameters().