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,727 @@
|
|
|
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 numpy as np
|
|
20
|
+
import os
|
|
21
|
+
import logging
|
|
22
|
+
import h5py
|
|
23
|
+
import re
|
|
24
|
+
|
|
25
|
+
from typing import Any, Dict, Union
|
|
26
|
+
from nomad.units import ureg
|
|
27
|
+
from simulationworkflowschema import SinglePoint
|
|
28
|
+
from runschema.run import Run, Program
|
|
29
|
+
from runschema.calculation import (
|
|
30
|
+
Calculation,
|
|
31
|
+
ScfIteration,
|
|
32
|
+
Energy,
|
|
33
|
+
EnergyEntry,
|
|
34
|
+
GreensFunctions,
|
|
35
|
+
Dos,
|
|
36
|
+
DosValues,
|
|
37
|
+
)
|
|
38
|
+
from runschema.method import (
|
|
39
|
+
Method,
|
|
40
|
+
AtomParameters,
|
|
41
|
+
HubbardKanamoriModel,
|
|
42
|
+
KMesh,
|
|
43
|
+
FrequencyMesh,
|
|
44
|
+
TimeMesh,
|
|
45
|
+
DMFT,
|
|
46
|
+
)
|
|
47
|
+
from runschema.system import System, Atoms
|
|
48
|
+
from .metainfo.soliddmft import x_soliddmft_observables_parameters
|
|
49
|
+
from ..utils import numpy_type_to_json_serializable
|
|
50
|
+
|
|
51
|
+
|
|
52
|
+
class SolidDMFTParser:
|
|
53
|
+
def __init__(self):
|
|
54
|
+
self._re_namesafe = re.compile(r'[^\w]')
|
|
55
|
+
self._calculation_type = 'dmft'
|
|
56
|
+
|
|
57
|
+
self.code_keys = ['solid_dmft', 'solver', 'triqs']
|
|
58
|
+
|
|
59
|
+
self.angular_momentum = ['s', 'p', 'd', 'f']
|
|
60
|
+
|
|
61
|
+
self.dc_type = ['fll', 'held_formula', 'amf', 'fll_eg_orbitals']
|
|
62
|
+
|
|
63
|
+
self._solver_map = {
|
|
64
|
+
'cthyb': 'CT-HYB',
|
|
65
|
+
'ctint': 'CT-INT',
|
|
66
|
+
'ftps': 'MPS',
|
|
67
|
+
'hubbardI': 'hubbard_I',
|
|
68
|
+
'ctseg': 'CT-HYB',
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
self.iteration_gfs = [
|
|
72
|
+
'Delta_time',
|
|
73
|
+
'Delta_freq',
|
|
74
|
+
'G0_freq',
|
|
75
|
+
'Gimp_freq',
|
|
76
|
+
'Gimp_time',
|
|
77
|
+
'Sigma_freq',
|
|
78
|
+
]
|
|
79
|
+
|
|
80
|
+
self.observable_gfs = ['imp_gb2', 'imp_occ', 'orb_Z', 'orb_gb2', 'orb_occ']
|
|
81
|
+
|
|
82
|
+
self._gf_map = {
|
|
83
|
+
'Sigma_freq': 'self_energy_iw',
|
|
84
|
+
'Gimp_freq': 'greens_function_iw',
|
|
85
|
+
'Gimp_time': 'greens_function_tau',
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
self._gf_freq_map = {
|
|
89
|
+
'real': {
|
|
90
|
+
'Delta_freq': 'hybridization_function_freq',
|
|
91
|
+
'Gimp_freq': 'greens_function_freq',
|
|
92
|
+
'Sigma_freq': 'self_energy_freq',
|
|
93
|
+
'Gimp_time': 'greens_function_tau',
|
|
94
|
+
},
|
|
95
|
+
'matsubara': {
|
|
96
|
+
'Delta_freq': 'hybridization_function_iw',
|
|
97
|
+
'Gimp_freq': 'greens_function_iw',
|
|
98
|
+
'Sigma_freq': 'self_energy_iw',
|
|
99
|
+
'Gimp_time': 'greens_function_tau',
|
|
100
|
+
},
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
def extract_groups_datasets(
|
|
104
|
+
self,
|
|
105
|
+
data: Union[h5py.Dataset, h5py.Group],
|
|
106
|
+
default: Union[bool, int, float, np.ndarray, None] = None,
|
|
107
|
+
):
|
|
108
|
+
"""Extracts the content from the h5 file groups and datasets.
|
|
109
|
+
|
|
110
|
+
For a dataset, returns the extracted data or the default. For a group, returns a
|
|
111
|
+
dictionary with dataset names as keys and their content as values. If the content
|
|
112
|
+
is a byte string, it is decoded to a regular string.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
data (Union[h5py.Dataset, h5py.Group]): The dataset or group to extract from.
|
|
116
|
+
default (Union[bool, int, float, np.ndarray, None], optional): The default value
|
|
117
|
+
to return if data does not exists. Defaults to None.
|
|
118
|
+
|
|
119
|
+
Returns:
|
|
120
|
+
- For Dataset: The content of the dataset.
|
|
121
|
+
- For Group: Dictionary with dataset names as keys and their content as values.
|
|
122
|
+
- Otherwise: The default value.
|
|
123
|
+
"""
|
|
124
|
+
if isinstance(data, h5py.Dataset):
|
|
125
|
+
return data[()]
|
|
126
|
+
elif isinstance(data, h5py.Group):
|
|
127
|
+
params = {}
|
|
128
|
+
for key, value in data.items():
|
|
129
|
+
if not isinstance(value, h5py.Dataset) or value.shape or not value:
|
|
130
|
+
continue
|
|
131
|
+
val = value[()].decode() if isinstance(value[()], bytes) else value[()]
|
|
132
|
+
params[key] = numpy_type_to_json_serializable(val)
|
|
133
|
+
return params
|
|
134
|
+
else:
|
|
135
|
+
return default
|
|
136
|
+
|
|
137
|
+
def parse_system(self):
|
|
138
|
+
"""Parses the system information and stores it under self.archive.run[0].system."""
|
|
139
|
+
# TODO speak with solid_dmft devs to include this info in the output
|
|
140
|
+
sec_run = self.archive.run[-1]
|
|
141
|
+
if self.dft_input.get('kpt_basis'):
|
|
142
|
+
sec_system = System()
|
|
143
|
+
sec_run.system.append(sec_system)
|
|
144
|
+
sec_atoms = Atoms()
|
|
145
|
+
sec_system.atoms = sec_atoms
|
|
146
|
+
kpt_basis = self.extract_groups_datasets(self.dft_input.get('kpt_basis'))
|
|
147
|
+
if kpt_basis is not None:
|
|
148
|
+
sec_atoms.lattice_vectors_reciprocal = kpt_basis / ureg.angstrom
|
|
149
|
+
else:
|
|
150
|
+
pass
|
|
151
|
+
|
|
152
|
+
def parse_input_model(self, data: h5py.File):
|
|
153
|
+
"""Extracts the input model from the given data. The method focuses on:
|
|
154
|
+
1- the projection matrix
|
|
155
|
+
2- the Hubbard-Kanamori parameters.
|
|
156
|
+
|
|
157
|
+
The parsed information is stored under self.archive.run[0].method[0]
|
|
158
|
+
|
|
159
|
+
Args:
|
|
160
|
+
data (HDF5file): The data read from the h5 mainfile.
|
|
161
|
+
"""
|
|
162
|
+
sec_run = self.archive.run[-1]
|
|
163
|
+
sec_method = Method()
|
|
164
|
+
sec_run.method.append(sec_method)
|
|
165
|
+
|
|
166
|
+
# DFTTools code-specific input
|
|
167
|
+
for group_name in ['dft_input', 'dft_misc_input', 'dft_symmcorr_input']:
|
|
168
|
+
group = data.get(group_name)
|
|
169
|
+
if not group:
|
|
170
|
+
continue
|
|
171
|
+
params = self.extract_groups_datasets(group)
|
|
172
|
+
sec_method.m_set(
|
|
173
|
+
sec_method.m_get_quantity_definition(f'x_soliddmft_{group_name}'),
|
|
174
|
+
params,
|
|
175
|
+
)
|
|
176
|
+
|
|
177
|
+
# HoppingMatrix || ProjectionMatrix
|
|
178
|
+
proj_mat = self.extract_groups_datasets(self.dft_input.get('proj_mat'))
|
|
179
|
+
if proj_mat is not None:
|
|
180
|
+
sec_method.x_soliddmft_projection_matrix = (
|
|
181
|
+
proj_mat[:, 0, :, :, :, 0] + 1j * proj_mat[:, 0, :, :, :, 1]
|
|
182
|
+
)
|
|
183
|
+
|
|
184
|
+
# HubbardKanamoriModel
|
|
185
|
+
# TODO add parse for full_slater
|
|
186
|
+
# TODO add parse for crpa file
|
|
187
|
+
n_impurities = self.extract_groups_datasets(
|
|
188
|
+
self.dft_input.get('n_inequiv_shells'), 1
|
|
189
|
+
)
|
|
190
|
+
general_params = self.dmft_input.get('general_params')
|
|
191
|
+
for n in range(n_impurities):
|
|
192
|
+
n_imp = str(n)
|
|
193
|
+
sec_atom_parameters = AtomParameters()
|
|
194
|
+
sec_method.atom_parameters.append(sec_atom_parameters)
|
|
195
|
+
atom_impurity = self.dft_input.get('corr_shells')
|
|
196
|
+
if atom_impurity:
|
|
197
|
+
atom_index = self.extract_groups_datasets(
|
|
198
|
+
atom_impurity.get(n_imp).get('atom')
|
|
199
|
+
)
|
|
200
|
+
sec_atom_parameters.atom_index = atom_index
|
|
201
|
+
n_orbitals = self.extract_groups_datasets(
|
|
202
|
+
atom_impurity.get(n_imp).get('dim')
|
|
203
|
+
)
|
|
204
|
+
l_number = self.extract_groups_datasets(
|
|
205
|
+
atom_impurity.get(n_imp).get('l')
|
|
206
|
+
)
|
|
207
|
+
if n_orbitals and l_number:
|
|
208
|
+
sec_atom_parameters.n_orbitals = n_orbitals
|
|
209
|
+
angular_momentum = self.angular_momentum[l_number]
|
|
210
|
+
orbital_labels = [
|
|
211
|
+
f'{angular_momentum}{ml}' for ml in range(n_orbitals)
|
|
212
|
+
]
|
|
213
|
+
sec_atom_parameters.orbitals = orbital_labels
|
|
214
|
+
|
|
215
|
+
sec_hubbard_kanamori_model = HubbardKanamoriModel()
|
|
216
|
+
sec_atom_parameters.hubbard_kanamori_model = sec_hubbard_kanamori_model
|
|
217
|
+
hubbard_u = self.extract_groups_datasets(general_params.get('U').get(n_imp))
|
|
218
|
+
hubbard_j = self.extract_groups_datasets(general_params.get('J').get(n_imp))
|
|
219
|
+
if hubbard_u is not None and hubbard_j is not None:
|
|
220
|
+
sec_hubbard_kanamori_model.u = hubbard_u * ureg.eV
|
|
221
|
+
sec_hubbard_kanamori_model.jh = hubbard_j * ureg.eV
|
|
222
|
+
# solid_dmft keeps spin-rotational invariance
|
|
223
|
+
sec_hubbard_kanamori_model.up = (
|
|
224
|
+
sec_hubbard_kanamori_model.u - 2.0 * sec_hubbard_kanamori_model.jh
|
|
225
|
+
)
|
|
226
|
+
# issue with def of 'h_int_type' in the output h5 in different versions
|
|
227
|
+
h_int_type = general_params.get('h_int_type')
|
|
228
|
+
if isinstance(h_int_type, h5py.Dataset):
|
|
229
|
+
h_int_type = self.extract_groups_datasets(h_int_type)
|
|
230
|
+
elif isinstance(h_int_type, h5py.Group):
|
|
231
|
+
h_int_type = self.extract_groups_datasets(h_int_type.get(n_imp))
|
|
232
|
+
if h_int_type == b'density_density':
|
|
233
|
+
sec_hubbard_kanamori_model.j = 0.0
|
|
234
|
+
elif h_int_type == b'kanamori':
|
|
235
|
+
sec_hubbard_kanamori_model.j = sec_hubbard_kanamori_model.jh
|
|
236
|
+
dc_type = self.extract_groups_datasets(
|
|
237
|
+
general_params.get('dc_type'), 0
|
|
238
|
+
) # set to 'fll' by default
|
|
239
|
+
sec_hubbard_kanamori_model.double_counting_correction = self.dc_type[
|
|
240
|
+
dc_type
|
|
241
|
+
]
|
|
242
|
+
|
|
243
|
+
def parse_method(self):
|
|
244
|
+
"""Extracts the DMFT and related code-specific parameters from the 'DMFT_input' group.
|
|
245
|
+
|
|
246
|
+
The parsed information is stored under self.archive.run[0].method[1]
|
|
247
|
+
|
|
248
|
+
Note:
|
|
249
|
+
The extraction heavily relies on the structure and layout of the HDF5 dataset.
|
|
250
|
+
If the dataset changes or is restructured, this method may need adjustments.
|
|
251
|
+
"""
|
|
252
|
+
sec_run = self.archive.run[-1]
|
|
253
|
+
sec_method = Method()
|
|
254
|
+
sec_run.method.append(sec_method)
|
|
255
|
+
# ref to the Non- and InteractionHamiltonian
|
|
256
|
+
sec_method.starting_method_ref = sec_run.method[0]
|
|
257
|
+
|
|
258
|
+
# Code-specific
|
|
259
|
+
for group_name in ['general_params', 'solver_params', 'advanced_params']:
|
|
260
|
+
group = self.dmft_input.get(group_name)
|
|
261
|
+
if not group:
|
|
262
|
+
continue
|
|
263
|
+
params = self.extract_groups_datasets(group)
|
|
264
|
+
sec_method.m_set(
|
|
265
|
+
sec_method.m_get_quantity_definition(f'x_soliddmft_{group_name}'),
|
|
266
|
+
params,
|
|
267
|
+
)
|
|
268
|
+
|
|
269
|
+
# KMesh
|
|
270
|
+
sec_k_mesh = KMesh()
|
|
271
|
+
sec_method.k_mesh = sec_k_mesh
|
|
272
|
+
n_k = self.extract_groups_datasets(self.dft_input.get('n_k'), 1)
|
|
273
|
+
sec_k_mesh.n_points = n_k
|
|
274
|
+
kpts = self.extract_groups_datasets(self.dft_input.get('kpts'))
|
|
275
|
+
if kpts is not None:
|
|
276
|
+
sec_k_mesh.points = np.complex128(kpts)
|
|
277
|
+
kpt_weights = self.extract_groups_datasets(self.dft_input.get('kpt_weights'))
|
|
278
|
+
sec_k_mesh.weights = kpt_weights
|
|
279
|
+
|
|
280
|
+
# DMFT
|
|
281
|
+
sec_dmft = DMFT()
|
|
282
|
+
sec_method.dmft = sec_dmft
|
|
283
|
+
n_impurities = self.extract_groups_datasets(
|
|
284
|
+
self.dft_input.get('n_inequiv_shells'), 1
|
|
285
|
+
)
|
|
286
|
+
sec_dmft.n_impurities = n_impurities
|
|
287
|
+
impurity_orbitals = []
|
|
288
|
+
impurity_occupation = []
|
|
289
|
+
for n in range(n_impurities):
|
|
290
|
+
n_imp = str(n)
|
|
291
|
+
# Number of impurity orbitals
|
|
292
|
+
n_orbitals = self.extract_groups_datasets(
|
|
293
|
+
self.dft_input.get('corr_shells', {}).get(n_imp, {}).get('dim'), 1
|
|
294
|
+
)
|
|
295
|
+
impurity_orbitals.append(n_orbitals)
|
|
296
|
+
# Impurity occupation
|
|
297
|
+
occupation = (
|
|
298
|
+
self.dmft_results.get('observables', {}).get('imp_occ', {}).get(n_imp)
|
|
299
|
+
)
|
|
300
|
+
total_occupation = self.extract_groups_datasets(
|
|
301
|
+
occupation['down']['0']
|
|
302
|
+
) + self.extract_groups_datasets(occupation['up']['0'])
|
|
303
|
+
impurity_occupation.append(total_occupation)
|
|
304
|
+
sec_dmft.n_correlated_orbitals = impurity_orbitals
|
|
305
|
+
sec_dmft.n_electrons = impurity_occupation
|
|
306
|
+
# Beta
|
|
307
|
+
dmft_general_params = self.dmft_input.get('general_params', {})
|
|
308
|
+
beta = self.extract_groups_datasets(dmft_general_params.get('beta'))
|
|
309
|
+
if beta:
|
|
310
|
+
sec_dmft.inverse_temperature = beta / ureg.eV
|
|
311
|
+
magnetic_flag = self.extract_groups_datasets(
|
|
312
|
+
dmft_general_params.get('magnetic'), False
|
|
313
|
+
)
|
|
314
|
+
if magnetic_flag:
|
|
315
|
+
magmom = dmft_general_params.get('magmom')
|
|
316
|
+
if len(magmom) > 0:
|
|
317
|
+
magmom = [
|
|
318
|
+
self.extract_groups_datasets(magmom.get(keys))
|
|
319
|
+
for keys in magmom.keys()
|
|
320
|
+
]
|
|
321
|
+
sec_dmft.magnetic_state = (
|
|
322
|
+
'ferromagnetic'
|
|
323
|
+
if all(signs == 1.0 for signs in np.sign(magmom))
|
|
324
|
+
else 'antiferromagnetic'
|
|
325
|
+
)
|
|
326
|
+
else:
|
|
327
|
+
self.logger.warning(
|
|
328
|
+
'The magnetic flag is set to true, but the initial magnetic moment is not resolved. '
|
|
329
|
+
'Is this really a magnetic calculation without an initial magmom seed?'
|
|
330
|
+
)
|
|
331
|
+
else:
|
|
332
|
+
sec_dmft.magnetic_state = 'paramagnetic'
|
|
333
|
+
solver_type = self.extract_groups_datasets(
|
|
334
|
+
dmft_general_params.get('solver_type')
|
|
335
|
+
)
|
|
336
|
+
if solver_type:
|
|
337
|
+
sec_dmft.impurity_solver = self._solver_map[solver_type.decode()]
|
|
338
|
+
|
|
339
|
+
# MatsFrequencyMesh
|
|
340
|
+
n_iw = self.extract_groups_datasets(dmft_general_params.get('n_iw'))
|
|
341
|
+
if n_iw:
|
|
342
|
+
iw = np.array([(2 * (n - n_iw) + 1) * 1j / beta for n in range(2 * n_iw)])
|
|
343
|
+
iw = iw.reshape((2 * n_iw, 1))
|
|
344
|
+
sec_freq_mesh = FrequencyMesh(
|
|
345
|
+
dimensionality=1, n_points=n_iw, points=iw * ureg.eV
|
|
346
|
+
)
|
|
347
|
+
sec_method.m_add_sub_section(Method.frequency_mesh, sec_freq_mesh)
|
|
348
|
+
# TimeMesh
|
|
349
|
+
n_tau = self.extract_groups_datasets(dmft_general_params.get('n_tau'))
|
|
350
|
+
if n_tau:
|
|
351
|
+
tau = np.array([n * beta * 1j / (n_tau - 1) for n in range(n_tau)])
|
|
352
|
+
tau = tau.reshape((n_tau, 1))
|
|
353
|
+
sec_time_mesh = TimeMesh(dimensionality=1, n_points=n_tau, points=tau)
|
|
354
|
+
sec_method.m_add_sub_section(Method.time_mesh, sec_time_mesh)
|
|
355
|
+
# FrequencyMesh
|
|
356
|
+
n_w = self.extract_groups_datasets(dmft_general_params.get('n_w'))
|
|
357
|
+
if n_w:
|
|
358
|
+
w_min = self.extract_groups_datasets(
|
|
359
|
+
dmft_general_params.get('w_range', {}).get('0'), 0.0
|
|
360
|
+
)
|
|
361
|
+
w_max = self.extract_groups_datasets(
|
|
362
|
+
dmft_general_params.get('w_range', {}).get('1'), 0.0
|
|
363
|
+
)
|
|
364
|
+
freq = np.linspace(w_min, w_max, n_w)
|
|
365
|
+
freq = freq.reshape((n_w, 1))
|
|
366
|
+
sec_freq_mesh = FrequencyMesh(
|
|
367
|
+
dimensionality=1, n_points=n_w, points=freq * ureg.eV
|
|
368
|
+
)
|
|
369
|
+
sec_method.m_add_sub_section(Method.frequency_mesh, sec_freq_mesh)
|
|
370
|
+
|
|
371
|
+
def parse_scc(self):
|
|
372
|
+
"""Extracts the output quantities from the 'DMFT_results' group. These are mainly
|
|
373
|
+
Green's functions and related quantities.
|
|
374
|
+
|
|
375
|
+
The parsed information is stored under self.archive.run[0].calculation[0]
|
|
376
|
+
"""
|
|
377
|
+
sec_run = self.archive.run[-1]
|
|
378
|
+
sec_scc = Calculation()
|
|
379
|
+
sec_run.calculation.append(sec_scc)
|
|
380
|
+
sec_scc.system_ref = sec_run.system[-1] if sec_run.system else None
|
|
381
|
+
sec_scc.method_ref = sec_run.method[-1] # ref to DMFT
|
|
382
|
+
|
|
383
|
+
def parse_scf(
|
|
384
|
+
filename: str,
|
|
385
|
+
sec_scc: Calculation,
|
|
386
|
+
i_scf: int,
|
|
387
|
+
n_impurities: int,
|
|
388
|
+
convergence_obs: Dict[str, Any],
|
|
389
|
+
observables: Dict[str, Any],
|
|
390
|
+
farg: str = 'r+b',
|
|
391
|
+
):
|
|
392
|
+
"""Parses the scf iterations.
|
|
393
|
+
|
|
394
|
+
Args:
|
|
395
|
+
filename: Path to the h5 file.
|
|
396
|
+
farg: Arguments for reading and decoding the h5 file.
|
|
397
|
+
sec_scc (Calculation): Calculation section.
|
|
398
|
+
i_scf (int): Scf iteration index.
|
|
399
|
+
n_impurities (int): Number of impurities.
|
|
400
|
+
convergence_obs (Dict[str, Any]): Convergence of observables.
|
|
401
|
+
observables (Dict[str, Any]): Observables.
|
|
402
|
+
"""
|
|
403
|
+
sec_scf = ScfIteration()
|
|
404
|
+
sec_scc.scf_iteration.append(sec_scf)
|
|
405
|
+
# Convergence of the observables per scf iteration step
|
|
406
|
+
conv_obs = {}
|
|
407
|
+
for key, value in convergence_obs.items():
|
|
408
|
+
if len(value) == 0 or key == 'iteration':
|
|
409
|
+
continue
|
|
410
|
+
if key == 'd_mu':
|
|
411
|
+
val = self.extract_groups_datasets(value.get(f'{i_scf}'))
|
|
412
|
+
conv_obs[key] = numpy_type_to_json_serializable(val)
|
|
413
|
+
else:
|
|
414
|
+
for n in range(n_impurities):
|
|
415
|
+
n_imp = str(n)
|
|
416
|
+
if key == 'd_orb_occ':
|
|
417
|
+
d_orb_occ = self.extract_groups_datasets(
|
|
418
|
+
value.get(n_imp)[f'{i_scf}']
|
|
419
|
+
)
|
|
420
|
+
sec_scf.x_soliddmft_convergence_orb_occ = d_orb_occ
|
|
421
|
+
else:
|
|
422
|
+
val = self.extract_groups_datasets(
|
|
423
|
+
value.get(n_imp)[f'{i_scf}']
|
|
424
|
+
)
|
|
425
|
+
conv_obs[f'{key}_imp{n_imp}'] = (
|
|
426
|
+
numpy_type_to_json_serializable(val)
|
|
427
|
+
)
|
|
428
|
+
sec_scf.x_soliddmft_convergence_obs = conv_obs
|
|
429
|
+
|
|
430
|
+
# Energy per scf iteration step
|
|
431
|
+
sec_energy = Energy()
|
|
432
|
+
sec_scf.energy = sec_energy
|
|
433
|
+
total_energy = self.extract_groups_datasets(
|
|
434
|
+
observables.get('E_tot', {}).get(f'{i_scf + 1}')
|
|
435
|
+
)
|
|
436
|
+
if total_energy:
|
|
437
|
+
total_energy = total_energy * ureg.eV
|
|
438
|
+
sec_energy.total = EnergyEntry(value=total_energy)
|
|
439
|
+
chemical_potential = self.extract_groups_datasets(
|
|
440
|
+
observables.get('mu', {}).get(f'{i_scf + 1}')
|
|
441
|
+
)
|
|
442
|
+
if chemical_potential:
|
|
443
|
+
sec_energy.chemical_potential = chemical_potential * ureg.eV
|
|
444
|
+
dc_energy = []
|
|
445
|
+
for n in range(n_impurities):
|
|
446
|
+
dc_energy_atom = self.extract_groups_datasets(
|
|
447
|
+
observables.get('E_DC', {}).get(f'{n}').get(f'{i_scf + 1}')
|
|
448
|
+
)
|
|
449
|
+
dc_energy.append(dc_energy_atom)
|
|
450
|
+
sec_energy.double_counting = EnergyEntry(
|
|
451
|
+
values_per_atom=dc_energy * ureg.eV
|
|
452
|
+
)
|
|
453
|
+
|
|
454
|
+
# Observables per scf iteration step
|
|
455
|
+
scf_iteration = self.dmft_results.get(f'it_{i_scf + 1}')
|
|
456
|
+
for n in range(n_impurities):
|
|
457
|
+
n_imp = str(n_imp)
|
|
458
|
+
sec_obs_scf = x_soliddmft_observables_parameters()
|
|
459
|
+
sec_scf.x_soliddmft_observables.append(sec_obs_scf)
|
|
460
|
+
h5_base = f'{os.path.basename(self.mainfile)}#/DMFT_results'
|
|
461
|
+
for gf_iteration in self.iteration_gfs:
|
|
462
|
+
if f'{gf_iteration}_{n_imp}' not in scf_iteration.keys():
|
|
463
|
+
continue
|
|
464
|
+
value_per_spin_orbital = scf_iteration.get(
|
|
465
|
+
f'{gf_iteration}_{n_imp}'
|
|
466
|
+
)
|
|
467
|
+
value_tot = []
|
|
468
|
+
for spin_orb in value_per_spin_orbital.keys():
|
|
469
|
+
if spin_orb == 'block_names':
|
|
470
|
+
continue
|
|
471
|
+
value_tot.append(
|
|
472
|
+
f'{h5_base}/it_{i_scf + 1}/{gf_iteration}_{n_imp}/{spin_orb}/data'
|
|
473
|
+
)
|
|
474
|
+
sec_obs_scf.m_set(
|
|
475
|
+
sec_obs_scf.m_get_quantity_definition(
|
|
476
|
+
f'x_soliddmft_{gf_iteration}'
|
|
477
|
+
),
|
|
478
|
+
value_tot,
|
|
479
|
+
)
|
|
480
|
+
for gf_observable in self.observable_gfs:
|
|
481
|
+
if gf_observable not in observables.keys():
|
|
482
|
+
continue
|
|
483
|
+
value_per_spin_orbital = observables.get(gf_observable).get(
|
|
484
|
+
f'{n_imp}'
|
|
485
|
+
)
|
|
486
|
+
value_tot = []
|
|
487
|
+
for spin_orb in value_per_spin_orbital.keys():
|
|
488
|
+
value_tot.append(
|
|
489
|
+
f'{h5_base}/observables/{gf_observable}/{n_imp}/{spin_orb}/{i_scf + 1}'
|
|
490
|
+
)
|
|
491
|
+
sec_obs_scf.m_set(
|
|
492
|
+
sec_obs_scf.m_get_quantity_definition(
|
|
493
|
+
f'x_soliddmft_{gf_observable}'
|
|
494
|
+
),
|
|
495
|
+
value_tot,
|
|
496
|
+
)
|
|
497
|
+
|
|
498
|
+
def parse_gfs(sec_scc: Calculation, n_impurities: int):
|
|
499
|
+
"""Parses Green's functions quantities.
|
|
500
|
+
|
|
501
|
+
Args:
|
|
502
|
+
sec_scc (Calculation): Calculation section.
|
|
503
|
+
n_impurities (int): Number of impurities.
|
|
504
|
+
"""
|
|
505
|
+
sec_gfs = GreensFunctions()
|
|
506
|
+
sec_scc.greens_functions.append(sec_gfs)
|
|
507
|
+
|
|
508
|
+
# First, store energies
|
|
509
|
+
dmft_last_iter = self.dmft_results.get('last_iter')
|
|
510
|
+
sec_energy = Energy()
|
|
511
|
+
sec_scc.energy = sec_energy
|
|
512
|
+
if dmft_last_iter.get('DC_energ'):
|
|
513
|
+
dc_energy = [
|
|
514
|
+
self.extract_groups_datasets(
|
|
515
|
+
dmft_last_iter.get('DC_energ').get(keys)
|
|
516
|
+
)
|
|
517
|
+
for keys in dmft_last_iter.get('DC_energ')
|
|
518
|
+
]
|
|
519
|
+
sec_energy.double_counting = EnergyEntry(
|
|
520
|
+
values_per_atom=dc_energy * ureg.eV
|
|
521
|
+
)
|
|
522
|
+
chemical_potential = self.extract_groups_datasets(
|
|
523
|
+
dmft_last_iter.get('chemical_potential_post')
|
|
524
|
+
)
|
|
525
|
+
if chemical_potential:
|
|
526
|
+
sec_energy.chemical_potential = chemical_potential * ureg.eV
|
|
527
|
+
sec_gfs.chemical_potential = chemical_potential * ureg.eV
|
|
528
|
+
|
|
529
|
+
# Read axes label
|
|
530
|
+
axes_label = ''
|
|
531
|
+
for freq_mesh in sec_scc.method_ref.frequency_mesh:
|
|
532
|
+
points = np.transpose(freq_mesh.points.to('eV').magnitude)[-1]
|
|
533
|
+
if np.isreal(points).all():
|
|
534
|
+
sec_gfs.frequencies = np.real(points)
|
|
535
|
+
axes_label = 'real'
|
|
536
|
+
else:
|
|
537
|
+
sec_gfs.matsubara_freq = np.imag(points)
|
|
538
|
+
axes_label = 'matsubara'
|
|
539
|
+
axes = self._gf_freq_map[axes_label]
|
|
540
|
+
if sec_scc.method_ref.time_mesh:
|
|
541
|
+
sec_gfs.tau = np.transpose(sec_scc.method_ref.time_mesh[0].points.imag)[
|
|
542
|
+
-1
|
|
543
|
+
]
|
|
544
|
+
|
|
545
|
+
# Finally, store GF quantities
|
|
546
|
+
n_orbitals = sec_scc.method_ref.dmft.n_correlated_orbitals
|
|
547
|
+
if n_orbitals is not None:
|
|
548
|
+
for gf_quantity in self.iteration_gfs:
|
|
549
|
+
quantity_name = axes.get(gf_quantity)
|
|
550
|
+
if not quantity_name:
|
|
551
|
+
continue
|
|
552
|
+
value_per_atom = []
|
|
553
|
+
for n in range(n_impurities):
|
|
554
|
+
n_orb = n_orbitals[n]
|
|
555
|
+
if not dmft_last_iter.get(f'{gf_quantity}_{n}'):
|
|
556
|
+
continue
|
|
557
|
+
value = dmft_last_iter.get(f'{gf_quantity}_{n}')
|
|
558
|
+
value_per_atom_per_spin = []
|
|
559
|
+
for spin in ['down', 'up']:
|
|
560
|
+
value_per_atom_per_spin_per_orbital = []
|
|
561
|
+
for i_orb in range(n_orb):
|
|
562
|
+
val = value.get(f'{spin}_{i_orb}').get('data')
|
|
563
|
+
val = val[:, 0, 0, 0] + 1j * val[:, 0, 0, 1]
|
|
564
|
+
value_per_atom_per_spin_per_orbital.append(val)
|
|
565
|
+
value_per_atom_per_spin.append(
|
|
566
|
+
value_per_atom_per_spin_per_orbital
|
|
567
|
+
)
|
|
568
|
+
value_per_atom.append(value_per_atom_per_spin)
|
|
569
|
+
if not value_per_atom:
|
|
570
|
+
continue
|
|
571
|
+
gf = np.array(value_per_atom)
|
|
572
|
+
if (
|
|
573
|
+
gf_quantity == 'Gimp_time'
|
|
574
|
+
): # setting G(tau) to positive values as in other codes
|
|
575
|
+
gf = -gf
|
|
576
|
+
sec_gfs.m_set(sec_gfs.m_get_quantity_definition(quantity_name), gf)
|
|
577
|
+
|
|
578
|
+
# In case axes_label = real, we parse the DOS as -Im G(w) / np.pi
|
|
579
|
+
if axes_label == 'real':
|
|
580
|
+
magnetic_state = sec_scc.method_ref.dmft.magnetic_state
|
|
581
|
+
n_spin_channels = 1 if magnetic_state == 'paramagnetic' else 2
|
|
582
|
+
|
|
583
|
+
im_greens_functions_freq = sec_gfs.greens_function_freq.imag
|
|
584
|
+
for spin_channel in range(n_spin_channels):
|
|
585
|
+
sec_dos = Dos()
|
|
586
|
+
sec_scc.dos_electronic.append(sec_dos)
|
|
587
|
+
sec_dos.spin_channel = (
|
|
588
|
+
spin_channel if n_spin_channels == 2 else None
|
|
589
|
+
)
|
|
590
|
+
sec_dos.kind = 'spectral'
|
|
591
|
+
sec_dos.energy_fermi = chemical_potential * ureg.eV
|
|
592
|
+
energies = sec_gfs.frequencies
|
|
593
|
+
sec_dos.n_energies = len(energies)
|
|
594
|
+
sec_dos.energies = energies * ureg.eV
|
|
595
|
+
# Total values
|
|
596
|
+
imgf_per_spin = im_greens_functions_freq[:, spin_channel, :, :]
|
|
597
|
+
value = -imgf_per_spin / np.pi
|
|
598
|
+
value_total = 0.0
|
|
599
|
+
for i_at in range(value.shape[0]):
|
|
600
|
+
for i_orb in range(value.shape[1]):
|
|
601
|
+
value_total += value[i_at][i_orb]
|
|
602
|
+
value_total = (
|
|
603
|
+
2 * value_total if n_spin_channels == 2 else value_total
|
|
604
|
+
)
|
|
605
|
+
sec_dos_total = DosValues()
|
|
606
|
+
sec_dos.total.append(sec_dos_total)
|
|
607
|
+
sec_dos_total.value = value_total / ureg.eV
|
|
608
|
+
return sec_gfs
|
|
609
|
+
|
|
610
|
+
# SCF steps
|
|
611
|
+
scf_keys = [
|
|
612
|
+
int(key.lstrip('it_'))
|
|
613
|
+
for key in self.dmft_results.keys()
|
|
614
|
+
if key.startswith('it_')
|
|
615
|
+
]
|
|
616
|
+
scf_keys.sort()
|
|
617
|
+
n_iter_scf = (
|
|
618
|
+
self.dmft_results.get('iteration_count')[()]
|
|
619
|
+
if self.dmft_results.get('iteration_count')
|
|
620
|
+
else 1
|
|
621
|
+
)
|
|
622
|
+
|
|
623
|
+
if len(scf_keys) != n_iter_scf:
|
|
624
|
+
self.logger.warning(
|
|
625
|
+
'Number of it_n steps for DMFT results is different from the iteration '
|
|
626
|
+
'count stored in the h5 file.'
|
|
627
|
+
)
|
|
628
|
+
|
|
629
|
+
n_impurities = self.dft_input.get('n_inequiv_shells')[()]
|
|
630
|
+
convergence_obs = self.dmft_results.get('convergence_obs', {})
|
|
631
|
+
observables = self.dmft_results.get('observables', {})
|
|
632
|
+
# Resolving h5 path for to_hdf5 method
|
|
633
|
+
filename = os.path.join(
|
|
634
|
+
os.path.dirname(self.filepath.split('/raw/')[-1]), self.mainfile
|
|
635
|
+
)
|
|
636
|
+
for i_scf in range(len(scf_keys)):
|
|
637
|
+
parse_scf(
|
|
638
|
+
filename, sec_scc, i_scf, n_impurities, convergence_obs, observables
|
|
639
|
+
)
|
|
640
|
+
|
|
641
|
+
# Greens functions quantities
|
|
642
|
+
sec_gfs = parse_gfs(sec_scc, n_impurities)
|
|
643
|
+
# and related quantities
|
|
644
|
+
quasiparticle_weights = []
|
|
645
|
+
orbital_occupations = []
|
|
646
|
+
orb_Z = observables.get('orb_Z')
|
|
647
|
+
orb_occ = observables.get('orb_occ')
|
|
648
|
+
for n in range(n_impurities):
|
|
649
|
+
n_imp = str(n)
|
|
650
|
+
orb_Z_per_impurity = orb_Z.get(n_imp)
|
|
651
|
+
quasiparticle_weights_per_impurity = []
|
|
652
|
+
orb_occ_per_impurity = orb_occ.get(n_imp)
|
|
653
|
+
orbital_occupations_per_impurity = []
|
|
654
|
+
for spin in ['down', 'up']:
|
|
655
|
+
quasiparticle_weights_per_impurity.append(
|
|
656
|
+
self.extract_groups_datasets(
|
|
657
|
+
orb_Z_per_impurity.get(spin).get(f'{n_iter_scf}')
|
|
658
|
+
)
|
|
659
|
+
)
|
|
660
|
+
orbital_occupations_per_impurity.append(
|
|
661
|
+
self.extract_groups_datasets(
|
|
662
|
+
orb_occ_per_impurity.get(spin).get(f'{n_iter_scf}')
|
|
663
|
+
)
|
|
664
|
+
)
|
|
665
|
+
quasiparticle_weights.append(quasiparticle_weights_per_impurity)
|
|
666
|
+
orbital_occupations.append(orbital_occupations_per_impurity)
|
|
667
|
+
sec_gfs.quasiparticle_weights = quasiparticle_weights
|
|
668
|
+
sec_gfs.orbital_occupations = orbital_occupations
|
|
669
|
+
|
|
670
|
+
def parse(self, filepath, archive, logger):
|
|
671
|
+
self.filepath = filepath
|
|
672
|
+
self.archive = archive
|
|
673
|
+
self.maindir = os.path.dirname(self.filepath)
|
|
674
|
+
self.mainfile = os.path.basename(self.filepath)
|
|
675
|
+
self.logger = logging.getLogger(__name__) if logger is None else logger
|
|
676
|
+
|
|
677
|
+
try:
|
|
678
|
+
data = h5py.File(self.filepath)
|
|
679
|
+
except Exception:
|
|
680
|
+
self.logger.error('Error opening h5 file.')
|
|
681
|
+
data = None
|
|
682
|
+
return
|
|
683
|
+
self.dft_input = data.get('dft_input')
|
|
684
|
+
self.dmft_input = data.get('DMFT_input')
|
|
685
|
+
self.dmft_results = data.get('DMFT_results')
|
|
686
|
+
|
|
687
|
+
sec_run = Run()
|
|
688
|
+
archive.run.append(sec_run)
|
|
689
|
+
|
|
690
|
+
# Program section
|
|
691
|
+
sec_program = Program()
|
|
692
|
+
sec_run.program = sec_program
|
|
693
|
+
sec_program.name = 'solid_dmft'
|
|
694
|
+
if self.dmft_input['version'] is not None:
|
|
695
|
+
for name in self.code_keys:
|
|
696
|
+
hash = self.extract_groups_datasets(
|
|
697
|
+
self.dmft_input['version'].get(f'{name}_hash')
|
|
698
|
+
)
|
|
699
|
+
if hash:
|
|
700
|
+
if name == 'solid_dmft':
|
|
701
|
+
sec_program.x_soliddmft_hash = hash.decode()
|
|
702
|
+
else:
|
|
703
|
+
setattr(sec_program, f'x_soliddmft_{name}_hash', hash.decode())
|
|
704
|
+
version = self.extract_groups_datasets(
|
|
705
|
+
self.dmft_input['version'].get(f'{name}_version')
|
|
706
|
+
)
|
|
707
|
+
if version:
|
|
708
|
+
if name == 'solid_dmft':
|
|
709
|
+
sec_program.version = version.decode()
|
|
710
|
+
else:
|
|
711
|
+
setattr(
|
|
712
|
+
sec_program, f'x_soliddmft_{name}_version', version.decode()
|
|
713
|
+
)
|
|
714
|
+
|
|
715
|
+
# System section
|
|
716
|
+
self.parse_system()
|
|
717
|
+
|
|
718
|
+
# Method.DMFT section with inputs (HoppingMatrix + InteractionModel)
|
|
719
|
+
self.parse_input_model(data)
|
|
720
|
+
self.parse_method()
|
|
721
|
+
|
|
722
|
+
# Calculation section
|
|
723
|
+
self.parse_scc()
|
|
724
|
+
|
|
725
|
+
# Workflow section
|
|
726
|
+
workflow = SinglePoint()
|
|
727
|
+
self.archive.workflow2 = workflow
|