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 < bool > ("plot", false, "");
78 initialize < bool > ("kain", true, "");
79 initialize < std::size_t > ("kain_subspace", 3, "");
80 initialize < long > ("freeze", -1, "number of frozen orbitals: -1: automatic");
81 initialize < bool > ("test", false, "");
82 // choose if Q for the constant part of MP2 and related calculations should be decomposed: GQV or GV - GO12V
83 initialize < bool > ("decompose_Q", true, "always true",{true});
84 // if true the ansatz for the CC2 ground state pairs is |tau_ij> = |u_ij> + Qtf12|titj>, with Qt = Q - |tau><phi|
85 // if false the ansatz is the same with normal Q projector
86 // the response ansatz is the corresponding response of the gs ansatz
87 initialize < bool > ("QtAnsatz", true, "always true",{true});
88 // a vector containing the excitations which shall be optizmized later (with CIS(D) or CC2)
89 initialize < std::vector<size_t>>
90 ("excitations", {}, "vector containing the excitations");
91 }
92
93 void set_derived_values();
94
96 std::string value = get<std::string>("calc_type");
97 if (value == "mp2") return CT_MP2;
98 if (value == "mp3") return CT_MP3;
99 if (value == "cc2") return CT_CC2;
100 if (value == "cis") return CT_LRCCS;
101 if (value == "lrcc2") return CT_LRCC2;
102 if (value == "cispd") return CT_CISPD;
103 if (value == "adc2") return CT_ADC2;
104 if (value == "test") return CT_TEST;
105 MADNESS_EXCEPTION("faulty CalcType", 1);
106 }
107
108 bool response() const {return calc_type()==CT_ADC2 or calc_type()==CT_CISPD or calc_type()==CT_LRCC2 or calc_type()==CT_LRCCS;}
109 double lo() const { return get<double>("lo"); }
110
111 double dmin() const { return get<double>("dmin"); }
112
113 double thresh_3D() const { return get<double>("thresh_3d"); }
114
115 double tight_thresh_3D() const { return get<double>("tight_thresh_3d"); }
116
117 double thresh_6D() const { return get<double>("thresh_6d"); }
118
119 double tight_thresh_6D() const { return get<double>("tight_thresh_6d"); }
120
121 double thresh_bsh_3D() const { return get<double>("thresh_bsh_3d"); }
122
123 double thresh_bsh_6D() const { return get<double>("thresh_bsh_6d"); }
124
125 double thresh_poisson() const { return get<double>("thresh_poisson"); }
126
127 double thresh_f12() const { return get<double>("thresh_f12"); }
128
129 double thresh_Ue() const { return get<double>("thresh_ue"); }
130
131 double econv() const { return get<double>("econv"); }
132
133 double econv_pairs() const { return get<double>("econv_pairs"); }
134
135 double dconv_3D() const { return get<double>("dconv_3d"); }
136
137 double dconv_6D() const { return get<double>("dconv_6d"); }
138
139 std::size_t iter_max() const { return get<std::size_t>("iter_max"); }
140
141 std::size_t iter_max_3D() const { return get<std::size_t>("iter_max_3d"); }
142
143 std::size_t iter_max_6D() const { return get<std::size_t>("iter_max_6d"); }
144
145 std::pair<int, int> only_pair() const { return get<std::pair<int, int>>("only_pair"); }
146
147 bool restart() const { return get<bool>("restart"); }
148
149 bool no_compute() const { return get<bool>("no_compute"); }
150
151 bool no_compute_gs() const { return get<bool>("no_compute_gs"); }
152
153 bool no_compute_mp2_constantpart() const { return get<bool>("no_compute_mp2_constantpart"); }
154
155 bool no_compute_response() const { return get<bool>("no_compute_response"); }
156
157 bool no_compute_mp2() const { return get<bool>("no_compute_mp2"); }
158
159 bool no_compute_cc2() const { return get<bool>("no_compute_cc2"); }
160
161 bool no_compute_cispd() const { return get<bool>("no_compute_cispd"); }
162
163 bool no_compute_lrcc2() const { return get<bool>("no_compute_lrcc2"); }
164
165 bool debug() const { return get<bool>("debug"); }
166
167 bool plot() const { return get<bool>("plot"); }
168
169 bool kain() const { return get<bool>("kain"); }
170
171 bool test() const { return get<bool>("test"); }
172
173 bool decompose_Q() const { return get<bool>("decompose_q"); }
174
175 bool QtAnsatz() const { return get<bool>("qtansatz"); }
176
177 std::size_t output_prec() const { return get<std::size_t>("output_prec"); }
178
179 std::size_t kain_subspace() const { return get<std::size_t>("kain_subspace"); }
180
181 long freeze() const { return get<long>("freeze"); }
182
183 std::vector<std::size_t> excitations() const { return get<std::vector<std::size_t>>("excitations"); }
184
185 double gamma() const {return get<double>("corrfac_gamma");}
186
187 /// print out the parameters
188 void information(World& world) const;
189
190 /// check if parameters are set correct
191 void sanity_check(World& world) const;
192
193 void error(World& world, const std::string& msg) const {
194 if (world.rank() == 0)
195 std::cout << "\n\n\n\n\n!!!!!!!!!\n\nERROR IN CC_PARAMETERS:\n ERROR MESSAGE IS: " << msg
196 << "\n\n\n!!!!!!!!" << std::endl;
197 MADNESS_EXCEPTION("ERROR IN CC_PARAMETERS", 1);
198 }
199
200 size_t warning(World& world, const std::string& msg) const {
201 if (world.rank() == 0) std::cout << "WARNING IN CC_PARAMETERS!: " << msg << std::endl;
202 return 1;
203 }
204
205 };
206} // namespace madness
207
208#endif //CCPARAMETER_H
class for holding the parameters for calculation
Definition QCCalculationParametersBase.h:294
virtual void read_input_and_commandline_options(World &world, const commandlineparser &parser, const std::string tag)
Definition QCCalculationParametersBase.h:330
A parallel world class.
Definition world.h:132
ProcessID rank() const
Returns the process rank in this World (same as MPI_Comm_rank()).
Definition world.h:320
#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 DFParameters.h:10
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
static const double thresh
Definition rk.cc:45
Definition CCParameters.h:20
double thresh_Ue() const
Definition CCParameters.h:129
double thresh_f12() const
Definition CCParameters.h:127
std::size_t kain_subspace() const
Definition CCParameters.h:179
double tight_thresh_6D() const
Definition CCParameters.h:119
std::size_t iter_max_3D() const
Definition CCParameters.h:141
bool no_compute_cispd() const
Definition CCParameters.h:161
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:153
std::pair< int, int > only_pair() const
Definition CCParameters.h:145
bool kain() const
Definition CCParameters.h:169
bool plot() const
Definition CCParameters.h:167
bool no_compute_response() const
Definition CCParameters.h:155
double thresh_poisson() const
Definition CCParameters.h:125
std::string get_tag() const override
Definition CCParameters.h:37
CCParameters()
Definition CCParameters.h:24
double thresh_bsh_3D() const
Definition CCParameters.h:121
bool no_compute_mp2() const
Definition CCParameters.h:157
double dconv_6D() const
Definition CCParameters.h:137
double econv_pairs() const
Definition CCParameters.h:133
void initialize_parameters()
Definition CCParameters.h:42
bool response() const
Definition CCParameters.h:108
bool decompose_Q() const
Definition CCParameters.h:173
double thresh_bsh_6D() const
Definition CCParameters.h:123
void error(World &world, const std::string &msg) const
Definition CCParameters.h:193
CCParameters(const CCParameters &other)=default
copy constructor
double gamma() const
Definition CCParameters.h:185
double thresh_3D() const
Definition CCParameters.h:113
double tight_thresh_3D() const
Definition CCParameters.h:115
bool no_compute() const
Definition CCParameters.h:149
double dconv_3D() const
Definition CCParameters.h:135
std::size_t iter_max() const
Definition CCParameters.h:139
double lo() const
Definition CCParameters.h:109
long freeze() const
Definition CCParameters.h:181
double thresh_6D() const
Definition CCParameters.h:117
bool no_compute_cc2() const
Definition CCParameters.h:159
std::vector< std::size_t > excitations() const
Definition CCParameters.h:183
void set_derived_values()
Definition CCStructures.cc:159
bool QtAnsatz() const
Definition CCParameters.h:175
bool test() const
Definition CCParameters.h:171
double dmin() const
Definition CCParameters.h:111
std::size_t output_prec() const
Definition CCParameters.h:177
bool restart() const
Definition CCParameters.h:147
double econv() const
Definition CCParameters.h:131
static constexpr char const * tag
Definition CCParameters.h:21
std::size_t iter_max_6D() const
Definition CCParameters.h:143
CalcType calc_type() const
Definition CCParameters.h:95
bool no_compute_gs() const
Definition CCParameters.h:151
bool debug() const
Definition CCParameters.h:165
void information(World &world) const
print out the parameters
Definition CCStructures.cc:191
bool no_compute_lrcc2() const
Definition CCParameters.h:163
size_t warning(World &world, const std::string &msg) const
Definition CCParameters.h:200
void sanity_check(World &world) const
check if parameters are set correct
Definition CCStructures.cc:202
very simple command line parser
Definition commandlineparser.h:15
Declares the World class for the parallel runtime environment.