3
\brief Parse the input file and command line for CINTS specific options.
10
#include<libipv1/ip_lib.h>
11
#include<libint/libint.h>
12
#include<libciomr/libciomr.h>
20
#include"scf_parsing.h"
23
namespace psi { namespace CINTS {
24
//! Main parsing routine for input.
31
UserOptions.print_lvl = 1;
32
errcod = ip_data("PRINT","%d",&(UserOptions.print_lvl),0);
34
/*--- This piece of code from CPHF by Ed Seidl ---*/
35
if (ip_exist("MEMORY", 0)) {
36
fndcor(&max_bytes, infile, outfile);
37
UserOptions.max_memory = max_bytes / sizeof(double);
40
UserOptions.max_memory = MAX_NUM_DOUBLES;
41
UserOptions.memory = UserOptions.max_memory;
44
errcod = ip_data("CUTOFF","%d",&cutoff_exp,0);
45
UserOptions.cutoff = 1.0/pow(10.0,(double)cutoff_exp);
47
UserOptions.fine_structure_alpha = 1.0;
48
errcod = ip_data("FINE_STRUCTURE_ALPHA","%lf",&(UserOptions.fine_structure_alpha),0);
50
UserOptions.make_oei = 1;
51
UserOptions.make_fock = 0;
52
UserOptions.make_eri = 1;
53
UserOptions.symm_ints = 1;
54
errcod = ip_boolean("MAKE_ERI",&(UserOptions.make_eri),0);
56
errcod = ip_data("S_FILE","%d",&(IOUnits.itapS),0);
57
errcod = ip_data("T_FILE","%d",&(IOUnits.itapT),0);
58
errcod = ip_data("V_FILE","%d",&(IOUnits.itapV),0);
59
if (UserOptions.make_eri)
60
errcod = ip_data("ERI_FILE","%d",&(IOUnits.itap33),0);
62
UserOptions.empirical_dispersion = 0;
63
errcod = ip_boolean("EMPIRICAL_DISPERSION",
64
&UserOptions.empirical_dispersion, 0);
66
UserOptions.scf_only = 0;
67
errcod = ip_string("WFN",&UserOptions.wfn,0);
68
if (UserOptions.wfn == NULL)
69
throw std::domain_error("Keyword WFN is missing");
70
if ((!strcmp("SCF",UserOptions.wfn)) ||
71
(!strcmp("SCF_MVD",UserOptions.wfn)))
72
UserOptions.scf_only = 1;
74
UserOptions.num_threads = 1;
75
errcod = ip_data("NUM_THREADS","%d",&(UserOptions.num_threads),0);
76
if (UserOptions.num_threads < 1)
77
UserOptions.num_threads = 1;
79
UserOptions.restart = 0;
80
errcod = ip_boolean("RESTART",&UserOptions.restart,0);
81
if (UserOptions.restart) {
82
errcod = ip_data("RESTART_TASK","%d",&UserOptions.restart_task,0);
83
if (UserOptions.restart_task < 0)
84
throw std::domain_error("RESTART_TASK < 0");
87
std::vector<double> temp(3);
88
errcod = ip_double_array("ORIGIN", &temp[0], 3);
89
if(errcod == IPE_OK) {
90
UserOptions.origin.x = temp[0];
91
UserOptions.origin.y = temp[1];
92
UserOptions.origin.z = temp[2];
95
UserOptions.origin.x = 0;
96
UserOptions.origin.y = 0;
97
UserOptions.origin.z = 0;
99
UserOptions.origin.Z_nuc = 0;
101
UserOptions.E_given = false;
102
if (ip_exist("EFIELD",0)) {
103
UserOptions.E_given = true;
104
errcod = ip_double_array("EFIELD", UserOptions.E, 3);
106
throw std::runtime_error("Could not read EFIELD");
108
// if the field is specified also need to query the frame
110
errcod = ip_string("EFIELD_FRAME",&frame,0);
111
if (errcod == IPE_OK) {
112
if (!strcmp(frame,"CANONICAL"))
113
UserOptions.E_frame = canonical;
114
else if (!strcmp(frame,"REFERENCE"))
115
UserOptions.E_frame = reference;
117
throw std::invalid_argument("Invalid value for keyword EFIELD_FRAME");
121
UserOptions.E_frame = canonical;
131
//! Parses the command line for options.
132
void parsing_cmdline(int argc, char *argv[])
137
for (i=1; i<argc; i++) {
139
/*--- build Fock option ---*/
140
if (strcmp(argv[i], "--fock") == 0) {
143
/*UserOptions.make_oei = 0;
144
UserOptions.make_eri = 0;
145
UserOptions.make_fock = 1;
146
UserOptions.print_lvl = 0;
147
UserOptions.symm_ints = 0;
148
UserOptions.make_dft = 0;
149
errcod = ip_string("REFERENCE",&refstring,0);
150
if (errcod != IPE_OK)
151
throw std::domain_error("REFERENCE keyword is missing");
152
else if (!strcmp(refstring,"RHF") || !strcmp(refstring,""))
153
UserOptions.reftype = rhf;
154
else if (!strcmp(refstring,"ROHF"))
155
UserOptions.reftype = rohf;
156
else if (!strcmp(refstring,"UHF"))
157
UserOptions.reftype = uhf;
158
else if (!strcmp(refstring,"RKS")){
159
UserOptions.reftype = rhf;
160
UserOptions.make_dft = 1;
162
else if (!strcmp(refstring,"UKS")){
163
UserOptions.reftype = uhf;
164
UserOptions.make_dft = 1;
167
throw std::domain_error("The specified REFERENCE not implemented");*/
169
throw std::domain_error("--fock option is not supported by your CINTS executable.\nRecompile the code including files in Fock subdirectory.");
174
/*--- build oeints option ---*/
175
if (strcmp(argv[i], "--oeints") == 0) {
176
#ifdef INCLUDE_Default_Ints
177
UserOptions.make_oei = 1;
178
UserOptions.make_eri = 0;
179
UserOptions.make_fock = 0;
180
UserOptions.print_lvl = 0;
181
UserOptions.symm_ints = 1;
182
UserOptions.num_threads = 1;
184
throw std::domain_error("--oeints option is not supported by your CINTS executable.\nRecompile the code including files in Default_Ints subdirectory.");
189
/*--- build ERIs option ---*/
190
if (strcmp(argv[i], "--teints") == 0) {
191
#ifdef INCLUDE_Default_Ints
192
UserOptions.make_oei = 0;
193
UserOptions.make_eri = 1;
194
UserOptions.make_fock = 0;
195
UserOptions.print_lvl = 0;
196
UserOptions.symm_ints = 1;
197
UserOptions.num_threads = 1;
199
throw std::domain_error("--teints option is not supported by your CINTS executable.\nRecompile the code including files in Default_Ints subdirectory.");
204
/*--- compute 1st derivatives option ---*/
205
if (strcmp(argv[i], "--deriv1") == 0) {
206
#ifdef INCLUDE_Default_Deriv1
207
UserOptions.make_oei = 0;
208
UserOptions.make_eri = 0;
209
UserOptions.make_fock = 0;
210
UserOptions.make_deriv1 = 1;
211
UserOptions.make_deriv1_mvd = 0;
212
if (!strcmp("SCF_MVD",UserOptions.wfn))
213
UserOptions.make_deriv1_mvd = 1;
214
UserOptions.symm_ints = 0;
215
UserOptions.dertype = strdup("FIRST");
216
if (!strcmp("SCF",UserOptions.wfn)) {
217
errcod = ip_string("REFERENCE",&refstring,0);
218
if (errcod != IPE_OK)
219
throw std::domain_error("REFERENCE keyword is missing");
220
else if (!strcmp(refstring,"RHF") || !strcmp(refstring,""))
221
UserOptions.reftype = rhf;
222
else if (!strcmp(refstring,"ROHF"))
223
UserOptions.reftype = rohf;
224
else if (!strcmp(refstring,"UHF"))
225
UserOptions.reftype = uhf;
226
else if (!strcmp(refstring,"TWOCON"))
227
UserOptions.reftype = twocon;
229
throw std::domain_error("SCF gradients with specified REFERENCE not implemented");
231
if (!strcmp("SCF_MVD",UserOptions.wfn)) {
232
if (UserOptions.reftype != rhf)
233
throw std::domain_error("SCF_MVD gradients with specified REFERENCE not implemented");
235
if ((strcmp("SCF",UserOptions.wfn)) && (strcmp("SCF_MVD",UserOptions.wfn)))
236
UserOptions.num_threads = 1;
238
throw std::domain_error("--deriv1 option is not supported by your CINTS executable.\nRecompile the code including files in Default_Deriv1 subdirectory.");
243
/*--- compute 1st derivative integrals option ---*/
244
if (strcmp(argv[i], "--deriv1_ints") == 0) {
245
#ifdef INCLUDE_Default_Deriv1
246
UserOptions.make_oei = 0;
247
UserOptions.make_eri = 0;
248
UserOptions.make_fock = 0;
249
UserOptions.symm_ints = 1;
250
UserOptions.make_deriv1 = 1;
251
UserOptions.num_threads = 1;
252
UserOptions.make_mkpt2_ints = 0;
254
throw std::domain_error("--deriv1_ints option is not supported by your CINTS executable.\nRecompile the code including files in Default_Deriv1 subdirectory.");
259
/*--- compute 2nd derivatives ---*/
260
if(!strcmp(argv[i], "--deriv2")) {
261
#ifdef INCLUDE_Default_Deriv2
262
UserOptions.make_oei = 0;
263
UserOptions.make_eri = 0;
264
UserOptions.make_fock = 0;
265
UserOptions.symm_ints = 0;
266
UserOptions.make_deriv2 = 1;
267
UserOptions.make_mkpt2_ints = 0;
269
throw std::domain_error("--deriv2 option is not supported by your CINTS executable.\nRecompile the code including files in Default_Deriv2 subdirectory.");
274
/*--- compute one-electron property integrals option ---*/
275
if (strcmp(argv[i], "--oeprop") == 0) {
276
#ifdef INCLUDE_OEProp_Ints
277
UserOptions.make_oei = 0;
278
UserOptions.make_eri = 0;
279
UserOptions.make_fock = 0;
280
UserOptions.make_oeprop = 1;
281
UserOptions.symm_ints = 0;
282
UserOptions.print_lvl = 0;
283
UserOptions.make_mkpt2_ints = 0;
285
throw std::domain_error("--oeprop option is not supported by your CINTS executable.\nRecompile the code including files in OEProp_Ints subdirectory.");
290
/*--- compute MP2 energy option ---*/
291
if (strcmp(argv[i], "--mp2") == 0) {
293
UserOptions.make_oei = 0;
294
UserOptions.make_eri = 0;
295
UserOptions.make_fock = 0;
296
UserOptions.make_deriv1 = 0;
297
UserOptions.make_mp2 = 1;
298
UserOptions.make_r12ints = 0;
299
UserOptions.make_mp2r12 = 0;
300
UserOptions.make_cc_bt2 = 0;
301
UserOptions.symm_ints = 0;
302
UserOptions.make_mkpt2_ints = 0;
304
errcod = ip_string("REFERENCE",&refstring,0);
305
if (errcod != IPE_OK)
306
throw std::domain_error("REFERENCE keyword is missing");
307
else if (!strcmp(refstring,"RHF") || !strcmp(refstring,""))
308
UserOptions.reftype = rhf;
309
else if (!strcmp(refstring,"UHF")) {
310
UserOptions.reftype = uhf;
311
throw std::domain_error("UMP2 energy evaluation is not yet implemented");
314
throw std::domain_error("MP2 energy evaluation with specified REFERENCE not implemented");
316
throw std::domain_error("--mp2 option is not supported by your CINTS executable.\nRecompile the code including files in MP2 subdirectory.");
321
/*--- build te integrals for R12 methods option ---*/
322
if (strcmp(argv[i], "--r12ints") == 0) {
323
#ifdef INCLUDE_R12_Ints
324
UserOptions.make_oei = 0;
325
UserOptions.make_eri = 0;
326
UserOptions.make_fock = 0;
327
UserOptions.make_deriv1 = 0;
328
UserOptions.make_mp2 = 0;
329
UserOptions.make_r12ints = 1;
330
UserOptions.make_mp2r12 = 0;
331
UserOptions.make_cc_bt2 = 0;
332
UserOptions.symm_ints = 1;
333
UserOptions.num_threads = 1;
334
UserOptions.make_mkpt2_ints = 0;
336
throw std::domain_error("--r12ints option is not supported by your CINTS executable.\nRecompile the code including files in R12_Ints subdirectory.");
341
/*--- compute MP2-R12 energy option ---*/
342
if (strcmp(argv[i], "--mp2r12") == 0) {
343
#ifdef INCLUDE_MP2R12
344
UserOptions.make_oei = 0;
345
UserOptions.make_eri = 0;
346
UserOptions.make_fock = 0;
347
UserOptions.make_deriv1 = 0;
348
UserOptions.make_mp2 = 0;
349
UserOptions.make_r12ints = 0;
350
UserOptions.make_mp2r12 = 1;
351
UserOptions.make_cc_bt2 = 0;
352
UserOptions.symm_ints = 0;
353
UserOptions.make_mkpt2_ints = 0;
355
errcod = ip_string("REFERENCE",&refstring,0);
356
if (errcod != IPE_OK)
357
throw std::domain_error("REFERENCE keyword is missing");
358
else if (!strcmp(refstring,"RHF") || !strcmp(refstring,""))
359
UserOptions.reftype = rhf;
361
throw std::domain_error("Direct MP2-R12/A integrals transformation with specified REFERENCE not implemented");
363
throw std::domain_error("--mp2r12 option is not supported by your CINTS executable.\nRecompile the code including files in MP2R12 subdirectory.");
368
/*--- compute MkPT2 integrals option ---*/
369
if (strcmp(argv[i], "--mkpt2") == 0) {
371
UserOptions.make_oei = 0;
372
UserOptions.make_eri = 0;
373
UserOptions.make_fock = 0;
374
UserOptions.make_deriv1 = 0;
375
UserOptions.make_mp2 = 0;
376
UserOptions.make_r12ints = 0;
377
UserOptions.make_mp2r12 = 0;
378
UserOptions.make_cc_bt2 = 0;
379
UserOptions.symm_ints = 0;
380
UserOptions.make_mkpt2_ints = 1;
382
errcod = ip_string("REFERENCE",&refstring,0);
383
if (errcod != IPE_OK)
384
throw std::domain_error("REFERENCE keyword is missing");
385
else if (!strcmp(refstring,"RHF") || !strcmp(refstring,""))
386
UserOptions.reftype = rhf;
387
else if (!strcmp(refstring,"ROHF"))
388
UserOptions.reftype = rohf;
389
else if (!strcmp(refstring,"TWOCON"))
390
UserOptions.reftype = twocon;
392
throw std::domain_error("Direct MkPT2 integral computation with specified REFERENCE not implemented");
394
throw std::domain_error("--mkpt2 option is not supported by your CINTS executable.\nRecompile the code including files in MKPT2 subdirectory.");
400
/*--- compute 4-virtuals T2 contribution to CC equations ---*/
401
if (strcmp(argv[i], "--cc_bt2") == 0) {
403
UserOptions.make_oei = 0;
404
UserOptions.make_eri = 0;
405
UserOptions.make_fock = 0;
406
UserOptions.make_deriv1 = 0;
407
UserOptions.make_mp2 = 0;
408
UserOptions.make_mp2r12 = 0;
409
UserOptions.make_cc_bt2 = 1;
410
UserOptions.symm_ints = 0;
411
UserOptions.print_lvl = 0;
412
UserOptions.make_mkpt2_ints = 0;
414
errcod = ip_string("REFERENCE",&refstring,0);
415
if (errcod != IPE_OK)
416
throw std::domain_error("REFERENCE keyword is missing");
417
else if (!strcmp(refstring,"RHF") || !strcmp(refstring,""))
418
UserOptions.reftype = rhf;
420
throw std::domain_error("Direct CC four-virtuals term computation with specified REFERENCE not implemented");
422
throw std::domain_error("--cc_bt2 option is not supported by your CINTS executable.\nRecompile the code including files in CC subdirectory.");
427
/*--- compute derivatives integrals over GIAOs ---*/
428
if(!strcmp(argv[i], "--giao_deriv")) {
429
#ifdef INCLUDE_GIAO_Deriv
430
UserOptions.make_oei = 0;
431
UserOptions.make_eri = 0;
432
UserOptions.make_fock = 0;
433
UserOptions.symm_ints = 0;
434
UserOptions.make_giao_deriv = 1;
435
UserOptions.make_mkpt2_ints = 0;
437
throw std::domain_error("--giao_deriv option is not supported by your CINTS executable.\nRecompile the code including files in GIAO_Deriv subdirectory.");