30 int main(
int argc,
char** argv)
33 mpi3::environment env(argc, argv);
39 std::cout <<
"Usage: convert [-gaussian|-gamess|-orbitals|-dirac|-rmg] filename " << std::endl;
40 std::cout <<
"[-nojastrow -hdf5 -prefix title -addCusp -production -NbImages NimageX NimageY NimageZ]" << std::endl;
41 std::cout <<
"[-psi_tag psi0 -ion_tag ion0 -gridtype log|log0|linear -first ri -last rf]" << std::endl;
42 std::cout <<
"[-size npts -multidet multidet.h5 -ci file.out -threshold cimin -TargetState state_number " 43 "-NaturalOrbitals NumToRead -optDetCoeffs]" 45 std::cout <<
"Defaults : -gridtype log -first 1e-6 -last 100 -size 1001 -ci required -threshold 0.01 -TargetState " 48 std::cout <<
"When the input format is missing, the extension of filename is used to determine the format " 50 std::cout <<
" *.Fchk -> gaussian; *.out -> gamess; *.h5 -> HDF5" << std::endl;
62 std::cout.setf(std::ios::scientific, std::ios::floatfield);
63 std::cout.setf(std::ios::right, std::ios::adjustfield);
64 std::cout.precision(12);
66 std::unique_ptr<QMCGaussianParserBase> parser;
68 std::string in_file(argv[1]);
71 std::string punch_file;
72 std::string psi_tag(
"psi0");
73 std::string ion_tag(
"ion0");
74 std::string jastrow(
"j");
78 bool addJastrow =
true;
81 bool useprefix =
false;
84 bool ci =
false, zeroCI =
false, orderByExcitation =
false, addCusp =
false, multidet =
false,
89 std::vector<int> Image;
92 std::string a(argv[iargc]);
95 parser = std::make_unique<GaussianFCHKParser>(argc, argv);
96 in_file = argv[++iargc];
98 else if (a ==
"-gamess")
100 parser = std::make_unique<GamesAsciiParser>(argc, argv);
101 in_file = argv[++iargc];
103 else if (a ==
"-dirac")
105 parser = std::make_unique<DiracParser>(argc, argv);
106 in_file = argv[++iargc];
109 else if (a ==
"-orbitals")
111 parser = std::make_unique<LCAOHDFParser>(argc, argv);
113 in_file = argv[++iargc];
115 else if (a ==
"-rmg")
117 parser = std::make_unique<RMGParser>(argc, argv);
119 in_file = argv[++iargc];
121 else if (a ==
"-hdf5")
125 else if (a ==
"-psi_tag")
127 psi_tag = argv[++iargc];
129 else if (a ==
"-production")
133 else if (a ==
"-ion_tag")
135 ion_tag = argv[++iargc];
137 else if (a ==
"-prefix")
139 prefix = argv[++iargc];
145 punch_file = argv[++iargc];
147 else if (a ==
"-multidet")
150 punch_file = argv[++iargc];
152 else if (a ==
"-NbImages")
155 temp = atoi(argv[++iargc]);
156 temp += 1 - temp % 2;
157 Image.push_back(temp);
158 temp = atoi(argv[++iargc]);
159 temp += 1 - temp % 2;
160 Image.push_back(temp);
161 temp = atoi(argv[++iargc]);
162 temp += 1 - temp % 2;
163 Image.push_back(temp);
165 else if (a ==
"-addCusp")
169 else if (a ==
"-threshold")
171 thres = atof(argv[++iargc]);
173 else if (a ==
"-optDetCoeffs")
177 else if (a ==
"-TargetState")
179 TargetState = atoi(argv[++iargc]);
181 else if (a ==
"-NaturalOrbitals")
183 readNO = atoi(argv[++iargc]);
185 else if (a ==
"-readInitialGuess")
187 readGuess = atoi(argv[++iargc]);
189 else if (a ==
"-zeroCI")
193 else if (a ==
"-orderByExcitation")
195 orderByExcitation =
true;
197 else if (a ==
"-cutoff")
199 orderByExcitation =
true;
201 else if (a ==
"-debug")
205 else if (a ==
"-nojastrow")
212 if (readNO > 0 && readGuess > 0)
214 std::cerr <<
"Can only use one of: -NaturalOrbitals or -readInitialGuess. \n";
223 WARNMSG(
"Creating GaussianFCHKParser")
224 parser = std::make_unique<GaussianFCHKParser>(argc, argv);
226 else if (ext ==
"h5")
228 WARNMSG(
"Creating LCAOHDFParser")
229 parser = std::make_unique<LCAOHDFParser>(argc, argv);
232 else if (ext ==
"out")
234 WARNMSG(
"Creating GamesAsciiParser")
235 parser = std::make_unique<GamesAsciiParser>(argc, argv);
239 std::cerr <<
"Unknown extension: " << ext << std::endl;
243 if (useprefix !=
true)
246 std::string delimiter;
253 pos = prefix.find(delimiter);
254 token = prefix.substr(0, pos);
257 std::cout <<
"Using " << prefix <<
" to name output files" << std::endl;
259 parser->Title = prefix;
260 parser->debug = debug;
261 parser->DoCusp = addCusp;
262 parser->UseHDF5 = usehdf5;
263 parser->singledetH5 = h5;
266 parser->UseHDF5 =
false;
267 parser->h5file = in_file;
270 parser->h5file = parser->Title +
".orbs.h5";
271 parser->IonSystem.setName(ion_tag);
274 parser->UseHDF5 =
false;
277 parser->multideterminant =
false;
279 parser->multideterminant = ci;
282 parser->multideterminant = multidet;
283 parser->multidetH5 = multidet;
285 parser->multih5file = punch_file;
286 parser->production = prod;
287 parser->ci_threshold = thres;
288 parser->optDetCoeffs = optDetCoeffs;
289 parser->target_state = TargetState;
290 parser->readNO = readNO;
291 parser->orderByExcitation = orderByExcitation;
292 parser->zeroCI = zeroCI;
293 parser->readGuess = readGuess;
294 parser->outputFile = punch_file;
295 parser->Image = Image;
296 parser->parse(in_file);
299 parser->addJastrow = addJastrow;
300 parser->WFS_name = jastrow;
303 std::cout <<
"Generating Inputs for Supertwist with coordinates:" << parser->STwist_Coord[0] <<
" " 304 << parser->STwist_Coord[1] <<
" " << parser->STwist_Coord[2] << std::endl;
305 parser->dumpPBC(psi_tag, ion_tag);
308 parser->dump(psi_tag, ion_tag);
309 parser->dumpStdInputProd(psi_tag, ion_tag);
313 parser->addJastrow = addJastrow;
314 parser->WFS_name = jastrow;
317 std::cout <<
"Generating Inputs for Supertwist with coordinates:" << parser->STwist_Coord[0] <<
" " 318 << parser->STwist_Coord[1] <<
" " << parser->STwist_Coord[2] << std::endl;
319 parser->dumpPBC(psi_tag, ion_tag);
322 parser->dump(psi_tag, ion_tag);
323 parser->dumpStdInput(psi_tag, ion_tag);
326 catch (
const std::exception&
e)
Declaration of OutputManager class.
void shutOff()
Permanently shut off all streams.
std::ostream & app_error()
Communicate * Controller
Global Communicator for a process.
OutputManagerClass outputManager(Verbosity::HIGH)
Wrapping information on parallelism.
std::string_view getExtension(const std::string_view str)
int main(int argc, char **argv)
#define APP_ABORT(msg)
Widely used but deprecated fatal error macros from legacy code.
Declare a global Random Number Generator.