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,1745 @@
|
|
|
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 re
|
|
20
|
+
import os
|
|
21
|
+
import textwrap
|
|
22
|
+
import datetime
|
|
23
|
+
|
|
24
|
+
import ase
|
|
25
|
+
import numpy as np
|
|
26
|
+
|
|
27
|
+
from nomad.units import ureg
|
|
28
|
+
from nomad import atomutils # type: ignore
|
|
29
|
+
from nomad.parsing.file_parser import TextParser, Quantity
|
|
30
|
+
from runschema.run import Run, Program, TimeRun
|
|
31
|
+
from runschema.system import System, Atoms
|
|
32
|
+
from runschema.method import (
|
|
33
|
+
Method,
|
|
34
|
+
BasisSet,
|
|
35
|
+
Electronic,
|
|
36
|
+
Scf,
|
|
37
|
+
DFT,
|
|
38
|
+
XCFunctional,
|
|
39
|
+
Functional,
|
|
40
|
+
BasisSetAtomCentered,
|
|
41
|
+
BasisSetContainer,
|
|
42
|
+
)
|
|
43
|
+
from runschema.calculation import (
|
|
44
|
+
Calculation,
|
|
45
|
+
ScfIteration,
|
|
46
|
+
Energy,
|
|
47
|
+
EnergyEntry,
|
|
48
|
+
Forces,
|
|
49
|
+
ForcesEntry,
|
|
50
|
+
BandStructure,
|
|
51
|
+
BandEnergies,
|
|
52
|
+
Dos,
|
|
53
|
+
DosValues,
|
|
54
|
+
)
|
|
55
|
+
from simulationworkflowschema import (
|
|
56
|
+
GeometryOptimization,
|
|
57
|
+
GeometryOptimizationMethod,
|
|
58
|
+
GeometryOptimizationResults,
|
|
59
|
+
)
|
|
60
|
+
from .metainfo.crystal import x_crystal_section_shell
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def capture(regex):
|
|
64
|
+
return r'(' + regex + r')'
|
|
65
|
+
|
|
66
|
+
|
|
67
|
+
flt = r'-?(?:\d+\.?\d*|\d*\.?\d+)(?:E[\+-]?\d+)?' # Floating point number
|
|
68
|
+
flt_c = capture(flt) # Captures a floating point number
|
|
69
|
+
flt_crystal_c = r'(-?\d+(?:.\d+)?\*\*-?.*\d+)' # Crystal specific floating point syntax
|
|
70
|
+
ws = r'\s+' # Series of white-space characters
|
|
71
|
+
integer = r'-?\d+' # Integer number
|
|
72
|
+
integer_c = capture(integer) # Captures integer number
|
|
73
|
+
word = r'[a-zA-Z]+' # A single alphanumeric word
|
|
74
|
+
word_c = capture(word) # Captures a single alphanumeric word
|
|
75
|
+
br = r'\r?\n' # Newline that works for both Windows and Unix. Crystal can be run on a Windows machine as well.
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
class CrystalParser:
|
|
79
|
+
"""NOMAD-lab parser for Crystal."""
|
|
80
|
+
|
|
81
|
+
def __init__(self):
|
|
82
|
+
pass
|
|
83
|
+
|
|
84
|
+
def parse_output(self, filepath):
|
|
85
|
+
"""Reads the calculation output."""
|
|
86
|
+
outputparser = TextParser(
|
|
87
|
+
filepath,
|
|
88
|
+
quantities=[
|
|
89
|
+
# Header
|
|
90
|
+
Quantity(
|
|
91
|
+
'datetime',
|
|
92
|
+
rf'(?:Date\:|date)\s+(.*?){br}',
|
|
93
|
+
str_operation=lambda x: x,
|
|
94
|
+
repeats=False,
|
|
95
|
+
),
|
|
96
|
+
Quantity(
|
|
97
|
+
'hostname',
|
|
98
|
+
rf'(?:Running on\:|hostname)\s+(.*?){br}',
|
|
99
|
+
str_operation=lambda x: x,
|
|
100
|
+
repeats=False,
|
|
101
|
+
),
|
|
102
|
+
Quantity(
|
|
103
|
+
'os',
|
|
104
|
+
rf'(?:system)\s+(.*?){br}',
|
|
105
|
+
str_operation=lambda x: x,
|
|
106
|
+
repeats=False,
|
|
107
|
+
),
|
|
108
|
+
Quantity(
|
|
109
|
+
'user',
|
|
110
|
+
rf'user\s+(.*?){br}',
|
|
111
|
+
str_operation=lambda x: x,
|
|
112
|
+
repeats=False,
|
|
113
|
+
),
|
|
114
|
+
Quantity(
|
|
115
|
+
'input_path',
|
|
116
|
+
rf'(?:Input data|input data in)\s+(.*?){br}',
|
|
117
|
+
str_operation=lambda x: x,
|
|
118
|
+
repeats=False,
|
|
119
|
+
),
|
|
120
|
+
Quantity(
|
|
121
|
+
'output_path',
|
|
122
|
+
rf'(?:Output\:|output data in)\s+(.*?){br}',
|
|
123
|
+
str_operation=lambda x: x,
|
|
124
|
+
repeats=False,
|
|
125
|
+
),
|
|
126
|
+
Quantity(
|
|
127
|
+
'executable_path',
|
|
128
|
+
rf'(?:Executable\:|crystal executable in)\s+(.*?){br}',
|
|
129
|
+
str_operation=lambda x: x,
|
|
130
|
+
repeats=False,
|
|
131
|
+
),
|
|
132
|
+
Quantity(
|
|
133
|
+
'tmpdir',
|
|
134
|
+
rf'(?:Temporary directory\:|temporary directory)\s+(.*?){br}',
|
|
135
|
+
str_operation=lambda x: x,
|
|
136
|
+
repeats=False,
|
|
137
|
+
),
|
|
138
|
+
Quantity(
|
|
139
|
+
'system_type',
|
|
140
|
+
rf'(CRYSTAL|SLAB|POLYMER|HELIX|MOLECULE|EXTERNAL|DLVINPUT)',
|
|
141
|
+
repeats=False,
|
|
142
|
+
),
|
|
143
|
+
Quantity(
|
|
144
|
+
'calculation_type', rf'(OPTGEOM|FREQCALC|ANHARM)', repeats=False
|
|
145
|
+
),
|
|
146
|
+
# Input
|
|
147
|
+
Quantity(
|
|
148
|
+
'dftd3',
|
|
149
|
+
rf'(DFTD3{br}[\s\S]*?END{br})',
|
|
150
|
+
sub_parser=TextParser(
|
|
151
|
+
quantities=[
|
|
152
|
+
Quantity(
|
|
153
|
+
'version',
|
|
154
|
+
r'(VERSION \d)',
|
|
155
|
+
str_operation=lambda x: x,
|
|
156
|
+
repeats=False,
|
|
157
|
+
),
|
|
158
|
+
]
|
|
159
|
+
),
|
|
160
|
+
repeats=False,
|
|
161
|
+
),
|
|
162
|
+
Quantity(
|
|
163
|
+
'grimme',
|
|
164
|
+
rf'(GRIMME{br}[\s\S]*?END{br})',
|
|
165
|
+
repeats=False,
|
|
166
|
+
),
|
|
167
|
+
Quantity(
|
|
168
|
+
'dft',
|
|
169
|
+
rf'(DFT{br}[\w\s]*?END{br})',
|
|
170
|
+
sub_parser=TextParser(
|
|
171
|
+
quantities=[
|
|
172
|
+
Quantity(
|
|
173
|
+
'exchange',
|
|
174
|
+
rf'EXCHANGE{br}(LDA|VBH|BECKE|PBE|PBESOL|mPW91|PWGGA|SOGGA|WCGGA)',
|
|
175
|
+
repeats=False,
|
|
176
|
+
),
|
|
177
|
+
Quantity(
|
|
178
|
+
'correlation',
|
|
179
|
+
rf'CORRELAT{br}(PZ|VBH|VWN|LYP|P86|PBE|PBESOL|PWGGA|PWLSD|WL)',
|
|
180
|
+
repeats=False,
|
|
181
|
+
),
|
|
182
|
+
Quantity(
|
|
183
|
+
'exchange_correlation',
|
|
184
|
+
rf'(SVWN|BLYP|PBEXC|PBESOLXC|SOGGAXC|B3PW|B3LYP|PBE0|PBESOL0|B1WC|WCILYP|B97H|PBE0-13|HYBRID|NONLOCAL|HSE06|HSESOL|HISS|RSHXLDA|wB97|wB97X|LC-WPBE|LC-WPBESOL|LC-WBLYP|M05-2X|M05|M062X|M06HF|M06L|M06|B2PLYP|B2GPPLYP|mPW2PLYP|DHYBRID)',
|
|
185
|
+
repeats=False,
|
|
186
|
+
),
|
|
187
|
+
]
|
|
188
|
+
),
|
|
189
|
+
repeats=False,
|
|
190
|
+
),
|
|
191
|
+
Quantity(
|
|
192
|
+
'program_version',
|
|
193
|
+
rf'{br} \*\s+CRYSTAL([\d]+)\s+\*',
|
|
194
|
+
repeats=False,
|
|
195
|
+
dtype=str,
|
|
196
|
+
),
|
|
197
|
+
Quantity(
|
|
198
|
+
'distribution',
|
|
199
|
+
rf'{br} \*\s*({word} : \d+[\.\d+]*)',
|
|
200
|
+
str_operation=lambda x: x,
|
|
201
|
+
repeats=False,
|
|
202
|
+
),
|
|
203
|
+
Quantity(
|
|
204
|
+
'start_timestamp',
|
|
205
|
+
rf' EEEEEEEEEE STARTING DATE\s+(.*? TIME .*?){br}',
|
|
206
|
+
str_operation=lambda x: x,
|
|
207
|
+
repeats=False,
|
|
208
|
+
),
|
|
209
|
+
Quantity(
|
|
210
|
+
'title',
|
|
211
|
+
rf' EEEEEEEEEE STARTING DATE.*?{br}\s*(.*?){br}{br}',
|
|
212
|
+
str_operation=lambda x: x,
|
|
213
|
+
repeats=False,
|
|
214
|
+
),
|
|
215
|
+
Quantity(
|
|
216
|
+
'hamiltonian_type',
|
|
217
|
+
rf' (KOHN-SHAM HAMILTONIAN|HARTREE-FOCK HAMILTONIAN)',
|
|
218
|
+
str_operation=lambda x: x,
|
|
219
|
+
repeats=False,
|
|
220
|
+
),
|
|
221
|
+
Quantity(
|
|
222
|
+
'xc_out',
|
|
223
|
+
rf' \(EXCHANGE\)\[CORRELATION\] FUNCTIONAL:(\([\s\S]+?\)\[[\s\S]+?\])',
|
|
224
|
+
str_operation=lambda x: x,
|
|
225
|
+
repeats=False,
|
|
226
|
+
),
|
|
227
|
+
Quantity(
|
|
228
|
+
'hybrid_out',
|
|
229
|
+
rf' HYBRID EXCHANGE - PERCENTAGE OF FOCK EXCHANGE\s+{flt_c}',
|
|
230
|
+
repeats=False,
|
|
231
|
+
),
|
|
232
|
+
# Geometry optimization settings
|
|
233
|
+
Quantity(
|
|
234
|
+
'initial_trust_radius',
|
|
235
|
+
rf' INITIAL TRUST RADIUS\s+{flt_c}',
|
|
236
|
+
repeats=False,
|
|
237
|
+
),
|
|
238
|
+
Quantity(
|
|
239
|
+
'maximum_trust_radius',
|
|
240
|
+
rf' MAXIMUM TRUST RADIUS\s+{flt_c}',
|
|
241
|
+
repeats=False,
|
|
242
|
+
),
|
|
243
|
+
Quantity(
|
|
244
|
+
'maximum_gradient_component',
|
|
245
|
+
rf' MAXIMUM GRADIENT COMPONENT\s+{flt_c}',
|
|
246
|
+
repeats=False,
|
|
247
|
+
),
|
|
248
|
+
Quantity(
|
|
249
|
+
'rms_gradient_component',
|
|
250
|
+
rf' R\.M\.S\. OF GRADIENT COMPONENT\s+{flt_c}',
|
|
251
|
+
repeats=False,
|
|
252
|
+
),
|
|
253
|
+
Quantity(
|
|
254
|
+
'rms_displacement_component',
|
|
255
|
+
rf' R\.M\.S\. OF DISPLACEMENT COMPONENTS\s+{flt_c}',
|
|
256
|
+
repeats=False,
|
|
257
|
+
),
|
|
258
|
+
Quantity(
|
|
259
|
+
'geometry_change',
|
|
260
|
+
rf' MAXIMUM DISPLACEMENT COMPONENT\s+{flt_c}',
|
|
261
|
+
unit=ureg.bohr,
|
|
262
|
+
repeats=False,
|
|
263
|
+
),
|
|
264
|
+
Quantity(
|
|
265
|
+
'energy_change',
|
|
266
|
+
rf' THRESHOLD ON ENERGY CHANGE\s+{flt_c}',
|
|
267
|
+
unit=ureg.hartree,
|
|
268
|
+
repeats=False,
|
|
269
|
+
),
|
|
270
|
+
Quantity(
|
|
271
|
+
'extrapolating_polynomial_order',
|
|
272
|
+
rf' EXTRAPOLATING POLYNOMIAL ORDER{ws}{integer_c}',
|
|
273
|
+
repeats=False,
|
|
274
|
+
),
|
|
275
|
+
Quantity(
|
|
276
|
+
'max_steps',
|
|
277
|
+
rf' MAXIMUM ALLOWED NUMBER OF STEPS\s+{integer_c}',
|
|
278
|
+
repeats=False,
|
|
279
|
+
),
|
|
280
|
+
Quantity(
|
|
281
|
+
'sorting_of_energy_points',
|
|
282
|
+
rf'SORTING OF ENERGY POINTS\:\s+{word_c}',
|
|
283
|
+
repeats=False,
|
|
284
|
+
),
|
|
285
|
+
# System
|
|
286
|
+
Quantity(
|
|
287
|
+
'material_type',
|
|
288
|
+
rf' ((?:MOLECULAR|SLAB) CALCULATION){br}',
|
|
289
|
+
str_operation=lambda x: x,
|
|
290
|
+
repeats=False,
|
|
291
|
+
),
|
|
292
|
+
Quantity(
|
|
293
|
+
'crystal_family',
|
|
294
|
+
rf' CRYSTAL FAMILY\s*:\s*([\s\S]+?)\s*{br}',
|
|
295
|
+
str_operation=lambda x: x,
|
|
296
|
+
repeats=False,
|
|
297
|
+
),
|
|
298
|
+
Quantity(
|
|
299
|
+
'crystal_class',
|
|
300
|
+
rf' CRYSTAL CLASS \(GROTH - 1921\)\s*:\s*([\s\S]+?)\s*{br}',
|
|
301
|
+
str_operation=lambda x: x,
|
|
302
|
+
repeats=False,
|
|
303
|
+
),
|
|
304
|
+
Quantity(
|
|
305
|
+
'space_group',
|
|
306
|
+
rf' SPACE GROUP \(CENTROSYMMETRIC\)\s*:\s*([\s\S]+?)\s*{br}',
|
|
307
|
+
str_operation=lambda x: x,
|
|
308
|
+
repeats=False,
|
|
309
|
+
),
|
|
310
|
+
Quantity(
|
|
311
|
+
'dimensionality',
|
|
312
|
+
rf' GEOMETRY FOR WAVE FUNCTION - DIMENSIONALITY OF THE SYSTEM\s+(\d)',
|
|
313
|
+
repeats=False,
|
|
314
|
+
),
|
|
315
|
+
Quantity(
|
|
316
|
+
'lattice_parameters',
|
|
317
|
+
rf' (?:PRIMITIVE CELL - CENTRING CODE\s*[\s\S]*?\s*VOLUME=\s*{flt} - DENSITY\s*{flt} g/cm\^3{br}|PRIMITIVE CELL{br})'
|
|
318
|
+
+ rf'\s+A\s+B\s+C\s+ALPHA\s+BETA\s+GAMMA.*\s+'
|
|
319
|
+
+ rf'{flt_c}\s+{flt_c}\s+{flt_c}\s+{flt_c}\s+{flt_c}\s+{flt_c}',
|
|
320
|
+
shape=(6),
|
|
321
|
+
dtype=np.float64,
|
|
322
|
+
repeats=False,
|
|
323
|
+
),
|
|
324
|
+
Quantity(
|
|
325
|
+
'labels_positions',
|
|
326
|
+
rf' ATOMS IN THE ASYMMETRIC UNIT\s+{integer} - ATOMS IN THE UNIT CELL:\s+{integer}{br}'
|
|
327
|
+
+ rf'\s+ATOM\s+X(?:/A|\(ANGSTROM\))\s+Y(?:/B|\(ANGSTROM\))\s+Z(?:/C|\(ANGSTROM\))\s*{br}'
|
|
328
|
+
+ re.escape(
|
|
329
|
+
' *******************************************************************************'
|
|
330
|
+
)
|
|
331
|
+
+ rf'((?:\s+{integer}\s+(?:T|F)\s+{integer}\s+[\s\S]*?\s+{flt}\s+{flt}\s+{flt}{br})+)',
|
|
332
|
+
shape=(-1, 7),
|
|
333
|
+
dtype=str,
|
|
334
|
+
repeats=False,
|
|
335
|
+
),
|
|
336
|
+
Quantity(
|
|
337
|
+
'labels_positions_raw',
|
|
338
|
+
rf'AT\.IRR\.\s+AT\s+AT\.N\.\s+X\s+Y\s+Z\s*{br}'
|
|
339
|
+
+ rf'((?:\s+{integer}\s+{integer}\s+{integer}\s+{flt}\s+{flt}\s+{flt}{br})+)',
|
|
340
|
+
shape=(-1, 6),
|
|
341
|
+
dtype=str,
|
|
342
|
+
),
|
|
343
|
+
# Used to capture an edited geometry. Can contain
|
|
344
|
+
# substitutions, supercells, deformations etc. in any order.
|
|
345
|
+
Quantity(
|
|
346
|
+
'system_edited',
|
|
347
|
+
rf' \*\s+GEOMETRY EDITING([\s\S]+?)T = ATOM BELONGING TO THE ASYMMETRIC UNIT',
|
|
348
|
+
sub_parser=TextParser(
|
|
349
|
+
quantities=[
|
|
350
|
+
Quantity(
|
|
351
|
+
'lattice_parameters',
|
|
352
|
+
rf'A\s+B\s+C\s+ALPHA\s+BETA\s+GAMMA.+'
|
|
353
|
+
rf'\s+{flt_c}\s+{flt_c}\s+{flt_c}\s+{flt_c}\s+{flt_c}\s+{flt_c}',
|
|
354
|
+
shape=(6),
|
|
355
|
+
dtype=np.float64,
|
|
356
|
+
repeats=False,
|
|
357
|
+
),
|
|
358
|
+
Quantity(
|
|
359
|
+
'labels_positions',
|
|
360
|
+
rf'\s+ATOM\s+X(?:/A|\(ANGSTROM\))\s+Y(?:/B|\(ANGSTROM\))\s+Z(?:/C|\(ANGSTROM\))\s*{br}'
|
|
361
|
+
+ re.escape(
|
|
362
|
+
' *******************************************************************************'
|
|
363
|
+
)
|
|
364
|
+
+ rf'((?:\s+{integer}\s+(?:T|F)\s+{integer}\s+[\s\S]*?\s+{flt}\s+{flt}\s+{flt}{br})+)',
|
|
365
|
+
shape=(-1, 7),
|
|
366
|
+
dtype=str,
|
|
367
|
+
repeats=False,
|
|
368
|
+
),
|
|
369
|
+
Quantity(
|
|
370
|
+
'labels_positions_nanotube',
|
|
371
|
+
rf'\s+ATOM\s+X/A\s+Y\(ANGSTROM\)\s+Z\(ANGSTROM\)\s+R\(ANGS\)\s*{br}'
|
|
372
|
+
+ re.escape(
|
|
373
|
+
' *******************************************************************************'
|
|
374
|
+
)
|
|
375
|
+
+ rf'((?:\s+{integer}\s+(?:T|F)\s+{integer}\s+[\s\S]*?\s+{flt}\s+{flt}\s+{flt}\s+{flt}{br})+)',
|
|
376
|
+
shape=(-1, 8),
|
|
377
|
+
dtype=str,
|
|
378
|
+
repeats=False,
|
|
379
|
+
),
|
|
380
|
+
]
|
|
381
|
+
),
|
|
382
|
+
repeats=False,
|
|
383
|
+
),
|
|
384
|
+
Quantity(
|
|
385
|
+
'lattice_vectors_restart',
|
|
386
|
+
rf' DIRECT LATTICE VECTOR COMPONENTS \(ANGSTROM\){br}'
|
|
387
|
+
+ rf'\s+{flt_c}\s+{flt_c}\s+{flt_c}{br}'
|
|
388
|
+
+ rf'\s+{flt_c}\s+{flt_c}\s+{flt_c}{br}'
|
|
389
|
+
+ rf'\s+{flt_c}\s+{flt_c}\s+{flt_c}{br}',
|
|
390
|
+
shape=(3, 3),
|
|
391
|
+
dtype=np.float64,
|
|
392
|
+
repeats=False,
|
|
393
|
+
),
|
|
394
|
+
Quantity(
|
|
395
|
+
'labels_positions_restart',
|
|
396
|
+
rf' ATOM N\.AT\. SHELL X\(A\) Y\(A\) Z\(A\) EXAD N\.ELECT\.{br}'
|
|
397
|
+
+ re.escape(
|
|
398
|
+
' *******************************************************************************'
|
|
399
|
+
)
|
|
400
|
+
+ rf'((?:\s+{integer}\s+{integer}\s+{word}\s+{integer}\s+{flt}\s+{flt}\s+{flt}\s+{flt}\s+{flt}{br})+)',
|
|
401
|
+
shape=(-1, 9),
|
|
402
|
+
dtype=str,
|
|
403
|
+
repeats=False,
|
|
404
|
+
),
|
|
405
|
+
Quantity(
|
|
406
|
+
'symmops',
|
|
407
|
+
rf' NUMBER OF SYMMETRY OPERATORS\s*:\s*(\d){br}',
|
|
408
|
+
repeats=False,
|
|
409
|
+
),
|
|
410
|
+
# Method
|
|
411
|
+
Quantity(
|
|
412
|
+
'basis_set',
|
|
413
|
+
re.escape(
|
|
414
|
+
r' *******************************************************************************'
|
|
415
|
+
)
|
|
416
|
+
+ rf'{br} LOCAL ATOMIC FUNCTIONS BASIS SET{br}'
|
|
417
|
+
+ re.escape(
|
|
418
|
+
r' *******************************************************************************'
|
|
419
|
+
)
|
|
420
|
+
+ rf'{br} ATOM X\(AU\) Y\(AU\) Z\(AU\) N. TYPE EXPONENT S COEF P COEF D/F/G COEF{br}'
|
|
421
|
+
+ rf'([\s\S]*?){br} INFORMATION',
|
|
422
|
+
sub_parser=TextParser(
|
|
423
|
+
quantities=[
|
|
424
|
+
Quantity(
|
|
425
|
+
'basis_sets',
|
|
426
|
+
rf'({br}{ws}{integer}{ws}{word}{ws}{flt}{ws}{flt}{ws}{flt}{br}(?:(?:\s+(?:\d+-\s+)?\d+\s+(?:S|P|SP|D|F|G)\s*{br}[\s\S]*?(?:{ws}{flt}(?:{ws})?{flt}(?:{ws})?{flt}(?:{ws})?{flt}{br})+)+)?)',
|
|
427
|
+
sub_parser=TextParser(
|
|
428
|
+
quantities=[
|
|
429
|
+
Quantity(
|
|
430
|
+
'species',
|
|
431
|
+
rf'{br}({ws}{integer}{ws}{word}{ws}{flt}{ws}{flt}{ws}{flt}{br})',
|
|
432
|
+
repeats=False,
|
|
433
|
+
),
|
|
434
|
+
Quantity(
|
|
435
|
+
'shells',
|
|
436
|
+
rf'(\s+(?:\d+-\s+)?\d+\s+(?:S|P|SP|D|F|G)\s*{br}[\s\S]*?(?:{ws}{flt}(?:{ws})?{flt}(?:{ws})?{flt}(?:{ws})?{flt}{br})+)',
|
|
437
|
+
sub_parser=TextParser(
|
|
438
|
+
quantities=[
|
|
439
|
+
Quantity(
|
|
440
|
+
'shell_range',
|
|
441
|
+
r'(\s+(?:\d+-\s+)?\d+)',
|
|
442
|
+
str_operation=lambda x: ''.join(
|
|
443
|
+
x.split()
|
|
444
|
+
),
|
|
445
|
+
repeats=False,
|
|
446
|
+
),
|
|
447
|
+
Quantity(
|
|
448
|
+
'shell_type',
|
|
449
|
+
rf'((?:S|P|SP|D|F|G))\s*{br}',
|
|
450
|
+
str_operation=lambda x: x.strip(),
|
|
451
|
+
repeats=False,
|
|
452
|
+
),
|
|
453
|
+
Quantity(
|
|
454
|
+
'shell_coefficients',
|
|
455
|
+
rf'{ws}({flt})(?:{ws})?({flt})(?:{ws})?({flt})(?:{ws})?({flt}){br}',
|
|
456
|
+
repeats=True,
|
|
457
|
+
dtype=np.float64,
|
|
458
|
+
shape=(4),
|
|
459
|
+
),
|
|
460
|
+
]
|
|
461
|
+
),
|
|
462
|
+
repeats=True,
|
|
463
|
+
),
|
|
464
|
+
]
|
|
465
|
+
),
|
|
466
|
+
repeats=True,
|
|
467
|
+
),
|
|
468
|
+
]
|
|
469
|
+
),
|
|
470
|
+
repeats=False,
|
|
471
|
+
),
|
|
472
|
+
Quantity(
|
|
473
|
+
'fock_ks_matrix_mixing',
|
|
474
|
+
rf' INFORMATION \*+.*?\*+.*?\:\s+FOCK/KS MATRIX MIXING SET TO\s+{integer_c}\s+\%{br}',
|
|
475
|
+
repeats=False,
|
|
476
|
+
),
|
|
477
|
+
Quantity(
|
|
478
|
+
'coulomb_bipolar_buffer',
|
|
479
|
+
rf' INFORMATION \*+.*?\*+.*?\:\s+COULOMB BIPOLAR BUFFER SET TO\s+{flt_c} Mb{br}',
|
|
480
|
+
repeats=False,
|
|
481
|
+
),
|
|
482
|
+
Quantity(
|
|
483
|
+
'exchange_bipolar_buffer',
|
|
484
|
+
rf' INFORMATION \*+.*?\*+.*?\:\s+EXCHANGE BIPOLAR BUFFER SET TO\s+{flt_c} Mb{br}',
|
|
485
|
+
repeats=False,
|
|
486
|
+
),
|
|
487
|
+
Quantity(
|
|
488
|
+
'toldee',
|
|
489
|
+
rf' INFORMATION \*+ TOLDEE \*+\s*\*+ SCF TOL ON TOTAL ENERGY SET TO\s+{flt_c}{br}',
|
|
490
|
+
repeats=False,
|
|
491
|
+
),
|
|
492
|
+
Quantity(
|
|
493
|
+
'n_atoms_per_cell',
|
|
494
|
+
r' N\. OF ATOMS PER CELL\s+' + integer_c,
|
|
495
|
+
repeats=False,
|
|
496
|
+
),
|
|
497
|
+
Quantity(
|
|
498
|
+
'n_shells', r' NUMBER OF SHELLS\s+' + integer_c, repeats=False
|
|
499
|
+
),
|
|
500
|
+
Quantity('n_ao', r' NUMBER OF AO\s+' + integer_c, repeats=False),
|
|
501
|
+
Quantity(
|
|
502
|
+
'n_electrons',
|
|
503
|
+
r' N\. OF ELECTRONS PER CELL\s+' + integer_c,
|
|
504
|
+
repeats=False,
|
|
505
|
+
),
|
|
506
|
+
Quantity(
|
|
507
|
+
'n_core_electrons',
|
|
508
|
+
r' CORE ELECTRONS PER CELL\s+' + integer_c,
|
|
509
|
+
repeats=False,
|
|
510
|
+
),
|
|
511
|
+
Quantity(
|
|
512
|
+
'n_symmops',
|
|
513
|
+
r' N\. OF SYMMETRY OPERATORS\s+' + integer_c,
|
|
514
|
+
repeats=False,
|
|
515
|
+
),
|
|
516
|
+
Quantity(
|
|
517
|
+
'tol_coulomb_overlap',
|
|
518
|
+
r' COULOMB OVERLAP TOL\s+\(T1\) ' + flt_crystal_c,
|
|
519
|
+
str_operation=to_float,
|
|
520
|
+
repeats=False,
|
|
521
|
+
),
|
|
522
|
+
Quantity(
|
|
523
|
+
'tol_coulomb_penetration',
|
|
524
|
+
r' COULOMB PENETRATION TOL\s+\(T2\) ' + flt_crystal_c,
|
|
525
|
+
str_operation=to_float,
|
|
526
|
+
repeats=False,
|
|
527
|
+
),
|
|
528
|
+
Quantity(
|
|
529
|
+
'tol_exchange_overlap',
|
|
530
|
+
r' EXCHANGE OVERLAP TOL\s+\(T3\) ' + flt_crystal_c,
|
|
531
|
+
str_operation=to_float,
|
|
532
|
+
repeats=False,
|
|
533
|
+
),
|
|
534
|
+
Quantity(
|
|
535
|
+
'tol_pseudo_overlap_f',
|
|
536
|
+
r' EXCHANGE PSEUDO OVP \(F\(G\)\)\s+\(T4\) ' + flt_crystal_c,
|
|
537
|
+
str_operation=to_float,
|
|
538
|
+
repeats=False,
|
|
539
|
+
),
|
|
540
|
+
Quantity(
|
|
541
|
+
'tol_pseudo_overlap_p',
|
|
542
|
+
r' EXCHANGE PSEUDO OVP \(P\(G\)\)\s+\(T5\) ' + flt_crystal_c,
|
|
543
|
+
str_operation=to_float,
|
|
544
|
+
repeats=False,
|
|
545
|
+
),
|
|
546
|
+
Quantity(
|
|
547
|
+
'pole_order',
|
|
548
|
+
r' POLE ORDER IN MONO ZONE\s+' + integer_c,
|
|
549
|
+
repeats=False,
|
|
550
|
+
),
|
|
551
|
+
Quantity(
|
|
552
|
+
'calculation_type',
|
|
553
|
+
rf' TYPE OF CALCULATION \:\s+(.*?{br}\s+.*?){br}',
|
|
554
|
+
str_operation=lambda x: ' '.join(x.split()),
|
|
555
|
+
repeats=False,
|
|
556
|
+
),
|
|
557
|
+
Quantity(
|
|
558
|
+
'xc_functional',
|
|
559
|
+
rf' \(EXCHANGE\)\[CORRELATION\] FUNCTIONAL:(\(.+\)\[.+\]){br}',
|
|
560
|
+
str_operation=lambda x: x,
|
|
561
|
+
repeats=False,
|
|
562
|
+
),
|
|
563
|
+
Quantity(
|
|
564
|
+
'cappa',
|
|
565
|
+
rf'CAPPA:IS1\s+{integer_c};IS2\s+{integer_c};IS3\s+{integer_c}; K PTS MONK NET\s+{integer_c}; SYMMOPS:\s*K SPACE\s+{integer_c};G SPACE\s+{integer_c}',
|
|
566
|
+
repeats=False,
|
|
567
|
+
),
|
|
568
|
+
Quantity(
|
|
569
|
+
'scf_max_iteration',
|
|
570
|
+
r' MAX NUMBER OF SCF CYCLES\s+' + integer_c,
|
|
571
|
+
repeats=False,
|
|
572
|
+
),
|
|
573
|
+
Quantity(
|
|
574
|
+
'convergenge_deltap',
|
|
575
|
+
r'CONVERGENCE ON DELTAP\s+' + flt_crystal_c,
|
|
576
|
+
str_operation=to_float,
|
|
577
|
+
repeats=False,
|
|
578
|
+
),
|
|
579
|
+
Quantity(
|
|
580
|
+
'weight_f',
|
|
581
|
+
r'WEIGHT OF F\(I\) IN F\(I\+1\)\s+' + integer_c,
|
|
582
|
+
repeats=False,
|
|
583
|
+
),
|
|
584
|
+
Quantity(
|
|
585
|
+
'scf_threshold_energy_change',
|
|
586
|
+
r'CONVERGENCE ON ENERGY\s+' + flt_crystal_c,
|
|
587
|
+
str_operation=to_float,
|
|
588
|
+
repeats=False,
|
|
589
|
+
unit=ureg.hartree,
|
|
590
|
+
),
|
|
591
|
+
Quantity(
|
|
592
|
+
'shrink',
|
|
593
|
+
r'SHRINK\. FACT\.\(MONKH\.\)\s+('
|
|
594
|
+
+ integer
|
|
595
|
+
+ ws
|
|
596
|
+
+ integer
|
|
597
|
+
+ ws
|
|
598
|
+
+ integer
|
|
599
|
+
+ r')',
|
|
600
|
+
repeats=False,
|
|
601
|
+
),
|
|
602
|
+
Quantity(
|
|
603
|
+
'n_k_points_ibz',
|
|
604
|
+
r'NUMBER OF K POINTS IN THE IBZ\s+' + integer_c,
|
|
605
|
+
repeats=False,
|
|
606
|
+
),
|
|
607
|
+
Quantity(
|
|
608
|
+
'shrink_gilat',
|
|
609
|
+
r'SHRINKING FACTOR\(GILAT NET\)\s+' + integer_c,
|
|
610
|
+
repeats=False,
|
|
611
|
+
),
|
|
612
|
+
Quantity(
|
|
613
|
+
'n_k_points_gilat',
|
|
614
|
+
r'NUMBER OF K POINTS\(GILAT NET\)\s+' + integer_c,
|
|
615
|
+
repeats=False,
|
|
616
|
+
),
|
|
617
|
+
# SCF
|
|
618
|
+
Quantity(
|
|
619
|
+
'scf_block',
|
|
620
|
+
r' CHARGE NORMALIZATION FACTOR([\s\S]*?) == SCF ENDED',
|
|
621
|
+
sub_parser=TextParser(
|
|
622
|
+
quantities=[
|
|
623
|
+
Quantity(
|
|
624
|
+
'scf_iterations',
|
|
625
|
+
r'( CHARGE NORMALIZATION FACTOR[\s\S]*? (?:TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT PDIG|TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT MPP_KSPA|== SCF ENDED))',
|
|
626
|
+
sub_parser=TextParser(
|
|
627
|
+
quantities=[
|
|
628
|
+
Quantity(
|
|
629
|
+
'charge_normalization_factor',
|
|
630
|
+
rf' CHARGE NORMALIZATION FACTOR{ws}{flt}{br}',
|
|
631
|
+
repeats=False,
|
|
632
|
+
),
|
|
633
|
+
Quantity(
|
|
634
|
+
'total_atomic_charges',
|
|
635
|
+
rf' TOTAL ATOMIC CHARGES:{br}(?:{ws}{flt})+{br}',
|
|
636
|
+
repeats=False,
|
|
637
|
+
),
|
|
638
|
+
Quantity(
|
|
639
|
+
'QGAM',
|
|
640
|
+
rf' TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT QGAM TELAPSE{ws}{flt}{ws}TCPU{ws}{flt}{br}',
|
|
641
|
+
repeats=False,
|
|
642
|
+
),
|
|
643
|
+
Quantity(
|
|
644
|
+
'BIEL2',
|
|
645
|
+
rf' TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT BIEL2 TELAPSE{ws}{flt}{ws}TCPU{ws}{flt}{br}',
|
|
646
|
+
repeats=False,
|
|
647
|
+
),
|
|
648
|
+
Quantity(
|
|
649
|
+
'energy_kinetic',
|
|
650
|
+
rf' ::: KINETIC ENERGY\s+{flt_c}{br}',
|
|
651
|
+
unit=ureg.hartree,
|
|
652
|
+
repeats=False,
|
|
653
|
+
),
|
|
654
|
+
Quantity(
|
|
655
|
+
'energy_ee',
|
|
656
|
+
rf' ::: TOTAL E-E\s+{flt_c}{br}',
|
|
657
|
+
unit=ureg.hartree,
|
|
658
|
+
repeats=False,
|
|
659
|
+
),
|
|
660
|
+
Quantity(
|
|
661
|
+
'energy_en_ne',
|
|
662
|
+
rf' ::: TOTAL E-N \+ N-E\s+{flt_c}{br}',
|
|
663
|
+
unit=ureg.hartree,
|
|
664
|
+
repeats=False,
|
|
665
|
+
),
|
|
666
|
+
Quantity(
|
|
667
|
+
'energy_nn',
|
|
668
|
+
rf' ::: TOTAL N-N\s+{flt_c}{br}',
|
|
669
|
+
unit=ureg.hartree,
|
|
670
|
+
repeats=False,
|
|
671
|
+
),
|
|
672
|
+
Quantity(
|
|
673
|
+
'virial_coefficient',
|
|
674
|
+
rf' ::: VIRIAL COEFFICIENT\s+{flt_c}{br}',
|
|
675
|
+
repeats=False,
|
|
676
|
+
),
|
|
677
|
+
Quantity(
|
|
678
|
+
'TOTENY',
|
|
679
|
+
rf' TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT TOTENY TELAPSE{ws}{flt}{ws}TCPU{ws}{flt}{br}',
|
|
680
|
+
repeats=False,
|
|
681
|
+
),
|
|
682
|
+
Quantity(
|
|
683
|
+
'integrated_density',
|
|
684
|
+
rf' NUMERICALLY INTEGRATED DENSITY{ws}{flt}{br}',
|
|
685
|
+
repeats=False,
|
|
686
|
+
),
|
|
687
|
+
Quantity(
|
|
688
|
+
'NUMDFT',
|
|
689
|
+
rf' TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT NUMDFT TELAPSE{ws}{flt}{ws}TCPU{ws}{flt}{br}',
|
|
690
|
+
repeats=False,
|
|
691
|
+
),
|
|
692
|
+
Quantity(
|
|
693
|
+
'energies',
|
|
694
|
+
rf' CYC{ws}{integer}{ws}ETOT\(AU\){ws}{flt_c}{ws}DETOT{ws}{flt_c}{ws}tst{ws}{flt}{ws}PX{ws}{flt}{br}',
|
|
695
|
+
repeats=False,
|
|
696
|
+
dtype=np.float64,
|
|
697
|
+
unit=ureg.hartree,
|
|
698
|
+
),
|
|
699
|
+
Quantity(
|
|
700
|
+
'FDIK',
|
|
701
|
+
rf' TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT FDIK TELAPSE{ws}{flt}{ws}TCPU{ws}{flt}{br}',
|
|
702
|
+
repeats=False,
|
|
703
|
+
),
|
|
704
|
+
]
|
|
705
|
+
),
|
|
706
|
+
repeats=True,
|
|
707
|
+
),
|
|
708
|
+
]
|
|
709
|
+
),
|
|
710
|
+
repeats=False,
|
|
711
|
+
),
|
|
712
|
+
Quantity(
|
|
713
|
+
'number_of_scf_iterations',
|
|
714
|
+
rf' == SCF ENDED - CONVERGENCE ON (?:ENERGY|TESTER)\s+E\(AU\)\s*{flt}\s*CYCLES\s+{integer_c}',
|
|
715
|
+
repeats=False,
|
|
716
|
+
),
|
|
717
|
+
Quantity(
|
|
718
|
+
'energy_total',
|
|
719
|
+
rf' TOTAL ENERGY\((?:DFT|HF)\)\(AU\)\(\s*{integer}\)\s*{flt_c} DE\s*{flt} (?:tester|tst)\s*{flt}',
|
|
720
|
+
unit=ureg.hartree,
|
|
721
|
+
repeats=False,
|
|
722
|
+
),
|
|
723
|
+
# Geometry optimization steps
|
|
724
|
+
Quantity(
|
|
725
|
+
'geo_opt',
|
|
726
|
+
rf'( (?:COORDINATE AND CELL OPTIMIZATION|COORDINATE OPTIMIZATION) - POINT\s+1{br}'
|
|
727
|
+
+ r'[\s\S]*?'
|
|
728
|
+
+ re.escape(
|
|
729
|
+
r' ******************************************************************'
|
|
730
|
+
)
|
|
731
|
+
+ rf'{br}'
|
|
732
|
+
+ rf'\s*\* OPT END - CONVERGED \* E\(AU\)\:\s+{flt}\s+POINTS\s+{integer})\s+\*{br}',
|
|
733
|
+
sub_parser=TextParser(
|
|
734
|
+
quantities=[
|
|
735
|
+
Quantity(
|
|
736
|
+
'geo_opt_step',
|
|
737
|
+
rf' (?:COORDINATE AND CELL OPTIMIZATION|COORDINATE OPTIMIZATION) - POINT\s+{integer}{br}'
|
|
738
|
+
+ rf'([\s\S]*?)'
|
|
739
|
+
+ rf' ((?:TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT OPTI|\* OPT END).+)',
|
|
740
|
+
sub_parser=TextParser(
|
|
741
|
+
quantities=[
|
|
742
|
+
Quantity(
|
|
743
|
+
'lattice_parameters',
|
|
744
|
+
rf' (?:PRIMITIVE CELL - CENTRING CODE [\s\S]*?VOLUME=\s*{flt} - DENSITY\s*{flt} g/cm\^3{br}|PRIMITIVE CELL{br})'
|
|
745
|
+
+ rf' A B C ALPHA BETA GAMMA\s*'
|
|
746
|
+
+ rf'{flt_c}\s+{flt_c}\s+{flt_c}\s+{flt_c}\s+{flt_c}\s+{flt_c}{br}',
|
|
747
|
+
shape=(6),
|
|
748
|
+
dtype=np.float64,
|
|
749
|
+
repeats=False,
|
|
750
|
+
),
|
|
751
|
+
Quantity(
|
|
752
|
+
'labels_positions',
|
|
753
|
+
rf'\s+ATOM\s+X(?:/A|\(ANGSTROM\))\s+Y(?:/B|\(ANGSTROM\))\s+Z(?:/C|\(ANGSTROM\))\s*{br}'
|
|
754
|
+
+ re.escape(
|
|
755
|
+
' *******************************************************************************'
|
|
756
|
+
)
|
|
757
|
+
+ rf'((?:\s+{integer}\s+(?:T|F)\s+{integer}\s+[\s\S]*?\s+{flt}\s+{flt}\s+{flt}{br})+)',
|
|
758
|
+
shape=(-1, 7),
|
|
759
|
+
dtype=str,
|
|
760
|
+
repeats=False,
|
|
761
|
+
),
|
|
762
|
+
Quantity(
|
|
763
|
+
'labels_positions_nanotube',
|
|
764
|
+
rf'\s+ATOM\s+X/A\s+Y\(ANGSTROM\)\s+Z\(ANGSTROM\)\s+R\(ANGS\)\s*{br}'
|
|
765
|
+
+ re.escape(
|
|
766
|
+
' *******************************************************************************'
|
|
767
|
+
)
|
|
768
|
+
+ rf'((?:\s+{integer}\s+(?:T|F)\s+{integer}\s+[\s\S]*?\s+{flt}\s+{flt}\s+{flt}\s+{flt}{br})+)',
|
|
769
|
+
shape=(-1, 8),
|
|
770
|
+
dtype=str,
|
|
771
|
+
repeats=False,
|
|
772
|
+
),
|
|
773
|
+
Quantity(
|
|
774
|
+
'energy',
|
|
775
|
+
rf' TOTAL ENERGY\({word}\)\(AU\)\(\s*{integer}\)\s*{flt_c}',
|
|
776
|
+
unit=ureg.hartree,
|
|
777
|
+
repeats=False,
|
|
778
|
+
),
|
|
779
|
+
Quantity(
|
|
780
|
+
'time_physical',
|
|
781
|
+
rf'OPT.+? TELAPSE\s+({flt})',
|
|
782
|
+
),
|
|
783
|
+
]
|
|
784
|
+
),
|
|
785
|
+
repeats=True,
|
|
786
|
+
),
|
|
787
|
+
Quantity(
|
|
788
|
+
'converged',
|
|
789
|
+
rf' \* OPT END - ([\s\S]*?) \* E\(AU\)\:\s+{flt}\s+POINTS\s+{integer}',
|
|
790
|
+
repeats=False,
|
|
791
|
+
),
|
|
792
|
+
]
|
|
793
|
+
),
|
|
794
|
+
repeats=False,
|
|
795
|
+
),
|
|
796
|
+
# Band structure
|
|
797
|
+
Quantity(
|
|
798
|
+
'band_structure',
|
|
799
|
+
re.escape(
|
|
800
|
+
rf' *******************************************************************************'
|
|
801
|
+
)
|
|
802
|
+
+ rf'{br}'
|
|
803
|
+
+ rf' \* \*{br}'
|
|
804
|
+
+ rf' \* BAND STRUCTURE \*{br}'
|
|
805
|
+
+ rf'[\s\S]*?'
|
|
806
|
+
+ rf' \* FROM BAND\s+{integer} TO BAND\s+{integer}\s+\*{br}'
|
|
807
|
+
+ rf' \* TOTAL OF\s+{integer} K-POINTS ALONG THE PATH\s+\*{br}'
|
|
808
|
+
+ rf' \* \*{br}'
|
|
809
|
+
+ re.escape(
|
|
810
|
+
r' *******************************************************************************'
|
|
811
|
+
)
|
|
812
|
+
+ rf'{br}'
|
|
813
|
+
+ rf'([\s\S]*?'
|
|
814
|
+
+ rf' ENERGY RANGE \(A\.U\.\)\s*{flt} - \s*{flt} EFERMI\s*{flt_c}{br})',
|
|
815
|
+
sub_parser=TextParser(
|
|
816
|
+
quantities=[
|
|
817
|
+
Quantity(
|
|
818
|
+
'segments',
|
|
819
|
+
rf' (LINE\s+{integer} \( {flt} {flt} {flt}: {flt} {flt} {flt}\) IN TERMS OF PRIMITIVE LATTICE VECTORS{br}'
|
|
820
|
+
+ rf'\s+{integer} POINTS - SHRINKING_FACTOR\s*{integer}{br}'
|
|
821
|
+
+ rf' CARTESIAN COORD\.\s+\( {flt} {flt} {flt}\):\( {flt} {flt} {flt}\) STEP\s+{flt}{br}{br}{br})',
|
|
822
|
+
sub_parser=TextParser(
|
|
823
|
+
quantities=[
|
|
824
|
+
Quantity(
|
|
825
|
+
'start_end',
|
|
826
|
+
rf'LINE\s+{integer} \( {flt_c} {flt_c} {flt_c}: {flt_c} {flt_c} {flt_c}\) IN TERMS OF PRIMITIVE LATTICE VECTORS{br}',
|
|
827
|
+
type=np.float64,
|
|
828
|
+
shape=(2, 3),
|
|
829
|
+
repeats=False,
|
|
830
|
+
),
|
|
831
|
+
Quantity(
|
|
832
|
+
'n_steps',
|
|
833
|
+
rf'\s+{integer_c} POINTS - ',
|
|
834
|
+
repeats=False,
|
|
835
|
+
),
|
|
836
|
+
Quantity(
|
|
837
|
+
'shrinking_factor',
|
|
838
|
+
rf'SHRINKING_FACTOR\s*{integer_c}{br}',
|
|
839
|
+
repeats=False,
|
|
840
|
+
),
|
|
841
|
+
]
|
|
842
|
+
),
|
|
843
|
+
repeats=True,
|
|
844
|
+
),
|
|
845
|
+
Quantity(
|
|
846
|
+
'fermi_energy',
|
|
847
|
+
rf' ENERGY RANGE \(A\.U\.\)\s*{flt} - \s*{flt} EFERMI\s*{flt_c}',
|
|
848
|
+
repeats=False,
|
|
849
|
+
),
|
|
850
|
+
]
|
|
851
|
+
),
|
|
852
|
+
repeats=False,
|
|
853
|
+
),
|
|
854
|
+
# DOS
|
|
855
|
+
Quantity(
|
|
856
|
+
'dos',
|
|
857
|
+
rf' RESTART WITH NEW K POINTS NET{br}'
|
|
858
|
+
+ rf'([\s\S]+?'
|
|
859
|
+
+ rf' TOTAL AND PROJECTED DENSITY OF STATES - FOURIER LEGENDRE METHOD{br}'
|
|
860
|
+
+ rf'[\s\S]+?)'
|
|
861
|
+
+ rf' TTTTTTTTTTTTTTTTTTTTTTTTTTTTTT DOSS TELAPSE',
|
|
862
|
+
sub_parser=TextParser(
|
|
863
|
+
quantities=[
|
|
864
|
+
Quantity(
|
|
865
|
+
'k_points',
|
|
866
|
+
rf' \*\*\* K POINTS COORDINATES (OBLIQUE COORDINATES IN UNITS OF IS = {int}){br}',
|
|
867
|
+
repeats=False,
|
|
868
|
+
),
|
|
869
|
+
Quantity(
|
|
870
|
+
'highest_occupied',
|
|
871
|
+
rf' TOP OF VALENCE BANDS - BAND\s*{integer}; K\s*{integer}; EIG {flt_c}\s*AU',
|
|
872
|
+
unit=ureg.hartree,
|
|
873
|
+
repeats=False,
|
|
874
|
+
),
|
|
875
|
+
Quantity(
|
|
876
|
+
'lowest_unoccupied',
|
|
877
|
+
rf' BOTTOM OF VIRTUAL BANDS - BAND\s*{integer}; K\s*{integer}; EIG\s*{flt_c}\s*AU',
|
|
878
|
+
unit=ureg.hartree,
|
|
879
|
+
repeats=False,
|
|
880
|
+
),
|
|
881
|
+
]
|
|
882
|
+
),
|
|
883
|
+
repeats=False,
|
|
884
|
+
),
|
|
885
|
+
Quantity(
|
|
886
|
+
'end_timestamp',
|
|
887
|
+
rf' EEEEEEEEEE TERMINATION DATE\s+(.*? TIME .*?){br}',
|
|
888
|
+
str_operation=lambda x: x,
|
|
889
|
+
repeats=False,
|
|
890
|
+
),
|
|
891
|
+
# Forces
|
|
892
|
+
Quantity(
|
|
893
|
+
'forces',
|
|
894
|
+
rf' CARTESIAN FORCES IN HARTREE/BOHR \(ANALYTICAL\){br}'
|
|
895
|
+
rf' ATOM X Y Z{br}'
|
|
896
|
+
+ rf'((?:'
|
|
897
|
+
+ ws
|
|
898
|
+
+ integer
|
|
899
|
+
+ ws
|
|
900
|
+
+ integer
|
|
901
|
+
+ ws
|
|
902
|
+
+ flt
|
|
903
|
+
+ ws
|
|
904
|
+
+ flt
|
|
905
|
+
+ ws
|
|
906
|
+
+ flt
|
|
907
|
+
+ rf'{br})*)',
|
|
908
|
+
shape=(-1, 5),
|
|
909
|
+
dtype=str,
|
|
910
|
+
repeats=False,
|
|
911
|
+
),
|
|
912
|
+
Quantity(
|
|
913
|
+
'end_timestamp',
|
|
914
|
+
rf' EEEEEEEEEE TERMINATION DATE\s+(.*? TIME .*?){br}',
|
|
915
|
+
str_operation=lambda x: x,
|
|
916
|
+
repeats=False,
|
|
917
|
+
),
|
|
918
|
+
Quantity('time_end', rf'END +TELAPSE +({flt_c})', dtype=np.float64),
|
|
919
|
+
# Filepaths
|
|
920
|
+
Quantity(
|
|
921
|
+
'f25_filepath1',
|
|
922
|
+
rf'file fort\.25 saved as ([\s\S]+?){br}',
|
|
923
|
+
str_operation=lambda x: x,
|
|
924
|
+
repeats=False,
|
|
925
|
+
),
|
|
926
|
+
Quantity(
|
|
927
|
+
'f25_filepath2',
|
|
928
|
+
rf'BAND/MAPS/DOSS data for plotting fort.25 saved as ([\s\S]+?){br}',
|
|
929
|
+
str_operation=lambda x: x,
|
|
930
|
+
repeats=False,
|
|
931
|
+
),
|
|
932
|
+
],
|
|
933
|
+
)
|
|
934
|
+
|
|
935
|
+
return outputparser
|
|
936
|
+
|
|
937
|
+
def parse_f25(self, filepath):
|
|
938
|
+
"""Parses the f25 file containing e.g. the band structure energies." """
|
|
939
|
+
f25parser = TextParser(
|
|
940
|
+
filepath,
|
|
941
|
+
quantities=[
|
|
942
|
+
# Band structure energies
|
|
943
|
+
Quantity(
|
|
944
|
+
'segments',
|
|
945
|
+
rf'(-\%-0BAND\s*{integer}\s*{integer}\s?{flt}\s?{flt}\s?{flt}{br}'
|
|
946
|
+
+ rf'\s*{flt}\s*{flt}{br}'
|
|
947
|
+
+ rf'\s*{integer}\s*{integer}\s*{integer}\s*{integer}\s*{integer}\s*{integer}{br}'
|
|
948
|
+
+ rf'(?:\s*{flt})+)',
|
|
949
|
+
sub_parser=TextParser(
|
|
950
|
+
quantities=[
|
|
951
|
+
Quantity(
|
|
952
|
+
'first_row',
|
|
953
|
+
rf'-\%-0BAND\s*{integer_c}\s*{integer_c}\s?{flt_c}\s?{flt_c}\s?{flt_c}{br}',
|
|
954
|
+
repeats=False,
|
|
955
|
+
),
|
|
956
|
+
Quantity(
|
|
957
|
+
'second_row',
|
|
958
|
+
rf'\s?{flt_c}\s?{flt_c}{br}',
|
|
959
|
+
repeats=False,
|
|
960
|
+
),
|
|
961
|
+
Quantity(
|
|
962
|
+
'energies',
|
|
963
|
+
rf'\s*{integer}\s*{integer}\s*{integer}\s*{integer}\s*{integer}\s*{integer}{br}'
|
|
964
|
+
+ rf'((?:{flt}\s?)+)',
|
|
965
|
+
str_operation=lambda x: x,
|
|
966
|
+
repeats=False,
|
|
967
|
+
),
|
|
968
|
+
]
|
|
969
|
+
),
|
|
970
|
+
repeats=True,
|
|
971
|
+
),
|
|
972
|
+
# DOS values
|
|
973
|
+
Quantity(
|
|
974
|
+
'dos',
|
|
975
|
+
rf'(-\%-0DOSS\s*{integer}\s*{integer}\s?{flt}\s?{flt}\s?{flt}{br}'
|
|
976
|
+
+ rf'\s*{flt}\s?{flt}{br}'
|
|
977
|
+
+ rf'\s*{integer}\s*{integer}\s*{integer}\s*{integer}\s*{integer}\s*{integer}{br}'
|
|
978
|
+
+ rf'(?:\s*{flt})+)',
|
|
979
|
+
sub_parser=TextParser(
|
|
980
|
+
quantities=[
|
|
981
|
+
Quantity(
|
|
982
|
+
'first_row',
|
|
983
|
+
rf'-\%-0DOSS\s*{integer_c}\s*{integer_c}\s?{flt_c}\s?{flt_c}\s?{flt_c}{br}',
|
|
984
|
+
repeats=False,
|
|
985
|
+
),
|
|
986
|
+
Quantity(
|
|
987
|
+
'second_row',
|
|
988
|
+
rf'\s?{flt_c}\s?{flt_c}{br}',
|
|
989
|
+
repeats=False,
|
|
990
|
+
),
|
|
991
|
+
Quantity(
|
|
992
|
+
'values',
|
|
993
|
+
rf'\s*{integer}\s*{integer}\s*{integer}\s*{integer}\s*{integer}\s*{integer}{br}'
|
|
994
|
+
+ rf'((?:\s*{flt})+)',
|
|
995
|
+
str_operation=lambda x: x,
|
|
996
|
+
repeats=False,
|
|
997
|
+
),
|
|
998
|
+
]
|
|
999
|
+
),
|
|
1000
|
+
repeats=False,
|
|
1001
|
+
),
|
|
1002
|
+
],
|
|
1003
|
+
)
|
|
1004
|
+
|
|
1005
|
+
return f25parser
|
|
1006
|
+
|
|
1007
|
+
def parse(self, filepath, archive, logger):
|
|
1008
|
+
# Read files
|
|
1009
|
+
out = self.parse_output(filepath)
|
|
1010
|
+
wrkdir, _ = os.path.split(filepath)
|
|
1011
|
+
f25_filepath1 = out['f25_filepath1']
|
|
1012
|
+
f25_filepath2 = out['f25_filepath2']
|
|
1013
|
+
f25_filepath_original = f25_filepath1 if f25_filepath1 else f25_filepath2
|
|
1014
|
+
f25 = None
|
|
1015
|
+
if f25_filepath_original is not None:
|
|
1016
|
+
_, f25_filename = os.path.split(f25_filepath_original)
|
|
1017
|
+
f25_filepath = os.path.join(wrkdir, f25_filename)
|
|
1018
|
+
if os.path.exists(f25_filepath):
|
|
1019
|
+
f25 = self.parse_f25(f25_filepath)
|
|
1020
|
+
|
|
1021
|
+
# Run
|
|
1022
|
+
run = Run()
|
|
1023
|
+
archive.run.append(run)
|
|
1024
|
+
run.program = Program(name='Crystal', version=out['program_version'])
|
|
1025
|
+
run.x_crystal_datetime = out['datetime']
|
|
1026
|
+
run.x_crystal_hostname = out['hostname']
|
|
1027
|
+
run.x_crystal_user = out['user']
|
|
1028
|
+
run.x_crystal_os = out['os']
|
|
1029
|
+
run.x_crystal_input_path = out['input_path']
|
|
1030
|
+
run.x_crystal_output_path = out['output_path']
|
|
1031
|
+
run.x_crystal_tmpdir = out['tmpdir']
|
|
1032
|
+
run.x_crystal_executable_path = out['executable_path']
|
|
1033
|
+
distribution = out['distribution']
|
|
1034
|
+
if distribution is not None:
|
|
1035
|
+
dist, minor = distribution.split(' : ', 1)
|
|
1036
|
+
run.x_crystal_distribution = dist
|
|
1037
|
+
run.x_crystal_version_minor = minor
|
|
1038
|
+
title = out['title']
|
|
1039
|
+
if title is not None:
|
|
1040
|
+
run.x_crystal_run_title = title.strip()
|
|
1041
|
+
run.time_run = TimeRun(
|
|
1042
|
+
date_start=to_unix_time(out['start_timestamp']),
|
|
1043
|
+
date_end=to_unix_time(out['end_timestamp']),
|
|
1044
|
+
)
|
|
1045
|
+
|
|
1046
|
+
# System. There are several alternative sources for this information
|
|
1047
|
+
# depending on the run type.
|
|
1048
|
+
system = System()
|
|
1049
|
+
run.system.append(system)
|
|
1050
|
+
system_edited = out['system_edited']
|
|
1051
|
+
labels_positions = out['labels_positions']
|
|
1052
|
+
lattice_vectors_restart = out['lattice_vectors_restart']
|
|
1053
|
+
dimensionality = out['dimensionality']
|
|
1054
|
+
if dimensionality == 0:
|
|
1055
|
+
pbc = np.zeros(3, dtype=bool)
|
|
1056
|
+
else:
|
|
1057
|
+
pbc = np.ones(3, dtype=bool)
|
|
1058
|
+
|
|
1059
|
+
# By default the system is read from the configuration at the beginning
|
|
1060
|
+
# of the file: it may come from restart or clean start
|
|
1061
|
+
atomic_numbers = None
|
|
1062
|
+
if labels_positions is not None:
|
|
1063
|
+
atomic_numbers = labels_positions[:, 2] # pylint: disable=E1136
|
|
1064
|
+
atom_labels = labels_positions[:, 3] # pylint: disable=E1136
|
|
1065
|
+
atom_pos = labels_positions[:, 4:7] # pylint: disable=E1136
|
|
1066
|
+
lattice = out['lattice_parameters']
|
|
1067
|
+
elif lattice_vectors_restart is not None:
|
|
1068
|
+
labels_positions = out['labels_positions_restart']
|
|
1069
|
+
atomic_numbers = labels_positions[:, 1] # pylint: disable=E1136
|
|
1070
|
+
atom_labels = labels_positions[:, 2] # pylint: disable=E1136
|
|
1071
|
+
atom_pos = labels_positions[:, 4:7] # pylint: disable=E1136
|
|
1072
|
+
lattice = lattice_vectors_restart
|
|
1073
|
+
|
|
1074
|
+
# If any geometry edits (supercells, substitutions, dispplacements,
|
|
1075
|
+
# deformations, nanotube construction, etc.) are done on top of the
|
|
1076
|
+
# original system, they override the original system.
|
|
1077
|
+
if system_edited is not None:
|
|
1078
|
+
if system_edited['labels_positions_nanotube'] is not None: # pylint: disable=E1136
|
|
1079
|
+
labels_positions = system_edited['labels_positions_nanotube'] # pylint: disable=E1136
|
|
1080
|
+
else:
|
|
1081
|
+
labels_positions = system_edited['labels_positions'] # pylint: disable=E1136
|
|
1082
|
+
# TODO adjust re pattern for other formats e.g. with R(ANGS)
|
|
1083
|
+
if labels_positions is not None:
|
|
1084
|
+
atomic_numbers = labels_positions[:, 2] # pylint: disable=E1136
|
|
1085
|
+
atom_labels = labels_positions[:, 3] # pylint: disable=E1136
|
|
1086
|
+
atom_pos = labels_positions[:, 4:7] # pylint: disable=E1136
|
|
1087
|
+
if system_edited['lattice_parameters'] is not None: # pylint: disable=E1136
|
|
1088
|
+
lattice = system_edited['lattice_parameters'] # pylint: disable=E1136
|
|
1089
|
+
|
|
1090
|
+
if atomic_numbers is None:
|
|
1091
|
+
# TODO define regex pattern for labels_positions to capture other versions
|
|
1092
|
+
logger.error('Error parsing system.')
|
|
1093
|
+
return
|
|
1094
|
+
|
|
1095
|
+
cart_pos, atomic_numbers, atom_labels, lattice_vectors = to_system(
|
|
1096
|
+
atomic_numbers,
|
|
1097
|
+
atom_labels,
|
|
1098
|
+
atom_pos,
|
|
1099
|
+
lattice,
|
|
1100
|
+
dimensionality,
|
|
1101
|
+
)
|
|
1102
|
+
|
|
1103
|
+
system.atoms = Atoms(
|
|
1104
|
+
lattice_vectors=lattice_vectors,
|
|
1105
|
+
periodic=pbc,
|
|
1106
|
+
positions=cart_pos,
|
|
1107
|
+
species=atomic_numbers,
|
|
1108
|
+
labels=atom_labels,
|
|
1109
|
+
)
|
|
1110
|
+
system.x_crystal_dimensionality = dimensionality
|
|
1111
|
+
crystal_family = out['crystal_family']
|
|
1112
|
+
system.x_crystal_family = crystal_family
|
|
1113
|
+
crystal_class = out['crystal_class']
|
|
1114
|
+
system.x_crystal_class = crystal_class
|
|
1115
|
+
n_symmops = out['n_symmops']
|
|
1116
|
+
system.x_crystal_n_symmops = n_symmops
|
|
1117
|
+
space_group = out['space_group']
|
|
1118
|
+
system.x_crystal_space_group = space_group
|
|
1119
|
+
|
|
1120
|
+
# Method
|
|
1121
|
+
method = Method()
|
|
1122
|
+
run.method.append(method)
|
|
1123
|
+
|
|
1124
|
+
# Basis set
|
|
1125
|
+
basis_set = out['basis_set']
|
|
1126
|
+
covered_species = set()
|
|
1127
|
+
section_basis_sets = []
|
|
1128
|
+
if basis_set is not None:
|
|
1129
|
+
for bs in basis_set['basis_sets']: # pylint: disable=E1136
|
|
1130
|
+
atomic_number = label_to_atomic_number(bs['species'][1])
|
|
1131
|
+
shells = bs['shells']
|
|
1132
|
+
if atomic_number != covered_species and shells is not None:
|
|
1133
|
+
section_basis_sets.append(
|
|
1134
|
+
BasisSetAtomCentered(
|
|
1135
|
+
atom_number=atomic_number,
|
|
1136
|
+
)
|
|
1137
|
+
)
|
|
1138
|
+
covered_species.add(atomic_number)
|
|
1139
|
+
for shell in shells:
|
|
1140
|
+
section_shell = x_crystal_section_shell(
|
|
1141
|
+
x_crystal_shell_range=str(shell['shell_range']),
|
|
1142
|
+
x_crystal_shell_type=shell['shell_type'],
|
|
1143
|
+
x_crystal_shell_coefficients=np.array(
|
|
1144
|
+
shell['shell_coefficients']
|
|
1145
|
+
),
|
|
1146
|
+
)
|
|
1147
|
+
section_basis_sets[-1].x_crystal_section_shell.append(
|
|
1148
|
+
section_shell
|
|
1149
|
+
)
|
|
1150
|
+
|
|
1151
|
+
method.electrons_representation = [
|
|
1152
|
+
BasisSetContainer(
|
|
1153
|
+
type='atom-centered orbitals',
|
|
1154
|
+
scope=['wavefunction'],
|
|
1155
|
+
basis_set=[
|
|
1156
|
+
BasisSet(
|
|
1157
|
+
type='gaussians', # the scope can fluctuate depending on the use of ECPs
|
|
1158
|
+
atom_centered=section_basis_sets,
|
|
1159
|
+
)
|
|
1160
|
+
],
|
|
1161
|
+
)
|
|
1162
|
+
]
|
|
1163
|
+
|
|
1164
|
+
method.electronic = Electronic(method='DFT')
|
|
1165
|
+
method.scf = Scf(
|
|
1166
|
+
n_max_iteration=out['scf_max_iteration'],
|
|
1167
|
+
threshold_energy_change=out['scf_threshold_energy_change'],
|
|
1168
|
+
)
|
|
1169
|
+
dftd3 = out['dftd3']
|
|
1170
|
+
if dftd3:
|
|
1171
|
+
if dftd3['version'] == 'VERSION 2': # pylint: disable=E1136
|
|
1172
|
+
method.electronic.van_der_waals_method = 'G06'
|
|
1173
|
+
else:
|
|
1174
|
+
method.electronic.van_der_waals_method = 'DFT-D3'
|
|
1175
|
+
if out['grimme']:
|
|
1176
|
+
method.electronic.van_der_waals_method = 'G06'
|
|
1177
|
+
|
|
1178
|
+
def add_functionals(functionals):
|
|
1179
|
+
for functional in functionals:
|
|
1180
|
+
if '_X_' in functional.name:
|
|
1181
|
+
method.dft.xc_functional.exchange.append(functional)
|
|
1182
|
+
elif '_C_' in functional.name:
|
|
1183
|
+
method.dft.xc_functional.correlation.append(functional)
|
|
1184
|
+
elif '_XC_' in functional.name or 'HYB' in functional.name:
|
|
1185
|
+
method.dft.xc_functional.hybrid.append(functional)
|
|
1186
|
+
else:
|
|
1187
|
+
method.dft.xc_functional.contributions.append(functional)
|
|
1188
|
+
|
|
1189
|
+
# Try to primarily read the methodology from input
|
|
1190
|
+
method.dft = DFT(xc_functional=XCFunctional())
|
|
1191
|
+
dft = out['dft']
|
|
1192
|
+
if dft:
|
|
1193
|
+
exchange = dft['exchange'] # pylint: disable=E1136
|
|
1194
|
+
correlation = dft['correlation'] # pylint: disable=E1136
|
|
1195
|
+
exchange_correlation = dft['exchange_correlation'] # pylint: disable=E1136
|
|
1196
|
+
functionals = to_libxc(exchange, correlation, exchange_correlation)
|
|
1197
|
+
if functionals:
|
|
1198
|
+
add_functionals(functionals)
|
|
1199
|
+
method.dft.xc_functional.name = to_libxc_name(functionals)
|
|
1200
|
+
|
|
1201
|
+
# If methodology not reported in input, try to read from output
|
|
1202
|
+
if dft is None or not functionals:
|
|
1203
|
+
hamiltonian_type = out['hamiltonian_type']
|
|
1204
|
+
if hamiltonian_type == 'HARTREE-FOCK HAMILTONIAN':
|
|
1205
|
+
xc = Functional(name='HF_X', weight=1.0)
|
|
1206
|
+
method.dft.xc_functional.exchange.append(xc)
|
|
1207
|
+
method.dft.xc_functional.name = to_libxc_name([xc])
|
|
1208
|
+
elif hamiltonian_type == 'KOHN-SHAM HAMILTONIAN':
|
|
1209
|
+
xc_output = out['xc_out']
|
|
1210
|
+
hybrid = out['hybrid_out']
|
|
1211
|
+
functionals = to_libxc_out(xc_output, hybrid)
|
|
1212
|
+
if functionals:
|
|
1213
|
+
add_functionals(functionals)
|
|
1214
|
+
method.dft.xc_functional.name = to_libxc_name(functionals)
|
|
1215
|
+
|
|
1216
|
+
method.x_crystal_fock_ks_matrix_mixing = out['fock_ks_matrix_mixing']
|
|
1217
|
+
method.x_crystal_coulomb_bipolar_buffer = out['coulomb_bipolar_buffer']
|
|
1218
|
+
method.x_crystal_exchange_bipolar_buffer = out['exchange_bipolar_buffer']
|
|
1219
|
+
method.x_crystal_toldee = out['toldee']
|
|
1220
|
+
method.x_crystal_n_atoms = out['n_atoms_per_cell']
|
|
1221
|
+
method.x_crystal_n_shells = out['n_shells']
|
|
1222
|
+
method.x_crystal_n_orbitals = out['n_ao']
|
|
1223
|
+
method.x_crystal_n_electrons = out['n_electrons']
|
|
1224
|
+
method.x_crystal_n_core_electrons = out['n_core_electrons']
|
|
1225
|
+
method.x_crystal_n_symmops = out['n_symmops']
|
|
1226
|
+
method.x_crystal_tol_coulomb_overlap = out['tol_coulomb_overlap']
|
|
1227
|
+
method.x_crystal_tol_coulomb_penetration = out['tol_coulomb_penetration']
|
|
1228
|
+
method.x_crystal_tol_exchange_overlap = out['tol_exchange_overlap']
|
|
1229
|
+
method.x_crystal_tol_pseudo_overlap_f = out['tol_pseudo_overlap_f']
|
|
1230
|
+
method.x_crystal_tol_pseudo_overlap_p = out['tol_pseudo_overlap_p']
|
|
1231
|
+
method.x_crystal_pole_order = out['pole_order']
|
|
1232
|
+
method.x_crystal_type_of_calculation = out['calculation_type']
|
|
1233
|
+
cappa = out['cappa']
|
|
1234
|
+
if cappa is not None:
|
|
1235
|
+
method.x_crystal_is1 = cappa[0] # pylint: disable=E1136
|
|
1236
|
+
method.x_crystal_is2 = cappa[1] # pylint: disable=E1136
|
|
1237
|
+
method.x_crystal_is3 = cappa[2] # pylint: disable=E1136
|
|
1238
|
+
method.x_crystal_k_pts_monk_net = cappa[3] # pylint: disable=E1136
|
|
1239
|
+
method.x_crystal_symmops_k = cappa[4] # pylint: disable=E1136
|
|
1240
|
+
method.x_crystal_symmops_g = cappa[5] # pylint: disable=E1136
|
|
1241
|
+
method.x_crystal_weight_f = out['weight_f']
|
|
1242
|
+
method.x_crystal_shrink = out['shrink']
|
|
1243
|
+
method.x_crystal_shrink_gilat = out['shrink_gilat']
|
|
1244
|
+
method.x_crystal_convergence_deltap = out['convergenge_deltap']
|
|
1245
|
+
method.x_crystal_n_k_points_ibz = out['n_k_points_ibz']
|
|
1246
|
+
method.x_crystal_n_k_points_gilat = out['n_k_points_gilat']
|
|
1247
|
+
|
|
1248
|
+
# SCC
|
|
1249
|
+
scc = Calculation()
|
|
1250
|
+
run.calculation.append(scc)
|
|
1251
|
+
scf_block = out['scf_block']
|
|
1252
|
+
if scf_block is not None:
|
|
1253
|
+
number_of_scf_iterations = out['number_of_scf_iterations']
|
|
1254
|
+
scc.calculation_converged = number_of_scf_iterations is not None
|
|
1255
|
+
for scf in scf_block['scf_iterations']: # pylint: disable=E1136
|
|
1256
|
+
energies = scf['energies']
|
|
1257
|
+
section_scf = ScfIteration()
|
|
1258
|
+
scc.scf_iteration.append(section_scf)
|
|
1259
|
+
section_scf.energy = Energy()
|
|
1260
|
+
if energies is not None:
|
|
1261
|
+
section_scf.energy.total = EnergyEntry(value=energies[0])
|
|
1262
|
+
section_scf.energy.change = energies[1]
|
|
1263
|
+
energy_kinetic = scf['energy_kinetic']
|
|
1264
|
+
section_scf.energy.electronic_kinetic = EnergyEntry(
|
|
1265
|
+
value=energy_kinetic
|
|
1266
|
+
)
|
|
1267
|
+
energy_ee = scf['energy_ee']
|
|
1268
|
+
section_scf.x_crystal_scf_energy_ee = energy_ee
|
|
1269
|
+
energy_en_ne = scf['energy_en_ne']
|
|
1270
|
+
section_scf.x_crystal_scf_energy_en_ne = energy_en_ne
|
|
1271
|
+
energy_nn = scf['energy_nn']
|
|
1272
|
+
section_scf.x_crystal_scf_energy_nn = energy_nn
|
|
1273
|
+
virial_coefficient = scf['virial_coefficient']
|
|
1274
|
+
section_scf.x_crystal_scf_virial_coefficient = virial_coefficient
|
|
1275
|
+
scc.n_scf_iterations = len(scc.scf_iteration)
|
|
1276
|
+
|
|
1277
|
+
if out['energy_total'] is not None:
|
|
1278
|
+
# If the final energy is found, replace the final SCF step energy
|
|
1279
|
+
# with it, as it is more accurate.
|
|
1280
|
+
if scc.scf_iteration:
|
|
1281
|
+
scc.scf_iteration[-1].energy.total = EnergyEntry(
|
|
1282
|
+
value=out['energy_total']
|
|
1283
|
+
)
|
|
1284
|
+
scc.energy = Energy(total=EnergyEntry(value=out['energy_total']))
|
|
1285
|
+
forces = out['forces']
|
|
1286
|
+
if forces is not None:
|
|
1287
|
+
scc.forces = Forces(
|
|
1288
|
+
total=ForcesEntry(
|
|
1289
|
+
value=forces[:, 2:].astype(float) * ureg.hartree / ureg.bohr
|
|
1290
|
+
)
|
|
1291
|
+
) # pylint: disable=E1136
|
|
1292
|
+
scc.system_ref = system
|
|
1293
|
+
scc.method_ref = method
|
|
1294
|
+
|
|
1295
|
+
# Band structure
|
|
1296
|
+
band_structure = out['band_structure']
|
|
1297
|
+
if band_structure is not None:
|
|
1298
|
+
section_band = BandStructure()
|
|
1299
|
+
scc.band_structure_electronic.append(section_band)
|
|
1300
|
+
section_band.reciprocal_cell = (
|
|
1301
|
+
atomutils.reciprocal_cell(system.atoms.lattice_vectors.magnitude)
|
|
1302
|
+
* 1
|
|
1303
|
+
/ ureg.meter
|
|
1304
|
+
)
|
|
1305
|
+
segments = band_structure['segments'] # pylint: disable=E1136
|
|
1306
|
+
k_points = to_k_points(segments)
|
|
1307
|
+
for i_seg, segment in enumerate(segments):
|
|
1308
|
+
section_segment = BandEnergies()
|
|
1309
|
+
section_band.segment.append(section_segment)
|
|
1310
|
+
_ = segment['start_end']
|
|
1311
|
+
section_segment.kpoints = k_points[i_seg]
|
|
1312
|
+
section_segment.n_kpoints = k_points[i_seg].shape[0]
|
|
1313
|
+
|
|
1314
|
+
# Read energies from the f25-file. If the file is not found, the
|
|
1315
|
+
# band structure is not written in the archive. The meaning of the
|
|
1316
|
+
# values is given in an appendix of the Crystal manual.
|
|
1317
|
+
if f25 is not None:
|
|
1318
|
+
segments = f25.segments
|
|
1319
|
+
prev_energy = None
|
|
1320
|
+
prev_k_point = None
|
|
1321
|
+
first_row = segments[0]['first_row']
|
|
1322
|
+
fermi_energy = first_row[4]
|
|
1323
|
+
if scc.energy is None:
|
|
1324
|
+
scc.energy = Energy()
|
|
1325
|
+
scc.energy.fermi = fermi_energy * ureg.hartree
|
|
1326
|
+
for i_seg, segment in enumerate(segments):
|
|
1327
|
+
first_row = segment['first_row']
|
|
1328
|
+
cols = int(first_row[0])
|
|
1329
|
+
rows = int(first_row[1])
|
|
1330
|
+
energies = segment['energies']
|
|
1331
|
+
energies = to_array(cols, rows, energies)
|
|
1332
|
+
|
|
1333
|
+
# If a segment starts from the previous point, then
|
|
1334
|
+
# re-report the energy. This way segments get the same
|
|
1335
|
+
# treatment in the metainfo whether they are continuous
|
|
1336
|
+
# or not.
|
|
1337
|
+
start_k_point = section_band.segment[i_seg].kpoints[0]
|
|
1338
|
+
end_k_point = section_band.segment[i_seg].kpoints[-1]
|
|
1339
|
+
if prev_k_point is not None and np.allclose(
|
|
1340
|
+
prev_k_point, start_k_point
|
|
1341
|
+
):
|
|
1342
|
+
energies = np.concatenate(([prev_energy], energies), axis=0)
|
|
1343
|
+
section_band.segment[i_seg].energies = (
|
|
1344
|
+
energies[None, :] * ureg.hartree
|
|
1345
|
+
)
|
|
1346
|
+
prev_energy = energies[-1]
|
|
1347
|
+
prev_k_point = end_k_point
|
|
1348
|
+
|
|
1349
|
+
# DOS
|
|
1350
|
+
dos = out['dos']
|
|
1351
|
+
if dos is not None:
|
|
1352
|
+
# Read values and energies from the f25-file. If the file is not
|
|
1353
|
+
# found, the dos is not written in the archive. The meaning of the
|
|
1354
|
+
# values is given in an appendix of the Crystal manual.
|
|
1355
|
+
if f25 is not None:
|
|
1356
|
+
dos_f25 = f25['dos']
|
|
1357
|
+
if dos_f25 is not None:
|
|
1358
|
+
scc_dos = Calculation()
|
|
1359
|
+
run.calculation.append(scc_dos)
|
|
1360
|
+
scc_dos.system_ref = system
|
|
1361
|
+
scc_dos.method_ref = method
|
|
1362
|
+
scc_dos.energy = Energy(fermi=fermi_energy * ureg.hartree)
|
|
1363
|
+
# Getting row information
|
|
1364
|
+
first_row = dos_f25['first_row']
|
|
1365
|
+
cols = int(first_row[0])
|
|
1366
|
+
rows = int(first_row[1])
|
|
1367
|
+
de = first_row[3]
|
|
1368
|
+
fermi_energy = first_row[4]
|
|
1369
|
+
second_row = dos_f25['second_row']
|
|
1370
|
+
start_energy = second_row[1]
|
|
1371
|
+
dos_values = to_array(cols, rows, dos_f25['values'])
|
|
1372
|
+
dos_values = dos_values.T
|
|
1373
|
+
# Writing into the arhcive
|
|
1374
|
+
n_spin_channels = len(dos_values)
|
|
1375
|
+
for spin in range(n_spin_channels):
|
|
1376
|
+
sec_dos = Dos()
|
|
1377
|
+
scc_dos.dos_electronic.append(sec_dos)
|
|
1378
|
+
sec_dos.spin_channel = spin if n_spin_channels == 2 else None
|
|
1379
|
+
sec_dos.energies = (
|
|
1380
|
+
start_energy + np.arange(rows) * de
|
|
1381
|
+
) * ureg.hartree
|
|
1382
|
+
sec_dos_total = DosValues()
|
|
1383
|
+
sec_dos.total.append(sec_dos_total)
|
|
1384
|
+
sec_dos_total.value = dos_values[spin]
|
|
1385
|
+
|
|
1386
|
+
# Sampling
|
|
1387
|
+
geo_opt = out['geo_opt']
|
|
1388
|
+
if geo_opt is not None:
|
|
1389
|
+
steps = geo_opt['geo_opt_step'] # pylint: disable=E1136
|
|
1390
|
+
if steps is not None:
|
|
1391
|
+
archive.workflow2 = GeometryOptimization(
|
|
1392
|
+
method=GeometryOptimizationMethod(),
|
|
1393
|
+
results=GeometryOptimizationResults(),
|
|
1394
|
+
)
|
|
1395
|
+
archive.workflow2.method.convergence_tolerance_energy_difference = out[
|
|
1396
|
+
'energy_change'
|
|
1397
|
+
]
|
|
1398
|
+
archive.workflow2.method.convergence_tolerance_displacement_maximum = (
|
|
1399
|
+
out['geometry_change']
|
|
1400
|
+
)
|
|
1401
|
+
|
|
1402
|
+
# First step is special: it refers to the initial system which
|
|
1403
|
+
# was printed before entering the geometry optimization loop.
|
|
1404
|
+
i_system = system
|
|
1405
|
+
i_energy = steps[0]['energy']
|
|
1406
|
+
scc.energy.total = EnergyEntry(value=i_energy)
|
|
1407
|
+
scc.time_physical = steps[0]['time_physical']
|
|
1408
|
+
scc.time_calculation = steps[0]['time_physical']
|
|
1409
|
+
|
|
1410
|
+
frames = []
|
|
1411
|
+
for step in steps[1:]:
|
|
1412
|
+
i_scc = Calculation()
|
|
1413
|
+
run.calculation.append(i_scc)
|
|
1414
|
+
i_system = System()
|
|
1415
|
+
run.system.append(i_system)
|
|
1416
|
+
i_energy = step['energy']
|
|
1417
|
+
if step['labels_positions_nanotube'] is not None:
|
|
1418
|
+
i_labels_positions = step['labels_positions_nanotube']
|
|
1419
|
+
else:
|
|
1420
|
+
i_labels_positions = step['labels_positions']
|
|
1421
|
+
i_atomic_numbers = i_labels_positions[:, 2]
|
|
1422
|
+
i_atom_labels = i_labels_positions[:, 3]
|
|
1423
|
+
i_atom_pos = i_labels_positions[:, 4:7]
|
|
1424
|
+
i_lattice_parameters = step['lattice_parameters']
|
|
1425
|
+
(
|
|
1426
|
+
i_cart_pos,
|
|
1427
|
+
i_atomic_numbers,
|
|
1428
|
+
i_atom_labels,
|
|
1429
|
+
i_lattice_vectors,
|
|
1430
|
+
) = to_system(
|
|
1431
|
+
i_atomic_numbers,
|
|
1432
|
+
i_atom_labels,
|
|
1433
|
+
i_atom_pos,
|
|
1434
|
+
i_lattice_parameters,
|
|
1435
|
+
dimensionality,
|
|
1436
|
+
)
|
|
1437
|
+
i_system.atoms = Atoms(
|
|
1438
|
+
species=i_atomic_numbers,
|
|
1439
|
+
labels=i_atom_labels,
|
|
1440
|
+
positions=i_cart_pos,
|
|
1441
|
+
lattice_vectors=i_lattice_vectors,
|
|
1442
|
+
periodic=pbc,
|
|
1443
|
+
)
|
|
1444
|
+
i_scc.energy = Energy(total=EnergyEntry(value=i_energy))
|
|
1445
|
+
|
|
1446
|
+
i_scc.system_ref = i_system
|
|
1447
|
+
i_scc.method_ref = method
|
|
1448
|
+
i_scc.time_physical = step['time_physical']
|
|
1449
|
+
if i_scc.time_physical:
|
|
1450
|
+
i_scc.time_calculation = (
|
|
1451
|
+
i_scc.time_physical - run.calculation[-2].time_physical
|
|
1452
|
+
)
|
|
1453
|
+
|
|
1454
|
+
frames.append(i_scc)
|
|
1455
|
+
if frames:
|
|
1456
|
+
i_scc.time_physical = out['time_end'][-1]
|
|
1457
|
+
i_scc.time_calculation = (
|
|
1458
|
+
i_scc.time_physical - run.calculation[-2].time_physical
|
|
1459
|
+
)
|
|
1460
|
+
|
|
1461
|
+
archive.workflow2.results.is_converged_geometry = (
|
|
1462
|
+
geo_opt['converged'] == 'CONVERGED'
|
|
1463
|
+
) # pylint: disable=E1136
|
|
1464
|
+
|
|
1465
|
+
# Remove ghost atom information. The metainfo does not provide a very
|
|
1466
|
+
# good way to deal with them currently so they are simply removed.
|
|
1467
|
+
remove_ghosts(run)
|
|
1468
|
+
|
|
1469
|
+
|
|
1470
|
+
def to_k_points(segments):
|
|
1471
|
+
"""Converts the given start and end points, the shrinking factor and the
|
|
1472
|
+
number of steps into a list of concrete sampling points in k-space. The
|
|
1473
|
+
shrinking factor tells to how many portions one reciprocal basis vector is
|
|
1474
|
+
divided into. This needs to be done manually as sometimes the k-points are
|
|
1475
|
+
not reported in the output.
|
|
1476
|
+
"""
|
|
1477
|
+
all_k_points = []
|
|
1478
|
+
prev_point = None
|
|
1479
|
+
for segment in segments:
|
|
1480
|
+
start = segment['start_end'][0, :]
|
|
1481
|
+
end = segment['start_end'][1, :]
|
|
1482
|
+
shrinking_factor = segment['shrinking_factor']
|
|
1483
|
+
n_steps = segment['n_steps']
|
|
1484
|
+
|
|
1485
|
+
# Segments that do not start from a previous segment get special
|
|
1486
|
+
# treatment.
|
|
1487
|
+
end_idx = n_steps + 1
|
|
1488
|
+
if prev_point is None or not np.allclose(prev_point, start):
|
|
1489
|
+
end_idx = n_steps
|
|
1490
|
+
n_steps = n_steps - 1
|
|
1491
|
+
|
|
1492
|
+
delta = end - start
|
|
1493
|
+
start_step = (shrinking_factor * start).astype(np.int32)
|
|
1494
|
+
step_size = (shrinking_factor * delta / n_steps).astype(np.int32)
|
|
1495
|
+
steps = start_step + step_size * np.arange(0, end_idx)[:, None]
|
|
1496
|
+
k_points = steps / shrinking_factor
|
|
1497
|
+
all_k_points.append(k_points)
|
|
1498
|
+
prev_point = end
|
|
1499
|
+
|
|
1500
|
+
return all_k_points
|
|
1501
|
+
|
|
1502
|
+
|
|
1503
|
+
def to_system(atomic_numbers, labels, positions, lattice, dimensionality):
|
|
1504
|
+
"""Converts a Crystal structure format, i.e. scaled for axes with PBC
|
|
1505
|
+
and Cartesian for the rest, to fully Cartesian positions and lattice vectors, if present.
|
|
1506
|
+
The conversion depends on the dimensionality.
|
|
1507
|
+
"""
|
|
1508
|
+
atomic_numbers = std_atomic_number(atomic_numbers.astype(np.int32))
|
|
1509
|
+
atom_labels = std_label(labels)
|
|
1510
|
+
positions = positions.astype(np.float64)
|
|
1511
|
+
|
|
1512
|
+
# Get the lattice vectors
|
|
1513
|
+
lattice_vectors = None
|
|
1514
|
+
if lattice is not None:
|
|
1515
|
+
if lattice.shape == (6,):
|
|
1516
|
+
lattice_vectors = atomutils.cellpar_to_cell(lattice, degrees=True)
|
|
1517
|
+
elif lattice.shape == (3, 3):
|
|
1518
|
+
lattice_vectors = lattice
|
|
1519
|
+
|
|
1520
|
+
# Convert positions based on the given type
|
|
1521
|
+
n_atoms = atomic_numbers.shape[0]
|
|
1522
|
+
scaled_pos = np.zeros((n_atoms, 3), dtype=np.float64)
|
|
1523
|
+
scaled_pos[:, :dimensionality] = positions[:, :dimensionality]
|
|
1524
|
+
if lattice_vectors is not None:
|
|
1525
|
+
cart_pos = atomutils.to_cartesian(scaled_pos, lattice_vectors)
|
|
1526
|
+
cart_pos[:, dimensionality:] = positions[:, dimensionality:]
|
|
1527
|
+
else:
|
|
1528
|
+
cart_pos = scaled_pos
|
|
1529
|
+
|
|
1530
|
+
if lattice_vectors is not None:
|
|
1531
|
+
lattice_vectors *= ureg.angstrom
|
|
1532
|
+
|
|
1533
|
+
return cart_pos * ureg.angstrom, atomic_numbers, atom_labels, lattice_vectors
|
|
1534
|
+
|
|
1535
|
+
|
|
1536
|
+
def to_float(value):
|
|
1537
|
+
"""Transforms the Crystal-specific float notation into a floating point
|
|
1538
|
+
number.
|
|
1539
|
+
"""
|
|
1540
|
+
base, exponent = value.split('**')
|
|
1541
|
+
base = int(base)
|
|
1542
|
+
exponent = int(''.join(exponent.split()))
|
|
1543
|
+
return pow(base, exponent)
|
|
1544
|
+
|
|
1545
|
+
|
|
1546
|
+
def to_array(cols, rows, values):
|
|
1547
|
+
"""Transforms the Crystal-specific f25 array syntax into a numpy array."""
|
|
1548
|
+
values = values.replace('\n', '').replace('\r', '')
|
|
1549
|
+
values = [values[n: n + 12] for n in range(0, len(values), 12)]
|
|
1550
|
+
# does not seem to work
|
|
1551
|
+
# values = textwrap.wrap(values, 12)
|
|
1552
|
+
values = np.array(values, dtype=np.float64)
|
|
1553
|
+
values = values.reshape((rows, cols))
|
|
1554
|
+
return values
|
|
1555
|
+
|
|
1556
|
+
|
|
1557
|
+
def std_atomic_number(value):
|
|
1558
|
+
"""Given an atomic numer in the NAT form (conventional atomic number, where
|
|
1559
|
+
the real atomic number is the remainder when divided by 100), return the
|
|
1560
|
+
actual atomic number.
|
|
1561
|
+
"""
|
|
1562
|
+
return value % 100
|
|
1563
|
+
|
|
1564
|
+
|
|
1565
|
+
def remove_ghosts(run):
|
|
1566
|
+
"""Removes ghost atoms from the given section_system. In Crystal ghost
|
|
1567
|
+
atoms are indicated by the atomic number 0.
|
|
1568
|
+
"""
|
|
1569
|
+
for system in run.system:
|
|
1570
|
+
ghosts_mask = system.atoms.species == 0
|
|
1571
|
+
if np.any(ghosts_mask):
|
|
1572
|
+
system.atoms.species = np.delete(system.atoms.species, ghosts_mask)
|
|
1573
|
+
system.atoms.labels = np.delete(system.atoms.labels, ghosts_mask)
|
|
1574
|
+
system.atoms.positions = np.delete(
|
|
1575
|
+
system.atoms.positions.magnitude, ghosts_mask, axis=0
|
|
1576
|
+
)
|
|
1577
|
+
|
|
1578
|
+
|
|
1579
|
+
def label_to_atomic_number(value):
|
|
1580
|
+
"""Given a Crystal specific uppercase species name, returns the
|
|
1581
|
+
corresponding atomic number.
|
|
1582
|
+
"""
|
|
1583
|
+
symbol = value.lower().capitalize()
|
|
1584
|
+
atomic_number = ase.data.atomic_numbers.get(symbol, 0)
|
|
1585
|
+
return atomic_number
|
|
1586
|
+
|
|
1587
|
+
|
|
1588
|
+
def atomic_numbers_to_labels(value):
|
|
1589
|
+
"""Given a NAT atomic number, returns the
|
|
1590
|
+
corresponding label.
|
|
1591
|
+
"""
|
|
1592
|
+
atomic_numbers = std_atomic_number(value)
|
|
1593
|
+
labels = np.array(ase.data.chemical_symbols)[atomic_numbers]
|
|
1594
|
+
return labels
|
|
1595
|
+
|
|
1596
|
+
|
|
1597
|
+
def std_label(value):
|
|
1598
|
+
"""Given Crystal specific uppercase species names, returns the capitalized
|
|
1599
|
+
versions.
|
|
1600
|
+
"""
|
|
1601
|
+
labels = []
|
|
1602
|
+
for label in value:
|
|
1603
|
+
labels.append(label.lower().capitalize())
|
|
1604
|
+
return labels
|
|
1605
|
+
|
|
1606
|
+
|
|
1607
|
+
def to_unix_time(value):
|
|
1608
|
+
"""Transforms the Crystal-specific float notation into a floating point
|
|
1609
|
+
number.
|
|
1610
|
+
"""
|
|
1611
|
+
if value is None:
|
|
1612
|
+
return None
|
|
1613
|
+
|
|
1614
|
+
value = value.strip()
|
|
1615
|
+
date_time_obj = datetime.datetime.strptime(value, '%d %m %Y TIME %H:%M:%S.%f')
|
|
1616
|
+
return date_time_obj.timestamp()
|
|
1617
|
+
|
|
1618
|
+
|
|
1619
|
+
def to_libxc(exchange, correlation, exchange_correlation):
|
|
1620
|
+
"""Transforms the Crystal-specific XC naming into a list of
|
|
1621
|
+
section_XC_functionals.
|
|
1622
|
+
"""
|
|
1623
|
+
xc_list = []
|
|
1624
|
+
|
|
1625
|
+
# Handle the XC's defined with single shortcut
|
|
1626
|
+
if exchange_correlation:
|
|
1627
|
+
exchange_correlation = exchange_correlation.upper()
|
|
1628
|
+
shortcut_map = {
|
|
1629
|
+
'PBEXC': ['GGA_C_PBE', 'GGA_X_PBE'],
|
|
1630
|
+
'PBE0': ['HYB_GGA_XC_PBEH'],
|
|
1631
|
+
'B3LYP': ['HYB_GGA_XC_B3LYP'],
|
|
1632
|
+
'HSE06': ['HYB_GGA_XC_HSE06'],
|
|
1633
|
+
'M06': ['MGGA_C_M06', 'HYB_MGGA_X_M06'],
|
|
1634
|
+
'M05-2X': ['HYB_MGGA_XC_M05_2X'],
|
|
1635
|
+
'LC-WPBE': ['HYB_GGA_XC_LRC_WPBE'],
|
|
1636
|
+
}
|
|
1637
|
+
norm_xc = shortcut_map.get(exchange_correlation)
|
|
1638
|
+
if norm_xc:
|
|
1639
|
+
xc_list.extend(norm_xc)
|
|
1640
|
+
|
|
1641
|
+
# Handle the exchange part
|
|
1642
|
+
if exchange:
|
|
1643
|
+
exchange = exchange.upper()
|
|
1644
|
+
exchange_map = {
|
|
1645
|
+
'PBE': 'GGA_X_PBE',
|
|
1646
|
+
'PBESOL': 'GGA_X_PBE_SOL',
|
|
1647
|
+
'BECKE': 'GGA_X_B88',
|
|
1648
|
+
'LDA': 'LDA_X',
|
|
1649
|
+
'PWGGA': 'GGA_X_PW91',
|
|
1650
|
+
}
|
|
1651
|
+
norm_x = exchange_map.get(exchange)
|
|
1652
|
+
if norm_x:
|
|
1653
|
+
xc_list.append(norm_x)
|
|
1654
|
+
|
|
1655
|
+
# Handle the correlation part
|
|
1656
|
+
if correlation:
|
|
1657
|
+
correlation = correlation.upper()
|
|
1658
|
+
correlation_map = {
|
|
1659
|
+
'PBE': 'GGA_C_PBE',
|
|
1660
|
+
'PBESOL': 'GGA_C_PBE_SOL',
|
|
1661
|
+
'PZ': 'LDA_C_PZ',
|
|
1662
|
+
'WFN': 'LDA_C_VWN',
|
|
1663
|
+
'PWGGA': 'GGA_C_PW91',
|
|
1664
|
+
}
|
|
1665
|
+
norm_c = correlation_map.get(correlation)
|
|
1666
|
+
if norm_c:
|
|
1667
|
+
xc_list.append(norm_c)
|
|
1668
|
+
|
|
1669
|
+
# Go throught the XC list and add the sections and gather a summary
|
|
1670
|
+
functionals = []
|
|
1671
|
+
for xc in xc_list:
|
|
1672
|
+
section = Functional()
|
|
1673
|
+
weight = 1.0
|
|
1674
|
+
section.name = xc
|
|
1675
|
+
section.weight = weight
|
|
1676
|
+
functionals.append(section)
|
|
1677
|
+
|
|
1678
|
+
return functionals
|
|
1679
|
+
|
|
1680
|
+
|
|
1681
|
+
def to_libxc_out(xc_output, hybridization):
|
|
1682
|
+
"""Transforms the Crystal-specific XC naming in the output into a list of
|
|
1683
|
+
section_XC_functionals.
|
|
1684
|
+
"""
|
|
1685
|
+
xc_list = []
|
|
1686
|
+
exchange, correlation = xc_output[1:-1].split(')[')
|
|
1687
|
+
|
|
1688
|
+
# Handle the exchange part
|
|
1689
|
+
if exchange:
|
|
1690
|
+
exchange = exchange.upper()
|
|
1691
|
+
exchange_map = {
|
|
1692
|
+
'PERDEW-BURKE-ERNZERHOF': 'GGA_X_PBE',
|
|
1693
|
+
'PERDEW-WANG GGA': 'GGA_X_PW91',
|
|
1694
|
+
'WU-COHEN GGA': 'GGA_X_WC',
|
|
1695
|
+
}
|
|
1696
|
+
norm_x = exchange_map.get(exchange)
|
|
1697
|
+
if norm_x:
|
|
1698
|
+
xc_list.append(norm_x)
|
|
1699
|
+
|
|
1700
|
+
# Handle the correlation part
|
|
1701
|
+
if correlation:
|
|
1702
|
+
correlation = correlation.upper()
|
|
1703
|
+
correlation_map = {
|
|
1704
|
+
'PERDEW-BURKE-ERNZERHOF': 'GGA_C_PBE',
|
|
1705
|
+
'PERDEW-WANG GGA': 'GGA_C_PW91',
|
|
1706
|
+
'LEE-YANG-PARR': 'GGA_C_LYP',
|
|
1707
|
+
}
|
|
1708
|
+
norm_c = correlation_map.get(correlation)
|
|
1709
|
+
if norm_c:
|
|
1710
|
+
xc_list.append(norm_c)
|
|
1711
|
+
|
|
1712
|
+
# Shortcuts
|
|
1713
|
+
if norm_x == 'GGA_X_PBE' and norm_c == 'GGA_C_PBE' and hybridization == 25.00:
|
|
1714
|
+
section = Functional()
|
|
1715
|
+
section.name = 'HYB_GGA_XC_PBEH'
|
|
1716
|
+
section.weight = 1
|
|
1717
|
+
return [section]
|
|
1718
|
+
|
|
1719
|
+
# Go throught the XC list and add the sections and gather a summary
|
|
1720
|
+
functionals = []
|
|
1721
|
+
if hybridization:
|
|
1722
|
+
section = Functional()
|
|
1723
|
+
section.name = 'HF_X'
|
|
1724
|
+
section.weight = float(hybridization) / 100
|
|
1725
|
+
functionals.append(section)
|
|
1726
|
+
for xc in xc_list:
|
|
1727
|
+
section = Functional()
|
|
1728
|
+
weight = 1.0
|
|
1729
|
+
if hybridization and '_X_' in xc:
|
|
1730
|
+
weight = 1.0 - float(hybridization) / 100
|
|
1731
|
+
section.name = xc
|
|
1732
|
+
section.weight = weight
|
|
1733
|
+
functionals.append(section)
|
|
1734
|
+
|
|
1735
|
+
return functionals
|
|
1736
|
+
|
|
1737
|
+
|
|
1738
|
+
def to_libxc_name(functionals):
|
|
1739
|
+
"""Given a list of section_XC_functionals, returns the single string that
|
|
1740
|
+
represents them all.
|
|
1741
|
+
"""
|
|
1742
|
+
return '+'.join(
|
|
1743
|
+
'{}*{}'.format(x.weight, x.name)
|
|
1744
|
+
for x in sorted(functionals, key=lambda x: x.name)
|
|
1745
|
+
)
|