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,757 @@
|
|
|
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 numpy as np
|
|
21
|
+
import logging
|
|
22
|
+
import re
|
|
23
|
+
|
|
24
|
+
from nomad.units import ureg
|
|
25
|
+
from nomad.parsing.file_parser import TextParser, Quantity
|
|
26
|
+
from runschema.run import Run, Program
|
|
27
|
+
from runschema.method import (
|
|
28
|
+
Electronic,
|
|
29
|
+
Method,
|
|
30
|
+
DFT,
|
|
31
|
+
XCFunctional,
|
|
32
|
+
Functional,
|
|
33
|
+
BasisSet,
|
|
34
|
+
Scf,
|
|
35
|
+
BasisSetContainer,
|
|
36
|
+
)
|
|
37
|
+
from runschema.system import System, Atoms
|
|
38
|
+
from runschema.calculation import (
|
|
39
|
+
Calculation,
|
|
40
|
+
Energy,
|
|
41
|
+
EnergyEntry,
|
|
42
|
+
Forces,
|
|
43
|
+
ForcesEntry,
|
|
44
|
+
ScfIteration,
|
|
45
|
+
)
|
|
46
|
+
from simulationworkflowschema import (
|
|
47
|
+
SinglePoint,
|
|
48
|
+
GeometryOptimization,
|
|
49
|
+
GeometryOptimizationMethod,
|
|
50
|
+
MolecularDynamics,
|
|
51
|
+
)
|
|
52
|
+
|
|
53
|
+
from .metainfo.nwchem import (
|
|
54
|
+
x_nwchem_section_start_information,
|
|
55
|
+
x_nwchem_section_qmd_step,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def fix_dfloat(val_in):
|
|
60
|
+
return float(re.sub(r'[dD]([\-\+]*\d)', r'E\1', val_in))
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class OutParser(TextParser):
|
|
64
|
+
def __init__(self):
|
|
65
|
+
super().__init__()
|
|
66
|
+
|
|
67
|
+
def init_quantities(self):
|
|
68
|
+
re_float = r'[-+]?\d+\.\d*(?:[EeDd][-+]\d+)?'
|
|
69
|
+
|
|
70
|
+
def str_to_functional(val_in):
|
|
71
|
+
val = [v.strip() for v in val_in.strip().rsplit(' ', 1)]
|
|
72
|
+
if len(val) == 2:
|
|
73
|
+
val = [val[0]] + val[1].split()
|
|
74
|
+
|
|
75
|
+
return val
|
|
76
|
+
|
|
77
|
+
def str_to_energy(val_in):
|
|
78
|
+
separator = '=' if '=' in val_in else ':'
|
|
79
|
+
val = [v.strip() for v in val_in.strip().split(separator)]
|
|
80
|
+
return val[0], float(val[1]) * ureg.hartree
|
|
81
|
+
|
|
82
|
+
def str_to_labels_positions(val_in):
|
|
83
|
+
val = [v.strip().split() for v in val_in.strip().split('\n')]
|
|
84
|
+
labels, positions = [], []
|
|
85
|
+
for val_i in val:
|
|
86
|
+
labels.append(val_i[1])
|
|
87
|
+
positions.append(val_i[3:6])
|
|
88
|
+
positions = np.array(positions, dtype=np.dtype(np.float64))
|
|
89
|
+
return labels, positions * ureg.angstrom
|
|
90
|
+
|
|
91
|
+
def str_to_labels_positions_forces(val_in):
|
|
92
|
+
val = np.transpose([v.split() for v in val_in.strip().split('\n')])
|
|
93
|
+
labels = val[0]
|
|
94
|
+
positions = np.transpose(np.array(val[2:5], dtype=np.dtype(np.float64)))
|
|
95
|
+
forces = np.transpose(np.array(val[5:8], dtype=np.dtype(np.float64)))
|
|
96
|
+
return labels, positions * ureg.bohr, forces * ureg.hartree / ureg.bohr
|
|
97
|
+
|
|
98
|
+
geometry_quantities = [
|
|
99
|
+
Quantity(
|
|
100
|
+
'labels_positions',
|
|
101
|
+
r'No\.\s*Tag\s*Charge\s*X\s*Y\s*Z[\s\-]+([\s\S]+?)\n *\n',
|
|
102
|
+
str_operation=str_to_labels_positions,
|
|
103
|
+
convert=False,
|
|
104
|
+
),
|
|
105
|
+
Quantity(
|
|
106
|
+
'lattice_vectors',
|
|
107
|
+
r'a1\=\<([\d\.\- ]+)\>\s*'
|
|
108
|
+
r'a2\=\<([\d\.\- ]+)\>\s*'
|
|
109
|
+
r'a3\=\<([\d\.\- ]+)\>\s*',
|
|
110
|
+
dtype=np.dtype(np.float64),
|
|
111
|
+
shape=(3, 3),
|
|
112
|
+
unit=ureg.bohr,
|
|
113
|
+
),
|
|
114
|
+
]
|
|
115
|
+
|
|
116
|
+
dft_quantities = geometry_quantities + [
|
|
117
|
+
Quantity(
|
|
118
|
+
'general_info',
|
|
119
|
+
r'General Information\s+\-+([\s\S]+?)\n *\n',
|
|
120
|
+
sub_parser=TextParser(
|
|
121
|
+
quantities=[
|
|
122
|
+
Quantity(
|
|
123
|
+
'info',
|
|
124
|
+
r' +([\w\. ]+\s*\:\s*[\w\.\- ]+)',
|
|
125
|
+
str_operation=lambda x: [v.strip() for v in x.split(':')],
|
|
126
|
+
repeats=True,
|
|
127
|
+
)
|
|
128
|
+
]
|
|
129
|
+
),
|
|
130
|
+
),
|
|
131
|
+
Quantity(
|
|
132
|
+
'xc_info',
|
|
133
|
+
r'XC Information\s+\-+([\s\S]+?)\n *\n',
|
|
134
|
+
sub_parser=TextParser(
|
|
135
|
+
quantities=[
|
|
136
|
+
Quantity(
|
|
137
|
+
'functional',
|
|
138
|
+
r'(.+(?:Functional|Exchange|POtential).+)',
|
|
139
|
+
str_operation=str_to_functional,
|
|
140
|
+
repeats=True,
|
|
141
|
+
)
|
|
142
|
+
]
|
|
143
|
+
),
|
|
144
|
+
),
|
|
145
|
+
Quantity(
|
|
146
|
+
'energy',
|
|
147
|
+
rf'([\w \-\.]+ energy\s*=\s*{re_float})',
|
|
148
|
+
str_operation=str_to_energy,
|
|
149
|
+
repeats=True,
|
|
150
|
+
convert=False,
|
|
151
|
+
),
|
|
152
|
+
Quantity(
|
|
153
|
+
'labels_positions_forces',
|
|
154
|
+
r'atom\s*coordinates\s*gradient\s*x\s*y\s*z\s*x\s*y\s*z\s*([\s\S]+?\n *\n)',
|
|
155
|
+
str_operation=str_to_labels_positions_forces,
|
|
156
|
+
convert=False,
|
|
157
|
+
),
|
|
158
|
+
Quantity(
|
|
159
|
+
'qmd_info',
|
|
160
|
+
r'QMD Run Information\s*\-+\s*([\s\S]+?)\n *\n',
|
|
161
|
+
str_operation=lambda x: [
|
|
162
|
+
[vi.strip() for vi in v.split(':')] for v in x.split('\n')
|
|
163
|
+
],
|
|
164
|
+
convert=False,
|
|
165
|
+
),
|
|
166
|
+
Quantity(
|
|
167
|
+
'self_consistency',
|
|
168
|
+
r'convergence\s*iter\s*energy\s*DeltaE\s*RMS\-Dens\s*Diis\-err\s*time\s*'
|
|
169
|
+
r'([\s\S]+?)\n *\n *\n',
|
|
170
|
+
sub_parser=TextParser(
|
|
171
|
+
quantities=[
|
|
172
|
+
Quantity(
|
|
173
|
+
'iteration',
|
|
174
|
+
rf'd\=\s*\d+,ls=[\d\.]+,diis\s*\d+\s*({re_float})\s*({re_float})\s*{re_float}\s*{re_float}\s*({re_float})',
|
|
175
|
+
dtype=np.dtype(np.float64),
|
|
176
|
+
repeats=True,
|
|
177
|
+
)
|
|
178
|
+
]
|
|
179
|
+
),
|
|
180
|
+
),
|
|
181
|
+
Quantity(
|
|
182
|
+
'time_calculation',
|
|
183
|
+
rf'Total iterative time = +({re_float})s',
|
|
184
|
+
dtype=np.float64,
|
|
185
|
+
unit=ureg.s,
|
|
186
|
+
),
|
|
187
|
+
]
|
|
188
|
+
|
|
189
|
+
dft_gradient_quantities = [
|
|
190
|
+
Quantity(
|
|
191
|
+
'labels_positions_forces',
|
|
192
|
+
r'atom\s*coordinates\s*gradient\s*x\s*y\s*z\s*x\s*y\s*z\s*([\s\S]+?\n *\n)',
|
|
193
|
+
str_operation=str_to_labels_positions_forces,
|
|
194
|
+
convert=False,
|
|
195
|
+
),
|
|
196
|
+
Quantity('energy', r'Step\s*Energy.+[\-\s\@]+(.+)'),
|
|
197
|
+
]
|
|
198
|
+
|
|
199
|
+
pw_quantities = geometry_quantities + [
|
|
200
|
+
Quantity(
|
|
201
|
+
'energy',
|
|
202
|
+
rf'([\w \-]+ energy\s*\:\s*{re_float})',
|
|
203
|
+
str_operation=str_to_energy,
|
|
204
|
+
repeats=True,
|
|
205
|
+
convert=False,
|
|
206
|
+
),
|
|
207
|
+
Quantity('spin_S2', rf'\<S\^2\>\s*\=\s*({re_float})', dtype=np.float64),
|
|
208
|
+
Quantity(
|
|
209
|
+
'parameters',
|
|
210
|
+
r'options\:\s*([\s\S]+?)\n *\n',
|
|
211
|
+
str_operation=lambda x: [
|
|
212
|
+
[vi.strip() for vi in v.split('=')] for v in x.split('\n')
|
|
213
|
+
],
|
|
214
|
+
),
|
|
215
|
+
Quantity(
|
|
216
|
+
'self_consistency',
|
|
217
|
+
r'ITERATION STARTED([\s\S]+?)ITERATION ENDED',
|
|
218
|
+
sub_parser=TextParser(
|
|
219
|
+
quantities=[
|
|
220
|
+
Quantity(
|
|
221
|
+
'iteration',
|
|
222
|
+
rf'\d+\s+({re_float}\s+{re_float})\s+{re_float}\n',
|
|
223
|
+
repeats=True,
|
|
224
|
+
dtype=np.dtype(np.float64),
|
|
225
|
+
)
|
|
226
|
+
]
|
|
227
|
+
),
|
|
228
|
+
),
|
|
229
|
+
Quantity(
|
|
230
|
+
'total_charge', rf'total charge\:\s*({re_float})', dtype=np.float64
|
|
231
|
+
),
|
|
232
|
+
# TODO add xc functionals cannot find mapping
|
|
233
|
+
]
|
|
234
|
+
|
|
235
|
+
calculation_quantities = geometry_quantities + [
|
|
236
|
+
Quantity(
|
|
237
|
+
'dft',
|
|
238
|
+
r'(DFT Module[\s\S]+?)(?:NWChem|\Z)',
|
|
239
|
+
repeats=True,
|
|
240
|
+
sub_parser=TextParser(quantities=dft_quantities),
|
|
241
|
+
),
|
|
242
|
+
Quantity(
|
|
243
|
+
'dft_gradient',
|
|
244
|
+
r'(DFT Gradient Module[\s\S]+?)(?:NWChem|\Z)',
|
|
245
|
+
repeats=True,
|
|
246
|
+
sub_parser=TextParser(quantities=dft_gradient_quantities),
|
|
247
|
+
),
|
|
248
|
+
Quantity(
|
|
249
|
+
'pw',
|
|
250
|
+
r'(PSPW Calculation[\s\S]+?)(?:\*\s*NWPW|\Z)',
|
|
251
|
+
repeats=True,
|
|
252
|
+
sub_parser=TextParser(quantities=pw_quantities),
|
|
253
|
+
),
|
|
254
|
+
]
|
|
255
|
+
|
|
256
|
+
self._quantities = [
|
|
257
|
+
Quantity(
|
|
258
|
+
'version',
|
|
259
|
+
r'Northwest Computational Chemistry Package \(NWChem\) (.+)\n',
|
|
260
|
+
flatten=False,
|
|
261
|
+
convert=False,
|
|
262
|
+
),
|
|
263
|
+
Quantity(
|
|
264
|
+
'job_info',
|
|
265
|
+
r'Job information\s*\-+\s*([\s\S]+?)\n *\n *\n',
|
|
266
|
+
sub_parser=TextParser(
|
|
267
|
+
quantities=[
|
|
268
|
+
Quantity(
|
|
269
|
+
'info',
|
|
270
|
+
r'(\w.+?\s*\=\s*.+)',
|
|
271
|
+
str_operation=lambda x: [v.strip() for v in x.split('=')],
|
|
272
|
+
convert=False,
|
|
273
|
+
repeats=True,
|
|
274
|
+
)
|
|
275
|
+
]
|
|
276
|
+
),
|
|
277
|
+
),
|
|
278
|
+
Quantity(
|
|
279
|
+
'input',
|
|
280
|
+
r'(Input Module[\s\S]+? {30}NWChem)',
|
|
281
|
+
sub_parser=TextParser(quantities=geometry_quantities),
|
|
282
|
+
),
|
|
283
|
+
Quantity(
|
|
284
|
+
'single_point',
|
|
285
|
+
r'(DFT Module\s+\-+[\s\S]+?)(?:GA Statistics for process|NWChem Input Module|\Z)',
|
|
286
|
+
sub_parser=TextParser(quantities=calculation_quantities),
|
|
287
|
+
),
|
|
288
|
+
Quantity(
|
|
289
|
+
'geometry_optimization',
|
|
290
|
+
r'(Geometry Optimization[\s\S]+?)(?:GA Statistics for process|NWChem Input Module|\Z)',
|
|
291
|
+
sub_parser=TextParser(
|
|
292
|
+
quantities=[
|
|
293
|
+
Quantity(
|
|
294
|
+
'parameters',
|
|
295
|
+
r'(maximum gradient threshold\s*\(gmax\)[\s\S]+?)\n *\n',
|
|
296
|
+
str_operation=lambda x: [
|
|
297
|
+
[vi.strip() for vi in v.split('=')]
|
|
298
|
+
for v in x.split('\n')
|
|
299
|
+
],
|
|
300
|
+
),
|
|
301
|
+
Quantity(
|
|
302
|
+
'iteration',
|
|
303
|
+
r'p\s+\d+\s*\-+\s*(Geometry[\s\S]+?(?:\-+\n +Ste|\Z))',
|
|
304
|
+
repeats=True,
|
|
305
|
+
sub_parser=TextParser(quantities=calculation_quantities),
|
|
306
|
+
),
|
|
307
|
+
]
|
|
308
|
+
),
|
|
309
|
+
),
|
|
310
|
+
Quantity(
|
|
311
|
+
'molecular_dynamics',
|
|
312
|
+
r'(QMD Module[\s\S]+?)(?:GA Statistics for process|NWChem Input Module|\Z)',
|
|
313
|
+
sub_parser=TextParser(
|
|
314
|
+
quantities=[
|
|
315
|
+
Quantity(
|
|
316
|
+
'parameters',
|
|
317
|
+
r'QMD Run Parameters\s*\-+\s*([\s\S]+?)\n *\n',
|
|
318
|
+
str_operation=lambda x: [
|
|
319
|
+
[vi.strip() for vi in v.split(':')]
|
|
320
|
+
for v in x.split('\n')
|
|
321
|
+
],
|
|
322
|
+
),
|
|
323
|
+
Quantity(
|
|
324
|
+
'iteration',
|
|
325
|
+
r'(DFT Module[\s\S]+?(?:NWChem|\Z))',
|
|
326
|
+
repeats=True,
|
|
327
|
+
sub_parser=TextParser(quantities=calculation_quantities),
|
|
328
|
+
),
|
|
329
|
+
]
|
|
330
|
+
),
|
|
331
|
+
),
|
|
332
|
+
Quantity(
|
|
333
|
+
'pw',
|
|
334
|
+
r'(PSPW Calculation[\s\S]+?)(?:\*\s*NWPW|GA Statistics for process|\Z)',
|
|
335
|
+
repeats=True,
|
|
336
|
+
sub_parser=TextParser(quantities=pw_quantities),
|
|
337
|
+
),
|
|
338
|
+
# TODO implement frequency analysis
|
|
339
|
+
# TODO add timings
|
|
340
|
+
]
|
|
341
|
+
|
|
342
|
+
|
|
343
|
+
class NWChemParser:
|
|
344
|
+
def __init__(self):
|
|
345
|
+
self.out_parser = OutParser()
|
|
346
|
+
|
|
347
|
+
self._metainfo_map = {
|
|
348
|
+
'hostname': 'run_host_name',
|
|
349
|
+
'program': 'program_name',
|
|
350
|
+
'date': 'start_datetime',
|
|
351
|
+
'compiled': 'compilation_datetime',
|
|
352
|
+
'nwchem branch': 'branch',
|
|
353
|
+
'nwchem revision': 'revision',
|
|
354
|
+
'input': 'input_filename',
|
|
355
|
+
'prefix': 'input_prefix',
|
|
356
|
+
'data base': 'db_filename',
|
|
357
|
+
'Charge': 'total_charge',
|
|
358
|
+
'Spin multiplicity': 'spin_target_multiplicity',
|
|
359
|
+
'Maximum number of iterations': 'scf_max_iteration',
|
|
360
|
+
'Convergence on energy requested': 'scf_threshold_energy_change',
|
|
361
|
+
'Total DFT energy': 'energy_total',
|
|
362
|
+
'One electron energy': 'x_nwchem_energy_one_electron',
|
|
363
|
+
'Coulomb energy': 'energy_coulomb',
|
|
364
|
+
'Exchange energy': 'energy_exchange',
|
|
365
|
+
'Exchange-Corr. energy': 'energy_XC',
|
|
366
|
+
'Correlation energy': 'energy_correlation',
|
|
367
|
+
'Nuclear repulsion energy': 'energy_nuclear_repulsion',
|
|
368
|
+
'total energy': 'energy_total',
|
|
369
|
+
'exc-corr energy': 'energy_XC',
|
|
370
|
+
# TODO verify if energy contributions mapping is correct
|
|
371
|
+
# 'total orbital energy': 'energy_sum_eigenvalues'
|
|
372
|
+
'hartree energy': 'energy_correction_hartree',
|
|
373
|
+
'ion-ion energy': 'energy_nuclear_repulsion',
|
|
374
|
+
'No. of nuclear steps': 'qmd_number_of_nuclear_steps',
|
|
375
|
+
'Nuclear time step': 'qmd_nuclear_time_step',
|
|
376
|
+
'Target temp. (K)': 'qmd_target_temperature',
|
|
377
|
+
'Thermostat': 'qmd_thermostat',
|
|
378
|
+
'Tau': 'qmd_tau',
|
|
379
|
+
'Random seed': 'qmd_random_seed',
|
|
380
|
+
'Nuclear integrator': 'qmd_nuclear_integrator',
|
|
381
|
+
'Current temp. (K)': 'qmd_initial_temperature',
|
|
382
|
+
'electron spin': 'electron_spin_restriction',
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
self._xc_functional_map = {
|
|
386
|
+
'B3LYP Method XC Potential': 'HYB_GGA_XC_B3LYP',
|
|
387
|
+
'PBE0 Method XC Functional': 'HYB_GGA_XC_PBEH',
|
|
388
|
+
'Becke half-and-half Method XC Potential': 'HYB_GGA_XC_BHANDH',
|
|
389
|
+
'HCTH120 Method XC Functional': 'GGA_XC_HCTH_120',
|
|
390
|
+
'HCTH147 Method XC Functional': 'GGA_XC_HCTH_147',
|
|
391
|
+
'HCTH407 Method XC Functional': 'GGA_XC_HCTH_407',
|
|
392
|
+
'PerdewBurkeErnzerhof Exchange Functional': 'GGA_X_PBE',
|
|
393
|
+
'Becke 1988 Exchange Functional': 'GGA_X_B88',
|
|
394
|
+
'Lee-Yang-Parr Correlation Functional': 'GGA_C_LYP',
|
|
395
|
+
'Perdew 1986 Correlation Functional': 'GGA_C_P86',
|
|
396
|
+
'Perdew 1991 Correlation Functional': 'GGA_C_PW91',
|
|
397
|
+
'Perdew 1991 Exchange Functional': 'GGA_X_PW91',
|
|
398
|
+
'Hartree-Fock (Exact) Exchange': 'HF_X',
|
|
399
|
+
'TPSS metaGGA Exchange Functional': 'MGGA_X_TPSS',
|
|
400
|
+
'TPSS03 metaGGA Correlation Functional': 'MGGA_C_TPSS',
|
|
401
|
+
'Slater Exchange Functional': 'LDA_X',
|
|
402
|
+
'VWN V Correlation Functional': 'LDA_C_VWN',
|
|
403
|
+
'OPTX Exchange Functional_1.432_non-local+Slater Exchange Functional_1.052_local': 'GGA_X_OPTX',
|
|
404
|
+
'Perdew 1991 LDA Correlation Functional_1.000_local+PerdewBurkeErnz. Correlation Functional_1.000_non-local': 'GGA_C_PBE',
|
|
405
|
+
'Perdew 1981 Correlation Functional_1.000_local+Perdew 1986 Correlation Functional_1.000_non-local': 'GGA_C_P86',
|
|
406
|
+
'Perdew 1991 Correlation Functional_1.000_non-local+Perdew 1991 LDA Correlation Functional_1.000_local': 'GGA_C_PW91',
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
def init_parser(self):
|
|
410
|
+
self.out_parser.mainfile = self.filepath
|
|
411
|
+
self.out_parser.logger = self.logger
|
|
412
|
+
|
|
413
|
+
def parse_system(self, source):
|
|
414
|
+
sec_system = System()
|
|
415
|
+
self.archive.run[0].system.append(sec_system)
|
|
416
|
+
|
|
417
|
+
labels, positions = source.get('labels_positions', [[], []])
|
|
418
|
+
if len(positions) == 0:
|
|
419
|
+
dft = source.get('dft', [{}])[-1]
|
|
420
|
+
dft_gradient = source.get('dft_gradient', [{}])[-1]
|
|
421
|
+
labels_positions = dft.get(
|
|
422
|
+
'labels_positions_forces', dft_gradient.get('labels_positions_forces')
|
|
423
|
+
)
|
|
424
|
+
if labels_positions is not None:
|
|
425
|
+
labels, positions = labels_positions[:2]
|
|
426
|
+
|
|
427
|
+
if len(positions) == 0:
|
|
428
|
+
labels, positions = self.out_parser.get('input', {}).get(
|
|
429
|
+
'labels_positions', [[], []]
|
|
430
|
+
)
|
|
431
|
+
|
|
432
|
+
sec_atoms = Atoms()
|
|
433
|
+
sec_system.atoms = sec_atoms
|
|
434
|
+
sec_atoms.labels = labels
|
|
435
|
+
sec_atoms.positions = positions
|
|
436
|
+
|
|
437
|
+
lattice_vectors = source.get('lattice_vectors')
|
|
438
|
+
if lattice_vectors is not None:
|
|
439
|
+
sec_atoms.lattice_vectors = lattice_vectors
|
|
440
|
+
sec_atoms.periodic = [True, True, True]
|
|
441
|
+
else:
|
|
442
|
+
sec_atoms.periodic = [False, False, False]
|
|
443
|
+
|
|
444
|
+
return sec_system
|
|
445
|
+
|
|
446
|
+
def parse_scc(self, source):
|
|
447
|
+
sec_run = self.archive.run[0]
|
|
448
|
+
initial_time = (
|
|
449
|
+
sec_run.calculation[-1].time_physical if sec_run.calculation else 0 * ureg.s
|
|
450
|
+
)
|
|
451
|
+
sec_scc = Calculation()
|
|
452
|
+
sec_run.calculation.append(sec_scc)
|
|
453
|
+
|
|
454
|
+
# we only read the results from the last dft and gradients module
|
|
455
|
+
dft = source.get('dft', [{}])[-1]
|
|
456
|
+
dft_gradient = source.get('dft_gradient', [{}])[-1]
|
|
457
|
+
|
|
458
|
+
# energies
|
|
459
|
+
sec_energy = Energy()
|
|
460
|
+
sec_scc.energy = sec_energy
|
|
461
|
+
for key, val in source.get('energy', dft.get('energy', [])):
|
|
462
|
+
key = self._metainfo_map.get(key)
|
|
463
|
+
if key is not None:
|
|
464
|
+
if key.startswith('x_nwchem_energy_'):
|
|
465
|
+
setattr(sec_scc, key, val.to('J').magnitude)
|
|
466
|
+
else:
|
|
467
|
+
sec_energy.m_add_sub_section(
|
|
468
|
+
getattr(Energy, key.replace('energy_', '').lower()),
|
|
469
|
+
EnergyEntry(value=val),
|
|
470
|
+
)
|
|
471
|
+
|
|
472
|
+
# for geometry optimization, energy can also be parsed from gradient module
|
|
473
|
+
energy = dft_gradient.get('energy')
|
|
474
|
+
if energy is not None:
|
|
475
|
+
sec_energy.total = EnergyEntry(value=energy[1] * ureg.hartree)
|
|
476
|
+
sec_scc.time_physical = energy[-1] * ureg.s
|
|
477
|
+
sec_scc.time_calculation = sec_scc.time_physical - initial_time
|
|
478
|
+
|
|
479
|
+
# forces
|
|
480
|
+
forces = dft_gradient.get(
|
|
481
|
+
'labels_positions_forces', dft.get('labels_positions_forces')
|
|
482
|
+
)
|
|
483
|
+
if forces is not None:
|
|
484
|
+
sec_scc.forces = Forces(total=ForcesEntry(value=forces[2]))
|
|
485
|
+
|
|
486
|
+
# spin
|
|
487
|
+
spin_S2 = source.get('spin_S2')
|
|
488
|
+
if spin_S2 is not None:
|
|
489
|
+
sec_scc.spin_S2 = spin_S2
|
|
490
|
+
|
|
491
|
+
# md properties
|
|
492
|
+
qmd_info = dft.get('qmd_info')
|
|
493
|
+
if qmd_info is not None:
|
|
494
|
+
sec_qmd = x_nwchem_section_qmd_step()
|
|
495
|
+
sec_scc.x_nwchem_section_qmd_step.append(sec_qmd)
|
|
496
|
+
for key, val in qmd_info:
|
|
497
|
+
val = val.split()
|
|
498
|
+
if key == 'Time elapsed (fs)':
|
|
499
|
+
sec_qmd.x_nwchem_qmd_step_time = float(val[0]) * ureg.fs
|
|
500
|
+
elif key == 'Kin. energy (a.u.)':
|
|
501
|
+
sec_qmd.x_nwchem_qmd_step_kinetic_energy = (
|
|
502
|
+
float(val[1]) * ureg.hartree
|
|
503
|
+
)
|
|
504
|
+
elif key == 'Pot. energy (a.u.)':
|
|
505
|
+
sec_qmd.x_nwchem_qmd_step_potential_energy = (
|
|
506
|
+
float(val[1]) * ureg.hartree
|
|
507
|
+
)
|
|
508
|
+
elif key == 'Tot. energy (a.u.)':
|
|
509
|
+
sec_qmd.x_nwchem_qmd_step_total_energy = (
|
|
510
|
+
float(val[1]) * ureg.hartree
|
|
511
|
+
)
|
|
512
|
+
elif key == 'Target temp. (K)':
|
|
513
|
+
sec_qmd.x_nwchem_qmd_step_target_temperature = (
|
|
514
|
+
float(val[1]) * ureg.kelvin
|
|
515
|
+
)
|
|
516
|
+
elif key == 'Current temp. (K)':
|
|
517
|
+
sec_qmd.x_nwchem_qmd_step_temperature = float(val[1]) * ureg.kelvin
|
|
518
|
+
elif key == 'Dipole (a.u.)':
|
|
519
|
+
sec_qmd.x_nwchem_qmd_step_dipole = [float(v) for v in val[1:4]]
|
|
520
|
+
|
|
521
|
+
# self consistency
|
|
522
|
+
scf = dft.get('self_consistency', source.get('self_consistency'))
|
|
523
|
+
if scf is not None:
|
|
524
|
+
for iteration in scf.get('iteration', []):
|
|
525
|
+
scf_initial_time = (
|
|
526
|
+
sec_scc.scf_iteration[-1].time_physical
|
|
527
|
+
if sec_scc.scf_iteration
|
|
528
|
+
else initial_time
|
|
529
|
+
)
|
|
530
|
+
sec_scf = ScfIteration()
|
|
531
|
+
sec_scc.scf_iteration.append(sec_scf)
|
|
532
|
+
sec_scf_energy = Energy()
|
|
533
|
+
sec_scf.energy = sec_scf_energy
|
|
534
|
+
iteration = [
|
|
535
|
+
fix_dfloat(i) if isinstance(i, str) else i for i in iteration
|
|
536
|
+
]
|
|
537
|
+
sec_scf_energy.total = EnergyEntry(value=iteration[0] * ureg.hartree)
|
|
538
|
+
sec_scf_energy.change = iteration[1] * ureg.hartree
|
|
539
|
+
if len(iteration) > 2:
|
|
540
|
+
sec_scf.time_physical = iteration[2] * ureg.s
|
|
541
|
+
sec_scf.time_calculation = sec_scf.time_physical - scf_initial_time
|
|
542
|
+
|
|
543
|
+
if not sec_scc.time_calculation and dft.get('time_calculation') is not None:
|
|
544
|
+
sec_scc.time_calculation = dft.time_calculation
|
|
545
|
+
sec_scc.time_physical = initial_time + dft.time_calculation
|
|
546
|
+
|
|
547
|
+
return sec_scc
|
|
548
|
+
|
|
549
|
+
def parse_method(self, source):
|
|
550
|
+
sec_method = Method()
|
|
551
|
+
self.archive.run[0].method.append(sec_method)
|
|
552
|
+
|
|
553
|
+
def resolve_functional_combination(functionals):
|
|
554
|
+
names = []
|
|
555
|
+
for f_a in functionals:
|
|
556
|
+
name = self._xc_functional_map.get(f_a[0])
|
|
557
|
+
if name is not None:
|
|
558
|
+
names.append([name, None])
|
|
559
|
+
if len(f_a) > 1:
|
|
560
|
+
names[-1][1] = f_a[1]
|
|
561
|
+
for f_b in functionals:
|
|
562
|
+
if len(f_a) < 3 or len(f_b) < 3:
|
|
563
|
+
continue
|
|
564
|
+
combination = '+'.join(
|
|
565
|
+
['%s_%1.3f_%s' % tuple(f) for f in [f_a, f_b]]
|
|
566
|
+
)
|
|
567
|
+
name = self._xc_functional_map.get(combination)
|
|
568
|
+
if name is not None:
|
|
569
|
+
names.append([name, None])
|
|
570
|
+
return names
|
|
571
|
+
|
|
572
|
+
sec_dft = DFT()
|
|
573
|
+
sec_method.dft = sec_dft
|
|
574
|
+
sec_electronic = Electronic()
|
|
575
|
+
sec_method.electronic = sec_electronic
|
|
576
|
+
sec_electronic.method = 'DFT'
|
|
577
|
+
|
|
578
|
+
dft = source.get('dft', [{}])[-1]
|
|
579
|
+
|
|
580
|
+
general_info = dft.get('general_info', {})
|
|
581
|
+
sec_scf = Scf()
|
|
582
|
+
sec_method.scf = sec_scf
|
|
583
|
+
for key, val in general_info.get('info', []):
|
|
584
|
+
key = self._metainfo_map.get(key)
|
|
585
|
+
if key is None:
|
|
586
|
+
continue
|
|
587
|
+
if key == 'scf_threshold_energy_change':
|
|
588
|
+
val = fix_dfloat(val) * ureg.hartree
|
|
589
|
+
sec_scf.threshold_energy_change = val
|
|
590
|
+
elif key == 'scf_max_iteration' and isinstance(val, int):
|
|
591
|
+
sec_scf.n_max_iteration = val
|
|
592
|
+
else:
|
|
593
|
+
setattr(sec_method, key, val)
|
|
594
|
+
|
|
595
|
+
xc_functionals = dft.get('xc_info', {}).get('functional', [])
|
|
596
|
+
sec_xc_functional = XCFunctional()
|
|
597
|
+
sec_dft.xc_functional = sec_xc_functional
|
|
598
|
+
for name, weight in resolve_functional_combination(xc_functionals):
|
|
599
|
+
functional = Functional(name=name)
|
|
600
|
+
if weight is not None:
|
|
601
|
+
functional.weight = weight
|
|
602
|
+
if '_X_' in name or name.endswith('_X'):
|
|
603
|
+
sec_xc_functional.exchange.append(functional)
|
|
604
|
+
elif '_C_' in name or name.endswith('_C'):
|
|
605
|
+
sec_xc_functional.correlation.append(functional)
|
|
606
|
+
elif 'HYB' in name:
|
|
607
|
+
sec_xc_functional.hybrid.append(functional)
|
|
608
|
+
else:
|
|
609
|
+
sec_xc_functional.contributions.append(functional)
|
|
610
|
+
|
|
611
|
+
parameters = source.get('parameters', [])
|
|
612
|
+
for parameter in parameters:
|
|
613
|
+
key = self._metainfo_map.get(parameter[0])
|
|
614
|
+
if len(parameter) == 2 and key is not None:
|
|
615
|
+
setattr(sec_method, 'x_nwchem_%s' % key, parameter[1])
|
|
616
|
+
|
|
617
|
+
total_charge = source.get('total_charge')
|
|
618
|
+
if total_charge is not None:
|
|
619
|
+
sec_electronic.charge = total_charge
|
|
620
|
+
|
|
621
|
+
sec_basis = BasisSet()
|
|
622
|
+
sec_basis.type = (
|
|
623
|
+
'plane waves' if self.out_parser.get('pw') is not None else 'gaussians'
|
|
624
|
+
)
|
|
625
|
+
sec_basis.scope = (
|
|
626
|
+
['valence'] if sec_basis.type == 'gaussians' else []
|
|
627
|
+
) # TODO: add distinction for ECP
|
|
628
|
+
full_type = (
|
|
629
|
+
'plane waves'
|
|
630
|
+
if sec_basis.type == 'plane waves'
|
|
631
|
+
else 'atom-centered orbitals'
|
|
632
|
+
)
|
|
633
|
+
sec_method.electrons_representation = [
|
|
634
|
+
BasisSetContainer(
|
|
635
|
+
type=full_type,
|
|
636
|
+
scope=['wavefunction'],
|
|
637
|
+
basis_set=[sec_basis],
|
|
638
|
+
)
|
|
639
|
+
]
|
|
640
|
+
|
|
641
|
+
return sec_method
|
|
642
|
+
|
|
643
|
+
def parse_configurations(self):
|
|
644
|
+
def parse_calculation(source):
|
|
645
|
+
sec_method = self.parse_method(source)
|
|
646
|
+
sec_system = self.parse_system(source)
|
|
647
|
+
sec_scc = self.parse_scc(source)
|
|
648
|
+
sec_scc.method_ref = sec_method
|
|
649
|
+
sec_scc.system_ref = sec_system
|
|
650
|
+
|
|
651
|
+
if self.out_parser.get('geometry_optimization') is not None:
|
|
652
|
+
for iteration in self.out_parser.get('geometry_optimization').get(
|
|
653
|
+
'iteration', []
|
|
654
|
+
):
|
|
655
|
+
parse_calculation(iteration)
|
|
656
|
+
|
|
657
|
+
elif self.out_parser.get('molecular_dynamics') is not None:
|
|
658
|
+
for iteration in self.out_parser.get('molecular_dynamics').get(
|
|
659
|
+
'iteration', []
|
|
660
|
+
):
|
|
661
|
+
parse_calculation(iteration)
|
|
662
|
+
|
|
663
|
+
elif self.out_parser.get('pw') is not None:
|
|
664
|
+
for calculation in self.out_parser.get('pw'):
|
|
665
|
+
parse_calculation(calculation)
|
|
666
|
+
|
|
667
|
+
elif self.out_parser.get('single_point') is not None:
|
|
668
|
+
parse_calculation(self.out_parser.get('single_point'))
|
|
669
|
+
|
|
670
|
+
def parse_workflow(self):
|
|
671
|
+
workflow = None
|
|
672
|
+
parameters = []
|
|
673
|
+
if self.out_parser.get('geometry_optimization') is not None:
|
|
674
|
+
parameters = self.out_parser.get('geometry_optimization').get(
|
|
675
|
+
'parameters', []
|
|
676
|
+
)
|
|
677
|
+
workflow = GeometryOptimization(method=GeometryOptimizationMethod())
|
|
678
|
+
|
|
679
|
+
elif self.out_parser.get('molecular_dynamics') is not None:
|
|
680
|
+
parameters = self.out_parser.get('molecular_dynamics').get('parameters', [])
|
|
681
|
+
workflow = MolecularDynamics()
|
|
682
|
+
|
|
683
|
+
elif self.out_parser.get('pw') is not None:
|
|
684
|
+
# pw is not fully implemented as I do not have example files
|
|
685
|
+
workflow = (
|
|
686
|
+
GeometryOptimization()
|
|
687
|
+
if len(self.out_parser.get('pw')) > 1
|
|
688
|
+
else SinglePoint()
|
|
689
|
+
)
|
|
690
|
+
|
|
691
|
+
elif self.out_parser.get('single_point') is not None:
|
|
692
|
+
workflow = SinglePoint()
|
|
693
|
+
|
|
694
|
+
for parameter in parameters:
|
|
695
|
+
if len(parameter) != 2:
|
|
696
|
+
continue
|
|
697
|
+
if parameter[0] == 'maximum gradient threshold (gmax)':
|
|
698
|
+
val = (
|
|
699
|
+
fix_dfloat(parameter[1])
|
|
700
|
+
if isinstance(parameter[1], str)
|
|
701
|
+
else parameter[1]
|
|
702
|
+
)
|
|
703
|
+
workflow.method.convergence_tolerance_force_maximum = (
|
|
704
|
+
val * ureg.hartree / ureg.bohr
|
|
705
|
+
)
|
|
706
|
+
elif parameter[0] == 'maximum cartesian step threshold (xmax)':
|
|
707
|
+
val = (
|
|
708
|
+
fix_dfloat(parameter[1])
|
|
709
|
+
if isinstance(parameter[1], str)
|
|
710
|
+
else parameter[1]
|
|
711
|
+
)
|
|
712
|
+
workflow.method.convergence_tolerance_displacement_maximum = (
|
|
713
|
+
val * ureg.bohr
|
|
714
|
+
)
|
|
715
|
+
elif parameter[0] == 'energy precision (eprec)':
|
|
716
|
+
val = (
|
|
717
|
+
fix_dfloat(parameter[1])
|
|
718
|
+
if isinstance(parameter[1], str)
|
|
719
|
+
else parameter[1]
|
|
720
|
+
)
|
|
721
|
+
workflow.method.convergence_tolerance_energy_difference = (
|
|
722
|
+
val * ureg.hartree
|
|
723
|
+
)
|
|
724
|
+
else:
|
|
725
|
+
parameter[0] = self._metainfo_map.get(parameter[0])
|
|
726
|
+
if parameter[0] is not None:
|
|
727
|
+
setattr(workflow, 'x_nwchem_%s' % parameter[0], parameter[1])
|
|
728
|
+
|
|
729
|
+
self.archive.workflow2 = workflow
|
|
730
|
+
|
|
731
|
+
def parse(self, filepath, archive, logger):
|
|
732
|
+
self.filepath = os.path.abspath(filepath)
|
|
733
|
+
self.archive = archive
|
|
734
|
+
self.maindir = os.path.dirname(self.filepath)
|
|
735
|
+
self.logger = logger if logger is not None else logging.getLogger(__name__)
|
|
736
|
+
|
|
737
|
+
self.init_parser()
|
|
738
|
+
|
|
739
|
+
sec_run = Run()
|
|
740
|
+
self.archive.run.append(sec_run)
|
|
741
|
+
|
|
742
|
+
sec_run.program = Program(
|
|
743
|
+
name='NWChem', version=self.out_parser.get('version', '')
|
|
744
|
+
)
|
|
745
|
+
|
|
746
|
+
# job information
|
|
747
|
+
sec_info = x_nwchem_section_start_information()
|
|
748
|
+
sec_run.x_nwchem_section_start_information.append(sec_info)
|
|
749
|
+
for key, val in self.out_parser.get('job_info', {}).get('info', []):
|
|
750
|
+
if val is None:
|
|
751
|
+
continue
|
|
752
|
+
key = self._metainfo_map.get(key, key.replace(' ', '_'))
|
|
753
|
+
setattr(sec_info, 'x_nwchem_%s' % key, val)
|
|
754
|
+
|
|
755
|
+
self.parse_configurations()
|
|
756
|
+
|
|
757
|
+
self.parse_workflow()
|