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,671 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright The NOMAD Authors.
|
|
3
|
+
#
|
|
4
|
+
# This file is part of NOMAD.
|
|
5
|
+
# See https://nomad-lab.eu for further info.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
import os
|
|
20
|
+
import logging
|
|
21
|
+
import numpy as np
|
|
22
|
+
|
|
23
|
+
from nomad.units import ureg
|
|
24
|
+
|
|
25
|
+
from nomad.parsing.file_parser import TextParser, Quantity, DataTextParser
|
|
26
|
+
from simulationworkflowschema import SinglePoint
|
|
27
|
+
from runschema.run import Run, Program
|
|
28
|
+
from runschema.calculation import (
|
|
29
|
+
Calculation,
|
|
30
|
+
Dos,
|
|
31
|
+
DosValues,
|
|
32
|
+
BandStructure,
|
|
33
|
+
BandEnergies,
|
|
34
|
+
Energy,
|
|
35
|
+
HoppingMatrix,
|
|
36
|
+
)
|
|
37
|
+
from runschema.method import Method, AtomParameters, KMesh, Wannier, TB
|
|
38
|
+
from runschema.system import System, Atoms, AtomsGroup
|
|
39
|
+
from ..utils import get_files
|
|
40
|
+
|
|
41
|
+
re_n = r'[\n\r]'
|
|
42
|
+
|
|
43
|
+
|
|
44
|
+
class WOutParser(TextParser):
|
|
45
|
+
def __init__(self):
|
|
46
|
+
super().__init__(None)
|
|
47
|
+
|
|
48
|
+
def init_quantities(self):
|
|
49
|
+
kmesh_quantities = [
|
|
50
|
+
Quantity('n_points', r'Total points[\s=]*(\d+)', dtype=int, repeats=False),
|
|
51
|
+
Quantity(
|
|
52
|
+
'grid', r'Grid size *\= *(\d+) *x *(\d+) *x *(\d+)', repeats=False
|
|
53
|
+
),
|
|
54
|
+
Quantity('k_points', r'\|[\s\d]*(-*\d.[^\|]+)', repeats=True, dtype=float),
|
|
55
|
+
]
|
|
56
|
+
|
|
57
|
+
disentangle_quantities = [
|
|
58
|
+
Quantity(
|
|
59
|
+
'outer',
|
|
60
|
+
r'\|\s*Outer:\s*([-\d.]+)\s*\w*\s*([-\d.]+)\s*\((?P<__unit>\w+)\)',
|
|
61
|
+
dtype=float,
|
|
62
|
+
repeats=False,
|
|
63
|
+
),
|
|
64
|
+
Quantity(
|
|
65
|
+
'inner',
|
|
66
|
+
r'\|\s*Inner:\s*([-\d.]+)\s*\w*\s*([-\d.]+)\s*\((?P<__unit>\w+)\)',
|
|
67
|
+
dtype=float,
|
|
68
|
+
repeats=False,
|
|
69
|
+
),
|
|
70
|
+
]
|
|
71
|
+
|
|
72
|
+
structure_quantities = [
|
|
73
|
+
Quantity('labels', r'\|\s*([A-Z][a-z]*)', repeats=True),
|
|
74
|
+
Quantity(
|
|
75
|
+
'positions',
|
|
76
|
+
rf'\|\s*([\-\d\.]+)\s*([\-\d\.]+)\s*([\-\d\.]+)',
|
|
77
|
+
repeats=True,
|
|
78
|
+
dtype=float,
|
|
79
|
+
),
|
|
80
|
+
]
|
|
81
|
+
|
|
82
|
+
self._quantities = [
|
|
83
|
+
# Program quantities
|
|
84
|
+
Quantity(
|
|
85
|
+
Program.version, r'\s*\|\s*Release\:\s*([\d\.]+)\s*', repeats=False
|
|
86
|
+
),
|
|
87
|
+
# System quantities
|
|
88
|
+
Quantity('lattice_vectors', r'\s*a_\d\s*([\d\-\s\.]+)', repeats=True),
|
|
89
|
+
Quantity(
|
|
90
|
+
'reciprocal_lattice_vectors', r'\s*b_\d\s*([\d\-\s\.]+)', repeats=True
|
|
91
|
+
),
|
|
92
|
+
Quantity(
|
|
93
|
+
'structure',
|
|
94
|
+
rf'(\s*Fractional Coordinate[\s\S]+?)(?:{re_n}\s*(PROJECTIONS|K-POINT GRID))',
|
|
95
|
+
repeats=False,
|
|
96
|
+
sub_parser=TextParser(quantities=structure_quantities),
|
|
97
|
+
),
|
|
98
|
+
# Method quantities
|
|
99
|
+
Quantity(
|
|
100
|
+
'k_mesh',
|
|
101
|
+
rf'\s*(K-POINT GRID[\s\S]+?)(?:-\s*MAIN)',
|
|
102
|
+
repeats=False,
|
|
103
|
+
sub_parser=TextParser(quantities=kmesh_quantities),
|
|
104
|
+
),
|
|
105
|
+
Quantity(
|
|
106
|
+
'Nwannier',
|
|
107
|
+
r'\|\s*Number of Wannier Functions\s*\:\s*(\d+)',
|
|
108
|
+
repeats=False,
|
|
109
|
+
),
|
|
110
|
+
Quantity(
|
|
111
|
+
'Nband',
|
|
112
|
+
r'\|\s*Number of input Bloch states\s*\:\s*(\d+)',
|
|
113
|
+
repeats=False,
|
|
114
|
+
),
|
|
115
|
+
Quantity(
|
|
116
|
+
'Niter', r'\|\s*Total number of iterations\s*\:\s*(\d+)', repeats=False
|
|
117
|
+
),
|
|
118
|
+
Quantity(
|
|
119
|
+
'conv_tol',
|
|
120
|
+
r'\|\s*Convergence tolerence\s*\:\s*([\d.eE-]+)',
|
|
121
|
+
repeats=False,
|
|
122
|
+
),
|
|
123
|
+
Quantity(
|
|
124
|
+
'energy_windows',
|
|
125
|
+
rf'(\|\s*Energy\s*Windows\s*\|[\s\S]+?)(?:Number of target bands to extract:)',
|
|
126
|
+
repeats=False,
|
|
127
|
+
sub_parser=TextParser(quantities=disentangle_quantities),
|
|
128
|
+
),
|
|
129
|
+
# Band related quantities
|
|
130
|
+
Quantity(
|
|
131
|
+
'n_k_segments',
|
|
132
|
+
r'\|\s*Number of K-path sections\s*\:\s*(\d+)',
|
|
133
|
+
repeats=False,
|
|
134
|
+
),
|
|
135
|
+
Quantity(
|
|
136
|
+
'div_first_k_segment',
|
|
137
|
+
r'\|\s*Divisions along first K-path section\s*\:\s*(\d+)',
|
|
138
|
+
repeats=False,
|
|
139
|
+
),
|
|
140
|
+
Quantity(
|
|
141
|
+
'band_segments_points',
|
|
142
|
+
r'\|\s*From\:\s*\w+([\d\s\-\.]+)To\:\s*\w+([\d\s\-\.]+)',
|
|
143
|
+
repeats=True,
|
|
144
|
+
),
|
|
145
|
+
]
|
|
146
|
+
|
|
147
|
+
|
|
148
|
+
class WInParser(TextParser):
|
|
149
|
+
def __init__(self):
|
|
150
|
+
super().__init__(None)
|
|
151
|
+
|
|
152
|
+
def init_quantities(self):
|
|
153
|
+
def str_proj_to_list(val_in):
|
|
154
|
+
# To avoid inconsistent regex that can contain or not spaces
|
|
155
|
+
val_n = [x for x in val_in.split('\n') if x]
|
|
156
|
+
return [v.strip('[]').replace(' ', '').split(':') for v in val_n]
|
|
157
|
+
|
|
158
|
+
self._quantities = [
|
|
159
|
+
Quantity(
|
|
160
|
+
'energy_fermi', rf'{re_n}fermi_energy\s*=\s*([\d\.\-]+)', repeats=False
|
|
161
|
+
),
|
|
162
|
+
Quantity(
|
|
163
|
+
'projections',
|
|
164
|
+
rf'[bB]egin [pP]rojections([\s\S]+?)(?:[eE]nd [pP]rojections)',
|
|
165
|
+
repeats=False,
|
|
166
|
+
str_operation=str_proj_to_list,
|
|
167
|
+
),
|
|
168
|
+
]
|
|
169
|
+
|
|
170
|
+
|
|
171
|
+
class HrParser(TextParser):
|
|
172
|
+
def __init__(self):
|
|
173
|
+
super().__init__(None)
|
|
174
|
+
|
|
175
|
+
def init_quantities(self):
|
|
176
|
+
self._quantities = [
|
|
177
|
+
Quantity('degeneracy_factors', r'\s*written on[\s\w]*:\d*:\d*\s*([\d\s]+)'),
|
|
178
|
+
Quantity('hoppings', rf'\s*([-\d\s.]+)', repeats=False),
|
|
179
|
+
]
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
class Wannier90Parser:
|
|
183
|
+
def __init__(self):
|
|
184
|
+
self.wout_parser = WOutParser()
|
|
185
|
+
self.win_parser = WInParser()
|
|
186
|
+
self.band_dat_parser = DataTextParser()
|
|
187
|
+
self.dos_dat_parser = DataTextParser()
|
|
188
|
+
self.hr_parser = HrParser()
|
|
189
|
+
|
|
190
|
+
self._input_projection_mapping = {
|
|
191
|
+
'Nwannier': 'n_projected_orbitals',
|
|
192
|
+
'Nband': 'n_bands',
|
|
193
|
+
'conv_tol': 'convergence_tolerance_max_localization',
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
self._input_projection_units = {'Ang': 'angstrom', 'Bohr': 'bohr'}
|
|
197
|
+
|
|
198
|
+
# Angular momentum [l, mr] following Wannier90 tables 3.1 and 3.2
|
|
199
|
+
# TODO move to normalization or utils in nomad?
|
|
200
|
+
self._angular_momentum_orbital_map = {
|
|
201
|
+
(0, 1): 's',
|
|
202
|
+
(1, 1): 'px',
|
|
203
|
+
(1, 2): 'py',
|
|
204
|
+
(1, 3): 'pz',
|
|
205
|
+
(2, 1): 'dz2',
|
|
206
|
+
(2, 2): 'dxz',
|
|
207
|
+
(2, 3): 'dyz',
|
|
208
|
+
(2, 4): 'dx2-y2',
|
|
209
|
+
(2, 5): 'dxy',
|
|
210
|
+
(3, 1): 'fz3',
|
|
211
|
+
(3, 2): 'fxz2',
|
|
212
|
+
(3, 3): 'fyz2',
|
|
213
|
+
(3, 4): 'fz(x2-y2)',
|
|
214
|
+
(3, 5): 'fxyz',
|
|
215
|
+
(3, 6): 'fx(x2-3y2)',
|
|
216
|
+
(3, 7): 'fy(3x2-y2)',
|
|
217
|
+
(-1, 1): 'sp-1',
|
|
218
|
+
(-1, 2): 'sp-2',
|
|
219
|
+
(-2, 1): 'sp2-1',
|
|
220
|
+
(-2, 2): 'sp2-2',
|
|
221
|
+
(-2, 3): 'sp2-3',
|
|
222
|
+
(-3, 1): 'sp3-1',
|
|
223
|
+
(-3, 2): 'sp3-2',
|
|
224
|
+
(-3, 3): 'sp3-3',
|
|
225
|
+
(-3, 4): 'sp3-4',
|
|
226
|
+
(-4, 1): 'sp3d-1',
|
|
227
|
+
(-4, 2): 'sp3d-2',
|
|
228
|
+
(-4, 3): 'sp3d-3',
|
|
229
|
+
(-4, 4): 'sp3d-4',
|
|
230
|
+
(-4, 5): 'sp3d-5',
|
|
231
|
+
(-5, 1): 'sp3d2-1',
|
|
232
|
+
(-5, 2): 'sp3d2-2',
|
|
233
|
+
(-5, 3): 'sp3d2-3',
|
|
234
|
+
(-5, 4): 'sp3d2-4',
|
|
235
|
+
(-5, 5): 'sp3d2-5',
|
|
236
|
+
(-5, 6): 'sp3d2-6',
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
self._dft_codes = [
|
|
240
|
+
'quantumespresso',
|
|
241
|
+
'abinit',
|
|
242
|
+
'vasp',
|
|
243
|
+
'siesta',
|
|
244
|
+
'wien2k',
|
|
245
|
+
'fleur',
|
|
246
|
+
'openmx',
|
|
247
|
+
'gpaw',
|
|
248
|
+
]
|
|
249
|
+
|
|
250
|
+
def parse_system(self):
|
|
251
|
+
sec_run = self.archive.run[-1]
|
|
252
|
+
sec_system = System()
|
|
253
|
+
sec_run.system.append(sec_system)
|
|
254
|
+
|
|
255
|
+
structure = self.wout_parser.get('structure')
|
|
256
|
+
if structure is None:
|
|
257
|
+
self.logger.error('Error parsing the structure from .wout')
|
|
258
|
+
return
|
|
259
|
+
|
|
260
|
+
sec_atoms = Atoms()
|
|
261
|
+
sec_system.atoms = sec_atoms
|
|
262
|
+
if self.wout_parser.get('lattice_vectors', []):
|
|
263
|
+
lattice_vectors = np.vstack(
|
|
264
|
+
self.wout_parser.get('lattice_vectors', [])[-3:]
|
|
265
|
+
)
|
|
266
|
+
sec_atoms.lattice_vectors = lattice_vectors * ureg.angstrom
|
|
267
|
+
if self.wout_parser.get('reciprocal_lattice_vectors') is not None:
|
|
268
|
+
sec_atoms.lattice_vectors_reciprocal = (
|
|
269
|
+
np.vstack(self.wout_parser.get('reciprocal_lattice_vectors')[-3:])
|
|
270
|
+
/ ureg.angstrom
|
|
271
|
+
)
|
|
272
|
+
|
|
273
|
+
pbc = (
|
|
274
|
+
[True, True, True] if lattice_vectors is not None else [False, False, False]
|
|
275
|
+
)
|
|
276
|
+
sec_atoms.periodic = pbc
|
|
277
|
+
sec_atoms.labels = structure.get('labels')
|
|
278
|
+
if structure.get('positions') is not None:
|
|
279
|
+
sec_atoms.positions = structure.get('positions') * ureg.angstrom
|
|
280
|
+
|
|
281
|
+
def parse_method(self):
|
|
282
|
+
sec_run = self.archive.run[-1]
|
|
283
|
+
sec_method = Method()
|
|
284
|
+
sec_run.method.append(sec_method)
|
|
285
|
+
sec_proj = TB()
|
|
286
|
+
sec_method.tb = sec_proj
|
|
287
|
+
sec_wann = Wannier()
|
|
288
|
+
sec_proj.wannier = sec_wann
|
|
289
|
+
|
|
290
|
+
# k_mesh section
|
|
291
|
+
kmesh = self.wout_parser.get('k_mesh')
|
|
292
|
+
if kmesh:
|
|
293
|
+
sec_k_mesh = KMesh()
|
|
294
|
+
sec_method.k_mesh = sec_k_mesh
|
|
295
|
+
sec_k_mesh.n_points = kmesh.get('n_points')
|
|
296
|
+
sec_k_mesh.grid = kmesh.get('grid', [])
|
|
297
|
+
if kmesh.get('k_points') is not None:
|
|
298
|
+
sec_k_mesh.points = np.complex128(kmesh.k_points[::2])
|
|
299
|
+
|
|
300
|
+
# Wannier90 section
|
|
301
|
+
for key in self._input_projection_mapping.keys():
|
|
302
|
+
setattr(
|
|
303
|
+
sec_wann, self._input_projection_mapping[key], self.wout_parser.get(key)
|
|
304
|
+
)
|
|
305
|
+
if self.wout_parser.get('Niter'):
|
|
306
|
+
sec_wann.is_maximally_localized = self.wout_parser.get('Niter', 0) > 1
|
|
307
|
+
if self.wout_parser.get('energy_windows'):
|
|
308
|
+
sec_wann.energy_window_outer = self.wout_parser.get('energy_windows').outer
|
|
309
|
+
sec_wann.energy_window_inner = self.wout_parser.get('energy_windows').inner
|
|
310
|
+
|
|
311
|
+
def parse_winput(self):
|
|
312
|
+
sec_run = self.archive.run[-1]
|
|
313
|
+
try:
|
|
314
|
+
sec_system = sec_run.system[-1]
|
|
315
|
+
sec_atoms = sec_system.atoms
|
|
316
|
+
sec_method = sec_run.method[-1]
|
|
317
|
+
except Exception:
|
|
318
|
+
self.logger.warning(
|
|
319
|
+
'Could not extract system.atoms and method sections for parsing win.'
|
|
320
|
+
)
|
|
321
|
+
return
|
|
322
|
+
|
|
323
|
+
# Parsing from input
|
|
324
|
+
win_files = get_files('*.win', self.filepath, self.mainfile)
|
|
325
|
+
if not win_files:
|
|
326
|
+
self.logger.warning('Input .win file not found.')
|
|
327
|
+
return
|
|
328
|
+
if len(win_files) > 1:
|
|
329
|
+
self.logger.warning(
|
|
330
|
+
'Multiple win files found. We will parse the first one.'
|
|
331
|
+
)
|
|
332
|
+
self.win_parser.mainfile = win_files[0]
|
|
333
|
+
|
|
334
|
+
def fract_cart_sites(sec_atoms, units, val):
|
|
335
|
+
for pos in sec_atoms.positions.to(units):
|
|
336
|
+
if np.array_equal(val, pos.magnitude):
|
|
337
|
+
index = sec_atoms.positions.magnitude.tolist().index(
|
|
338
|
+
pos.magnitude.tolist()
|
|
339
|
+
)
|
|
340
|
+
return sec_atoms.labels[index]
|
|
341
|
+
|
|
342
|
+
# Set units in case these are defined in .win
|
|
343
|
+
projections = self.win_parser.get('projections', [])
|
|
344
|
+
if projections:
|
|
345
|
+
if not isinstance(projections, list):
|
|
346
|
+
projections = [projections]
|
|
347
|
+
if projections[0][0] in ['Bohr', 'Angstrom']:
|
|
348
|
+
sec_run.x_wannier90_units = self._input_projection_units[
|
|
349
|
+
projections[0][0]
|
|
350
|
+
]
|
|
351
|
+
projections.pop(0)
|
|
352
|
+
else:
|
|
353
|
+
sec_run.x_wannier90_units = 'angstrom'
|
|
354
|
+
if projections[0][0] == 'random':
|
|
355
|
+
return
|
|
356
|
+
|
|
357
|
+
# Populating AtomsGroup for projected atoms
|
|
358
|
+
sec_run.x_wannier90_n_atoms_proj = len(projections)
|
|
359
|
+
for nat in range(sec_run.x_wannier90_n_atoms_proj):
|
|
360
|
+
sec_atoms_group = AtomsGroup()
|
|
361
|
+
sec_system.atoms_group.append(sec_atoms_group)
|
|
362
|
+
sec_atoms_group.type = 'active_orbitals'
|
|
363
|
+
sec_atoms_group.index = (
|
|
364
|
+
0 # Always first index (projection on a projection does not exist)
|
|
365
|
+
)
|
|
366
|
+
sec_atoms_group.is_molecule = False
|
|
367
|
+
|
|
368
|
+
# atom label always index=0
|
|
369
|
+
try:
|
|
370
|
+
atom = projections[nat][0]
|
|
371
|
+
if atom.startswith('f='): # fractional coordinates
|
|
372
|
+
val = [float(x) for x in atom.replace('f=', '').split(',')]
|
|
373
|
+
val = np.dot(val, sec_atoms.lattice_vectors.magnitude)
|
|
374
|
+
sites = fract_cart_sites(sec_atoms, sec_run.x_wannier90_units, val)
|
|
375
|
+
elif atom.startswith('c='): # cartesian coordinates
|
|
376
|
+
val = [float(x) for x in atom.replace('c=', '').split(',')]
|
|
377
|
+
sites = fract_cart_sites(sec_atoms, sec_run.x_wannier90_units, val)
|
|
378
|
+
else: # atom label directly specified
|
|
379
|
+
sites = atom
|
|
380
|
+
sec_atoms_group.n_atoms = len(
|
|
381
|
+
sites
|
|
382
|
+
) # always 1 (only one atom per proj) # TODO: either add a check or default to 1
|
|
383
|
+
sec_atoms_group.label = 'projection'
|
|
384
|
+
sec_atoms_group.atom_indices = np.where(
|
|
385
|
+
[x == sites for x in sec_atoms.labels]
|
|
386
|
+
)[0]
|
|
387
|
+
except Exception:
|
|
388
|
+
self.logger.warning(
|
|
389
|
+
'Error finding the atom labels for the projection from win.'
|
|
390
|
+
)
|
|
391
|
+
|
|
392
|
+
# orbital angular momentum always index=1
|
|
393
|
+
# suggestion: shift to wout for projection?
|
|
394
|
+
try:
|
|
395
|
+
orbitals = projections[nat][1].split(';')
|
|
396
|
+
sec_atom_parameters = AtomParameters()
|
|
397
|
+
sec_method.atom_parameters.append(sec_atom_parameters)
|
|
398
|
+
sec_atom_parameters.n_orbitals = len(orbitals)
|
|
399
|
+
angular_momentum = []
|
|
400
|
+
for orb in orbitals:
|
|
401
|
+
if orb.startswith('l='): # using angular momentum numbers
|
|
402
|
+
lmom = int(orb.split(',mr')[0].replace('l=', '').split(',')[0])
|
|
403
|
+
mrmom = int(orb.split(',mr')[-1].replace('=', '').split(',')[0])
|
|
404
|
+
if (
|
|
405
|
+
orb_ang_mom := self._angular_momentum_orbital_map.get(
|
|
406
|
+
(lmom, mrmom)
|
|
407
|
+
)
|
|
408
|
+
): # shouldn't a missing numerical code rather generate a warning?
|
|
409
|
+
angular_momentum.append(orb_ang_mom)
|
|
410
|
+
else: # ang mom label directly specified
|
|
411
|
+
angular_momentum.append(orb)
|
|
412
|
+
sec_atom_parameters.orbitals = np.array(angular_momentum)
|
|
413
|
+
except Exception:
|
|
414
|
+
self.logger.warning('Projected orbital labels not found from win.')
|
|
415
|
+
|
|
416
|
+
def parse_hoppings(self):
|
|
417
|
+
hr_files = get_files('*hr.dat', self.filepath, self.mainfile)
|
|
418
|
+
if not hr_files:
|
|
419
|
+
return
|
|
420
|
+
self.hr_parser.mainfile = hr_files[0]
|
|
421
|
+
|
|
422
|
+
# Assuming method.tb is parsed before
|
|
423
|
+
sec_scc = self.archive.run[-1].calculation[-1]
|
|
424
|
+
sec_hopping_matrix = HoppingMatrix()
|
|
425
|
+
sec_scc.hopping_matrix.append(sec_hopping_matrix)
|
|
426
|
+
sec_hopping_matrix.n_orbitals = (
|
|
427
|
+
self.archive.run[-1].method[-1].tb.wannier.n_projected_orbitals
|
|
428
|
+
)
|
|
429
|
+
deg_factors = self.hr_parser.get('degeneracy_factors', [])
|
|
430
|
+
if deg_factors is not None:
|
|
431
|
+
sec_hopping_matrix.n_wigner_seitz_points = deg_factors[1]
|
|
432
|
+
sec_hopping_matrix.degeneracy_factors = deg_factors[2:]
|
|
433
|
+
full_hoppings = self.hr_parser.get('hoppings', [])
|
|
434
|
+
try:
|
|
435
|
+
sec_hopping_matrix.value = np.reshape(
|
|
436
|
+
full_hoppings,
|
|
437
|
+
(
|
|
438
|
+
sec_hopping_matrix.n_wigner_seitz_points,
|
|
439
|
+
sec_hopping_matrix.n_orbitals * sec_hopping_matrix.n_orbitals,
|
|
440
|
+
7,
|
|
441
|
+
),
|
|
442
|
+
)
|
|
443
|
+
except Exception:
|
|
444
|
+
self.logger.warning(
|
|
445
|
+
'Could not parse the hopping matrix values. Please, revise your output files.'
|
|
446
|
+
)
|
|
447
|
+
try:
|
|
448
|
+
sec_scc_energy = Energy()
|
|
449
|
+
sec_scc.energy = sec_scc_energy
|
|
450
|
+
# Setting Fermi level to the first orbital onsite energy
|
|
451
|
+
n_wigner_seitz_points_half = int(
|
|
452
|
+
0.5 * sec_hopping_matrix.n_wigner_seitz_points
|
|
453
|
+
)
|
|
454
|
+
energy_fermi = (
|
|
455
|
+
sec_hopping_matrix.value[n_wigner_seitz_points_half][0][5] * ureg.eV
|
|
456
|
+
)
|
|
457
|
+
sec_scc_energy.fermi = energy_fermi
|
|
458
|
+
sec_scc_energy.highest_occupied = energy_fermi
|
|
459
|
+
except Exception:
|
|
460
|
+
return
|
|
461
|
+
|
|
462
|
+
def get_k_points(self):
|
|
463
|
+
if self.wout_parser.get('reciprocal_lattice_vectors') is None:
|
|
464
|
+
return
|
|
465
|
+
reciprocal_lattice_vectors = np.vstack(
|
|
466
|
+
self.wout_parser.get('reciprocal_lattice_vectors')
|
|
467
|
+
)
|
|
468
|
+
|
|
469
|
+
n_k_segments = self.wout_parser.get('n_k_segments', [])
|
|
470
|
+
k_symm_points = []
|
|
471
|
+
k_symm_points_cart = []
|
|
472
|
+
for ns in range(n_k_segments):
|
|
473
|
+
k_segments = np.split(self.wout_parser.get('band_segments_points')[ns], 2)
|
|
474
|
+
[
|
|
475
|
+
k_symm_points_cart.append(
|
|
476
|
+
np.dot(k_segments[i], reciprocal_lattice_vectors)
|
|
477
|
+
)
|
|
478
|
+
for i in range(2)
|
|
479
|
+
]
|
|
480
|
+
[k_symm_points.append(k_segments[i]) for i in range(2)]
|
|
481
|
+
|
|
482
|
+
n_k_segments_points_1 = self.wout_parser.get('div_first_k_segment')
|
|
483
|
+
delta_k = (
|
|
484
|
+
np.linalg.norm(k_symm_points_cart[1] - k_symm_points_cart[0])
|
|
485
|
+
/ n_k_segments_points_1
|
|
486
|
+
)
|
|
487
|
+
band_segments_points = []
|
|
488
|
+
for ns in range(n_k_segments):
|
|
489
|
+
n_k_segments_points = round(
|
|
490
|
+
np.linalg.norm(
|
|
491
|
+
k_symm_points_cart[2 * ns + 1] - k_symm_points_cart[2 * ns]
|
|
492
|
+
)
|
|
493
|
+
/ delta_k
|
|
494
|
+
)
|
|
495
|
+
band_segments_points.append(n_k_segments_points)
|
|
496
|
+
|
|
497
|
+
kpoints = []
|
|
498
|
+
for n in range(len(band_segments_points)):
|
|
499
|
+
kpoints_segment = [
|
|
500
|
+
k_symm_points[2 * n]
|
|
501
|
+
+ i
|
|
502
|
+
* (k_symm_points[2 * n + 1] - k_symm_points[2 * n])
|
|
503
|
+
/ band_segments_points[n]
|
|
504
|
+
for i in range(band_segments_points[n])
|
|
505
|
+
]
|
|
506
|
+
kpoints.append(kpoints_segment)
|
|
507
|
+
|
|
508
|
+
# TODO check having to add manually last point (?)
|
|
509
|
+
band_segments_points[-1] = band_segments_points[-1] + 1
|
|
510
|
+
kpoints[-1].append(k_symm_points[-1])
|
|
511
|
+
n_kpoints = sum(band_segments_points)
|
|
512
|
+
|
|
513
|
+
return (n_kpoints, band_segments_points, kpoints)
|
|
514
|
+
|
|
515
|
+
def parse_bandstructure(self):
|
|
516
|
+
sec_scc = self.archive.run[-1].calculation[-1]
|
|
517
|
+
|
|
518
|
+
try:
|
|
519
|
+
energy_fermi = sec_scc.energy.fermi
|
|
520
|
+
except Exception:
|
|
521
|
+
self.logger.warning(
|
|
522
|
+
'Error setting the Fermi level: not found from hoppings. Setting it to 0 eV'
|
|
523
|
+
)
|
|
524
|
+
energy_fermi = 0.0 * ureg.eV
|
|
525
|
+
energy_fermi_eV = energy_fermi.to('electron_volt').magnitude
|
|
526
|
+
|
|
527
|
+
band_files = get_files('*band.dat', self.filepath, self.mainfile)
|
|
528
|
+
if not band_files:
|
|
529
|
+
return
|
|
530
|
+
if len(band_files) > 1:
|
|
531
|
+
self.logger.warning('Multiple bandstructure data files found.')
|
|
532
|
+
# Parsing only first *_band.dat file
|
|
533
|
+
self.band_dat_parser.mainfile = band_files[0]
|
|
534
|
+
|
|
535
|
+
sec_k_band = BandStructure()
|
|
536
|
+
sec_scc.band_structure_electronic.append(sec_k_band)
|
|
537
|
+
sec_k_band.energy_fermi = energy_fermi
|
|
538
|
+
try:
|
|
539
|
+
sec_k_band.reciprocal_cell = (
|
|
540
|
+
self.archive.run[-1].system[0].atoms.lattice_vectors_reciprocal
|
|
541
|
+
)
|
|
542
|
+
except Exception:
|
|
543
|
+
self.logger.warning(
|
|
544
|
+
'Reciprocal cell in band_structure_electronic not set up.'
|
|
545
|
+
)
|
|
546
|
+
|
|
547
|
+
if self.band_dat_parser.data is None:
|
|
548
|
+
return
|
|
549
|
+
data = np.transpose(self.band_dat_parser.data)
|
|
550
|
+
|
|
551
|
+
(n_kpoints, band_segments_points, kpoints) = self.get_k_points()
|
|
552
|
+
n_segments = len(band_segments_points)
|
|
553
|
+
n_bands = round((len(data[0])) / n_kpoints)
|
|
554
|
+
n_spin = 1
|
|
555
|
+
|
|
556
|
+
# reshaping bands into the NOMAD band_structure style
|
|
557
|
+
try:
|
|
558
|
+
bands = np.transpose(np.reshape(data[1], (n_bands, n_kpoints)))
|
|
559
|
+
except Exception:
|
|
560
|
+
self.logger.warning(
|
|
561
|
+
'Could not reshape the bands into the NOMAD dimensions.'
|
|
562
|
+
)
|
|
563
|
+
return
|
|
564
|
+
bkp_init = 0
|
|
565
|
+
for n in range(n_segments):
|
|
566
|
+
sec_k_band_segment = BandEnergies()
|
|
567
|
+
sec_k_band.segment.append(sec_k_band_segment)
|
|
568
|
+
sec_k_band_segment.n_kpoints = band_segments_points[n]
|
|
569
|
+
sec_k_band_segment.kpoints = kpoints[n]
|
|
570
|
+
|
|
571
|
+
bkp_last = bkp_init + band_segments_points[n]
|
|
572
|
+
energies = np.reshape(
|
|
573
|
+
bands[bkp_init:bkp_last, :], (n_spin, band_segments_points[n], n_bands)
|
|
574
|
+
)
|
|
575
|
+
occs = np.reshape(
|
|
576
|
+
np.array(
|
|
577
|
+
[
|
|
578
|
+
2.0 if energies[i, j, k] < energy_fermi_eV else 0.0
|
|
579
|
+
for i in range(n_spin)
|
|
580
|
+
for j in range(band_segments_points[n])
|
|
581
|
+
for k in range(n_bands)
|
|
582
|
+
]
|
|
583
|
+
),
|
|
584
|
+
(n_spin, band_segments_points[n], n_bands),
|
|
585
|
+
)
|
|
586
|
+
bkp_init = bkp_last
|
|
587
|
+
sec_k_band_segment.energies = energies * ureg.eV
|
|
588
|
+
sec_k_band_segment.occupations = occs
|
|
589
|
+
|
|
590
|
+
def parse_dos(self):
|
|
591
|
+
sec_scc = self.archive.run[-1].calculation[-1]
|
|
592
|
+
|
|
593
|
+
try:
|
|
594
|
+
energy_fermi = sec_scc.energy.fermi
|
|
595
|
+
except Exception:
|
|
596
|
+
self.logger.warning(
|
|
597
|
+
'Error setting the Fermi level: not found from hoppings. Setting it to 0 eV'
|
|
598
|
+
)
|
|
599
|
+
energy_fermi = 0.0 * ureg.eV
|
|
600
|
+
|
|
601
|
+
dos_files = get_files('*dos.dat', self.filepath, self.mainfile)
|
|
602
|
+
if not dos_files:
|
|
603
|
+
return
|
|
604
|
+
if len(dos_files) > 1:
|
|
605
|
+
self.logger.warning('Multiple dos data files found.')
|
|
606
|
+
# Parsing only first *dos.dat file
|
|
607
|
+
self.dos_dat_parser.mainfile = dos_files[0]
|
|
608
|
+
|
|
609
|
+
# TODO add spin polarized case
|
|
610
|
+
sec_dos = Dos()
|
|
611
|
+
sec_scc.dos_electronic.append(sec_dos)
|
|
612
|
+
sec_dos.energy_fermi = energy_fermi
|
|
613
|
+
data = np.transpose(self.dos_dat_parser.data)
|
|
614
|
+
sec_dos.n_energies = len(data[0])
|
|
615
|
+
sec_dos.energies = data[0] * ureg.eV
|
|
616
|
+
sec_dos_values = DosValues()
|
|
617
|
+
sec_dos.total.append(sec_dos_values)
|
|
618
|
+
sec_dos_values.value = data[1] / ureg.eV
|
|
619
|
+
|
|
620
|
+
def parse_scc(self):
|
|
621
|
+
sec_run = self.archive.run[-1]
|
|
622
|
+
sec_scc = Calculation()
|
|
623
|
+
sec_run.calculation.append(sec_scc)
|
|
624
|
+
|
|
625
|
+
# Refs for calculation
|
|
626
|
+
sec_scc.method_ref = sec_run.method[-1]
|
|
627
|
+
sec_scc.system_ref = sec_run.system[-1]
|
|
628
|
+
|
|
629
|
+
# Wannier90 hoppings section
|
|
630
|
+
self.parse_hoppings()
|
|
631
|
+
|
|
632
|
+
# Wannier band structure
|
|
633
|
+
self.parse_bandstructure()
|
|
634
|
+
|
|
635
|
+
# Wannier DOS
|
|
636
|
+
self.parse_dos()
|
|
637
|
+
|
|
638
|
+
def init_parser(self):
|
|
639
|
+
self.wout_parser.mainfile = self.filepath
|
|
640
|
+
self.wout_parser.logger = self.logger
|
|
641
|
+
self.hr_parser.logger = self.logger
|
|
642
|
+
|
|
643
|
+
def parse(self, filepath, archive, logger):
|
|
644
|
+
self.filepath = filepath
|
|
645
|
+
self.archive = archive
|
|
646
|
+
self.maindir = os.path.dirname(self.filepath)
|
|
647
|
+
self.mainfile = os.path.basename(self.filepath)
|
|
648
|
+
self.logger = logging.getLogger(__name__) if logger is None else logger
|
|
649
|
+
|
|
650
|
+
self.init_parser()
|
|
651
|
+
|
|
652
|
+
sec_run = Run()
|
|
653
|
+
self.archive.run.append(sec_run)
|
|
654
|
+
|
|
655
|
+
# Program section
|
|
656
|
+
sec_run.program = Program(
|
|
657
|
+
name='Wannier90', version=self.wout_parser.get('version', '')
|
|
658
|
+
)
|
|
659
|
+
# TODO TimeRun section
|
|
660
|
+
|
|
661
|
+
self.parse_system()
|
|
662
|
+
|
|
663
|
+
self.parse_method()
|
|
664
|
+
|
|
665
|
+
# Parsing AtomsGroup and AtomParameters for System and Method from the input file .win
|
|
666
|
+
self.parse_winput()
|
|
667
|
+
|
|
668
|
+
self.parse_scc()
|
|
669
|
+
|
|
670
|
+
workflow = SinglePoint()
|
|
671
|
+
self.archive.workflow2 = workflow
|
|
@@ -0,0 +1,19 @@
|
|
|
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
|
+
from .parser import Wien2kParser
|