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.
Files changed (272) hide show
  1. electronicparsers/__init__.py +1162 -0
  2. electronicparsers/abacus/__init__.py +20 -0
  3. electronicparsers/abacus/__main__.py +32 -0
  4. electronicparsers/abacus/metainfo/__init__.py +19 -0
  5. electronicparsers/abacus/metainfo/abacus.py +836 -0
  6. electronicparsers/abacus/nomad_plugin.yaml +44 -0
  7. electronicparsers/abacus/parser.py +1975 -0
  8. electronicparsers/abinit/__init__.py +19 -0
  9. electronicparsers/abinit/__main__.py +31 -0
  10. electronicparsers/abinit/metainfo/__init__.py +20 -0
  11. electronicparsers/abinit/metainfo/abinit.py +871 -0
  12. electronicparsers/abinit/metainfo/abinit_autogenerated.py +6794 -0
  13. electronicparsers/abinit/nomad_plugin.yaml +43 -0
  14. electronicparsers/abinit/parser.py +1922 -0
  15. electronicparsers/ams/__init__.py +19 -0
  16. electronicparsers/ams/__main__.py +31 -0
  17. electronicparsers/ams/metainfo/__init__.py +19 -0
  18. electronicparsers/ams/metainfo/ams.py +769 -0
  19. electronicparsers/ams/nomad_plugin.yaml +19 -0
  20. electronicparsers/ams/parser.py +1849 -0
  21. electronicparsers/ams/rkf.py +620 -0
  22. electronicparsers/atk/__init__.py +19 -0
  23. electronicparsers/atk/__main__.py +31 -0
  24. electronicparsers/atk/metainfo/__init__.py +19 -0
  25. electronicparsers/atk/metainfo/atk.py +71 -0
  26. electronicparsers/atk/nomad_plugin.yaml +34 -0
  27. electronicparsers/atk/parser.py +388 -0
  28. electronicparsers/bigdft/__init__.py +19 -0
  29. electronicparsers/bigdft/__main__.py +31 -0
  30. electronicparsers/bigdft/metainfo/__init__.py +18 -0
  31. electronicparsers/bigdft/nomad_plugin.yaml +19 -0
  32. electronicparsers/bigdft/parser.py +372 -0
  33. electronicparsers/castep/__init__.py +19 -0
  34. electronicparsers/castep/__main__.py +31 -0
  35. electronicparsers/castep/metainfo/__init__.py +19 -0
  36. electronicparsers/castep/metainfo/castep.py +2481 -0
  37. electronicparsers/castep/nomad_plugin.yaml +28 -0
  38. electronicparsers/castep/parser.py +1680 -0
  39. electronicparsers/charmm/__init__.py +19 -0
  40. electronicparsers/charmm/__main__.py +31 -0
  41. electronicparsers/charmm/metainfo/__init__.py +19 -0
  42. electronicparsers/charmm/metainfo/charmm.py +1931 -0
  43. electronicparsers/charmm/nomad_plugin.yaml +18 -0
  44. electronicparsers/charmm/parser.py +61 -0
  45. electronicparsers/cp2k/__init__.py +19 -0
  46. electronicparsers/cp2k/__main__.py +31 -0
  47. electronicparsers/cp2k/metainfo/__init__.py +19 -0
  48. electronicparsers/cp2k/metainfo/cp2k.py +59185 -0
  49. electronicparsers/cp2k/metainfo/cp2k_general.py +1014 -0
  50. electronicparsers/cp2k/nomad_plugin.yaml +49 -0
  51. electronicparsers/cp2k/parser.py +2324 -0
  52. electronicparsers/cpmd/__init__.py +19 -0
  53. electronicparsers/cpmd/__main__.py +31 -0
  54. electronicparsers/cpmd/metainfo/__init__.py +19 -0
  55. electronicparsers/cpmd/metainfo/cpmd.py +10733 -0
  56. electronicparsers/cpmd/metainfo/cpmd_general.py +988 -0
  57. electronicparsers/cpmd/nomad_plugin.yaml +19 -0
  58. electronicparsers/cpmd/parser.py +680 -0
  59. electronicparsers/crystal/__init__.py +19 -0
  60. electronicparsers/crystal/__main__.py +31 -0
  61. electronicparsers/crystal/metainfo/__init__.py +19 -0
  62. electronicparsers/crystal/metainfo/crystal.py +619 -0
  63. electronicparsers/crystal/nomad_plugin.yaml +36 -0
  64. electronicparsers/crystal/parser.py +1745 -0
  65. electronicparsers/dmol3/__init__.py +19 -0
  66. electronicparsers/dmol3/__main__.py +31 -0
  67. electronicparsers/dmol3/metainfo/__init__.py +19 -0
  68. electronicparsers/dmol3/metainfo/dmol3.py +664 -0
  69. electronicparsers/dmol3/nomad_plugin.yaml +19 -0
  70. electronicparsers/dmol3/parser.py +750 -0
  71. electronicparsers/edmft/__init__.py +19 -0
  72. electronicparsers/edmft/__main__.py +31 -0
  73. electronicparsers/edmft/metainfo/__init__.py +19 -0
  74. electronicparsers/edmft/metainfo/edmft.py +96 -0
  75. electronicparsers/edmft/nomad_plugin.yaml +53 -0
  76. electronicparsers/edmft/parser.py +912 -0
  77. electronicparsers/elk/__init__.py +19 -0
  78. electronicparsers/elk/__main__.py +31 -0
  79. electronicparsers/elk/metainfo/__init__.py +19 -0
  80. electronicparsers/elk/metainfo/elk.py +775 -0
  81. electronicparsers/elk/nomad_plugin.yaml +19 -0
  82. electronicparsers/elk/parser.py +493 -0
  83. electronicparsers/exciting/__init__.py +19 -0
  84. electronicparsers/exciting/__main__.py +31 -0
  85. electronicparsers/exciting/metainfo/__init__.py +19 -0
  86. electronicparsers/exciting/metainfo/exciting.py +2942 -0
  87. electronicparsers/exciting/nomad_plugin.yaml +83 -0
  88. electronicparsers/exciting/parser.py +3398 -0
  89. electronicparsers/fhiaims/__init__.py +19 -0
  90. electronicparsers/fhiaims/__main__.py +31 -0
  91. electronicparsers/fhiaims/metainfo/__init__.py +19 -0
  92. electronicparsers/fhiaims/metainfo/fhi_aims.py +1565 -0
  93. electronicparsers/fhiaims/nomad_plugin.yaml +52 -0
  94. electronicparsers/fhiaims/parser.py +2582 -0
  95. electronicparsers/fleur/__init__.py +19 -0
  96. electronicparsers/fleur/__main__.py +31 -0
  97. electronicparsers/fleur/metainfo/__init__.py +19 -0
  98. electronicparsers/fleur/metainfo/fleur.py +623 -0
  99. electronicparsers/fleur/nomad_plugin.yaml +19 -0
  100. electronicparsers/fleur/parser.py +952 -0
  101. electronicparsers/fplo/__init__.py +19 -0
  102. electronicparsers/fplo/__main__.py +31 -0
  103. electronicparsers/fplo/metainfo/__init__.py +19 -0
  104. electronicparsers/fplo/metainfo/fplo.py +188 -0
  105. electronicparsers/fplo/metainfo/fplo_input_autogenerated.py +2744 -0
  106. electronicparsers/fplo/metainfo/fplo_temporaries.py +319 -0
  107. electronicparsers/fplo/nomad_plugin.yaml +19 -0
  108. electronicparsers/fplo/parser.py +42 -0
  109. electronicparsers/gamess/__init__.py +19 -0
  110. electronicparsers/gamess/__main__.py +31 -0
  111. electronicparsers/gamess/metainfo/__init__.py +19 -0
  112. electronicparsers/gamess/metainfo/gamess.py +837 -0
  113. electronicparsers/gamess/nomad_plugin.yaml +19 -0
  114. electronicparsers/gamess/parser.py +941 -0
  115. electronicparsers/gaussian/__init__.py +19 -0
  116. electronicparsers/gaussian/__main__.py +31 -0
  117. electronicparsers/gaussian/metainfo/__init__.py +19 -0
  118. electronicparsers/gaussian/metainfo/gaussian.py +1707 -0
  119. electronicparsers/gaussian/nomad_plugin.yaml +18 -0
  120. electronicparsers/gaussian/parser.py +1556 -0
  121. electronicparsers/gpaw/__init__.py +19 -0
  122. electronicparsers/gpaw/__main__.py +31 -0
  123. electronicparsers/gpaw/metainfo/__init__.py +19 -0
  124. electronicparsers/gpaw/metainfo/gpaw.py +214 -0
  125. electronicparsers/gpaw/nomad_plugin.yaml +19 -0
  126. electronicparsers/gpaw/parser.py +671 -0
  127. electronicparsers/magres/__init__.py +19 -0
  128. electronicparsers/magres/__main__.py +31 -0
  129. electronicparsers/magres/metainfo/__init__.py +19 -0
  130. electronicparsers/magres/metainfo/magres.py +110 -0
  131. electronicparsers/magres/nomad_plugin.yaml +18 -0
  132. electronicparsers/magres/parser.py +505 -0
  133. electronicparsers/molcas/__init__.py +19 -0
  134. electronicparsers/molcas/__main__.py +31 -0
  135. electronicparsers/molcas/metainfo/__init__.py +19 -0
  136. electronicparsers/molcas/metainfo/molcas.py +151 -0
  137. electronicparsers/molcas/nomad_plugin.yaml +19 -0
  138. electronicparsers/molcas/parser.py +59 -0
  139. electronicparsers/mopac/__init__.py +19 -0
  140. electronicparsers/mopac/__main__.py +31 -0
  141. electronicparsers/mopac/metainfo/__init__.py +19 -0
  142. electronicparsers/mopac/metainfo/mopac.py +79 -0
  143. electronicparsers/mopac/nomad_plugin.yaml +19 -0
  144. electronicparsers/mopac/parser.py +304 -0
  145. electronicparsers/nwchem/__init__.py +19 -0
  146. electronicparsers/nwchem/__main__.py +31 -0
  147. electronicparsers/nwchem/metainfo/__init__.py +19 -0
  148. electronicparsers/nwchem/metainfo/nwchem.py +487 -0
  149. electronicparsers/nwchem/nomad_plugin.yaml +19 -0
  150. electronicparsers/nwchem/parser.py +757 -0
  151. electronicparsers/ocean/__init__.py +19 -0
  152. electronicparsers/ocean/__main__.py +31 -0
  153. electronicparsers/ocean/metainfo/__init__.py +19 -0
  154. electronicparsers/ocean/metainfo/ocean.py +410 -0
  155. electronicparsers/ocean/nomad_plugin.yaml +37 -0
  156. electronicparsers/ocean/parser.py +344 -0
  157. electronicparsers/octopus/__init__.py +19 -0
  158. electronicparsers/octopus/__main__.py +31 -0
  159. electronicparsers/octopus/metainfo/__init__.py +19 -0
  160. electronicparsers/octopus/metainfo/octopus.py +71 -0
  161. electronicparsers/octopus/metainfo/octopus_autogenerated.py +11647 -0
  162. electronicparsers/octopus/nomad_plugin.yaml +41 -0
  163. electronicparsers/octopus/parser.py +1214 -0
  164. electronicparsers/onetep/__init__.py +19 -0
  165. electronicparsers/onetep/__main__.py +31 -0
  166. electronicparsers/onetep/metainfo/__init__.py +19 -0
  167. electronicparsers/onetep/metainfo/onetep.py +3443 -0
  168. electronicparsers/onetep/nomad_plugin.yaml +19 -0
  169. electronicparsers/onetep/parser.py +577 -0
  170. electronicparsers/openmx/__init__.py +19 -0
  171. electronicparsers/openmx/__main__.py +31 -0
  172. electronicparsers/openmx/metainfo/__init__.py +19 -0
  173. electronicparsers/openmx/metainfo/openmx.py +24 -0
  174. electronicparsers/openmx/nomad_plugin.yaml +25 -0
  175. electronicparsers/openmx/parser.py +918 -0
  176. electronicparsers/orca/__init__.py +19 -0
  177. electronicparsers/orca/__main__.py +31 -0
  178. electronicparsers/orca/metainfo/__init__.py +19 -0
  179. electronicparsers/orca/metainfo/orca.py +1448 -0
  180. electronicparsers/orca/nomad_plugin.yaml +19 -0
  181. electronicparsers/orca/parser.py +1371 -0
  182. electronicparsers/psi4/__init__.py +19 -0
  183. electronicparsers/psi4/__main__.py +31 -0
  184. electronicparsers/psi4/metainfo/__init__.py +19 -0
  185. electronicparsers/psi4/metainfo/psi4.py +372 -0
  186. electronicparsers/psi4/nomad_plugin.yaml +27 -0
  187. electronicparsers/psi4/parser.py +1362 -0
  188. electronicparsers/qball/__init__.py +19 -0
  189. electronicparsers/qball/__main__.py +31 -0
  190. electronicparsers/qball/metainfo/__init__.py +19 -0
  191. electronicparsers/qball/metainfo/qball.py +27 -0
  192. electronicparsers/qball/nomad_plugin.yaml +25 -0
  193. electronicparsers/qball/parser.py +152 -0
  194. electronicparsers/qbox/__init__.py +19 -0
  195. electronicparsers/qbox/__main__.py +31 -0
  196. electronicparsers/qbox/metainfo/__init__.py +19 -0
  197. electronicparsers/qbox/metainfo/qbox.py +490 -0
  198. electronicparsers/qbox/nomad_plugin.yaml +19 -0
  199. electronicparsers/qbox/parser.py +508 -0
  200. electronicparsers/quantumespresso/__init__.py +19 -0
  201. electronicparsers/quantumespresso/__main__.py +31 -0
  202. electronicparsers/quantumespresso/metainfo/__init__.py +19 -0
  203. electronicparsers/quantumespresso/metainfo/quantum_espresso.py +3296 -0
  204. electronicparsers/quantumespresso/nomad_plugin.yaml +31 -0
  205. electronicparsers/quantumespresso/parser.py +3594 -0
  206. electronicparsers/siesta/__init__.py +19 -0
  207. electronicparsers/siesta/__main__.py +31 -0
  208. electronicparsers/siesta/metainfo/__init__.py +19 -0
  209. electronicparsers/siesta/metainfo/siesta.py +141 -0
  210. electronicparsers/siesta/metainfo/siesta_autogenerated.py +3365 -0
  211. electronicparsers/siesta/nomad_plugin.yaml +19 -0
  212. electronicparsers/siesta/parser.py +607 -0
  213. electronicparsers/soliddmft/__init__.py +19 -0
  214. electronicparsers/soliddmft/__main__.py +31 -0
  215. electronicparsers/soliddmft/metainfo/__init__.py +19 -0
  216. electronicparsers/soliddmft/metainfo/soliddmft.py +274 -0
  217. electronicparsers/soliddmft/nomad_plugin.yaml +26 -0
  218. electronicparsers/soliddmft/parser.py +727 -0
  219. electronicparsers/tbstudio/__init__.py +19 -0
  220. electronicparsers/tbstudio/__main__.py +31 -0
  221. electronicparsers/tbstudio/metainfo/__init__.py +19 -0
  222. electronicparsers/tbstudio/metainfo/tbstudio.py +34 -0
  223. electronicparsers/tbstudio/nomad_plugin.yaml +24 -0
  224. electronicparsers/tbstudio/parser.py +412 -0
  225. electronicparsers/turbomole/__init__.py +19 -0
  226. electronicparsers/turbomole/__main__.py +31 -0
  227. electronicparsers/turbomole/metainfo/__init__.py +19 -0
  228. electronicparsers/turbomole/metainfo/turbomole.py +727 -0
  229. electronicparsers/turbomole/nomad_plugin.yaml +18 -0
  230. electronicparsers/turbomole/parser.py +1585 -0
  231. electronicparsers/utils/__init__.py +20 -0
  232. electronicparsers/utils/magres_workflow.py +61 -0
  233. electronicparsers/utils/utils.py +636 -0
  234. electronicparsers/vasp/__init__.py +19 -0
  235. electronicparsers/vasp/__main__.py +31 -0
  236. electronicparsers/vasp/metainfo/__init__.py +19 -0
  237. electronicparsers/vasp/metainfo/vasp.py +169 -0
  238. electronicparsers/vasp/metainfo/vasp_incars.py +3428 -0
  239. electronicparsers/vasp/metainfo/vasp_incarsOut.py +3428 -0
  240. electronicparsers/vasp/metainfo/vasp_incarsUnknown.py +86 -0
  241. electronicparsers/vasp/nomad_plugin.yaml +28 -0
  242. electronicparsers/vasp/parser.py +2340 -0
  243. electronicparsers/w2dynamics/__init__.py +19 -0
  244. electronicparsers/w2dynamics/__main__.py +31 -0
  245. electronicparsers/w2dynamics/metainfo/__init__.py +19 -0
  246. electronicparsers/w2dynamics/metainfo/w2dynamics.py +1270 -0
  247. electronicparsers/w2dynamics/nomad_plugin.yaml +36 -0
  248. electronicparsers/w2dynamics/parser.py +674 -0
  249. electronicparsers/wannier90/__init__.py +19 -0
  250. electronicparsers/wannier90/__main__.py +31 -0
  251. electronicparsers/wannier90/metainfo/__init__.py +19 -0
  252. electronicparsers/wannier90/metainfo/wannier90.py +56 -0
  253. electronicparsers/wannier90/nomad_plugin.yaml +34 -0
  254. electronicparsers/wannier90/parser.py +671 -0
  255. electronicparsers/wien2k/__init__.py +19 -0
  256. electronicparsers/wien2k/__main__.py +31 -0
  257. electronicparsers/wien2k/metainfo/__init__.py +19 -0
  258. electronicparsers/wien2k/metainfo/wien2k.py +783 -0
  259. electronicparsers/wien2k/nomad_plugin.yaml +18 -0
  260. electronicparsers/wien2k/parser.py +1133 -0
  261. electronicparsers/yambo/__init__.py +19 -0
  262. electronicparsers/yambo/__main__.py +31 -0
  263. electronicparsers/yambo/metainfo/__init__.py +19 -0
  264. electronicparsers/yambo/metainfo/yambo.py +577 -0
  265. electronicparsers/yambo/nomad_plugin.yaml +31 -0
  266. electronicparsers/yambo/parser.py +896 -0
  267. nomad_parser_plugins_electronic-1.0.dist-info/LICENSE +202 -0
  268. nomad_parser_plugins_electronic-1.0.dist-info/METADATA +360 -0
  269. nomad_parser_plugins_electronic-1.0.dist-info/RECORD +272 -0
  270. nomad_parser_plugins_electronic-1.0.dist-info/WHEEL +5 -0
  271. nomad_parser_plugins_electronic-1.0.dist-info/entry_points.txt +43 -0
  272. nomad_parser_plugins_electronic-1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,636 @@
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
+
20
+ import numpy as np
21
+ import os
22
+ from glob import glob
23
+
24
+ from typing import Union
25
+ from nomad.utils import extract_section
26
+ from nomad.datamodel import EntryArchive
27
+ from runschema.run import Run
28
+ from nomad.datamodel.metainfo.workflow import Link, TaskReference
29
+ from simulationworkflowschema import (
30
+ DFTPlusGW,
31
+ DFTPlusGWMethod,
32
+ DFTPlusTBPlusDMFT,
33
+ DFTPlusTBPlusDMFTMethod,
34
+ XS,
35
+ XSMethod,
36
+ FirstPrinciplesPlusTB,
37
+ FirstPrinciplesPlusTBMethod,
38
+ DMFTPlusMaxEnt,
39
+ DMFTPlusMaxEntMethod,
40
+ PhotonPolarization,
41
+ PhotonPolarizationMethod,
42
+ PhotonPolarizationResults,
43
+ )
44
+
45
+ # Special file-format workflow definition
46
+ from .magres_workflow import (
47
+ NMRMagRes,
48
+ NMRMagResMethod,
49
+ NMRMagResResults,
50
+ )
51
+
52
+
53
+ def get_files(pattern: str, filepath: str, stripname: str = '', deep: bool = True):
54
+ """Get files following the `pattern` with respect to the file `stripname` (usually this
55
+ being the mainfile of the given parser) up to / down from the `filepath` (`deep=True` going
56
+ down, `deep=False` up)
57
+
58
+ Args:
59
+ pattern (str): targeted pattern to be found
60
+ filepath (str): filepath to start the search
61
+ stripname (str, optional): name with respect to which do the search. Defaults to ''.
62
+ deep (bool, optional): boolean setting the path in the folders to scan (down or up). Defaults to down=True.
63
+
64
+ Returns:
65
+ list: List of found files.
66
+ """
67
+ for _ in range(10):
68
+ filenames = glob(f'{os.path.dirname(filepath)}/{pattern}')
69
+ pattern = os.path.join('**' if deep else '..', pattern)
70
+ if filenames:
71
+ break
72
+
73
+ if len(filenames) > 1:
74
+ # filter files that match
75
+ suffix = os.path.basename(filepath).strip(stripname)
76
+ matches = [f for f in filenames if suffix in f]
77
+ filenames = matches if matches else filenames
78
+
79
+ filenames = [f for f in filenames if os.access(f, os.F_OK)]
80
+ return filenames
81
+
82
+
83
+ def numpy_type_to_json_serializable(
84
+ quantity: Union[np.bool_, np.int32, np.int64, np.float64],
85
+ ):
86
+ """Converts numpy data types to native Python types suitable for JSON serialization.
87
+
88
+ Args:
89
+ quantity (Union[np.bool_, np.int32, np.int64, np.float64]): The numpy data type
90
+ value to be converted.
91
+
92
+ Returns:
93
+ Union[bool, int, float]: The converted native Python type.
94
+ """
95
+ if isinstance(quantity, np.bool_):
96
+ return bool(quantity)
97
+ if isinstance(quantity, (np.int32, np.int64)):
98
+ return int(quantity)
99
+ if isinstance(quantity, np.float64):
100
+ return float(quantity)
101
+
102
+
103
+ class BeyondDFTWorkflowsParser:
104
+ """
105
+ Generates automatic beyondDFT (GW, BSE, DMFT) workflows. Main classes for parsers will
106
+ inherit from here if some automatic workflow parsing has been implemented.
107
+ """
108
+
109
+ def __init__(
110
+ self,
111
+ archive: EntryArchive,
112
+ _child_archives: dict,
113
+ _xs_spectra_types: list,
114
+ logger,
115
+ ):
116
+ self.archive = archive
117
+ self.logger = logger
118
+ self._child_archives = _child_archives
119
+ self._xs_spectra_types = _xs_spectra_types
120
+
121
+ def run_workflow_archive(self, workflow_archive: EntryArchive):
122
+ """Initializes the workflow archive by checking if Run exists or not, as well as
123
+ copying Program and System into it.
124
+
125
+ Args:
126
+ workflow_archive (EntryArchive): the workflow archive targeted for initialization
127
+ """
128
+ if workflow_archive.run:
129
+ sec_run = workflow_archive.run[-1]
130
+ else:
131
+ sec_run = Run()
132
+ workflow_archive.run.append(sec_run)
133
+ sec_run.program = self.archive.run[-1].program
134
+
135
+ def parse_gw_workflow(
136
+ self, gw_archive: EntryArchive, gw_workflow_archive: EntryArchive
137
+ ):
138
+ """Automatically parses the GW workflow. Here, `self.archive` is the DFT archive.
139
+
140
+ Args:
141
+ gw_archive (EntryArchive): the GW archive
142
+ gw_workflow_archive (EntryArchive): the GW workflow archive
143
+ """
144
+ self.run_workflow_archive(gw_workflow_archive)
145
+ gw_workflow_archive.run[-1].m_add_sub_section(
146
+ Run.system, self.archive.run[-1].system[-1]
147
+ )
148
+
149
+ workflow = DFTPlusGW(method=DFTPlusGWMethod())
150
+
151
+ # Method
152
+ method_gw = extract_section(gw_archive, ['run', 'method', 'gw'])
153
+ method_xcfunctional = extract_section(
154
+ self.archive, ['run', 'method', 'dft', 'xc_functional']
155
+ )
156
+ method_basisset = extract_section(
157
+ self.archive, ['run', 'method', 'electrons_representation']
158
+ )
159
+ workflow.method.gw_method_ref = method_gw
160
+ workflow.method.starting_point = method_xcfunctional
161
+ workflow.method.electrons_representation = method_basisset
162
+
163
+ # Inputs and Outputs
164
+ input_structure = extract_section(self.archive, ['run', 'system'])
165
+ dft_calculation = extract_section(self.archive, ['run', 'calculation'])
166
+ gw_calculation = extract_section(gw_archive, ['run', 'calculation'])
167
+ if input_structure:
168
+ workflow.m_add_sub_section(
169
+ DFTPlusGW.inputs, Link(name='Input structure', section=input_structure)
170
+ )
171
+ if gw_calculation:
172
+ workflow.m_add_sub_section(
173
+ DFTPlusGW.outputs,
174
+ Link(name='Output GW calculation', section=gw_calculation),
175
+ )
176
+
177
+ # DFT task
178
+ if self.archive.workflow2:
179
+ task = TaskReference(task=self.archive.workflow2)
180
+ task.name = 'DFT'
181
+ # TODO check why this re-writting is necessary to not repeat sections inside tasks
182
+ if input_structure:
183
+ task.inputs = [Link(name='Input structure', section=input_structure)]
184
+ if dft_calculation:
185
+ task.outputs = [
186
+ Link(name='Output DFT calculation', section=dft_calculation)
187
+ ]
188
+ workflow.m_add_sub_section(DFTPlusGW.tasks, task)
189
+
190
+ # GW task
191
+ if gw_archive.workflow2:
192
+ task = TaskReference(task=gw_archive.workflow2)
193
+ task.name = 'GW'
194
+ if dft_calculation:
195
+ task.inputs = [
196
+ Link(name='Output DFT calculation', section=dft_calculation)
197
+ ]
198
+ if gw_calculation:
199
+ task.outputs = [
200
+ Link(name='Output GW calculation', section=gw_calculation)
201
+ ]
202
+ workflow.m_add_sub_section(DFTPlusGW.tasks, task)
203
+
204
+ gw_workflow_archive.workflow2 = workflow
205
+
206
+ def parse_tb_workflow(
207
+ self,
208
+ tb_archive: EntryArchive,
209
+ first_principles_calculation_archive: EntryArchive,
210
+ tb_workflow_archive: EntryArchive,
211
+ ):
212
+ """Automatically parses the TB workflow. Here, `self.archive` is the DFT archive.
213
+
214
+ Args:
215
+ tb_archive (EntryArchive): the Tight-Binding archive
216
+ first_principles_calculation_archive (EntryArchive): the first-principles-calculation archive
217
+ tb_workflow_archive (EntryArchive): the Tight-Binding workflow archive
218
+ """
219
+ self.run_workflow_archive(tb_workflow_archive)
220
+ tb_workflow_archive.run[-1].m_add_sub_section(
221
+ Run.system, first_principles_calculation_archive.run[-1].system[-1]
222
+ )
223
+ workflow = FirstPrinciplesPlusTB(method=FirstPrinciplesPlusTBMethod())
224
+
225
+ # Method
226
+ method_first_principles = extract_section(
227
+ first_principles_calculation_archive, ['run', 'method']
228
+ )
229
+ method_tb = extract_section(tb_archive, ['run', 'method', 'tb'])
230
+ workflow.method.first_principles_method_ref = method_first_principles
231
+ workflow.method.tb_method_ref = method_tb
232
+
233
+ # Inputs and Outputs
234
+ input_structure = extract_section(
235
+ first_principles_calculation_archive, ['run', 'system']
236
+ )
237
+ first_principles_calculation = extract_section(
238
+ first_principles_calculation_archive, ['run', 'calculation']
239
+ )
240
+ tb_calculation = extract_section(tb_archive, ['run', 'calculation'])
241
+ if input_structure:
242
+ workflow.m_add_sub_section(
243
+ FirstPrinciplesPlusTB.inputs,
244
+ Link(name='Input Structure', section=input_structure),
245
+ )
246
+ if tb_calculation:
247
+ workflow.m_add_sub_section(
248
+ FirstPrinciplesPlusTB.outputs,
249
+ Link(name='Output TB Model', section=tb_calculation),
250
+ )
251
+
252
+ # First Principles Calculation task
253
+ if self.archive.workflow2:
254
+ first_principles_task = TaskReference(
255
+ task=first_principles_calculation_archive.workflow2
256
+ )
257
+ first_principles_task.name = 'FirstPrinciples'
258
+ if input_structure:
259
+ first_principles_task.inputs = [
260
+ Link(name='Input Structure', section=input_structure)
261
+ ]
262
+ if first_principles_calculation:
263
+ first_principles_task.outputs = [
264
+ Link(
265
+ name='Output FirstPrinciples Calculation',
266
+ section=first_principles_calculation,
267
+ )
268
+ ]
269
+ workflow.m_add_sub_section(
270
+ FirstPrinciplesPlusTB.tasks, first_principles_task
271
+ )
272
+
273
+ # TB task
274
+ if tb_archive.workflow2:
275
+ tb_task = TaskReference(task=tb_archive.workflow2)
276
+ tb_task.name = 'TB'
277
+ if first_principles_calculation:
278
+ tb_task.inputs = [
279
+ Link(
280
+ name='Input FirstPrinciples Calculation',
281
+ section=first_principles_calculation,
282
+ )
283
+ ]
284
+ if tb_calculation:
285
+ tb_task.outputs = [Link(name='Output TB Model', section=tb_calculation)]
286
+ workflow.m_add_sub_section(FirstPrinciplesPlusTB.tasks, tb_task)
287
+
288
+ tb_workflow_archive.workflow2 = workflow
289
+
290
+ def parse_photon_workflow(self):
291
+ """Automatically parses the PhotonPolarization workflow. Here, `self.archive` is
292
+ the photon_workflow archive, and `self._child_archives` the archives for SinglePoint
293
+ photons.
294
+ """
295
+ workflow = PhotonPolarization(
296
+ method=PhotonPolarizationMethod(), results=PhotonPolarizationResults()
297
+ )
298
+ workflow.name = 'BSE' # this entry contains the full BSE calculation for all photon polarizations
299
+
300
+ # Method
301
+ method_bse = extract_section(self.archive, ['run', 'method', 'bse'])
302
+ workflow.method.bse_method_ref = method_bse
303
+
304
+ # Inputs
305
+ input_structure = extract_section(self.archive, ['run', 'system'])
306
+ workflow.m_add_sub_section(
307
+ PhotonPolarization.inputs,
308
+ Link(name='Input structure', section=input_structure),
309
+ )
310
+ input_method = extract_section(self.archive, ['run', 'method'])
311
+ workflow.m_add_sub_section(
312
+ PhotonPolarization.inputs,
313
+ Link(name='Input BSE methodology', section=input_method),
314
+ )
315
+
316
+ # Outputs
317
+ spectra = []
318
+ for index, path in enumerate(self._child_archives.keys()):
319
+ archive = self._child_archives.get(path)
320
+
321
+ output_polarization = extract_section(archive, ['run', 'calculation'])
322
+ if output_polarization:
323
+ workflow.m_add_sub_section(
324
+ PhotonPolarization.outputs,
325
+ Link(
326
+ name=f'Output polarization {index + 1}',
327
+ section=output_polarization,
328
+ ),
329
+ )
330
+ spectra.append(output_polarization.spectra[0])
331
+
332
+ # Tasks
333
+ if archive.workflow2:
334
+ task = TaskReference(task=archive.workflow2)
335
+ task.name = f'Photon {index + 1}'
336
+ input_photon_method = archive.run[-1].method[0]
337
+ if input_photon_method and input_structure:
338
+ task.inputs = [
339
+ Link(name='Input structure', section=input_structure),
340
+ Link(
341
+ name='Input photon parameters', section=input_photon_method
342
+ ),
343
+ ]
344
+ if output_polarization:
345
+ task.outputs = [
346
+ Link(
347
+ name=f'Output polarization {index + 1}',
348
+ section=output_polarization,
349
+ )
350
+ ]
351
+ workflow.m_add_sub_section(PhotonPolarization.tasks, task)
352
+
353
+ # Results
354
+ workflow.results.n_polarizations = len(spectra)
355
+ workflow.results.spectrum_polarization = spectra
356
+
357
+ self.archive.workflow2 = workflow
358
+
359
+ def parse_xs_workflow(
360
+ self, xs_archives: EntryArchive, xs_workflow_archive: EntryArchive
361
+ ):
362
+ """Automatically parses the XS workflow. Here, `self.archive` is the DFT archive.
363
+
364
+ Args:
365
+ xs_archives (EntryArchive): the XS archive
366
+ xs_workflow_archive (EntryArchive): the XS workflow archive
367
+ """
368
+ self.run_workflow_archive(xs_workflow_archive)
369
+ xs_workflow_archive.run[-1].m_add_sub_section(
370
+ Run.system, self.archive.run[-1].system[-1]
371
+ )
372
+
373
+ def extract_polarization_outputs():
374
+ output = []
375
+ index = 0
376
+ for path, archive in self._child_archives.items():
377
+ if os.path.basename(path).split('_')[0] in self._xs_spectra_types:
378
+ output_polarization = archive.run[-1].calculation[-1]
379
+ output.append(
380
+ Link(
381
+ name=f'Output polarization {index + 1}',
382
+ section=output_polarization,
383
+ )
384
+ )
385
+ index += 1
386
+ return output
387
+
388
+ workflow = XS(method=XSMethod())
389
+ workflow.name = 'XS'
390
+
391
+ # Inputs and Outputs
392
+ input_structure = extract_section(self.archive, ['run', 'system'])
393
+ dft_calculation = extract_section(self.archive, ['run', 'calculation'])
394
+ polarization_calculations = extract_polarization_outputs()
395
+ if input_structure:
396
+ workflow.m_add_sub_section(
397
+ XS.inputs, Link(name='Input structure', section=input_structure)
398
+ )
399
+ for index, polarizations in enumerate(polarization_calculations):
400
+ workflow.m_add_sub_section(
401
+ XS.outputs,
402
+ Link(name=f'Polarization {index + 1}', section=polarizations),
403
+ )
404
+
405
+ # DFT task
406
+ if self.archive.workflow2:
407
+ task = TaskReference(task=self.archive.workflow2)
408
+ task.name = 'DFT'
409
+ if input_structure:
410
+ task.inputs = [Link(name='Input structure', section=input_structure)]
411
+ if dft_calculation:
412
+ task.outputs = [
413
+ Link(name='Output DFT calculation', section=dft_calculation)
414
+ ]
415
+ workflow.m_add_sub_section(XS.tasks, task)
416
+
417
+ # Spectra task
418
+ for index, xs_archive in enumerate(xs_archives):
419
+ if not xs_archive.workflow2:
420
+ continue
421
+ task = TaskReference(task=xs_archive.workflow2)
422
+ task.name = f'BSE {index + 1}'
423
+ if dft_calculation:
424
+ xs_archive.workflow2.m_add_sub_section(
425
+ PhotonPolarization.inputs,
426
+ Link(name='Output DFT calculation', section=dft_calculation),
427
+ )
428
+ task.inputs = [
429
+ Link(name='Output DFT calculation', section=dft_calculation)
430
+ ]
431
+ for i_photon, photon_task in enumerate(xs_archive.workflow2.tasks):
432
+ photon_task.m_add_sub_section(
433
+ TaskReference.inputs,
434
+ Link(name='Output DFT calculation', section=dft_calculation),
435
+ )
436
+ if photon_task.m_xpath('outputs[-1].section'):
437
+ task.m_add_sub_section(
438
+ TaskReference.outputs,
439
+ Link(
440
+ name=f'Polarization {i_photon + 1}',
441
+ section=photon_task.outputs[-1].section,
442
+ ),
443
+ )
444
+ workflow.m_add_sub_section(XS.tasks, task)
445
+
446
+ xs_workflow_archive.workflow2 = workflow
447
+
448
+ def parse_dmft_maxent_workflow(
449
+ self, maxent_archive: EntryArchive, workflow_archive: EntryArchive
450
+ ):
451
+ """Automatically parses the DMFT+MaxEnt workflow. Here, `self.archive` is the DMFT archive.
452
+
453
+ Args:
454
+ maxent_archive (EntryArchive): the MaxEnt archive
455
+ workflow_archive (EntryArchive): the DMFT+MaxEnt workflow archive
456
+ """
457
+
458
+ workflow = DMFTPlusMaxEnt(method=DMFTPlusMaxEntMethod())
459
+
460
+ # Method
461
+ method_dmft = extract_section(self.archive, ['run', 'method', 'dmft'])
462
+ method_maxent = extract_section(maxent_archive, ['run', 'method'])
463
+ workflow.method.dmft_method_ref = method_dmft
464
+ workflow.method.maxent_method_ref = method_maxent
465
+
466
+ # Inputs and Outputs
467
+ input_structure = extract_section(self.archive, ['run', 'system'])
468
+ dmft_calculation = extract_section(self.archive, ['run', 'calculation'])
469
+ maxent_calculation = extract_section(maxent_archive, ['run', 'calculation'])
470
+ workflow_maxent_calculation = extract_section(
471
+ workflow_archive, ['run', 'calculation']
472
+ )
473
+ if input_structure:
474
+ workflow.m_add_sub_section(
475
+ DMFTPlusMaxEnt.inputs,
476
+ Link(name='Input structure', section=input_structure),
477
+ )
478
+ if maxent_calculation and workflow_maxent_calculation:
479
+ outputs = [
480
+ Link(
481
+ name='Output MaxEnt Sigma calculation', section=maxent_calculation
482
+ ),
483
+ Link(
484
+ name='Output MaxEnt GF and DOS calculation',
485
+ section=workflow_maxent_calculation,
486
+ ),
487
+ ]
488
+ workflow.outputs = outputs
489
+
490
+ # DMFT task
491
+ if self.archive.workflow2:
492
+ task = TaskReference(task=self.archive.workflow2)
493
+ task.name = 'DMFT'
494
+ if input_structure:
495
+ task.inputs = [Link(name='Input structure', section=input_structure)]
496
+ if dmft_calculation:
497
+ task.outputs = [
498
+ Link(name='Output DMFT calculation', section=dmft_calculation)
499
+ ]
500
+ workflow.m_add_sub_section(DMFTPlusMaxEnt.tasks, task)
501
+
502
+ # MaxEnt task
503
+ if maxent_archive.workflow2:
504
+ task = TaskReference(task=maxent_archive.workflow2)
505
+ task.name = 'MaxEnt'
506
+ if dmft_calculation:
507
+ task.inputs = [
508
+ Link(name='Output DMFT calculation', section=dmft_calculation)
509
+ ]
510
+ if maxent_calculation:
511
+ task.outputs = [
512
+ Link(
513
+ name='Output MaxEnt Sigma calculation',
514
+ section=maxent_calculation,
515
+ )
516
+ ]
517
+ workflow.m_add_sub_section(DMFTPlusMaxEnt.tasks, task)
518
+
519
+ workflow_archive.workflow2 = workflow
520
+
521
+ def parse_dmft_workflow(
522
+ self, wannier_archive: EntryArchive, dmft_workflow_archive: EntryArchive
523
+ ):
524
+ # TODO extend for DFT tasks
525
+ self.run_workflow_archive(dmft_workflow_archive)
526
+ # Check if system exists in the DMFT archive or not, and whether it exists on the
527
+ # Wannier90 archive or not, and then add it.
528
+ try:
529
+ sec_system = self.archive.run[-1].system[-1]
530
+ dmft_workflow_archive.run[-1].m_add_sub_section(Run.system, sec_system)
531
+ except Exception:
532
+ if wannier_archive.run[-1].system[-1]:
533
+ sec_system = wannier_archive.run[-1].system[-1]
534
+ self.archive.run[-1].m_add_sub_section(Run.system, sec_system)
535
+ dmft_workflow_archive.run[-1].m_add_sub_section(Run.system, sec_system)
536
+
537
+ workflow = DFTPlusTBPlusDMFT(method=DFTPlusTBPlusDMFTMethod())
538
+
539
+ # Method
540
+ method_proj = extract_section(wannier_archive, ['run', 'method', 'tb'])
541
+ method_dmft = extract_section(self.archive, ['run', 'method', 'dmft'])
542
+ workflow.method.tb_method_ref = method_proj
543
+ workflow.method.dmft_method_ref = method_dmft
544
+
545
+ # Inputs and Outputs
546
+ input_structure = extract_section(wannier_archive, ['run', 'system'])
547
+ wannier_calculation = extract_section(wannier_archive, ['run', 'calculation'])
548
+ dmft_calculation = extract_section(self.archive, ['run', 'calculation'])
549
+ if input_structure:
550
+ workflow.m_add_sub_section(
551
+ DFTPlusTBPlusDMFT.inputs,
552
+ Link(name='Input structure', section=input_structure),
553
+ )
554
+ if dmft_calculation:
555
+ workflow.m_add_sub_section(
556
+ DFTPlusTBPlusDMFT.outputs,
557
+ Link(name='Output DMFT calculation', section=dmft_calculation),
558
+ )
559
+
560
+ # Wannier90 task
561
+ if wannier_archive.workflow2:
562
+ task = TaskReference(task=wannier_archive.workflow2)
563
+ task.name = 'TB'
564
+ # TODO check why this re-writting is necessary to not repeat sections inside tasks
565
+ if input_structure:
566
+ task.inputs = [Link(name='Input structure', section=input_structure)]
567
+ if wannier_calculation:
568
+ task.outputs = [
569
+ Link(name='Output TB calculation', section=wannier_calculation)
570
+ ]
571
+ workflow.m_add_sub_section(DFTPlusTBPlusDMFT.tasks, task)
572
+
573
+ # DMFT task
574
+ if self.archive.workflow2:
575
+ task = TaskReference(task=self.archive.workflow2)
576
+ task.name = 'DMFT'
577
+ if wannier_calculation:
578
+ task.inputs = [
579
+ Link(name='Output TB calculation', section=wannier_calculation)
580
+ ]
581
+ if dmft_calculation:
582
+ task.outputs = [
583
+ Link(name='Output DMFT calculation', section=dmft_calculation)
584
+ ]
585
+ workflow.m_add_sub_section(DFTPlusTBPlusDMFT.tasks, task)
586
+
587
+ dmft_workflow_archive.workflow2 = workflow
588
+
589
+ def parse_nmr_magres_file_format(self, nmr_first_principles_archive: EntryArchive):
590
+ """
591
+ Automatically parses the NMR Magres workflow. Here, `self.archive` is the
592
+ NMR magres archive in which we will link the original NMR first principles (CASTEP
593
+ or QuantumEspresso-GIPAW)
594
+
595
+ Args:
596
+ nmr_first_principles_archive (EntryArchive): the NMR (first principles)
597
+ SinglePoint archive
598
+ """
599
+ workflow = NMRMagRes(method=NMRMagResMethod(), results=NMRMagResResults())
600
+ workflow.name = 'NMR MagRes'
601
+
602
+ # Method
603
+ method_nmr = extract_section(nmr_first_principles_archive, ['run', 'method'])
604
+ workflow.method.nmr_method_ref = method_nmr
605
+
606
+ # Inputs and Outputs
607
+ input_structure = extract_section(
608
+ nmr_first_principles_archive, ['run', 'system']
609
+ )
610
+ nmr_magres_calculation = extract_section(self.archive, ['run', 'calculation'])
611
+ if input_structure:
612
+ workflow.m_add_sub_section(
613
+ NMRMagRes.inputs, Link(name='Input structure', section=input_structure)
614
+ )
615
+ if nmr_magres_calculation:
616
+ workflow.m_add_sub_section(
617
+ NMRMagRes.outputs,
618
+ Link(name='Output NMR calculation', section=nmr_magres_calculation),
619
+ )
620
+
621
+ # NMR (first principles) task
622
+ if nmr_first_principles_archive.workflow2:
623
+ task = TaskReference(task=nmr_first_principles_archive.workflow2)
624
+ task.name = 'NMR FirstPrinciples'
625
+ if input_structure:
626
+ task.inputs = [Link(name='Input structure', section=input_structure)]
627
+ if nmr_magres_calculation:
628
+ task.outputs = [
629
+ Link(
630
+ name='Output NMR calculation',
631
+ section=nmr_magres_calculation,
632
+ )
633
+ ]
634
+ workflow.m_add_sub_section(NMRMagRes.tasks, task)
635
+
636
+ self.archive.workflow2 = workflow
@@ -0,0 +1,19 @@
1
+ #
2
+ # Copyright The NOMAD Authors.
3
+ #
4
+ # This file is part of NOMAD.
5
+ # See https://nomad-lab.eu for further info.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ from .parser import VASPParser
@@ -0,0 +1,31 @@
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 sys
20
+ import json
21
+ import logging
22
+
23
+ from nomad.utils import configure_logging
24
+ from nomad.datamodel import EntryArchive
25
+ from electronicparsers.vasp import VASPParser
26
+
27
+ if __name__ == '__main__':
28
+ configure_logging(console_log_level=logging.DEBUG)
29
+ archive = EntryArchive()
30
+ VASPParser().parse(sys.argv[1], archive, logging)
31
+ json.dump(archive.m_to_dict(), sys.stdout, indent=2)