source: ThirdParty/mpqc_open/src/bin/mpqc/validate/makein.pl@ 86fb69

Action_Thermostats Add_AtomRandomPerturbation Add_RotateAroundBondAction Add_SelectAtomByNameAction Adding_Graph_to_ChangeBondActions Adding_MD_integration_tests Adding_StructOpt_integration_tests AutomationFragmentation_failures Candidate_v1.6.0 Candidate_v1.6.1 ChangeBugEmailaddress ChangingTestPorts ChemicalSpaceEvaluator Combining_Subpackages Debian_Package_split Debian_package_split_molecuildergui_only Disabling_MemDebug Docu_Python_wait EmpiricalPotential_contain_HomologyGraph_documentation Enable_parallel_make_install Enhance_userguide Enhanced_StructuralOptimization Enhanced_StructuralOptimization_continued Example_ManyWaysToTranslateAtom Exclude_Hydrogens_annealWithBondGraph FitPartialCharges_GlobalError Fix_ChronosMutex Fix_StatusMsg Fix_StepWorldTime_single_argument Fix_Verbose_Codepatterns ForceAnnealing_goodresults ForceAnnealing_oldresults ForceAnnealing_tocheck ForceAnnealing_with_BondGraph ForceAnnealing_with_BondGraph_continued ForceAnnealing_with_BondGraph_continued_betteresults ForceAnnealing_with_BondGraph_contraction-expansion GeometryObjects Gui_displays_atomic_force_velocity IndependentFragmentGrids_IntegrationTest JobMarket_RobustOnKillsSegFaults JobMarket_StableWorkerPool JobMarket_unresolvable_hostname_fix ODR_violation_mpqc_open PartialCharges_OrthogonalSummation PythonUI_with_named_parameters QtGui_reactivate_TimeChanged_changes Recreated_GuiChecks RotateToPrincipalAxisSystem_UndoRedo StoppableMakroAction Subpackage_levmar Subpackage_vmg ThirdParty_MPQC_rebuilt_buildsystem TremoloParser_IncreasedPrecision TremoloParser_MultipleTimesteps Ubuntu_1604_changes stable
Last change on this file since 86fb69 was 860145, checked in by Frederik Heber <heber@…>, 8 years ago

Merge commit '0b990dfaa8c6007a996d030163a25f7f5fc8a7e7' as 'ThirdParty/mpqc_open'

  • Property mode set to 100755
