5#ifndef MADNESS_APPS_DFPARAMS_H_INCLUDED
6#define MADNESS_APPS_DFPARAMS_H_INCLUDED
21 const auto first =
name.find_first_not_of(
" \t\n\r");
22 if (first == std::string::npos)
return "";
23 const auto last =
name.find_last_not_of(
" \t\n\r");
24 name =
name.substr(first, (last - first + 1));
28 bool all_digits =
true;
29 for (
size_t i =
name.size() - 5; i <
name.size(); ++i) {
30 if (!std::isdigit(
static_cast<unsigned char>(
name[i]))) {
40 if (!std::filesystem::exists(
name +
".00000") && std::filesystem::exists(
name +
".restartdata.00000")) {
41 name +=
".restartdata";
96 template<
typename Archive>
100 if constexpr (Archive::is_input_archive) {
145 bool dconv_was_set =
false;
146 bool thresh_mul_was_set =
false;
152 else if (s[0] ==
'#'){
154 std::getline(
f, dummy);
157 else if (s ==
"archive"){
161 else if (s ==
"job"){
164 else if (s ==
"max_iter"){
167 else if (s ==
"small"){
170 else if (s ==
"thresh"){
173 else if (s ==
"dconv"){
175 dconv_was_set =
true;
177 else if (s ==
"thresh_mul"){
179 thresh_mul_was_set =
true;
184 else if (s ==
"kain"){
187 else if (s ==
"maxsub"){
190 else if (s ==
"maxrotn"){
193 else if (s ==
"restart"){
196 else if (s ==
"nucleus"){
199 else if (s ==
"no_save"){
202 else if (s ==
"savefile"){
206 else if (s ==
"lb_iter"){
209 else if (s ==
"nwchem"){
212 else if (s ==
"lineplot"){
215 else if (s ==
"no_compute"){
218 else if (s ==
"bohr_rad"){
221 else if (s ==
"speed_of_light"){
224 else if (s ==
"min_iter"){
227 else if (s ==
"Krestricted"){
230 else if (s ==
"convergence_criteria"){
234 std::cout <<
"Dirac Fock: unrecognized convergence_criteria " << keyword
235 <<
" (allowed: bsh_residual, energy_density_residual)" << std::endl;
240 std::cout <<
"Dirac Fock: unrecognized input keyword " << s << std::endl;
#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
static const char * filename
Definition legendre.cc:96
std::istream & position_stream(std::istream &f, const std::string &tag, bool rewind=true)
Definition position_stream.cc:48
const char * df_convergence_criterion_name(const DFConvergenceCriterion criterion)
Definition DFConvergence.h:30
std::string clean_archive_filename(std::string name)
Definition DFParameters.h:18
void print(const T &t, const Ts &... ts)
Print items to std::cout (items separated by spaces) and terminate with a new line.
Definition print.h:227
NDIM & f
Definition mra.h:2668
DFConvergenceCriterion
Definition DFConvergence.h:11
std::string name(const FuncType &type, const int ex=-1)
Definition ccpairfunction.h:28
bool df_convergence_criterion_from_string(const std::string &keyword, DFConvergenceCriterion &criterion)
Definition DFConvergence.h:17
Definition DFParameters.h:46
double thresh_mul
Accuracy criterion for sparse multiplication. Defaults to thresh.
Definition DFParameters.h:65
bool no_compute
If true, will skip all computation.
Definition DFParameters.h:77
int k
Number of legendre polynomials in scaling basis.
Definition DFParameters.h:66
void read(std::istream &f)
Definition DFParameters.h:139
double maxrotn
maximum step allowed by kain
Definition DFParameters.h:69
double small
Minimum length scale to be resolved.
Definition DFParameters.h:62
bool kain
Turns on KAIN nonlinear solver.
Definition DFParameters.h:67
bool restart
Indicates this is a restarted DF job.
Definition DFParameters.h:70
int lb_iter
How many iterations to load balance (after the initial load balancing)
Definition DFParameters.h:74
int min_iter
minimum number of iterations (default: 2)
Definition DFParameters.h:80
double dconv
Accuracy criterion for charge density. Defaults to thresh.
Definition DFParameters.h:64
std::string archive
Name of input archive to read in ground state.
Definition DFParameters.h:53
int max_iter
Maximum number of iterations.
Definition DFParameters.h:61
double speed_of_light
speed_of_light in au (default: 137.03599917697017 CODATA2022)
Definition DFParameters.h:79
bool lineplot
Whether or not to make lineplots at the end of the job.
Definition DFParameters.h:76
bool Krestricted
Calculation should be performed in Kramers-restricted manner (default: false)
Definition DFParameters.h:81
void serialize(Archive &ar)
Definition DFParameters.h:97
double thresh
Accuracy criterion when truncating.
Definition DFParameters.h:63
DFConvergenceCriterion convergence_criteria
Definition DFParameters.h:82
void print_params() const
Definition DFParameters.h:250
std::string savefile
Gives the file to save the archive each iteration Default: DFrestartdata (in working directory)
Definition DFParameters.h:73
double bohr_rad
bohr radius in fm (default: 52917.7210544 CODATA2022)
Definition DFParameters.h:78
int job
Definition DFParameters.h:54
void read_file(const std::string &filename)
Definition DFParameters.h:133
bool nwchem
Indicates archive given is actually an nwchem file for starting the job.
Definition DFParameters.h:75
int nucleus
Indicates which nucleus model to use (1 for fermi, anything else for Gaussian)
Definition DFParameters.h:71
DFParameters()
Definition DFParameters.h:106
bool do_save
Whether or not to save after each iteration. Defaults to true. Turn off with 'no_save'.
Definition DFParameters.h:72
int maxsub
Sets maximum subspace size for KAIN.
Definition DFParameters.h:68
void e()
Definition test_sig.cc:75