MPQC 3.0.0-alpha
Loading...
Searching...
No Matches
mpqcin.h
1
2#ifndef _mpqcin_h
3#define _mpqcin_h
4
5#include <vector>
6#include <iostream>
7#include <string.h>
8
9#include <util/keyval/keyval.h>
10#include <chemistry/molecule/molecule.h>
11
12class MPQCInFlexLexer;
13
14namespace sc {
15
16class IPV2;
17
18template <class T>
20 int set_;
21 T val_;
22 public:
23 MPQCInDatum(const T&v): val_(v), set_(0) {}
24 const T &operator =(const T&v) { set_ = 1; val_ = v; return val_; }
25 void reset(const T &val) { set_ = 0; val_ = val; }
26 int set() const { return set_; }
27 T val() const { return val_; }
28};
29
32
34class MPQCIn {
35
36 public:
37 struct Basis {
38 Basis() : name(0), uc(0), split(0), puream(0) {}
39 Basis(const char* n, bool u, bool s, bool p) : name(0), uc(u), split(s), puream(p) {
40 if (n) name = strdup(n);
41 if (uc.val()) split = false; // uncontraction implies splitting
42 }
43 Basis(const Basis& other) : name(0), uc(0), split(0), puream(0) {
44 if (other.name.set()) name = strdup(other.name.val());
45 if (other.uc.set()) uc = other.uc;
46 if (other.split.set()) split = other.split;
47 if (other.puream.set()) puream = other.puream;
48 }
49 ~Basis() { if (name.val()) free(name.val()); }
50
51 void set_name(char* c) { name = c; }
52 void set_uc(bool b) { uc = b; }
53 void set_split(bool b) { split = b; }
54 void set_puream(bool b) { puream = b; }
55 void write(std::ostream &ostrs,
56 const char *keyword) const;
57
58 bool operator==(const Basis& other) {
59 return strcmp(name.val(), other.name.val()) == 0 &&
60 uc.val() == other.uc.val() &&
61 split.val() == other.split.val() &&
62 puream.val() == other.puream.val();
63 }
64 bool operator!=(const Basis& other) {
65 return ! (*this == other);
66 }
67
68 MPQCInDatum<char *> name; // name
69 MPQCInDatum<int> uc; // force uncontracted?
70 MPQCInDatum<int> split; // force split?
71 MPQCInDatum<int> puream; // force puream?
72 };
73
74 private:
75 MPQCInFlexLexer *lexer_;
76 Ref<Molecule> mol_;
77 MPQCInDatum<int> gradient_;
78 MPQCInDatum<int> frequencies_;
79 MPQCInDatum<int> optimize_;
80 MPQCInDatum<int> mult_;
81 MPQCInDatum<int> restart_;
82 MPQCInDatum<int> checkpoint_;
83 MPQCInDatum<int> precise_findif_;
84 MPQCInDatum<int> charge_;
85 MPQCInDatum<int> atom_charge_;
86 MPQCInDatum<int> molecule_bohr_;
87 Basis basis_;
88 Basis auxbasis_;
89 Basis dfbasis_;
90 MPQCInDatum<char *> method_;
91 MPQCInDatum<char *> accuracy_;
92 MPQCInDatum<char *> lindep_;
93 // options for optimize
94 MPQCInDatum<int> redund_coor_;
95 MPQCInDatum<int> opt_type_;
96 MPQCInDatum<char *> opt_convergence_;
97 // options for frequencies
98 MPQCInDatum<char *> freq_accuracy_;
99 // options for SCF
100 MPQCInDatum<char *> scf_maxiter_;
101 // options for DFT methods
102 MPQCInDatum<char *> dftmethod_xc_;
103 MPQCInDatum<char *> dftmethod_grid_;
104 // options for R12 methods
105 MPQCInDatum<char *> r12method_f12_;
106 MPQCInDatum<char *> r12method_app_;
107 MPQCInDatum<char *> r12method_ri_;
108 MPQCInDatum<char *> r12method_ansatz_;
109 MPQCInDatum<char *> pccsd_alpha_;
110 MPQCInDatum<char *> pccsd_beta_;
111 MPQCInDatum<char *> pccsd_gamma_;
112 MPQCInDatum<char *> symmetry_;
113 MPQCInDatum<char *> memory_;
114 MPQCInDatum<char *> tmpstore_;
115 MPQCInDatum<char *> tmpdir_;
116 MPQCInDatum<char *> debug_;
121 MPQCInDatum<std::vector<int> *> frozen_docc_;
122 MPQCInDatum<std::vector<int> *> frozen_uocc_;
123
124 int nirrep_;
125
126 enum IntegralsFactoryType {
127 IntV3,
128 Libint2,
129 Invalid
130 };
131 static std::string to_string(IntegralsFactoryType ifactory);
132 static Basis guess_basis(IntegralsFactoryType ifactory);
133 static bool psi_method(const char*);
134 static bool r12_method(const char*);
135
137 void infer_defaults();
138
139 void write_energy_object(std::ostream&, const char *keyword,
140 const char *method,
141 Basis const* basis, int coor,
142 IntegralsFactoryType& ifactory);
143 void write_vector(std::ostream &ostrs,
144 const char *keyvalname,
145 const char *name,
146 MPQCInDatum<std::vector<int> *>&vec,
147 int require_nirrep);
148
149 static int checking_;
150 public:
151 MPQCIn();
152 ~MPQCIn();
153
154 char *parse_string(const char *s);
155 int check_string(const char *s);
156
157 int ylex();
158 int yparse();
159 void error(const char* s);
160 void error2(const char* s, const char* s2);
161 void yerror(const char* s);
162 void yerror2(const char* s, const char *);
163
164 void begin_molecule();
165 void end_molecule();
166 void add_atom(char *, char *, char *, char *);
167 void set_charge(char *);
168 void set_method(char *);
169 void set_multiplicity(char *);
170 void set_memory(char *);
171 void set_tmpstore(char *);
172 void set_tmpdir(char *);
173 void set_accuracy(char *);
174 void set_lindep(char *);
175 void set_optimize(int);
176 void set_opt_type(int);
177 void set_opt_convergence(char *);
178 void set_atom_charge(char *);
179 void set_molecule_unit(char *);
180 void set_symmetry(char *);
181 void set_redund_coor(int);
182 void set_gradient(int);
183 void set_frequencies(int);
184 void set_freq_accuracy(char *);
185 void set_restart(int);
186 void set_checkpoint(int);
187 void set_precise_findif(int);
188 void set_molecule_bohr(int);
189 void set_debug(char *);
190 void set_pccsd(char *, char *, char *);
191 void set_docc(std::vector<int> *);
192 void set_socc(std::vector<int> *);
193 void set_alpha(std::vector<int> *);
194 void set_beta(std::vector<int> *);
195 void set_frozen_docc(std::vector<int> *);
196 void set_frozen_uocc(std::vector<int> *);
197 std::vector<int> *make_nnivec(std::vector<int> *, char *);
198
199 void set_scf_maxiter(char *);
200
201 void set_dftmethod_xc(char *);
202 void set_dftmethod_grid(char *);
203 void set_r12method_f12(char *);
204 void set_r12method_app(char *);
205 void set_r12method_ri(char *);
206 void set_r12method_ansatz(char *);
207
208 static int checking() { return checking_; }
209};
210
212// end of addtogroup Init
213
214}
215
216#endif
Definition ipv2.h:78
Definition mpqcin.h:19
Converts MPQC simple input to object-oriented input.
Definition mpqcin.h:34
A template class that maintains references counts.
Definition ref.h:361
SpinCase1 other(SpinCase1 S)
given 1-spin return the other 1-spin
Contains all MPQC code up to version 3.
Definition mpqcin.h:14
Definition mpqcin.h:37

Generated at Wed Sep 25 2024 02:45:28 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.12.0.