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,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.magres import MagresParser
26
+
27
+ if __name__ == '__main__':
28
+ configure_logging(console_log_level=logging.DEBUG)
29
+ archive = EntryArchive()
30
+ MagresParser().parse(sys.argv[1], archive, logging)
31
+ json.dump(archive.m_to_dict(), sys.stdout, indent=2)
@@ -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 . import magres
@@ -0,0 +1,110 @@
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 # pylint: disable=unused-import
20
+ import typing # pylint: disable=unused-import
21
+ from nomad.metainfo import ( # pylint: disable=unused-import
22
+ MSection,
23
+ MCategory,
24
+ Category,
25
+ Package,
26
+ Quantity,
27
+ Section,
28
+ SubSection,
29
+ SectionProxy,
30
+ Reference,
31
+ )
32
+
33
+ from runschema.calculation import (
34
+ MagneticShielding as BaseMagneticShielding,
35
+ ElectricFieldGradient as BaseElectricFieldGradient,
36
+ SpinSpinCoupling as BaseSpinSpinCoupling,
37
+ )
38
+
39
+
40
+ m_package = Package()
41
+
42
+
43
+ class MagneticShielding(BaseMagneticShielding):
44
+ """
45
+ Section extensions for the Run.Calculation.MagneticShielding base section.
46
+ """
47
+
48
+ # ! These quantities should be implemented in `BaseMagneticShielding` as refs to the specific `AtomsState`
49
+
50
+ m_def = Section(extends_base_section=True)
51
+
52
+ atoms = Quantity(
53
+ type=np.str_,
54
+ shape=['n_atoms', 2],
55
+ description="""
56
+ Identifier for the atoms involved in the magnetic shielding tensor. This a list of
57
+ `n_atoms` pairs of strings [atom_label, atom_index]. The atom index corresponds to the position
58
+ on the list `System.atoms.labels`.
59
+ """,
60
+ )
61
+
62
+
63
+ class ElectricFieldGradient(BaseElectricFieldGradient):
64
+ """
65
+ Section extensions for the Run.Calculation.ElectricFieldGradient base section.
66
+ """
67
+
68
+ # ! These quantities should be implemented in `BaseElectricFieldGradient` as refs to the specific `AtomsState`
69
+
70
+ m_def = Section(extends_base_section=True)
71
+
72
+ atoms = Quantity(
73
+ type=np.str_,
74
+ shape=['n_atoms', 2],
75
+ description="""
76
+ Identifier for the atoms involved in the electric field gradient tensor. This a list of
77
+ `n_atoms` pairs of strings [atom_label, atom_index]. The atom index corresponds to the position
78
+ on the list `System.atoms.labels`.
79
+ """,
80
+ )
81
+
82
+
83
+ class SpinSpinCoupling(BaseSpinSpinCoupling):
84
+ """
85
+ Section extensions for the Run.Calculation.SpinspinCoupling base section.
86
+ """
87
+
88
+ # ! These quantities should be implemented in `BaseSpinSpinCoupling` as refs to the specific `AtomsState`g`
89
+
90
+ m_def = Section(extends_base_section=True)
91
+
92
+ atoms_1 = Quantity(
93
+ type=np.str_,
94
+ shape=['n_atoms', 2],
95
+ description="""
96
+ Identifier for the atoms involved in the spin-spin coupling J12 for the 1 atoms. This a list of
97
+ `n_atoms` pairs of strings [atom_label, atom_index]. The atom index corresponds to the position
98
+ on the list `System.atoms.labels`.
99
+ """,
100
+ )
101
+
102
+ atoms_2 = Quantity(
103
+ type=np.str_,
104
+ shape=['n_atoms', 2],
105
+ description="""
106
+ Identifier for the atoms involved in the spin-spin coupling J12 for the 2 atoms. This a list of
107
+ `n_atoms` pairs of strings [atom_label, atom_index]. The atom index corresponds to the position
108
+ on the list `System.atoms.labels`.
109
+ """,
110
+ )
@@ -0,0 +1,18 @@
1
+ code_category: Atomistic code
2
+ code_homepage: https://www.ccpnc.ac.uk/docs/magres
3
+ code_name: magres
4
+ metadata:
5
+ codeCategory: Atomistic code
6
+ codeLabel: magres
7
+ codeLabelStyle: all in lower case
8
+ codeName: magres
9
+ codeUrl: https://www.ccpnc.ac.uk/docs/magres
10
+ parserDirName: dependencies/electronic/electronicparsers/magres/
11
+ parserGitUrl: https://github.com/nomad-coe/electronic-parsers.git
12
+ preamble: ''
13
+ status: production
14
+ tableOfFiles: ''
15
+ name: parsers/magres
16
+ parser_class_name: electronicparsers.magres.parser.MagresParser
17
+ python_package: electronicparsers.magres
18
+ plugin_source_code_url: https://github.com/nomad-coe/electronic-parsers/tree/develop/electronicparsers/magres
@@ -0,0 +1,505 @@
1
+ #
2
+ # Copyright The NOMAD Authors.
3
+ #
4
+ # This file is part of NOMAD.
5
+ # See https://nomad-lab.eu for further info.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+ import os
20
+ import numpy as np
21
+ import logging
22
+
23
+ from nomad.units import ureg
24
+ from nomad.parsing.file_parser import TextParser, Quantity
25
+ from runschema.run import Run, Program
26
+ from runschema.method import (
27
+ Functional,
28
+ Method,
29
+ DFT,
30
+ XCFunctional,
31
+ BasisSetContainer,
32
+ BasisSet,
33
+ KMesh,
34
+ )
35
+ from runschema.system import System, Atoms
36
+ from runschema.calculation import (
37
+ Calculation,
38
+ MagneticSusceptibility,
39
+ MagneticShielding,
40
+ ElectricFieldGradient,
41
+ SpinSpinCoupling,
42
+ )
43
+ from .metainfo.magres import m_package
44
+
45
+ from nomad.app.v1.models import MetadataRequired
46
+ from ..utils import BeyondDFTWorkflowsParser
47
+
48
+
49
+ re_float = r' *[-+]?\d+\.\d*(?:[Ee][-+]\d+)? *'
50
+
51
+
52
+ class MagresFileParser(TextParser):
53
+ def __init__(self):
54
+ super().__init__()
55
+
56
+ def init_quantities(self):
57
+ self._quantities = [
58
+ Quantity('lattice_units', r'units *lattice *([a-zA-Z]+)'),
59
+ Quantity('atom_units', r'units *atom *([a-zA-Z]+)'),
60
+ Quantity('ms_units', r'units *ms *([a-zA-Z]+)'),
61
+ Quantity('efg_units', r'units *efg *([a-zA-Z]+)'),
62
+ Quantity('efg_local_units', r'units *efg_local *([a-zA-Z]+)'),
63
+ Quantity('efg_nonlocal_units', r'units *efg_nonlocal *([a-zA-Z]+)'),
64
+ Quantity('isc_units', r'units *isc *([a-zA-Z\^\d\.\-]+)'),
65
+ Quantity('isc_fc_units', r'units *isc_fc *([a-zA-Z\^\d\.\-]+)'),
66
+ Quantity('isc_spin_units', r'units *isc_spin *([a-zA-Z\^\d\.\-]+)'),
67
+ Quantity(
68
+ 'isc_orbital_p_units', r'units *isc_orbital_p *([a-zA-Z\^\d\.\-]+)'
69
+ ),
70
+ Quantity(
71
+ 'isc_orbital_d_units', r'units *isc_orbital_d *([a-zA-Z\^\d\.\-]+)'
72
+ ),
73
+ Quantity('sus_units', r'units *sus *([a-zA-Z\^\d\.\-]+)'),
74
+ Quantity('cutoffenergy_units', rf'units *calc\_cutoffenergy *([a-zA-Z]+)'),
75
+ Quantity(
76
+ 'calculation',
77
+ r'([\[\<]*calculation[\>\]]*[\s\S]+?)(?:[\[\<]*\/calculation[\>\]]*)',
78
+ sub_parser=TextParser(
79
+ quantities=[
80
+ Quantity('code', r'calc\_code *([a-zA-Z]+)'),
81
+ Quantity(
82
+ 'code_version', r'calc\_code\_version *([a-zA-Z\d\.]+)'
83
+ ),
84
+ Quantity(
85
+ 'code_hgversion',
86
+ r'calc\_code\_hgversion ([a-zA-Z\d\:\+\s]*)\n',
87
+ flatten=False,
88
+ ),
89
+ Quantity(
90
+ 'code_platform', r'calc\_code\_platform *([a-zA-Z\d\_]+)'
91
+ ),
92
+ Quantity('name', r'calc\_name *([\w]+)'),
93
+ Quantity('comment', r'calc\_comment *([\w]+)'),
94
+ Quantity('xcfunctional', r'calc\_xcfunctional *([\w]+)'),
95
+ Quantity(
96
+ 'cutoffenergy',
97
+ rf'calc\_cutoffenergy({re_float})(?P<__unit>\w+)',
98
+ ),
99
+ Quantity(
100
+ 'pspot',
101
+ r'calc\_pspot *([\w]+) *([\w\.\|\(\)\=\:]+)',
102
+ repeats=True,
103
+ ),
104
+ Quantity(
105
+ 'kpoint_mp_grid',
106
+ r'calc\_kpoint\_mp\_grid *([\w]+) *([\w]+) *([\w]+)',
107
+ ),
108
+ Quantity(
109
+ 'kpoint_mp_offset',
110
+ rf'calc\_kpoint\_mp\_offset({re_float*3})$',
111
+ ),
112
+ ]
113
+ ),
114
+ ),
115
+ Quantity(
116
+ 'atoms',
117
+ r'([\[\<]*atoms[\>\]]*[\s\S]+?)(?:[\[\<]*\/atoms[\>\]]*)',
118
+ sub_parser=TextParser(
119
+ quantities=[
120
+ Quantity('lattice', rf'lattice({re_float*9})'),
121
+ Quantity('symmetry', r'symmetry *([\w\-\+\,]+)', repeats=True),
122
+ Quantity(
123
+ 'atom',
124
+ rf'atom *([a-zA-Z]+) *[a-zA-Z\d]* *([\d]+) *({re_float*3})',
125
+ repeats=True,
126
+ ),
127
+ ]
128
+ ),
129
+ ),
130
+ Quantity(
131
+ 'magres',
132
+ r'([\[\<]*magres[\>\]]*[\s\S]+?)(?:[\[\<]*\/magres[\>\]]*)',
133
+ sub_parser=TextParser(
134
+ quantities=[
135
+ Quantity(
136
+ 'ms', rf'ms *(\w+) *(\d+)({re_float*9})', repeats=True
137
+ ),
138
+ Quantity(
139
+ 'efg', rf'efg *(\w+) *(\d+)({re_float*9})', repeats=True
140
+ ),
141
+ Quantity(
142
+ 'efg_local',
143
+ rf'efg_local *(\w+) *(\d+)({re_float*9})',
144
+ repeats=True,
145
+ ),
146
+ Quantity(
147
+ 'efg_nonlocal',
148
+ rf'efg_nonlocal *(\w+) *(\d+)({re_float*9})',
149
+ repeats=True,
150
+ ),
151
+ Quantity(
152
+ 'isc',
153
+ rf'isc *(\w+) *(\d+) *(\w+) *(\d+)({re_float*9})',
154
+ repeats=True,
155
+ ),
156
+ Quantity(
157
+ 'isc_fc',
158
+ rf'isc_fc *(\w+) *(\d+) *(\w+) *(\d+)({re_float*9})',
159
+ repeats=True,
160
+ ),
161
+ Quantity(
162
+ 'isc_orbital_p',
163
+ rf'isc_orbital_p *(\w+) *(\d+) *(\w+) *(\d+)({re_float*9})',
164
+ repeats=True,
165
+ ),
166
+ Quantity(
167
+ 'isc_orbital_d',
168
+ rf'isc_orbital_d *(\w+) *(\d+) *(\w+) *(\d+)({re_float*9})',
169
+ repeats=True,
170
+ ),
171
+ Quantity(
172
+ 'isc_spin',
173
+ rf'isc_spin *(\w+) *(\d+) *(\w+) *(\d+)({re_float*9})',
174
+ repeats=True,
175
+ ),
176
+ Quantity('sus', rf'sus *({re_float*9})', repeats=True),
177
+ ]
178
+ ),
179
+ ),
180
+ ]
181
+
182
+
183
+ class MagresParser(BeyondDFTWorkflowsParser):
184
+ def __init__(self):
185
+ self.magres_file_parser = MagresFileParser()
186
+
187
+ self._xc_functional_map = {
188
+ 'LDA': ['LDA_C_PZ', 'LDA_X_PZ'],
189
+ 'PW91': ['GGA_C_PW91', 'GGA_X_PW91'],
190
+ 'PBE': ['GGA_C_PBE', 'GGA_X_PBE'],
191
+ 'RPBE': ['GGA_X_RPBE'],
192
+ 'WC': ['GGA_C_PBE_GGA_X_WC'],
193
+ 'PBESOL': ['GGA_X_RPBE'],
194
+ 'BLYP': ['GGA_C_LYP', 'LDA_X_B88'],
195
+ 'B3LYP': ['HYB_GGA_XC_B3LYP5'],
196
+ 'HF': ['HF_X'],
197
+ 'HF-LDA': ['HF_X_LDA_C_PW'],
198
+ 'PBE0': ['HYB_GGA_XC_PBEH'],
199
+ 'HSE03': ['HYB_GGA_XC_HSE03'],
200
+ 'HSE06': ['HYB_GGA_XC_HSE06'],
201
+ 'RSCAN': ['MGGA_X_RSCAN', 'MGGA_C_RSCAN'],
202
+ }
203
+
204
+ def init_parser(self):
205
+ self.magres_file_parser.mainfile = self.filepath
206
+ self.magres_file_parser.logger = self.logger
207
+
208
+ def _check_units_magres(self):
209
+ """
210
+ Check if the units of the NMR quantities are magres standard. If not, a warning
211
+ is issued and the default units are used.
212
+ """
213
+ allowed_units = {
214
+ 'lattice': 'Angstrom',
215
+ 'atom': 'Angstrom',
216
+ 'ms': 'ppm',
217
+ 'efg': 'au',
218
+ 'efg_local': 'au',
219
+ 'efg_nonlocal': 'au',
220
+ 'isc': '10^19.T^2.J^-1',
221
+ 'isc_fc': '10^19.T^2.J^-1',
222
+ 'isc_orbital_p': '10^19.T^2.J^-1',
223
+ 'isc_orbital_d': '10^19.T^2.J^-1',
224
+ 'isc_spin': '10^19.T^2.J^-1',
225
+ 'sus': '10^-6.cm^3.mol^-1',
226
+ }
227
+ for key, value in allowed_units.items():
228
+ data = self.magres_file_parser.get(f'{key}_units', '')
229
+ if data and data != value:
230
+ self.logger.warning(
231
+ f'The units of the NMR quantities are not parsed if they are not magres standard. '
232
+ f'We will use the default units.',
233
+ data={
234
+ 'quantities': key,
235
+ 'standard_units': value,
236
+ 'parsed_units': data,
237
+ },
238
+ )
239
+
240
+ def parse_system(self, sec_run: Run):
241
+ """
242
+ Parse the System section by extracting information about the atomic structure:
243
+ lattice vectors, periodic boundary conditions, atom positions and labels from the
244
+ magres file.
245
+
246
+ Args:
247
+ sec_run (Run): the section Run where System will be added.
248
+ """
249
+ sec_atoms = Atoms()
250
+
251
+ # Check if [atoms][/atoms] was correctly parsed
252
+ atoms = self.magres_file_parser.get('atoms')
253
+ if not atoms:
254
+ self.logger.warning('Could not find atomic structure in magres file.')
255
+ return
256
+
257
+ # Store lattice_vectors and periodic boundary conditions
258
+ lattice_vectors = np.reshape(np.array(atoms.get('lattice', [])), (3, 3))
259
+ sec_atoms.lattice_vectors = lattice_vectors * ureg.angstrom
260
+ pbc = (
261
+ [True, True, True] if lattice_vectors is not None else [False, False, False]
262
+ )
263
+ sec_atoms.periodic = pbc
264
+
265
+ # Storing atom positions and labels
266
+ atoms_list = atoms.get('atom', [])
267
+ if len(atoms_list) == 0:
268
+ self.logger.warning(
269
+ 'Could not find atom positions and labels in magres file.'
270
+ )
271
+ return
272
+ atom_labels = []
273
+ atom_positions = []
274
+ for atom in atoms_list:
275
+ atom_labels.append(atom[0])
276
+ atom_positions.append(atom[2:])
277
+ sec_atoms.labels = atom_labels
278
+ sec_atoms.positions = atom_positions * ureg.angstrom
279
+
280
+ # Add Atoms to System and this to Run
281
+ sec_system = System()
282
+ sec_system.atoms = sec_atoms
283
+ sec_run.system.append(sec_system)
284
+
285
+ def parse_method(self, calculation_params: TextParser, sec_run: Run):
286
+ """
287
+ Parse the Method section by extracting information about the NMR method:basis set,
288
+ exchange-correlation functional, cutoff energy, and K mesh.
289
+
290
+ Note: only CASTEP-like method parameters are currently being supported.
291
+
292
+ Args:
293
+ calculation_params (TextParser): the parsed [calculation][/calculation] block parameters.
294
+ sec_run (Run): the section Run where Method will be added.
295
+ """
296
+ sec_method = Method(label='NMR')
297
+
298
+ # XC functional parsing
299
+ sec_dft = DFT()
300
+ xc_functional = calculation_params.get('xcfunctional', 'LDA')
301
+ xc_functional_labels = self._xc_functional_map.get(xc_functional)
302
+ if xc_functional_labels:
303
+ sec_xc_functional = XCFunctional()
304
+ for functional in xc_functional_labels:
305
+ sec_functional = Functional(name=functional)
306
+ if '_X_' in functional or functional.endswith('_X'):
307
+ sec_xc_functional.exchange.append(sec_functional)
308
+ elif '_C_' in functional or functional.endswith('_C'):
309
+ sec_xc_functional.correlation.append(sec_functional)
310
+ elif 'HYB' in functional:
311
+ sec_xc_functional.hybrid.append(sec_functional)
312
+ else:
313
+ sec_xc_functional.contributions.append(sec_functional)
314
+ sec_dft.xc_functional = sec_xc_functional
315
+ sec_method.dft = sec_dft
316
+
317
+ # Basis set parsing (adding cutoff energies units check)
318
+ cutoff = calculation_params.get('cutoffenergy')
319
+ if cutoff.dimensionless:
320
+ cutoff_units = self.magres_file_parser.get('cutoffenergy_units', 'eV')
321
+ if cutoff_units == 'Hartree':
322
+ cutoff_units = 'hartree'
323
+ cutoff = cutoff.magnitude * ureg(cutoff_units)
324
+ sec_basis_set = BasisSetContainer(
325
+ type='plane waves',
326
+ scope=['wavefunction'],
327
+ basis_set=[BasisSet(scope=['valence'], type='plane waves', cutoff=cutoff)],
328
+ )
329
+ sec_method.electrons_representation.append(sec_basis_set)
330
+
331
+ # KMesh parsing
332
+ sec_k_mesh = KMesh(
333
+ grid=calculation_params.get('kpoint_mp_grid', [1, 1, 1]),
334
+ offset=calculation_params.get('kpoint_mp_offset', [0, 0, 0]),
335
+ )
336
+ sec_method.k_mesh = sec_k_mesh
337
+
338
+ # Add Method to Run
339
+ sec_run.method.append(sec_method)
340
+
341
+ def parse_calculation(self, sec_run: Run):
342
+ """
343
+ Parse the Calculation section by extracting information about the magnetic outputs
344
+ in the magres file: magnetic shielding tensor, electric field gradient, indirect
345
+ spin-spin coupling, and magnetic susceptibility. It also stores references to the
346
+ System and Method sections.
347
+
348
+ Args:
349
+ sec_run (Run): the section Run where System will be added.
350
+ """
351
+ # Check if [magres][/magres] was correctly parsed
352
+ magres_data = self.magres_file_parser.get('magres')
353
+ if not magres_data:
354
+ self.logger.warning('Could not find [magres] data block in magres file.')
355
+ return
356
+
357
+ # Creating Calculation and adding System and Method refs
358
+ sec_scc = Calculation()
359
+ sec_scc.system_ref = sec_run.system[-1]
360
+ sec_scc.method_ref = sec_run.method[-1]
361
+ atom_labels = sec_scc.system_ref.atoms.labels
362
+ if not atom_labels:
363
+ self.logger.warning('Could not find the parsed atomic cell information.')
364
+ return
365
+ n_atoms = len(atom_labels)
366
+
367
+ # Magnetic Shielding Tensor (ms) parsing
368
+ data = magres_data.get('ms', [])
369
+ if np.size(data) == n_atoms * (9 + 2): # 2 extra columns with atom labels
370
+ values = np.reshape([d[2:] for d in data], (n_atoms, 3, 3))
371
+ values = np.transpose(values, axes=(0, 2, 1))
372
+ isotropic_value = np.trace(values, axis1=1, axis2=2) / 3.0
373
+ atoms = np.array([d[:2] for d in data])
374
+ sec_ms = MagneticShielding(atoms=atoms)
375
+ sec_ms.value = values * 1e-6 * ureg('dimensionless')
376
+ sec_ms.isotropic_value = isotropic_value * 1e-6 * ureg('dimensionless')
377
+ sec_scc.magnetic_shielding.append(sec_ms)
378
+
379
+ # Electric Field Gradient (efg) parsing
380
+ efg_contributions = {
381
+ 'efg_local': 'local',
382
+ 'efg_nonlocal': 'non_local',
383
+ 'efg': 'total',
384
+ }
385
+ for tag, contribution in efg_contributions.items():
386
+ data = magres_data.get(tag, [])
387
+ if np.size(data) != n_atoms * (9 + 2): # 2 extra columns with atom labels
388
+ continue
389
+ values = np.reshape([d[2:] for d in data], (n_atoms, 3, 3))
390
+ values = np.transpose(values, axes=(0, 2, 1))
391
+ atoms = np.array([d[:2] for d in data])
392
+ sec_efg = ElectricFieldGradient(atoms=atoms)
393
+ sec_efg.contribution = contribution
394
+ sec_efg.value = values * 9.717362e21 * ureg('V/m^2')
395
+ sec_scc.electric_field_gradient.append(sec_efg)
396
+
397
+ # Indirect Spin-Spin Coupling (isc) parsing
398
+ isc_contributions = {
399
+ 'isc_fc': 'fermi_contact',
400
+ 'isc_orbital_p': 'orbital_paramagnetic',
401
+ 'isc_orbital_d': 'orbital_diamagnetic',
402
+ 'isc_spin': 'spin_dipolar',
403
+ 'isc': 'total',
404
+ }
405
+ for tag, contribution in isc_contributions.items():
406
+ # TODO the data is organized differently to the NOMAD metainfo, we need to transform it properly
407
+ data = magres_data.get(tag, [])
408
+ if np.size(data) != n_atoms**2 * (
409
+ 9 + 4
410
+ ): # 4 extra columns with atom labels
411
+ continue
412
+ values = np.reshape([d[4:] for d in data], (n_atoms, n_atoms, 3, 3))
413
+ values = np.transpose(values, axes=(0, 1, 3, 2))
414
+ atoms = np.array([d[:4] for d in data])
415
+ atoms_1 = atoms[:, 0:2]
416
+ atoms_2 = atoms[:, 2:4]
417
+ sec_isc = SpinSpinCoupling(atoms_1=atoms_1, atoms_2=atoms_2)
418
+ sec_isc.contribution = contribution
419
+ sec_isc.reduced_value = values * 1e19 * ureg('K^2/J')
420
+ sec_scc.spin_spin_coupling.append(sec_isc)
421
+
422
+ # Magnetic Susceptibility (sus) parsing
423
+ data = magres_data.get('sus', [])
424
+ if np.size(data) == 9:
425
+ values = np.transpose(np.reshape(data, (3, 3)))
426
+ sec_sus = MagneticSusceptibility()
427
+ sec_sus.scale_dimension = 'macroscopic'
428
+ sec_sus.value = values * 1e-6 * ureg('dimensionless')
429
+ sec_scc.magnetic_susceptibility.append(sec_sus)
430
+
431
+ # Add Calculation to Run
432
+ sec_run.calculation.append(sec_scc)
433
+
434
+ def parse(self, filepath, archive, logger):
435
+ self.filepath = os.path.abspath(filepath)
436
+ self.archive = archive
437
+ self.logger = logger if logger is not None else logging.getLogger(__name__)
438
+
439
+ self.init_parser()
440
+ self._check_units_magres()
441
+
442
+ # Create Run with Program information
443
+ sec_run = Run()
444
+ calculation_params = self.magres_file_parser.get('calculation')
445
+ program_name = calculation_params.get('code', '')
446
+ if program_name != 'CASTEP':
447
+ self.logger.error(
448
+ 'Only CASTEP-based NMR simulations are supported by the '
449
+ 'magres parser.'
450
+ )
451
+ return
452
+ sec_run.program = Program(
453
+ name=program_name,
454
+ version=calculation_params.get('code_version', ''),
455
+ )
456
+
457
+ # Parse main sections under Run
458
+ self.parse_system(sec_run)
459
+
460
+ self.parse_method(calculation_params, sec_run)
461
+
462
+ self.parse_calculation(sec_run)
463
+
464
+ # Add run to the Archive
465
+ self.archive.run.append(sec_run)
466
+
467
+ # We try to resolve the entry_id and mainfile of other entries in the upload
468
+ filepath_stripped = self.filepath.split('raw/')[-1]
469
+ metadata = []
470
+ try:
471
+ from nomad.app.v1.routers.uploads import get_upload_with_read_access
472
+ from nomad.datamodel import User
473
+
474
+ upload_id = self.archive.metadata.upload_id
475
+ upload = get_upload_with_read_access(
476
+ upload_id=upload_id,
477
+ user=User.get(user_id=self.archive.metadata.main_author.user_id),
478
+ )
479
+ with upload.entries_metadata() as entries_metadata:
480
+ metadata.extend(
481
+ [[meta.entry_id, meta.mainfile] for meta in entries_metadata]
482
+ )
483
+ except Exception:
484
+ self.logger.warning(
485
+ 'Could not resolve the entry_id and mainfile of other entries in the upload.'
486
+ )
487
+ return
488
+
489
+ for entry_id, mainfile in metadata:
490
+ if mainfile == filepath_stripped: # we skip the current parsed mainfile
491
+ continue
492
+ # We try to load the archive from its context and connect both the CASTEP
493
+ # and the magres entries
494
+ try:
495
+ entry_archive = archive.m_context.load_archive(
496
+ entry_id, upload_id, None
497
+ )
498
+ method_label = entry_archive.run[-1].method[-1].label
499
+ if method_label == 'NMR':
500
+ castep_archive = entry_archive
501
+ # We write the workflow NMRMagRes directly in the magres entry
502
+ self.parse_nmr_magres_file_format(castep_archive)
503
+ break
504
+ except Exception:
505
+ continue