|
78 | 78 | ), |
79 | 79 | dict( |
80 | 80 | name="orca-mixed-per-element", |
81 | | - fixture="water_mixed.gbs", |
| 81 | + fixture="water_mixed_orca.gbs", |
82 | 82 | exporter="std2ORCA", |
83 | 83 | expect=[("no route card", lambda t: "useRouteCard" not in t), |
84 | 84 | ("O named via NewGTO", |
|
95 | 95 | ("Pt explicit", lambda t: "2.63000000" in t), |
96 | 96 | ("ECP still written", lambda t: "PT-ECP" in t)], |
97 | 97 | ), |
| 98 | + dict( |
| 99 | + name="orca-general-contraction", |
| 100 | + fixture="water_gencontr.gbs", |
| 101 | + exporter="std2ORCA", |
| 102 | + # cc-pVDZ oxygen s is 8 primitives and TWO contractions. The ORCA |
| 103 | + # writer once wrote only the first, so water had 23 functions |
| 104 | + # instead of 24 and the energy was 0.3 Eh off. |
| 105 | + expect=[("both contractions of the 8-primitive s shell are written", |
| 106 | + lambda t: t.count(" S 8") == 2), |
| 107 | + ("the second column's coefficients are there", |
| 108 | + lambda t: "-0.00016000" in t and "0.55736800" in t)], |
| 109 | + ), |
98 | 110 | dict( |
99 | 111 | name="orca-ecp-per-element", |
100 | 112 | fixture="pth_ecp.gbs", |
@@ -355,6 +367,59 @@ def orca_ecp_rows_shape_ok(text): |
355 | 367 | return True |
356 | 368 |
|
357 | 369 |
|
| 370 | +def name_tables(): |
| 371 | + """%NameToBasis in the ORCA and Gaussian 16 writers. |
| 372 | +
|
| 373 | + Every entry was run against the real code (tests/basisload/ |
| 374 | + named_basis_check.py) and judged by energy against ECCE's own |
| 375 | + primitives. This pins a representative set -- a name that silently |
| 376 | + maps to a different basis, or a verified name that goes missing -- |
| 377 | + without needing either code. ECCE name -> keyword, exactly. |
| 378 | + """ |
| 379 | + def table(path): |
| 380 | + text = open(os.path.join(PARSERS, path)).read() |
| 381 | + return dict(re.findall(r'\$NameToBasis\{"([^"]+)"\}\s*=\s*"([^"]+)"', |
| 382 | + text)) |
| 383 | + |
| 384 | + must = { |
| 385 | + "wrORCAGBS.pm": { |
| 386 | + "6-31g*": "6-31G*", "cc-pvdz": "cc-pVDZ", |
| 387 | + "aug-cc-pvtz": "aug-cc-pVTZ", "cc-pvtz-dk": "cc-pVTZ-DK", |
| 388 | + "cc-pwcvtz": "cc-pwCVTZ", "aug-cc-pcvdz": "aug-cc-pCVDZ", |
| 389 | + "pc-2": "pc-2", "pcseg-2": "pcseg-2", "iglo-ii": "IGLO-II", |
| 390 | + "def2-svp(p)": "def2-SV(P)", "ahlrichs vdz": "SV", |
| 391 | + "3-21gsp": "3-21GSP", "def2-tzvp": "def2-TZVP"}, |
| 392 | + "wrGaussian16GBS.pm": { |
| 393 | + "6-31g*": "6-31G*", "6-31++g*": "6-31++G*", |
| 394 | + "cc-pvdz": "cc-pvdz", "def2-svp": "def2SVP", |
| 395 | + "def2-svp(p)": "def2SVPP", "midi!": "midix", |
| 396 | + "dz (dunning)": "d95", "ahlrichs vdz": "SV", |
| 397 | + "dzp (dunning)": "D95**", "sto-6g": "STO-6G"}, |
| 398 | + } |
| 399 | + # Rejected by the code or a different basis from ECCE's under the |
| 400 | + # same name: naming any of these must stay impossible. |
| 401 | + never = { |
| 402 | + "wrORCAGBS.pm": ["pcseg-0", "3-21g*", "4-31g", "6-31++g", |
| 403 | + "6-31++g*", "d-aug-cc-pvdz", "cc-pv(d+d)z", |
| 404 | + "dz (dunning)"], |
| 405 | + "wrGaussian16GBS.pm": ["6-31g(3df,3pd)", "cc-pvdz-dk", "cc-pcvdz", |
| 406 | + "d-aug-cc-pvdz", "pc-2", "iglo-ii"], |
| 407 | + } |
| 408 | + problems = [] |
| 409 | + for path in must: |
| 410 | + got = table(path) |
| 411 | + for name, kw in must[path].items(): |
| 412 | + if got.get(name) != kw: |
| 413 | + problems.append("%s: %r should map to %r, maps to %r" |
| 414 | + % (path, name, kw, got.get(name))) |
| 415 | + for name in never[path]: |
| 416 | + if name in got: |
| 417 | + problems.append("%s: %r is in the table but the code " |
| 418 | + "rejects it or its set differs from ECCE's" |
| 419 | + % (path, name)) |
| 420 | + return problems |
| 421 | + |
| 422 | + |
358 | 423 | def run(case): |
359 | 424 | path = os.path.join(PARSERS, case["exporter"]) |
360 | 425 | with open(os.path.join(FIXTURES, case["fixture"])) as handle: |
@@ -422,6 +487,10 @@ def main(): |
422 | 487 | for finding in mo_ordering_matches_the_code(): |
423 | 488 | failures.append("MO ordering: " + finding) |
424 | 489 |
|
| 490 | + checks += 1 |
| 491 | + for finding in name_tables(): |
| 492 | + failures.append("name tables: " + finding) |
| 493 | + |
425 | 494 | checks += 1 |
426 | 495 | for finding in basis_name_rules(args.verbose): |
427 | 496 | failures.append("basis name rules: " + finding) |
|
0 commit comments