MADNESS 0.10.1
CCParameters.h
Go to the documentation of this file.
1//
2// Created by Florian Bischoff on 04.06.25.
3//
4
5#ifndef CCPARAMETER_H
6#define CCPARAMETER_H
7
10#include <madness/world/world.h>
11
12namespace madness {
13 /// Calculation Types used by CC2
17
18 /// Calculation TDHFParameters for CC2 and TDA calculations
19 /// Maybe merge this with calculation_parameters of SCF at some point, or split into TDA and CC
21 static constexpr char const* tag = "cc2";
22
23
27
28 /// copy constructor
29 CCParameters(const CCParameters& other) =default;
30
31 /// ctor reading out the input file
32 CCParameters(World& world, const commandlineparser& parser) {
34 read_input_and_commandline_options(world,parser,"cc2");
36 };
37 std::string get_tag() const override {
38 return std::string(tag);
39 }
40
41
43 double thresh=1.e-3;
44 double thresh_operators=1.e-6;
45 initialize < std::string > ("calc_type", "mp2", "the calculation type", {"mp2", "mp3", "cc2", "cis", "lrcc2", "cispd", "adc2", "test"});
46 initialize < double > ("lo", 1.e-7, "the finest length scale to be resolved by 6D operators");
47 initialize < double > ("dmin", 1.0, "defines the depth of the special level");
48 initialize < double > ("thresh_6d", thresh, "threshold for the 6D wave function");
49 initialize < double > ("tight_thresh_6d", 0.1*thresh, "tight threshold for the 6D wave function");
50 initialize < double > ("thresh_3d", 0.01*thresh, "threshold for the 3D reference wave function");
51 initialize < double > ("tight_thresh_3d", 0.001*thresh, "tight threshold for the 3D reference wave function");
52 initialize < double > ("thresh_bsh_3d", thresh_operators, "threshold for BSH operators");
53 initialize < double > ("thresh_bsh_6d", thresh_operators, "threshold for BSH operators");
54 initialize < double > ("thresh_poisson", thresh_operators, "threshold for Poisson operators");
55 initialize < double > ("thresh_f12", thresh_operators, "threshold for Poisson operators");
56 initialize < double > ("thresh_Ue", thresh_operators, "ue threshold");
57 initialize < double > ("econv", thresh, "overal convergence threshold ");
58 initialize < double > ("econv_pairs", 0.1*thresh, "convergence threshold for pairs");
59 initialize < double > ("dconv_3d", 0.3*thresh, "convergence for cc singles");
60 initialize < double > ("dconv_6d", 3.0*thresh, "convergence for cc doubles");
61 initialize < std::size_t > ("iter_max", 10, "max iterations");
62 initialize < std::size_t > ("iter_max_3d", 10, "max iterations for singles");
63 initialize < std::size_t > ("iter_max_6d", 10, "max iterations for doubles");
64 initialize < std::pair<int, int>> ("only_pair", {-1, -1}, "compute only a single pair");
65 initialize < bool > ("restart", false, "restart");
66 initialize < bool > ("no_compute", false, "no compute");
67 initialize < bool > ("no_compute_gs", false, "no compute");
68 initialize < bool > ("no_compute_mp2_constantpart", false, "no compute");
69 initialize < bool > ("no_compute_response", false, "no compute");
70 initialize < bool > ("no_compute_mp2", false, "no compute");
71 initialize < bool > ("no_compute_cc2", false, "no compute");
72 initialize < bool > ("no_compute_cispd", false, "no compute");
73 initialize < bool > ("no_compute_lrcc2", false, "no compute");
74 initialize < double > ("corrfac_gamma", 1.0, "exponent for the correlation factor");
75 initialize < std::size_t > ("output_prec", 8, "for formatted output");
76 initialize < bool > ("debug", false, "");
77 initialize < std::string > ("cp_diagnostics", "none", "cross-check constant-part intermediates",{"none","final","full"});
78 initialize < bool > ("plot", false, "");
79 initialize < bool > ("kain", true, "");
80 initialize < std::size_t > ("kain_subspace", 3, "");
81 initialize < long > ("freeze", -1, "number of frozen orbitals: -1: automatic");
82 initialize < bool > ("test", false, "");
83 // choose if Q for the constant part of MP2 and related calculations should be decomposed: GQV or GV - GO12V
84 initialize < bool > ("decompose_Q", true, "always true",{true});
85 // if true the ansatz for the CC2 ground state pairs is |tau_ij> = |u_ij> + Qtf12|titj>, with Qt = Q - |tau><phi|
86 // if false the ansatz is the same with normal Q projector
87 // the response ansatz is the corresponding response of the gs ansatz
88 initialize < bool > ("QtAnsatz", true, "always true",{true});
89 // a vector containing the excitations which shall be optizmized later (with CIS(D) or CC2)
91 ("excitations", {}, "vector containing the excitations");
92 initialize<std::string>("KffK_algorithm", "lrf_split_alpha", "algorithm for KffK commutator", {"lrf_split_alpha", "lrf_direct", "6d"});
93 initialize<double>("KffK_alpha", 100.0,"max exponent in g12");
94 initialize<double>("KffK_volume_element", 0.2,"volume element for exchange commutator");
95 }
96
97 void set_derived_values();
98
100 std::string value = get<std::string>("calc_type");
101 if (value == "mp2") return CT_MP2;
102 if (value == "mp3") return CT_MP3;
103 if (value == "cc2") return CT_CC2;
104 if (value == "cis") return CT_LRCCS;
105 if (value == "lrcc2") return CT_LRCC2;
106 if (value == "cispd") return CT_CISPD;
107 if (value == "adc2") return CT_ADC2;
108 if (value == "test") return CT_TEST;
109 MADNESS_EXCEPTION("faulty CalcType", 1);
110 }
111
112 bool response() const {return calc_type()==CT_ADC2 or calc_type()==CT_CISPD or calc_type()==CT_LRCC2 or calc_type()==CT_LRCCS;}
113 double lo() const { return get<double>("lo"); }
114
115 double dmin() const { return get<double>("dmin"); }
116
117 double thresh_3D() const { return get<double>("thresh_3d"); }
118
119 double tight_thresh_3D() const { return get<double>("tight_thresh_3d"); }
120
121 double thresh_6D() const { return get<double>("thresh_6d"); }
122
123 double tight_thresh_6D() const { return get<double>("tight_thresh_6d"); }
124
125 double thresh_bsh_3D() const { return get<double>("thresh_bsh_3d"); }
126
127 double thresh_bsh_6D() const { return get<double>("thresh_bsh_6d"); }
128
129 double thresh_poisson() const { return get<double>("thresh_poisson"); }
130
131 double thresh_f12() const { return get<double>("thresh_f12"); }
132
133 double thresh_Ue() const { return get<double>("thresh_ue"); }
134
135 double econv() const { return get<double>("econv"); }
136
137 double econv_pairs() const { return get<double>("econv_pairs"); }
138
139 double dconv_3D() const { return get<double>("dconv_3d"); }
140
141 double dconv_6D() const { return get<double>("dconv_6d"); }
142
143 std::size_t iter_max() const { return get<std::size_t>("iter_max"); }
144
145 std::size_t iter_max_3D() const { return get<std::size_t>("iter_max_3d"); }
146
147 std::size_t iter_max_6D() const { return get<std::size_t>("iter_max_6d"); }
148
149 std::pair<int, int> only_pair() const { return get<std::pair<int, int>>("only_pair"); }
150
151 bool restart() const { return get<bool>("restart"); }
152
153 bool no_compute() const { return get<bool>("no_compute"); }
154
155 bool no_compute_gs() const { return get<bool>("no_compute_gs"); }
156
157 bool no_compute_mp2_constantpart() const { return get<bool>("no_compute_mp2_constantpart"); }
158
159 bool no_compute_response() const { return get<bool>("no_compute_response"); }
160
161 bool no_compute_mp2() const { return get<bool>("no_compute_mp2"); }
162
163 bool no_compute_cc2() const { return get<bool>("no_compute_cc2"); }
164
165 bool no_compute_cispd() const { return get<bool>("no_compute_cispd"); }
166
167 bool no_compute_lrcc2() const { return get<bool>("no_compute_lrcc2"); }
168
169 bool debug() const { return get<bool>("debug"); }
170
171 std::string cp_diagnostics() const { return get<std::string>("cp_diagnostics"); }
172
173 bool plot() const { return get<bool>("plot"); }
174
175 bool kain() const { return get<bool>("kain"); }
176
177 bool test() const { return get<bool>("test"); }
178
179 bool decompose_Q() const { return get<bool>("decompose_q"); }
180
181 bool QtAnsatz() const { return get<bool>("qtansatz"); }
182
183 std::size_t output_prec() const { return get<std::size_t>("output_prec"); }
184
185 std::size_t kain_subspace() const { return get<std::size_t>("kain_subspace"); }
186
187 long freeze() const { return get<long>("freeze"); }
188
189 std::vector<std::size_t> excitations() const { return get<std::vector<std::size_t>>("excitations"); }
190
191 double gamma() const {return get<double>("corrfac_gamma");}
192
193 double kffk_alpha() const { return get<double>("kffk_alpha");}
194 double kffk_volume_element() const { return get<double>("kffk_volume_element");}
195
196 std::string kffk_algorithm() const { return get<std::string>("kffk_algorithm"); }
197
198 /// print out the parameters
199 void information(World& world) const;
200
201 /// check if parameters are set correct
202 void sanity_check(World& world) const;
203
204 void error(World& world, const std::string& msg) const {
205 if (world.rank() == 0)
206 std::cout << "\n\n\n\n\n!!!!!!!!!\n\nERROR IN CC_PARAMETERS:\n ERROR MESSAGE IS: " << msg
207 << "\n\n\n!!!!!!!!" << std::endl;
208 MADNESS_EXCEPTION("ERROR IN CC_PARAMETERS", 1);
209 }
210
211 size_t warning(World& world, const std::string& msg) const {
212 if (world.rank() == 0) std::cout << "WARNING IN CC_PARAMETERS!: " << msg << std::endl;
213 return 1;
214 }
215
216 };
217} // namespace madness
218
219#endif //CCPARAMETER_H
void read_input_and_commandline_options(World &world, const commandlineparser &parser, const std::string tag)
Definition chem/QCCalculationParametersBase.h:339
T get(const std::string key) const
Definition chem/QCCalculationParametersBase.h:313
void initialize(const std::string &key, const T &value, const std::string comment="", const std::vector< T > allowed_values={})
Definition chem/QCCalculationParametersBase.h:394
QCCalculationParametersBase()
ctor for testing
Definition chem/QCCalculationParametersBase.h:383
A parallel world class.
Definition world.h:134
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:344
#define MADNESS_EXCEPTION(msg, value)
Macro for throwing a MADNESS exception.
Definition madness_exception.h:119
Namespace for all elements and tools of MADNESS.
Definition DFConvergence.h:9
CalcType
Calculation Types used by CC2.
Definition CCParameters.h:14
@ CT_CC2
Definition CCParameters.h:15
@ CT_LRCC2
Definition CCParameters.h:15
@ CT_MP3
Definition CCParameters.h:15
@ CT_UNDEFINED
Definition CCParameters.h:15
@ CT_LRCCS
Definition CCParameters.h:15
@ CT_CISPD
Definition CCParameters.h:15
@ CT_TEST
Definition CCParameters.h:15
@ CT_MP2
Definition CCParameters.h:15
@ CT_ADC2
Definition CCParameters.h:15
@ CT_TDHF
Definition CCParameters.h:15
double FunctionDefaults< NDIM >::thresh
Definition mraimpl.h:3879
const Future< void > Future< void >::value
Definition future.cc:44
double thresh_Ue() const
Definition CCParameters.h:133
double thresh_f12() const
Definition CCParameters.h:131
std::size_t kain_subspace() const
Definition CCParameters.h:185
double tight_thresh_6D() const
Definition CCParameters.h:123
std::size_t iter_max_3D() const
Definition CCParameters.h:145
bool no_compute_cispd() const
Definition CCParameters.h:165
CCParameters(World &world, const commandlineparser &parser)
ctor reading out the input file
Definition CCParameters.h:32
bool no_compute_mp2_constantpart() const
Definition CCParameters.h:157
std::pair< int, int > only_pair() const
Definition CCParameters.h:149
bool kain() const
Definition CCParameters.h:175
double kffk_volume_element() const
Definition CCParameters.h:194
bool plot() const
Definition CCParameters.h:173
bool no_compute_response() const
Definition CCParameters.h:159
double thresh_poisson() const
Definition CCParameters.h:129
std::string kffk_algorithm() const
Definition CCParameters.h:196
std::string get_tag() const override
Definition CCParameters.h:37
CCParameters()
Definition CCParameters.h:24
double thresh_bsh_3D() const
Definition CCParameters.h:125
bool no_compute_mp2() const
Definition CCParameters.h:161
double dconv_6D() const
Definition CCParameters.h:141
double econv_pairs() const
Definition CCParameters.h:137
void initialize_parameters()
Definition CCParameters.h:42
bool response() const
Definition CCParameters.h:112
bool decompose_Q() const
Definition CCParameters.h:179
double thresh_bsh_6D() const
Definition CCParameters.h:127
void error(World &world, const std::string &msg) const
Definition CCParameters.h:204
CCParameters(const CCParameters &other)=default
copy constructor
std::string cp_diagnostics() const
Definition CCParameters.h:171
double gamma() const
Definition CCParameters.h:191
double thresh_3D() const
Definition CCParameters.h:117
double tight_thresh_3D() const
Definition CCParameters.h:119
bool no_compute() const
Definition CCParameters.h:153
double dconv_3D() const
Definition CCParameters.h:139
std::size_t iter_max() const
Definition CCParameters.h:143
double lo() const
Definition CCParameters.h:113
long freeze() const
Definition CCParameters.h:187
double thresh_6D() const
Definition CCParameters.h:121
bool no_compute_cc2() const
Definition CCParameters.h:163
std::vector< std::size_t > excitations() const
Definition CCParameters.h:189
void set_derived_values()
Definition CCStructures.cc:159
bool QtAnsatz() const
Definition CCParameters.h:181
bool test() const
Definition CCParameters.h:177
double dmin() const
Definition CCParameters.h:115
std::size_t output_prec() const
Definition CCParameters.h:183
bool restart() const
Definition CCParameters.h:151
double econv() const
Definition CCParameters.h:135
static constexpr char const * tag
Definition CCParameters.h:21
std::size_t iter_max_6D() const
Definition CCParameters.h:147
CalcType calc_type() const
Definition CCParameters.h:99
bool no_compute_gs() const
Definition CCParameters.h:155
bool debug() const
Definition CCParameters.h:169
void information(World &world) const
print out the parameters
Definition CCStructures.cc:191
bool no_compute_lrcc2() const
Definition CCParameters.h:167
double kffk_alpha() const
Definition CCParameters.h:193
size_t warning(World &world, const std::string &msg) const
Definition CCParameters.h:211
void sanity_check(World &world) const
check if parameters are set correct
Definition CCStructures.cc:202
very simple command line parser
Definition commandlineparser.h:28
Declares the World class for the parallel runtime environment.