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,912 @@
|
|
|
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 re
|
|
23
|
+
from scipy import optimize
|
|
24
|
+
|
|
25
|
+
from nomad.units import ureg
|
|
26
|
+
from nomad.parsing.file_parser import TextParser, Quantity, DataTextParser
|
|
27
|
+
from nomad.datamodel import EntryArchive
|
|
28
|
+
|
|
29
|
+
from runschema.run import Run, Program
|
|
30
|
+
from runschema.system import System, Atoms
|
|
31
|
+
from runschema.method import (
|
|
32
|
+
Method,
|
|
33
|
+
HubbardKanamoriModel,
|
|
34
|
+
FrequencyMesh,
|
|
35
|
+
DMFT,
|
|
36
|
+
AtomParameters,
|
|
37
|
+
)
|
|
38
|
+
from runschema.calculation import (
|
|
39
|
+
Calculation,
|
|
40
|
+
ScfIteration,
|
|
41
|
+
Energy,
|
|
42
|
+
EnergyEntry,
|
|
43
|
+
Charges,
|
|
44
|
+
GreensFunctions,
|
|
45
|
+
Dos,
|
|
46
|
+
DosValues,
|
|
47
|
+
)
|
|
48
|
+
from simulationworkflowschema import SinglePoint
|
|
49
|
+
from nomad.parsing.file_parser import DataTextParser
|
|
50
|
+
from .metainfo.edmft import x_edmft_method_parameters
|
|
51
|
+
from ..utils import get_files, BeyondDFTWorkflowsParser
|
|
52
|
+
from ..wien2k.parser import (
|
|
53
|
+
StructParser,
|
|
54
|
+
) # Wien2k is imported to parse the system information
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
class OutParser(TextParser):
|
|
58
|
+
def __init__(self):
|
|
59
|
+
super().__init__()
|
|
60
|
+
|
|
61
|
+
def init_quantities(self):
|
|
62
|
+
self._quantities = []
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
class IndmflParser(TextParser):
|
|
66
|
+
def __init__(self):
|
|
67
|
+
super().__init__()
|
|
68
|
+
|
|
69
|
+
def init_quantities(self):
|
|
70
|
+
def str_to_orbitals_list(val_in):
|
|
71
|
+
return val_in.replace("'", '').split(' ')[:-1]
|
|
72
|
+
|
|
73
|
+
self._quantities = [
|
|
74
|
+
Quantity(
|
|
75
|
+
'hybridization_window',
|
|
76
|
+
r'(\d+) *(\d+) *(\d+) *(\d+) *\# hybridization band index nemin and nemax\, renormalize for interstitials\, projection type',
|
|
77
|
+
),
|
|
78
|
+
Quantity(
|
|
79
|
+
'real_or_imaginary_axis',
|
|
80
|
+
r'(\d+) *([\d\.]+) *([\d\.]+) *(\d+) *([\d\-\.]+) *([\d\-\.]+) *\# matsubara\, broadening\-corr\, broadening\-noncorr\, nomega\, omega\_min\, omega\_max \(in eV\)',
|
|
81
|
+
),
|
|
82
|
+
Quantity('n_corr_atoms', r'(\d+)\s*\# number of correlated atoms'),
|
|
83
|
+
Quantity(
|
|
84
|
+
'i_atom_corr',
|
|
85
|
+
r'(\d+)\s*(\d+)\s*(\d+)\s*\# iatom\, nL\, locrot',
|
|
86
|
+
repeats=True,
|
|
87
|
+
),
|
|
88
|
+
Quantity(
|
|
89
|
+
'l_atom_corr',
|
|
90
|
+
r'\s*(\d+)\s*(\d+)\s*(\d+)\s*\# L\, qsplit\, cix',
|
|
91
|
+
repeats=True,
|
|
92
|
+
),
|
|
93
|
+
Quantity(
|
|
94
|
+
'siginds_corr',
|
|
95
|
+
r'(\# Siginds and crystal\-field transformations for correlated orbitals \=*[\s\S]+)(?:\# Sigind follows)',
|
|
96
|
+
sub_parser=TextParser(
|
|
97
|
+
quantities=[
|
|
98
|
+
Quantity(
|
|
99
|
+
'indep_cix_blocks',
|
|
100
|
+
r'(\d+) *(\d+) *(\d+) *\# Number of independent kcix blocks\, max dimension\, max num\-independent-components',
|
|
101
|
+
),
|
|
102
|
+
Quantity(
|
|
103
|
+
'cix',
|
|
104
|
+
r'(\d+) *(\d+) *(\d+) *\# cix\-num\, dimension\, num\-independent\-components',
|
|
105
|
+
repeats=True,
|
|
106
|
+
),
|
|
107
|
+
Quantity(
|
|
108
|
+
'orbitals',
|
|
109
|
+
r'\# Independent components are \-*[\s\S]([\'\^\-\+a-zA-Z\s\d]+)',
|
|
110
|
+
str_operation=str_to_orbitals_list,
|
|
111
|
+
),
|
|
112
|
+
]
|
|
113
|
+
),
|
|
114
|
+
),
|
|
115
|
+
]
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
class ParamsParser(TextParser):
|
|
119
|
+
def __init__(self):
|
|
120
|
+
super().__init__()
|
|
121
|
+
|
|
122
|
+
def init_quantities(self):
|
|
123
|
+
self._quantities = [
|
|
124
|
+
Quantity(
|
|
125
|
+
'general_parameters',
|
|
126
|
+
r'([\s\S]+)(?:\# Impurity problem number 0)',
|
|
127
|
+
sub_parser=TextParser(
|
|
128
|
+
quantities=[
|
|
129
|
+
Quantity(
|
|
130
|
+
'params',
|
|
131
|
+
r'([a-zA-Z\_]+)\s*\=\s*\'*([a-zA-Z\d\.\-]+)\'*',
|
|
132
|
+
repeats=True,
|
|
133
|
+
)
|
|
134
|
+
]
|
|
135
|
+
),
|
|
136
|
+
),
|
|
137
|
+
Quantity(
|
|
138
|
+
'impurity_parameters',
|
|
139
|
+
r'iparams0\=([\s\S]+)(?:\s*\})',
|
|
140
|
+
sub_parser=TextParser(
|
|
141
|
+
quantities=[
|
|
142
|
+
Quantity(
|
|
143
|
+
'params',
|
|
144
|
+
r'\s*\"(.+)\"\s*\:\s*\[[\"\'\s]*([a-zA-Z\d\.\-]+)[\"\'\s]*\,',
|
|
145
|
+
repeats=True,
|
|
146
|
+
)
|
|
147
|
+
]
|
|
148
|
+
),
|
|
149
|
+
),
|
|
150
|
+
]
|
|
151
|
+
|
|
152
|
+
|
|
153
|
+
class ImpurityGfOutParser(DataTextParser):
|
|
154
|
+
def __init__(self):
|
|
155
|
+
super().__init__()
|
|
156
|
+
|
|
157
|
+
def init_quantities(self):
|
|
158
|
+
self._quantities = [
|
|
159
|
+
Quantity(
|
|
160
|
+
'parameters',
|
|
161
|
+
r'\# *nf\=([\d\.]+) *mu\=([\d\.\-]+) *T\=([\d\.]+) *TrSigmaG\=([\d\.\-]+) *Epot\=([\d\.\-]+) *Ekin\=([\d\.\-]+) *mom\=([\[\]\,\d\.\-]+)',
|
|
162
|
+
repeats=False,
|
|
163
|
+
)
|
|
164
|
+
]
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
class MaxentParamsParser(TextParser):
|
|
168
|
+
def __init__(self):
|
|
169
|
+
super().__init__()
|
|
170
|
+
|
|
171
|
+
def init_quantities(self):
|
|
172
|
+
def str_multiply_to_float(val_in):
|
|
173
|
+
val = val_in.split('*')
|
|
174
|
+
return float(val[0]) * float(val[1])
|
|
175
|
+
|
|
176
|
+
self._quantities = [
|
|
177
|
+
Quantity(
|
|
178
|
+
'parameters',
|
|
179
|
+
r'\'([a-zA-Z\d\_]+)\' *\: *\ ([\d\.\*a-zA-Z]+)\'*\, *\#',
|
|
180
|
+
repeats=True,
|
|
181
|
+
),
|
|
182
|
+
Quantity(
|
|
183
|
+
'smearing',
|
|
184
|
+
r'\'gwidth\' *\: *([\d\*\.]+)\, *\#',
|
|
185
|
+
str_operation=str_multiply_to_float,
|
|
186
|
+
),
|
|
187
|
+
]
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
class MaxEntSigOutParser(DataTextParser):
|
|
191
|
+
def __init__(self):
|
|
192
|
+
super().__init__()
|
|
193
|
+
|
|
194
|
+
def init_quantities(self):
|
|
195
|
+
def str_to_array(val_in):
|
|
196
|
+
val = [float(v) for v in val_in.split(', ')]
|
|
197
|
+
return val
|
|
198
|
+
|
|
199
|
+
self._quantities = [
|
|
200
|
+
Quantity(
|
|
201
|
+
'aux_sigma',
|
|
202
|
+
r'\# *s\_oo\= *\[([\d\.\,\-\s]+)\]',
|
|
203
|
+
repeats=False,
|
|
204
|
+
str_operation=str_to_array,
|
|
205
|
+
)
|
|
206
|
+
]
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
class EDMFTParser(BeyondDFTWorkflowsParser):
|
|
210
|
+
"""Parser for inputs / outputs of the eDMFT code. This parses generates (if the calculation
|
|
211
|
+
files are present) 3 archives:
|
|
212
|
+
1- `self.archive` -> the DMFT SinglePoint calculations. It contains DMFT methodology
|
|
213
|
+
and GFs quantities in Matsubara frequencies.
|
|
214
|
+
2- `maxent_archive` -> the analytically continuated, MaxEnt, SinglePoint calculation. It
|
|
215
|
+
contains MaxEnt methodology and the self-energy in real space frequencies.
|
|
216
|
+
3- `dmft_maxent_archive` -> combines both archives (DMFT and MaxEnt SinglePoints) into
|
|
217
|
+
a workflow archive containing all the information. It also contains the Green's function
|
|
218
|
+
in real space frequencies and the DOS. Useful to then use to define the DFT+DMFT
|
|
219
|
+
workflow archive.
|
|
220
|
+
"""
|
|
221
|
+
|
|
222
|
+
def __init__(self):
|
|
223
|
+
self._re_namesafe = re.compile(r'[^\w]')
|
|
224
|
+
self._calculation_type = 'dmft'
|
|
225
|
+
self._child_archives = {}
|
|
226
|
+
|
|
227
|
+
self.out_parser = OutParser()
|
|
228
|
+
self.struct_parser = StructParser()
|
|
229
|
+
self.indmfl_parser = IndmflParser()
|
|
230
|
+
self.params_parser = ParamsParser()
|
|
231
|
+
self.iterate_parser = DataTextParser()
|
|
232
|
+
self.imp_gf_parser = ImpurityGfOutParser()
|
|
233
|
+
self.lattice_parser = DataTextParser()
|
|
234
|
+
|
|
235
|
+
self._solver_map = {'CTQMC': 'CT-HYB', 'OCA': 'OCA', 'NCA': 'NCA'}
|
|
236
|
+
|
|
237
|
+
self._angular_momentum = ['s', 'p', 'd', 'f']
|
|
238
|
+
|
|
239
|
+
self._gf_files_map = {
|
|
240
|
+
'imp.0/Gf.out.*': 'greens_function_iw',
|
|
241
|
+
'imp.0/Sig.out.*': 'self_energy_iw',
|
|
242
|
+
'imp.0/Delta.inp.*': 'hybridization_function_iw',
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
self._gf_lattice = ['greens_function_iw', 'self_energy_iw']
|
|
246
|
+
|
|
247
|
+
self._gf_lattice_maxent = [
|
|
248
|
+
'greens_function_freq',
|
|
249
|
+
'hybridization_function_freq',
|
|
250
|
+
]
|
|
251
|
+
|
|
252
|
+
self.maxent_params_parser = MaxentParamsParser()
|
|
253
|
+
self.maxent_sigout_parser = MaxEntSigOutParser()
|
|
254
|
+
|
|
255
|
+
def parse_system(self, sec_run: Run):
|
|
256
|
+
"""Parses the system from the Wien2k *.struct file using Wien2k parsing class `StructParser`.
|
|
257
|
+
|
|
258
|
+
Args:
|
|
259
|
+
sec_run (Run): Specific Run section to be populated with System.
|
|
260
|
+
"""
|
|
261
|
+
struct_files = get_files('*.struct', self.filepath, self.mainfile)
|
|
262
|
+
if not struct_files:
|
|
263
|
+
return
|
|
264
|
+
if len(struct_files) > 1:
|
|
265
|
+
self.logger.warning(
|
|
266
|
+
'Multiple *struct files found; we will parse the last one.',
|
|
267
|
+
data={'files': struct_files},
|
|
268
|
+
)
|
|
269
|
+
self.struct_parser.mainfile = struct_files[-1]
|
|
270
|
+
atoms = self.struct_parser.get_atoms()
|
|
271
|
+
if atoms is None:
|
|
272
|
+
return
|
|
273
|
+
|
|
274
|
+
sec_system = System()
|
|
275
|
+
sec_run.system.append(sec_system)
|
|
276
|
+
sec_atoms = Atoms()
|
|
277
|
+
sec_system.atoms = sec_atoms
|
|
278
|
+
sec_atoms.lattice_vectors = np.array(atoms.get_cell()) * ureg.angstrom
|
|
279
|
+
sec_atoms.positions = atoms.get_positions() * ureg.angstrom
|
|
280
|
+
sec_atoms.labels = atoms.get_chemical_symbols()
|
|
281
|
+
sec_atoms.periodic = atoms.get_pbc()
|
|
282
|
+
|
|
283
|
+
def parse_initial_model(self):
|
|
284
|
+
"""Parses the initial model for running DMFT SinglePoint. It is composed of the
|
|
285
|
+
projection matrix plus the Hubbard-Kanamori parameters.
|
|
286
|
+
"""
|
|
287
|
+
sec_run = self.archive.run[-1]
|
|
288
|
+
sec_method = Method()
|
|
289
|
+
sec_run.method.append(sec_method)
|
|
290
|
+
|
|
291
|
+
# TODO ask @LucianPascut what projectorw.dat means to parse as initial model.
|
|
292
|
+
|
|
293
|
+
# HubbardKanamori part
|
|
294
|
+
for n in range(self.indmfl_parser.get('n_corr_atoms', 1)):
|
|
295
|
+
sec_atom_params = AtomParameters()
|
|
296
|
+
sec_method.atom_parameters.append(sec_atom_params)
|
|
297
|
+
if sec_run.m_xpath('system[-1].atoms.labels'):
|
|
298
|
+
labels = sec_run.system[-1].atoms.labels
|
|
299
|
+
if self.indmfl_parser.get('i_atom_corr') is not None:
|
|
300
|
+
atom_corr = self.indmfl_parser.get('i_atom_corr')[n]
|
|
301
|
+
label = labels[atom_corr[0] - 1]
|
|
302
|
+
sec_atom_params.label = label
|
|
303
|
+
if self.indmfl_parser.get('l_atom_corr') is not None:
|
|
304
|
+
angular_momentum = self._angular_momentum[
|
|
305
|
+
self.indmfl_parser.get('l_atom_corr')[n][0]
|
|
306
|
+
]
|
|
307
|
+
if self.indmfl_parser.get('siginds_corr', {}).get('cix') is not None:
|
|
308
|
+
n_orbitals = self.indmfl_parser.get('siginds_corr', {}).get('cix')[
|
|
309
|
+
n
|
|
310
|
+
][-1]
|
|
311
|
+
sec_atom_params.n_orbitals = n_orbitals
|
|
312
|
+
if (
|
|
313
|
+
self.indmfl_parser.get('siginds_corr', {}).get('orbitals')
|
|
314
|
+
is not None
|
|
315
|
+
):
|
|
316
|
+
sec_atom_params.orbitals = [
|
|
317
|
+
f'{angular_momentum}{orb}'
|
|
318
|
+
for orb in self.indmfl_parser.get('siginds_corr', {}).get(
|
|
319
|
+
'orbitals'
|
|
320
|
+
)
|
|
321
|
+
]
|
|
322
|
+
sec_hubbard_kanamori = HubbardKanamoriModel()
|
|
323
|
+
sec_atom_params.hubbard_kanamori_model = sec_hubbard_kanamori
|
|
324
|
+
sec_hubbard_kanamori.double_counting_correction = (
|
|
325
|
+
self.general_parameters.get('DCs', '')
|
|
326
|
+
)
|
|
327
|
+
sec_hubbard_kanamori.u = self.impurity_parameters.get('U', 0.0) * ureg.eV
|
|
328
|
+
sec_hubbard_kanamori.jh = self.impurity_parameters.get('J', 0.0) * ureg.eV
|
|
329
|
+
if self.impurity_parameters.get('CoulombF', 'Full') == 'Ising':
|
|
330
|
+
sec_hubbard_kanamori.j = 0.0
|
|
331
|
+
else:
|
|
332
|
+
sec_hubbard_kanamori.up = (
|
|
333
|
+
sec_hubbard_kanamori.u - 2 * sec_hubbard_kanamori.jh
|
|
334
|
+
)
|
|
335
|
+
sec_hubbard_kanamori.j = sec_hubbard_kanamori.jh
|
|
336
|
+
|
|
337
|
+
def parse_method(self):
|
|
338
|
+
"""Parses DMFT SinglePoint method parameters."""
|
|
339
|
+
sec_run = self.archive.run[-1]
|
|
340
|
+
|
|
341
|
+
sec_method = Method()
|
|
342
|
+
sec_run.method.append(sec_method)
|
|
343
|
+
sec_method.starting_method_ref = sec_run.method[
|
|
344
|
+
0
|
|
345
|
+
] # ref to the Non- and InteractionHamiltonian
|
|
346
|
+
|
|
347
|
+
# Code-specific parameters
|
|
348
|
+
sec_edmft_params = x_edmft_method_parameters()
|
|
349
|
+
sec_method.x_edmft_method = sec_edmft_params
|
|
350
|
+
sec_edmft_params.x_edmft_general = self.general_parameters
|
|
351
|
+
sec_edmft_params.x_edmft_impurity_solver = self.impurity_parameters
|
|
352
|
+
|
|
353
|
+
# DMFT method
|
|
354
|
+
sec_dmft = DMFT()
|
|
355
|
+
sec_method.dmft = sec_dmft
|
|
356
|
+
n_corr_atoms = self.indmfl_parser.get('n_corr_atoms', 1)
|
|
357
|
+
sec_dmft.n_impurities = n_corr_atoms
|
|
358
|
+
if self.indmfl_parser.get('siginds_corr', {}).get('cix'):
|
|
359
|
+
n_orbitals = [
|
|
360
|
+
orb[-1] for orb in self.indmfl_parser.get('siginds_corr', {}).get('cix')
|
|
361
|
+
]
|
|
362
|
+
sec_dmft.n_correlated_orbitals = n_orbitals
|
|
363
|
+
if self.impurity_parameters.get('nf0'):
|
|
364
|
+
n_corr_elect = self.impurity_parameters.get('nf0', 1.0) / n_corr_atoms
|
|
365
|
+
corr_elect = [
|
|
366
|
+
n_corr_elect
|
|
367
|
+
] * n_corr_atoms # TODO ask Lucian if this makes sense
|
|
368
|
+
sec_dmft.n_electrons = corr_elect
|
|
369
|
+
sec_dmft.inverse_temperature = (
|
|
370
|
+
self.impurity_parameters.get('beta', 0.0) / ureg.eV
|
|
371
|
+
)
|
|
372
|
+
sec_dmft.magnetic_state = 'paramagnetic' # TODO ask Lucian if this is correct
|
|
373
|
+
sec_dmft.impurity_solver = self._solver_map.get(
|
|
374
|
+
self.general_parameters.get('solver', '')
|
|
375
|
+
)
|
|
376
|
+
|
|
377
|
+
def extract_greens_functions_data(
|
|
378
|
+
self,
|
|
379
|
+
sec_scc: Calculation,
|
|
380
|
+
sec_gfs: GreensFunctions,
|
|
381
|
+
n_orbitals: np.int32,
|
|
382
|
+
gf_data: np.ndarray,
|
|
383
|
+
mesh_type: str,
|
|
384
|
+
create_freq_mesh: bool = True,
|
|
385
|
+
):
|
|
386
|
+
"""Extracts GF data from gf_data as read from the data output files, and populates
|
|
387
|
+
sec_gfs with it.
|
|
388
|
+
|
|
389
|
+
Args:
|
|
390
|
+
sec_scc (Calculation): Calculation section for updating the method_ref.
|
|
391
|
+
sec_gfs (GreensFunctions): GreensFunctions section to be populated with gf_data
|
|
392
|
+
n_orbitals (np.int32): Number of correlated orbitals.
|
|
393
|
+
gf_data (np.ndarray): Data extracted from the data output files.
|
|
394
|
+
mesh_type(str): Specifies if the FreqMesh is imaginary (Matsubara) or real frequencies.
|
|
395
|
+
create_freq_mesh (bool, optional): Creates a FrequencyMesh section and the
|
|
396
|
+
calculation.method_ref if true. Defaults to True.
|
|
397
|
+
"""
|
|
398
|
+
# Adding FreqMesh
|
|
399
|
+
if gf_data is None:
|
|
400
|
+
return
|
|
401
|
+
freq = gf_data[:, 0]
|
|
402
|
+
if mesh_type == 'imaginary':
|
|
403
|
+
sec_gfs.matsubara_freq = freq
|
|
404
|
+
freq = freq * 1j
|
|
405
|
+
elif mesh_type == 'real':
|
|
406
|
+
sec_gfs.frequencies = freq
|
|
407
|
+
|
|
408
|
+
if create_freq_mesh:
|
|
409
|
+
freq = freq.reshape((len(freq), 1))
|
|
410
|
+
sec_freq_mesh = FrequencyMesh(
|
|
411
|
+
dimensionality=1, n_points=len(freq), points=freq * ureg.eV
|
|
412
|
+
)
|
|
413
|
+
try:
|
|
414
|
+
method_ref = sec_scc.method_ref
|
|
415
|
+
method_ref.m_add_sub_section(Method.frequency_mesh, sec_freq_mesh)
|
|
416
|
+
except Exception:
|
|
417
|
+
pass
|
|
418
|
+
|
|
419
|
+
# Defining the full Gf in the basis n_atoms x 2 x n_orbitals x n_freq
|
|
420
|
+
gf_orb_data = np.array(
|
|
421
|
+
[
|
|
422
|
+
gf_data[:, 2 * n + 1] + gf_data[:, 2 * n + 2] * 1j
|
|
423
|
+
for n in range(n_orbitals)
|
|
424
|
+
]
|
|
425
|
+
)
|
|
426
|
+
return np.array([[gf_orb_data, gf_orb_data]])
|
|
427
|
+
|
|
428
|
+
def parse_scc(self):
|
|
429
|
+
"""Parses output calculation from a DMFT SinglePoint calculation. Each DMFT calculation
|
|
430
|
+
step is composed of a scf convergence, as explained in the documentation workflow
|
|
431
|
+
graphs: http://hauleweb.rutgers.edu/tutorials/Overview.html
|
|
432
|
+
|
|
433
|
+
Each calculation section is then composed of:
|
|
434
|
+
a) Iteration energy and charge quantities inside scf_iteration.
|
|
435
|
+
b) Impurity GF quantities in Matsubara frequency space. The last
|
|
436
|
+
calculation contains the last output quantities to be compared with the lattice GF
|
|
437
|
+
quantities.
|
|
438
|
+
c) The final calculation also contains the lattice GF quantities.
|
|
439
|
+
"""
|
|
440
|
+
# TODO: (1) ask about extensions when more than one impurity: iparams0, iparams1,
|
|
441
|
+
# info.iterate n_latt and n_imp columns? imp.X subfolders?
|
|
442
|
+
# (2) how to check convergence (Gimp - Glatt < criteria)?
|
|
443
|
+
sec_run = self.archive.run[-1]
|
|
444
|
+
|
|
445
|
+
def create_calculation_section():
|
|
446
|
+
"""Creates a calculation section and includes system_ref and method_ref."""
|
|
447
|
+
sec_scc = Calculation()
|
|
448
|
+
sec_run.calculation.append(sec_scc)
|
|
449
|
+
if sec_run.system is not None:
|
|
450
|
+
sec_scc.system_ref = sec_run.system[-1]
|
|
451
|
+
if sec_run.method is not None:
|
|
452
|
+
sec_scc.method_ref = sec_run.method[-1] # ref DMFT
|
|
453
|
+
return sec_scc
|
|
454
|
+
|
|
455
|
+
if sec_run.m_xpath('method[-1].dmft.n_correlated_orbitals') is not None:
|
|
456
|
+
n_orbitals = sec_run.method[-1].dmft.n_correlated_orbitals[0]
|
|
457
|
+
else:
|
|
458
|
+
self.logger.warning(
|
|
459
|
+
'Number of orbitals could not be extracted. We cannot parse '
|
|
460
|
+
'the output calculation information.'
|
|
461
|
+
)
|
|
462
|
+
return
|
|
463
|
+
|
|
464
|
+
# Parsing iteration steps for each of the calculation steps
|
|
465
|
+
iterate_files = get_files('info.iterate', self.filepath, self.mainfile)
|
|
466
|
+
if iterate_files:
|
|
467
|
+
if len(iterate_files) > 1:
|
|
468
|
+
self.logger.warning(
|
|
469
|
+
'Multiple info.iterate files found; we will parse the last one.',
|
|
470
|
+
data={'files': iterate_files},
|
|
471
|
+
)
|
|
472
|
+
self.iterate_parser.mainfile = iterate_files[-1]
|
|
473
|
+
data_scf = (
|
|
474
|
+
[] if self.iterate_parser.data is None else self.iterate_parser.data
|
|
475
|
+
)
|
|
476
|
+
calculations = sec_run.calculation
|
|
477
|
+
for i_dmft, data in enumerate(data_scf):
|
|
478
|
+
iter_dmft = np.int32(data[1])
|
|
479
|
+
sec_scc = (
|
|
480
|
+
create_calculation_section()
|
|
481
|
+
if len(calculations) <= iter_dmft
|
|
482
|
+
else calculations[iter_dmft]
|
|
483
|
+
)
|
|
484
|
+
|
|
485
|
+
sec_scf_iteration = ScfIteration()
|
|
486
|
+
sec_scc.scf_iteration.append(sec_scf_iteration)
|
|
487
|
+
# Energies
|
|
488
|
+
sec_energy = Energy()
|
|
489
|
+
sec_scf_iteration.energy = sec_energy
|
|
490
|
+
sec_energy.chemical_potential = data[3] * ureg.eV
|
|
491
|
+
sec_energy.double_counting = EnergyEntry(
|
|
492
|
+
value=data[4] * ureg.eV
|
|
493
|
+
)
|
|
494
|
+
sec_energy.total = EnergyEntry(value=data[5] * ureg.rydberg)
|
|
495
|
+
sec_energy.free = EnergyEntry(value=data[7] * ureg.rydberg)
|
|
496
|
+
# Lattice and impurity occupations
|
|
497
|
+
sec_charges_latt = Charges()
|
|
498
|
+
sec_scf_iteration.charges.append(sec_charges_latt)
|
|
499
|
+
sec_charges_latt.kind = 'lattice'
|
|
500
|
+
sec_charges_latt.n_atoms = sec_scc.method_ref.dmft.n_impurities
|
|
501
|
+
sec_charges_latt.n_orbitals = n_orbitals
|
|
502
|
+
sec_charges_latt.n_electrons = [data[8]]
|
|
503
|
+
sec_charges_imp = Charges()
|
|
504
|
+
sec_scf_iteration.charges.append(sec_charges_imp)
|
|
505
|
+
sec_charges_imp.kind = 'impurity'
|
|
506
|
+
sec_charges_imp.n_atoms = sec_scc.method_ref.dmft.n_impurities
|
|
507
|
+
sec_charges_imp.n_orbitals = n_orbitals
|
|
508
|
+
sec_charges_imp.n_electrons = [data[9]]
|
|
509
|
+
|
|
510
|
+
# Impurity Green's function, self-energy, hybridization function parsing for each calculation step
|
|
511
|
+
for imp_path in self._gf_files_map.keys():
|
|
512
|
+
impurity_files = get_files(imp_path, self.filepath, self.mainfile)
|
|
513
|
+
if impurity_files:
|
|
514
|
+
impurity_files.sort()
|
|
515
|
+
for i_scc, f in enumerate(impurity_files):
|
|
516
|
+
# Calculation and GreensFunction sections
|
|
517
|
+
if sec_run.calculation:
|
|
518
|
+
sec_scc = sec_run.calculation[i_scc]
|
|
519
|
+
else:
|
|
520
|
+
sec_scc = Calculation()
|
|
521
|
+
sec_run.calculation.append(sec_scc)
|
|
522
|
+
if sec_scc.greens_functions:
|
|
523
|
+
sec_gfs = sec_scc.greens_functions[-1]
|
|
524
|
+
else:
|
|
525
|
+
sec_gfs = GreensFunctions()
|
|
526
|
+
sec_scc.greens_functions.append(sec_gfs)
|
|
527
|
+
sec_gfs.type = 'impurity'
|
|
528
|
+
# Parsing data
|
|
529
|
+
self.imp_gf_parser.mainfile = f
|
|
530
|
+
imp_gf_data = self.imp_gf_parser.data
|
|
531
|
+
impurity_data = (
|
|
532
|
+
self.extract_greens_functions_data(
|
|
533
|
+
sec_scc, sec_gfs, n_orbitals, imp_gf_data, 'imaginary'
|
|
534
|
+
)
|
|
535
|
+
if imp_gf_data is not None
|
|
536
|
+
else None
|
|
537
|
+
)
|
|
538
|
+
if impurity_data is not None:
|
|
539
|
+
sec_gfs.m_set(
|
|
540
|
+
sec_gfs.m_get_quantity_definition(
|
|
541
|
+
self._gf_files_map[imp_path]
|
|
542
|
+
),
|
|
543
|
+
impurity_data,
|
|
544
|
+
)
|
|
545
|
+
if self.imp_gf_parser.get('parameters'):
|
|
546
|
+
sec_gfs.chemical_potential = (
|
|
547
|
+
self.imp_gf_parser.get('parameters')[1] * ureg.eV
|
|
548
|
+
)
|
|
549
|
+
|
|
550
|
+
# Parse lattice GFs quantities in the last calculation
|
|
551
|
+
if sec_run.calculation is not None:
|
|
552
|
+
sec_scc = sec_run.calculation[-1]
|
|
553
|
+
lattice_gf_files = get_files('*.gc1', self.filepath, self.mainfile)
|
|
554
|
+
lattice_sigma_files = get_files('sig.inp1', self.filepath, self.mainfile)
|
|
555
|
+
for i_files, lattice_files in enumerate(
|
|
556
|
+
[lattice_gf_files, lattice_sigma_files]
|
|
557
|
+
):
|
|
558
|
+
if lattice_files:
|
|
559
|
+
if len(lattice_files) > 1:
|
|
560
|
+
self.logger.warning(
|
|
561
|
+
'Multiple lattice files (*.gc* or sig.inp1) found; we will parse the last one.',
|
|
562
|
+
data={'files': lattice_files},
|
|
563
|
+
)
|
|
564
|
+
self.lattice_parser.mainfile = lattice_files[-1]
|
|
565
|
+
sec_gfs = GreensFunctions()
|
|
566
|
+
sec_scc.greens_functions.append(sec_gfs)
|
|
567
|
+
sec_gfs.type = 'lattice'
|
|
568
|
+
lattice_data = self.lattice_parser.data
|
|
569
|
+
# Extracting Matsubara freqs and GF data without storing FrequencyMesh -> this
|
|
570
|
+
# is because impurity and lattice GFs can have different size in Matsubara frequencies.
|
|
571
|
+
extracted_lattice_data = (
|
|
572
|
+
self.extract_greens_functions_data(
|
|
573
|
+
sec_scc,
|
|
574
|
+
sec_gfs,
|
|
575
|
+
n_orbitals,
|
|
576
|
+
lattice_data,
|
|
577
|
+
'imaginary',
|
|
578
|
+
False,
|
|
579
|
+
)
|
|
580
|
+
if lattice_data is not None
|
|
581
|
+
else None
|
|
582
|
+
)
|
|
583
|
+
sec_gfs.m_set(
|
|
584
|
+
sec_gfs.m_get_quantity_definition(self._gf_lattice[i_files]),
|
|
585
|
+
extracted_lattice_data,
|
|
586
|
+
)
|
|
587
|
+
|
|
588
|
+
def init_parser(self):
|
|
589
|
+
self.out_parser.mainfile = self.mainfile
|
|
590
|
+
self.out_parser.logger = self.logger
|
|
591
|
+
self.struct_parser.mainfile = None
|
|
592
|
+
self.struct_parser.logger = self.logger
|
|
593
|
+
self.indmfl_parser.mainfile = None
|
|
594
|
+
self.indmfl_parser.logger = self.logger
|
|
595
|
+
self.params_parser.mainfile = None
|
|
596
|
+
self.params_parser.logger = self.logger
|
|
597
|
+
self.iterate_parser.mainfile = None
|
|
598
|
+
self.iterate_parser.logger = self.logger
|
|
599
|
+
self.imp_gf_parser.mainfile = None
|
|
600
|
+
self.imp_gf_parser.logger = self.logger
|
|
601
|
+
self.lattice_parser.mainfile = None
|
|
602
|
+
self.lattice_parser.logger = self.logger
|
|
603
|
+
self.maxent_params_parser.mainfile = None
|
|
604
|
+
self.maxent_params_parser.logger = self.logger
|
|
605
|
+
self.maxent_sigout_parser.mainfile = None
|
|
606
|
+
self.maxent_sigout_parser.logger = self.logger
|
|
607
|
+
|
|
608
|
+
def get_mainfile_keys(self, **kwargs):
|
|
609
|
+
filepath = kwargs.get('filename')
|
|
610
|
+
mainfile = os.path.basename(filepath)
|
|
611
|
+
maxent_files = get_files('maxent_params.dat', filepath, mainfile)
|
|
612
|
+
if maxent_files is not None:
|
|
613
|
+
return ['MaxEnt', 'MaxEnt_workflow']
|
|
614
|
+
return True
|
|
615
|
+
|
|
616
|
+
def parse_maxent_archive(self, archive: EntryArchive):
|
|
617
|
+
"""Populates the MaxEnt SinglePoint archive. This will contain:
|
|
618
|
+
1- The analytical continuation method parameters.
|
|
619
|
+
2- The self-energy in real frequencies.
|
|
620
|
+
"""
|
|
621
|
+
self.init_parser()
|
|
622
|
+
sec_run = Run()
|
|
623
|
+
archive.run.append(sec_run)
|
|
624
|
+
sec_run.program = Program(name='eDMFT')
|
|
625
|
+
|
|
626
|
+
def _freq_tan_points(x0: float, l0: float, n_w: int):
|
|
627
|
+
"""Defines the frequency mesh points in a 'Tan' mesh. Following script by @LucianPascut."""
|
|
628
|
+
|
|
629
|
+
def opt_function(x: np.ndarray, x0: float, l0: float, n_w: int):
|
|
630
|
+
d = x[0]
|
|
631
|
+
w = x[1]
|
|
632
|
+
return np.array(
|
|
633
|
+
[l0 - w / np.tan(d), x0 - w * np.tan(np.pi / (2 * n_w) - d / n_w)]
|
|
634
|
+
)
|
|
635
|
+
|
|
636
|
+
xi = x0 / l0
|
|
637
|
+
d0 = (
|
|
638
|
+
0.5
|
|
639
|
+
* n_w
|
|
640
|
+
* (
|
|
641
|
+
np.tan(np.pi / (2 * n_w))
|
|
642
|
+
- np.sqrt(np.tan(np.pi / (2 * n_w)) ** 2 - 4 * xi / n_w)
|
|
643
|
+
)
|
|
644
|
+
)
|
|
645
|
+
w0 = l0 * d0
|
|
646
|
+
|
|
647
|
+
sol = optimize.root(opt_function, [d0, w0], args=(x0, l0, n_w))
|
|
648
|
+
(d, w) = sol.x
|
|
649
|
+
return w * np.tan(
|
|
650
|
+
np.linspace(0, 1, 2 * n_w + 1) * (np.pi - 2 * d) - np.pi / 2 + d
|
|
651
|
+
)
|
|
652
|
+
|
|
653
|
+
def parse_maxent_method():
|
|
654
|
+
"""Populates method section with MaxEnt parameters and the real space FrequencyMesh."""
|
|
655
|
+
sec_method = Method()
|
|
656
|
+
sec_run.method.append(sec_method)
|
|
657
|
+
params = dict(self.maxent_params_parser.get('parameters'))
|
|
658
|
+
sec_maxent_params = x_edmft_method_parameters()
|
|
659
|
+
sec_method.x_edmft_method = sec_maxent_params
|
|
660
|
+
sec_maxent_params.x_edmft_maxent = params
|
|
661
|
+
sec_freq_mesh = FrequencyMesh(
|
|
662
|
+
dimensionality=1, sampling_method='Tan', n_points=params.get('Nw', 1)
|
|
663
|
+
)
|
|
664
|
+
try:
|
|
665
|
+
freqs = _freq_tan_points(
|
|
666
|
+
params.get('x0'), params.get('L'), params.get('Nw')
|
|
667
|
+
)
|
|
668
|
+
freqs = freqs.reshape((len(freqs), 1))
|
|
669
|
+
sec_freq_mesh.points = freqs * ureg.eV
|
|
670
|
+
except Exception:
|
|
671
|
+
self.logger.warning('Real frequency mesh could not be extracted.')
|
|
672
|
+
sec_method.m_add_sub_section(Method.frequency_mesh, sec_freq_mesh)
|
|
673
|
+
|
|
674
|
+
def parse_maxent_scc():
|
|
675
|
+
"""Populates the calculation section with the analytically continuated self-energies
|
|
676
|
+
in real space frequencies. This contains the info of the auxiliary function Sigma(infinity),
|
|
677
|
+
which is also stored in the archive.
|
|
678
|
+
"""
|
|
679
|
+
data = self.maxent_sigout_parser.data
|
|
680
|
+
if data is None:
|
|
681
|
+
return
|
|
682
|
+
sec_scc = Calculation()
|
|
683
|
+
sec_run.calculation.append(sec_scc)
|
|
684
|
+
sec_scc.system_ref = sec_run.system[-1]
|
|
685
|
+
sec_scc.method_ref = sec_run.method[-1]
|
|
686
|
+
sec_gfs = GreensFunctions()
|
|
687
|
+
sec_scc.greens_functions.append(sec_gfs)
|
|
688
|
+
sec_gfs.frequencies = data[:, 0]
|
|
689
|
+
try:
|
|
690
|
+
n_orbitals = (
|
|
691
|
+
self.archive.run[-1].method[-1].dmft.n_correlated_orbitals[0]
|
|
692
|
+
) # getting them from DMFT SinglePoint
|
|
693
|
+
sigout_orb_data = np.array(
|
|
694
|
+
[
|
|
695
|
+
data[:, 2 * n + 1] + data[:, 2 * n + 2] * 1j
|
|
696
|
+
for n in range(n_orbitals)
|
|
697
|
+
]
|
|
698
|
+
)
|
|
699
|
+
sec_gfs.self_energy_freq = np.array(
|
|
700
|
+
[[sigout_orb_data, sigout_orb_data]]
|
|
701
|
+
)
|
|
702
|
+
except Exception:
|
|
703
|
+
self.logger.warning(
|
|
704
|
+
'Could not extract self-energy in real frequencies data.'
|
|
705
|
+
)
|
|
706
|
+
aux_sigma = self.maxent_sigout_parser.get('aux_sigma', [])
|
|
707
|
+
if aux_sigma is not None:
|
|
708
|
+
sec_gfs.x_edmft_self_energy_infinity = aux_sigma
|
|
709
|
+
|
|
710
|
+
# System
|
|
711
|
+
self.parse_system(sec_run)
|
|
712
|
+
|
|
713
|
+
# Method and MaxEnt calculation
|
|
714
|
+
maxent_params_files = get_files(
|
|
715
|
+
'maxent_params.dat', self.filepath, self.mainfile
|
|
716
|
+
)
|
|
717
|
+
if maxent_params_files:
|
|
718
|
+
if len(maxent_params_files) > 1:
|
|
719
|
+
self.logger.warning(
|
|
720
|
+
'Multiple maxent_params.dat files found; we will parse the last one.',
|
|
721
|
+
data={'files': maxent_params_files},
|
|
722
|
+
)
|
|
723
|
+
maxent_file = maxent_params_files[-1]
|
|
724
|
+
self.maxent_params_parser.mainfile = maxent_file
|
|
725
|
+
parse_maxent_method()
|
|
726
|
+
sigout_files = get_files(
|
|
727
|
+
'Sig.out', maxent_file, os.path.basename(maxent_file)
|
|
728
|
+
)
|
|
729
|
+
if sigout_files:
|
|
730
|
+
if len(sigout_files) > 1:
|
|
731
|
+
self.logger.warning(
|
|
732
|
+
'Multiple Sig.out files found; we will parse the last one.',
|
|
733
|
+
data={'files': sigout_files},
|
|
734
|
+
)
|
|
735
|
+
self.maxent_sigout_parser.mainfile = sigout_files[-1]
|
|
736
|
+
parse_maxent_scc()
|
|
737
|
+
|
|
738
|
+
# Workflow
|
|
739
|
+
workflow = SinglePoint()
|
|
740
|
+
workflow.name = 'MaxEnt Sigma'
|
|
741
|
+
archive.workflow2 = workflow
|
|
742
|
+
|
|
743
|
+
def parse_maxent_workflow(
|
|
744
|
+
self, maxent_archive: EntryArchive, workflow_archive: EntryArchive
|
|
745
|
+
):
|
|
746
|
+
"""Populates the DMFT+MaxEnt workflow archive. This will contain:
|
|
747
|
+
1- The Green's function in real frequencies and the Spectral density function (to be compared with the DOS).
|
|
748
|
+
2- Tasks pointing to the DMFT SinglePoint and MaxEnt SinglePoint entries.
|
|
749
|
+
"""
|
|
750
|
+
self.init_parser()
|
|
751
|
+
sec_run = Run()
|
|
752
|
+
workflow_archive.run.append(sec_run)
|
|
753
|
+
sec_run.program = Program(name='eDMFT')
|
|
754
|
+
|
|
755
|
+
def parse_gfs_real_freqs():
|
|
756
|
+
sec_scc = Calculation()
|
|
757
|
+
sec_run.calculation.append(sec_scc)
|
|
758
|
+
if sec_run.system is not None:
|
|
759
|
+
sec_scc.system_ref = sec_run.system[-1]
|
|
760
|
+
maxent_indmfl_files = get_files('**/*.indmfl', self.filepath, self.mainfile)
|
|
761
|
+
if not maxent_indmfl_files:
|
|
762
|
+
return
|
|
763
|
+
for file in maxent_indmfl_files:
|
|
764
|
+
self.indmfl_parser.mainfile = file
|
|
765
|
+
if self.indmfl_parser.get('real_or_imaginary_axis') is not None:
|
|
766
|
+
axis_flag = int(self.indmfl_parser.get('real_or_imaginary_axis')[0])
|
|
767
|
+
if axis_flag == 0: # real frequencies flaghybridization_function
|
|
768
|
+
if not self.indmfl_parser.get('siginds_corr', {}).get('cix'):
|
|
769
|
+
self.logger.warning(
|
|
770
|
+
'Could not locate the number of correlated orbital in the impurity.'
|
|
771
|
+
)
|
|
772
|
+
return
|
|
773
|
+
n_orbitals = self.indmfl_parser.get('siginds_corr', {}).get(
|
|
774
|
+
'cix'
|
|
775
|
+
)[0][-1]
|
|
776
|
+
# Parsing Green's function and hybridization function
|
|
777
|
+
lattice_gf_files = get_files(
|
|
778
|
+
'*.gc1', file, os.path.basename(file)
|
|
779
|
+
)
|
|
780
|
+
lattice_delta_files = get_files(
|
|
781
|
+
'*.dlt1', file, os.path.basename(file)
|
|
782
|
+
)
|
|
783
|
+
for i_files, lattice_files in enumerate(
|
|
784
|
+
[lattice_gf_files, lattice_delta_files]
|
|
785
|
+
):
|
|
786
|
+
if lattice_files:
|
|
787
|
+
if len(lattice_files) > 1:
|
|
788
|
+
self.logger.warning(
|
|
789
|
+
'Multiple lattice files (*.gc1 or *.dlt1) found; we will parse the last one.',
|
|
790
|
+
data={'files': lattice_files},
|
|
791
|
+
)
|
|
792
|
+
self.lattice_parser.mainfile = lattice_files[-1]
|
|
793
|
+
sec_gfs = GreensFunctions()
|
|
794
|
+
sec_scc.greens_functions.append(sec_gfs)
|
|
795
|
+
sec_gfs.type = 'lattice'
|
|
796
|
+
lattice_data = self.lattice_parser.data
|
|
797
|
+
extracted_lattice_data = (
|
|
798
|
+
self.extract_greens_functions_data(
|
|
799
|
+
sec_scc,
|
|
800
|
+
sec_gfs,
|
|
801
|
+
n_orbitals,
|
|
802
|
+
lattice_data,
|
|
803
|
+
'real',
|
|
804
|
+
False,
|
|
805
|
+
)
|
|
806
|
+
if lattice_data is not None
|
|
807
|
+
else None
|
|
808
|
+
)
|
|
809
|
+
sec_gfs.m_set(
|
|
810
|
+
sec_gfs.m_get_quantity_definition(
|
|
811
|
+
self._gf_lattice_maxent[i_files]
|
|
812
|
+
),
|
|
813
|
+
extracted_lattice_data,
|
|
814
|
+
)
|
|
815
|
+
# Parsing DOS as - Im G / np.pi
|
|
816
|
+
if lattice_files == lattice_gf_files:
|
|
817
|
+
sec_dos = Dos()
|
|
818
|
+
sec_scc.dos_electronic.append(sec_dos)
|
|
819
|
+
sec_dos.kind = 'spectral'
|
|
820
|
+
sec_dos.energy_fermi = 0.0 * ureg.eV
|
|
821
|
+
sec_dos.n_energies = len(lattice_data[:, 0])
|
|
822
|
+
sec_dos.energies = lattice_data[:, 0] * ureg.eV
|
|
823
|
+
sec_dos_values = DosValues()
|
|
824
|
+
sec_dos.total.append(sec_dos_values)
|
|
825
|
+
value = (
|
|
826
|
+
-np.sum(extracted_lattice_data[0][0].imag, (0))
|
|
827
|
+
/ np.pi
|
|
828
|
+
)
|
|
829
|
+
sec_dos_values.value = value / ureg.eV
|
|
830
|
+
|
|
831
|
+
# System
|
|
832
|
+
self.parse_system(sec_run)
|
|
833
|
+
|
|
834
|
+
# G(w) and DOS calculation
|
|
835
|
+
parse_gfs_real_freqs()
|
|
836
|
+
|
|
837
|
+
# Workflow
|
|
838
|
+
self.parse_dmft_maxent_workflow(maxent_archive, workflow_archive)
|
|
839
|
+
|
|
840
|
+
def parse(self, filepath: str, archive: EntryArchive, logger):
|
|
841
|
+
self.filepath = filepath
|
|
842
|
+
self.archive = archive
|
|
843
|
+
self.maindir = os.path.dirname(self.filepath)
|
|
844
|
+
self.mainfile = os.path.basename(self.filepath)
|
|
845
|
+
self.logger = logging.getLogger(__name__) if logger is None else logger
|
|
846
|
+
|
|
847
|
+
self.init_parser()
|
|
848
|
+
|
|
849
|
+
params_files = get_files('*params.dat', self.filepath, self.mainfile)
|
|
850
|
+
if params_files:
|
|
851
|
+
if len(params_files) > 1:
|
|
852
|
+
self.logger.warning(
|
|
853
|
+
'Multiple *params.dat files found; we will parse the last one.',
|
|
854
|
+
data={'files': params_files},
|
|
855
|
+
)
|
|
856
|
+
self.params_parser.mainfile = params_files[-1]
|
|
857
|
+
|
|
858
|
+
if self.params_parser.get('general_parameters'):
|
|
859
|
+
self.general_parameters = dict(
|
|
860
|
+
self.params_parser.get('general_parameters').get('params', [])
|
|
861
|
+
)
|
|
862
|
+
if self.params_parser.get('impurity_parameters'):
|
|
863
|
+
self.impurity_parameters = dict(
|
|
864
|
+
self.params_parser.get('impurity_parameters').get('params', [])
|
|
865
|
+
)
|
|
866
|
+
|
|
867
|
+
# Program section
|
|
868
|
+
sec_run = Run()
|
|
869
|
+
self.archive.run.append(sec_run)
|
|
870
|
+
sec_run.program = Program(name='eDMFT')
|
|
871
|
+
|
|
872
|
+
# System section
|
|
873
|
+
self.parse_system(sec_run)
|
|
874
|
+
|
|
875
|
+
# Method.DMFT section
|
|
876
|
+
indmfl_files = get_files('*.indmfl', self.filepath, self.mainfile)
|
|
877
|
+
if indmfl_files:
|
|
878
|
+
if len(indmfl_files) > 1:
|
|
879
|
+
self.logger.warning(
|
|
880
|
+
'Multiple *.indmfl files found; we will parse the last one.',
|
|
881
|
+
data={'files': indmfl_files},
|
|
882
|
+
)
|
|
883
|
+
self.indmfl_parser.mainfile = indmfl_files[-1]
|
|
884
|
+
if self.general_parameters and self.impurity_parameters:
|
|
885
|
+
self.parse_initial_model()
|
|
886
|
+
self.parse_method()
|
|
887
|
+
|
|
888
|
+
# Calculation section
|
|
889
|
+
self.parse_scc()
|
|
890
|
+
|
|
891
|
+
# Workflow section
|
|
892
|
+
workflow = SinglePoint()
|
|
893
|
+
self.archive.workflow2 = workflow
|
|
894
|
+
|
|
895
|
+
# DMFT+MaxEnt workflow
|
|
896
|
+
maxent_archive = self._child_archives.get('MaxEnt')
|
|
897
|
+
if maxent_archive:
|
|
898
|
+
# Parse first the MaxEnt SinglePoint archive.
|
|
899
|
+
# MaxEnt contains the analytical continuation of the imaginary axis Self-energy
|
|
900
|
+
# into the real frequencies space.
|
|
901
|
+
self.parse_maxent_archive(maxent_archive)
|
|
902
|
+
|
|
903
|
+
# Then parse the DMFT with MaxEnt continuation workflow archive.
|
|
904
|
+
# DMFT+MaxEnt contains the DMFT SinglePoint, the MaxEnt point, as well as the
|
|
905
|
+
# calculation of the Green's function and DOS in the real frequency axis.
|
|
906
|
+
dmft_maxent_archive = self._child_archives.get('MaxEnt_workflow')
|
|
907
|
+
try:
|
|
908
|
+
self.parse_maxent_workflow(maxent_archive, dmft_maxent_archive)
|
|
909
|
+
except Exception:
|
|
910
|
+
self.logger.error(
|
|
911
|
+
'Error parsing the automatic DMFT with MaxEnt continuation workflow.'
|
|
912
|
+
)
|