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,2582 @@
|
|
|
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 json
|
|
22
|
+
import hashlib
|
|
23
|
+
from typing import Any
|
|
24
|
+
import re
|
|
25
|
+
from datetime import datetime
|
|
26
|
+
|
|
27
|
+
from nomad.units import ureg
|
|
28
|
+
from nomad.parsing.file_parser import TextParser, Quantity, DataTextParser
|
|
29
|
+
from nomad.metainfo import MSection
|
|
30
|
+
from nomad.utils import get_logger
|
|
31
|
+
|
|
32
|
+
from runschema.run import Run, Program, TimeRun
|
|
33
|
+
from runschema.method import (
|
|
34
|
+
Electronic,
|
|
35
|
+
Method,
|
|
36
|
+
XCFunctional,
|
|
37
|
+
Functional,
|
|
38
|
+
HubbardKanamoriModel,
|
|
39
|
+
AtomParameters,
|
|
40
|
+
DFT,
|
|
41
|
+
BasisSet,
|
|
42
|
+
GW,
|
|
43
|
+
KMesh,
|
|
44
|
+
FrequencyMesh,
|
|
45
|
+
BasisSetContainer,
|
|
46
|
+
)
|
|
47
|
+
from runschema.system import System, Atoms
|
|
48
|
+
from runschema.calculation import (
|
|
49
|
+
Calculation,
|
|
50
|
+
BandStructure,
|
|
51
|
+
BandEnergies,
|
|
52
|
+
Dos,
|
|
53
|
+
DosValues,
|
|
54
|
+
ScfIteration,
|
|
55
|
+
Energy,
|
|
56
|
+
EnergyEntry,
|
|
57
|
+
Stress,
|
|
58
|
+
StressEntry,
|
|
59
|
+
Thermodynamics,
|
|
60
|
+
Forces,
|
|
61
|
+
ForcesEntry,
|
|
62
|
+
)
|
|
63
|
+
from simulationworkflowschema import (
|
|
64
|
+
SinglePoint,
|
|
65
|
+
GeometryOptimization,
|
|
66
|
+
MolecularDynamics,
|
|
67
|
+
MolecularDynamicsMethod,
|
|
68
|
+
MolecularDynamicsResults,
|
|
69
|
+
)
|
|
70
|
+
from simulationworkflowschema.molecular_dynamics import ThermostatParameters
|
|
71
|
+
|
|
72
|
+
from .metainfo.fhi_aims import (
|
|
73
|
+
Run as xsection_run,
|
|
74
|
+
Method as xsection_method,
|
|
75
|
+
x_fhi_aims_section_parallel_task_assignement,
|
|
76
|
+
x_fhi_aims_section_parallel_tasks,
|
|
77
|
+
x_fhi_aims_section_controlIn_basis_set,
|
|
78
|
+
x_fhi_aims_section_controlIn_basis_func,
|
|
79
|
+
x_fhi_aims_section_controlInOut_atom_species,
|
|
80
|
+
x_fhi_aims_section_controlInOut_basis_func,
|
|
81
|
+
x_fhi_aims_section_vdW_TS,
|
|
82
|
+
)
|
|
83
|
+
|
|
84
|
+
from ..utils import BeyondDFTWorkflowsParser
|
|
85
|
+
|
|
86
|
+
|
|
87
|
+
re_float = r'[-+]?\d+\.\d*(?:[Ee][-+]\d+)?'
|
|
88
|
+
re_n = r'[\n\r]'
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
class FHIAimsControlParser(TextParser):
|
|
92
|
+
def __init__(self):
|
|
93
|
+
super().__init__(None)
|
|
94
|
+
|
|
95
|
+
@staticmethod
|
|
96
|
+
def str_to_unit(val_in):
|
|
97
|
+
val = val_in.strip().lower()
|
|
98
|
+
unit = None
|
|
99
|
+
if val.startswith('a'):
|
|
100
|
+
unit = 1 / ureg.angstrom
|
|
101
|
+
elif val.startswith('b'):
|
|
102
|
+
unit = 1 / ureg.bohr
|
|
103
|
+
return unit
|
|
104
|
+
|
|
105
|
+
def init_quantities(self):
|
|
106
|
+
def str_to_species(val_in):
|
|
107
|
+
val = val_in.strip().splitlines()
|
|
108
|
+
data = []
|
|
109
|
+
species = dict()
|
|
110
|
+
for v in val:
|
|
111
|
+
v = v.strip().split('#')[0]
|
|
112
|
+
if not v or not v[0].isalpha():
|
|
113
|
+
continue
|
|
114
|
+
if v.startswith('species'):
|
|
115
|
+
if species:
|
|
116
|
+
data.append(species)
|
|
117
|
+
species = dict(species=v.split()[1:])
|
|
118
|
+
else:
|
|
119
|
+
v = v.replace('.d', '.e').split()
|
|
120
|
+
vi = v[1] if len(v[1:]) == 1 else v[1:]
|
|
121
|
+
if v[0] in species:
|
|
122
|
+
species[v[0]].extend([vi])
|
|
123
|
+
else:
|
|
124
|
+
species[v[0]] = [vi]
|
|
125
|
+
data.append(species)
|
|
126
|
+
return data
|
|
127
|
+
|
|
128
|
+
self._quantities = [
|
|
129
|
+
Quantity(
|
|
130
|
+
xsection_method.x_fhi_aims_controlIn_charge,
|
|
131
|
+
rf'{re_n} *charge\s*({re_float})',
|
|
132
|
+
repeats=False,
|
|
133
|
+
),
|
|
134
|
+
Quantity(
|
|
135
|
+
xsection_method.x_fhi_aims_controlIn_hse_unit,
|
|
136
|
+
rf'{re_n} *hse_unit\s*([\w\-]+)',
|
|
137
|
+
str_operation=self.str_to_unit,
|
|
138
|
+
repeats=False,
|
|
139
|
+
),
|
|
140
|
+
Quantity(
|
|
141
|
+
xsection_method.x_fhi_aims_controlIn_hybrid_xc_coeff,
|
|
142
|
+
rf'{re_n} *hybrid_xc_coeff\s*({re_float})',
|
|
143
|
+
repeats=False,
|
|
144
|
+
),
|
|
145
|
+
Quantity(
|
|
146
|
+
xsection_run.x_fhi_aims_controlIn_MD_time_step,
|
|
147
|
+
rf'{re_n} *MD_time_step\s*({re_float})',
|
|
148
|
+
repeats=False,
|
|
149
|
+
),
|
|
150
|
+
Quantity(
|
|
151
|
+
'k_grid', rf'{re_n} *k\_grid\s*([\d ]+)', repeats=False
|
|
152
|
+
), # manual version 210716_2
|
|
153
|
+
Quantity(
|
|
154
|
+
'k_offset', rf'{re_n} *k\_offset\s*([\d ]+)', repeats=False
|
|
155
|
+
), # manual version 210716_2
|
|
156
|
+
Quantity(
|
|
157
|
+
'occupation_type',
|
|
158
|
+
rf'{re_n} *occupation_type\s*([\w\. \-\+]+)',
|
|
159
|
+
repeats=False,
|
|
160
|
+
),
|
|
161
|
+
Quantity(
|
|
162
|
+
xsection_method.x_fhi_aims_controlIn_override_relativity,
|
|
163
|
+
rf'{re_n} *override_relativity\s*([\.\w]+)',
|
|
164
|
+
repeats=False,
|
|
165
|
+
),
|
|
166
|
+
Quantity(
|
|
167
|
+
'relativistic', rf'{re_n} *relativistic\s*([\w\. \-\+]+)', repeats=False
|
|
168
|
+
),
|
|
169
|
+
Quantity(
|
|
170
|
+
xsection_method.x_fhi_aims_controlIn_sc_accuracy_rho,
|
|
171
|
+
rf'{re_n} *sc_accuracy_rho\s*({re_float})',
|
|
172
|
+
repeats=False,
|
|
173
|
+
),
|
|
174
|
+
Quantity(
|
|
175
|
+
xsection_method.x_fhi_aims_controlIn_sc_accuracy_eev,
|
|
176
|
+
rf'{re_n} *sc_accuracy_eev\s*({re_float})',
|
|
177
|
+
repeats=False,
|
|
178
|
+
),
|
|
179
|
+
Quantity(
|
|
180
|
+
xsection_method.x_fhi_aims_controlIn_sc_accuracy_etot,
|
|
181
|
+
rf'{re_n} *sc_accuracy_etot\s*({re_float})',
|
|
182
|
+
repeats=False,
|
|
183
|
+
),
|
|
184
|
+
Quantity(
|
|
185
|
+
xsection_method.x_fhi_aims_controlIn_sc_accuracy_forces,
|
|
186
|
+
rf'{re_n} *sc_accuracy_forces\s*({re_float})',
|
|
187
|
+
repeats=False,
|
|
188
|
+
),
|
|
189
|
+
Quantity(
|
|
190
|
+
xsection_method.x_fhi_aims_controlIn_sc_accuracy_stress,
|
|
191
|
+
rf'{re_n} *sc_accuracy_stress\s*({re_float})',
|
|
192
|
+
repeats=False,
|
|
193
|
+
),
|
|
194
|
+
Quantity(
|
|
195
|
+
xsection_method.x_fhi_aims_controlIn_sc_iter_limit,
|
|
196
|
+
rf'{re_n} *sc_iter_limit\s*([\d]+)',
|
|
197
|
+
repeats=False,
|
|
198
|
+
),
|
|
199
|
+
Quantity(
|
|
200
|
+
xsection_method.x_fhi_aims_controlIn_spin,
|
|
201
|
+
rf'{re_n} *spin\s*([\w]+)',
|
|
202
|
+
repeats=False,
|
|
203
|
+
),
|
|
204
|
+
Quantity(
|
|
205
|
+
xsection_method.x_fhi_aims_controlIn_verbatim_writeout,
|
|
206
|
+
rf'{re_n} *verbatim_writeout\s*([\w]+)',
|
|
207
|
+
repeats=False,
|
|
208
|
+
),
|
|
209
|
+
Quantity('xc', rf'{re_n} *xc\s*([\w\. \-\+]+)', repeats=False),
|
|
210
|
+
Quantity(
|
|
211
|
+
'species',
|
|
212
|
+
rf'{re_n} *(species\s*[A-Z][a-z]?[\s\S]+?)'
|
|
213
|
+
r'(?:species\s*[A-Z][a-z]?|Completed|\-{10})',
|
|
214
|
+
str_operation=str_to_species,
|
|
215
|
+
repeats=False,
|
|
216
|
+
),
|
|
217
|
+
]
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
class FHIAimsOutParser(TextParser):
|
|
221
|
+
def __init__(self):
|
|
222
|
+
self._re_gw_flag = rf'{re_n}\s*(?:qpe_calc|sc_self_energy)\s*([\w]+)'
|
|
223
|
+
super().__init__(None)
|
|
224
|
+
|
|
225
|
+
def init_quantities(self):
|
|
226
|
+
units_mapping = {'Ha': ureg.hartree, 'eV': ureg.eV}
|
|
227
|
+
|
|
228
|
+
def str_to_energy_components(val_in):
|
|
229
|
+
val = [v.strip() for v in val_in.strip().splitlines()]
|
|
230
|
+
res = dict()
|
|
231
|
+
for v in val:
|
|
232
|
+
v = v.lstrip(' |').strip().split(':')
|
|
233
|
+
if len(v) < 2 or not v[1]:
|
|
234
|
+
continue
|
|
235
|
+
vi = v[1].split()
|
|
236
|
+
if not vi[0][-1].isdecimal() or len(vi) < 2:
|
|
237
|
+
continue
|
|
238
|
+
unit = units_mapping.get(vi[1], None)
|
|
239
|
+
res[v[0].strip()] = (
|
|
240
|
+
float(vi[0]) * unit if unit is not None else float(vi[0])
|
|
241
|
+
)
|
|
242
|
+
return res
|
|
243
|
+
|
|
244
|
+
def str_to_scf_convergence(val_in):
|
|
245
|
+
res = dict()
|
|
246
|
+
for v in val_in.strip().splitlines():
|
|
247
|
+
v = v.lstrip(' |').split(':')
|
|
248
|
+
if len(v) != 2:
|
|
249
|
+
break
|
|
250
|
+
vs = v[1].split()
|
|
251
|
+
unit = None
|
|
252
|
+
if len(vs) > 1:
|
|
253
|
+
unit = units_mapping.get(vs[1], None)
|
|
254
|
+
res[v[0].strip()] = (
|
|
255
|
+
float(vs[0]) * unit if unit is not None else float(vs[0])
|
|
256
|
+
)
|
|
257
|
+
return res
|
|
258
|
+
|
|
259
|
+
def str_to_atomic_forces(val_in):
|
|
260
|
+
val = [v.lstrip(' |').split() for v in val_in.strip().splitlines()]
|
|
261
|
+
forces = np.array([v[1:4] for v in val if len(v) == 4], dtype=float)
|
|
262
|
+
return forces * ureg.eV / ureg.angstrom
|
|
263
|
+
|
|
264
|
+
def str_to_dos_files(val_in):
|
|
265
|
+
val = [v.strip() for v in val_in.strip().splitlines()]
|
|
266
|
+
files = []
|
|
267
|
+
species = []
|
|
268
|
+
for v in val[1:]:
|
|
269
|
+
if v.startswith('| writing') and 'raw data' in v:
|
|
270
|
+
files.append(v.split('to file')[1].strip(' .'))
|
|
271
|
+
if 'for species' in v:
|
|
272
|
+
species.append(v.split('for species')[1].split()[0])
|
|
273
|
+
elif not v.startswith('|'):
|
|
274
|
+
break
|
|
275
|
+
return files, list(set(species))
|
|
276
|
+
|
|
277
|
+
def str_to_array_size_parameters(val_in):
|
|
278
|
+
val = [v.lstrip(' |').split(':') for v in val_in.strip().splitlines()]
|
|
279
|
+
return {v[0].strip(): int(v[1]) for v in val if len(v) == 2}
|
|
280
|
+
|
|
281
|
+
def str_to_species_in(val_in):
|
|
282
|
+
val = [v.strip() for v in val_in.splitlines()]
|
|
283
|
+
data = []
|
|
284
|
+
species = dict()
|
|
285
|
+
for i in range(len(val)):
|
|
286
|
+
if val[i].startswith('Reading configuration options for species'):
|
|
287
|
+
if species:
|
|
288
|
+
data.append(species)
|
|
289
|
+
species = dict(species=val[i].split('species')[1].split()[0])
|
|
290
|
+
elif not val[i].startswith('| Found'):
|
|
291
|
+
continue
|
|
292
|
+
val[i] = val[i].split(':')
|
|
293
|
+
if len(val[i]) == 1:
|
|
294
|
+
val[i] = val[i][0].split('treatment for')
|
|
295
|
+
if len(val[i]) < 2:
|
|
296
|
+
continue
|
|
297
|
+
k = val[i][0].split('Found')[1].strip()
|
|
298
|
+
v = val[i][1].replace(',', '').split()
|
|
299
|
+
if 'Gaussian basis function' in k and 'elementary' in v:
|
|
300
|
+
n_gaussians = int(v[v.index('elementary') - 1])
|
|
301
|
+
for j in range(n_gaussians):
|
|
302
|
+
v.extend(val[i + j + 1].lstrip('|').split())
|
|
303
|
+
v = v[0] if len(v) == 1 else v
|
|
304
|
+
if val[i][0] in species:
|
|
305
|
+
species[k].extend([v])
|
|
306
|
+
else:
|
|
307
|
+
species[k] = [v]
|
|
308
|
+
data.append(species)
|
|
309
|
+
return data
|
|
310
|
+
|
|
311
|
+
def str_to_species(val_in):
|
|
312
|
+
data = dict()
|
|
313
|
+
val = [v.strip() for v in val_in.splitlines()]
|
|
314
|
+
for i in range(len(val)):
|
|
315
|
+
if val[i].startswith('species'):
|
|
316
|
+
data['species'] = val[i].split()[1]
|
|
317
|
+
elif not val[i].startswith('| Found'):
|
|
318
|
+
continue
|
|
319
|
+
val[i] = val[i].split(':')
|
|
320
|
+
if len(val[i]) == 1:
|
|
321
|
+
val[i] = val[i][0].split('treatment for')
|
|
322
|
+
if len(val[i]) < 2:
|
|
323
|
+
continue
|
|
324
|
+
k = val[i][0].split('Found')[1].strip()
|
|
325
|
+
v = val[i][1].replace(',', '').split()
|
|
326
|
+
if 'Gaussian basis function' in k and 'elementary' in v:
|
|
327
|
+
n_gaussians = int(v[v.index('elementary') - 1])
|
|
328
|
+
for j in range(n_gaussians):
|
|
329
|
+
v.extend(val[i + j + 1].lstrip('|').split())
|
|
330
|
+
v = v[0] if len(v) == 1 else v
|
|
331
|
+
if k in data:
|
|
332
|
+
data[k].extend([v])
|
|
333
|
+
else:
|
|
334
|
+
data[k] = [v]
|
|
335
|
+
return data
|
|
336
|
+
|
|
337
|
+
structure_quantities = [
|
|
338
|
+
Quantity(
|
|
339
|
+
'labels',
|
|
340
|
+
rf'(?:Species\s*([A-Z][a-z]*)|([A-Z][a-z]*)\w*{re_n})',
|
|
341
|
+
repeats=True,
|
|
342
|
+
),
|
|
343
|
+
Quantity(
|
|
344
|
+
'positions',
|
|
345
|
+
rf'({re_float})\s+({re_float})\s+({re_float}) *{re_n}',
|
|
346
|
+
dtype=np.dtype(np.float64),
|
|
347
|
+
repeats=True,
|
|
348
|
+
),
|
|
349
|
+
Quantity(
|
|
350
|
+
'positions',
|
|
351
|
+
rf'atom +({re_float})\s+({re_float})\s+({re_float})',
|
|
352
|
+
dtype=np.dtype(np.float64),
|
|
353
|
+
repeats=True,
|
|
354
|
+
),
|
|
355
|
+
Quantity(
|
|
356
|
+
'velocities',
|
|
357
|
+
rf'velocity\s+({re_float})\s+({re_float})\s+({re_float})',
|
|
358
|
+
dtype=np.dtype(np.float64),
|
|
359
|
+
repeats=True,
|
|
360
|
+
),
|
|
361
|
+
]
|
|
362
|
+
|
|
363
|
+
eigenvalues = Quantity(
|
|
364
|
+
'eigenvalues',
|
|
365
|
+
rf'Writing Kohn\-Sham eigenvalues\.([\s\S]+?State[\s\S]+?)(?:{re_n}{re_n} +[A-RT-Z])',
|
|
366
|
+
repeats=True,
|
|
367
|
+
sub_parser=TextParser(
|
|
368
|
+
quantities=[
|
|
369
|
+
Quantity(
|
|
370
|
+
'kpoints',
|
|
371
|
+
rf'{re_n} *K-point:\s*\d+ at\s*({re_float})\s*({re_float})\s*({re_float})',
|
|
372
|
+
dtype=float,
|
|
373
|
+
repeats=True,
|
|
374
|
+
),
|
|
375
|
+
Quantity(
|
|
376
|
+
'occupation_eigenvalue',
|
|
377
|
+
rf'{re_n} *\d+\s*({re_float})\s*({re_float})\s*{re_float}',
|
|
378
|
+
repeats=True,
|
|
379
|
+
),
|
|
380
|
+
]
|
|
381
|
+
),
|
|
382
|
+
)
|
|
383
|
+
|
|
384
|
+
date_time = Quantity(
|
|
385
|
+
'date_time',
|
|
386
|
+
rf'Date\s*:\s*(\d+), Time\s*:\s*([\d\.]+)\s*',
|
|
387
|
+
repeats=False,
|
|
388
|
+
convert=False,
|
|
389
|
+
str_operation=lambda x: datetime.strptime(
|
|
390
|
+
x, '%Y%m%d %H%M%S.%f'
|
|
391
|
+
).timestamp(),
|
|
392
|
+
)
|
|
393
|
+
|
|
394
|
+
scf_quantities = [
|
|
395
|
+
# TODO add section_eigenvalues to scf_iteration
|
|
396
|
+
date_time,
|
|
397
|
+
eigenvalues,
|
|
398
|
+
Quantity(
|
|
399
|
+
'energy_components',
|
|
400
|
+
rf'{re_n} *Total energy components:([\s\S]+?)((?:{re_n}{re_n}|\| Electronic free energy per atom\s*:\s*[Ee\d\.\-]+ eV))',
|
|
401
|
+
repeats=False,
|
|
402
|
+
str_operation=str_to_energy_components,
|
|
403
|
+
convert=False,
|
|
404
|
+
),
|
|
405
|
+
Quantity(
|
|
406
|
+
'forces',
|
|
407
|
+
rf'{re_n} *Total forces\([\s\d]+\)\s*:([\s\d\.\-\+Ee]+){re_n}',
|
|
408
|
+
repeats=True,
|
|
409
|
+
),
|
|
410
|
+
Quantity(
|
|
411
|
+
'stress_tensor',
|
|
412
|
+
rf'{re_n} *Sum of all contributions\s*:\s*([\d\.\-\+Ee ]+{re_n})',
|
|
413
|
+
repeats=False,
|
|
414
|
+
),
|
|
415
|
+
Quantity('pressure', r' *\|\s*Pressure:\s*([\d\.\-\+Ee ]+)', repeats=False),
|
|
416
|
+
Quantity(
|
|
417
|
+
'scf_convergence',
|
|
418
|
+
rf'{re_n} *Self-consistency convergence accuracy:([\s\S]+?)(\| Change of total energy\s*:\s*[\d\.\-\+Ee V]+)',
|
|
419
|
+
repeats=False,
|
|
420
|
+
str_operation=str_to_scf_convergence,
|
|
421
|
+
convert=False,
|
|
422
|
+
),
|
|
423
|
+
Quantity(
|
|
424
|
+
'humo',
|
|
425
|
+
r'Highest occupied state \(VBM\) at\s*([\d\.\-\+Ee ]+) (?P<__unit>\w+)',
|
|
426
|
+
repeats=False,
|
|
427
|
+
dtype=float,
|
|
428
|
+
),
|
|
429
|
+
Quantity(
|
|
430
|
+
'lumo',
|
|
431
|
+
r'Lowest unoccupied state \(CBM\) at\s*([\d\.\-\+Ee ]+) (?P<__unit>\w+)',
|
|
432
|
+
repeats=False,
|
|
433
|
+
dtype=float,
|
|
434
|
+
),
|
|
435
|
+
Quantity(
|
|
436
|
+
'fermi_level', # older version
|
|
437
|
+
rf'{re_n} *\| Chemical potential \(Fermi level\) in (\w+)\s*:([\d\.\-\+Ee ]+)',
|
|
438
|
+
str_operation=lambda x: float(x.split()[1])
|
|
439
|
+
* units_mapping.get(x.split()[0]),
|
|
440
|
+
),
|
|
441
|
+
Quantity(
|
|
442
|
+
'fermi_level', # newer version
|
|
443
|
+
rf'{re_n} *\| Chemical potential \(Fermi level\)\:\s*([\-\d\.]+)\s*(\w+)',
|
|
444
|
+
str_operation=lambda x: float(x.split()[0])
|
|
445
|
+
* units_mapping.get(x.split()[1], 1),
|
|
446
|
+
),
|
|
447
|
+
Quantity(
|
|
448
|
+
'time_calculation',
|
|
449
|
+
r'Time for this iteration +: +[\d\.]+ s +([\d\.]+) s',
|
|
450
|
+
dtype=float,
|
|
451
|
+
),
|
|
452
|
+
]
|
|
453
|
+
|
|
454
|
+
def str_to_scf_convergence2(val_in):
|
|
455
|
+
val = val_in.split('|')
|
|
456
|
+
if len(val) != 7:
|
|
457
|
+
return
|
|
458
|
+
energy = float(val[3]) * ureg.eV
|
|
459
|
+
return {'Change of total energy': energy}
|
|
460
|
+
|
|
461
|
+
def str_to_hirshfeld(val_in):
|
|
462
|
+
val = [v.strip() for v in val_in.strip().splitlines()]
|
|
463
|
+
data = dict(atom=val[0])
|
|
464
|
+
for v in val[1:]:
|
|
465
|
+
if v.startswith('|'):
|
|
466
|
+
v = v.strip(' |').split(':')
|
|
467
|
+
if v[0][0].isalpha():
|
|
468
|
+
key = v[0].strip()
|
|
469
|
+
data[key] = []
|
|
470
|
+
data[key].extend([float(vi) for vi in v[-1].split()])
|
|
471
|
+
return data
|
|
472
|
+
|
|
473
|
+
def str_to_frequency(val_in):
|
|
474
|
+
val = val_in.strip().split()
|
|
475
|
+
return [int(val[0]), float(val[1])]
|
|
476
|
+
|
|
477
|
+
def str_to_gw_eigs(val_in):
|
|
478
|
+
val = [v.split() for v in val_in.splitlines()]
|
|
479
|
+
keys = val[0]
|
|
480
|
+
data = []
|
|
481
|
+
for v in val[1:]:
|
|
482
|
+
if len(keys) == len(v) and v[0].isdecimal():
|
|
483
|
+
data.append(v)
|
|
484
|
+
data = np.array(data, dtype=float)
|
|
485
|
+
data = np.transpose(data)
|
|
486
|
+
res = {keys[i]: data[i] for i in range(len(data))}
|
|
487
|
+
return res
|
|
488
|
+
|
|
489
|
+
def str_to_gw_scf(val_in):
|
|
490
|
+
val = [v.split(':') for v in val_in.splitlines()]
|
|
491
|
+
data = {}
|
|
492
|
+
for v in val:
|
|
493
|
+
if len(v) == 2:
|
|
494
|
+
data[v[0].strip(' |')] = float(v[1].split()[0]) * ureg.eV
|
|
495
|
+
if 'Fit accuracy for G' in v[0]:
|
|
496
|
+
data['Fit accuracy for G(w)'] = float(v[0].split()[-1])
|
|
497
|
+
return data
|
|
498
|
+
|
|
499
|
+
def str_to_md_calculation_info(val_in):
|
|
500
|
+
val = [v.strip() for v in val_in.strip().splitlines()]
|
|
501
|
+
res = dict()
|
|
502
|
+
for v in val:
|
|
503
|
+
v = v.lstrip(' |').strip().split(':')
|
|
504
|
+
if len(v) < 2 or not v[1]:
|
|
505
|
+
continue
|
|
506
|
+
vi = v[1].split()
|
|
507
|
+
if not vi[0][-1].isdecimal():
|
|
508
|
+
continue
|
|
509
|
+
elif len(vi) < 2:
|
|
510
|
+
res[v[0].strip()] = float(vi[0])
|
|
511
|
+
else:
|
|
512
|
+
unit = units_mapping.get(vi[1], None)
|
|
513
|
+
res[v[0].strip()] = (
|
|
514
|
+
float(vi[0]) * unit if unit is not None else float(vi[0])
|
|
515
|
+
)
|
|
516
|
+
return res
|
|
517
|
+
|
|
518
|
+
def str_to_quantity(val_in):
|
|
519
|
+
val = val_in.split()
|
|
520
|
+
if len(val) == 1:
|
|
521
|
+
return float(val[0])
|
|
522
|
+
elif len(val) == 2:
|
|
523
|
+
return float(val[0]) * ureg(val[1])
|
|
524
|
+
else:
|
|
525
|
+
return None
|
|
526
|
+
|
|
527
|
+
def str_to_ureg(val_in):
|
|
528
|
+
try:
|
|
529
|
+
val = ureg(val_in.replace('^', '**'))
|
|
530
|
+
except Exception:
|
|
531
|
+
self.logger.warning(
|
|
532
|
+
rf'Problem parsing some units from .out file, could not convert.',
|
|
533
|
+
details={'value': val_in},
|
|
534
|
+
)
|
|
535
|
+
val = None
|
|
536
|
+
return val
|
|
537
|
+
|
|
538
|
+
def str_to_md_control_in(val_in):
|
|
539
|
+
val = val_in.split()
|
|
540
|
+
return {val[0]: ' '.join(val[1:])}
|
|
541
|
+
|
|
542
|
+
calculation_quantities = [
|
|
543
|
+
Quantity(
|
|
544
|
+
'self_consistency',
|
|
545
|
+
r'Begin self\-consistency iteration #\s*\d+([\s\S]+?Total energy evaluation[s:\d\. ]+)',
|
|
546
|
+
repeats=True,
|
|
547
|
+
sub_parser=TextParser(quantities=scf_quantities),
|
|
548
|
+
),
|
|
549
|
+
# different format for scf loop
|
|
550
|
+
Quantity(
|
|
551
|
+
'self_consistency',
|
|
552
|
+
rf'{re_n} *SCF\s*\d+\s*:([ \|\-\+Ee\d\.s]+)',
|
|
553
|
+
repeats=True,
|
|
554
|
+
sub_parser=TextParser(
|
|
555
|
+
quantities=[
|
|
556
|
+
Quantity(
|
|
557
|
+
'scf_convergence',
|
|
558
|
+
r'([\s\S]+)',
|
|
559
|
+
str_operation=str_to_scf_convergence2,
|
|
560
|
+
repeats=False,
|
|
561
|
+
convert=False,
|
|
562
|
+
)
|
|
563
|
+
]
|
|
564
|
+
),
|
|
565
|
+
),
|
|
566
|
+
Quantity(
|
|
567
|
+
'structure',
|
|
568
|
+
rf'Atomic structure(.|\n)*\| *Atom *x \[A\] *y \[A\] *z \[A\]([\s\S]+?Species[\s\S]+?(?:{re_n} *{re_n}| 1\: ))',
|
|
569
|
+
repeats=False,
|
|
570
|
+
convert=False,
|
|
571
|
+
sub_parser=TextParser(quantities=structure_quantities),
|
|
572
|
+
),
|
|
573
|
+
Quantity(
|
|
574
|
+
'structure',
|
|
575
|
+
rf'{re_n} *(atom +{re_float}[\s\S]+?(?:{re_n} *{re_n}|\-\-\-))',
|
|
576
|
+
repeats=False,
|
|
577
|
+
convert=False,
|
|
578
|
+
sub_parser=TextParser(quantities=structure_quantities),
|
|
579
|
+
),
|
|
580
|
+
Quantity( # This quantity is double defined in self._quantities
|
|
581
|
+
'lattice_vectors',
|
|
582
|
+
rf'{re_n} *lattice_vector([\d\.\- ]+){re_n} *lattice_vector([\d\.\- ]+){re_n} *lattice_vector([\d\.\- ]+)',
|
|
583
|
+
unit='angstrom',
|
|
584
|
+
repeats=False,
|
|
585
|
+
shape=(3, 3),
|
|
586
|
+
dtype=float,
|
|
587
|
+
),
|
|
588
|
+
Quantity(
|
|
589
|
+
'energy',
|
|
590
|
+
rf'{re_n} *Energy and forces in a compact form:([\s\S]+?(?:{re_n}{re_n}|Electronic free energy\s*:\s*[\d\.\-Ee]+ eV))',
|
|
591
|
+
str_operation=str_to_energy_components,
|
|
592
|
+
repeats=False,
|
|
593
|
+
convert=False,
|
|
594
|
+
),
|
|
595
|
+
# in some cases, the energy components are also printed for after a calculation
|
|
596
|
+
# same format as in scf iteration, they are printed also in initialization
|
|
597
|
+
# so we should get last occurence
|
|
598
|
+
Quantity(
|
|
599
|
+
'energy_components',
|
|
600
|
+
rf'{re_n} *Total energy components:([\s\S]+?)((?:{re_n}{re_n}|\| Electronic free energy per atom\s*:\s*[\d\.\-Ee]+ eV))',
|
|
601
|
+
repeats=True,
|
|
602
|
+
str_operation=str_to_energy_components,
|
|
603
|
+
convert=False,
|
|
604
|
+
),
|
|
605
|
+
Quantity(
|
|
606
|
+
'energy_xc',
|
|
607
|
+
rf'{re_n} *Start decomposition of the XC Energy([\s\S]+?)End decomposition of the XC Energy',
|
|
608
|
+
str_operation=str_to_energy_components,
|
|
609
|
+
repeats=False,
|
|
610
|
+
convert=False,
|
|
611
|
+
),
|
|
612
|
+
eigenvalues,
|
|
613
|
+
Quantity(
|
|
614
|
+
'forces',
|
|
615
|
+
rf'{re_n} *Total atomic forces.*?\[eV/Ang\]:\s*([\d\.Ee\-\+\s\|]+)',
|
|
616
|
+
str_operation=str_to_atomic_forces,
|
|
617
|
+
repeats=False,
|
|
618
|
+
convert=False,
|
|
619
|
+
),
|
|
620
|
+
# TODO no metainfo for scf forces but old parser put it in atom_forces_free_raw
|
|
621
|
+
Quantity(
|
|
622
|
+
'forces_raw',
|
|
623
|
+
rf'{re_n} *Total forces\([\s\d]+\)\s*:([\s\d\.\-\+Ee]+){re_n}',
|
|
624
|
+
repeats=True,
|
|
625
|
+
dtype=float,
|
|
626
|
+
),
|
|
627
|
+
Quantity(
|
|
628
|
+
'time_calculation',
|
|
629
|
+
rf'{re_n} *\| Time for this force evaluation\s*:\s*[\d\.]+ s\s*([\d\.]+) s',
|
|
630
|
+
repeats=False,
|
|
631
|
+
dtype=float,
|
|
632
|
+
),
|
|
633
|
+
Quantity(
|
|
634
|
+
'total_dos_files',
|
|
635
|
+
r'Calculating total density of states([\s\S]+?)\-{5}',
|
|
636
|
+
str_operation=str_to_dos_files,
|
|
637
|
+
repeats=False,
|
|
638
|
+
convert=False,
|
|
639
|
+
),
|
|
640
|
+
Quantity(
|
|
641
|
+
'atom_projected_dos_files',
|
|
642
|
+
r'Calculating atom\-projected density of states([\s\S]+?)\-{5}',
|
|
643
|
+
str_operation=str_to_dos_files,
|
|
644
|
+
repeats=False,
|
|
645
|
+
convert=False,
|
|
646
|
+
),
|
|
647
|
+
Quantity(
|
|
648
|
+
'species_projected_dos_files',
|
|
649
|
+
r'Calculating angular momentum projected density of states([\s\S]+?)\-{5}',
|
|
650
|
+
str_operation=str_to_dos_files,
|
|
651
|
+
repeats=False,
|
|
652
|
+
convert=False,
|
|
653
|
+
),
|
|
654
|
+
Quantity(
|
|
655
|
+
'vdW_TS',
|
|
656
|
+
rf'(Evaluating non\-empirical van der Waals correction[\s\S]+?)(?:\|\s*Converged\.|\-{5}{re_n}{re_n})',
|
|
657
|
+
repeats=False,
|
|
658
|
+
sub_parser=TextParser(
|
|
659
|
+
quantities=[
|
|
660
|
+
Quantity(
|
|
661
|
+
'kind',
|
|
662
|
+
r'Evaluating non\-empirical van der Waals correction \(([\w /]+)\)',
|
|
663
|
+
repeats=False,
|
|
664
|
+
convert=False,
|
|
665
|
+
flatten=False,
|
|
666
|
+
),
|
|
667
|
+
Quantity(
|
|
668
|
+
'atom_hirshfeld',
|
|
669
|
+
r'\| Atom\s*\d+:([\s\S]+?)\-{5}',
|
|
670
|
+
str_operation=str_to_hirshfeld,
|
|
671
|
+
repeats=True,
|
|
672
|
+
convert=False,
|
|
673
|
+
),
|
|
674
|
+
]
|
|
675
|
+
),
|
|
676
|
+
),
|
|
677
|
+
Quantity(
|
|
678
|
+
'converged',
|
|
679
|
+
r'Self\-consistency cycle (converged)\.',
|
|
680
|
+
repeats=False,
|
|
681
|
+
dtype=str,
|
|
682
|
+
),
|
|
683
|
+
date_time,
|
|
684
|
+
]
|
|
685
|
+
|
|
686
|
+
molecular_dynamics_quantities = [
|
|
687
|
+
Quantity(
|
|
688
|
+
'md_run',
|
|
689
|
+
r' *Running\s*Born-Oppenheimer\s*molecular\s*dynamics\s*in\s*([A-Z]{3})\s*ensemble*\D*\s*with\s*([A-Za-z\-]*)\s*thermostat',
|
|
690
|
+
repeats=False,
|
|
691
|
+
convert=False,
|
|
692
|
+
),
|
|
693
|
+
Quantity(
|
|
694
|
+
'md_timestep',
|
|
695
|
+
rf'{re_n} *Molecular dynamics time step\s*=\s*({re_float} [A-Za-z]*)\s*{re_n}',
|
|
696
|
+
str_operation=str_to_quantity,
|
|
697
|
+
repeats=False,
|
|
698
|
+
convert=False,
|
|
699
|
+
),
|
|
700
|
+
Quantity(
|
|
701
|
+
'md_simulation_time',
|
|
702
|
+
rf'{re_n} *\| *simulation time\s*=\s*({re_float} [A-Za-z]*)\s*{re_n}',
|
|
703
|
+
str_operation=str_to_quantity,
|
|
704
|
+
repeats=False,
|
|
705
|
+
convert=False,
|
|
706
|
+
),
|
|
707
|
+
Quantity(
|
|
708
|
+
'md_temperature',
|
|
709
|
+
rf'{re_n} *\| *at temperature\s*=\s*({re_float} [A-Za-z]*)\s*{re_n}',
|
|
710
|
+
str_operation=str_to_quantity,
|
|
711
|
+
repeats=False,
|
|
712
|
+
convert=False,
|
|
713
|
+
),
|
|
714
|
+
Quantity(
|
|
715
|
+
'md_thermostat_mass',
|
|
716
|
+
rf'{re_n} *\| *thermostat effective mass\s*=\s*({re_float})\s*{re_n}',
|
|
717
|
+
str_operation=str_to_quantity,
|
|
718
|
+
repeats=False,
|
|
719
|
+
convert=False,
|
|
720
|
+
),
|
|
721
|
+
Quantity(
|
|
722
|
+
'md_thermostat_units',
|
|
723
|
+
rf'Thermostat\s*units\s*for\s*molecular\s*dynamics\s*:\s*([A-Za-z\^\-0-9]*)',
|
|
724
|
+
str_operation=str_to_ureg,
|
|
725
|
+
repeats=False,
|
|
726
|
+
convert=False,
|
|
727
|
+
),
|
|
728
|
+
Quantity(
|
|
729
|
+
'md_calculation_info',
|
|
730
|
+
rf'{re_n} *Advancing structure using Born-Oppenheimer Molecular Dynamics:\s*{re_n}'
|
|
731
|
+
rf' *Complete information for previous time-step:'
|
|
732
|
+
rf'([\s\S]+?)((?:{re_n}{re_n}|\| Nose-Hoover Hamiltonian\s*:\s*[Ee\d\.\-\+]+ eV))',
|
|
733
|
+
str_operation=str_to_md_calculation_info,
|
|
734
|
+
repeats=False,
|
|
735
|
+
convert=False,
|
|
736
|
+
),
|
|
737
|
+
Quantity(
|
|
738
|
+
'md_system_info',
|
|
739
|
+
rf'Atomic structure.*as used in the preceding time step:\s*{re_n}'
|
|
740
|
+
rf'([\s\S]+?)((?:{re_n}{re_n}|\s*Begin self-consistency loop))',
|
|
741
|
+
repeats=False,
|
|
742
|
+
convert=False,
|
|
743
|
+
sub_parser=TextParser(
|
|
744
|
+
quantities=[
|
|
745
|
+
Quantity(
|
|
746
|
+
'positions',
|
|
747
|
+
rf'atom +({re_float})\s+({re_float})\s+({re_float})',
|
|
748
|
+
dtype=np.dtype(np.float64),
|
|
749
|
+
repeats=True,
|
|
750
|
+
),
|
|
751
|
+
Quantity(
|
|
752
|
+
'velocities',
|
|
753
|
+
rf'velocity\s+({re_float})\s+({re_float})\s+({re_float})',
|
|
754
|
+
dtype=np.dtype(np.float64),
|
|
755
|
+
repeats=True,
|
|
756
|
+
),
|
|
757
|
+
]
|
|
758
|
+
),
|
|
759
|
+
),
|
|
760
|
+
]
|
|
761
|
+
|
|
762
|
+
tail = '|'.join(
|
|
763
|
+
[
|
|
764
|
+
r'Time for this force evaluation\s*:\s*[s \d\.]+',
|
|
765
|
+
r'Final output of selected total energy values',
|
|
766
|
+
r'No geometry change',
|
|
767
|
+
r'Leaving FHI\-aims',
|
|
768
|
+
r'\Z',
|
|
769
|
+
]
|
|
770
|
+
)
|
|
771
|
+
|
|
772
|
+
self._quantities = [
|
|
773
|
+
Quantity(
|
|
774
|
+
Program.version,
|
|
775
|
+
r'(?:Version|FHI\-aims version)\s*\:*\s*([\d\.]+)\s*',
|
|
776
|
+
repeats=False,
|
|
777
|
+
),
|
|
778
|
+
Quantity(
|
|
779
|
+
xsection_run.x_fhi_aims_program_compilation_date,
|
|
780
|
+
r'Compiled on ([\d\/]+)',
|
|
781
|
+
repeats=False,
|
|
782
|
+
),
|
|
783
|
+
Quantity(
|
|
784
|
+
xsection_run.x_fhi_aims_program_compilation_time,
|
|
785
|
+
r'at (\d+\:\d+\:\d+)',
|
|
786
|
+
repeats=False,
|
|
787
|
+
),
|
|
788
|
+
Quantity(Program.compilation_host, r'on host ([\w\.\-]+)', repeats=False),
|
|
789
|
+
date_time,
|
|
790
|
+
Quantity(
|
|
791
|
+
TimeRun.cpu1_start,
|
|
792
|
+
r'Time zero on CPU 1\s*:\s*([0-9\-E\.]+)\s*(?P<__unit>\w+)\.',
|
|
793
|
+
repeats=False,
|
|
794
|
+
dtype=float,
|
|
795
|
+
),
|
|
796
|
+
Quantity(
|
|
797
|
+
TimeRun.wall_start,
|
|
798
|
+
r'Internal wall clock time zero\s*:\s*([0-9\-E\.]+)\s*(?P<__unit>\w+)\.',
|
|
799
|
+
repeats=False,
|
|
800
|
+
dtype=float,
|
|
801
|
+
),
|
|
802
|
+
Quantity(Run.raw_id, r'aims_uuid\s*:\s*([\w\-]+)', repeats=False),
|
|
803
|
+
Quantity(
|
|
804
|
+
xsection_run.x_fhi_aims_number_of_tasks,
|
|
805
|
+
r'Using\s*(\d+)\s*parallel tasks',
|
|
806
|
+
repeats=False,
|
|
807
|
+
),
|
|
808
|
+
Quantity(
|
|
809
|
+
x_fhi_aims_section_parallel_task_assignement.x_fhi_aims_parallel_task_nr,
|
|
810
|
+
r'Task\s*(\d+)\s*on host',
|
|
811
|
+
repeats=True,
|
|
812
|
+
),
|
|
813
|
+
Quantity(
|
|
814
|
+
x_fhi_aims_section_parallel_task_assignement.x_fhi_aims_parallel_task_host,
|
|
815
|
+
r'Task\s*\d+\s*on host\s*([\s\S]+?)reporting',
|
|
816
|
+
repeats=True,
|
|
817
|
+
flatten=False,
|
|
818
|
+
),
|
|
819
|
+
Quantity(
|
|
820
|
+
'fhi_aims_files',
|
|
821
|
+
r'(?:FHI\-aims file:|Parsing)\s*([\w\/\.]+)',
|
|
822
|
+
repeats=True,
|
|
823
|
+
),
|
|
824
|
+
Quantity(
|
|
825
|
+
'array_size_parameters',
|
|
826
|
+
r'Basic array size parameters:\s*([\|:\s\w\.\/]+:\s*\d+)',
|
|
827
|
+
repeats=False,
|
|
828
|
+
str_operation=str_to_array_size_parameters,
|
|
829
|
+
convert=False,
|
|
830
|
+
),
|
|
831
|
+
Quantity(
|
|
832
|
+
xsection_method.x_fhi_aims_controlInOut_hse_unit,
|
|
833
|
+
r'hse_unit: Unit for the HSE06 hybrid functional screening parameter set to\s*(\w)',
|
|
834
|
+
str_operation=FHIAimsControlParser.str_to_unit,
|
|
835
|
+
repeats=False,
|
|
836
|
+
),
|
|
837
|
+
Quantity(
|
|
838
|
+
xsection_method.x_fhi_aims_controlInOut_hybrid_xc_coeff,
|
|
839
|
+
r'hybrid_xc_coeff: Mixing coefficient for hybrid-functional exact exchange modified to\s*([\d\.]+)',
|
|
840
|
+
repeats=False,
|
|
841
|
+
dtype=float,
|
|
842
|
+
),
|
|
843
|
+
Quantity(
|
|
844
|
+
'k_grid', rf'{re_n} *Found k-point grid:\s*([\d ]+)', repeats=False
|
|
845
|
+
), # taken from tests/data/fhi_aims
|
|
846
|
+
Quantity(
|
|
847
|
+
xsection_run.x_fhi_aims_controlInOut_MD_time_step,
|
|
848
|
+
rf'{re_n} *Molecular dynamics time step\s*=\s*([\d\.]+)\s*(?P<__unit>[\w]+)',
|
|
849
|
+
repeats=False,
|
|
850
|
+
),
|
|
851
|
+
Quantity(
|
|
852
|
+
xsection_method.x_fhi_aims_controlInOut_relativistic,
|
|
853
|
+
rf'{re_n} *Scalar relativistic treatment of kinetic energy:\s*([\w\- ]+)',
|
|
854
|
+
repeats=False,
|
|
855
|
+
),
|
|
856
|
+
Quantity(
|
|
857
|
+
xsection_method.x_fhi_aims_controlInOut_relativistic,
|
|
858
|
+
rf'{re_n} *(Non-relativistic) treatment of kinetic energy',
|
|
859
|
+
repeats=False,
|
|
860
|
+
),
|
|
861
|
+
Quantity(
|
|
862
|
+
xsection_method.x_fhi_aims_controlInOut_relativistic_threshold,
|
|
863
|
+
rf'{re_n} *Threshold value for ZORA:\s*([\d\.Ee\-\+])',
|
|
864
|
+
repeats=False,
|
|
865
|
+
),
|
|
866
|
+
Quantity(
|
|
867
|
+
xsection_method.x_fhi_aims_controlInOut_xc,
|
|
868
|
+
rf'{re_n} *XC:\s*(?:Using)*\s*([\w\- ]+) with OMEGA =\s*([\d\.Ee\-\+]+)',
|
|
869
|
+
repeats=False,
|
|
870
|
+
dtype=None,
|
|
871
|
+
),
|
|
872
|
+
Quantity(
|
|
873
|
+
'petukhov',
|
|
874
|
+
rf'{re_n} *Fixing petukhov mixing factor to\s+(\d?\.[\d]+)',
|
|
875
|
+
repeats=False,
|
|
876
|
+
dtype=np.dtype(np.float64),
|
|
877
|
+
),
|
|
878
|
+
Quantity(
|
|
879
|
+
xsection_method.x_fhi_aims_controlInOut_xc,
|
|
880
|
+
r'XC: (?:Running|Using) ([\-\w \(\) ]+)',
|
|
881
|
+
repeats=False,
|
|
882
|
+
),
|
|
883
|
+
Quantity(
|
|
884
|
+
xsection_method.x_fhi_aims_controlInOut_xc,
|
|
885
|
+
rf'{re_n} *(Hartree-Fock) calculation starts \.\.\.',
|
|
886
|
+
repeats=False,
|
|
887
|
+
),
|
|
888
|
+
Quantity(
|
|
889
|
+
'band_segment_points',
|
|
890
|
+
r'Plot band\s*\d+\s*\|\s*begin[ \d\.\-]+\s*\|\s*end[ \d\.\-]+\s*\|\s*number of points:\s*(\d+)',
|
|
891
|
+
repeats=True,
|
|
892
|
+
),
|
|
893
|
+
Quantity(
|
|
894
|
+
'species',
|
|
895
|
+
rf'(Reading configuration options for species [\s\S]+?)(?:{re_n} *Finished|{re_n} *{re_n})',
|
|
896
|
+
str_operation=str_to_species_in,
|
|
897
|
+
repeats=False,
|
|
898
|
+
),
|
|
899
|
+
Quantity(
|
|
900
|
+
'control_inout',
|
|
901
|
+
rf'{re_n} *Reading file control\.in\.\s*\-*\s*([\s\S]+?)'
|
|
902
|
+
r'(?:Finished reading input file \'control\.in\'|Input file control\.in ends\.)',
|
|
903
|
+
repeats=False,
|
|
904
|
+
sub_parser=TextParser(
|
|
905
|
+
quantities=[
|
|
906
|
+
Quantity(
|
|
907
|
+
'species',
|
|
908
|
+
r'Reading configuration options for (species[\s\S]+?)grid points\.',
|
|
909
|
+
repeats=True,
|
|
910
|
+
str_operation=str_to_species,
|
|
911
|
+
),
|
|
912
|
+
*molecular_dynamics_quantities,
|
|
913
|
+
]
|
|
914
|
+
),
|
|
915
|
+
),
|
|
916
|
+
Quantity(
|
|
917
|
+
'control_in_verbatim',
|
|
918
|
+
rf'{re_n} *Parsing control\.in([\S\s]*)Completed first pass over input file control\.in',
|
|
919
|
+
repeats=False,
|
|
920
|
+
sub_parser=TextParser(
|
|
921
|
+
quantities=[
|
|
922
|
+
Quantity(
|
|
923
|
+
'md_controlin',
|
|
924
|
+
rf' *([\_a-zA-Z\d\-]*MD[\_a-zA-Z\d\-]*)\s+([a-zA-Z\d\.\-\_\^]+.*){re_n}',
|
|
925
|
+
str_operation=str_to_md_control_in,
|
|
926
|
+
repeats=True,
|
|
927
|
+
convert=False,
|
|
928
|
+
)
|
|
929
|
+
]
|
|
930
|
+
),
|
|
931
|
+
),
|
|
932
|
+
# GW input quantities
|
|
933
|
+
Quantity('gw_flag', self._re_gw_flag, repeats=False),
|
|
934
|
+
Quantity('anacon_type', rf'{re_n}\s*anacon_type\s*(\d+)', repeats=False),
|
|
935
|
+
Quantity(
|
|
936
|
+
'gw_analytical_continuation',
|
|
937
|
+
rf'{re_n} (?:Using)*\s*([\w\-\s]+) for analytical continuation',
|
|
938
|
+
repeats=False,
|
|
939
|
+
flatten=True,
|
|
940
|
+
str_operation=lambda x: [
|
|
941
|
+
y.lower() for v in x.split(' ') for y in v.split('-')
|
|
942
|
+
],
|
|
943
|
+
),
|
|
944
|
+
Quantity('k_grid', rf'{re_n} *k\_grid\s*([\d ]+)', repeats=False),
|
|
945
|
+
Quantity(
|
|
946
|
+
'freq_grid_type',
|
|
947
|
+
rf'{re_n}\s*Initialising([\w\-\s]+)time and frequency grids',
|
|
948
|
+
repeats=False,
|
|
949
|
+
),
|
|
950
|
+
Quantity(
|
|
951
|
+
'n_freq',
|
|
952
|
+
rf'{re_n}\s*frequency_points\s*(\d+)',
|
|
953
|
+
repeats=False,
|
|
954
|
+
dtype=int,
|
|
955
|
+
),
|
|
956
|
+
Quantity(
|
|
957
|
+
'frequency_data',
|
|
958
|
+
r'\s*\|*\s*i_freq\s*([\d*\s*.+eE\-\+]+)',
|
|
959
|
+
repeats=True,
|
|
960
|
+
str_operation=str_to_frequency,
|
|
961
|
+
),
|
|
962
|
+
Quantity(
|
|
963
|
+
'frozen_core',
|
|
964
|
+
rf'{re_n}\s*frozen_core_scf\s*(\d+)',
|
|
965
|
+
repeats=False,
|
|
966
|
+
dtype=int,
|
|
967
|
+
),
|
|
968
|
+
Quantity(
|
|
969
|
+
'n_states_gw',
|
|
970
|
+
r'\|\s*Number of Kohn-Sham states \(occupied \+ empty\)\s*\:\s*(\d+)',
|
|
971
|
+
repeats=False,
|
|
972
|
+
),
|
|
973
|
+
Quantity(
|
|
974
|
+
'gw_self_consistency',
|
|
975
|
+
r'GW Total Energy Calculation([\s\S]+?)\-{5}',
|
|
976
|
+
repeats=True,
|
|
977
|
+
str_operation=str_to_gw_scf,
|
|
978
|
+
convert=False,
|
|
979
|
+
),
|
|
980
|
+
Quantity(
|
|
981
|
+
'gw_eigenvalues',
|
|
982
|
+
r'(state\s*occ_num\s*e_gs[\s\S]+?)\s*\| Total time',
|
|
983
|
+
str_operation=str_to_gw_eigs,
|
|
984
|
+
repeats=False,
|
|
985
|
+
convert=False,
|
|
986
|
+
),
|
|
987
|
+
# assign the initial geometry to full scf as no change in structure is done
|
|
988
|
+
# during the initial scf step
|
|
989
|
+
Quantity(
|
|
990
|
+
'lattice_vectors',
|
|
991
|
+
r'Input geometry:\s*\|\s*Unit cell:\s*'
|
|
992
|
+
r'\s*\|\s*([\d\.\-\+eE\s]+)\s*\|\s*([\d\.\-\+eE\s]+)\s*\|\s*([\d\.\-\+eE\s]+)',
|
|
993
|
+
repeats=False,
|
|
994
|
+
unit='angstrom',
|
|
995
|
+
shape=(3, 3),
|
|
996
|
+
dtype=float,
|
|
997
|
+
),
|
|
998
|
+
Quantity(
|
|
999
|
+
'structure',
|
|
1000
|
+
rf'Atomic structure(.|\n)*\| *Atom *x \[A\] *y \[A\] *z \[A\]([\s\S]+?Species[\s\S]+?(?:{re_n} *{re_n}| 1\: ))',
|
|
1001
|
+
repeats=False,
|
|
1002
|
+
convert=False,
|
|
1003
|
+
sub_parser=TextParser(quantities=structure_quantities),
|
|
1004
|
+
),
|
|
1005
|
+
Quantity(
|
|
1006
|
+
'lattice_vectors_reciprocal',
|
|
1007
|
+
r'Quantities derived from the lattice vectors:\s*'
|
|
1008
|
+
r'\s*\|\s*Reciprocal lattice vector \d:([\d\.\-\+eE\s]+)\s*\|\s*Reciprocal lattice vector \d:([\d\.\-\+eE\s]+)\s*\|\s*Reciprocal lattice vector \d:([\d\.\-\+eE\s]+)',
|
|
1009
|
+
repeats=False,
|
|
1010
|
+
unit='1/angstrom',
|
|
1011
|
+
shape=(3, 3),
|
|
1012
|
+
dtype=float,
|
|
1013
|
+
),
|
|
1014
|
+
Quantity(
|
|
1015
|
+
'full_scf',
|
|
1016
|
+
r'Begin self-consistency loop: Initialization' rf'([\s\S]+?(?:{tail}))',
|
|
1017
|
+
repeats=True,
|
|
1018
|
+
sub_parser=TextParser(quantities=calculation_quantities),
|
|
1019
|
+
),
|
|
1020
|
+
Quantity(
|
|
1021
|
+
'geometry_optimization',
|
|
1022
|
+
rf'{re_n} *Geometry optimization: Attempting to predict improved coordinates\.'
|
|
1023
|
+
rf'([\s\S]+?(?:{tail}))',
|
|
1024
|
+
repeats=True,
|
|
1025
|
+
sub_parser=TextParser(quantities=calculation_quantities),
|
|
1026
|
+
),
|
|
1027
|
+
Quantity(
|
|
1028
|
+
'molecular_dynamics',
|
|
1029
|
+
rf'{re_n} *Molecular dynamics: Attempting to update all nuclear coordinates\.'
|
|
1030
|
+
rf'([\s\S]+?(?:{tail}))',
|
|
1031
|
+
repeats=True,
|
|
1032
|
+
sub_parser=TextParser(
|
|
1033
|
+
quantities=[*calculation_quantities, *molecular_dynamics_quantities]
|
|
1034
|
+
),
|
|
1035
|
+
),
|
|
1036
|
+
Quantity(
|
|
1037
|
+
'timing',
|
|
1038
|
+
r'(Date.+\s+Computational steps[\s\S]+?\Z)',
|
|
1039
|
+
sub_parser=TextParser(
|
|
1040
|
+
quantities=[
|
|
1041
|
+
date_time,
|
|
1042
|
+
Quantity(
|
|
1043
|
+
'total_time',
|
|
1044
|
+
r'\| Total time +: +[\d\.]+ s +([\d\.]+) s',
|
|
1045
|
+
dtype=np.float64,
|
|
1046
|
+
),
|
|
1047
|
+
]
|
|
1048
|
+
),
|
|
1049
|
+
),
|
|
1050
|
+
]
|
|
1051
|
+
# TODO add SOC perturbed eigs, dielectric function
|
|
1052
|
+
|
|
1053
|
+
def get_number_of_spin_channels(self):
|
|
1054
|
+
return self.get('array_size_parameters', {}).get('Number of spin channels', 1)
|
|
1055
|
+
|
|
1056
|
+
|
|
1057
|
+
class FHIAimsParser(BeyondDFTWorkflowsParser):
|
|
1058
|
+
def __init__(self):
|
|
1059
|
+
self.out_parser = FHIAimsOutParser()
|
|
1060
|
+
self.control_parser = FHIAimsControlParser()
|
|
1061
|
+
self.dos_parser = DataTextParser()
|
|
1062
|
+
self.bandstructure_parser = DataTextParser()
|
|
1063
|
+
self.logger = get_logger(__name__)
|
|
1064
|
+
self._calculation_type = 'dft'
|
|
1065
|
+
self._child_archives = {}
|
|
1066
|
+
|
|
1067
|
+
self._xc_map = {
|
|
1068
|
+
'Perdew-Wang parametrisation of Ceperley-Alder LDA': [
|
|
1069
|
+
{'name': 'LDA_C_PW'},
|
|
1070
|
+
{'name': 'LDA_X'},
|
|
1071
|
+
],
|
|
1072
|
+
'Perdew-Zunger parametrisation of Ceperley-Alder LDA': [
|
|
1073
|
+
{'name': 'LDA_C_PZ'},
|
|
1074
|
+
{'name': 'LDA_X'},
|
|
1075
|
+
],
|
|
1076
|
+
'VWN-LDA parametrisation of VWN5 form': [
|
|
1077
|
+
{'name': 'LDA_C_VWN'},
|
|
1078
|
+
{'name': 'LDA_X'},
|
|
1079
|
+
],
|
|
1080
|
+
'VWN-LDA parametrisation of VWN-RPA form': [
|
|
1081
|
+
{'name': 'LDA_C_VWN_RPA'},
|
|
1082
|
+
{'name': 'LDA_X'},
|
|
1083
|
+
],
|
|
1084
|
+
'AM05 gradient-corrected functionals': [
|
|
1085
|
+
{'name': 'GGA_C_AM05'},
|
|
1086
|
+
{'name': 'GGA_X_AM05'},
|
|
1087
|
+
],
|
|
1088
|
+
'BLYP functional': [{'name': 'GGA_C_LYP'}, {'name': 'GGA_X_B88'}],
|
|
1089
|
+
'PBE gradient-corrected functionals': [
|
|
1090
|
+
{'name': 'GGA_C_PBE'},
|
|
1091
|
+
{'name': 'GGA_X_PBE'},
|
|
1092
|
+
],
|
|
1093
|
+
'PBEint gradient-corrected functional': [
|
|
1094
|
+
{'name': 'GGA_C_PBEINT'},
|
|
1095
|
+
{'name': 'GGA_X_PBEINT'},
|
|
1096
|
+
],
|
|
1097
|
+
'PBEsol gradient-corrected functionals': [
|
|
1098
|
+
{'name': 'GGA_C_PBE_SOL'},
|
|
1099
|
+
{'name': 'GGA_X_PBE_SOL'},
|
|
1100
|
+
],
|
|
1101
|
+
'RPBE gradient-corrected functionals': [
|
|
1102
|
+
{'name': 'GGA_C_PBE'},
|
|
1103
|
+
{'name': 'GGA_X_RPBE'},
|
|
1104
|
+
],
|
|
1105
|
+
'revPBE gradient-corrected functionals': [
|
|
1106
|
+
{'name': 'GGA_C_PBE'},
|
|
1107
|
+
{'name': 'GGA_X_PBE_R'},
|
|
1108
|
+
],
|
|
1109
|
+
'PW91 gradient-corrected functionals': [
|
|
1110
|
+
{'name': 'GGA_C_PW91'},
|
|
1111
|
+
{'name': 'GGA_X_PW91'},
|
|
1112
|
+
],
|
|
1113
|
+
'M06-L gradient-corrected functionals': [
|
|
1114
|
+
{'name': 'MGGA_C_M06_L'},
|
|
1115
|
+
{'name': 'MGGA_X_M06_L'},
|
|
1116
|
+
],
|
|
1117
|
+
'M11-L gradient-corrected functionals': [
|
|
1118
|
+
{'name': 'MGGA_C_M11_L'},
|
|
1119
|
+
{'name': 'MGGA_X_M11_L'},
|
|
1120
|
+
],
|
|
1121
|
+
'TPSS gradient-corrected functionals': [
|
|
1122
|
+
{'name': 'MGGA_C_TPSS'},
|
|
1123
|
+
{'name': 'MGGA_X_TPSS'},
|
|
1124
|
+
],
|
|
1125
|
+
'TPSSloc gradient-corrected functionals': [
|
|
1126
|
+
{'name': 'MGGA_C_TPSSLOC'},
|
|
1127
|
+
{'name': 'MGGA_X_TPSS'},
|
|
1128
|
+
],
|
|
1129
|
+
'hybrid B3LYP functional': [{'name': 'HYB_GGA_XC_B3LYP5'}],
|
|
1130
|
+
'Hartree-Fock': [{'name': 'HF_X'}],
|
|
1131
|
+
'HSE': [{'name': 'HYB_GGA_XC_HSE03'}],
|
|
1132
|
+
'HSE-functional': [{'name': 'HYB_GGA_XC_HSE06'}],
|
|
1133
|
+
'hybrid-PBE0 functionals': [
|
|
1134
|
+
{'name': 'GGA_C_PBE'},
|
|
1135
|
+
{
|
|
1136
|
+
'name': 'GGA_X_PBE',
|
|
1137
|
+
'weight': lambda x: 0.75 if x is None else 1.0 - x,
|
|
1138
|
+
},
|
|
1139
|
+
{'name': 'HF_X', 'weight': lambda x: 0.25 if x is None else x},
|
|
1140
|
+
],
|
|
1141
|
+
'hybrid-PBEsol0 functionals': [
|
|
1142
|
+
{'name': 'GGA_C_PBE_SOL'},
|
|
1143
|
+
{
|
|
1144
|
+
'name': 'GGA_X_PBE_SOL',
|
|
1145
|
+
'weight': lambda x: 0.75 if x is None else 1.0 - x,
|
|
1146
|
+
},
|
|
1147
|
+
{'name': 'HF_X', 'weight': lambda x: 0.25 if x is None else x},
|
|
1148
|
+
],
|
|
1149
|
+
'Hybrid M06 gradient-corrected functionals': [
|
|
1150
|
+
{'name': 'MGGA_C_M06'},
|
|
1151
|
+
{'name': 'HYB_MGGA_X_M06'},
|
|
1152
|
+
],
|
|
1153
|
+
'Hybrid M06-2X gradient-corrected functionals': [
|
|
1154
|
+
{'name': 'MGGA_C_M06_2X'},
|
|
1155
|
+
{'name': 'HYB_MGGA_X_M06'},
|
|
1156
|
+
],
|
|
1157
|
+
'Hybrid M06-HF gradient-corrected functionals': [
|
|
1158
|
+
{'name': 'MGGA_C_M06_HF'},
|
|
1159
|
+
{'name': 'HYB_MGGA_X_M06'},
|
|
1160
|
+
],
|
|
1161
|
+
'Hybrid M08-HX gradient-corrected functionals': [
|
|
1162
|
+
{'name': 'MGGA_C_M08_HX'},
|
|
1163
|
+
{'name': 'HYB_MGGA_X_M08_HX'},
|
|
1164
|
+
],
|
|
1165
|
+
'Hybrid M08-SO gradient-corrected functionals': [
|
|
1166
|
+
{'name': 'MGGA_C_M08_SO'},
|
|
1167
|
+
{'name': 'HYB_MGGA_X_M08_SO'},
|
|
1168
|
+
],
|
|
1169
|
+
'Hybrid M11 gradient-corrected functionals': [
|
|
1170
|
+
{'name': 'MGGA_C_M11'},
|
|
1171
|
+
{'name': 'HYB_MGGA_X_M11'},
|
|
1172
|
+
],
|
|
1173
|
+
}
|
|
1174
|
+
|
|
1175
|
+
# TODO update metainfo to reflect all energy corrections
|
|
1176
|
+
# why section_vdW_TS under x_fhi_aims_section_controlInOut_atom_species?
|
|
1177
|
+
self._energy_map = {
|
|
1178
|
+
'Total energy uncorrected': 'energy_total',
|
|
1179
|
+
'Total energy corrected': 'energy_total_t0',
|
|
1180
|
+
'Electronic free energy': 'energy_free',
|
|
1181
|
+
'X Energy': 'energy_exchange',
|
|
1182
|
+
'C Energy GGA': 'energy_correlation',
|
|
1183
|
+
'Total XC Energy': 'energy_xc',
|
|
1184
|
+
'X Energy LDA': 'x_fhi_aims_energy_X_LDA',
|
|
1185
|
+
'C Energy LDA': 'x_fhi_aims_energy_C_LDA',
|
|
1186
|
+
'Sum of eigenvalues': 'energy_sum_eigenvalues',
|
|
1187
|
+
'XC energy correction': 'energy_correction_xc',
|
|
1188
|
+
'XC potential correction': 'energy_xc_potential',
|
|
1189
|
+
'Free-atom electrostatic energy': 'x_fhi_aims_energy_electrostatic_free_atom',
|
|
1190
|
+
'Hartree energy correction': 'energy_correction_hartree',
|
|
1191
|
+
'vdW energy correction': 'energy_van_der_waals',
|
|
1192
|
+
'Entropy correction': 'energy_correction_entropy',
|
|
1193
|
+
'Total energy': 'energy_total',
|
|
1194
|
+
'Total energy, T -> 0': 'energy_total_t0',
|
|
1195
|
+
'Kinetic energy': 'energy_kinetic_electronic',
|
|
1196
|
+
'Electrostatic energy': 'energy_electrostatic',
|
|
1197
|
+
'error in Hartree potential': 'energy_correction_hartree',
|
|
1198
|
+
'Sum of eigenvalues per atom': 'energy_sum_eigenvalues_per_atom',
|
|
1199
|
+
'Total energy (T->0) per atom': 'energy_total_t0_per_atom',
|
|
1200
|
+
'Electronic free energy per atom': 'energy_free_per_atom',
|
|
1201
|
+
'Hartree-Fock part': 'energy_hartree_fock_x_scaled',
|
|
1202
|
+
# GW
|
|
1203
|
+
'Galitskii-Migdal Total Energy': 'x_fhi_aims_scgw_galitskii_migdal_total_energy',
|
|
1204
|
+
'GW Kinetic Energy': 'x_fhi_aims_scgw_kinetic_energy',
|
|
1205
|
+
'Hartree energy from GW density': 'x_fhi_aims_scgw_hartree_energy_sum_eigenvalues',
|
|
1206
|
+
'GW correlation Energy': 'x_fhi_aims_energy_scgw_correlation_energy',
|
|
1207
|
+
'RPA correlation Energy': 'x_fhi_aims_scgw_rpa_correlation_energy',
|
|
1208
|
+
'Sigle Particle Energy': 'x_fhi_aims_single_particle_energy',
|
|
1209
|
+
'Fit accuracy for G(w)': 'x_fhi_aims_poles_fit_accuracy',
|
|
1210
|
+
# Convergence
|
|
1211
|
+
'Change of total energy': 'energy_change',
|
|
1212
|
+
}
|
|
1213
|
+
|
|
1214
|
+
self._relativity_map = {
|
|
1215
|
+
'Non-relativistic': None,
|
|
1216
|
+
'ZORA': 'scalar_relativistic',
|
|
1217
|
+
'on-site free-atom approximation to ZORA': 'scalar_relativistic_atomic_ZORA',
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1220
|
+
self._property_map = {
|
|
1221
|
+
'atom': 'x_fhi_aims_atom_type_vdW',
|
|
1222
|
+
'Free atom volume': 'x_fhi_aims_free_atom_volume',
|
|
1223
|
+
'Hirshfeld charge': 'x_fhi_aims_hirschfeld_charge',
|
|
1224
|
+
'Hirshfeld volume': 'x_fhi_aims_hirschfeld_volume',
|
|
1225
|
+
}
|
|
1226
|
+
|
|
1227
|
+
self.orbital_lm_map = [
|
|
1228
|
+
's',
|
|
1229
|
+
'p',
|
|
1230
|
+
'd',
|
|
1231
|
+
'f',
|
|
1232
|
+
'g',
|
|
1233
|
+
'h',
|
|
1234
|
+
] # ask devs about 'g' and 'h' orbitals (?)
|
|
1235
|
+
|
|
1236
|
+
self._gw_flag_map = {
|
|
1237
|
+
'gw': 'G0W0',
|
|
1238
|
+
'gw_expt': 'G0W0',
|
|
1239
|
+
'ev_scgw0': 'ev-scGW',
|
|
1240
|
+
'ev_scgw': 'ev-scGW',
|
|
1241
|
+
'scgw': 'scGW',
|
|
1242
|
+
}
|
|
1243
|
+
|
|
1244
|
+
self.gw_analytical_continuation = ['multi_pole', 'pade']
|
|
1245
|
+
|
|
1246
|
+
self._gw_qp_energies_map = {
|
|
1247
|
+
'occ_num': 'occupations',
|
|
1248
|
+
'e_gs': 'value_ks',
|
|
1249
|
+
'e_x^ex': 'value_exchange',
|
|
1250
|
+
'e_xc^gs': 'value_ks_xc',
|
|
1251
|
+
'e_c^nloc': 'value_correlation',
|
|
1252
|
+
'e_qp': 'value_qp',
|
|
1253
|
+
}
|
|
1254
|
+
|
|
1255
|
+
self._md_calculation_map = {
|
|
1256
|
+
'Time step number': 'step',
|
|
1257
|
+
'Simulation time': 'time',
|
|
1258
|
+
'Temperature (nuclei)': 'temperature',
|
|
1259
|
+
}
|
|
1260
|
+
self._md_calculation_energy_map = {
|
|
1261
|
+
'Nuclear kinetic energy': 'kinetic',
|
|
1262
|
+
'Total energy (el.+nuc.)': 'total',
|
|
1263
|
+
}
|
|
1264
|
+
self._md_methods_map = {
|
|
1265
|
+
'Nose-Hoover': 'nose_hoover',
|
|
1266
|
+
'Bussi-Donadio-Parrinello': 'velocity_rescaling',
|
|
1267
|
+
'Andersen': 'andersen',
|
|
1268
|
+
'Andersen stochastic': 'andersen',
|
|
1269
|
+
'Berendsen': 'berendsen',
|
|
1270
|
+
# TODO: Add GLE thermostat
|
|
1271
|
+
}
|
|
1272
|
+
|
|
1273
|
+
self._frame_rate = None
|
|
1274
|
+
# max cumulative number of atoms for all parsed trajectories to calculate sampling rate
|
|
1275
|
+
self._cum_max_atoms = 100000
|
|
1276
|
+
|
|
1277
|
+
# set up the native tier references
|
|
1278
|
+
_native_tier_reference_data_filename = 'native_tier_references.json'
|
|
1279
|
+
_native_tier_reference_data_filepath = os.path.join(
|
|
1280
|
+
os.path.dirname(__file__), _native_tier_reference_data_filename
|
|
1281
|
+
)
|
|
1282
|
+
try:
|
|
1283
|
+
with open(_native_tier_reference_data_filepath) as f:
|
|
1284
|
+
self._native_tier_references = json.load(f)
|
|
1285
|
+
except (FileNotFoundError, json.JSONDecodeError):
|
|
1286
|
+
self._native_tier_references = {}
|
|
1287
|
+
self.logger.warning(
|
|
1288
|
+
"""Native tier references could not be loaded,
|
|
1289
|
+
hence `native_tier` cannot be assigned."""
|
|
1290
|
+
)
|
|
1291
|
+
|
|
1292
|
+
@property
|
|
1293
|
+
def frame_rate(self):
|
|
1294
|
+
if self._frame_rate is None:
|
|
1295
|
+
n_frames = 0
|
|
1296
|
+
for calc_type in [
|
|
1297
|
+
'full_scf',
|
|
1298
|
+
'geometry_optimization',
|
|
1299
|
+
'molecular_dynamics',
|
|
1300
|
+
]:
|
|
1301
|
+
n_frames += len(self.out_parser.get(calc_type, []))
|
|
1302
|
+
n_atoms = len(self.out_parser.get('structure', {}).get('positions', []))
|
|
1303
|
+
if n_atoms == 0 or n_frames == 0:
|
|
1304
|
+
self._frame_rate = 1
|
|
1305
|
+
else:
|
|
1306
|
+
cum_atoms = n_atoms * n_frames
|
|
1307
|
+
self._frame_rate = (
|
|
1308
|
+
1
|
|
1309
|
+
if cum_atoms <= self._cum_max_atoms
|
|
1310
|
+
else cum_atoms // self._cum_max_atoms
|
|
1311
|
+
)
|
|
1312
|
+
return self._frame_rate
|
|
1313
|
+
|
|
1314
|
+
def get_fhiaims_file(self, default):
|
|
1315
|
+
base, *ext = default.split('.')
|
|
1316
|
+
ext = '.'.join(ext)
|
|
1317
|
+
base = base.lower()
|
|
1318
|
+
files = os.listdir(self.maindir)
|
|
1319
|
+
files = [os.path.basename(f) for f in files]
|
|
1320
|
+
files = [
|
|
1321
|
+
os.path.join(self.maindir, f)
|
|
1322
|
+
for f in files
|
|
1323
|
+
if base.lower() in f.lower() and f.endswith(ext)
|
|
1324
|
+
]
|
|
1325
|
+
files.sort()
|
|
1326
|
+
return files
|
|
1327
|
+
|
|
1328
|
+
def parse_bandstructure(self, energy_fermi):
|
|
1329
|
+
sec_run = self.archive.run[-1]
|
|
1330
|
+
|
|
1331
|
+
band_segments_points = self.out_parser.get('band_segment_points')
|
|
1332
|
+
if band_segments_points is None:
|
|
1333
|
+
return
|
|
1334
|
+
|
|
1335
|
+
# band structure, unlike dos is not a property of a section_scc but of the
|
|
1336
|
+
# the whole run. dos output file is contained in a section
|
|
1337
|
+
sec_scc = sec_run.calculation[-1]
|
|
1338
|
+
|
|
1339
|
+
energy_fermi_ev = energy_fermi.to(ureg.electron_volt).magnitude
|
|
1340
|
+
sec_k_band = BandStructure()
|
|
1341
|
+
sec_scc.band_structure_electronic.append(sec_k_band)
|
|
1342
|
+
sec_k_band.energy_fermi = energy_fermi
|
|
1343
|
+
|
|
1344
|
+
nspin = self.out_parser.get_number_of_spin_channels()
|
|
1345
|
+
nbands = None
|
|
1346
|
+
for n in range(len(band_segments_points)):
|
|
1347
|
+
if self._calculation_type == 'dft':
|
|
1348
|
+
bs_files = [
|
|
1349
|
+
os.path.join(
|
|
1350
|
+
self.out_parser.maindir, 'band%d%03d.out' % (s + 1, n + 1)
|
|
1351
|
+
)
|
|
1352
|
+
for s in range(nspin)
|
|
1353
|
+
]
|
|
1354
|
+
elif self._calculation_type == 'gw':
|
|
1355
|
+
bs_files = [
|
|
1356
|
+
os.path.join(
|
|
1357
|
+
self.out_parser.maindir, 'GW_band%d%03d.out' % (s + 1, n + 1)
|
|
1358
|
+
)
|
|
1359
|
+
for s in range(nspin)
|
|
1360
|
+
]
|
|
1361
|
+
else:
|
|
1362
|
+
self.logger.warning(
|
|
1363
|
+
'_calculation_type not found. Only DFT or GW allowed.'
|
|
1364
|
+
)
|
|
1365
|
+
|
|
1366
|
+
data = []
|
|
1367
|
+
for band_file in bs_files:
|
|
1368
|
+
self.bandstructure_parser.mainfile = band_file
|
|
1369
|
+
if self.bandstructure_parser.data is None:
|
|
1370
|
+
break
|
|
1371
|
+
data.append(self.bandstructure_parser.data)
|
|
1372
|
+
|
|
1373
|
+
if len(data) == 0:
|
|
1374
|
+
continue
|
|
1375
|
+
|
|
1376
|
+
data = np.transpose(data)
|
|
1377
|
+
eigs = (np.transpose(data[5::2]) + energy_fermi_ev) * ureg.eV
|
|
1378
|
+
nbands = (
|
|
1379
|
+
np.shape(eigs)[-1]
|
|
1380
|
+
if n == 0
|
|
1381
|
+
else nbands
|
|
1382
|
+
if nbands is not None
|
|
1383
|
+
else np.shape(eigs)[-1]
|
|
1384
|
+
)
|
|
1385
|
+
if nbands != np.shape(eigs)[-1]:
|
|
1386
|
+
self.logger.warning(
|
|
1387
|
+
'Inconsistent number of bands found in bandstructure data.'
|
|
1388
|
+
)
|
|
1389
|
+
continue
|
|
1390
|
+
|
|
1391
|
+
sec_k_band_segment = BandEnergies()
|
|
1392
|
+
sec_k_band.segment.append(sec_k_band_segment)
|
|
1393
|
+
sec_k_band_segment.kpoints = np.transpose(data[1:4])[0]
|
|
1394
|
+
occs = np.transpose(data[4::2])
|
|
1395
|
+
# the band energies stored in the band*.out files have already
|
|
1396
|
+
# been shifted to the fermi energy. This shift is undone so
|
|
1397
|
+
# that the energy scales for for energy_reference_fermi, band
|
|
1398
|
+
# energies and the DOS energies match.
|
|
1399
|
+
sec_k_band_segment.energies = eigs
|
|
1400
|
+
sec_k_band_segment.occupations = occs
|
|
1401
|
+
|
|
1402
|
+
def parse_gw(self):
|
|
1403
|
+
sec_run = self.archive.run[-1]
|
|
1404
|
+
|
|
1405
|
+
# GW method
|
|
1406
|
+
sec_method = Method()
|
|
1407
|
+
sec_run.method.append(sec_method)
|
|
1408
|
+
# GW
|
|
1409
|
+
sec_gw = GW()
|
|
1410
|
+
sec_method.gw = sec_gw
|
|
1411
|
+
sec_gw.type = self._gw_flag_map.get(self.out_parser.get('gw_flag'), None)
|
|
1412
|
+
sec_gw.n_states = self.out_parser.get('n_states_gw')
|
|
1413
|
+
# KMesh
|
|
1414
|
+
if self.out_parser.get('k_grid') is not None:
|
|
1415
|
+
sec_k_mesh = KMesh()
|
|
1416
|
+
sec_method.k_mesh = sec_k_mesh
|
|
1417
|
+
sec_k_mesh.grid = self.out_parser.get('k_grid')
|
|
1418
|
+
# QMesh copied from KMesh
|
|
1419
|
+
sec_gw.m_add_sub_section(GW.q_mesh, sec_k_mesh)
|
|
1420
|
+
# Analytical continuation
|
|
1421
|
+
sec_gw.analytical_continuation = self.gw_analytical_continuation[
|
|
1422
|
+
self.out_parser.get('anacon_type', 1)
|
|
1423
|
+
]
|
|
1424
|
+
# FrequencyMesh
|
|
1425
|
+
frequency_data = self.out_parser.get('frequency_data')
|
|
1426
|
+
freq_points = None
|
|
1427
|
+
if frequency_data:
|
|
1428
|
+
try:
|
|
1429
|
+
freq_points = np.array(frequency_data)[:, 1] * ureg.hartree
|
|
1430
|
+
except Exception:
|
|
1431
|
+
pass
|
|
1432
|
+
freq_grid_type = self.out_parser.get('freq_grid_type', 'Gauss-Legendre')
|
|
1433
|
+
if isinstance(freq_grid_type, list):
|
|
1434
|
+
freq_grid_type = freq_grid_type[-1]
|
|
1435
|
+
elif freq_grid_type == 'logarithmic':
|
|
1436
|
+
freq_grid_type = freq_grid_type.capitalize()
|
|
1437
|
+
sec_freq_mesh = FrequencyMesh(
|
|
1438
|
+
dimensionality=1,
|
|
1439
|
+
sampling_method=freq_grid_type,
|
|
1440
|
+
n_points=self.out_parser.get('n_freq', 100),
|
|
1441
|
+
points=np.reshape(freq_points, (len(freq_points), 1))
|
|
1442
|
+
if freq_points is not None
|
|
1443
|
+
else None,
|
|
1444
|
+
)
|
|
1445
|
+
sec_method.m_add_sub_section(Method.frequency_mesh, sec_freq_mesh)
|
|
1446
|
+
|
|
1447
|
+
# GW calculation
|
|
1448
|
+
sec_scc = Calculation()
|
|
1449
|
+
sec_run.calculation.append(sec_scc)
|
|
1450
|
+
# References
|
|
1451
|
+
sec_energy = Energy()
|
|
1452
|
+
sec_scc.energy = sec_energy
|
|
1453
|
+
for n, section in enumerate(self.out_parser.get('full_scf', [])):
|
|
1454
|
+
# skip frames for large trajectories
|
|
1455
|
+
if (n % self.frame_rate) > 0:
|
|
1456
|
+
continue
|
|
1457
|
+
self.parse_system(section)
|
|
1458
|
+
|
|
1459
|
+
# Fermi level
|
|
1460
|
+
scf_iterations = section.get('self_consistency', [])
|
|
1461
|
+
last_scf_iteration = scf_iterations[len(scf_iterations) - 1]
|
|
1462
|
+
if last_scf_iteration.get('fermi_level') is not None:
|
|
1463
|
+
sec_energy.fermi = last_scf_iteration.get('fermi_level')
|
|
1464
|
+
try:
|
|
1465
|
+
last_scf_iteration.get('fermi_level').units
|
|
1466
|
+
except Exception:
|
|
1467
|
+
self.logger.warning('Erorr setting the Fermi level: no units')
|
|
1468
|
+
sec_scc.method_ref = sec_method
|
|
1469
|
+
if sec_run.system is not None:
|
|
1470
|
+
sec_scc.system_ref = sec_run.system[-1]
|
|
1471
|
+
|
|
1472
|
+
# Parse GW band structure
|
|
1473
|
+
self.parse_bandstructure(sec_energy.fermi)
|
|
1474
|
+
|
|
1475
|
+
# scGW calculation
|
|
1476
|
+
gw_scf_energies = self.out_parser.get('gw_self_consistency', [])
|
|
1477
|
+
gw_eigenvalues = self.out_parser.get('gw_eigenvalues', None)
|
|
1478
|
+
if gw_scf_energies is None and gw_eigenvalues is None:
|
|
1479
|
+
return
|
|
1480
|
+
|
|
1481
|
+
for energies in gw_scf_energies:
|
|
1482
|
+
sec_gw_scf_iteration = ScfIteration()
|
|
1483
|
+
sec_scc.scf_iteration.append(sec_gw_scf_iteration)
|
|
1484
|
+
for key, val in energies.items():
|
|
1485
|
+
metainfo_key = self._energy_map.get(key, None)
|
|
1486
|
+
if metainfo_key is not None:
|
|
1487
|
+
try:
|
|
1488
|
+
setattr(sec_gw_scf_iteration, metainfo_key, val)
|
|
1489
|
+
except Exception:
|
|
1490
|
+
self.logger.warning(
|
|
1491
|
+
'Error setting scGW metainfo.', details={key: metainfo_key}
|
|
1492
|
+
)
|
|
1493
|
+
|
|
1494
|
+
if gw_eigenvalues is not None:
|
|
1495
|
+
sec_eigs_gw = BandEnergies()
|
|
1496
|
+
sec_scc.eigenvalues.append(sec_eigs_gw)
|
|
1497
|
+
for key, name in self._gw_qp_energies_map.items():
|
|
1498
|
+
# TODO verify shape of eigenvalues
|
|
1499
|
+
val = (
|
|
1500
|
+
gw_eigenvalues[key]
|
|
1501
|
+
if key == 'occ_num'
|
|
1502
|
+
else gw_eigenvalues[key] * ureg.eV
|
|
1503
|
+
)
|
|
1504
|
+
setattr(sec_eigs_gw, name, np.reshape(val, (1, 1, len(val))))
|
|
1505
|
+
|
|
1506
|
+
def parse_system(self, section):
|
|
1507
|
+
sec_run = self.archive.run[-1]
|
|
1508
|
+
|
|
1509
|
+
lattice_vectors = section.get(
|
|
1510
|
+
'lattice_vectors', self.out_parser.get('lattice_vectors')
|
|
1511
|
+
)
|
|
1512
|
+
lattice_vectors_reciprocal = section.get(
|
|
1513
|
+
'lattice_vectors_reciprocal',
|
|
1514
|
+
self.out_parser.get('lattice_vectors_reciprocal'),
|
|
1515
|
+
)
|
|
1516
|
+
|
|
1517
|
+
structure = section.get('structure', self.out_parser.get('structure'))
|
|
1518
|
+
pbc = [lattice_vectors is not None] * 3
|
|
1519
|
+
if structure is None:
|
|
1520
|
+
return
|
|
1521
|
+
|
|
1522
|
+
sec_system = System()
|
|
1523
|
+
sec_run.system.append(sec_system)
|
|
1524
|
+
sec_atoms = Atoms()
|
|
1525
|
+
sec_system.atoms = sec_atoms
|
|
1526
|
+
if lattice_vectors is not None:
|
|
1527
|
+
sec_atoms.lattice_vectors = lattice_vectors
|
|
1528
|
+
if lattice_vectors_reciprocal is not None:
|
|
1529
|
+
sec_atoms.lattice_vectors_reciprocal = lattice_vectors_reciprocal
|
|
1530
|
+
|
|
1531
|
+
sec_atoms.periodic = pbc
|
|
1532
|
+
sec_atoms.labels = structure.get('labels')
|
|
1533
|
+
sec_atoms.positions = structure.get('positions') * ureg.angstrom
|
|
1534
|
+
velocities = structure.get('velocities')
|
|
1535
|
+
if velocities is None:
|
|
1536
|
+
molecular_dynamics_system_info = section.get('md_system_info', None)
|
|
1537
|
+
velocities = (
|
|
1538
|
+
molecular_dynamics_system_info._results['velocities']
|
|
1539
|
+
if molecular_dynamics_system_info
|
|
1540
|
+
else None
|
|
1541
|
+
)
|
|
1542
|
+
if velocities is not None:
|
|
1543
|
+
sec_atoms.velocities = velocities * ureg.angstrom / ureg.ps
|
|
1544
|
+
|
|
1545
|
+
def parse_configurations(self):
|
|
1546
|
+
sec_run = self.archive.run[-1]
|
|
1547
|
+
time_initial = sec_run.x_fhi_aims_program_execution_time
|
|
1548
|
+
|
|
1549
|
+
def read_dos(dos_file):
|
|
1550
|
+
dos_file = self.get_fhiaims_file(dos_file)
|
|
1551
|
+
if not dos_file:
|
|
1552
|
+
return
|
|
1553
|
+
self.dos_parser.mainfile = dos_file[0]
|
|
1554
|
+
if self.dos_parser.data is None:
|
|
1555
|
+
return
|
|
1556
|
+
return np.transpose(self.dos_parser.data)
|
|
1557
|
+
|
|
1558
|
+
def parse_dos(section):
|
|
1559
|
+
version_normalization_cutoff = 71914.7
|
|
1560
|
+
version_normalization = 0.5
|
|
1561
|
+
|
|
1562
|
+
sec_scc = sec_run.calculation[-1]
|
|
1563
|
+
energies = None
|
|
1564
|
+
|
|
1565
|
+
n_spin = self.out_parser.get_number_of_spin_channels()
|
|
1566
|
+
# parse total first, we expect only one file
|
|
1567
|
+
total_dos_files, _ = section.get(
|
|
1568
|
+
'total_dos_files', [['KS_DOS_total_raw.dat'], []]
|
|
1569
|
+
)
|
|
1570
|
+
for dos_file in total_dos_files:
|
|
1571
|
+
data = read_dos(dos_file)
|
|
1572
|
+
if data is None or np.size(data) == 0:
|
|
1573
|
+
continue
|
|
1574
|
+
energies = data[0] * ureg.eV
|
|
1575
|
+
# dos unit is 1/(eV-cell volume)
|
|
1576
|
+
dos = data[1 : n_spin + 1] / ureg.eV
|
|
1577
|
+
for spin in range(n_spin):
|
|
1578
|
+
sec_dos = Dos()
|
|
1579
|
+
sec_scc.dos_electronic.append(sec_dos)
|
|
1580
|
+
sec_dos.spin_channel = spin if n_spin == 2 else None
|
|
1581
|
+
sec_dos.n_energies = len(energies)
|
|
1582
|
+
sec_dos.energies = energies
|
|
1583
|
+
sec_dos_total = DosValues()
|
|
1584
|
+
sec_dos.total.append(sec_dos_total)
|
|
1585
|
+
if float(sec_run.program.version) <= version_normalization_cutoff:
|
|
1586
|
+
sec_dos_total.x_fhi_aims_normalization_factor_raw_data = (
|
|
1587
|
+
version_normalization
|
|
1588
|
+
)
|
|
1589
|
+
dos[spin] /= version_normalization
|
|
1590
|
+
sec_dos_total.value = dos[spin]
|
|
1591
|
+
|
|
1592
|
+
# Parse projected
|
|
1593
|
+
# TODO: check if this is the histogram or the integrated one
|
|
1594
|
+
for projection_type in ['atom', 'species']:
|
|
1595
|
+
proj_dos_files, species = section.get(
|
|
1596
|
+
f'{projection_type}_projected_dos_files', [[], []]
|
|
1597
|
+
)
|
|
1598
|
+
for files in proj_dos_files:
|
|
1599
|
+
species_label = next(
|
|
1600
|
+
(label for label in species if label in files), None
|
|
1601
|
+
)
|
|
1602
|
+
|
|
1603
|
+
# Check if data can be read
|
|
1604
|
+
data = read_dos(files)
|
|
1605
|
+
if data is None:
|
|
1606
|
+
continue
|
|
1607
|
+
|
|
1608
|
+
if sec_scc.dos_electronic is not None:
|
|
1609
|
+
sec_dos = (
|
|
1610
|
+
sec_scc.dos_electronic[1]
|
|
1611
|
+
if 'spin_dn' in files
|
|
1612
|
+
else sec_scc.dos_electronic[0]
|
|
1613
|
+
)
|
|
1614
|
+
else:
|
|
1615
|
+
sec_dos = Dos()
|
|
1616
|
+
sec_scc.dos_electronic.append(sec_dos)
|
|
1617
|
+
sec_dos.m_kind = 'integrated'
|
|
1618
|
+
|
|
1619
|
+
# Projected DOS section definition
|
|
1620
|
+
sec_def = (
|
|
1621
|
+
Dos.atom_projected
|
|
1622
|
+
if projection_type == 'atom'
|
|
1623
|
+
else Dos.species_projected
|
|
1624
|
+
)
|
|
1625
|
+
if sec_dos.m_get(sec_def):
|
|
1626
|
+
created_section = False
|
|
1627
|
+
for index, dos_proj in enumerate(sec_dos.m_get(sec_def)):
|
|
1628
|
+
if dos_proj.atom_label == species_label:
|
|
1629
|
+
sec_dos_proj = sec_dos.m_get(sec_def)[index]
|
|
1630
|
+
created_section = True
|
|
1631
|
+
break
|
|
1632
|
+
if not created_section:
|
|
1633
|
+
sec_dos_proj = DosValues()
|
|
1634
|
+
sec_dos.m_add_sub_section(sec_def, sec_dos_proj)
|
|
1635
|
+
else:
|
|
1636
|
+
sec_dos_proj = DosValues()
|
|
1637
|
+
sec_dos.m_add_sub_section(sec_def, sec_dos_proj)
|
|
1638
|
+
sec_dos_proj.atom_label = species_label
|
|
1639
|
+
sec_dos_proj.value = data[1] / ureg.eV
|
|
1640
|
+
# Orbital projections
|
|
1641
|
+
data = data[2:]
|
|
1642
|
+
for lindex, dos_l in enumerate(data):
|
|
1643
|
+
sec_dos_orbital = DosValues()
|
|
1644
|
+
sec_dos.orbital_projected.append(sec_dos_orbital)
|
|
1645
|
+
sec_dos_orbital.atom_label = species_label
|
|
1646
|
+
orbital_label = self.orbital_lm_map[lindex]
|
|
1647
|
+
sec_dos_orbital.orbital = orbital_label
|
|
1648
|
+
sec_dos_orbital.value = dos_l
|
|
1649
|
+
|
|
1650
|
+
def get_eigenvalues(section):
|
|
1651
|
+
data = section.get('eigenvalues', [None])[-1]
|
|
1652
|
+
if data is None:
|
|
1653
|
+
return
|
|
1654
|
+
n_spin = self.out_parser.get_number_of_spin_channels()
|
|
1655
|
+
|
|
1656
|
+
kpts = data.get('kpoints', [np.zeros(3)] * n_spin)
|
|
1657
|
+
if len(kpts) % n_spin != 0:
|
|
1658
|
+
self.logger.warning('Inconsistent number of spin channels found.')
|
|
1659
|
+
n_spin -= 1
|
|
1660
|
+
kpts = np.reshape(kpts, (len(kpts) // n_spin, n_spin, 3))
|
|
1661
|
+
kpts = np.transpose(kpts, axes=(1, 0, 2))[0]
|
|
1662
|
+
kpts = None if len(kpts) == 0 else kpts
|
|
1663
|
+
|
|
1664
|
+
occs_eigs = data.get('occupation_eigenvalue')
|
|
1665
|
+
n_eigs = len(occs_eigs) // (len(kpts) * n_spin)
|
|
1666
|
+
occs_eigs = np.transpose(
|
|
1667
|
+
np.reshape(occs_eigs, (len(kpts), n_spin, n_eigs, 2)), axes=(3, 1, 0, 2)
|
|
1668
|
+
)
|
|
1669
|
+
|
|
1670
|
+
return kpts, occs_eigs[1] * ureg.hartree, occs_eigs[0]
|
|
1671
|
+
|
|
1672
|
+
def parse_scf(iteration):
|
|
1673
|
+
sec_scc = sec_run.calculation[-1]
|
|
1674
|
+
sec_scf = ScfIteration()
|
|
1675
|
+
sec_scc.scf_iteration.append(sec_scf)
|
|
1676
|
+
|
|
1677
|
+
if iteration.get('date_time') is not None:
|
|
1678
|
+
sec_scf.x_fhi_aims_scf_time_start = iteration.date_time * ureg.s
|
|
1679
|
+
if iteration.get('time_calculation') is not None:
|
|
1680
|
+
sec_scf.time_calculation = iteration.time_calculation * ureg.s
|
|
1681
|
+
if (
|
|
1682
|
+
sec_scf.x_fhi_aims_scf_time_start is not None
|
|
1683
|
+
and sec_scf.time_calculation is not None
|
|
1684
|
+
):
|
|
1685
|
+
sec_scf.time_physical = (
|
|
1686
|
+
sec_scf.x_fhi_aims_scf_time_start
|
|
1687
|
+
+ sec_scf.time_calculation
|
|
1688
|
+
- time_initial
|
|
1689
|
+
)
|
|
1690
|
+
|
|
1691
|
+
sec_energy = Energy()
|
|
1692
|
+
sec_scf.energy = sec_energy
|
|
1693
|
+
energies = iteration.get('energy_components', {})
|
|
1694
|
+
convergence = iteration.get('scf_convergence', {})
|
|
1695
|
+
energies.update(convergence)
|
|
1696
|
+
for key, val in energies.items():
|
|
1697
|
+
metainfo_key = self._energy_map.get(key, None)
|
|
1698
|
+
if metainfo_key is not None:
|
|
1699
|
+
if metainfo_key == 'energy_change':
|
|
1700
|
+
sec_energy.change = val
|
|
1701
|
+
elif metainfo_key.startswith(
|
|
1702
|
+
'energy_'
|
|
1703
|
+
) and not metainfo_key.endswith('per_atom'):
|
|
1704
|
+
try:
|
|
1705
|
+
setattr(
|
|
1706
|
+
sec_energy,
|
|
1707
|
+
metainfo_key.replace('energy_', ''),
|
|
1708
|
+
EnergyEntry(
|
|
1709
|
+
value=val,
|
|
1710
|
+
value_per_atom=energies.get(
|
|
1711
|
+
'%s_per_atom' % metainfo_key
|
|
1712
|
+
),
|
|
1713
|
+
),
|
|
1714
|
+
)
|
|
1715
|
+
except Exception:
|
|
1716
|
+
self.logger.warning(
|
|
1717
|
+
'Error setting scf energy metainfo.',
|
|
1718
|
+
details={key: metainfo_key},
|
|
1719
|
+
)
|
|
1720
|
+
else:
|
|
1721
|
+
try:
|
|
1722
|
+
setattr(sec_scf, metainfo_key, val)
|
|
1723
|
+
except Exception:
|
|
1724
|
+
self.logger.warning(
|
|
1725
|
+
'Error setting scf energy metainfo.',
|
|
1726
|
+
details={key: metainfo_key},
|
|
1727
|
+
)
|
|
1728
|
+
|
|
1729
|
+
if iteration.get('fermi_level') is not None:
|
|
1730
|
+
sec_energy.fermi = iteration.get('fermi_level')
|
|
1731
|
+
try:
|
|
1732
|
+
iteration.get('fermi_level').units
|
|
1733
|
+
except Exception:
|
|
1734
|
+
self.logger.warning('Erorr setting the Fermi level: no units')
|
|
1735
|
+
|
|
1736
|
+
# eigenvalues scf iteration
|
|
1737
|
+
eigenvalues = get_eigenvalues(iteration)
|
|
1738
|
+
if eigenvalues is not None:
|
|
1739
|
+
sec_eigenvalues = BandEnergies()
|
|
1740
|
+
sec_scf.eigenvalues.append(sec_eigenvalues)
|
|
1741
|
+
if eigenvalues[0] is not None:
|
|
1742
|
+
sec_eigenvalues.kpoints = eigenvalues[0]
|
|
1743
|
+
sec_eigenvalues.energies = eigenvalues[1]
|
|
1744
|
+
sec_eigenvalues.occupations = eigenvalues[2]
|
|
1745
|
+
|
|
1746
|
+
# stress tensor
|
|
1747
|
+
stress_tensor = iteration.get('stress_tensor')
|
|
1748
|
+
if stress_tensor is not None:
|
|
1749
|
+
sec_stress = Stress()
|
|
1750
|
+
sec_scf.stress = sec_stress
|
|
1751
|
+
value = np.zeros((3, 3))
|
|
1752
|
+
value[0][0] = stress_tensor[0]
|
|
1753
|
+
value[1][1] = stress_tensor[1]
|
|
1754
|
+
value[2][2] = stress_tensor[2]
|
|
1755
|
+
value[0][1] = value[1][0] = stress_tensor[3]
|
|
1756
|
+
value[0][2] = value[2][0] = stress_tensor[4]
|
|
1757
|
+
value[1][2] = value[2][1] = stress_tensor[5]
|
|
1758
|
+
sec_stress.total = StressEntry(value=value)
|
|
1759
|
+
|
|
1760
|
+
# pressure
|
|
1761
|
+
pressure = iteration.get('pressure')
|
|
1762
|
+
if pressure is not None:
|
|
1763
|
+
sec_thermo = Thermodynamics()
|
|
1764
|
+
sec_scf.thermodynamics.append(sec_thermo)
|
|
1765
|
+
sec_thermo.pressure = pressure
|
|
1766
|
+
|
|
1767
|
+
def parse_vdW(section):
|
|
1768
|
+
# these are not actually vdW outputs but vdW control parameters but are
|
|
1769
|
+
# printed within the calculation section.
|
|
1770
|
+
# TODO why is x_fhi_aims_section_vdW_TS under x_fhi_aims_section_controlInOut_atom_species
|
|
1771
|
+
# we would then have to split the vdW parameters by species
|
|
1772
|
+
atoms = section.get('vdW_TS', {}).get('atom_hirshfeld', [])
|
|
1773
|
+
if not atoms:
|
|
1774
|
+
return
|
|
1775
|
+
# get species from section_atom_type
|
|
1776
|
+
sec_atom_type = sec_run.method[-1].atom_parameters
|
|
1777
|
+
if not sec_atom_type:
|
|
1778
|
+
return
|
|
1779
|
+
|
|
1780
|
+
for sec in sec_atom_type:
|
|
1781
|
+
for atom in atoms:
|
|
1782
|
+
if sec.label == atom['atom']:
|
|
1783
|
+
sec_vdW_ts = x_fhi_aims_section_vdW_TS()
|
|
1784
|
+
sec.x_fhi_aims_section_controlInOut_atom_species[
|
|
1785
|
+
-1
|
|
1786
|
+
].x_fhi_aims_section_vdW_TS.append(sec_vdW_ts)
|
|
1787
|
+
for key, val in atom.items():
|
|
1788
|
+
metainfo_name = self._property_map.get(key, None)
|
|
1789
|
+
if metainfo_name is None:
|
|
1790
|
+
continue
|
|
1791
|
+
val = val[0] if len(val) == 1 else val
|
|
1792
|
+
try:
|
|
1793
|
+
setattr(sec_vdW_ts, metainfo_name, val)
|
|
1794
|
+
except Exception:
|
|
1795
|
+
self.logger.warning(
|
|
1796
|
+
'Error setting vdW metainfo.',
|
|
1797
|
+
details={key: metainfo_name},
|
|
1798
|
+
)
|
|
1799
|
+
# TODO add the remanining properties
|
|
1800
|
+
sec_run.method[-1].electronic.van_der_waals_method = 'TS'
|
|
1801
|
+
|
|
1802
|
+
def parse_section(section):
|
|
1803
|
+
self.parse_system(section)
|
|
1804
|
+
|
|
1805
|
+
sec_scc = Calculation()
|
|
1806
|
+
sec_run.calculation.append(sec_scc)
|
|
1807
|
+
sec_scc.system_ref = sec_run.system[-1]
|
|
1808
|
+
sec_scc.method_ref = sec_run.method[-1]
|
|
1809
|
+
|
|
1810
|
+
sec_energy = Energy()
|
|
1811
|
+
sec_scc.energy = sec_energy
|
|
1812
|
+
energy = section.get('energy', {})
|
|
1813
|
+
energy.update(section.get('energy_components', [{}])[-1])
|
|
1814
|
+
energy.update(section.get('energy_xc', {}))
|
|
1815
|
+
for key, val in energy.items():
|
|
1816
|
+
metainfo_key = self._energy_map.get(key, None)
|
|
1817
|
+
if metainfo_key is None:
|
|
1818
|
+
continue
|
|
1819
|
+
elif key == 'vdW energy correction':
|
|
1820
|
+
kind = section.get('vdW_TS', {}).get(
|
|
1821
|
+
'kind', 'Tkatchenko/Scheffler 2009'
|
|
1822
|
+
)
|
|
1823
|
+
sec_energy.van_der_waals = EnergyEntry(value=val, kind=kind)
|
|
1824
|
+
elif metainfo_key.startswith('x_fhi_aims_energy'):
|
|
1825
|
+
setattr(sec_scc, metainfo_key, val)
|
|
1826
|
+
elif metainfo_key.startswith('energy_') and not metainfo_key.endswith(
|
|
1827
|
+
'per_atom'
|
|
1828
|
+
):
|
|
1829
|
+
try:
|
|
1830
|
+
setattr(
|
|
1831
|
+
sec_energy,
|
|
1832
|
+
metainfo_key.replace('energy_', ''),
|
|
1833
|
+
EnergyEntry(
|
|
1834
|
+
value=val,
|
|
1835
|
+
value_per_atom=energy.get('%s_per_atom' % metainfo_key),
|
|
1836
|
+
),
|
|
1837
|
+
)
|
|
1838
|
+
except Exception:
|
|
1839
|
+
self.logger.warning(
|
|
1840
|
+
'Error setting energy metainfo.', details={key: key}
|
|
1841
|
+
)
|
|
1842
|
+
|
|
1843
|
+
# eigenvalues
|
|
1844
|
+
eigenvalues = get_eigenvalues(section)
|
|
1845
|
+
# get if from last scf iteration
|
|
1846
|
+
if eigenvalues is not None:
|
|
1847
|
+
sec_eigenvalues = BandEnergies()
|
|
1848
|
+
sec_scc.eigenvalues.append(sec_eigenvalues)
|
|
1849
|
+
if eigenvalues[0] is not None:
|
|
1850
|
+
sec_eigenvalues.kpoints = eigenvalues[0]
|
|
1851
|
+
sec_eigenvalues.energies = eigenvalues[1]
|
|
1852
|
+
sec_eigenvalues.occupations = eigenvalues[2]
|
|
1853
|
+
|
|
1854
|
+
# TODO add force contributions and stress
|
|
1855
|
+
forces = section.get('forces', None)
|
|
1856
|
+
if forces is not None:
|
|
1857
|
+
sec_forces = Forces()
|
|
1858
|
+
sec_scc.forces = sec_forces
|
|
1859
|
+
sec_forces.free = ForcesEntry(value=forces)
|
|
1860
|
+
|
|
1861
|
+
forces_raw = section.get('forces_raw', None)
|
|
1862
|
+
if forces_raw is not None:
|
|
1863
|
+
# we are actually reading the scf forces so we take only the last iteration
|
|
1864
|
+
try:
|
|
1865
|
+
# TODO This is a temporary fix to a huge md run I cannot test.
|
|
1866
|
+
# see calc_id=a8r8KkvKXWams50UhzMGCxY0IGqH
|
|
1867
|
+
sec_forces.free.value_raw = (
|
|
1868
|
+
forces_raw[-len(forces) :] * ureg.eV / ureg.angstrom
|
|
1869
|
+
)
|
|
1870
|
+
except Exception:
|
|
1871
|
+
self.logger.warning('Error setting raw forces.')
|
|
1872
|
+
|
|
1873
|
+
if section.time_calculation is not None:
|
|
1874
|
+
sec_scc.time_calculation = section.time_calculation * ureg.s
|
|
1875
|
+
if section.date_time is not None:
|
|
1876
|
+
sec_scc.time_physical = (
|
|
1877
|
+
section.date_time * ureg.s
|
|
1878
|
+
+ sec_scc.time_calculation
|
|
1879
|
+
- time_initial
|
|
1880
|
+
)
|
|
1881
|
+
|
|
1882
|
+
scf_iterations = section.get('self_consistency', [])
|
|
1883
|
+
sec_scc.n_scf_iterations = len(scf_iterations)
|
|
1884
|
+
for scf_iteration in scf_iterations:
|
|
1885
|
+
parse_scf(scf_iteration)
|
|
1886
|
+
|
|
1887
|
+
sec_scc.calculation_converged = section.get('converged') == 'converged'
|
|
1888
|
+
# how about geometry optimization convergence
|
|
1889
|
+
|
|
1890
|
+
# density of states
|
|
1891
|
+
parse_dos(section)
|
|
1892
|
+
|
|
1893
|
+
# fermi level
|
|
1894
|
+
fermi_energy = 0.0
|
|
1895
|
+
if scf_iterations:
|
|
1896
|
+
if scf_iterations[-1].get('fermi_level') is not None:
|
|
1897
|
+
fermi_energy = scf_iterations[-1].get('fermi_level')
|
|
1898
|
+
fermi_energy = (
|
|
1899
|
+
fermi_energy.to('joule').magnitude if fermi_energy else 0.0
|
|
1900
|
+
)
|
|
1901
|
+
sec_scc.energy.fermi = fermi_energy
|
|
1902
|
+
|
|
1903
|
+
# vdW parameters
|
|
1904
|
+
parse_vdW(section)
|
|
1905
|
+
|
|
1906
|
+
# step, time, temperature info + additional energies from molecular dynamics
|
|
1907
|
+
md_info = section.get('md_calculation_info', {})
|
|
1908
|
+
sec_scc.x_fhi_aims_calculation_md = {
|
|
1909
|
+
key: str(val.magnitude) + ' ' + str(val.units)
|
|
1910
|
+
if type(val) is ureg.Quantity
|
|
1911
|
+
else str(val)
|
|
1912
|
+
for key, val in md_info.items()
|
|
1913
|
+
}
|
|
1914
|
+
for key, val in md_info.items():
|
|
1915
|
+
if key in self._md_calculation_map:
|
|
1916
|
+
metainfo_key = self._md_calculation_map.get(key, None)
|
|
1917
|
+
if metainfo_key == 'step':
|
|
1918
|
+
val = int(val)
|
|
1919
|
+
if metainfo_key is not None:
|
|
1920
|
+
try:
|
|
1921
|
+
setattr(sec_scc, metainfo_key, val)
|
|
1922
|
+
except Exception:
|
|
1923
|
+
self.logger.warning(
|
|
1924
|
+
'Error setting md calculation metainfo.',
|
|
1925
|
+
details={key: metainfo_key, 'value': val},
|
|
1926
|
+
)
|
|
1927
|
+
elif key in self._md_calculation_energy_map:
|
|
1928
|
+
metainfo_key = self._md_calculation_energy_map.get(key, None)
|
|
1929
|
+
if metainfo_key is not None:
|
|
1930
|
+
try:
|
|
1931
|
+
setattr(sec_energy, metainfo_key, EnergyEntry(value=val))
|
|
1932
|
+
except Exception:
|
|
1933
|
+
self.logger.warning(
|
|
1934
|
+
'Error setting md calculation energy metainfo.',
|
|
1935
|
+
details={key: metainfo_key, 'value': val},
|
|
1936
|
+
)
|
|
1937
|
+
|
|
1938
|
+
# get potential energies
|
|
1939
|
+
total_energy = sec_energy.get('total')
|
|
1940
|
+
kinetic_energy = sec_energy.get('kinetic')
|
|
1941
|
+
if total_energy and kinetic_energy:
|
|
1942
|
+
potential_energy = total_energy.value - kinetic_energy.value
|
|
1943
|
+
try:
|
|
1944
|
+
setattr(
|
|
1945
|
+
sec_energy, 'potential', EnergyEntry(value=potential_energy)
|
|
1946
|
+
)
|
|
1947
|
+
except Exception:
|
|
1948
|
+
self.logger.warning('Error setting potential energy metainfo.')
|
|
1949
|
+
|
|
1950
|
+
for n, section in enumerate(self.out_parser.get('full_scf', [])):
|
|
1951
|
+
# skip frames for large trajectories
|
|
1952
|
+
if (n % self.frame_rate) > 0:
|
|
1953
|
+
continue
|
|
1954
|
+
parse_section(section)
|
|
1955
|
+
|
|
1956
|
+
for n, section in enumerate(self.out_parser.get('geometry_optimization', [])):
|
|
1957
|
+
# skip frames for large trajectories
|
|
1958
|
+
if (n % self.frame_rate) > 0:
|
|
1959
|
+
continue
|
|
1960
|
+
parse_section(section)
|
|
1961
|
+
|
|
1962
|
+
for n, section in enumerate(self.out_parser.get('molecular_dynamics', [])):
|
|
1963
|
+
# skip frames for large trajectories
|
|
1964
|
+
if (n % self.frame_rate) > 0:
|
|
1965
|
+
continue
|
|
1966
|
+
parse_section(section)
|
|
1967
|
+
|
|
1968
|
+
if not sec_run.calculation:
|
|
1969
|
+
return
|
|
1970
|
+
|
|
1971
|
+
sec_scc = sec_run.calculation[-1]
|
|
1972
|
+
timing = self.out_parser.timing
|
|
1973
|
+
if timing is not None:
|
|
1974
|
+
sec_scc.time_physical = timing.total_time
|
|
1975
|
+
if len(sec_run.calculation) > 1 and sec_run.calculation[-2].time_physical:
|
|
1976
|
+
sec_scc.time_calculation = (
|
|
1977
|
+
sec_scc.time_physical - sec_run.calculation[-2].time_physical
|
|
1978
|
+
)
|
|
1979
|
+
|
|
1980
|
+
# bandstructure
|
|
1981
|
+
fermi_energy = sec_scc.energy.fermi
|
|
1982
|
+
self.parse_bandstructure(fermi_energy)
|
|
1983
|
+
|
|
1984
|
+
def parse_workflow(self):
|
|
1985
|
+
workflow = SinglePoint()
|
|
1986
|
+
if self.out_parser.get('geometry_optimization') is not None:
|
|
1987
|
+
workflow = GeometryOptimization()
|
|
1988
|
+
elif self.out_parser.get('molecular_dynamics', None) is not None:
|
|
1989
|
+
workflow = MolecularDynamics(
|
|
1990
|
+
method=MolecularDynamicsMethod(), results=MolecularDynamicsResults()
|
|
1991
|
+
)
|
|
1992
|
+
|
|
1993
|
+
control_in_md = self.out_parser.get('control_in_verbatim').get(
|
|
1994
|
+
'md_controlin'
|
|
1995
|
+
)
|
|
1996
|
+
if control_in_md:
|
|
1997
|
+
workflow.method.x_fhi_aims_controlIn_md = {}
|
|
1998
|
+
for input_param in control_in_md:
|
|
1999
|
+
for key, val in input_param.items():
|
|
2000
|
+
workflow.method.x_fhi_aims_controlIn_md[key] = val
|
|
2001
|
+
control_inout = self.out_parser.get('control_inout')
|
|
2002
|
+
if control_inout:
|
|
2003
|
+
md_run = control_inout.get('md_run')
|
|
2004
|
+
workflow.method.integration_timestep = control_inout.get('md_timestep')
|
|
2005
|
+
|
|
2006
|
+
sec_thermostat_parameters = ThermostatParameters()
|
|
2007
|
+
workflow.method.thermostat_parameters.append(sec_thermostat_parameters)
|
|
2008
|
+
if md_run:
|
|
2009
|
+
workflow.method.thermodynamic_ensemble = md_run[0]
|
|
2010
|
+
sec_thermostat_parameters.thermostat_type = (
|
|
2011
|
+
self._md_methods_map.get(md_run[1])
|
|
2012
|
+
)
|
|
2013
|
+
simulation_time = control_inout.get('md_simulation_time')
|
|
2014
|
+
if (simulation_time is not None) and (
|
|
2015
|
+
workflow.method.integration_timestep is not None
|
|
2016
|
+
):
|
|
2017
|
+
n_steps = (
|
|
2018
|
+
simulation_time.to(ureg.picosecond)
|
|
2019
|
+
/ workflow.method.integration_timestep.to(ureg.picosecond)
|
|
2020
|
+
).magnitude
|
|
2021
|
+
workflow.method.n_steps = int(n_steps)
|
|
2022
|
+
sec_thermostat_parameters.reference_temperature = control_inout.get(
|
|
2023
|
+
'md_temperature'
|
|
2024
|
+
)
|
|
2025
|
+
thermostat_mass = control_inout.get('md_thermostat_mass')
|
|
2026
|
+
if type(thermostat_mass != ureg.Quantity):
|
|
2027
|
+
thermostat_mass_unit = control_inout.get('md_thermostat_units')
|
|
2028
|
+
sec_thermostat_parameters.coupling_constant = (
|
|
2029
|
+
1.0
|
|
2030
|
+
/ (ureg.speed_of_light * thermostat_mass * thermostat_mass_unit)
|
|
2031
|
+
if thermostat_mass_unit is not None
|
|
2032
|
+
else None
|
|
2033
|
+
)
|
|
2034
|
+
else:
|
|
2035
|
+
sec_thermostat_parameters.effective_mass = thermostat_mass # TODO: generalize this for different thermostats (assuming here that the mass units will be printed to the outfile in case thermostat_mass is not defined)
|
|
2036
|
+
|
|
2037
|
+
self.archive.workflow2 = workflow
|
|
2038
|
+
|
|
2039
|
+
def parse_method(self):
|
|
2040
|
+
sec_run = self.archive.run[-1]
|
|
2041
|
+
sec_method = Method()
|
|
2042
|
+
sec_run.method.append(sec_method)
|
|
2043
|
+
|
|
2044
|
+
# extract the k-grid
|
|
2045
|
+
sec_kmesh = KMesh()
|
|
2046
|
+
sec_method.k_mesh = sec_kmesh
|
|
2047
|
+
sec_kmesh.grid = self.out_parser.get('k_grid')
|
|
2048
|
+
sec_kmesh.offset = self.out_parser.get('k_offset')
|
|
2049
|
+
|
|
2050
|
+
# Basis set
|
|
2051
|
+
sec_method.electrons_representation = [
|
|
2052
|
+
BasisSetContainer(
|
|
2053
|
+
type='atom-centered orbitals',
|
|
2054
|
+
scope=['wavefunction'],
|
|
2055
|
+
basis_set=[
|
|
2056
|
+
BasisSet(
|
|
2057
|
+
type='numeric AOs',
|
|
2058
|
+
scope=['full-electron'],
|
|
2059
|
+
)
|
|
2060
|
+
],
|
|
2061
|
+
)
|
|
2062
|
+
]
|
|
2063
|
+
sec_dft = DFT()
|
|
2064
|
+
sec_method.dft = sec_dft
|
|
2065
|
+
sec_electronic = Electronic()
|
|
2066
|
+
sec_method.electronic = sec_electronic
|
|
2067
|
+
sec_electronic.method = 'DFT'
|
|
2068
|
+
|
|
2069
|
+
# control parameters from out file
|
|
2070
|
+
self.control_parser.mainfile = self.filepath
|
|
2071
|
+
# we use species as marker that control parameters are printed in out file
|
|
2072
|
+
species = self.control_parser.get('species')
|
|
2073
|
+
# if not in outfile read it from control.in
|
|
2074
|
+
if species is None:
|
|
2075
|
+
control_file = self.get_fhiaims_file('control.in')
|
|
2076
|
+
if not control_file:
|
|
2077
|
+
control_file = [os.path.join(self.out_parser.maindir, 'control.in')]
|
|
2078
|
+
self.control_parser.mainfile = control_file[0]
|
|
2079
|
+
|
|
2080
|
+
def parse_basis_set(species):
|
|
2081
|
+
sec_basis_set = x_fhi_aims_section_controlIn_basis_set()
|
|
2082
|
+
sec_method.x_fhi_aims_section_controlIn_basis_set.append(sec_basis_set)
|
|
2083
|
+
basis_funcs = [
|
|
2084
|
+
'gaussian',
|
|
2085
|
+
'hydro',
|
|
2086
|
+
'valence',
|
|
2087
|
+
'ion_occ',
|
|
2088
|
+
'ionic',
|
|
2089
|
+
'confined',
|
|
2090
|
+
]
|
|
2091
|
+
for key, val in species.items():
|
|
2092
|
+
if key == 'species':
|
|
2093
|
+
sec_basis_set.x_fhi_aims_controlIn_species_name = val[0]
|
|
2094
|
+
elif key == 'angular_grids':
|
|
2095
|
+
sec_basis_set.x_fhi_aims_controlIn_angular_grids_method = val[0]
|
|
2096
|
+
elif key == 'division':
|
|
2097
|
+
pass
|
|
2098
|
+
elif key in basis_funcs:
|
|
2099
|
+
for i in range(len(val)):
|
|
2100
|
+
sec_basis_func = x_fhi_aims_section_controlIn_basis_func()
|
|
2101
|
+
sec_basis_set.x_fhi_aims_section_controlIn_basis_func.append(
|
|
2102
|
+
sec_basis_func
|
|
2103
|
+
)
|
|
2104
|
+
sec_basis_func.x_fhi_aims_controlIn_basis_func_type = key
|
|
2105
|
+
sec_basis_func.x_fhi_aims_controlIn_basis_func_n = int(
|
|
2106
|
+
val[i][0]
|
|
2107
|
+
)
|
|
2108
|
+
sec_basis_func.x_fhi_aims_controlIn_basis_func_l = str(
|
|
2109
|
+
val[i][1]
|
|
2110
|
+
)
|
|
2111
|
+
if len(val[i]) == 3 and hasattr(val[i][2], 'real'):
|
|
2112
|
+
sec_basis_func.x_fhi_aims_controlIn_basis_func_radius = val[
|
|
2113
|
+
i
|
|
2114
|
+
][2]
|
|
2115
|
+
elif key in ['cut_pot', 'radial_base']:
|
|
2116
|
+
setattr(
|
|
2117
|
+
sec_basis_set,
|
|
2118
|
+
'x_fhi_aims_controlIn_%s' % key,
|
|
2119
|
+
np.array(val[0], dtype=float),
|
|
2120
|
+
)
|
|
2121
|
+
else:
|
|
2122
|
+
try:
|
|
2123
|
+
setattr(sec_basis_set, 'x_fhi_aims_controlIn_%s' % key, val[0])
|
|
2124
|
+
except Exception:
|
|
2125
|
+
self.logger.warning(
|
|
2126
|
+
'Error setting controlIn metainfo.', details={key: key}
|
|
2127
|
+
)
|
|
2128
|
+
|
|
2129
|
+
# is the number of basis functions equal to number of divisions?
|
|
2130
|
+
division = species.get('division', None)
|
|
2131
|
+
if division is not None:
|
|
2132
|
+
sec_basis_set.x_fhi_aims_controlIn_number_of_basis_func = len(division)
|
|
2133
|
+
sec_basis_set.x_fhi_aims_controlIn_division = division
|
|
2134
|
+
|
|
2135
|
+
def _get_elemental_tier(
|
|
2136
|
+
basis_settings: x_fhi_aims_section_controlIn_basis_set,
|
|
2137
|
+
reference: dict = self._native_tier_references,
|
|
2138
|
+
) -> tuple[Any, Any]:
|
|
2139
|
+
"""Compare the basis settings to the reference
|
|
2140
|
+
and return the matching tier for each element."""
|
|
2141
|
+
|
|
2142
|
+
def _prep_elemental_tier(basis_settings: MSection) -> dict[str, Any]:
|
|
2143
|
+
"""Prepare the elemental tier for the basis set."""
|
|
2144
|
+
prefix = 'x_fhi_aims_controlIn_'
|
|
2145
|
+
prefix_repeating = 'x_fhi_aims_section_controlIn_'
|
|
2146
|
+
to_be_filtered = [
|
|
2147
|
+
'species_name',
|
|
2148
|
+
'nucleus',
|
|
2149
|
+
'mass',
|
|
2150
|
+
'number_of_basis_func',
|
|
2151
|
+
'angular_grids_method',
|
|
2152
|
+
]
|
|
2153
|
+
to_be_filtered = [prefix + k for k in to_be_filtered]
|
|
2154
|
+
basis_new = {}
|
|
2155
|
+
if not isinstance(basis_settings, dict):
|
|
2156
|
+
basis_settings = basis_settings.m_to_dict()
|
|
2157
|
+
for k, v in basis_settings.items():
|
|
2158
|
+
if (
|
|
2159
|
+
k.startswith(prefix) or k.startswith(prefix_repeating)
|
|
2160
|
+
) and k not in to_be_filtered:
|
|
2161
|
+
basis_new[k] = v
|
|
2162
|
+
return {k: basis_new[k] for k in sorted(basis_new.keys())}
|
|
2163
|
+
|
|
2164
|
+
# filter out element identifiers and other non-relevant quantities
|
|
2165
|
+
orbital_name = 'x_fhi_aims_section_controlIn_basis_func'
|
|
2166
|
+
bs_filtered = _prep_elemental_tier(basis_settings)
|
|
2167
|
+
bs_filtered[orbital_name] = [
|
|
2168
|
+
_prep_elemental_tier(orb) for orb in bs_filtered[orbital_name]
|
|
2169
|
+
]
|
|
2170
|
+
for quantity in ['radius', 'type', 'l', 'n']:
|
|
2171
|
+
try:
|
|
2172
|
+
bsf = lambda x: x[f'x_fhi_aims_controlIn_basis_func_{quantity}']
|
|
2173
|
+
bs_filtered[orbital_name] = sorted(
|
|
2174
|
+
bs_filtered[orbital_name], key=bsf
|
|
2175
|
+
)
|
|
2176
|
+
except KeyError:
|
|
2177
|
+
pass
|
|
2178
|
+
bs_hash = hashlib.sha1()
|
|
2179
|
+
bs_hash.update(json.dumps(bs_filtered, sort_keys=True).encode('utf-8'))
|
|
2180
|
+
bs_hash_key = bs_hash.hexdigest()
|
|
2181
|
+
try:
|
|
2182
|
+
return reference['hash'][bs_hash_key]['tier'], reference['hash'][
|
|
2183
|
+
bs_hash_key
|
|
2184
|
+
]['hierarchy']
|
|
2185
|
+
except KeyError:
|
|
2186
|
+
return None, -1
|
|
2187
|
+
|
|
2188
|
+
for key, val in self.control_parser.items():
|
|
2189
|
+
if val is None:
|
|
2190
|
+
# TODO consider also none entries? or (isinstance(val, str) and val == 'none'):
|
|
2191
|
+
continue
|
|
2192
|
+
if key.startswith('x_fhi_aims_controlIn'):
|
|
2193
|
+
try:
|
|
2194
|
+
if key == 'x_fhi_aims_controlIn_hse_unit':
|
|
2195
|
+
val = str(val)
|
|
2196
|
+
setattr(sec_method, key, val)
|
|
2197
|
+
except Exception:
|
|
2198
|
+
self.logger.warning(
|
|
2199
|
+
'Error setting controlIn metainfo.', data=dict(key=key)
|
|
2200
|
+
)
|
|
2201
|
+
elif key == 'occupation_type':
|
|
2202
|
+
sec_method.x_fhi_aims_controlIn_occupation_type = val[0]
|
|
2203
|
+
sec_method.x_fhi_aims_controlIn_occupation_width = val[1]
|
|
2204
|
+
if len(val) > 2:
|
|
2205
|
+
sec_method.x_fhi_aims_controlIn_occupation_order = int(val[2])
|
|
2206
|
+
elif key == 'relativistic':
|
|
2207
|
+
if isinstance(val, str):
|
|
2208
|
+
val = [val]
|
|
2209
|
+
sec_method.x_fhi_aims_controlIn_relativistic = ' '.join(val[:2])
|
|
2210
|
+
if len(val) > 2:
|
|
2211
|
+
sec_method.x_fhi_aims_controlIn_relativistic_threshold = val[2]
|
|
2212
|
+
elif key == 'species':
|
|
2213
|
+
for species in val:
|
|
2214
|
+
parse_basis_set(species)
|
|
2215
|
+
elif key == 'xc':
|
|
2216
|
+
if isinstance(val, str):
|
|
2217
|
+
val = [val]
|
|
2218
|
+
xc = ' '.join([v for v in val if isinstance(v, str)])
|
|
2219
|
+
sec_method.x_fhi_aims_controlIn_xc = str(xc)
|
|
2220
|
+
if not isinstance(val[-1], str) and xc.lower().startswith('hse'):
|
|
2221
|
+
unit = self.control_parser.get('x_fhi_aims_controlIn_hse_unit')
|
|
2222
|
+
hse_omega = val[-1] * unit if unit else val[-1]
|
|
2223
|
+
sec_method.x_fhi_aims_controlIn_hse_omega = hse_omega
|
|
2224
|
+
hybrid_coeff = self.control_parser.get(
|
|
2225
|
+
'x_fhi_aims_controlIn_hybrid_xc_coeff'
|
|
2226
|
+
)
|
|
2227
|
+
if hybrid_coeff is not None:
|
|
2228
|
+
# is it necessary to check if xc is a hybrid type aside from hybrid_coeff
|
|
2229
|
+
sec_method.x_fhi_aims_controlIn_hybrid_xc_coeff = hybrid_coeff
|
|
2230
|
+
|
|
2231
|
+
inout_exclude = [
|
|
2232
|
+
'x_fhi_aims_controlInOut_relativistic',
|
|
2233
|
+
'x_fhi_aims_controlInOut_xc',
|
|
2234
|
+
'x_fhi_aims_controlInOut_hse_unit',
|
|
2235
|
+
'x_fhi_aims_controlInOut_hybrid_xc_coeff',
|
|
2236
|
+
]
|
|
2237
|
+
# add controlInOut parameters
|
|
2238
|
+
for key in self.out_parser.keys():
|
|
2239
|
+
if key.startswith('x_fhi_aims_controlInOut'):
|
|
2240
|
+
if key not in inout_exclude:
|
|
2241
|
+
try:
|
|
2242
|
+
setattr(sec_method, key, self.out_parser.get(key))
|
|
2243
|
+
except Exception:
|
|
2244
|
+
self.logger.warning(
|
|
2245
|
+
'Error setting controlInOut metainfo.', details={key: key}
|
|
2246
|
+
)
|
|
2247
|
+
|
|
2248
|
+
nspin = self.out_parser.get_number_of_spin_channels()
|
|
2249
|
+
sec_method.x_fhi_aims_controlInOut_number_of_spin_channels = nspin
|
|
2250
|
+
sec_electronic.n_spin_channels = nspin
|
|
2251
|
+
|
|
2252
|
+
# convert relativistic
|
|
2253
|
+
relativistic = self.out_parser.get('x_fhi_aims_controlInOut_relativistic')
|
|
2254
|
+
if relativistic is not None:
|
|
2255
|
+
if not isinstance(relativistic, str):
|
|
2256
|
+
relativistic = ' '.join(relativistic)
|
|
2257
|
+
sec_method.x_fhi_aims_controlInOut_relativistic = relativistic
|
|
2258
|
+
relativistic = self._relativity_map.get(relativistic, None)
|
|
2259
|
+
if relativistic is not None:
|
|
2260
|
+
sec_electronic.relativity_method = relativistic
|
|
2261
|
+
|
|
2262
|
+
# atom species
|
|
2263
|
+
self.parse_topology()
|
|
2264
|
+
|
|
2265
|
+
# xc functional from output
|
|
2266
|
+
self.parse_xc_functional(sec_method, sec_dft)
|
|
2267
|
+
|
|
2268
|
+
# assign native tier
|
|
2269
|
+
if 'x_fhi_aims_section_controlIn_basis_set' in sec_method:
|
|
2270
|
+
native_basis_set = sec_method.x_fhi_aims_section_controlIn_basis_set
|
|
2271
|
+
tiers = {}
|
|
2272
|
+
for nbs in native_basis_set:
|
|
2273
|
+
tier, hierarchy = _get_elemental_tier(nbs)
|
|
2274
|
+
tiers[tier] = hierarchy
|
|
2275
|
+
if tiers:
|
|
2276
|
+
sec_method.electrons_representation[0].native_tier = min(
|
|
2277
|
+
tiers.keys(), key=lambda x: tiers[x]
|
|
2278
|
+
)
|
|
2279
|
+
|
|
2280
|
+
def parse_xc_functional(self, section, subsection):
|
|
2281
|
+
xc_inout = self.out_parser.get('x_fhi_aims_controlInOut_xc', None)
|
|
2282
|
+
if xc_inout is not None:
|
|
2283
|
+
xc_inout = [xc_inout] if isinstance(xc_inout, str) else xc_inout
|
|
2284
|
+
xc = ' '.join([v for v in xc_inout if isinstance(v, str)])
|
|
2285
|
+
section.x_fhi_aims_controlInOut_xc = str(xc)
|
|
2286
|
+
|
|
2287
|
+
# hse func
|
|
2288
|
+
hse_omega = None
|
|
2289
|
+
if not isinstance(xc_inout[-1], str) and xc.lower().startswith('hse'):
|
|
2290
|
+
unit = self.out_parser.get('x_fhi_aims_controlInOut_hse_unit')
|
|
2291
|
+
hse_omega = xc_inout[-1] * unit if unit else xc_inout[-1]
|
|
2292
|
+
section.x_fhi_aims_controlInOut_hse_omega = hse_omega
|
|
2293
|
+
|
|
2294
|
+
hybrid_coeff = self.out_parser.get(
|
|
2295
|
+
'x_fhi_aims_controlInOut_hybrid_xc_coeff'
|
|
2296
|
+
)
|
|
2297
|
+
if hybrid_coeff is not None:
|
|
2298
|
+
section.x_fhi_aims_controlIn_hybrid_xc_coeff = hybrid_coeff
|
|
2299
|
+
|
|
2300
|
+
# convert parsed xc to meta info
|
|
2301
|
+
xc_meta_list = self._xc_map.get(xc, [])
|
|
2302
|
+
sec_xc_functional = XCFunctional()
|
|
2303
|
+
subsection.xc_functional = sec_xc_functional
|
|
2304
|
+
for xc_meta in xc_meta_list:
|
|
2305
|
+
name = xc_meta.get('name')
|
|
2306
|
+
functional = Functional(name=name)
|
|
2307
|
+
weight = xc_meta.get('weight', None)
|
|
2308
|
+
if weight is not None and hybrid_coeff is not None:
|
|
2309
|
+
functional.weight = weight(float(hybrid_coeff))
|
|
2310
|
+
xc_parameters = dict()
|
|
2311
|
+
if hse_omega is not None:
|
|
2312
|
+
hybrid_coeff = 0.25 if hybrid_coeff is None else hybrid_coeff
|
|
2313
|
+
xc_parameters.setdefault(
|
|
2314
|
+
'$\\omega$ in m^-1', hse_omega.to('1/m').magnitude
|
|
2315
|
+
)
|
|
2316
|
+
if hybrid_coeff is not None:
|
|
2317
|
+
xc_parameters.setdefault(
|
|
2318
|
+
'exact_exchange_mixing_factor', hybrid_coeff
|
|
2319
|
+
)
|
|
2320
|
+
sec_xc_functional.normalize_hybrid()
|
|
2321
|
+
if xc_parameters:
|
|
2322
|
+
functional.parameters = xc_parameters
|
|
2323
|
+
if '_X_' in name or name.endswith('_X'):
|
|
2324
|
+
sec_xc_functional.exchange.append(functional)
|
|
2325
|
+
elif '_C_' in name or name.endswith('_C'):
|
|
2326
|
+
sec_xc_functional.correlation.append(functional)
|
|
2327
|
+
elif 'HYB' in name:
|
|
2328
|
+
sec_xc_functional.hybrid.append(functional)
|
|
2329
|
+
else:
|
|
2330
|
+
sec_xc_functional.contributions.append(functional)
|
|
2331
|
+
|
|
2332
|
+
def parse_topology(self):
|
|
2333
|
+
sec_method = self.archive.run[-1].method[-1]
|
|
2334
|
+
|
|
2335
|
+
def parse_atom_type(species):
|
|
2336
|
+
sec_atom_type = AtomParameters()
|
|
2337
|
+
sec_method.atom_parameters.append(sec_atom_type)
|
|
2338
|
+
sec_atom_species = x_fhi_aims_section_controlInOut_atom_species()
|
|
2339
|
+
sec_atom_type.x_fhi_aims_section_controlInOut_atom_species.append(
|
|
2340
|
+
sec_atom_species
|
|
2341
|
+
)
|
|
2342
|
+
for key, val in species.items():
|
|
2343
|
+
if key == 'nuclear charge':
|
|
2344
|
+
charge = val[0] * ureg.elementary_charge
|
|
2345
|
+
sec_atom_type.charge = charge
|
|
2346
|
+
sec_atom_species.x_fhi_aims_controlInOut_species_charge = charge
|
|
2347
|
+
elif key == 'atomic mass':
|
|
2348
|
+
mass = val[0][0] * ureg.amu
|
|
2349
|
+
sec_atom_type.mass = mass
|
|
2350
|
+
sec_atom_species.x_fhi_aims_controlInOut_species_mass = mass
|
|
2351
|
+
elif key == 'species':
|
|
2352
|
+
sec_atom_type.label = val
|
|
2353
|
+
sec_atom_species.x_fhi_aims_controlInOut_species_name = val
|
|
2354
|
+
elif 'request to include pure gaussian fns' in key:
|
|
2355
|
+
sec_atom_species.x_fhi_aims_controlInOut_pure_gaussian = val[0]
|
|
2356
|
+
elif 'cutoff potl' in key:
|
|
2357
|
+
sec_atom_species.x_fhi_aims_controlInOut_species_cut_pot = (
|
|
2358
|
+
val[0][0] * ureg.angstrom
|
|
2359
|
+
)
|
|
2360
|
+
sec_atom_species.x_fhi_aims_controlInOut_species_cut_pot_width = (
|
|
2361
|
+
val[0][1] * ureg.angstrom
|
|
2362
|
+
)
|
|
2363
|
+
sec_atom_species.x_fhi_aims_controlInOut_species_cut_pot_scale = (
|
|
2364
|
+
val[0][2]
|
|
2365
|
+
)
|
|
2366
|
+
elif "request for '+U'" in key:
|
|
2367
|
+
sec_hubbard = HubbardKanamoriModel()
|
|
2368
|
+
sec_atom_type.hubbard_kanamori_model = sec_hubbard
|
|
2369
|
+
sec_hubbard.orbital = f'{val[0][0]}{val[0][1]}'
|
|
2370
|
+
sec_hubbard.u_effective = val[0][-2] * ureg.eV
|
|
2371
|
+
sec_hubbard.double_counting_correction = 'Dudarev'
|
|
2372
|
+
sec_hubbard.x_fhi_aims_projection_type = 'Mulliken (dual)'
|
|
2373
|
+
sec_hubbard.x_fhi_aims_petukhov_mixing_factor = float(
|
|
2374
|
+
self.out_parser.get('petukhov')
|
|
2375
|
+
)
|
|
2376
|
+
elif 'free-atom' in key or 'free-ion' in key:
|
|
2377
|
+
for i in range(len(val)):
|
|
2378
|
+
sec_basis_func = x_fhi_aims_section_controlInOut_basis_func()
|
|
2379
|
+
sec_atom_species.x_fhi_aims_section_controlInOut_basis_func.append(
|
|
2380
|
+
sec_basis_func
|
|
2381
|
+
)
|
|
2382
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_type = (
|
|
2383
|
+
' '.join(key.split()[:-1])
|
|
2384
|
+
)
|
|
2385
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_n = val[i][0]
|
|
2386
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_l = val[i][1]
|
|
2387
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_occ = val[i][
|
|
2388
|
+
2
|
|
2389
|
+
]
|
|
2390
|
+
elif 'hydrogenic' in key:
|
|
2391
|
+
for i in range(len(val)):
|
|
2392
|
+
sec_basis_func = x_fhi_aims_section_controlInOut_basis_func()
|
|
2393
|
+
sec_atom_species.x_fhi_aims_section_controlInOut_basis_func.append(
|
|
2394
|
+
sec_basis_func
|
|
2395
|
+
)
|
|
2396
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_type = (
|
|
2397
|
+
' '.join(key.split()[:-1])
|
|
2398
|
+
)
|
|
2399
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_n = val[i][0]
|
|
2400
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_l = val[i][1]
|
|
2401
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_eff_charge = (
|
|
2402
|
+
val[i][2]
|
|
2403
|
+
)
|
|
2404
|
+
elif 'ionic' in key:
|
|
2405
|
+
for i in range(len(val)):
|
|
2406
|
+
sec_basis_func = x_fhi_aims_section_controlInOut_basis_func()
|
|
2407
|
+
sec_atom_species.x_fhi_aims_section_controlInOut_basis_func.append(
|
|
2408
|
+
sec_basis_func
|
|
2409
|
+
)
|
|
2410
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_type = (
|
|
2411
|
+
'ionic basis'
|
|
2412
|
+
)
|
|
2413
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_n = val[i][0]
|
|
2414
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_l = val[i][1]
|
|
2415
|
+
elif 'basis function' in key:
|
|
2416
|
+
for i in range(len(val)):
|
|
2417
|
+
sec_basis_func = x_fhi_aims_section_controlInOut_basis_func()
|
|
2418
|
+
sec_atom_species.x_fhi_aims_section_controlInOut_basis_func.append(
|
|
2419
|
+
sec_basis_func
|
|
2420
|
+
)
|
|
2421
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_type = (
|
|
2422
|
+
key.split('basis')[0].strip()
|
|
2423
|
+
)
|
|
2424
|
+
if val[i][0] == 'L':
|
|
2425
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_gauss_l = val[
|
|
2426
|
+
i
|
|
2427
|
+
][2]
|
|
2428
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_gauss_N = val[
|
|
2429
|
+
i
|
|
2430
|
+
][3]
|
|
2431
|
+
alpha = [
|
|
2432
|
+
val[i][j + 2]
|
|
2433
|
+
for j in range(len(val[i]))
|
|
2434
|
+
if val[i][j] == 'alpha'
|
|
2435
|
+
]
|
|
2436
|
+
weight = [
|
|
2437
|
+
val[i][j + 2]
|
|
2438
|
+
for j in range(len(val[i]))
|
|
2439
|
+
if val[i][j] == 'weight'
|
|
2440
|
+
]
|
|
2441
|
+
alpha = np.array(alpha) * (1 / ureg.angstrom**2)
|
|
2442
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_gauss_alpha = alpha
|
|
2443
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_gauss_weight = weight
|
|
2444
|
+
elif len(val[i]) == 2:
|
|
2445
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_gauss_l = val[
|
|
2446
|
+
i
|
|
2447
|
+
][0]
|
|
2448
|
+
alpha = np.array(val[i][1]) / ureg.angstrom**2
|
|
2449
|
+
sec_basis_func.x_fhi_aims_controlInOut_basis_func_primitive_gauss_alpha = alpha
|
|
2450
|
+
|
|
2451
|
+
# add inout parameters read from main output
|
|
2452
|
+
# species
|
|
2453
|
+
species = self.out_parser.get('control_inout', {}).get('species')
|
|
2454
|
+
if species is not None:
|
|
2455
|
+
for specie in species:
|
|
2456
|
+
parse_atom_type(specie)
|
|
2457
|
+
|
|
2458
|
+
def init_parser(self):
|
|
2459
|
+
self.out_parser.mainfile = self.filepath
|
|
2460
|
+
self.out_parser.logger = self.logger
|
|
2461
|
+
self.control_parser.logger = self.logger
|
|
2462
|
+
self.dos_parser.logger = self.logger
|
|
2463
|
+
self.bandstructure_parser.logger = self.logger
|
|
2464
|
+
self._frame_rate = None
|
|
2465
|
+
|
|
2466
|
+
def reuse_parser(self, parser):
|
|
2467
|
+
self.out_parser.quantities = parser.out_parser.quantities
|
|
2468
|
+
self.control_parser.quantities = parser.control_parser.quantities
|
|
2469
|
+
|
|
2470
|
+
def get_mainfile_keys(self, **kwargs):
|
|
2471
|
+
buffer = kwargs.get('decoded_buffer', '')
|
|
2472
|
+
match = re.search(self.out_parser._re_gw_flag, buffer)
|
|
2473
|
+
if match:
|
|
2474
|
+
gw_flag = match[1]
|
|
2475
|
+
else:
|
|
2476
|
+
overlap = len(self.out_parser._re_gw_flag) + 1
|
|
2477
|
+
block = max(len(buffer), 4916)
|
|
2478
|
+
match = None
|
|
2479
|
+
position = len(buffer)
|
|
2480
|
+
with open(kwargs.get('filename')) as f:
|
|
2481
|
+
while True:
|
|
2482
|
+
f.seek(position - overlap)
|
|
2483
|
+
text = f.read(block + overlap)
|
|
2484
|
+
match = re.search(self.out_parser._re_gw_flag, text)
|
|
2485
|
+
position += block
|
|
2486
|
+
if not text or match:
|
|
2487
|
+
gw_flag = match[1]
|
|
2488
|
+
break
|
|
2489
|
+
# TODO decide which to keep after thorough benchmarking
|
|
2490
|
+
# else:
|
|
2491
|
+
# self.out_parser.findall = False
|
|
2492
|
+
# self.out_parser.mainfile = kwargs.get('filename')
|
|
2493
|
+
# stop = self.out_parser.file_mmap.find(b'species')
|
|
2494
|
+
# self.out_parser.file_offset = len(buffer)
|
|
2495
|
+
# self.out_parser.file_length = stop if stop > 0 else 0
|
|
2496
|
+
# self.out_parser._file_handler = None
|
|
2497
|
+
# gw_flag = self.out_parser.get('gw_flag')
|
|
2498
|
+
# self.out_parser.findall = True
|
|
2499
|
+
# self.out_parser.file_offset = 0
|
|
2500
|
+
# self.out_parser.file_length = 0
|
|
2501
|
+
if gw_flag in self._gw_flag_map.keys():
|
|
2502
|
+
return ['GW', 'GW_workflow']
|
|
2503
|
+
return True
|
|
2504
|
+
|
|
2505
|
+
def parse(self, filepath, archive, logger):
|
|
2506
|
+
self.filepath = filepath
|
|
2507
|
+
self.archive = archive
|
|
2508
|
+
self.maindir = os.path.dirname(self.filepath)
|
|
2509
|
+
self.logger = logger if logger is not None else self.logger
|
|
2510
|
+
|
|
2511
|
+
self.init_parser()
|
|
2512
|
+
|
|
2513
|
+
sec_run = Run()
|
|
2514
|
+
self.archive.run.append(sec_run)
|
|
2515
|
+
sec_run.program = Program(
|
|
2516
|
+
name='FHI-aims',
|
|
2517
|
+
version=self.out_parser.get('version', ''),
|
|
2518
|
+
compilation_host=self.out_parser.get('compilation_host', ''),
|
|
2519
|
+
)
|
|
2520
|
+
sec_run.time_run = TimeRun(
|
|
2521
|
+
cpu1_start=self.out_parser.get('cpu1_start', 0),
|
|
2522
|
+
wall_start=self.out_parser.get('wall_start', 0),
|
|
2523
|
+
)
|
|
2524
|
+
|
|
2525
|
+
section_run_keys = [
|
|
2526
|
+
'x_fhi_aims_program_compilation_date',
|
|
2527
|
+
'x_fhi_aims_program_compilation_time',
|
|
2528
|
+
'raw_id',
|
|
2529
|
+
'x_fhi_aims_number_of_tasks',
|
|
2530
|
+
]
|
|
2531
|
+
for key in section_run_keys:
|
|
2532
|
+
value = self.out_parser.get(key)
|
|
2533
|
+
if value is None:
|
|
2534
|
+
continue
|
|
2535
|
+
try:
|
|
2536
|
+
setattr(sec_run, key, value)
|
|
2537
|
+
except Exception:
|
|
2538
|
+
self.logger.warning('Error setting run metainfo', details={key: key})
|
|
2539
|
+
sec_run.x_fhi_aims_program_execution_time = (
|
|
2540
|
+
self.out_parser.get('date_time', 0.0) * ureg.s
|
|
2541
|
+
)
|
|
2542
|
+
|
|
2543
|
+
sec_parallel_tasks = x_fhi_aims_section_parallel_tasks()
|
|
2544
|
+
sec_run.x_fhi_aims_section_parallel_tasks = sec_parallel_tasks
|
|
2545
|
+
# why embed section not just let task be an array
|
|
2546
|
+
|
|
2547
|
+
task_nrs = self.out_parser.get('x_fhi_aims_parallel_task_nr', [])
|
|
2548
|
+
task_hosts = self.out_parser.get('x_fhi_aims_parallel_task_host', [])
|
|
2549
|
+
for i in range(len(task_nrs)):
|
|
2550
|
+
sec_parallel_task_assignement = (
|
|
2551
|
+
x_fhi_aims_section_parallel_task_assignement()
|
|
2552
|
+
)
|
|
2553
|
+
sec_parallel_tasks.x_fhi_aims_section_parallel_task_assignement.append(
|
|
2554
|
+
sec_parallel_task_assignement
|
|
2555
|
+
)
|
|
2556
|
+
sec_parallel_task_assignement.x_fhi_aims_parallel_task_nr = task_nrs[i]
|
|
2557
|
+
sec_parallel_task_assignement.x_fhi_aims_parallel_task_host = task_hosts[i]
|
|
2558
|
+
|
|
2559
|
+
if self._calculation_type == 'gw':
|
|
2560
|
+
self.parse_gw()
|
|
2561
|
+
else:
|
|
2562
|
+
self.parse_method()
|
|
2563
|
+
self.parse_configurations()
|
|
2564
|
+
|
|
2565
|
+
self.parse_workflow()
|
|
2566
|
+
|
|
2567
|
+
gw_archive = self._child_archives.get('GW')
|
|
2568
|
+
if (
|
|
2569
|
+
gw_archive is not None
|
|
2570
|
+
and self.out_parser.get('gw_flag', None) in self._gw_flag_map.keys()
|
|
2571
|
+
):
|
|
2572
|
+
# GW single point
|
|
2573
|
+
p = FHIAimsParser()
|
|
2574
|
+
p._calculation_type = 'gw'
|
|
2575
|
+
p.parse(filepath, gw_archive, logger)
|
|
2576
|
+
|
|
2577
|
+
# GW workflow
|
|
2578
|
+
gw_workflow_archive = self._child_archives.get('GW_workflow')
|
|
2579
|
+
try:
|
|
2580
|
+
self.parse_gw_workflow(gw_archive, gw_workflow_archive)
|
|
2581
|
+
except Exception:
|
|
2582
|
+
self.logger.error('Error parsing the automatic GW workflow')
|