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,896 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright The NOMAD Authors.
|
|
3
|
+
#
|
|
4
|
+
# This file is part of NOMAD.
|
|
5
|
+
# See https://nomad-lab.eu for further info.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
import os
|
|
20
|
+
import numpy as np
|
|
21
|
+
import logging
|
|
22
|
+
from datetime import datetime
|
|
23
|
+
from netCDF4 import Dataset # pylint: disable=no-name-in-module
|
|
24
|
+
from ase.data import chemical_symbols
|
|
25
|
+
|
|
26
|
+
from nomad.parsing.file_parser import TextParser, Quantity, FileParser
|
|
27
|
+
from nomad.units import ureg
|
|
28
|
+
from runschema.run import Run, Program, TimeRun
|
|
29
|
+
from runschema.system import System, Atoms
|
|
30
|
+
from runschema.method import Method
|
|
31
|
+
from runschema.calculation import Calculation, Energy, EnergyEntry, BandEnergies
|
|
32
|
+
from .metainfo.yambo import (
|
|
33
|
+
x_yambo_dipoles,
|
|
34
|
+
x_yambo_dynamic_dielectric_matrix_fragment,
|
|
35
|
+
x_yambo_io,
|
|
36
|
+
x_yambo_dynamic_dielectric_matrix,
|
|
37
|
+
x_yambo_local_xc_nonlocal_fock,
|
|
38
|
+
x_yambo_dyson,
|
|
39
|
+
x_yambo_local_xc_nonlocal_fock_bandenergies,
|
|
40
|
+
x_yambo_bare_xc,
|
|
41
|
+
x_yambo_bare_xc_bandenergies,
|
|
42
|
+
x_yambo_module,
|
|
43
|
+
x_yambo_transferred_momenta,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class MainfileParser(TextParser):
|
|
48
|
+
def __init__(self):
|
|
49
|
+
super().__init__()
|
|
50
|
+
|
|
51
|
+
def init_quantities(self):
|
|
52
|
+
re_f = r'[-+]*\d*\.\d+[Ee]*[-+]*\d*'
|
|
53
|
+
|
|
54
|
+
io_quantities = [
|
|
55
|
+
Quantity(
|
|
56
|
+
'key_value',
|
|
57
|
+
r'([A-Z\d].+?)(?:\(.+\)|\[.+\]| |)(:.+?)(?:\[|\n)',
|
|
58
|
+
str_operation=lambda x: [v.strip() for v in x.split(':')],
|
|
59
|
+
repeats=True,
|
|
60
|
+
),
|
|
61
|
+
Quantity('file', r'\[(?:RD|WR)(.+?)\]', dtype=str),
|
|
62
|
+
Quantity('sn', r'- S/N *(\d+)', dtype=str),
|
|
63
|
+
]
|
|
64
|
+
|
|
65
|
+
energies_quantities = [
|
|
66
|
+
Quantity(
|
|
67
|
+
'fermi', rf'Fermi Level.+?: +({re_f})', dtype=np.float64, unit=ureg.eV
|
|
68
|
+
),
|
|
69
|
+
Quantity(
|
|
70
|
+
'conduction',
|
|
71
|
+
rf'Conduction Band Min +: +({re_f})',
|
|
72
|
+
dtpye=np.float64,
|
|
73
|
+
unit=ureg.eV,
|
|
74
|
+
),
|
|
75
|
+
Quantity(
|
|
76
|
+
'valence',
|
|
77
|
+
rf'Valence Band Max +: +({re_f})',
|
|
78
|
+
dtpye=np.float64,
|
|
79
|
+
unit=ureg.eV,
|
|
80
|
+
),
|
|
81
|
+
Quantity(
|
|
82
|
+
'valence_conduction',
|
|
83
|
+
rf'VBM / CBm +\[ev\]: +({re_f}) +({re_f})',
|
|
84
|
+
dtpye=np.dtype(np.float64),
|
|
85
|
+
unit=ureg.eV,
|
|
86
|
+
),
|
|
87
|
+
Quantity(
|
|
88
|
+
'x_yambo_filled_bands',
|
|
89
|
+
r'Filled Bands +: +(\d+)',
|
|
90
|
+
dtype=np.int32,
|
|
91
|
+
str_operation=lambda x: [1, int(x)],
|
|
92
|
+
),
|
|
93
|
+
Quantity(
|
|
94
|
+
'x_yambo_empty_bands',
|
|
95
|
+
r'Empty Bands +: +([\d ]+)',
|
|
96
|
+
dtype=np.dtype(np.int32),
|
|
97
|
+
),
|
|
98
|
+
Quantity(
|
|
99
|
+
'x_yambo_electronic_temperature',
|
|
100
|
+
rf'Electronic Temp.+?: +{re_f} +({re_f})',
|
|
101
|
+
dtype=np.float64,
|
|
102
|
+
unit=ureg.kelvin,
|
|
103
|
+
),
|
|
104
|
+
Quantity(
|
|
105
|
+
'x_yambo_bosonic_temperature',
|
|
106
|
+
rf'Bosonic +Temp.+?: +{re_f} +({re_f})',
|
|
107
|
+
dtype=np.float64,
|
|
108
|
+
unit=ureg.kelvin,
|
|
109
|
+
),
|
|
110
|
+
Quantity(
|
|
111
|
+
'x_yambo_finite_temperature_mode',
|
|
112
|
+
r'Finite Temperature mode: +(\S+)',
|
|
113
|
+
str_operation=lambda x: x == 'yes',
|
|
114
|
+
),
|
|
115
|
+
Quantity(
|
|
116
|
+
'x_yambo_electronic_density',
|
|
117
|
+
rf'El\. density.+?: +(.+?)(?:\[|\n)',
|
|
118
|
+
str_operation=lambda x: x.strip().split()[-1],
|
|
119
|
+
dtype=np.float64,
|
|
120
|
+
),
|
|
121
|
+
Quantity(
|
|
122
|
+
'states_summary',
|
|
123
|
+
r'States summary +: Full +Metallic +Empty\s+(.+)',
|
|
124
|
+
str_operation=lambda x: [v.split('-') for v in x.strip().split()],
|
|
125
|
+
),
|
|
126
|
+
Quantity(
|
|
127
|
+
'x_yambo_indirect_gaps',
|
|
128
|
+
rf'Indirect Gaps.+?: +({re_f}) +({re_f})',
|
|
129
|
+
dtype=np.dtype(np.float64),
|
|
130
|
+
unit=ureg.eV,
|
|
131
|
+
),
|
|
132
|
+
Quantity(
|
|
133
|
+
'x_yambo_direct_gaps',
|
|
134
|
+
rf'Direct Gaps.+?: +({re_f}) +({re_f})',
|
|
135
|
+
dtype=np.dtype(np.float64),
|
|
136
|
+
unit=ureg.eV,
|
|
137
|
+
),
|
|
138
|
+
Quantity(
|
|
139
|
+
'x_yambo_indirect_gap',
|
|
140
|
+
rf'Indirect Gap.+?: +({re_f})',
|
|
141
|
+
dtype=np.float64,
|
|
142
|
+
unit=ureg.eV,
|
|
143
|
+
),
|
|
144
|
+
Quantity(
|
|
145
|
+
'x_yambo_direct_gap',
|
|
146
|
+
rf'Direct Gap.+?: +({re_f})',
|
|
147
|
+
dtype=np.float64,
|
|
148
|
+
unit=ureg.eV,
|
|
149
|
+
),
|
|
150
|
+
Quantity(
|
|
151
|
+
'x_yambo_direct_gap_kpoint',
|
|
152
|
+
r'Direct Gap localized at k-point.+?: +(\d+)',
|
|
153
|
+
dtype=np.int32,
|
|
154
|
+
),
|
|
155
|
+
Quantity(
|
|
156
|
+
'x_yambo_indirect_gap_kpoints',
|
|
157
|
+
r'Indirect Gap between k-points.+?: +(\d+) +(\d+)',
|
|
158
|
+
dtype=np.int32,
|
|
159
|
+
),
|
|
160
|
+
]
|
|
161
|
+
|
|
162
|
+
qp_properties_quantity = Quantity(
|
|
163
|
+
'qp_properties',
|
|
164
|
+
r'QP properties and I/O([\s\S]+? S/N \d+.+)',
|
|
165
|
+
sub_parser=TextParser(
|
|
166
|
+
quantities=[
|
|
167
|
+
Quantity(
|
|
168
|
+
'qp_energy',
|
|
169
|
+
r'(QP \[eV\] @ K[\s\S]+?)\n *\n',
|
|
170
|
+
repeats=True,
|
|
171
|
+
sub_parser=TextParser(
|
|
172
|
+
quantities=[
|
|
173
|
+
Quantity(
|
|
174
|
+
'band',
|
|
175
|
+
rf'B= *(\d+) Eo= *({re_f}) E= *({re_f}) E-Eo= *({re_f}) '
|
|
176
|
+
rf'Re\(Z\)= *({re_f}) Im\(Z\)= *({re_f}) nlXC= *({re_f}) lXC= *({re_f}) So= *({re_f})',
|
|
177
|
+
repeats=True,
|
|
178
|
+
dtype=np.dtype(np.float64),
|
|
179
|
+
),
|
|
180
|
+
Quantity(
|
|
181
|
+
'kpoint',
|
|
182
|
+
r'K *\[\d+\].+?\: *(.+)',
|
|
183
|
+
dtype=np.dtype(np.float64),
|
|
184
|
+
),
|
|
185
|
+
]
|
|
186
|
+
),
|
|
187
|
+
),
|
|
188
|
+
Quantity(
|
|
189
|
+
'output',
|
|
190
|
+
r'(\[WR.+?\.QP\][\s\S]+?- S/N \d+.+)',
|
|
191
|
+
repeats=True,
|
|
192
|
+
sub_parser=TextParser(quantities=io_quantities),
|
|
193
|
+
),
|
|
194
|
+
]
|
|
195
|
+
),
|
|
196
|
+
)
|
|
197
|
+
|
|
198
|
+
module_quantities = [
|
|
199
|
+
Quantity(
|
|
200
|
+
'dipoles',
|
|
201
|
+
r'Dipoles *\n([\s\S]+?)\n *\[\d+\]',
|
|
202
|
+
sub_parser=TextParser(
|
|
203
|
+
quantities=[
|
|
204
|
+
Quantity(
|
|
205
|
+
'input',
|
|
206
|
+
r'(\[RD.+?\][\s\S]+?- S/N \d+.+)',
|
|
207
|
+
repeats=True,
|
|
208
|
+
sub_parser=TextParser(quantities=io_quantities),
|
|
209
|
+
),
|
|
210
|
+
Quantity(
|
|
211
|
+
'output',
|
|
212
|
+
r'(\[WR.+?\.dipoles\][\s\S]+?- S/N \d+.+)',
|
|
213
|
+
repeats=True,
|
|
214
|
+
sub_parser=TextParser(quantities=io_quantities),
|
|
215
|
+
),
|
|
216
|
+
]
|
|
217
|
+
),
|
|
218
|
+
),
|
|
219
|
+
Quantity(
|
|
220
|
+
'local_xc_nonlocal_fock',
|
|
221
|
+
r'Local Exchange-Correlation \+ Non-Local Fock([\s\S]+?(?:\n *\[\d+\]|\Z))',
|
|
222
|
+
sub_parser=TextParser(
|
|
223
|
+
quantities=[
|
|
224
|
+
Quantity(
|
|
225
|
+
'output',
|
|
226
|
+
r'(\[WR.+?\.HF_and_locXC\][\s\S]+?- S/N \d+.+)',
|
|
227
|
+
repeats=True,
|
|
228
|
+
sub_parser=TextParser(quantities=io_quantities),
|
|
229
|
+
),
|
|
230
|
+
Quantity(
|
|
231
|
+
'x_yambo_plane_waves_vxc',
|
|
232
|
+
r'\[VXC\] Plane waves : *(\d+)',
|
|
233
|
+
dtype=np.int32,
|
|
234
|
+
),
|
|
235
|
+
Quantity(
|
|
236
|
+
'x_yambo_plane_waves_exs',
|
|
237
|
+
r'\[EXS\] Plane waves : *(\d+)',
|
|
238
|
+
dtype=np.int32,
|
|
239
|
+
),
|
|
240
|
+
Quantity(
|
|
241
|
+
'x_yambo_mesh_size',
|
|
242
|
+
r'Mesh size: *(\d+) *(\d+) *(\d+)',
|
|
243
|
+
dtype=np.dtype(np.int32),
|
|
244
|
+
),
|
|
245
|
+
Quantity(
|
|
246
|
+
'energy_xc',
|
|
247
|
+
rf'E_xc *: *({re_f}) \[Ha\]',
|
|
248
|
+
dtype=np.float64,
|
|
249
|
+
unit='hartree',
|
|
250
|
+
),
|
|
251
|
+
Quantity(
|
|
252
|
+
'corrections',
|
|
253
|
+
r'Corrections @ K \[\d+\] *: *\[eV\]([\s\S]+?)\n *\n',
|
|
254
|
+
repeats=True,
|
|
255
|
+
sub_parser=TextParser(
|
|
256
|
+
quantities=[
|
|
257
|
+
Quantity(
|
|
258
|
+
'band',
|
|
259
|
+
rf'\<\d+\|nlXC\|\d+\> *= *({re_f}) *{re_f} \<\d+\|lXC\|\d+\> *= *({re_f}) *{re_f}',
|
|
260
|
+
repeats=True,
|
|
261
|
+
dtype=np.dtype(np.float64),
|
|
262
|
+
)
|
|
263
|
+
]
|
|
264
|
+
),
|
|
265
|
+
),
|
|
266
|
+
Quantity(
|
|
267
|
+
'hf_occupations',
|
|
268
|
+
r'Hartree-Fock occupations report([\s\S]+?)(?:\n *\[\d+|\Z)',
|
|
269
|
+
sub_parser=TextParser(quantities=energies_quantities),
|
|
270
|
+
),
|
|
271
|
+
]
|
|
272
|
+
),
|
|
273
|
+
),
|
|
274
|
+
# TODO add support for em1d
|
|
275
|
+
Quantity(
|
|
276
|
+
'dynamic_dielectric_matrix',
|
|
277
|
+
r'Dynamic.+?Dielectric Matrix([\s\S]+?(?:\n *\[\d+\]|\Z))',
|
|
278
|
+
sub_parser=TextParser(
|
|
279
|
+
quantities=[
|
|
280
|
+
Quantity(
|
|
281
|
+
'output',
|
|
282
|
+
r'(\[WR.+?(?:pp|em1d|dip_iR_and_P)\][\s\S]+?- S/N \d+.+)',
|
|
283
|
+
repeats=True,
|
|
284
|
+
sub_parser=TextParser(quantities=io_quantities),
|
|
285
|
+
),
|
|
286
|
+
Quantity(
|
|
287
|
+
'x_yambo_mesh_size',
|
|
288
|
+
r'Mesh size: *(\d+) *(\d+) *(\d+)',
|
|
289
|
+
dtype=np.dtype(np.int32),
|
|
290
|
+
),
|
|
291
|
+
]
|
|
292
|
+
),
|
|
293
|
+
),
|
|
294
|
+
Quantity(
|
|
295
|
+
'bare_xc',
|
|
296
|
+
r'Bare local and non-local Exchange-Correlation([\s\S]+?(?:\n *\[\d+\]|\Z))',
|
|
297
|
+
sub_parser=TextParser(
|
|
298
|
+
quantities=[
|
|
299
|
+
Quantity(
|
|
300
|
+
'output',
|
|
301
|
+
r'(\[WR.+?\.HF_and_locXC\][\s\S]+?- S/N \d+.+)',
|
|
302
|
+
repeats=True,
|
|
303
|
+
sub_parser=TextParser(quantities=io_quantities),
|
|
304
|
+
),
|
|
305
|
+
Quantity(
|
|
306
|
+
'xc_hf_dft',
|
|
307
|
+
r'XC HF and DFT \[eV\]([\s\S]+?)\n *\n',
|
|
308
|
+
repeats=True,
|
|
309
|
+
sub_parser=TextParser(
|
|
310
|
+
quantities=[
|
|
311
|
+
Quantity(
|
|
312
|
+
'band',
|
|
313
|
+
rf'\<\d+\|HF\|\d+\> *= *({re_f}) *{re_f} *\<\d+\|DFT\|\d+\> *= *({re_f}) *{re_f}',
|
|
314
|
+
repeats=True,
|
|
315
|
+
dtype=np.dtype(np.float64),
|
|
316
|
+
)
|
|
317
|
+
]
|
|
318
|
+
),
|
|
319
|
+
),
|
|
320
|
+
Quantity(
|
|
321
|
+
'hf_occupations',
|
|
322
|
+
r'HF occupations report([\s\S]+?Direct Gaps.+)',
|
|
323
|
+
sub_parser=TextParser(quantities=energies_quantities),
|
|
324
|
+
),
|
|
325
|
+
]
|
|
326
|
+
),
|
|
327
|
+
),
|
|
328
|
+
Quantity(
|
|
329
|
+
'dyson',
|
|
330
|
+
r'Dyson equation: Newton solver([\s\S]+?(?:\n *\[\d+\]|\Z))',
|
|
331
|
+
sub_parser=TextParser(
|
|
332
|
+
quantities=[
|
|
333
|
+
qp_properties_quantity,
|
|
334
|
+
Quantity(
|
|
335
|
+
'g0w0',
|
|
336
|
+
r'G0W0([\s\S]+?\n *\[\d+\.\d+\])',
|
|
337
|
+
sub_parser=TextParser(
|
|
338
|
+
quantities=[
|
|
339
|
+
Quantity(
|
|
340
|
+
'x_yambo_bands_range',
|
|
341
|
+
r'Bands range *: *(\d+) *(\d+)',
|
|
342
|
+
dtype=np.dtype(np.int32),
|
|
343
|
+
),
|
|
344
|
+
Quantity(
|
|
345
|
+
'x_yambo_g_damping',
|
|
346
|
+
rf'G damping.+?: *({re_f})',
|
|
347
|
+
dtype=np.float64,
|
|
348
|
+
),
|
|
349
|
+
Quantity(
|
|
350
|
+
'x_yambo_mesh_size',
|
|
351
|
+
r'Mesh size: *(\d+) *(\d+) *(\d+)',
|
|
352
|
+
dtype=np.dtype(np.int32),
|
|
353
|
+
),
|
|
354
|
+
Quantity(
|
|
355
|
+
'input',
|
|
356
|
+
r'(\[RD.+?\.pp\][\s\S]+?- S/N \d+.+)',
|
|
357
|
+
repeats=True,
|
|
358
|
+
sub_parser=TextParser(quantities=io_quantities),
|
|
359
|
+
),
|
|
360
|
+
]
|
|
361
|
+
),
|
|
362
|
+
),
|
|
363
|
+
]
|
|
364
|
+
),
|
|
365
|
+
),
|
|
366
|
+
]
|
|
367
|
+
|
|
368
|
+
self._quantities = [
|
|
369
|
+
Quantity(
|
|
370
|
+
'version', r'Version ([\d.]+ Revision \d+)', flatten=False, dtype=str
|
|
371
|
+
),
|
|
372
|
+
Quantity('hash', r'Hash (\S+)', dtype=str),
|
|
373
|
+
Quantity('build', r'(\S+) Build', dtype=str),
|
|
374
|
+
Quantity(
|
|
375
|
+
'date_start',
|
|
376
|
+
r' (\d\d/\d\d/\d\d\d\d) at (\d\d:\d\d) YAMBO @ .+',
|
|
377
|
+
flatten=False,
|
|
378
|
+
dtype=str,
|
|
379
|
+
),
|
|
380
|
+
Quantity(
|
|
381
|
+
'cpu_files_io',
|
|
382
|
+
r'((?:Cores |CPU structure)[\s\S]+?)\n *\[\d+\]',
|
|
383
|
+
sub_parser=TextParser(
|
|
384
|
+
quantities=[
|
|
385
|
+
Quantity(
|
|
386
|
+
'parameters',
|
|
387
|
+
r'([A-Z][\w/ ]+).*?(?: is | in |: ) *(\S+)',
|
|
388
|
+
repeats=True,
|
|
389
|
+
str_operation=lambda x: [
|
|
390
|
+
v.strip() for v in x.rsplit(' ', 1)
|
|
391
|
+
],
|
|
392
|
+
),
|
|
393
|
+
Quantity(
|
|
394
|
+
'input',
|
|
395
|
+
r'( \[RD.+[\s\S]+?- S/N \d+.+)',
|
|
396
|
+
repeats=False,
|
|
397
|
+
sub_parser=TextParser(quantities=io_quantities),
|
|
398
|
+
),
|
|
399
|
+
]
|
|
400
|
+
),
|
|
401
|
+
),
|
|
402
|
+
Quantity(
|
|
403
|
+
'core_variables_setup',
|
|
404
|
+
r'(CORE Variables Setup[\s\S]+?)\n *\[\d+\]',
|
|
405
|
+
sub_parser=TextParser(
|
|
406
|
+
quantities=[
|
|
407
|
+
Quantity(
|
|
408
|
+
'energies_occupations',
|
|
409
|
+
r'Energies.+?& Occupations([\s\S]+?)(?:\[0|\Z)',
|
|
410
|
+
sub_parser=TextParser(
|
|
411
|
+
quantities=energies_quantities
|
|
412
|
+
+ [
|
|
413
|
+
Quantity(
|
|
414
|
+
'eigenenergies',
|
|
415
|
+
rf'Energy unit is electronVolt \[eV\]([\s\S]+E *{re_f} *{re_f} *{re_f}.+)',
|
|
416
|
+
sub_parser=TextParser(
|
|
417
|
+
quantities=[
|
|
418
|
+
Quantity(
|
|
419
|
+
'energies',
|
|
420
|
+
rf'\n *E *({re_f} .+)',
|
|
421
|
+
repeats=True,
|
|
422
|
+
dtype=np.dtype(np.float64),
|
|
423
|
+
),
|
|
424
|
+
Quantity(
|
|
425
|
+
'kpoints',
|
|
426
|
+
rf'({re_f} *{re_f} *{re_f}) \(rlu\)',
|
|
427
|
+
repeats=True,
|
|
428
|
+
dtype=np.dtype(np.float64),
|
|
429
|
+
),
|
|
430
|
+
Quantity(
|
|
431
|
+
'kpoints_weights',
|
|
432
|
+
rf'weight +({re_f})',
|
|
433
|
+
repeats=True,
|
|
434
|
+
dtype=np.float64,
|
|
435
|
+
),
|
|
436
|
+
]
|
|
437
|
+
),
|
|
438
|
+
)
|
|
439
|
+
]
|
|
440
|
+
),
|
|
441
|
+
)
|
|
442
|
+
]
|
|
443
|
+
),
|
|
444
|
+
),
|
|
445
|
+
Quantity(
|
|
446
|
+
'transferred_momenta',
|
|
447
|
+
r'Transferred momenta grid([\s\S]+?)\n *\[\d+\]',
|
|
448
|
+
sub_parser=TextParser(
|
|
449
|
+
quantities=[
|
|
450
|
+
Quantity(
|
|
451
|
+
'input',
|
|
452
|
+
r'( \[RD.+[\s\S]+?- S/N \d+.+)',
|
|
453
|
+
repeats=True,
|
|
454
|
+
sub_parser=TextParser(quantities=io_quantities),
|
|
455
|
+
),
|
|
456
|
+
Quantity(
|
|
457
|
+
'qpoints',
|
|
458
|
+
rf'Q \[\d+\] *: *({re_f}) *({re_f}) *({re_f}) *\(iku\) \* weight *({re_f})',
|
|
459
|
+
repeats=True,
|
|
460
|
+
dtype=np.dtype(np.float64),
|
|
461
|
+
),
|
|
462
|
+
Quantity(
|
|
463
|
+
'module',
|
|
464
|
+
r'((?:Dipoles *\n|Dynamic Dielectric|Dyson|Bare local|Local Exchange)[\s\S]+?\n *\[\d+\.\d+\])',
|
|
465
|
+
repeats=True,
|
|
466
|
+
sub_parser=TextParser(quantities=module_quantities),
|
|
467
|
+
),
|
|
468
|
+
qp_properties_quantity,
|
|
469
|
+
]
|
|
470
|
+
),
|
|
471
|
+
),
|
|
472
|
+
Quantity(
|
|
473
|
+
'module',
|
|
474
|
+
r'((?:Dipoles *\n|Dynamic.+?Dielectric|Dyson|Bare local|Local Exchange)[\s\S]+?\n *\[\d+\])',
|
|
475
|
+
repeats=True,
|
|
476
|
+
sub_parser=TextParser(quantities=module_quantities),
|
|
477
|
+
),
|
|
478
|
+
]
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
class NetCDFParser(FileParser):
|
|
482
|
+
def __init__(self):
|
|
483
|
+
super().__init__()
|
|
484
|
+
|
|
485
|
+
def init_parameters(self):
|
|
486
|
+
self._keys = []
|
|
487
|
+
|
|
488
|
+
@property
|
|
489
|
+
def netcdf_file(self):
|
|
490
|
+
if self._file_handler is None:
|
|
491
|
+
try:
|
|
492
|
+
self._file_handler = Dataset(self.mainfile)
|
|
493
|
+
except Exception:
|
|
494
|
+
self.logger.warning('Error loading file.')
|
|
495
|
+
|
|
496
|
+
return self._file_handler
|
|
497
|
+
|
|
498
|
+
def parse(self, key=None):
|
|
499
|
+
self._results = dict() if self._results is None else self._results
|
|
500
|
+
if self.netcdf_file is None:
|
|
501
|
+
return
|
|
502
|
+
|
|
503
|
+
self._keys = list(self.netcdf_file.variables.keys())
|
|
504
|
+
for netcdf_variable in self._keys:
|
|
505
|
+
self._results[netcdf_variable] = self.netcdf_file.variables[
|
|
506
|
+
netcdf_variable
|
|
507
|
+
][:].data
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
class InputParser(TextParser):
|
|
511
|
+
def __init__(self):
|
|
512
|
+
super().__init__()
|
|
513
|
+
|
|
514
|
+
def init_quantities(self):
|
|
515
|
+
def str_to_key_block(val_in):
|
|
516
|
+
val = val_in.strip().split('\n')
|
|
517
|
+
return val[0].strip(), [
|
|
518
|
+
np.array(v.split('#')[0].split('|')[:-1], dtype=np.float64)
|
|
519
|
+
for v in val[1:]
|
|
520
|
+
]
|
|
521
|
+
|
|
522
|
+
self._quantities = [
|
|
523
|
+
Quantity('key_value', r'\n *(\w+) *= *(.+) *#*', repeats=True),
|
|
524
|
+
Quantity(
|
|
525
|
+
'key_block',
|
|
526
|
+
r'\n *\% *(\w+)([\s\S]+?)\%',
|
|
527
|
+
repeats=True,
|
|
528
|
+
str_operation=str_to_key_block,
|
|
529
|
+
),
|
|
530
|
+
]
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
class YamboParser:
|
|
534
|
+
def __init__(self):
|
|
535
|
+
self.mainfile_parser = MainfileParser()
|
|
536
|
+
self.input_parser = InputParser()
|
|
537
|
+
self.netcdf_parser = NetCDFParser()
|
|
538
|
+
self.metainfo_map = {
|
|
539
|
+
'cpu': 'cores',
|
|
540
|
+
'threads': 'threads_per_core',
|
|
541
|
+
'threads_tot': 'threads_total',
|
|
542
|
+
'io_nodes': 'nodes_io',
|
|
543
|
+
}
|
|
544
|
+
self._module = None
|
|
545
|
+
|
|
546
|
+
def init_parser(self):
|
|
547
|
+
self.mainfile_parser.mainfile = self.filepath
|
|
548
|
+
self._module = None
|
|
549
|
+
|
|
550
|
+
def parse_method(self, source, target=None):
|
|
551
|
+
if source is None:
|
|
552
|
+
return
|
|
553
|
+
|
|
554
|
+
if target is None:
|
|
555
|
+
method = Method()
|
|
556
|
+
self.archive.run[-1].method.append(method)
|
|
557
|
+
else:
|
|
558
|
+
method = target
|
|
559
|
+
|
|
560
|
+
section = self._module()
|
|
561
|
+
section_def = method.m_def.all_sub_sections_by_section.get(self._module.m_def)[
|
|
562
|
+
0
|
|
563
|
+
]
|
|
564
|
+
method.m_add_sub_section(section_def, section)
|
|
565
|
+
|
|
566
|
+
for input in source.get('input', []):
|
|
567
|
+
parameters = {key.strip(): val for key, val in input.get('key_value', [])}
|
|
568
|
+
x_yambo_input = x_yambo_io()
|
|
569
|
+
section.x_yambo_input.append(x_yambo_input)
|
|
570
|
+
x_yambo_input.x_yambo_file = input.file
|
|
571
|
+
x_yambo_input.x_yambo_sn = input.sn
|
|
572
|
+
x_yambo_input.x_yambo_parameters = parameters
|
|
573
|
+
|
|
574
|
+
for output in source.get('output', []):
|
|
575
|
+
parameters = {key.strip(): val for key, val in output.get('key_value', [])}
|
|
576
|
+
x_yambo_output = x_yambo_io()
|
|
577
|
+
section.x_yambo_output.append(x_yambo_output)
|
|
578
|
+
x_yambo_output.x_yambo_file = output.file
|
|
579
|
+
x_yambo_output.x_yambo_sn = output.sn
|
|
580
|
+
x_yambo_output.x_yambo_parameters = parameters
|
|
581
|
+
|
|
582
|
+
for key, val in source.items():
|
|
583
|
+
if key.startswith('x_yambo'):
|
|
584
|
+
setattr(section, key, val)
|
|
585
|
+
|
|
586
|
+
def parse_calculation(self, source, target=None):
|
|
587
|
+
if source is None:
|
|
588
|
+
return
|
|
589
|
+
|
|
590
|
+
if target is None:
|
|
591
|
+
calc = Calculation()
|
|
592
|
+
self.archive.run[-1].calculation.append(calc)
|
|
593
|
+
else:
|
|
594
|
+
calc = target
|
|
595
|
+
valence_conduction = source.get(
|
|
596
|
+
'valence_conduction',
|
|
597
|
+
[source.get('valence', 0.0), source.get('conduction', 0.0)],
|
|
598
|
+
)
|
|
599
|
+
calc.energy = Energy(
|
|
600
|
+
fermi=source.get('fermi', 0.0),
|
|
601
|
+
highest_occupied=valence_conduction[0],
|
|
602
|
+
lowest_unoccupied=valence_conduction[1],
|
|
603
|
+
)
|
|
604
|
+
|
|
605
|
+
states = source.states_summary
|
|
606
|
+
if states is not None:
|
|
607
|
+
calc.x_yambo_filled_bands = [int(s) for s in states[0]]
|
|
608
|
+
calc.x_yambo_empty_bands = [int(s) for s in states[-1]]
|
|
609
|
+
|
|
610
|
+
if self.netcdf_parser.EIGENVALUES is not None:
|
|
611
|
+
eigenvalues = BandEnergies()
|
|
612
|
+
calc.eigenvalues.append(eigenvalues)
|
|
613
|
+
eigenvalues.kpoints = np.transpose(self.netcdf_parser.get('K-POINTS'))
|
|
614
|
+
eigenvalues.energies = self.netcdf_parser.EIGENVALUES * ureg.eV
|
|
615
|
+
|
|
616
|
+
elif source.eigenenergies is not None:
|
|
617
|
+
eigenvalues = BandEnergies()
|
|
618
|
+
calc.eigenvalues.append(eigenvalues)
|
|
619
|
+
eigenvalues.kpoints = source.eigenenergies.kpoints
|
|
620
|
+
eigenvalues.kpoints_weights = source.eigenenergies.kpoints_weights
|
|
621
|
+
# TODO deal with spin polarized data
|
|
622
|
+
energies = source.eigenenergies.energies
|
|
623
|
+
eigenvalues.energies = (
|
|
624
|
+
np.reshape(
|
|
625
|
+
energies,
|
|
626
|
+
(
|
|
627
|
+
1,
|
|
628
|
+
len(eigenvalues.kpoints),
|
|
629
|
+
np.size(energies) // len(eigenvalues.kpoints),
|
|
630
|
+
),
|
|
631
|
+
)
|
|
632
|
+
* ureg.eV
|
|
633
|
+
)
|
|
634
|
+
|
|
635
|
+
if (
|
|
636
|
+
self.netcdf_parser.QP_E_Eo_Z is not None
|
|
637
|
+
or self.netcdf_parser.QP_E is not None
|
|
638
|
+
):
|
|
639
|
+
gw_band_energies = BandEnergies()
|
|
640
|
+
calc.eigenvalues.append(gw_band_energies)
|
|
641
|
+
n_spin = self.netcdf_parser.QP_table.shape[1] // 2
|
|
642
|
+
gw_band_energies.kpoints = self.netcdf_parser.QP_kpts.T
|
|
643
|
+
if self.netcdf_parser.QP_E_Eo_Z is not None:
|
|
644
|
+
qp_energy, bare_energy, z = self.netcdf_parser.QP_E_Eo_Z[0].T
|
|
645
|
+
else:
|
|
646
|
+
qp_energy = self.netcdf_parser.QP_E.T[0]
|
|
647
|
+
bare_energy = self.netcdf_parser.QP_Eo
|
|
648
|
+
z = self.netcdf_parser.QP_Z.T[0]
|
|
649
|
+
# TODO verify if indeed energies are only for one kpoint
|
|
650
|
+
shape = (n_spin, 1, len(qp_energy) // n_spin)
|
|
651
|
+
gw_band_energies.value_qp = np.reshape(qp_energy, shape) * ureg.hartree
|
|
652
|
+
gw_band_energies.value_ks = np.reshape(bare_energy, shape) * ureg.hartree
|
|
653
|
+
gw_band_energies.qp_linearization_prefactor = np.reshape(z, shape)
|
|
654
|
+
|
|
655
|
+
elif source.qp_energy is not None:
|
|
656
|
+
gw_band_energies = BandEnergies()
|
|
657
|
+
calc.eigenvalues.append(gw_band_energies)
|
|
658
|
+
qp_energy = source.qp_energy
|
|
659
|
+
gw_band_energies.kpoints = [q.kpoint for q in qp_energy]
|
|
660
|
+
energies = np.transpose([q.band for q in qp_energy])
|
|
661
|
+
qp_energy = energies[2].T
|
|
662
|
+
gw_band_energies.value_qp = (
|
|
663
|
+
np.reshape(qp_energy, (1, *np.shape(qp_energy))) * ureg.eV
|
|
664
|
+
)
|
|
665
|
+
gw_band_energies.value_ks = (
|
|
666
|
+
np.reshape(energies[1].T, (1, *np.shape(qp_energy))) * ureg.eV
|
|
667
|
+
)
|
|
668
|
+
gw_band_energies.qp_linearization_prefactor = np.reshape(
|
|
669
|
+
energies[4].T, (1, *np.shape(qp_energy))
|
|
670
|
+
)
|
|
671
|
+
|
|
672
|
+
if self.netcdf_parser.Sx_Vxc is not None or self.netcdf_parser.Sx is not None:
|
|
673
|
+
n_spin = self.netcdf_parser.QP_table.shape[1] // 2
|
|
674
|
+
if calc.eigenvalues:
|
|
675
|
+
gw_band_energies = calc.eigenvalues[-1]
|
|
676
|
+
else:
|
|
677
|
+
gw_band_energies = BandEnergies()
|
|
678
|
+
calc.eigenvalues.append(gw_band_energies)
|
|
679
|
+
if self.netcdf_parser.Sx_Vxc is not None:
|
|
680
|
+
if self.netcdf_parser.Sx_Vxc.shape[0] % 8 == 0:
|
|
681
|
+
qp = self.netcdf_parser.Sx_Vxc.reshape(-1, 8).T
|
|
682
|
+
sx, vxc = qp[4], qp[6]
|
|
683
|
+
else:
|
|
684
|
+
qp = self.netcdf_parser.Sx_Vxc.reshape(-1, 7).T
|
|
685
|
+
sx, vxc = qp[3], qp[5]
|
|
686
|
+
else:
|
|
687
|
+
sx = self.netcdf_parser.Sx.T[0]
|
|
688
|
+
vxc = self.netcdf_parser.Vxc.T[0]
|
|
689
|
+
shape = (n_spin, 1, len(sx) // n_spin)
|
|
690
|
+
gw_band_energies.value_exchange = np.reshape(sx, shape)
|
|
691
|
+
gw_band_energies.value_xc_potential = np.reshape(vxc, shape)
|
|
692
|
+
|
|
693
|
+
for key, val in source.items():
|
|
694
|
+
if key.startswith('x_yambo') and val is not None:
|
|
695
|
+
setattr(calc, key, val)
|
|
696
|
+
|
|
697
|
+
return calc
|
|
698
|
+
|
|
699
|
+
def parse_input(self):
|
|
700
|
+
if self.mainfile_parser.cpu_files_io.input is None:
|
|
701
|
+
return
|
|
702
|
+
|
|
703
|
+
run = self.archive.run[-1]
|
|
704
|
+
|
|
705
|
+
# read structure data from netcdf input file
|
|
706
|
+
self.netcdf_parser.mainfile = os.path.join(
|
|
707
|
+
self.maindir, self.mainfile_parser.cpu_files_io.input.file
|
|
708
|
+
)
|
|
709
|
+
if self.netcdf_parser.mainfile is not None:
|
|
710
|
+
system = System()
|
|
711
|
+
run.system.append(system)
|
|
712
|
+
positions = self.netcdf_parser.get('ATOM_POS', [])
|
|
713
|
+
n_atoms = self.netcdf_parser.N_ATOMS
|
|
714
|
+
atom_numbers = np.hstack(
|
|
715
|
+
[
|
|
716
|
+
[self.netcdf_parser.atomic_numbers[int(n)]] * int(n_atoms[int(n)])
|
|
717
|
+
for n in range(len(n_atoms))
|
|
718
|
+
]
|
|
719
|
+
)
|
|
720
|
+
system.atoms = Atoms(
|
|
721
|
+
positions=np.reshape(positions, (np.size(positions) // 3, 3))
|
|
722
|
+
* ureg.bohr,
|
|
723
|
+
labels=[chemical_symbols[int(n)] for n in atom_numbers],
|
|
724
|
+
)
|
|
725
|
+
if self.netcdf_parser.LATTICE_VECTORS is not None:
|
|
726
|
+
system.atoms.lattice_vectors = (
|
|
727
|
+
self.netcdf_parser.LATTICE_VECTORS * ureg.bohr
|
|
728
|
+
)
|
|
729
|
+
|
|
730
|
+
# reference calculation
|
|
731
|
+
energies_occupations = self.mainfile_parser.get('core_variables_setup', {}).get(
|
|
732
|
+
'energies_occupations'
|
|
733
|
+
)
|
|
734
|
+
self.parse_calculation(energies_occupations)
|
|
735
|
+
|
|
736
|
+
# input parameters from mainfile
|
|
737
|
+
input = x_yambo_io()
|
|
738
|
+
run.x_yambo_input = input
|
|
739
|
+
input.x_yambo_file = self.mainfile_parser.cpu_files_io.input.file
|
|
740
|
+
input.x_yambo_sn = self.mainfile_parser.cpu_files_io.input.sn
|
|
741
|
+
parameters = {
|
|
742
|
+
key.strip(): val
|
|
743
|
+
for key, val in self.mainfile_parser.cpu_files_io.input.get('key_value', [])
|
|
744
|
+
}
|
|
745
|
+
input.x_yambo_parameters = parameters
|
|
746
|
+
|
|
747
|
+
def parse_dynamic_dielectric_matrix(self, module):
|
|
748
|
+
source = module.dynamic_dielectric_matrix
|
|
749
|
+
if source is None:
|
|
750
|
+
return
|
|
751
|
+
|
|
752
|
+
self._module = x_yambo_dynamic_dielectric_matrix
|
|
753
|
+
self.parse_method(source)
|
|
754
|
+
|
|
755
|
+
for output in source.get('output', []):
|
|
756
|
+
path = os.path.join(self.maindir, os.path.dirname(output.get('file', '')))
|
|
757
|
+
if not os.path.isdir(path):
|
|
758
|
+
continue
|
|
759
|
+
ddm = self.archive.run[-1].method[-1].x_yambo_dynamic_dielectric_matrix[-1]
|
|
760
|
+
for filename in os.listdir(path):
|
|
761
|
+
if 'pp_fragment_' not in filename:
|
|
762
|
+
continue
|
|
763
|
+
self.netcdf_parser.mainfile = os.path.join(path, filename)
|
|
764
|
+
if self.netcdf_parser.mainfile is None:
|
|
765
|
+
continue
|
|
766
|
+
fragment = x_yambo_dynamic_dielectric_matrix_fragment()
|
|
767
|
+
ddm.x_yambo_fragment.append(fragment)
|
|
768
|
+
self.netcdf_parser.parse()
|
|
769
|
+
for key in self.netcdf_parser._keys:
|
|
770
|
+
val = self.netcdf_parser.get(key)
|
|
771
|
+
if key.startswith('FREQ_PARS_sec_iq'):
|
|
772
|
+
fragment.x_yambo_FREQ_PARS_sec_iq = val
|
|
773
|
+
elif key.startswith('FREQ_sec_iq'):
|
|
774
|
+
fragment.x_yambo_FREQ_sec_iq = val
|
|
775
|
+
elif key.startswith('X_Q'):
|
|
776
|
+
fragment.x_yambo_X_Q = val
|
|
777
|
+
|
|
778
|
+
def parse_local_xc_nonlocal_fock(self, module):
|
|
779
|
+
source = module.local_xc_nonlocal_fock
|
|
780
|
+
if source is None:
|
|
781
|
+
return
|
|
782
|
+
|
|
783
|
+
self._module = x_yambo_local_xc_nonlocal_fock
|
|
784
|
+
self.parse_method(source)
|
|
785
|
+
calc = self.parse_calculation(source.hf_occupations)
|
|
786
|
+
|
|
787
|
+
if source.corrections is not None:
|
|
788
|
+
if calc is None:
|
|
789
|
+
calc = Calculation()
|
|
790
|
+
self.archive.run[-1].calculation.append(calc)
|
|
791
|
+
if len(calc.x_yambo_local_xc_nonlocal_fock_bandenergies) == 0:
|
|
792
|
+
band_energy = x_yambo_local_xc_nonlocal_fock_bandenergies()
|
|
793
|
+
calc.x_yambo_local_xc_nonlocal_fock_bandenergies.append(band_energy)
|
|
794
|
+
sx, vxc = np.transpose([c.band for c in source.corrections])
|
|
795
|
+
band_energy.x_yambo_sx = np.reshape(sx, (1, *np.shape(sx.T))) * ureg.eV
|
|
796
|
+
band_energy.x_yambo_vxc = (
|
|
797
|
+
np.reshape(vxc, (1, *np.shape(vxc.T))) * ureg.eV
|
|
798
|
+
)
|
|
799
|
+
|
|
800
|
+
if source.energy_xc is not None:
|
|
801
|
+
calc.energy = Energy(xc=EnergyEntry(value=source.energy_xc))
|
|
802
|
+
|
|
803
|
+
def parse_bare_xc(self, module):
|
|
804
|
+
source = module.bare_xc
|
|
805
|
+
if source is None:
|
|
806
|
+
return
|
|
807
|
+
|
|
808
|
+
self._module = x_yambo_bare_xc
|
|
809
|
+
self.parse_method(source)
|
|
810
|
+
calc = self.parse_calculation(source.hf_occupations)
|
|
811
|
+
if source.xc_hf_dft is not None:
|
|
812
|
+
if calc is None:
|
|
813
|
+
calc = Calculation()
|
|
814
|
+
self.archive.run[-1].calculation.append(calc)
|
|
815
|
+
if len(calc.x_yambo_bare_xc_bandenergies) == 0:
|
|
816
|
+
band_energy = x_yambo_bare_xc_bandenergies()
|
|
817
|
+
calc.x_yambo_bare_xc_bandenergies.append(band_energy)
|
|
818
|
+
hf, dft = np.transpose([h.band for h in source.xc_hf_dft])
|
|
819
|
+
hf, dft = hf.T, dft.T
|
|
820
|
+
band_energy.x_yambo_hf = np.reshape(hf, (1, *np.shape(hf))) * ureg.eV
|
|
821
|
+
band_energy.x_yambo_dft = np.reshape(dft, (1, *np.shape(dft))) * ureg.eV
|
|
822
|
+
|
|
823
|
+
def parse_dipoles(self, module):
|
|
824
|
+
source = module.dipoles
|
|
825
|
+
if source is None:
|
|
826
|
+
return
|
|
827
|
+
self._module = x_yambo_dipoles
|
|
828
|
+
self.parse_method(source)
|
|
829
|
+
|
|
830
|
+
def parse_dyson(self, module):
|
|
831
|
+
source = module.dyson
|
|
832
|
+
if source is None:
|
|
833
|
+
return
|
|
834
|
+
|
|
835
|
+
self._module = x_yambo_dyson
|
|
836
|
+
|
|
837
|
+
if source.g0w0 is not None:
|
|
838
|
+
self.parse_method(source.g0w0)
|
|
839
|
+
|
|
840
|
+
if source.qp_properties is not None:
|
|
841
|
+
self.parse_method(source.qp_properties, self.archive.run[-1].method[-1])
|
|
842
|
+
for output in source.qp_properties.get('output', []):
|
|
843
|
+
self.netcdf_parser.mainfile = os.path.join(
|
|
844
|
+
self.maindir, output.get('file', '')
|
|
845
|
+
)
|
|
846
|
+
self.netcdf_parser.parse()
|
|
847
|
+
self.parse_calculation(source.qp_properties)
|
|
848
|
+
|
|
849
|
+
def parse(self, filepath, archive, logger):
|
|
850
|
+
self.filepath = os.path.abspath(filepath)
|
|
851
|
+
self.archive = archive
|
|
852
|
+
self.maindir = os.path.dirname(self.filepath)
|
|
853
|
+
self.logger = logger if logger is not None else logging
|
|
854
|
+
|
|
855
|
+
self.init_parser()
|
|
856
|
+
|
|
857
|
+
run = Run()
|
|
858
|
+
self.archive.run.append(run)
|
|
859
|
+
run.program = Program(
|
|
860
|
+
name='YAMBO',
|
|
861
|
+
version=self.mainfile_parser.get('version', ''),
|
|
862
|
+
x_yambo_build=self.mainfile_parser.get('build', ''),
|
|
863
|
+
x_yambo_hash=self.mainfile_parser.get('hash', ''),
|
|
864
|
+
)
|
|
865
|
+
date = datetime.strptime(
|
|
866
|
+
self.mainfile_parser.get('date_start', '01/01/1970 00:00'), '%d/%m/%Y %H:%M'
|
|
867
|
+
) - datetime(1970, 1, 1)
|
|
868
|
+
run.time_run = TimeRun(date_start=date.total_seconds())
|
|
869
|
+
|
|
870
|
+
if self.mainfile_parser.cpu_files_io is not None:
|
|
871
|
+
self.parse_input()
|
|
872
|
+
for key, val in self.mainfile_parser.cpu_files_io.parameters:
|
|
873
|
+
key = key.strip().replace('/', '').replace(' ', '_').lower()
|
|
874
|
+
val = val == 'yes' if val in ['yes', 'no'] else val
|
|
875
|
+
setattr(run, 'x_yambo_%s' % key, val)
|
|
876
|
+
|
|
877
|
+
def parse_module(module):
|
|
878
|
+
self.parse_dipoles(module)
|
|
879
|
+
self.parse_dynamic_dielectric_matrix(module)
|
|
880
|
+
self.parse_local_xc_nonlocal_fock(module)
|
|
881
|
+
self.parse_bare_xc(module)
|
|
882
|
+
self.parse_dyson(module)
|
|
883
|
+
|
|
884
|
+
if self.mainfile_parser.transferred_momenta is not None:
|
|
885
|
+
self._module = x_yambo_transferred_momenta
|
|
886
|
+
self.parse_method(self.mainfile_parser.transferred_momenta)
|
|
887
|
+
self.parse_calculation(
|
|
888
|
+
self.mainfile_parser.transferred_momenta.qp_properties
|
|
889
|
+
)
|
|
890
|
+
for module in self.mainfile_parser.transferred_momenta.get('module', []):
|
|
891
|
+
parse_module(module)
|
|
892
|
+
|
|
893
|
+
for module in self.mainfile_parser.get('module', []):
|
|
894
|
+
parse_module(module)
|
|
895
|
+
|
|
896
|
+
self.netcdf_parser.close()
|