File size: 15.5 KB
Line 
1#
2eval 'exec perl $0 $*'
3 if 0;
4
5require QCParse;
6
7$prefix = "";
8@files = ();
9%files = ();
10$writefiles = 1;
11$echonames = 0;
12$dir = "";
13%basissets = (
14 "STO-2G" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
15 "STO-3G" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],
16 "STO-3G*" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
17 "STO-6G" => [1,2,3,4,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],
18 "MINI (Huzinaga)" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
19 "MINI (Scaled)" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
20 "MIDI (Huzinaga)" => [1,2,3,4,5,6,7,8,9,10,11],
21 "DZ (Dunning)" => [1,3,5,6,7,8,9,10,13,14,15,16,17],
22 "DZP (Dunning)" => [1,3,5,6,7,8,9,10,13,14,15,16,17],
23 "DZP + Diffuse (Dunning)" => [1,5,6,7,8,9,10],
24 "3-21G" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36],
25 "3-21G*" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
26 "3-21++G" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
27 "3-21++G*" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
28 "4-31G" => [1,2,3,4,5,6,7,8,9,10,15,16,17],
29 "6-31G" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
30 "6-31G*" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
31 "6-31G**" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
32 "6-31+G*" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
33 "6-31++G" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
34 "6-31++G*" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
35 "6-31++G**" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
36 "6-311G" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,31,32,33,34,35,36],
37 "6-311G*" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,31,32,33,34,35,36],
38 "6-311G**" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,31,32,33,34,35,36],
39 "6-311G(2df,2pd)" => [1,2,3,4,5,6,7,8,9,10],
40 "6-311++G**" => [1,2,3,4,5,6,7,8,9,10],
41 "6-311++G(2d,2p)" => [1,2,3,4,5,6,7,8,9,10],
42 "6-311++G(3df,3pd)" => [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18],
43 "cc-pVDZ" => [1,2,5,6,7,8,9,10,13,14,15,16,17,18],
44 "cc-pVTZ" => [1,2,5,6,7,8,9,10,13,14,15,16,17,18],
45 "cc-pVQZ" => [1,2,5,6,7,8,9,10,13,14,15,16,17,18],
46 "cc-pV5Z" => [1,2,3,4,5,6,7,8,9,10,13,14,15,16,17,18],
47 "aug-cc-pVDZ" => [1,2,5,6,7,8,9,10,13,14,15,16,17,18],
48 "aug-cc-pVTZ" => [1,2,5,6,7,8,9,10,13,14,15,16,17,18],
49 "aug-cc-pVQZ" => [1,2,5,6,7,8,9,10,13,14,15,16,17,18],
50 "aug-cc-pV5Z" => [1,2,5,6,7,8,9,10,13,14,15,16,17,18],
51 "cc-pCVDZ" => [5,6,7,8,9,10],
52 "cc-pCVTZ" => [5,6,7,8,9,10],
53 "cc-pCVQZ" => [5,6,7,8,9,10],
54 "cc-pCV5Z" => [5,6,7,8,9,10],
55 "aug-cc-pCVDZ" => [5,6,7,8,9],
56 "aug-cc-pCVTZ" => [5,6,7,8,9,10],
57 "aug-cc-pCVQZ" => [5,6,7,8,9,10],
58 "aug-cc-pCV5Z" => [5,6,7,8,9],
59 "NASA Ames ANO" => [1,5,6,7,8,9,10,13,15,22,26,28],
60 "pc-0" => [1,6,7,8,9,14,15,16,17],
61 "pc-1" => [1,6,7,8,9,14,15,16,17],
62 "pc-2" => [1,6,7,8,9,14,15,16,17],
63 "pc-3" => [1,6,7,8,9,14,15,16,17],
64 "pc-4" => [1,6,7,8,9,14,15,16,17],
65 "pc-0-aug" => [1,6,7,8,9,14,15,16,17],
66 "pc-1-aug" => [1,6,7,8,9,14,15,16,17],
67 "pc-2-aug" => [1,6,7,8,9,14,15,16,17],
68 "pc-3-aug" => [1,6,7,8,9,14,15,16,17],
69 "pc-4-aug" => [1,6,7,8,9,14,15,16,17]
70);
71
72while ($_ = shift) {
73 if (/^-I(.*)/) {
74 $prefix = $1;
75 }
76 elsif (/^-p(.+)$/) {
77 $package = $1;
78 }
79 elsif (/^-p$/) {
80 $package = shift;
81 }
82 elsif (/^-e$/) {
83 $writefiles = 0;
84 $echonames = 1;
85 }
86 elsif (/^-d$/) {
87 $dir = shift;
88 $dir = "$dir/";
89 }
90 else {
91 unshift @files, $_;
92 }
93}
94
95foreach $i (@files) {
96 process_file($i, $package);
97}
98
99if ($echonames) {
100 for $i (keys(%files)) {
101 print "$i\n";
102 }
103}
104
105sub process_file {
106 my $file = shift;
107 my $package = shift;
108 my $parse = new QCParse;
109
110 my $fullfile = "$prefix/$file";
111 $parse->parse_file($fullfile);
112 if (! $echonames) {
113 print "File: $fullfile\n";
114 }
115
116 $file =~ s/^.*\/([^\/]*)$/\1/;
117 $file =~ s/\..*$//;
118
119 my $test_vars = {};
120 init_var($test_vars, $parse, "basis", "STO-3G");
121 init_var($test_vars, $parse, "auxbasis", "");
122 init_var($test_vars, $parse, "grid", "default");
123 init_var($test_vars, $parse, "symmetry", "C1");
124 init_var($test_vars, $parse, "method", "SCF");
125 init_var($test_vars, $parse, "calc", "energy");
126 init_var($test_vars, $parse, "fzc", 0);
127 init_var($test_vars, $parse, "fzv", 0);
128 init_var($test_vars, $parse, "docc", "auto");
129 init_var($test_vars, $parse, "socc", "auto");
130 init_var($test_vars, $parse, "multiplicity", 1);
131 init_var($test_vars, $parse, "gradient", "default");
132 init_var($test_vars, $parse, "molecule", "molecule");
133 init_var($test_vars, $parse, "orthog_method", "default");
134 init_var($test_vars, $parse, "lindep_tol", "default");
135 init_var($test_vars, $parse, "integral_buffer", "opaque");
136 init_var($test_vars, $parse, "integral_package", "intv3");
137 my @molecule_symmetry = $parse->value_as_array("test_molecule_symmetry");
138 my @molecule_fzc = $parse->value_as_array("test_molecule_fzc");
139 my @molecule_fzv = $parse->value_as_array("test_molecule_fzv");
140 my @molecule_docc = $parse->value_as_array("test_molecule_docc");
141 my @molecule_socc = $parse->value_as_array("test_molecule_socc");
142 my @molecule_mult = $parse->value_as_array("test_molecule_multiplicity");
143 my @molecule_gradient = $parse->value_as_array("test_molecule_gradient");
144 my @molecule_followed = $parse->value_as_array("test_molecule_followed");
145 my @molecule_fixed = $parse->value_as_array("test_molecule_fixed");
146 my $do_cca = "";
147 my $tmp_do_cca = $parse->value("do_cca");
148 if ($tmp_do_cca eq "yes") {
149 $do_cca = "yes";
150 }
151
152 my @keys = keys(%{$test_vars});
153 my $index = {};
154 my $size = {};
155 my $i;
156 foreach $i (@keys) {
157 $index->{$i} = 0;
158 $size->{$i} = scalar(@{$test_vars->{$i}});
159 }
160 for ($i=0; $i < $nkeys; $i++) { $vals->{$i} = 0; }
161 # this is equivalent to a nested loop for each test var,
162 # but is much easier to maintain
163 do {
164 my $basis = $test_vars->{"basis"}->[$index->{"basis"}];
165 my $auxbasis = $test_vars->{"auxbasis"}->[$index->{"auxbasis"}];
166 my $grid = $test_vars->{"grid"}->[$index->{"grid"}];
167 my $fzc = $test_vars->{"fzc"}->[$index->{"fzc"}];
168 my $fzv = $test_vars->{"fzv"}->[$index->{"fzv"}];
169 my $docc = $test_vars->{"docc"}->[$index->{"docc"}];
170 my $socc = $test_vars->{"socc"}->[$index->{"socc"}];
171 my $mult = $test_vars->{"multiplicity"}->[$index->{"multiplicity"}];
172 my $gradient = $test_vars->{"gradient"}->[$index->{"gradient"}];
173 my $method = $test_vars->{"method"}->[$index->{"method"}];
174 my $calc = $test_vars->{"calc"}->[$index->{"calc"}];
175 my $symmetry = $test_vars->{"symmetry"}->[$index->{"symmetry"}];
176 my $molecule = $test_vars->{"molecule"}->[$index->{"molecule"}];
177 my $fixed = $molecule_fixed[$index->{"fixed"}];
178 my $followed = $molecule_fixed[$index->{"followed"}];
179 my $orthog_method = $test_vars->{"orthog_method"}->[$index->{"orthog_method"}];
180 my $lindep_tol = $test_vars->{"lindep_tol"}->[$index->{"lindep_tol"}];
181 my $integral_buffer = $test_vars->{"integral_buffer"}->[$index->{"integral_buffer"}];
182 my $integral_package = $test_vars->{"integral_package"}->[$index->{"integral_package"}];
183 # if i got an array of molecule names then i expect
184 # an array of point groups, one for each molecule
185 if ($molecule ne "molecule") {
186 my $molindex = $index->{"molecule"};
187 $symmetry = $molecule_symmetry[$molindex];
188 if ($symmetry eq "") {
189 printf "\n";
190 printf "index = %d\n", $molindex;
191 printf "symmetry not set for a molecule array\n";
192 exit 1;
193 }
194 # check for frozen orbitals
195 if ($#molecule_fzc >= $molindex) {
196 $fzc = $molecule_fzc[$molindex];
197 }
198 if ($#molecule_fzv >= $molindex) {
199 $fzv = $molecule_fzv[$molindex];
200 }
201 # check for occupations
202 if ($#molecule_docc >= $molindex) {
203 $docc = $molecule_docc[$molindex];
204 }
205 if ($#molecule_socc >= $molindex) {
206 $socc = $molecule_socc[$molindex];
207 }
208 if ($#molecule_mult >= $molindex) {
209 $mult = $molecule_mult[$molindex];
210 }
211 if ($#molecule_gradient >= $molindex) {
212 $gradient = $molecule_gradient[$molindex];
213 }
214 # check for fixed coordinates
215 $fixed = $molecule_fixed[$molindex];
216 if ($fixed eq "-") {
217 $fixed = "";
218 }
219 # check for followed coordinates
220 $followed = $molecule_followed[$molindex];
221 if ($followed eq "-") {
222 $followed = "";
223 }
224 }
225
226 # the filename to use for the calc
227 my $fcalc;
228
229 # only need fzc and fzv for correlated calculations
230 if (!($method =~ /MP2/i)
231 && !($method =~ /OPT1/i)
232 && !($method =~ /OPT2[2]/i)
233 && !($method =~ /ZAPT2/i)) {
234 $fzc = "";
235 $fzv = "";
236 }
237 if ($calc eq "energy") {
238 $parse->set_value("optimize", "no");
239 $parse->set_value("frequencies", "no");
240 $fcalc = "";
241 }
242 elsif ($calc eq "opt") {
243 $parse->set_value("optimize", "yes");
244 $parse->set_value("frequencies", "no");
245 $fcalc = "opt";
246 }
247 elsif ($calc eq "freq") {
248 $parse->set_value("optimize", "no");
249 $parse->set_value("frequencies", "yes");
250 $fcalc = "frq";
251 }
252 elsif ($calc eq "optfreq") {
253 $parse->set_value("optimize", "yes");
254 $parse->set_value("frequencies", "yes");
255 $fcalc = "optfrq";
256 }
257 else {
258 print "Bad value for calc: $calc\n";
259 exit 1;
260 }
261
262 my $fextra = ""; # extra filename modifiers
263 $parse->set_value("basis", $basis);
264 $parse->set_value("auxbasis", $auxbasis);
265 $parse->set_value("grid", $grid);
266 $parse->set_value("method", $method);
267 $parse->set_value("symmetry", $symmetry);
268 $parse->set_value("integral_buffer", $integral_buffer);
269 $parse->set_value("integral_package", $integral_package);
270 $parse->set_value("fzc", $fzc);
271 $parse->set_value("fzv", $fzv);
272 $parse->set_value("docc", $docc);
273 $parse->set_value("socc", $socc);
274 $parse->set_value("state", $mult);
275 if ($gradient ne "default") {
276 if ($method =~ /v[12](lb)?$/) {
277 # these methods don't support gradients
278 $parse->set_value("gradient", "no");
279 }
280 else {
281 $parse->set_value("gradient", $gradient);
282 }
283 }
284 if ($orthog_method ne "default") {
285 $parse->set_value("orthog_method", $orthog_method);
286 if ($orthog_method eq "gramschmidt") {
287 $fextra = "gs$fextra";
288 }
289 elsif ($orthog_method eq "canonical") {
290 $fextra = "can$fextra";
291 }
292 elsif ($orthog_method eq "symmetric") {
293 $fextra = "sym$fextra";
294 }
295 else {
296 $fextra = "$orthog_method$fextra";
297 }
298 }
299 if ($lindep_tol ne "default") {
300 $parse->set_value("lindep_tol", $lindep_tol);
301 my $ldtolindex = $index->{"lindep_tol"};
302 $fextra = "t$ldtolindex$fextra";
303 }
304 $parse->set_value("molecule", $parse->value($molecule));
305 $parse->set_value("fixed", $parse->value($fixed));
306 $parse->set_value("followed", $parse->value($followed));
307 my $qcinput = new QCInput($parse);
308 my $fmol = $molecule;
309 $fmol = "" if ($molecule eq "molecule");
310 $fmol = tofilename($fmol);
311
312 # make sure that the basis set exists for all of the
313 # atoms in the molecule
314 my $molobject = $qcinput->molecule();
315 my $allowedatoms = $basissets{$basis};
316 my $ok = 1;
317 for $symbol (0..($molobject->n_atom()-1)) {
318 my $z = $molobject->z($symbol);
319 my $gotit = 0;
320 for $ztmp (@{$allowedatoms}) {
321 if ($ztmp == $z) {
322 $gotit = 1;
323 last;
324 }
325 }
326 $ok = 0 if (! $gotit);
327 }
328
329 my $spinok = 1;
330 if (($method =~ /MP2/i) && $mult > 1) {
331 $spinok = 0;
332 }
333
334 my $inputfile;
335 $method = tofilename($method);
336 $basis = tofilename($basis);
337 $auxbasis = tofilename($auxbasis);
338 $symmetry = tofilename($symmetry);
339 if ($do_cca eq "yes"){
340 $intbuf = tofilename($integral_buffer);
341 $intpack = tofilename($integral_package);
342 }
343 else {
344 $intbuf = "";
345 $intpack = "";
346 }
347 if ($grid eq "default") {$grid = "";}
348 my $basename = "$dir$file\_$fmol$method$grid$fzc$fzv$basis$auxbasis$symmetry$fcalc$fextra$intbuf$intpack";
349 my $writer;
350
351 if ($package eq "g94") {
352 $writer = new G94InputWriter($qcinput);
353 $inputfile = "$basename.com";
354 }
355 elsif ($package eq "mpqc") {
356 $writer = new MPQCInputWriter($qcinput);
357 $inputfile = "$basename.in";
358 }
359
360 if (! $ok) {
361 if (! $echonames) {
362 printf "skipping $inputfile since basis not available\n";
363 }
364 }
365 elsif (! $spinok) {
366 if (! $echonames) {
367 printf "skipping $inputfile due to mult/method combo\n";
368 }
369 }
370 else {
371 if ($writefiles) {
372 $writer->write_input("$inputfile.tmp");
373 $writer->write_qcinput("$basename.qci");
374 if ($files{"$inputfile"}) {
375 unlink("$inputfile.tmp");
376 }
377 else {
378 $files{"$inputfile"} = 1;
379 my $ret = 1;
380 $ret = system("cmp $inputfile $inputfile.tmp > /dev/null 2>&1")/256
381 if (-f "$inputfile");
382 if ($ret != 0) {
383 print "writing $inputfile\n";
384 rename("$inputfile.tmp", "$inputfile");
385 }
386 else {
387 unlink("$inputfile.tmp");
388 print "$inputfile is unchanged\n";
389 }
390 }
391 }
392 else {
393 $files{"$inputfile"} = 1;
394 }
395 }
396
397 } while (incr($index,$size));
398}
399
400sub incr {
401 my $index = shift;
402 my $size = shift;
403 my @keys = keys(%{$index});
404 my $i;
405 my $dozero = 0;
406 while ($i = shift(@keys)) {
407 if ($index->{$i} < $size->{$i} - 1) {
408 $index->{$i}++;
409 return 1;
410 }
411 else {
412 $index->{$i} = 0;
413 }
414 }
415 return 0;
416}
417
418sub init_var {
419 my $vars = shift;
420 my $parse = shift;
421 my $name = shift;
422 my $default = shift;
423 my $testname = "test_$name";
424 my @ar = $parse->value_as_array($testname);
425 if ($#ar < 0) { @ar = ( $default ); }
426 $vars->{$name} = \@ar;
427}
428
429sub tofilename {
430 my $raw = shift;
431 $raw =~ tr/A-Z/a-z/;
432 $raw =~ s/-//g;
433 $raw =~ s/ //g;
434 $raw =~ s/\*/s/g;
435 $raw =~ s/\+/p/g;
436 $raw =~ s/\'/prime/g;
437 $raw =~ s./.slash.g;
438 $raw;
439}
Note: See TracBrowser for help on using the repository browser.