MADNESS  0.10.1
madness/chem/write_test_input.h
Go to the documentation of this file.
1 //
2 // Created by Florian Bischoff on 5/27/21.
3 //
4 
5 #ifndef MADNESS_WRITE_TEST_INPUT_H
6 #define MADNESS_WRITE_TEST_INPUT_H
7 
9 
10 namespace madness {
11 
12 /// will write a test input and remove it from disk upon destruction
14 
15  double eprec = 1.e-3; // was 1e-4 ... trying to make test faster
16 
17  std::string filename_;
18  bool keepfile=false;
19 
20  write_test_input() : filename_("testinput") {}
21 
22  write_test_input(const CalculationParameters& param, const std::string& mol = "lih") : filename_("test_mo_input") {
23  std::ofstream of(filename_);
24  write_to_test_input("dft", &param, of);
26  of.close();
27  }
28 
30  if (not keepfile) std::remove(filename_.c_str());
31  }
32 
33  std::string filename() const { return filename_; }
34 
35  static std::ostream&
36  write_to_test_input(const std::string groupname, const QCCalculationParametersBase *param, std::ostream& of) {
37  of << groupname << endl;
38  of << param->print_to_string(true);
39  of << "end\n";
40  return of;
41  }
42 
43  static std::ostream& write_molecule_to_test_input(std::string mol, std::ostream& of) {
44  if (mol == "lih") {
45  of << "geometry\n";
46  of << "no_orient true\n";
47  of << "Li 0.0 0.0 0.0\n";
48  of << "H 1.4375 0.0 0.0\n";
49  of << "end\n";
50  } else if (mol == "hf") {
51  //double eprec=1.e-5; // trying to make test faster
52  of << "geometry\n";
53  of << "no_orient true\n";
54  of << "F 0.1 0.0 0.2\n";
55  of << "H 1.4375 0.0 0.0\n";
56  of << "end\n";
57  }
58  return of;
59  }
60 
61 };
62 
63 } // namespace madness
64 
65 
66 #endif //MADNESS_WRITE_TEST_INPUT_H
class for holding the parameters for calculation
Definition: QCCalculationParametersBase.h:290
File holds all helper structures necessary for the CC_Operator and CC2 class.
Definition: DFParameters.h:10
Definition: CalculationParameters.h:51
will write a test input and remove it from disk upon destruction
Definition: madness/chem/write_test_input.h:13
write_test_input()
Definition: madness/chem/write_test_input.h:20
write_test_input(const CalculationParameters &param, const std::string &mol="lih")
Definition: madness/chem/write_test_input.h:22
bool keepfile
Definition: madness/chem/write_test_input.h:18
static std::ostream & write_to_test_input(const std::string groupname, const QCCalculationParametersBase *param, std::ostream &of)
Definition: madness/chem/write_test_input.h:36
std::string filename() const
Definition: madness/chem/write_test_input.h:33
static std::ostream & write_molecule_to_test_input(std::string mol, std::ostream &of)
Definition: madness/chem/write_test_input.h:43
std::string filename_
Definition: madness/chem/write_test_input.h:17
double eprec
Definition: madness/chem/write_test_input.h:15
~write_test_input()
Definition: madness/chem/write_test_input.h:29
InputParameters param
Definition: tdse.cc:203