nomad-parser-plugins-electronic 1.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- electronicparsers/__init__.py +1162 -0
- electronicparsers/abacus/__init__.py +20 -0
- electronicparsers/abacus/__main__.py +32 -0
- electronicparsers/abacus/metainfo/__init__.py +19 -0
- electronicparsers/abacus/metainfo/abacus.py +836 -0
- electronicparsers/abacus/nomad_plugin.yaml +44 -0
- electronicparsers/abacus/parser.py +1975 -0
- electronicparsers/abinit/__init__.py +19 -0
- electronicparsers/abinit/__main__.py +31 -0
- electronicparsers/abinit/metainfo/__init__.py +20 -0
- electronicparsers/abinit/metainfo/abinit.py +871 -0
- electronicparsers/abinit/metainfo/abinit_autogenerated.py +6794 -0
- electronicparsers/abinit/nomad_plugin.yaml +43 -0
- electronicparsers/abinit/parser.py +1922 -0
- electronicparsers/ams/__init__.py +19 -0
- electronicparsers/ams/__main__.py +31 -0
- electronicparsers/ams/metainfo/__init__.py +19 -0
- electronicparsers/ams/metainfo/ams.py +769 -0
- electronicparsers/ams/nomad_plugin.yaml +19 -0
- electronicparsers/ams/parser.py +1849 -0
- electronicparsers/ams/rkf.py +620 -0
- electronicparsers/atk/__init__.py +19 -0
- electronicparsers/atk/__main__.py +31 -0
- electronicparsers/atk/metainfo/__init__.py +19 -0
- electronicparsers/atk/metainfo/atk.py +71 -0
- electronicparsers/atk/nomad_plugin.yaml +34 -0
- electronicparsers/atk/parser.py +388 -0
- electronicparsers/bigdft/__init__.py +19 -0
- electronicparsers/bigdft/__main__.py +31 -0
- electronicparsers/bigdft/metainfo/__init__.py +18 -0
- electronicparsers/bigdft/nomad_plugin.yaml +19 -0
- electronicparsers/bigdft/parser.py +372 -0
- electronicparsers/castep/__init__.py +19 -0
- electronicparsers/castep/__main__.py +31 -0
- electronicparsers/castep/metainfo/__init__.py +19 -0
- electronicparsers/castep/metainfo/castep.py +2481 -0
- electronicparsers/castep/nomad_plugin.yaml +28 -0
- electronicparsers/castep/parser.py +1680 -0
- electronicparsers/charmm/__init__.py +19 -0
- electronicparsers/charmm/__main__.py +31 -0
- electronicparsers/charmm/metainfo/__init__.py +19 -0
- electronicparsers/charmm/metainfo/charmm.py +1931 -0
- electronicparsers/charmm/nomad_plugin.yaml +18 -0
- electronicparsers/charmm/parser.py +61 -0
- electronicparsers/cp2k/__init__.py +19 -0
- electronicparsers/cp2k/__main__.py +31 -0
- electronicparsers/cp2k/metainfo/__init__.py +19 -0
- electronicparsers/cp2k/metainfo/cp2k.py +59185 -0
- electronicparsers/cp2k/metainfo/cp2k_general.py +1014 -0
- electronicparsers/cp2k/nomad_plugin.yaml +49 -0
- electronicparsers/cp2k/parser.py +2324 -0
- electronicparsers/cpmd/__init__.py +19 -0
- electronicparsers/cpmd/__main__.py +31 -0
- electronicparsers/cpmd/metainfo/__init__.py +19 -0
- electronicparsers/cpmd/metainfo/cpmd.py +10733 -0
- electronicparsers/cpmd/metainfo/cpmd_general.py +988 -0
- electronicparsers/cpmd/nomad_plugin.yaml +19 -0
- electronicparsers/cpmd/parser.py +680 -0
- electronicparsers/crystal/__init__.py +19 -0
- electronicparsers/crystal/__main__.py +31 -0
- electronicparsers/crystal/metainfo/__init__.py +19 -0
- electronicparsers/crystal/metainfo/crystal.py +619 -0
- electronicparsers/crystal/nomad_plugin.yaml +36 -0
- electronicparsers/crystal/parser.py +1745 -0
- electronicparsers/dmol3/__init__.py +19 -0
- electronicparsers/dmol3/__main__.py +31 -0
- electronicparsers/dmol3/metainfo/__init__.py +19 -0
- electronicparsers/dmol3/metainfo/dmol3.py +664 -0
- electronicparsers/dmol3/nomad_plugin.yaml +19 -0
- electronicparsers/dmol3/parser.py +750 -0
- electronicparsers/edmft/__init__.py +19 -0
- electronicparsers/edmft/__main__.py +31 -0
- electronicparsers/edmft/metainfo/__init__.py +19 -0
- electronicparsers/edmft/metainfo/edmft.py +96 -0
- electronicparsers/edmft/nomad_plugin.yaml +53 -0
- electronicparsers/edmft/parser.py +912 -0
- electronicparsers/elk/__init__.py +19 -0
- electronicparsers/elk/__main__.py +31 -0
- electronicparsers/elk/metainfo/__init__.py +19 -0
- electronicparsers/elk/metainfo/elk.py +775 -0
- electronicparsers/elk/nomad_plugin.yaml +19 -0
- electronicparsers/elk/parser.py +493 -0
- electronicparsers/exciting/__init__.py +19 -0
- electronicparsers/exciting/__main__.py +31 -0
- electronicparsers/exciting/metainfo/__init__.py +19 -0
- electronicparsers/exciting/metainfo/exciting.py +2942 -0
- electronicparsers/exciting/nomad_plugin.yaml +83 -0
- electronicparsers/exciting/parser.py +3398 -0
- electronicparsers/fhiaims/__init__.py +19 -0
- electronicparsers/fhiaims/__main__.py +31 -0
- electronicparsers/fhiaims/metainfo/__init__.py +19 -0
- electronicparsers/fhiaims/metainfo/fhi_aims.py +1565 -0
- electronicparsers/fhiaims/nomad_plugin.yaml +52 -0
- electronicparsers/fhiaims/parser.py +2582 -0
- electronicparsers/fleur/__init__.py +19 -0
- electronicparsers/fleur/__main__.py +31 -0
- electronicparsers/fleur/metainfo/__init__.py +19 -0
- electronicparsers/fleur/metainfo/fleur.py +623 -0
- electronicparsers/fleur/nomad_plugin.yaml +19 -0
- electronicparsers/fleur/parser.py +952 -0
- electronicparsers/fplo/__init__.py +19 -0
- electronicparsers/fplo/__main__.py +31 -0
- electronicparsers/fplo/metainfo/__init__.py +19 -0
- electronicparsers/fplo/metainfo/fplo.py +188 -0
- electronicparsers/fplo/metainfo/fplo_input_autogenerated.py +2744 -0
- electronicparsers/fplo/metainfo/fplo_temporaries.py +319 -0
- electronicparsers/fplo/nomad_plugin.yaml +19 -0
- electronicparsers/fplo/parser.py +42 -0
- electronicparsers/gamess/__init__.py +19 -0
- electronicparsers/gamess/__main__.py +31 -0
- electronicparsers/gamess/metainfo/__init__.py +19 -0
- electronicparsers/gamess/metainfo/gamess.py +837 -0
- electronicparsers/gamess/nomad_plugin.yaml +19 -0
- electronicparsers/gamess/parser.py +941 -0
- electronicparsers/gaussian/__init__.py +19 -0
- electronicparsers/gaussian/__main__.py +31 -0
- electronicparsers/gaussian/metainfo/__init__.py +19 -0
- electronicparsers/gaussian/metainfo/gaussian.py +1707 -0
- electronicparsers/gaussian/nomad_plugin.yaml +18 -0
- electronicparsers/gaussian/parser.py +1556 -0
- electronicparsers/gpaw/__init__.py +19 -0
- electronicparsers/gpaw/__main__.py +31 -0
- electronicparsers/gpaw/metainfo/__init__.py +19 -0
- electronicparsers/gpaw/metainfo/gpaw.py +214 -0
- electronicparsers/gpaw/nomad_plugin.yaml +19 -0
- electronicparsers/gpaw/parser.py +671 -0
- electronicparsers/magres/__init__.py +19 -0
- electronicparsers/magres/__main__.py +31 -0
- electronicparsers/magres/metainfo/__init__.py +19 -0
- electronicparsers/magres/metainfo/magres.py +110 -0
- electronicparsers/magres/nomad_plugin.yaml +18 -0
- electronicparsers/magres/parser.py +505 -0
- electronicparsers/molcas/__init__.py +19 -0
- electronicparsers/molcas/__main__.py +31 -0
- electronicparsers/molcas/metainfo/__init__.py +19 -0
- electronicparsers/molcas/metainfo/molcas.py +151 -0
- electronicparsers/molcas/nomad_plugin.yaml +19 -0
- electronicparsers/molcas/parser.py +59 -0
- electronicparsers/mopac/__init__.py +19 -0
- electronicparsers/mopac/__main__.py +31 -0
- electronicparsers/mopac/metainfo/__init__.py +19 -0
- electronicparsers/mopac/metainfo/mopac.py +79 -0
- electronicparsers/mopac/nomad_plugin.yaml +19 -0
- electronicparsers/mopac/parser.py +304 -0
- electronicparsers/nwchem/__init__.py +19 -0
- electronicparsers/nwchem/__main__.py +31 -0
- electronicparsers/nwchem/metainfo/__init__.py +19 -0
- electronicparsers/nwchem/metainfo/nwchem.py +487 -0
- electronicparsers/nwchem/nomad_plugin.yaml +19 -0
- electronicparsers/nwchem/parser.py +757 -0
- electronicparsers/ocean/__init__.py +19 -0
- electronicparsers/ocean/__main__.py +31 -0
- electronicparsers/ocean/metainfo/__init__.py +19 -0
- electronicparsers/ocean/metainfo/ocean.py +410 -0
- electronicparsers/ocean/nomad_plugin.yaml +37 -0
- electronicparsers/ocean/parser.py +344 -0
- electronicparsers/octopus/__init__.py +19 -0
- electronicparsers/octopus/__main__.py +31 -0
- electronicparsers/octopus/metainfo/__init__.py +19 -0
- electronicparsers/octopus/metainfo/octopus.py +71 -0
- electronicparsers/octopus/metainfo/octopus_autogenerated.py +11647 -0
- electronicparsers/octopus/nomad_plugin.yaml +41 -0
- electronicparsers/octopus/parser.py +1214 -0
- electronicparsers/onetep/__init__.py +19 -0
- electronicparsers/onetep/__main__.py +31 -0
- electronicparsers/onetep/metainfo/__init__.py +19 -0
- electronicparsers/onetep/metainfo/onetep.py +3443 -0
- electronicparsers/onetep/nomad_plugin.yaml +19 -0
- electronicparsers/onetep/parser.py +577 -0
- electronicparsers/openmx/__init__.py +19 -0
- electronicparsers/openmx/__main__.py +31 -0
- electronicparsers/openmx/metainfo/__init__.py +19 -0
- electronicparsers/openmx/metainfo/openmx.py +24 -0
- electronicparsers/openmx/nomad_plugin.yaml +25 -0
- electronicparsers/openmx/parser.py +918 -0
- electronicparsers/orca/__init__.py +19 -0
- electronicparsers/orca/__main__.py +31 -0
- electronicparsers/orca/metainfo/__init__.py +19 -0
- electronicparsers/orca/metainfo/orca.py +1448 -0
- electronicparsers/orca/nomad_plugin.yaml +19 -0
- electronicparsers/orca/parser.py +1371 -0
- electronicparsers/psi4/__init__.py +19 -0
- electronicparsers/psi4/__main__.py +31 -0
- electronicparsers/psi4/metainfo/__init__.py +19 -0
- electronicparsers/psi4/metainfo/psi4.py +372 -0
- electronicparsers/psi4/nomad_plugin.yaml +27 -0
- electronicparsers/psi4/parser.py +1362 -0
- electronicparsers/qball/__init__.py +19 -0
- electronicparsers/qball/__main__.py +31 -0
- electronicparsers/qball/metainfo/__init__.py +19 -0
- electronicparsers/qball/metainfo/qball.py +27 -0
- electronicparsers/qball/nomad_plugin.yaml +25 -0
- electronicparsers/qball/parser.py +152 -0
- electronicparsers/qbox/__init__.py +19 -0
- electronicparsers/qbox/__main__.py +31 -0
- electronicparsers/qbox/metainfo/__init__.py +19 -0
- electronicparsers/qbox/metainfo/qbox.py +490 -0
- electronicparsers/qbox/nomad_plugin.yaml +19 -0
- electronicparsers/qbox/parser.py +508 -0
- electronicparsers/quantumespresso/__init__.py +19 -0
- electronicparsers/quantumespresso/__main__.py +31 -0
- electronicparsers/quantumespresso/metainfo/__init__.py +19 -0
- electronicparsers/quantumespresso/metainfo/quantum_espresso.py +3296 -0
- electronicparsers/quantumespresso/nomad_plugin.yaml +31 -0
- electronicparsers/quantumespresso/parser.py +3594 -0
- electronicparsers/siesta/__init__.py +19 -0
- electronicparsers/siesta/__main__.py +31 -0
- electronicparsers/siesta/metainfo/__init__.py +19 -0
- electronicparsers/siesta/metainfo/siesta.py +141 -0
- electronicparsers/siesta/metainfo/siesta_autogenerated.py +3365 -0
- electronicparsers/siesta/nomad_plugin.yaml +19 -0
- electronicparsers/siesta/parser.py +607 -0
- electronicparsers/soliddmft/__init__.py +19 -0
- electronicparsers/soliddmft/__main__.py +31 -0
- electronicparsers/soliddmft/metainfo/__init__.py +19 -0
- electronicparsers/soliddmft/metainfo/soliddmft.py +274 -0
- electronicparsers/soliddmft/nomad_plugin.yaml +26 -0
- electronicparsers/soliddmft/parser.py +727 -0
- electronicparsers/tbstudio/__init__.py +19 -0
- electronicparsers/tbstudio/__main__.py +31 -0
- electronicparsers/tbstudio/metainfo/__init__.py +19 -0
- electronicparsers/tbstudio/metainfo/tbstudio.py +34 -0
- electronicparsers/tbstudio/nomad_plugin.yaml +24 -0
- electronicparsers/tbstudio/parser.py +412 -0
- electronicparsers/turbomole/__init__.py +19 -0
- electronicparsers/turbomole/__main__.py +31 -0
- electronicparsers/turbomole/metainfo/__init__.py +19 -0
- electronicparsers/turbomole/metainfo/turbomole.py +727 -0
- electronicparsers/turbomole/nomad_plugin.yaml +18 -0
- electronicparsers/turbomole/parser.py +1585 -0
- electronicparsers/utils/__init__.py +20 -0
- electronicparsers/utils/magres_workflow.py +61 -0
- electronicparsers/utils/utils.py +636 -0
- electronicparsers/vasp/__init__.py +19 -0
- electronicparsers/vasp/__main__.py +31 -0
- electronicparsers/vasp/metainfo/__init__.py +19 -0
- electronicparsers/vasp/metainfo/vasp.py +169 -0
- electronicparsers/vasp/metainfo/vasp_incars.py +3428 -0
- electronicparsers/vasp/metainfo/vasp_incarsOut.py +3428 -0
- electronicparsers/vasp/metainfo/vasp_incarsUnknown.py +86 -0
- electronicparsers/vasp/nomad_plugin.yaml +28 -0
- electronicparsers/vasp/parser.py +2340 -0
- electronicparsers/w2dynamics/__init__.py +19 -0
- electronicparsers/w2dynamics/__main__.py +31 -0
- electronicparsers/w2dynamics/metainfo/__init__.py +19 -0
- electronicparsers/w2dynamics/metainfo/w2dynamics.py +1270 -0
- electronicparsers/w2dynamics/nomad_plugin.yaml +36 -0
- electronicparsers/w2dynamics/parser.py +674 -0
- electronicparsers/wannier90/__init__.py +19 -0
- electronicparsers/wannier90/__main__.py +31 -0
- electronicparsers/wannier90/metainfo/__init__.py +19 -0
- electronicparsers/wannier90/metainfo/wannier90.py +56 -0
- electronicparsers/wannier90/nomad_plugin.yaml +34 -0
- electronicparsers/wannier90/parser.py +671 -0
- electronicparsers/wien2k/__init__.py +19 -0
- electronicparsers/wien2k/__main__.py +31 -0
- electronicparsers/wien2k/metainfo/__init__.py +19 -0
- electronicparsers/wien2k/metainfo/wien2k.py +783 -0
- electronicparsers/wien2k/nomad_plugin.yaml +18 -0
- electronicparsers/wien2k/parser.py +1133 -0
- electronicparsers/yambo/__init__.py +19 -0
- electronicparsers/yambo/__main__.py +31 -0
- electronicparsers/yambo/metainfo/__init__.py +19 -0
- electronicparsers/yambo/metainfo/yambo.py +577 -0
- electronicparsers/yambo/nomad_plugin.yaml +31 -0
- electronicparsers/yambo/parser.py +896 -0
- nomad_parser_plugins_electronic-1.0.dist-info/LICENSE +202 -0
- nomad_parser_plugins_electronic-1.0.dist-info/METADATA +360 -0
- nomad_parser_plugins_electronic-1.0.dist-info/RECORD +272 -0
- nomad_parser_plugins_electronic-1.0.dist-info/WHEEL +5 -0
- nomad_parser_plugins_electronic-1.0.dist-info/entry_points.txt +43 -0
- nomad_parser_plugins_electronic-1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,1362 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright The NOMAD Authors.
|
|
3
|
+
#
|
|
4
|
+
# This file is part of NOMAD.
|
|
5
|
+
# See https://nomad-lab.eu for further info.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
import os
|
|
20
|
+
import logging
|
|
21
|
+
from datetime import datetime
|
|
22
|
+
import numpy as np
|
|
23
|
+
|
|
24
|
+
from nomad.units import ureg
|
|
25
|
+
from nomad.parsing.file_parser import TextParser, Quantity
|
|
26
|
+
from runschema.run import Run, Program, TimeRun
|
|
27
|
+
from runschema.system import System, Atoms
|
|
28
|
+
from runschema.method import (
|
|
29
|
+
Electronic,
|
|
30
|
+
Method,
|
|
31
|
+
BasisSet,
|
|
32
|
+
BasisSetAtomCentered,
|
|
33
|
+
Scf as ScfMethod,
|
|
34
|
+
DFT,
|
|
35
|
+
XCFunctional,
|
|
36
|
+
Functional,
|
|
37
|
+
BasisSetContainer,
|
|
38
|
+
)
|
|
39
|
+
from runschema.calculation import (
|
|
40
|
+
Calculation,
|
|
41
|
+
Energy,
|
|
42
|
+
EnergyEntry,
|
|
43
|
+
Forces,
|
|
44
|
+
ForcesEntry,
|
|
45
|
+
ScfIteration,
|
|
46
|
+
BandEnergies,
|
|
47
|
+
Multipoles,
|
|
48
|
+
MultipolesEntry,
|
|
49
|
+
Charges,
|
|
50
|
+
ChargesValue,
|
|
51
|
+
)
|
|
52
|
+
from simulationworkflowschema import (
|
|
53
|
+
SinglePoint,
|
|
54
|
+
GeometryOptimization,
|
|
55
|
+
GeometryOptimizationMethod,
|
|
56
|
+
)
|
|
57
|
+
from .metainfo.psi4 import x_psi4_root_information
|
|
58
|
+
from .metainfo import psi4 # noqa
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
class OutParser(TextParser):
|
|
62
|
+
def __init__(self):
|
|
63
|
+
super().__init__(None)
|
|
64
|
+
|
|
65
|
+
def init_quantities(self):
|
|
66
|
+
re_f = r'-*\d+\.\d+[Ee]*[-+]*\d*'
|
|
67
|
+
|
|
68
|
+
def str_to_basis(val_in):
|
|
69
|
+
data = dict()
|
|
70
|
+
for line in val_in.strip().split('\n'):
|
|
71
|
+
line = line.split(':')
|
|
72
|
+
if len(line) == 2:
|
|
73
|
+
data[line[0].strip()] = line[1].strip()
|
|
74
|
+
return data
|
|
75
|
+
|
|
76
|
+
def str_to_orbital_energies(val_in):
|
|
77
|
+
val = val_in.strip().split()
|
|
78
|
+
orbitals = [val[i] for i in range(0, len(val), 2)]
|
|
79
|
+
energies = [float(val[i]) for i in range(1, len(val), 2)]
|
|
80
|
+
return orbitals, energies
|
|
81
|
+
|
|
82
|
+
def str_to_eigenvalues(val_in):
|
|
83
|
+
orbital_energies = []
|
|
84
|
+
for val in val_in.strip().split('\n'):
|
|
85
|
+
if 'occupied orbitals' in val:
|
|
86
|
+
orbital_energies.append([[], []])
|
|
87
|
+
elif 'Active orbitals' in val:
|
|
88
|
+
pass
|
|
89
|
+
else:
|
|
90
|
+
val = val.strip().split()
|
|
91
|
+
if len(val) % 3 != 0:
|
|
92
|
+
continue
|
|
93
|
+
orbital_energies[-1][0].extend(
|
|
94
|
+
[val[i] for i in range(2, len(val), 3)]
|
|
95
|
+
)
|
|
96
|
+
orbital_energies[-1][1].extend(
|
|
97
|
+
[float(val[i]) for i in range(1, len(val), 3)]
|
|
98
|
+
)
|
|
99
|
+
return orbital_energies
|
|
100
|
+
|
|
101
|
+
def str_to_parameters(val_in):
|
|
102
|
+
val_in = val_in.strip().split('\n')
|
|
103
|
+
name = val_in[0].split()[0]
|
|
104
|
+
parameters = dict()
|
|
105
|
+
separator = '='
|
|
106
|
+
if '=>' in val_in[-1]:
|
|
107
|
+
separator = '=>'
|
|
108
|
+
elif ':' in val_in[-1]:
|
|
109
|
+
separator = ':'
|
|
110
|
+
for val in val_in:
|
|
111
|
+
val = [v.rstrip('!').strip() for v in val.split(separator)]
|
|
112
|
+
if len(val) == 2:
|
|
113
|
+
try:
|
|
114
|
+
val[1] = float(val[1])
|
|
115
|
+
except Exception:
|
|
116
|
+
pass
|
|
117
|
+
if val[1] in ['TRUE', 'FALSE']:
|
|
118
|
+
val[1] = val[1] == 'TRUE'
|
|
119
|
+
parameters[val[0]] = val[1]
|
|
120
|
+
return name, parameters
|
|
121
|
+
|
|
122
|
+
charges_quantities = [
|
|
123
|
+
Quantity(
|
|
124
|
+
'atom',
|
|
125
|
+
rf'\d+ +[A-Z][a-z]* +({re_f}) +({re_f}) +({re_f}) +({re_f})',
|
|
126
|
+
repeats=True,
|
|
127
|
+
dtype=np.dtype(np.float64),
|
|
128
|
+
),
|
|
129
|
+
Quantity(
|
|
130
|
+
'total',
|
|
131
|
+
rf'Total alpha = +({re_f}), Total beta = +({re_f}), Total charge = +({re_f})',
|
|
132
|
+
dtype=np.dtype(np.float64),
|
|
133
|
+
),
|
|
134
|
+
]
|
|
135
|
+
|
|
136
|
+
properties_quantities = [
|
|
137
|
+
Quantity(
|
|
138
|
+
'multipole_moments',
|
|
139
|
+
r'Multipole +Electric \(a\.u\.\) .+\s+\-+([\s\S]+?)\-{10}',
|
|
140
|
+
sub_parser=TextParser(
|
|
141
|
+
quantities=[
|
|
142
|
+
Quantity(
|
|
143
|
+
'dipole',
|
|
144
|
+
r'Dipole [XYZ] +: +(.+)',
|
|
145
|
+
repeats=True,
|
|
146
|
+
dtype=np.dtype(np.float64),
|
|
147
|
+
),
|
|
148
|
+
Quantity(
|
|
149
|
+
'quadrupole',
|
|
150
|
+
r'Quadrupole [XYZ]{2} +: +(.+)',
|
|
151
|
+
repeats=True,
|
|
152
|
+
dtype=np.dtype(np.float64),
|
|
153
|
+
),
|
|
154
|
+
Quantity(
|
|
155
|
+
'octupole',
|
|
156
|
+
r'Octupole [XYZ]{3} +: +(.+)',
|
|
157
|
+
repeats=True,
|
|
158
|
+
dtype=np.dtype(np.float64),
|
|
159
|
+
),
|
|
160
|
+
Quantity(
|
|
161
|
+
'hexadecapole',
|
|
162
|
+
r'Hexadecapole [XYZ]{4} +: +(.+)',
|
|
163
|
+
repeats=True,
|
|
164
|
+
dtype=np.dtype(np.float64),
|
|
165
|
+
),
|
|
166
|
+
Quantity(
|
|
167
|
+
'npole',
|
|
168
|
+
r'32-pole [XYZ]{5} +: +(.+)',
|
|
169
|
+
repeats=True,
|
|
170
|
+
dtype=np.dtype(np.float64),
|
|
171
|
+
),
|
|
172
|
+
]
|
|
173
|
+
),
|
|
174
|
+
),
|
|
175
|
+
Quantity(
|
|
176
|
+
'nuclear_dipole_moment',
|
|
177
|
+
rf'Nuclear Dipole Moment: \(a\.u\.\)\s+X: +({re_f}) +Y: +({re_f}) +Z: +({re_f})',
|
|
178
|
+
dtype=np.dtype(np.float64),
|
|
179
|
+
),
|
|
180
|
+
Quantity(
|
|
181
|
+
'electronic_dipole_moment',
|
|
182
|
+
rf'Electronic Dipole Moment: \(a\.u\.\)\s+X: +({re_f}) +Y: +({re_f}) +Z: +({re_f})',
|
|
183
|
+
dtype=np.dtype(np.float64),
|
|
184
|
+
),
|
|
185
|
+
Quantity(
|
|
186
|
+
'total_dipole_moment',
|
|
187
|
+
rf'Dipole Moment: \(a\.u\.\)\s+X: +({re_f}) +Y: +({re_f}) +Z: +({re_f})',
|
|
188
|
+
dtype=np.dtype(np.float64),
|
|
189
|
+
),
|
|
190
|
+
Quantity(
|
|
191
|
+
'mulliken_charges',
|
|
192
|
+
r'Mulliken Charges: \(a\.u\.\)\s+.+([\s\S]+?Total charge.+)',
|
|
193
|
+
sub_parser=TextParser(quantities=charges_quantities),
|
|
194
|
+
),
|
|
195
|
+
Quantity(
|
|
196
|
+
'lowdin_charges',
|
|
197
|
+
r'Lowdin Charges: \(a\.u\.\)\s+.+([\s\S]+?Total charge.+)',
|
|
198
|
+
sub_parser=TextParser(quantities=charges_quantities),
|
|
199
|
+
),
|
|
200
|
+
]
|
|
201
|
+
|
|
202
|
+
scf_quantities = [
|
|
203
|
+
Quantity(
|
|
204
|
+
'geometry',
|
|
205
|
+
r'Geometry <==([\s\S]+?)==>',
|
|
206
|
+
sub_parser=TextParser(
|
|
207
|
+
quantities=[
|
|
208
|
+
Quantity(
|
|
209
|
+
'atoms',
|
|
210
|
+
rf'([A-Z][a-z]* +{re_f} +{re_f} +{re_f} +{re_f}\n)',
|
|
211
|
+
repeats=True,
|
|
212
|
+
),
|
|
213
|
+
Quantity(
|
|
214
|
+
'molecular_point_group',
|
|
215
|
+
r'Molecular point group: *(\w+)',
|
|
216
|
+
dtype=str,
|
|
217
|
+
),
|
|
218
|
+
Quantity(
|
|
219
|
+
'full_point_group', r'Full point group: *(\w+)', dtype=str
|
|
220
|
+
),
|
|
221
|
+
Quantity('symmetry', r'Running in (\w+) symmetry\.', dtype=str),
|
|
222
|
+
Quantity(
|
|
223
|
+
'rotational_constants',
|
|
224
|
+
rf'Rotational constants: *A = *({re_f}) *B = *({re_f}) *C = *({re_f}) \[cm\^-1\]',
|
|
225
|
+
dtype=np.dtype(np.float64),
|
|
226
|
+
),
|
|
227
|
+
Quantity(
|
|
228
|
+
'nuclear_repulsion',
|
|
229
|
+
rf'Nuclear repulsion = *({re_f})',
|
|
230
|
+
dtype=np.float64,
|
|
231
|
+
),
|
|
232
|
+
Quantity('charge', r'Charge *= (\d+)', dtype=np.float64),
|
|
233
|
+
Quantity(
|
|
234
|
+
'multiplicity', r'Multiplicity *= (\d+)', dtype=np.float64
|
|
235
|
+
),
|
|
236
|
+
Quantity('electrons', r'Electrons *= (\d+)', dtype=np.float64),
|
|
237
|
+
Quantity('nalpha', r'Nalpha *= (\d+)', dtype=np.float64),
|
|
238
|
+
Quantity('nbeta', r'Nbeta *= (\d+)', dtype=np.float64),
|
|
239
|
+
]
|
|
240
|
+
),
|
|
241
|
+
),
|
|
242
|
+
Quantity(
|
|
243
|
+
'algorithm',
|
|
244
|
+
r'Algorithm <==([\s\S]+?)==>',
|
|
245
|
+
sub_parser=TextParser(
|
|
246
|
+
quantities=[
|
|
247
|
+
Quantity(
|
|
248
|
+
'minimization_algorithm',
|
|
249
|
+
r'SCF Algorithm Type is (.+)\.',
|
|
250
|
+
dtype=str,
|
|
251
|
+
),
|
|
252
|
+
Quantity(
|
|
253
|
+
'x_psi4_diis',
|
|
254
|
+
r'DIIS (.+)\.',
|
|
255
|
+
str_operation=lambda x: x == 'enabled',
|
|
256
|
+
),
|
|
257
|
+
Quantity(
|
|
258
|
+
'x_psi4_mom',
|
|
259
|
+
r'MOM (.+)\.',
|
|
260
|
+
str_operation=lambda x: x == 'enabled',
|
|
261
|
+
),
|
|
262
|
+
Quantity(
|
|
263
|
+
'x_psi4_fractional_occupation',
|
|
264
|
+
r'Fractional occupation (.+)\.',
|
|
265
|
+
str_operation=lambda x: x == 'enabled',
|
|
266
|
+
),
|
|
267
|
+
Quantity(
|
|
268
|
+
'x_psi4_guess_type', r'Guess Type is (.+)\.', dtype=str
|
|
269
|
+
),
|
|
270
|
+
Quantity(
|
|
271
|
+
'threshold_energy_change',
|
|
272
|
+
rf'Energy threshold += +({re_f})',
|
|
273
|
+
dtype=np.float64,
|
|
274
|
+
unit=ureg.hartree,
|
|
275
|
+
),
|
|
276
|
+
Quantity(
|
|
277
|
+
'threshold_densDFT Potential <==ty_change',
|
|
278
|
+
rf'Density threDFT Potential <==hold += +({re_f})',
|
|
279
|
+
dtype=np.float64,
|
|
280
|
+
),
|
|
281
|
+
Quantity(
|
|
282
|
+
'x_psi4_integral_threshold',
|
|
283
|
+
rf'Integral threshold += +({re_f})',
|
|
284
|
+
dtype=np.float64,
|
|
285
|
+
),
|
|
286
|
+
]
|
|
287
|
+
),
|
|
288
|
+
),
|
|
289
|
+
Quantity(
|
|
290
|
+
'basis',
|
|
291
|
+
r'(?:Primary )*Basis (?:Set )*<==([\s\S]+?)==>',
|
|
292
|
+
sub_parser=TextParser(
|
|
293
|
+
quantities=[
|
|
294
|
+
Quantity(
|
|
295
|
+
'basis_set',
|
|
296
|
+
r'((?:Basis Set|Core potential|AO BASIS SET INFORMATION):[\s\S]+?\n\n)',
|
|
297
|
+
repeats=True,
|
|
298
|
+
str_operation=str_to_basis,
|
|
299
|
+
)
|
|
300
|
+
]
|
|
301
|
+
),
|
|
302
|
+
),
|
|
303
|
+
Quantity(
|
|
304
|
+
'jk_matrices',
|
|
305
|
+
r'(J/K Matrices <==[\s\S]+?==>)',
|
|
306
|
+
sub_parser=TextParser(
|
|
307
|
+
quantities=[
|
|
308
|
+
Quantity(
|
|
309
|
+
'parameters',
|
|
310
|
+
r'J/K Matrices <==\s+([\s\S]+?\n *\n)',
|
|
311
|
+
str_operation=str_to_parameters,
|
|
312
|
+
),
|
|
313
|
+
]
|
|
314
|
+
),
|
|
315
|
+
),
|
|
316
|
+
# Move auxiliary out of the parent section because I cannot cover all
|
|
317
|
+
Quantity(
|
|
318
|
+
'auxiliary_basis',
|
|
319
|
+
r' Auxiliary Basis (?:Set )*<=([\s\S]+?)==>',
|
|
320
|
+
repeats=True,
|
|
321
|
+
sub_parser=TextParser(
|
|
322
|
+
quantities=[
|
|
323
|
+
Quantity(
|
|
324
|
+
'basis_set',
|
|
325
|
+
r'((?:Basis Set|Core potential|AO BASIS SET INFORMATION):[\s\S]+?\n\n)',
|
|
326
|
+
repeats=True,
|
|
327
|
+
str_operation=str_to_basis,
|
|
328
|
+
)
|
|
329
|
+
]
|
|
330
|
+
),
|
|
331
|
+
),
|
|
332
|
+
Quantity(
|
|
333
|
+
'dft_potential',
|
|
334
|
+
r'DFT Potential <==([\s\S]+?==>)',
|
|
335
|
+
sub_parser=TextParser(
|
|
336
|
+
quantities=[
|
|
337
|
+
Quantity(
|
|
338
|
+
'composite',
|
|
339
|
+
r'Composite Functional.+([\s\S]+?)=>',
|
|
340
|
+
str_operation=str_to_parameters,
|
|
341
|
+
),
|
|
342
|
+
Quantity(
|
|
343
|
+
'exact_exchange',
|
|
344
|
+
r'Exact \(HF\) Exchange <=([\s\S]+?)=>',
|
|
345
|
+
str_operation=lambda x: [
|
|
346
|
+
v.split()[:2] for v in x.strip().split('\n')
|
|
347
|
+
],
|
|
348
|
+
),
|
|
349
|
+
Quantity(
|
|
350
|
+
'exchange',
|
|
351
|
+
r'Exchange Functionals <=([\s\S]+?)=>',
|
|
352
|
+
str_operation=lambda x: [
|
|
353
|
+
v.split()[:2] for v in x.strip().split('\n')
|
|
354
|
+
],
|
|
355
|
+
),
|
|
356
|
+
Quantity(
|
|
357
|
+
'correlation',
|
|
358
|
+
r' Correlation Functionals <=([\s\S]+?)=>',
|
|
359
|
+
str_operation=lambda x: [
|
|
360
|
+
v.split()[:2] for v in x.strip().split('\n')
|
|
361
|
+
],
|
|
362
|
+
),
|
|
363
|
+
Quantity(
|
|
364
|
+
'hybrid',
|
|
365
|
+
r'Exchange-Correlation Functionals <=([\s\S]+?)=>',
|
|
366
|
+
str_operation=lambda x: [
|
|
367
|
+
v.split()[:2] for v in x.strip().split('\n')
|
|
368
|
+
],
|
|
369
|
+
),
|
|
370
|
+
Quantity(
|
|
371
|
+
'molecular_quadrature',
|
|
372
|
+
r'Molecular Quadrature <=([\s\S]+?)=>',
|
|
373
|
+
str_operation=str_to_parameters,
|
|
374
|
+
),
|
|
375
|
+
]
|
|
376
|
+
),
|
|
377
|
+
),
|
|
378
|
+
Quantity('method', r'(?:\n +(.+) Reference *\n|@(.+) Final Energy:)'),
|
|
379
|
+
Quantity(
|
|
380
|
+
'iterations',
|
|
381
|
+
r'Iterations <==(\s+Total Energy[\s\S]+?)==>',
|
|
382
|
+
sub_parser=TextParser(
|
|
383
|
+
quantities=[
|
|
384
|
+
Quantity(
|
|
385
|
+
'iteration',
|
|
386
|
+
rf'iter +\d+\: +({re_f}) +({re_f}) +({re_f})',
|
|
387
|
+
repeats=True,
|
|
388
|
+
dtype=np.float64,
|
|
389
|
+
)
|
|
390
|
+
]
|
|
391
|
+
),
|
|
392
|
+
),
|
|
393
|
+
Quantity(
|
|
394
|
+
'spin_contamination_metric',
|
|
395
|
+
rf'@Spin Contamination Metric: +({re_f})',
|
|
396
|
+
dtype=np.float64,
|
|
397
|
+
),
|
|
398
|
+
Quantity('s2_expected', rf'@S\^2 Expected: +({re_f})', dtype=np.float64),
|
|
399
|
+
Quantity('s2_observed', rf'@S\^2 Observed: +({re_f})', dtype=np.float64),
|
|
400
|
+
Quantity('s_expected', rf'@S Expected: +({re_f})', dtype=np.float64),
|
|
401
|
+
Quantity('s_observed', rf'@S Observed: +({re_f})', dtype=np.float64),
|
|
402
|
+
Quantity(
|
|
403
|
+
'orbital_energies',
|
|
404
|
+
r'(?:Occupied:|Virtual:).+([\s\S]+?\n *\n)',
|
|
405
|
+
repeats=True,
|
|
406
|
+
str_operation=str_to_orbital_energies,
|
|
407
|
+
),
|
|
408
|
+
Quantity(
|
|
409
|
+
'energy',
|
|
410
|
+
r'Energetics <=([\s\S]+?Total Energy =.+)',
|
|
411
|
+
repeats=True,
|
|
412
|
+
sub_parser=TextParser(
|
|
413
|
+
quantities=[
|
|
414
|
+
Quantity(
|
|
415
|
+
'key_value',
|
|
416
|
+
rf'(.+) Energy = *({re_f})',
|
|
417
|
+
repeats=True,
|
|
418
|
+
str_operation=lambda x: [
|
|
419
|
+
v.strip() for v in x.rsplit(' ', 1)
|
|
420
|
+
],
|
|
421
|
+
)
|
|
422
|
+
]
|
|
423
|
+
),
|
|
424
|
+
),
|
|
425
|
+
Quantity(
|
|
426
|
+
'properties',
|
|
427
|
+
r'(Properties will be evaluated at[\s\S]+?)(?:==>|tstop|\Z)',
|
|
428
|
+
repeats=True,
|
|
429
|
+
sub_parser=TextParser(quantities=properties_quantities),
|
|
430
|
+
),
|
|
431
|
+
Quantity(
|
|
432
|
+
'total_gradient',
|
|
433
|
+
r'Total Gradient.+\s+Atom.+\s+\-.+\s+([\s\S]+?)\n *\n',
|
|
434
|
+
str_operation=lambda x: np.array(
|
|
435
|
+
[v.split()[1:] for v in x.strip().split('\n')]
|
|
436
|
+
),
|
|
437
|
+
dtype=np.dtype(np.float64),
|
|
438
|
+
),
|
|
439
|
+
]
|
|
440
|
+
|
|
441
|
+
mp_quantities = [
|
|
442
|
+
Quantity('method', r'(MP[\d\.]+)\s+Program'),
|
|
443
|
+
Quantity(
|
|
444
|
+
'energy',
|
|
445
|
+
r'Computing MP[\d\.]+ energy using SCF MOs([\s\S]+?)\n *\n',
|
|
446
|
+
repeats=True,
|
|
447
|
+
sub_parser=TextParser(
|
|
448
|
+
quantities=[
|
|
449
|
+
Quantity(
|
|
450
|
+
'key_value',
|
|
451
|
+
rf'\s+(.+?) (?:Energy|Contribution) (Correction )*\(a\.u\.\) *: +({re_f})',
|
|
452
|
+
repeats=True,
|
|
453
|
+
str_operation=lambda x: [
|
|
454
|
+
v.strip() for v in x.rsplit(' ', 1)
|
|
455
|
+
],
|
|
456
|
+
)
|
|
457
|
+
]
|
|
458
|
+
),
|
|
459
|
+
),
|
|
460
|
+
]
|
|
461
|
+
|
|
462
|
+
method_quantities = [
|
|
463
|
+
Quantity(
|
|
464
|
+
'parameters',
|
|
465
|
+
r'Parameters <==([\s\S]+?)==>',
|
|
466
|
+
sub_parser=TextParser(
|
|
467
|
+
quantities=[
|
|
468
|
+
Quantity(
|
|
469
|
+
'key_value',
|
|
470
|
+
r'([\w ]+= +\S+)',
|
|
471
|
+
repeats=True,
|
|
472
|
+
str_operation=lambda x: [v.strip() for v in x.split('=')],
|
|
473
|
+
)
|
|
474
|
+
]
|
|
475
|
+
),
|
|
476
|
+
),
|
|
477
|
+
Quantity(
|
|
478
|
+
'iterations',
|
|
479
|
+
r'Starting .+? iterations([\s\S]+?)==>',
|
|
480
|
+
sub_parser=TextParser(
|
|
481
|
+
quantities=[
|
|
482
|
+
Quantity(
|
|
483
|
+
'iteration',
|
|
484
|
+
rf'@.+\d+: +\d+ +({re_f}) +({re_f}) +({re_f})(.+)',
|
|
485
|
+
repeats=True,
|
|
486
|
+
dtype=np.dtype(np.float64),
|
|
487
|
+
)
|
|
488
|
+
]
|
|
489
|
+
),
|
|
490
|
+
),
|
|
491
|
+
Quantity(
|
|
492
|
+
'energy',
|
|
493
|
+
r'Energetics <==([\s\S]+?Total.+)',
|
|
494
|
+
repeats=True,
|
|
495
|
+
sub_parser=TextParser(
|
|
496
|
+
quantities=[
|
|
497
|
+
Quantity(
|
|
498
|
+
'key_value',
|
|
499
|
+
rf'(.+) [Ee]nergy += *({re_f})',
|
|
500
|
+
repeats=True,
|
|
501
|
+
str_operation=lambda x: [
|
|
502
|
+
v.strip() for v in x.rsplit(' ', 1)
|
|
503
|
+
],
|
|
504
|
+
)
|
|
505
|
+
]
|
|
506
|
+
),
|
|
507
|
+
),
|
|
508
|
+
Quantity(
|
|
509
|
+
'root_info',
|
|
510
|
+
r'(root \d+ information[\s\S]+?==>)',
|
|
511
|
+
sub_parser=TextParser(
|
|
512
|
+
quantities=[
|
|
513
|
+
Quantity(
|
|
514
|
+
'root_energy',
|
|
515
|
+
rf'Root \d+ energy += +({re_f})',
|
|
516
|
+
dtype=np.float64,
|
|
517
|
+
unit=ureg.hartree,
|
|
518
|
+
)
|
|
519
|
+
]
|
|
520
|
+
),
|
|
521
|
+
),
|
|
522
|
+
# TODO parse other properties e.g. orbital extents, mayer bond indices
|
|
523
|
+
Quantity(
|
|
524
|
+
'properties',
|
|
525
|
+
r'(erties computed using the[\s\S]+?)(?:==>|\n *Prop|tstop|\Z)',
|
|
526
|
+
repeats=True,
|
|
527
|
+
sub_parser=TextParser(quantities=properties_quantities),
|
|
528
|
+
),
|
|
529
|
+
]
|
|
530
|
+
|
|
531
|
+
mcscf_quantities = [
|
|
532
|
+
Quantity(
|
|
533
|
+
'iterations',
|
|
534
|
+
r'(Cycle +Energy.+\s+\=+[\s\S]+?)\={5}',
|
|
535
|
+
sub_parser=TextParser(
|
|
536
|
+
quantities=[
|
|
537
|
+
Quantity(
|
|
538
|
+
'iteration',
|
|
539
|
+
rf'@SCF +\d+ +({re_f}) +({re_f}) +({re_f})',
|
|
540
|
+
repeats=True,
|
|
541
|
+
dtype=np.dtype(np.float64),
|
|
542
|
+
)
|
|
543
|
+
]
|
|
544
|
+
),
|
|
545
|
+
),
|
|
546
|
+
Quantity(
|
|
547
|
+
'energy',
|
|
548
|
+
r'\* (SCF total energy.+)',
|
|
549
|
+
repeats=True,
|
|
550
|
+
sub_parser=TextParser(
|
|
551
|
+
quantities=[
|
|
552
|
+
Quantity(
|
|
553
|
+
'key_value',
|
|
554
|
+
rf'(.+) energy += +({re_f})',
|
|
555
|
+
repeats=True,
|
|
556
|
+
str_operation=lambda x: [
|
|
557
|
+
v.strip() for v in x.rsplit(' ', 1)
|
|
558
|
+
],
|
|
559
|
+
)
|
|
560
|
+
]
|
|
561
|
+
),
|
|
562
|
+
),
|
|
563
|
+
Quantity(
|
|
564
|
+
'orbital_energies',
|
|
565
|
+
r'Eigenvalues \(Eh\)([\s\S]+?)={5}',
|
|
566
|
+
str_operation=str_to_eigenvalues,
|
|
567
|
+
),
|
|
568
|
+
]
|
|
569
|
+
|
|
570
|
+
cc_quantities = [
|
|
571
|
+
Quantity(
|
|
572
|
+
'parameters',
|
|
573
|
+
r'Wfn Parameters:\s+\-+\s+([\s\S]+?)\n *\n',
|
|
574
|
+
sub_parser=TextParser(
|
|
575
|
+
quantities=[
|
|
576
|
+
Quantity(
|
|
577
|
+
'key_value',
|
|
578
|
+
r'(.+ += +\S+)',
|
|
579
|
+
repeats=True,
|
|
580
|
+
str_operation=lambda x: [v.strip() for v in x.split('=')],
|
|
581
|
+
)
|
|
582
|
+
]
|
|
583
|
+
),
|
|
584
|
+
),
|
|
585
|
+
Quantity(
|
|
586
|
+
'energy',
|
|
587
|
+
r'(Nuclear Rep[\s\S]+?)\n *\n',
|
|
588
|
+
repeats=True,
|
|
589
|
+
sub_parser=TextParser(
|
|
590
|
+
quantities=[
|
|
591
|
+
Quantity(
|
|
592
|
+
'key_value',
|
|
593
|
+
rf'([\w\. \-]+) energy += +({re_f})',
|
|
594
|
+
repeats=True,
|
|
595
|
+
str_operation=lambda x: [
|
|
596
|
+
v.strip() for v in x.rsplit(' ', 1)
|
|
597
|
+
],
|
|
598
|
+
)
|
|
599
|
+
]
|
|
600
|
+
),
|
|
601
|
+
),
|
|
602
|
+
]
|
|
603
|
+
|
|
604
|
+
cc_energy_quantities = [
|
|
605
|
+
Quantity(
|
|
606
|
+
'parameters',
|
|
607
|
+
r'Input parameters:\s+\-+([\s\S]+?)',
|
|
608
|
+
sub_parser=TextParser(
|
|
609
|
+
quantities=[
|
|
610
|
+
Quantity(
|
|
611
|
+
'key_value',
|
|
612
|
+
r'(.+ += +\S+)',
|
|
613
|
+
repeats=True,
|
|
614
|
+
str_operation=lambda x: [v.strip() for v in x.split('=')],
|
|
615
|
+
)
|
|
616
|
+
]
|
|
617
|
+
),
|
|
618
|
+
),
|
|
619
|
+
Quantity(
|
|
620
|
+
'iterations',
|
|
621
|
+
r'(Iter +Energy[\s\S]+?)\n *\n',
|
|
622
|
+
sub_parser=TextParser(
|
|
623
|
+
quantities=[
|
|
624
|
+
Quantity(
|
|
625
|
+
'iteration',
|
|
626
|
+
rf'\d+ +({re_f}) +({re_f}) +({re_f})',
|
|
627
|
+
repeats=True,
|
|
628
|
+
dtype=np.dtype(np.float64),
|
|
629
|
+
)
|
|
630
|
+
]
|
|
631
|
+
),
|
|
632
|
+
),
|
|
633
|
+
Quantity(
|
|
634
|
+
'energy',
|
|
635
|
+
r'\n *\n +(SCF energy[\s\S]+?CCSD total energy.+)',
|
|
636
|
+
repeats=True,
|
|
637
|
+
sub_parser=TextParser(
|
|
638
|
+
quantities=[
|
|
639
|
+
Quantity(
|
|
640
|
+
'key_value',
|
|
641
|
+
rf'([\w\. \-]+) energy.* += +({re_f})',
|
|
642
|
+
repeats=True,
|
|
643
|
+
str_operation=lambda x: [
|
|
644
|
+
v.strip() for v in x.rsplit(' ', 1)
|
|
645
|
+
],
|
|
646
|
+
)
|
|
647
|
+
]
|
|
648
|
+
),
|
|
649
|
+
),
|
|
650
|
+
]
|
|
651
|
+
|
|
652
|
+
cc_lambda_quantities = [
|
|
653
|
+
Quantity(
|
|
654
|
+
'parameters',
|
|
655
|
+
r'Input parameters:\s+\-+([\s\S]+?)\n *\n',
|
|
656
|
+
sub_parser=TextParser(
|
|
657
|
+
quantities=[
|
|
658
|
+
Quantity(
|
|
659
|
+
'key_value',
|
|
660
|
+
r'(.+ += +\S+)',
|
|
661
|
+
repeats=True,
|
|
662
|
+
str_operation=lambda x: [v.strip() for v in x.split('=')],
|
|
663
|
+
)
|
|
664
|
+
]
|
|
665
|
+
),
|
|
666
|
+
),
|
|
667
|
+
Quantity(
|
|
668
|
+
'iterations',
|
|
669
|
+
r'(Iter +PseudoEnergy[\s\S]+?)\n *\n',
|
|
670
|
+
sub_parser=TextParser(
|
|
671
|
+
quantities=[
|
|
672
|
+
Quantity(
|
|
673
|
+
'iteration',
|
|
674
|
+
rf'\d+ +({re_f}) +({re_f})',
|
|
675
|
+
repeats=True,
|
|
676
|
+
dtype=np.dtype(np.float64),
|
|
677
|
+
)
|
|
678
|
+
]
|
|
679
|
+
),
|
|
680
|
+
),
|
|
681
|
+
Quantity(
|
|
682
|
+
'energy',
|
|
683
|
+
r'(Nuclear Rep\. energy[\s\S]+?Total CCSD energy.+)',
|
|
684
|
+
repeats=True,
|
|
685
|
+
sub_parser=TextParser(
|
|
686
|
+
quantities=[
|
|
687
|
+
Quantity(
|
|
688
|
+
'key_value',
|
|
689
|
+
rf'([\w\. \-]+) energy.* += +({re_f})',
|
|
690
|
+
repeats=True,
|
|
691
|
+
str_operation=lambda x: [
|
|
692
|
+
v.strip() for v in x.rsplit(' ', 1)
|
|
693
|
+
],
|
|
694
|
+
)
|
|
695
|
+
]
|
|
696
|
+
),
|
|
697
|
+
),
|
|
698
|
+
]
|
|
699
|
+
|
|
700
|
+
cc_density_quantities = [
|
|
701
|
+
Quantity(
|
|
702
|
+
'parameters',
|
|
703
|
+
r'Input parameters:\s+\-+([\s\S]+?)\n *\n',
|
|
704
|
+
sub_parser=TextParser(
|
|
705
|
+
quantities=[
|
|
706
|
+
Quantity(
|
|
707
|
+
'key_value',
|
|
708
|
+
r'(.+ += +\S+)',
|
|
709
|
+
repeats=True,
|
|
710
|
+
str_operation=lambda x: [v.strip() for v in x.split('=')],
|
|
711
|
+
)
|
|
712
|
+
]
|
|
713
|
+
),
|
|
714
|
+
),
|
|
715
|
+
Quantity(
|
|
716
|
+
'energy',
|
|
717
|
+
r'((?:Nuclear Rep\. energy|Energies re-computed from|Virial Theorem Data)[\s\S]+?)\n *\n',
|
|
718
|
+
repeats=True,
|
|
719
|
+
sub_parser=TextParser(
|
|
720
|
+
quantities=[
|
|
721
|
+
Quantity(
|
|
722
|
+
'key_value',
|
|
723
|
+
rf'([\w\. \-]+) energy(?: +\(.+\))* += +({re_f})',
|
|
724
|
+
repeats=True,
|
|
725
|
+
str_operation=lambda x: [
|
|
726
|
+
v.strip() for v in x.rsplit(' ', 1)
|
|
727
|
+
],
|
|
728
|
+
)
|
|
729
|
+
]
|
|
730
|
+
),
|
|
731
|
+
),
|
|
732
|
+
Quantity(
|
|
733
|
+
'properties',
|
|
734
|
+
r'(Properties will be evaluated at[\s\S]+?)(?:==>|tstop|\Z)',
|
|
735
|
+
repeats=True,
|
|
736
|
+
sub_parser=TextParser(quantities=properties_quantities),
|
|
737
|
+
),
|
|
738
|
+
]
|
|
739
|
+
|
|
740
|
+
optking_quantities = [
|
|
741
|
+
Quantity(
|
|
742
|
+
'geometry',
|
|
743
|
+
r'Geometry and Gradient-+\s+([\s\S]+?)\n *\n',
|
|
744
|
+
sub_parser=TextParser(
|
|
745
|
+
quantities=[
|
|
746
|
+
Quantity(
|
|
747
|
+
'atoms',
|
|
748
|
+
rf'([A-Z][a-z]*) +({re_f}) +({re_f}) +({re_f})',
|
|
749
|
+
repeats=True,
|
|
750
|
+
),
|
|
751
|
+
Quantity(
|
|
752
|
+
'forces',
|
|
753
|
+
rf'({re_f}) +({re_f}) +({re_f})',
|
|
754
|
+
repeats=True,
|
|
755
|
+
dtype=np.dtype(np.float64),
|
|
756
|
+
),
|
|
757
|
+
]
|
|
758
|
+
),
|
|
759
|
+
),
|
|
760
|
+
Quantity(
|
|
761
|
+
'convergence_criteria',
|
|
762
|
+
rf'Convergence Criteria +({re_f}) +\* +({re_f}) +\* +\S+ +({re_f})',
|
|
763
|
+
dtype=np.dtype(np.float64),
|
|
764
|
+
),
|
|
765
|
+
Quantity('energy', rf'~\s+\d+ +({re_f}) +({re_f})', dtype=np.float64),
|
|
766
|
+
]
|
|
767
|
+
|
|
768
|
+
module_quantities = [
|
|
769
|
+
Quantity(
|
|
770
|
+
'scf',
|
|
771
|
+
rf'(SCF\s+by[\s\S]+?(Computation Completed|tstop|\Z))',
|
|
772
|
+
repeats=True,
|
|
773
|
+
sub_parser=TextParser(quantities=scf_quantities),
|
|
774
|
+
),
|
|
775
|
+
Quantity(
|
|
776
|
+
'scf_grad',
|
|
777
|
+
r'(SCF GRAD\s+[\s\S]+?(?:tstop|\Z))',
|
|
778
|
+
repeats=True,
|
|
779
|
+
sub_parser=TextParser(quantities=scf_quantities),
|
|
780
|
+
),
|
|
781
|
+
Quantity(
|
|
782
|
+
'mp',
|
|
783
|
+
r'(MP[\d\.]+\s+Program[\s\S]+?(?:tstop|\Z))',
|
|
784
|
+
repeats=True,
|
|
785
|
+
sub_parser=TextParser(quantities=mp_quantities),
|
|
786
|
+
),
|
|
787
|
+
Quantity(
|
|
788
|
+
'ci',
|
|
789
|
+
r'(Configuration Interaction\s+\(a [\s\S]+?)(?:PASSED|tstart|\Z)',
|
|
790
|
+
repeats=True,
|
|
791
|
+
sub_parser=TextParser(quantities=method_quantities),
|
|
792
|
+
),
|
|
793
|
+
Quantity(
|
|
794
|
+
'mcscf_detci',
|
|
795
|
+
r'(Multi-Configurational Self-Consistent Field[\s\S]+?)(?:PASSED|tstart|\Z)',
|
|
796
|
+
repeats=True,
|
|
797
|
+
sub_parser=TextParser(quantities=method_quantities),
|
|
798
|
+
),
|
|
799
|
+
Quantity(
|
|
800
|
+
'mcscf',
|
|
801
|
+
r'(MCSCF: a self-consistent field program[\s\S]+?)(?:tstop|\Z)',
|
|
802
|
+
repeats=True,
|
|
803
|
+
sub_parser=TextParser(quantities=mcscf_quantities),
|
|
804
|
+
),
|
|
805
|
+
Quantity(
|
|
806
|
+
'cc',
|
|
807
|
+
r'(Wfn Parameters:\s+\-+[\s\S]+?)(?:tstop|\Z)',
|
|
808
|
+
repeats=True,
|
|
809
|
+
sub_parser=TextParser(quantities=cc_quantities),
|
|
810
|
+
),
|
|
811
|
+
Quantity(
|
|
812
|
+
'cc_energy',
|
|
813
|
+
r'(CCENERGY +\*[\s\S]+?)(?:tstop|\Z)',
|
|
814
|
+
repeats=True,
|
|
815
|
+
sub_parser=TextParser(quantities=cc_energy_quantities),
|
|
816
|
+
),
|
|
817
|
+
Quantity(
|
|
818
|
+
'cc_lambda',
|
|
819
|
+
r'(CCLAMBDA +\*[\s\S]+?)(?:tstop|\Z)',
|
|
820
|
+
repeats=True,
|
|
821
|
+
sub_parser=TextParser(quantities=cc_lambda_quantities),
|
|
822
|
+
),
|
|
823
|
+
Quantity(
|
|
824
|
+
'cc_density',
|
|
825
|
+
r'(CCDENSITY +\*[\s\S]+?)(?:tstop|\Z)',
|
|
826
|
+
repeats=True,
|
|
827
|
+
sub_parser=TextParser(quantities=cc_density_quantities),
|
|
828
|
+
),
|
|
829
|
+
Quantity(
|
|
830
|
+
'optking',
|
|
831
|
+
r'OPTKING .+?: for geometry optimizations([\s\S]+?)OPTKING Finished Execution',
|
|
832
|
+
sub_parser=TextParser(quantities=optking_quantities),
|
|
833
|
+
),
|
|
834
|
+
Quantity(
|
|
835
|
+
'options',
|
|
836
|
+
r'Options:\s+\-+([\s\S]+?)\n *\n',
|
|
837
|
+
str_operation=str_to_parameters,
|
|
838
|
+
),
|
|
839
|
+
Quantity(
|
|
840
|
+
'salc',
|
|
841
|
+
r'(Cartesian Displacement SALCs[\s\S]+?)(?:tstart|\Z)',
|
|
842
|
+
sub_parser=TextParser(
|
|
843
|
+
quantities=[
|
|
844
|
+
Quantity(
|
|
845
|
+
'total_gradient',
|
|
846
|
+
r'Total gradient:\s+Atom.+\s+.+\s+([\s\S]+?)\n *\n',
|
|
847
|
+
str_operation=lambda x: [
|
|
848
|
+
v.split()[1:] for v in x.strip().split('\n')
|
|
849
|
+
],
|
|
850
|
+
dtype=np.dtype(np.float64),
|
|
851
|
+
),
|
|
852
|
+
Quantity(
|
|
853
|
+
'contributions_gradient',
|
|
854
|
+
r'\-(.+ (?:Energy 1st Derivatives|contribution to gradient)):'
|
|
855
|
+
r'\s+Atom.+\s+.+([\s\S]+?)\n *\n',
|
|
856
|
+
repeats=True,
|
|
857
|
+
sub_parser=TextParser(
|
|
858
|
+
quantities=[
|
|
859
|
+
Quantity(
|
|
860
|
+
'name',
|
|
861
|
+
r'(.+) (?:Energy|contribution)',
|
|
862
|
+
flatten=False,
|
|
863
|
+
),
|
|
864
|
+
Quantity(
|
|
865
|
+
'value',
|
|
866
|
+
rf'\d+ +({re_f}) +({re_f}) +({re_f})',
|
|
867
|
+
repeats=True,
|
|
868
|
+
dtype=np.dtype(np.float64),
|
|
869
|
+
),
|
|
870
|
+
]
|
|
871
|
+
),
|
|
872
|
+
),
|
|
873
|
+
]
|
|
874
|
+
),
|
|
875
|
+
),
|
|
876
|
+
# read user time since total time seems to be imprecise
|
|
877
|
+
Quantity(
|
|
878
|
+
'module_time',
|
|
879
|
+
rf'Module time\:\s+user time += +({re_f}) seconds',
|
|
880
|
+
dtype=np.float64,
|
|
881
|
+
),
|
|
882
|
+
Quantity(
|
|
883
|
+
'total_time',
|
|
884
|
+
rf'Total time\:\s+user time += +({re_f}) seconds',
|
|
885
|
+
dtype=np.float64,
|
|
886
|
+
),
|
|
887
|
+
]
|
|
888
|
+
|
|
889
|
+
self._quantities = [
|
|
890
|
+
Quantity(
|
|
891
|
+
'version',
|
|
892
|
+
r'Psi4: An Open-Source Ab Initio Electronic Structure Package\s*'
|
|
893
|
+
r'Psi4 ([\w\.]+)',
|
|
894
|
+
dtype=str,
|
|
895
|
+
),
|
|
896
|
+
Quantity(
|
|
897
|
+
'start_time', r'Psi4 started on: \w+, (.+)', flatten=False, dtype=str
|
|
898
|
+
),
|
|
899
|
+
Quantity('process_id', r'Process ID:\s*(\d+)', dtype=np.int32),
|
|
900
|
+
Quantity('psidatadir', r'PSIDATADIR:\s*(.+)', dtype=str),
|
|
901
|
+
Quantity('memory', r'Memory:\s*(\S+) MiB', dtype=np.float64),
|
|
902
|
+
Quantity('threads', r'Threads:\s*(\d+)', dtype=np.int32),
|
|
903
|
+
Quantity(
|
|
904
|
+
'input_file', r'Input File <==\s+\-+\s*([\s\S]+?)\-{5}', flatten=False
|
|
905
|
+
),
|
|
906
|
+
Quantity(
|
|
907
|
+
'module',
|
|
908
|
+
r'(\*\*\* at [A-Z][a-z]{2} [\s\S]+?(?:\*\*\* tstart|\Z))',
|
|
909
|
+
repeats=True,
|
|
910
|
+
sub_parser=TextParser(quantities=module_quantities),
|
|
911
|
+
),
|
|
912
|
+
]
|
|
913
|
+
|
|
914
|
+
|
|
915
|
+
class Psi4Parser:
|
|
916
|
+
def __init__(self):
|
|
917
|
+
self.out_parser = OutParser()
|
|
918
|
+
self._xc_map = {
|
|
919
|
+
'HF': 'LDA_X',
|
|
920
|
+
'PW6B95': 'HYB_MGGA_XC_PW6B95',
|
|
921
|
+
'B3LYP': 'HYB_GGA_XC_B3LYP',
|
|
922
|
+
'B3LYP5': 'HYB_GGA_XC_B3LYP5',
|
|
923
|
+
'wB97X-D': 'HYB_GGA_XC_WB97X_D',
|
|
924
|
+
}
|
|
925
|
+
self._metainfo_map = {
|
|
926
|
+
'Nuclear Repulsion': 'nuclear_repulsion',
|
|
927
|
+
'Total': 'total',
|
|
928
|
+
'DFT Exchange-Correlation': 'xc',
|
|
929
|
+
'Nuclear Rep.': 'nuclear_repulsion',
|
|
930
|
+
}
|
|
931
|
+
|
|
932
|
+
def init_parser(self):
|
|
933
|
+
self.out_parser.mainfile = self.filepath
|
|
934
|
+
self._method = None
|
|
935
|
+
|
|
936
|
+
def parse_system(self, source):
|
|
937
|
+
if source.geometry is None:
|
|
938
|
+
return
|
|
939
|
+
|
|
940
|
+
system = System()
|
|
941
|
+
self.archive.run[-1].system.append(system)
|
|
942
|
+
atoms = source.geometry.get('atoms', [])
|
|
943
|
+
# TODO determine lattice vectors
|
|
944
|
+
system.atoms = Atoms(
|
|
945
|
+
positions=np.array([a[1:4] for a in atoms]) * ureg.bohr,
|
|
946
|
+
labels=[a[0] for a in atoms],
|
|
947
|
+
periodic=[False, False, False],
|
|
948
|
+
)
|
|
949
|
+
for key, val in source.geometry.items():
|
|
950
|
+
try:
|
|
951
|
+
setattr(system, 'x_psi4_%s' % key, val)
|
|
952
|
+
except Exception:
|
|
953
|
+
pass
|
|
954
|
+
|
|
955
|
+
def _parse_basis(self, source: TextParser) -> list[BasisSet]:
|
|
956
|
+
"""Produce a list of the gaussian basis sets."""
|
|
957
|
+
if source is None:
|
|
958
|
+
return []
|
|
959
|
+
atoms: list[BasisSetAtomCentered] = []
|
|
960
|
+
for entry in source.get('basis_set', []):
|
|
961
|
+
atom = BasisSetAtomCentered()
|
|
962
|
+
atom.name = entry.get('Basis Set', '').strip('(').strip(')')
|
|
963
|
+
atom.n_basis_functions = int(entry.get('Number of basis function', 0))
|
|
964
|
+
atom.x_psi4_n_shells = int(entry.get('Number of shells', 0))
|
|
965
|
+
atom.x_psi4_max_angular_momentum = int(entry.get('Max angular momentum', 0))
|
|
966
|
+
atom.x_psi4_n_cartesian_functions = int(
|
|
967
|
+
entry.get('Number of Cartesian functions', 0)
|
|
968
|
+
)
|
|
969
|
+
atom.x_psi4_blend = entry.get('Blend')
|
|
970
|
+
atom.x_psi4_spherical_harmonics = (
|
|
971
|
+
entry.get('Spherical Harmonics?') == 'false'
|
|
972
|
+
)
|
|
973
|
+
atoms.append(atom)
|
|
974
|
+
|
|
975
|
+
return [
|
|
976
|
+
BasisSet(
|
|
977
|
+
type='gaussians',
|
|
978
|
+
scope=['full-electron'],
|
|
979
|
+
atom_centered=atoms,
|
|
980
|
+
),
|
|
981
|
+
]
|
|
982
|
+
|
|
983
|
+
def parse_method(self, source):
|
|
984
|
+
method = Method()
|
|
985
|
+
self.archive.run[-1].method.append(method)
|
|
986
|
+
if self._method is not None:
|
|
987
|
+
method.electronic = Electronic(method=self._method)
|
|
988
|
+
if self._method[:2] in ['MP', 'CI', 'MC', 'CC']:
|
|
989
|
+
method.core_method_ref = self.archive.run[-1].method[0]
|
|
990
|
+
method.methods_ref = [self.archive.run[-1].method[0]]
|
|
991
|
+
if source.parameters is not None:
|
|
992
|
+
method.x_psi4_parameters = {
|
|
993
|
+
key: val for key, val in source.parameters.get('key_value', [])
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
# Basis set
|
|
997
|
+
basis_sets = self._parse_basis(source.basis)
|
|
998
|
+
for basis in source.get('auxiliary_basis', []):
|
|
999
|
+
basis_sets += self._parse_basis(basis)
|
|
1000
|
+
if len(basis_sets) > 0:
|
|
1001
|
+
method.electrons_representation = [
|
|
1002
|
+
BasisSetContainer(
|
|
1003
|
+
type='atom-centered orbitals',
|
|
1004
|
+
scope=['wavefunction'],
|
|
1005
|
+
basis_set=basis_sets,
|
|
1006
|
+
),
|
|
1007
|
+
]
|
|
1008
|
+
|
|
1009
|
+
if source.jk_matrices is not None:
|
|
1010
|
+
method.x_psi4_jk_matrices_parameters = source.jk_matrices.get(
|
|
1011
|
+
'parameters', (None, None)
|
|
1012
|
+
)[1]
|
|
1013
|
+
|
|
1014
|
+
if source.algorithm is not None:
|
|
1015
|
+
scf = ScfMethod()
|
|
1016
|
+
method.scf = scf
|
|
1017
|
+
for key, val in source.algorithm.items():
|
|
1018
|
+
try:
|
|
1019
|
+
setattr(scf, key, val)
|
|
1020
|
+
except Exception:
|
|
1021
|
+
pass
|
|
1022
|
+
|
|
1023
|
+
if source.dft_potential is not None:
|
|
1024
|
+
dft = DFT()
|
|
1025
|
+
method.dft = dft
|
|
1026
|
+
xc_functional = XCFunctional()
|
|
1027
|
+
dft.xc_functional = xc_functional
|
|
1028
|
+
# get xc functional from composite first
|
|
1029
|
+
if len(xc_functional.exchange) == 0 and len(xc_functional.correlation) == 0:
|
|
1030
|
+
name, parameters = source.dft_potential.get('composite', (None, None))
|
|
1031
|
+
if name is not None:
|
|
1032
|
+
name = self._xc_map.get(name)
|
|
1033
|
+
if name is not None:
|
|
1034
|
+
xc_functional.contributions.append(
|
|
1035
|
+
Functional(name=name, parameters=parameters)
|
|
1036
|
+
)
|
|
1037
|
+
if len(xc_functional.contributions) == 0:
|
|
1038
|
+
# get contributions for exchange and correlation
|
|
1039
|
+
for xc_type in ['exact_exchange', 'exchange', 'correlation', 'hybrid']:
|
|
1040
|
+
if 'exchange' in xc_type:
|
|
1041
|
+
section = xc_functional.exchange
|
|
1042
|
+
elif xc_type == 'correlation':
|
|
1043
|
+
section = xc_functional.correlation
|
|
1044
|
+
else:
|
|
1045
|
+
section = xc_functional.hybrid
|
|
1046
|
+
for weight, name in source.dft_potential.get(xc_type, []):
|
|
1047
|
+
# it seems that other psi4 version print out xc functionals in libxc
|
|
1048
|
+
# notation prefixed with XC_
|
|
1049
|
+
# TODO complete mapping of XC functionals
|
|
1050
|
+
name = self._xc_map.get(name, name).lstrip('XC_')
|
|
1051
|
+
section.append(Functional(name=name, weight=weight))
|
|
1052
|
+
|
|
1053
|
+
if source.dft_potential.molecular_quadrature is not None:
|
|
1054
|
+
dft.x_psi4_molecular_quadrature = (
|
|
1055
|
+
source.dft_potential.molecular_quadrature[1]
|
|
1056
|
+
)
|
|
1057
|
+
|
|
1058
|
+
def parse_calculation(self, source):
|
|
1059
|
+
calc = Calculation()
|
|
1060
|
+
self.archive.run[-1].calculation.append(calc)
|
|
1061
|
+
ref_calcs = []
|
|
1062
|
+
|
|
1063
|
+
def parse_multipole(data, multipoles):
|
|
1064
|
+
if len(data) == 3:
|
|
1065
|
+
section = MultipolesEntry()
|
|
1066
|
+
multipoles.dipole = section
|
|
1067
|
+
exponent = 1
|
|
1068
|
+
elif len(data) == 6:
|
|
1069
|
+
section = MultipolesEntry()
|
|
1070
|
+
multipoles.quadrupole = section
|
|
1071
|
+
exponent = 2
|
|
1072
|
+
elif len(data) == 10:
|
|
1073
|
+
section = MultipolesEntry()
|
|
1074
|
+
multipoles.octupole = section
|
|
1075
|
+
exponent = 3
|
|
1076
|
+
elif len(data) == 15:
|
|
1077
|
+
section = MultipolesEntry()
|
|
1078
|
+
multipoles.higher_order.append(section)
|
|
1079
|
+
section.kind = 'hexadecapole'
|
|
1080
|
+
exponent = 4
|
|
1081
|
+
else:
|
|
1082
|
+
section = MultipolesEntry()
|
|
1083
|
+
multipoles.higher_order.append(section)
|
|
1084
|
+
section.kind = '32-pole'
|
|
1085
|
+
exponent = 5
|
|
1086
|
+
value = data * ureg.elementary_charge * ureg.bohr**exponent
|
|
1087
|
+
section.total = value.to('coulomb * m ** %d' % exponent).magnitude
|
|
1088
|
+
|
|
1089
|
+
def parse_properties(source, calc):
|
|
1090
|
+
if source is None:
|
|
1091
|
+
return
|
|
1092
|
+
|
|
1093
|
+
# multipoles
|
|
1094
|
+
multipole_kinds = ['electronic', 'nuclear', 'total']
|
|
1095
|
+
for n, multipole in enumerate(multipole_kinds):
|
|
1096
|
+
data = source.get('%s_dipole_moment' % multipole)
|
|
1097
|
+
if data is None:
|
|
1098
|
+
continue
|
|
1099
|
+
multipoles = Multipoles()
|
|
1100
|
+
calc.multipoles.append(multipoles) if len(
|
|
1101
|
+
calc.multipoles
|
|
1102
|
+
) <= n else calc.multipoles[n]
|
|
1103
|
+
multipoles.kind = multipole
|
|
1104
|
+
parse_multipole(data, multipoles)
|
|
1105
|
+
|
|
1106
|
+
multipole_moments = source.get('multipole_moments', {})
|
|
1107
|
+
for multipole in [
|
|
1108
|
+
'dipole',
|
|
1109
|
+
'quadrupole',
|
|
1110
|
+
'octupole',
|
|
1111
|
+
'hexadecapole',
|
|
1112
|
+
'npole',
|
|
1113
|
+
]:
|
|
1114
|
+
data = multipole_moments.get(multipole)
|
|
1115
|
+
if data is None:
|
|
1116
|
+
continue
|
|
1117
|
+
data = np.transpose(data)
|
|
1118
|
+
for n, value in enumerate(data):
|
|
1119
|
+
if len(calc.multipoles) <= n:
|
|
1120
|
+
multipoles = Multipoles()
|
|
1121
|
+
calc.multipoles.append(multipoles)
|
|
1122
|
+
else:
|
|
1123
|
+
multipoles = calc.multipoles[n]
|
|
1124
|
+
parse_multipole(value, multipoles)
|
|
1125
|
+
|
|
1126
|
+
# TODO verify for non spin polarized
|
|
1127
|
+
# charges
|
|
1128
|
+
for method in ['mulliken', 'lowdin']:
|
|
1129
|
+
data = source.get('%s_charges' % method)
|
|
1130
|
+
if data is not None:
|
|
1131
|
+
charges = Charges()
|
|
1132
|
+
calc.charges.append(charges)
|
|
1133
|
+
charges.analysis_method = method
|
|
1134
|
+
if data.atom is not None:
|
|
1135
|
+
charges.value = [
|
|
1136
|
+
a[-1] for a in data.atom
|
|
1137
|
+
] * ureg.elementary_charge
|
|
1138
|
+
charges.spins = [a[-2] for a in data.atom]
|
|
1139
|
+
for n, atom in enumerate(data.atom):
|
|
1140
|
+
for spin in range(2):
|
|
1141
|
+
charges_spin = ChargesValue()
|
|
1142
|
+
charges.spin_projected.append(charges_spin)
|
|
1143
|
+
charges_spin.atom_index = n
|
|
1144
|
+
charges_spin.spin = spin
|
|
1145
|
+
charges_spin.value = atom[spin] * ureg.elementary_charge
|
|
1146
|
+
if data.total is not None:
|
|
1147
|
+
charges.total = data.total[-1]
|
|
1148
|
+
|
|
1149
|
+
# scf iterations
|
|
1150
|
+
if source.iterations is not None:
|
|
1151
|
+
for iteration in source.iterations.get('iteration', []):
|
|
1152
|
+
scf = ScfIteration()
|
|
1153
|
+
calc.scf_iteration.append(scf)
|
|
1154
|
+
scf.energy = Energy(
|
|
1155
|
+
total=EnergyEntry(value=float(iteration[0]) * ureg.hartree),
|
|
1156
|
+
change=float(iteration[1]) * ureg.hartree,
|
|
1157
|
+
)
|
|
1158
|
+
|
|
1159
|
+
# energies
|
|
1160
|
+
# mp/ci energy, the last entry belongs to the method
|
|
1161
|
+
# create additional calc section for references e.g. mp3 have mp2 reference
|
|
1162
|
+
for n in range(len(source.get('energy', []))):
|
|
1163
|
+
if source.energy[n] is None:
|
|
1164
|
+
continue
|
|
1165
|
+
ref_calc = calc
|
|
1166
|
+
# for MP calc, the last energy block corresponds to calc
|
|
1167
|
+
n_ref = len(source.energy) - 1 if self._method[:2] == 'MP' else 0
|
|
1168
|
+
if n != n_ref:
|
|
1169
|
+
ref_calc = Calculation()
|
|
1170
|
+
self.archive.run[-1].calculation.append(ref_calc)
|
|
1171
|
+
ref_calcs.append(ref_calc)
|
|
1172
|
+
ref_calc.energy = Energy()
|
|
1173
|
+
for key, val in source.energy[n].get('key_value'):
|
|
1174
|
+
key = self._metainfo_map.get(key, key)
|
|
1175
|
+
if hasattr(ref_calc.energy, key):
|
|
1176
|
+
setattr(ref_calc.energy, key, EnergyEntry(value=val * ureg.hartree))
|
|
1177
|
+
else:
|
|
1178
|
+
ref_calc.energy.contributions.append(
|
|
1179
|
+
EnergyEntry(kind=key, value=val * ureg.hartree)
|
|
1180
|
+
)
|
|
1181
|
+
# assign total energy to corresponding to method
|
|
1182
|
+
if 'total' in key.lower():
|
|
1183
|
+
ref_calc.energy.total = EnergyEntry(value=val * ureg.hartree)
|
|
1184
|
+
|
|
1185
|
+
# forces
|
|
1186
|
+
if source.total_gradient is not None:
|
|
1187
|
+
calc.forces = Forces(
|
|
1188
|
+
total=ForcesEntry(
|
|
1189
|
+
value=source.total_gradient * ureg.hartree / ureg.bohr
|
|
1190
|
+
)
|
|
1191
|
+
)
|
|
1192
|
+
|
|
1193
|
+
# spins
|
|
1194
|
+
if source.s2_observed is not None:
|
|
1195
|
+
calc.x_psi4_s2_expected = source.s2_expected
|
|
1196
|
+
calc.x_psi4_s2_observed = source.s2_observed
|
|
1197
|
+
calc.spin_S2 = source.s2_observed
|
|
1198
|
+
calc.x_psi4_s_expected = source.s_expected
|
|
1199
|
+
calc.x_psi4_s_observed = source.s_observed
|
|
1200
|
+
|
|
1201
|
+
# eigenvalues
|
|
1202
|
+
if source.orbital_energies is not None:
|
|
1203
|
+
eigenvalues = BandEnergies()
|
|
1204
|
+
calc.eigenvalues.append(eigenvalues)
|
|
1205
|
+
labels, energies, occupations = [], [], []
|
|
1206
|
+
n_spin = len(source.orbital_energies) // 2
|
|
1207
|
+
for n, orbital_energies in enumerate(source.orbital_energies):
|
|
1208
|
+
labels.extend(orbital_energies[0])
|
|
1209
|
+
energies.extend(orbital_energies[1])
|
|
1210
|
+
occupations.extend(
|
|
1211
|
+
[2 / n_spin if n % 2 == 0 else 0] * len(orbital_energies[0])
|
|
1212
|
+
)
|
|
1213
|
+
eigenvalues.orbital_labels = labels
|
|
1214
|
+
eigenvalues.energies = (
|
|
1215
|
+
np.reshape(energies, (n_spin, 1, len(energies) // n_spin))
|
|
1216
|
+
* ureg.hartree
|
|
1217
|
+
)
|
|
1218
|
+
eigenvalues.occupations = np.reshape(
|
|
1219
|
+
occupations, (n_spin, 1, len(occupations) // n_spin)
|
|
1220
|
+
)
|
|
1221
|
+
|
|
1222
|
+
# properties can be calculated using multiple density matrices e.g. for ci/mcscf
|
|
1223
|
+
# create additional calculation section
|
|
1224
|
+
for n, properties in enumerate(source.get('properties', [])):
|
|
1225
|
+
if n == 0:
|
|
1226
|
+
ref_calc = calc
|
|
1227
|
+
else:
|
|
1228
|
+
ref_calc = Calculation()
|
|
1229
|
+
self.archive.run[-1].calculation.append(ref_calc)
|
|
1230
|
+
if n > 0:
|
|
1231
|
+
ref_calcs.append(ref_calc)
|
|
1232
|
+
parse_properties(properties, ref_calc)
|
|
1233
|
+
|
|
1234
|
+
# misc
|
|
1235
|
+
if source.root_info is not None:
|
|
1236
|
+
root_info = x_psi4_root_information()
|
|
1237
|
+
calc.x_psi4_root_information.append(root_info)
|
|
1238
|
+
root_info.x_psi4_root_energy = source.root_info.energy
|
|
1239
|
+
|
|
1240
|
+
# reference calculations
|
|
1241
|
+
if ref_calcs:
|
|
1242
|
+
calc.calculations_ref = ref_calcs
|
|
1243
|
+
for ref_calc in ref_calcs:
|
|
1244
|
+
ref_calc.starting_calculation_ref = calc
|
|
1245
|
+
|
|
1246
|
+
if calc.m_mod_count == 1:
|
|
1247
|
+
self.archive.run[-1].m_remove_sub_section(Run.calculation, -1)
|
|
1248
|
+
|
|
1249
|
+
return calc
|
|
1250
|
+
|
|
1251
|
+
def parse(self, filepath, archive, logger):
|
|
1252
|
+
self.filepath = os.path.abspath(filepath)
|
|
1253
|
+
self.archive = archive
|
|
1254
|
+
self.maindir = os.path.dirname(self.filepath)
|
|
1255
|
+
self.logger = logger if logger is not None else logging
|
|
1256
|
+
|
|
1257
|
+
self.init_parser()
|
|
1258
|
+
|
|
1259
|
+
run = Run()
|
|
1260
|
+
archive.run.append(run)
|
|
1261
|
+
run.program = Program(name='Psi4', version=self.out_parser.get('version', ''))
|
|
1262
|
+
if self.out_parser.start_time is not None:
|
|
1263
|
+
start_time = datetime.strptime(
|
|
1264
|
+
self.out_parser.start_time, '%d %B %Y %H:%M%p'
|
|
1265
|
+
)
|
|
1266
|
+
run.time_run = TimeRun(
|
|
1267
|
+
date_start=(start_time - datetime(1970, 1, 1)).total_seconds()
|
|
1268
|
+
)
|
|
1269
|
+
|
|
1270
|
+
for key in ['process_id', 'psidatadir', 'memory', 'threads', 'input_file']:
|
|
1271
|
+
val = self.out_parser.get(key)
|
|
1272
|
+
if val is not None:
|
|
1273
|
+
setattr(run, 'x_psi4_%s' % key, val)
|
|
1274
|
+
|
|
1275
|
+
opt_calculations_ref = []
|
|
1276
|
+
module_names = [
|
|
1277
|
+
'scf',
|
|
1278
|
+
'scf_grad',
|
|
1279
|
+
'mp',
|
|
1280
|
+
'ci',
|
|
1281
|
+
'mcscf',
|
|
1282
|
+
'mcscf_detci',
|
|
1283
|
+
'cc',
|
|
1284
|
+
'cc_energy',
|
|
1285
|
+
'cc_lambda',
|
|
1286
|
+
'cc_density',
|
|
1287
|
+
]
|
|
1288
|
+
for module in self.out_parser.get('module', []):
|
|
1289
|
+
for name in module_names:
|
|
1290
|
+
for submodule in module.get(name, []):
|
|
1291
|
+
self._method = submodule.get(
|
|
1292
|
+
'method', name.split('_', maxsplit=1)[0].upper()
|
|
1293
|
+
)
|
|
1294
|
+
self.parse_system(submodule)
|
|
1295
|
+
self.parse_method(submodule)
|
|
1296
|
+
calc = self.parse_calculation(submodule)
|
|
1297
|
+
if calc is not None:
|
|
1298
|
+
if self.archive.run[-1].system:
|
|
1299
|
+
calc.system_ref = self.archive.run[-1].system[-1]
|
|
1300
|
+
if self.archive.run[-1].method:
|
|
1301
|
+
calc.method_ref = self.archive.run[-1].method[-1]
|
|
1302
|
+
# TODO are these calcs done in series?
|
|
1303
|
+
calc.time_calculation = module.module_time
|
|
1304
|
+
calc.time_physical = module.total_time
|
|
1305
|
+
if module.options is not None:
|
|
1306
|
+
self.archive.run[-1].method[-1].x_psi4_options = module.options[1]
|
|
1307
|
+
|
|
1308
|
+
if module.salc is not None:
|
|
1309
|
+
calc = self.archive.run[-1].calculation[-1]
|
|
1310
|
+
forces = Forces()
|
|
1311
|
+
calc.forces = forces
|
|
1312
|
+
if module.salc.total_gradient is not None:
|
|
1313
|
+
forces.total = ForcesEntry(
|
|
1314
|
+
value=np.array(module.salc.total_gradient)
|
|
1315
|
+
* ureg.hartree
|
|
1316
|
+
/ ureg.bohr
|
|
1317
|
+
)
|
|
1318
|
+
for contribution in module.salc.get('contributions_gradient', []):
|
|
1319
|
+
forces.contributions.append(
|
|
1320
|
+
ForcesEntry(
|
|
1321
|
+
kind=contribution.name,
|
|
1322
|
+
value=contribution.value * ureg.hartree / ureg.bohr,
|
|
1323
|
+
)
|
|
1324
|
+
)
|
|
1325
|
+
|
|
1326
|
+
# each module should can be considered as a single_point workflow
|
|
1327
|
+
# TODO implement specific workflow for mp, ci, cc, mcscf
|
|
1328
|
+
self.archive.workflow2 = SinglePoint()
|
|
1329
|
+
|
|
1330
|
+
if module.optking is not None:
|
|
1331
|
+
self.parse_system(module.optking)
|
|
1332
|
+
calc = Calculation()
|
|
1333
|
+
self.archive.run[-1].calculation.append(calc)
|
|
1334
|
+
forces = module.optking.get('geometry', {}).get('forces')
|
|
1335
|
+
if forces is not None:
|
|
1336
|
+
calc.forces = Forces(
|
|
1337
|
+
total=ForcesEntry(value=forces * ureg.hartree / ureg.bohr)
|
|
1338
|
+
)
|
|
1339
|
+
energy = module.optking.energy
|
|
1340
|
+
if energy is not None:
|
|
1341
|
+
calc.energy = Energy(
|
|
1342
|
+
total=EnergyEntry(value=energy[0] * ureg.hartree),
|
|
1343
|
+
change=energy[1] * ureg.hartree,
|
|
1344
|
+
)
|
|
1345
|
+
calc.system_ref = self.archive.run[-1].system[-1]
|
|
1346
|
+
calc.time_calculation = module.module_time
|
|
1347
|
+
calc.time_physical = module.total_time
|
|
1348
|
+
opt_calculations_ref.append(calc)
|
|
1349
|
+
if opt_calculations_ref:
|
|
1350
|
+
convergence = module.optking.convergence_criteria
|
|
1351
|
+
if convergence is not None:
|
|
1352
|
+
workflow = GeometryOptimization(method=GeometryOptimizationMethod())
|
|
1353
|
+
workflow.method.convergence_tolerance_energy_difference = (
|
|
1354
|
+
convergence[0] * ureg.hartree
|
|
1355
|
+
)
|
|
1356
|
+
workflow.method.convergence_tolerance_force_maximum = (
|
|
1357
|
+
convergence[1] * ureg.hartree / ureg.bohr
|
|
1358
|
+
)
|
|
1359
|
+
workflow.method.convergence_tolerance_displacement_maximum = (
|
|
1360
|
+
convergence[2] * ureg.bohr
|
|
1361
|
+
)
|
|
1362
|
+
self.archive.workflow2 = workflow
|