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
38
40 double thresh=1.e-3;
41 double thresh_operators=1.e-6;
42 initialize < std::string > ("calc_type", "mp2", "the calculation type", {"mp2", "mp3", "cc2", "cis", "lrcc2", "cispd", "adc2", "test"});
43 initialize < double > ("lo", 1.e-7, "the finest length scale to be resolved by 6D operators");
44 initialize < double > ("dmin", 1.0, "defines the depth of the special level");
45 initialize < double > ("thresh_6d", thresh, "threshold for the 6D wave function");
46 initialize < double > ("tight_thresh_6d", 0.1*thresh, "tight threshold for the 6D wave function");
47 initialize < double > ("thresh_3d", 0.01*thresh, "threshold for the 3D reference wave function");
48 initialize < double > ("tight_thresh_3d", 0.001*thresh, "tight threshold for the 3D reference wave function");
49 initialize < double > ("thresh_bsh_3d", thresh_operators, "threshold for BSH operators");
50 initialize < double > ("thresh_bsh_6d", thresh_operators, "threshold for BSH operators");
51 initialize < double > ("thresh_poisson", thresh_operators, "threshold for Poisson operators");
52 initialize < double > ("thresh_f12", thresh_operators, "threshold for Poisson operators");
53 initialize < double > ("thresh_Ue", thresh_operators, "ue threshold");
54 initialize < double > ("econv", thresh, "overal convergence threshold ");
55 initialize < double > ("econv_pairs", 0.1*thresh, "convergence threshold for pairs");
56 initialize < double > ("dconv_3d", 0.3*thresh, "convergence for cc singles");
57 initialize < double > ("dconv_6d", 3.0*thresh, "convergence for cc doubles");
58 initialize < std::size_t > ("iter_max", 10, "max iterations");
59 initialize < std::size_t > ("iter_max_3d", 10, "max iterations for singles");
60 initialize < std::size_t > ("iter_max_6d", 10, "max iterations for doubles");
61 initialize < std::pair<int, int>> ("only_pair", {-1, -1}, "compute only a single pair");
62 initialize < bool > ("restart", false, "restart");
63 initialize < bool > ("no_compute", false, "no compute");
64 initialize < bool > ("no_compute_gs", false, "no compute");
65 initialize < bool > ("no_compute_mp2_constantpart", false, "no compute");
66 initialize < bool > ("no_compute_response", false, "no compute");
67 initialize < bool > ("no_compute_mp2", false, "no compute");
68 initialize < bool > ("no_compute_cc2", false, "no compute");
69 initialize < bool > ("no_compute_cispd", false, "no compute");
70 initialize < bool > ("no_compute_lrcc2", false, "no compute");
71 initialize < double > ("corrfac_gamma", 1.0, "exponent for the correlation factor");
72 initialize < std::size_t > ("output_prec", 8, "for formatted output");
73 initialize < bool > ("debug", false, "");
74 initialize < bool > ("plot", false, "");
75 initialize < bool > ("kain", true, "");
76 initialize < std::size_t > ("kain_subspace", 3, "");
77 initialize < long > ("freeze", -1, "number of frozen orbitals: -1: automatic");
78 initialize < bool > ("test", false, "");
79 // choose if Q for the constant part of MP2 and related calculations should be decomposed: GQV or GV - GO12V
80 initialize < bool > ("decompose_Q", true, "always true",{true});
81 // if true the ansatz for the CC2 ground state pairs is |tau_ij> = |u_ij> + Qtf12|titj>, with Qt = Q - |tau><phi|
82 // if false the ansatz is the same with normal Q projector
83 // the response ansatz is the corresponding response of the gs ansatz
84 initialize < bool > ("QtAnsatz", true, "always true",{true});
85 // a vector containing the excitations which shall be optizmized later (with CIS(D) or CC2)
86 initialize < std::vector<size_t>>
87 ("excitations", {}, "vector containing the excitations");
88 }
89
90 void set_derived_values();
91
93 std::string value = get<std::string>("calc_type");
94 if (value == "mp2") return CT_MP2;
95 if (value == "mp3") return CT_MP3;
96 if (value == "cc2") return CT_CC2;
97 if (value == "cis") return CT_LRCCS;
98 if (value == "lrcc2") return CT_LRCC2;
99 if (value == "cispd") return CT_CISPD;
100 if (value == "adc2") return CT_ADC2;
101 if (value == "test") return CT_TEST;
102 MADNESS_EXCEPTION("faulty CalcType", 1);
103 }
104
105 bool response() const {return calc_type()==CT_ADC2 or calc_type()==CT_CISPD or calc_type()==CT_LRCC2 or calc_type()==CT_LRCCS;}
106 double lo() const { return get<double>("lo"); }
107
108 double dmin() const { return get<double>("dmin"); }
109
110 double thresh_3D() const { return get<double>("thresh_3d"); }
111
112 double tight_thresh_3D() const { return get<double>("tight_thresh_3d"); }
113
114 double thresh_6D() const { return get<double>("thresh_6d"); }
115
116 double tight_thresh_6D() const { return get<double>("tight_thresh_6d"); }
117
118 double thresh_bsh_3D() const { return get<double>("thresh_bsh_3d"); }
119
120 double thresh_bsh_6D() const { return get<double>("thresh_bsh_6d"); }
121
122 double thresh_poisson() const { return get<double>("thresh_poisson"); }
123
124 double thresh_f12() const { return get<double>("thresh_f12"); }
125
126 double thresh_Ue() const { return get<double>("thresh_ue"); }
127
128 double econv() const { return get<double>("econv"); }
129
130 double econv_pairs() const { return get<double>("econv_pairs"); }
131
132 double dconv_3D() const { return get<double>("dconv_3d"); }
133
134 double dconv_6D() const { return get<double>("dconv_6d"); }
135
136 std::size_t iter_max() const { return get<std::size_t>("iter_max"); }
137
138 std::size_t iter_max_3D() const { return get<std::size_t>("iter_max_3d"); }
139
140 std::size_t iter_max_6D() const { return get<std::size_t>("iter_max_6d"); }
141
142 std::pair<int, int> only_pair() const { return get<std::pair<int, int>>("only_pair"); }
143
144 bool restart() const { return get<bool>("restart"); }
145
146 bool no_compute() const { return get<bool>("no_compute"); }
147
148 bool no_compute_gs() const { return get<bool>("no_compute_gs"); }
149
150 bool no_compute_mp2_constantpart() const { return get<bool>("no_compute_mp2_constantpart"); }
151
152 bool no_compute_response() const { return get<bool>("no_compute_response"); }
153
154 bool no_compute_mp2() const { return get<bool>("no_compute_mp2"); }
155
156 bool no_compute_cc2() const { return get<bool>("no_compute_cc2"); }
157
158 bool no_compute_cispd() const { return get<bool>("no_compute_cispd"); }
159
160 bool no_compute_lrcc2() const { return get<bool>("no_compute_lrcc2"); }
161
162 bool debug() const { return get<bool>("debug"); }
163
164 bool plot() const { return get<bool>("plot"); }
165
166 bool kain() const { return get<bool>("kain"); }
167
168 bool test() const { return get<bool>("test"); }
169
170 bool decompose_Q() const { return get<bool>("decompose_q"); }
171
172 bool QtAnsatz() const { return get<bool>("qtansatz"); }
173
174 std::size_t output_prec() const { return get<std::size_t>("output_prec"); }
175
176 std::size_t kain_subspace() const { return get<std::size_t>("kain_subspace"); }
177
178 long freeze() const { return get<long>("freeze"); }
179
180 std::vector<std::size_t> excitations() const { return get<std::vector<std::size_t>>("excitations"); }
181
182 double gamma() const {return get<double>("corrfac_gamma");}
183
184 /// print out the parameters
185 void information(World& world) const;
186
187 /// check if parameters are set correct
188 void sanity_check(World& world) const;
189
190 void error(World& world, const std::string& msg) const {
191 if (world.rank() == 0)
192 std::cout << "\n\n\n\n\n!!!!!!!!!\n\nERROR IN CC_PARAMETERS:\n ERROR MESSAGE IS: " << msg
193 << "\n\n\n!!!!!!!!" << std::endl;
194 MADNESS_EXCEPTION("ERROR IN CC_PARAMETERS", 1);
195 }
196
197 size_t warning(World& world, const std::string& msg) const {
198 if (world.rank() == 0) std::cout << "WARNING IN CC_PARAMETERS!: " << msg << std::endl;
199 return 1;
200 }
201
202 };
203} // namespace madness
204
205#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:328
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:126
double thresh_f12() const
Definition CCParameters.h:124
std::size_t kain_subspace() const
Definition CCParameters.h:176
double tight_thresh_6D() const
Definition CCParameters.h:116
std::size_t iter_max_3D() const
Definition CCParameters.h:138
bool no_compute_cispd() const
Definition CCParameters.h:158
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:150
std::pair< int, int > only_pair() const
Definition CCParameters.h:142
bool kain() const
Definition CCParameters.h:166
bool plot() const
Definition CCParameters.h:164
bool no_compute_response() const
Definition CCParameters.h:152
double thresh_poisson() const
Definition CCParameters.h:122
CCParameters()
Definition CCParameters.h:24
double thresh_bsh_3D() const
Definition CCParameters.h:118
bool no_compute_mp2() const
Definition CCParameters.h:154
double dconv_6D() const
Definition CCParameters.h:134
double econv_pairs() const
Definition CCParameters.h:130
void initialize_parameters()
Definition CCParameters.h:39
bool response() const
Definition CCParameters.h:105
bool decompose_Q() const
Definition CCParameters.h:170
double thresh_bsh_6D() const
Definition CCParameters.h:120
void error(World &world, const std::string &msg) const
Definition CCParameters.h:190
CCParameters(const CCParameters &other)=default
copy constructor
double gamma() const
Definition CCParameters.h:182
double thresh_3D() const
Definition CCParameters.h:110
double tight_thresh_3D() const
Definition CCParameters.h:112
bool no_compute() const
Definition CCParameters.h:146
double dconv_3D() const
Definition CCParameters.h:132
std::size_t iter_max() const
Definition CCParameters.h:136
double lo() const
Definition CCParameters.h:106
long freeze() const
Definition CCParameters.h:178
double thresh_6D() const
Definition CCParameters.h:114
bool no_compute_cc2() const
Definition CCParameters.h:156
std::vector< std::size_t > excitations() const
Definition CCParameters.h:180
void set_derived_values()
Definition CCStructures.cc:159
bool QtAnsatz() const
Definition CCParameters.h:172
bool test() const
Definition CCParameters.h:168
double dmin() const
Definition CCParameters.h:108
std::size_t output_prec() const
Definition CCParameters.h:174
bool restart() const
Definition CCParameters.h:144
double econv() const
Definition CCParameters.h:128
static constexpr char const * tag
Definition CCParameters.h:21
std::size_t iter_max_6D() const
Definition CCParameters.h:140
CalcType calc_type() const
Definition CCParameters.h:92
bool no_compute_gs() const
Definition CCParameters.h:148
bool debug() const
Definition CCParameters.h:162
void information(World &world) const
print out the parameters
Definition CCStructures.cc:191
bool no_compute_lrcc2() const
Definition CCParameters.h:160
size_t warning(World &world, const std::string &msg) const
Definition CCParameters.h:197
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.