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,1922 @@
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 re
21
+ import numpy as np
22
+ from datetime import datetime
23
+ from ase.data import chemical_symbols
24
+
25
+ from nomad.utils import get_logger
26
+ from nomad.units import ureg
27
+ from nomad.parsing.file_parser.text_parser import TextParser, Quantity, DataTextParser
28
+ from runschema.run import Run, Program, TimeRun
29
+ from runschema.method import (
30
+ Method,
31
+ BasisSet,
32
+ BasisSetContainer,
33
+ Electronic,
34
+ Smearing,
35
+ Scf,
36
+ DFT,
37
+ XCFunctional,
38
+ Functional,
39
+ KMesh,
40
+ FrequencyMesh,
41
+ Screening,
42
+ GW,
43
+ )
44
+ from runschema.system import System, Atoms
45
+ from runschema.calculation import (
46
+ Calculation,
47
+ Energy,
48
+ EnergyEntry,
49
+ Forces,
50
+ ForcesEntry,
51
+ Stress,
52
+ StressEntry,
53
+ Dos,
54
+ DosValues,
55
+ BandStructure,
56
+ BandEnergies,
57
+ ScfIteration,
58
+ )
59
+ from simulationworkflowschema import (
60
+ SinglePoint,
61
+ GeometryOptimization,
62
+ GeometryOptimizationMethod,
63
+ MolecularDynamics,
64
+ )
65
+
66
+ from .metainfo.abinit_autogenerated import (
67
+ x_abinit_section_dataset,
68
+ x_abinit_section_input,
69
+ )
70
+ from .metainfo.abinit import (
71
+ x_abinit_screening_dataset,
72
+ x_abinit_chi_q_data,
73
+ x_abinit_mesh,
74
+ x_abinit_gw_dataset,
75
+ x_abinit_ks_band_gaps_params,
76
+ x_abinit_qp_band_gaps_params,
77
+ x_abinit_sigma_params,
78
+ x_abinit_epsilon_inv_params,
79
+ )
80
+ from ..utils import BeyondDFTWorkflowsParser
81
+
82
+ ABINIT_NATIVE_IXC = {
83
+ 0: [{}],
84
+ 1: [{'XC_functional_name': 'LDA_XC_TETER93'}],
85
+ 2: [{'XC_functional_name': 'LDA_X'}, {'XC_functional_name': 'LDA_C_PZ'}],
86
+ # 3 - LDA, old Teter rational polynomial parametrization (4/91)
87
+ 4: [{'XC_functional_name': 'LDA_X'}, {'XC_functional_name': 'LDA_C_WIGNER'}],
88
+ 5: [{'XC_functional_name': 'LDA_X'}, {'XC_functional_name': 'LDA_C_HL'}],
89
+ 6: [{'XC_functional_name': 'LDA_X'}, {'XC_functional_name': 'LDA_C_XALPHA'}],
90
+ 7: [{'XC_functional_name': 'LDA_X'}, {'XC_functional_name': 'LDA_C_PW'}],
91
+ # 8 - x-only part of the Perdew-Wang 92 functional
92
+ # 9 - x- and RPA correlation part of the Perdew-Wang 92 functional
93
+ # 10 - non-existent
94
+ 11: [{'XC_functional_name': 'GGA_X_PBE'}, {'XC_functional_name': 'GGA_C_PBE'}],
95
+ 12: [{'XC_functional_name': 'GGA_X_PBE'}],
96
+ 13: [{'XC_functional_name': 'GGA_X_LB'}, {'XC_functional_name': 'LDA_C_PW'}],
97
+ 14: [{'XC_functional_name': 'GGA_X_PBE_R'}, {'XC_functional_name': '?'}],
98
+ 15: [{'XC_functional_name': 'GGA_X_RPBE'}, {'XC_functional_name': '?'}],
99
+ 16: [{'XC_functional_name': 'GGA_XC_HCTH_93'}],
100
+ 17: [{'XC_functional_name': 'GGA_XC_HCTH_120'}],
101
+ 18: [{'XC_functional_name': 'GGA_X_B88'}, {'XC_functional_name': 'GGA_C_LYP'}],
102
+ 19: [{'XC_functional_name': 'GGA_X_B88'}, {'XC_functional_name': 'GGA_C_P86'}],
103
+ # 20 - Fermi-Amaldi xc ( -1/N Hartree energy, where N is the number of electrons per cell;
104
+ # G=0 is not taken into account however), for TDDFT tests.
105
+ # 21 - same as 20, except that the xc-kernel is the LDA (ixc=1) one, for TDDFT tests.
106
+ # 22 - same as 20, except that the xc-kernel is the Burke-Petersilka-Gross hybrid, for
107
+ # TDDFT tests.
108
+ 23: [{'XC_functional_name': 'GGA_X_WC'}, {'XC_functional_name': '?'}],
109
+ 24: [{'XC_functional_name': 'GGA_X_C09X'}, {'XC_functional_name': '?'}],
110
+ # 25 - non-existent
111
+ 26: [{'XC_functional_name': 'GGA_XC_HCTH_147'}],
112
+ 27: [{'XC_functional_name': 'GGA_XC_HCTH_407'}],
113
+ 28: [{'XC_functional_name': 'GGA_X_OPTX'}, {'XC_functional_name': 'GGA_C_LYP'}],
114
+ 40: [{'XC_functional_name': 'HF_X'}],
115
+ 41: [{'XC_functional_name': 'HYB_GGA_XC_PBEH'}],
116
+ 42: [{'XC_functional_name': 'HYB_GGA_XC_PBE0_13'}],
117
+ }
118
+
119
+ ABINIT_LIBXC_IXC = {
120
+ 1: {'XC_functional_name': 'LDA_X'},
121
+ 2: {'XC_functional_name': 'LDA_C_WIGNER'},
122
+ 3: {'XC_functional_name': 'LDA_C_RPA'},
123
+ 4: {'XC_functional_name': 'LDA_C_HL'},
124
+ 5: {'XC_functional_name': 'LDA_C_GL'},
125
+ 6: {'XC_functional_name': 'LDA_C_XALPHA'},
126
+ 7: {'XC_functional_name': 'LDA_C_VWN'},
127
+ 8: {'XC_functional_name': 'LDA_C_VWN_RPA'},
128
+ 9: {'XC_functional_name': 'LDA_C_PZ'},
129
+ 10: {'XC_functional_name': 'LDA_C_PZ_MOD'},
130
+ 11: {'XC_functional_name': 'LDA_C_OB_PZ'},
131
+ 12: {'XC_functional_name': 'LDA_C_PW'},
132
+ 13: {'XC_functional_name': 'LDA_C_PW_MOD'},
133
+ 14: {'XC_functional_name': 'LDA_C_OB_PW'},
134
+ 15: {'XC_functional_name': 'LDA_C_2D_AMGB'},
135
+ 16: {'XC_functional_name': 'LDA_C_2D_PRM'},
136
+ 17: {'XC_functional_name': 'LDA_C_vBH'},
137
+ 18: {'XC_functional_name': 'LDA_C_1D_CSC'},
138
+ 19: {'XC_functional_name': 'LDA_X_2D'},
139
+ 20: {'XC_functional_name': 'LDA_XC_TETER93'},
140
+ 21: {'XC_functional_name': 'LDA_X_1D'},
141
+ 22: {'XC_functional_name': 'LDA_C_ML1'},
142
+ 23: {'XC_functional_name': 'LDA_C_ML2'},
143
+ 24: {'XC_functional_name': 'LDA_C_GOMBAS'},
144
+ 25: {'XC_functional_name': 'LDA_C_PW_RPA'},
145
+ 26: {'XC_functional_name': 'LDA_C_1D_LOOS'},
146
+ 27: {'XC_functional_name': 'LDA_C_RC04'},
147
+ 28: {'XC_functional_name': 'LDA_C_VWN_1'},
148
+ 29: {'XC_functional_name': 'LDA_C_VWN_2'},
149
+ 30: {'XC_functional_name': 'LDA_C_VWN_3'},
150
+ 31: {'XC_functional_name': 'LDA_C_VWN_4'},
151
+ 32: {'XC_functional_name': 'GGA_X_GAM'},
152
+ 33: {'XC_functional_name': 'GGA_C_GAM'},
153
+ 34: {'XC_functional_name': 'GGA_X_HCTH_A'},
154
+ 35: {'XC_functional_name': 'GGA_X_EV93'},
155
+ 36: {'XC_functional_name': 'HYB_MGGA_X_DLDF'},
156
+ 37: {'XC_functional_name': 'MGGA_C_DLDF'},
157
+ 38: {'XC_functional_name': 'GGA_X_BCGP'},
158
+ 39: {'XC_functional_name': 'GGA_C_BCGP'},
159
+ 40: {'XC_functional_name': 'GGA_X_LAMBDA_OC2_N'},
160
+ 41: {'XC_functional_name': 'GGA_X_B86_R'},
161
+ 42: {'XC_functional_name': 'MGGA_XC_ZLP'},
162
+ 43: {'XC_functional_name': 'LDA_XC_ZLP'},
163
+ 44: {'XC_functional_name': 'GGA_X_LAMBDA_CH_N'},
164
+ 45: {'XC_functional_name': 'GGA_X_LAMBDA_LO_N'},
165
+ 46: {'XC_functional_name': 'GGA_X_HJS_B88_V2'},
166
+ 47: {'XC_functional_name': 'GGA_C_Q2D'},
167
+ 48: {'XC_functional_name': 'GGA_X_Q2D'},
168
+ 49: {'XC_functional_name': 'GGA_X_PBE_MOL'},
169
+ 50: {'XC_functional_name': 'LDA_K_TF'},
170
+ 51: {'XC_functional_name': 'LDA_K_LP'},
171
+ 52: {'XC_functional_name': 'GGA_K_TFVW'},
172
+ 53: {'XC_functional_name': 'GGA_K_REVAPBEINT'},
173
+ 54: {'XC_functional_name': 'GGA_K_APBEINT'},
174
+ 55: {'XC_functional_name': 'GGA_K_REVAPBE'},
175
+ 56: {'XC_functional_name': 'GGA_X_AK13'},
176
+ 57: {'XC_functional_name': 'GGA_K_MEYER'},
177
+ 58: {'XC_functional_name': 'GGA_X_LV_RPW86'},
178
+ 59: {'XC_functional_name': 'GGA_X_PBE_TCA'},
179
+ 60: {'XC_functional_name': 'GGA_X_PBEINT'},
180
+ 61: {'XC_functional_name': 'GGA_C_ZPBEINT'},
181
+ 62: {'XC_functional_name': 'GGA_C_PBEINT'},
182
+ 63: {'XC_functional_name': 'GGA_C_ZPBESOL'},
183
+ 64: {'XC_functional_name': 'MGGA_XC_OTPSS_D'},
184
+ 65: {'XC_functional_name': 'GGA_XC_OPBE_D'},
185
+ 66: {'XC_functional_name': 'GGA_XC_OPWLYP_D'},
186
+ 67: {'XC_functional_name': 'GGA_XC_OBLYP_D'},
187
+ 68: {'XC_functional_name': 'GGA_X_VMT84_GE'},
188
+ 69: {'XC_functional_name': 'GGA_X_VMT84_PBE'},
189
+ 70: {'XC_functional_name': 'GGA_X_VMT_GE'},
190
+ 71: {'XC_functional_name': 'GGA_X_VMT_PBE'},
191
+ 72: {'XC_functional_name': 'MGGA_C_CS'},
192
+ 73: {'XC_functional_name': 'MGGA_C_MN12_SX'},
193
+ 74: {'XC_functional_name': 'MGGA_C_MN12_L'},
194
+ 75: {'XC_functional_name': 'MGGA_C_M11_L'},
195
+ 76: {'XC_functional_name': 'MGGA_C_M11'},
196
+ 77: {'XC_functional_name': 'MGGA_C_M08_SO'},
197
+ 78: {'XC_functional_name': 'MGGA_C_M08_HX'},
198
+ 79: {'XC_functional_name': 'GGA_C_N12_SX'},
199
+ 80: {'XC_functional_name': 'GGA_C_N12'},
200
+ 81: {'XC_functional_name': 'HYB_GGA_X_N12_SX'},
201
+ 82: {'XC_functional_name': 'GGA_X_N12'},
202
+ 83: {'XC_functional_name': 'GGA_C_REGTPSS'},
203
+ 84: {'XC_functional_name': 'GGA_C_OP_XALPHA'},
204
+ 85: {'XC_functional_name': 'GGA_C_OP_G96'},
205
+ 86: {'XC_functional_name': 'GGA_C_OP_PBE'},
206
+ 87: {'XC_functional_name': 'GGA_C_OP_B88'},
207
+ 88: {'XC_functional_name': 'GGA_C_FT97'},
208
+ 89: {'XC_functional_name': 'GGA_C_SPBE'},
209
+ 90: {'XC_functional_name': 'GGA_X_SSB_SW'},
210
+ 91: {'XC_functional_name': 'GGA_X_SSB'},
211
+ 92: {'XC_functional_name': 'GGA_X_SSB_D'},
212
+ 93: {'XC_functional_name': 'GGA_XC_HCTH_407P'},
213
+ 94: {'XC_functional_name': 'GGA_XC_HCTH_P76'},
214
+ 95: {'XC_functional_name': 'GGA_XC_HCTH_P14'},
215
+ 96: {'XC_functional_name': 'GGA_XC_B97_GGA1'},
216
+ 97: {'XC_functional_name': 'GGA_C_HCTH_A'},
217
+ 98: {'XC_functional_name': 'GGA_X_BPCCAC'},
218
+ 99: {'XC_functional_name': 'GGA_C_REVTCA'},
219
+ 100: {'XC_functional_name': 'GGA_C_TCA'},
220
+ 101: {'XC_functional_name': 'GGA_X_PBE'},
221
+ 102: {'XC_functional_name': 'GGA_X_PBE_R'},
222
+ 103: {'XC_functional_name': 'GGA_X_B86'},
223
+ 104: {'XC_functional_name': 'GGA_X_HERMAN'},
224
+ 105: {'XC_functional_name': 'GGA_X_B86_MGC'},
225
+ 106: {'XC_functional_name': 'GGA_X_B88'},
226
+ 107: {'XC_functional_name': 'GGA_X_G96'},
227
+ 108: {'XC_functional_name': 'GGA_X_PW86'},
228
+ 109: {'XC_functional_name': 'GGA_X_PW91'},
229
+ 110: {'XC_functional_name': 'GGA_X_OPTX'},
230
+ 111: {'XC_functional_name': 'GGA_X_DK87_R1'},
231
+ 112: {'XC_functional_name': 'GGA_X_DK87_R2'},
232
+ 113: {'XC_functional_name': 'GGA_X_LG93'},
233
+ 114: {'XC_functional_name': 'GGA_X_FT97_A'},
234
+ 115: {'XC_functional_name': 'GGA_X_FT97_B'},
235
+ 116: {'XC_functional_name': 'GGA_X_PBE_SOL'},
236
+ 117: {'XC_functional_name': 'GGA_X_RPBE'},
237
+ 118: {'XC_functional_name': 'GGA_X_WC'},
238
+ 119: {'XC_functional_name': 'GGA_X_MPW91'},
239
+ 120: {'XC_functional_name': 'GGA_X_AM05'},
240
+ 121: {'XC_functional_name': 'GGA_X_PBEA'},
241
+ 122: {'XC_functional_name': 'GGA_X_MPBE'},
242
+ 123: {'XC_functional_name': 'GGA_X_XPBE'},
243
+ 124: {'XC_functional_name': 'GGA_X_2D_B86_MGC'},
244
+ 125: {'XC_functional_name': 'GGA_X_BAYESIAN'},
245
+ 126: {'XC_functional_name': 'GGA_X_PBE_JSJR'},
246
+ 127: {'XC_functional_name': 'GGA_X_2D_B88'},
247
+ 128: {'XC_functional_name': 'GGA_X_2D_B86'},
248
+ 129: {'XC_functional_name': 'GGA_X_2D_PBE'},
249
+ 130: {'XC_functional_name': 'GGA_C_PBE'},
250
+ 131: {'XC_functional_name': 'GGA_C_LYP'},
251
+ 132: {'XC_functional_name': 'GGA_C_P86'},
252
+ 133: {'XC_functional_name': 'GGA_C_PBE_SOL'},
253
+ 134: {'XC_functional_name': 'GGA_C_PW91'},
254
+ 135: {'XC_functional_name': 'GGA_C_AM05'},
255
+ 136: {'XC_functional_name': 'GGA_C_XPBE'},
256
+ 137: {'XC_functional_name': 'GGA_C_LM'},
257
+ 138: {'XC_functional_name': 'GGA_C_PBE_JRGX'},
258
+ 139: {'XC_functional_name': 'GGA_X_OPTB88_VDW'},
259
+ 140: {'XC_functional_name': 'GGA_X_PBEK1_VDW'},
260
+ 141: {'XC_functional_name': 'GGA_X_OPTPBE_VDW'},
261
+ 142: {'XC_functional_name': 'GGA_X_RGE2'},
262
+ 143: {'XC_functional_name': 'GGA_C_RGE2'},
263
+ 144: {'XC_functional_name': 'GGA_X_RPW86'},
264
+ 145: {'XC_functional_name': 'GGA_X_KT1'},
265
+ 146: {'XC_functional_name': 'GGA_XC_KT2'},
266
+ 147: {'XC_functional_name': 'GGA_C_WL'},
267
+ 148: {'XC_functional_name': 'GGA_C_WI'},
268
+ 149: {'XC_functional_name': 'GGA_X_MB88'},
269
+ 150: {'XC_functional_name': 'GGA_X_SOGGA'},
270
+ 151: {'XC_functional_name': 'GGA_X_SOGGA11'},
271
+ 152: {'XC_functional_name': 'GGA_C_SOGGA11'},
272
+ 153: {'XC_functional_name': 'GGA_C_WI0'},
273
+ 154: {'XC_functional_name': 'GGA_XC_TH1'},
274
+ 155: {'XC_functional_name': 'GGA_XC_TH2'},
275
+ 156: {'XC_functional_name': 'GGA_XC_TH3'},
276
+ 157: {'XC_functional_name': 'GGA_XC_TH4'},
277
+ 158: {'XC_functional_name': 'GGA_X_C09X'},
278
+ 159: {'XC_functional_name': 'GGA_C_SOGGA11_X'},
279
+ 160: {'XC_functional_name': 'GGA_X_LB'},
280
+ 161: {'XC_functional_name': 'GGA_XC_HCTH_93'},
281
+ 162: {'XC_functional_name': 'GGA_XC_HCTH_120'},
282
+ 163: {'XC_functional_name': 'GGA_XC_HCTH_147'},
283
+ 164: {'XC_functional_name': 'GGA_XC_HCTH_407'},
284
+ 165: {'XC_functional_name': 'GGA_XC_EDF1'},
285
+ 166: {'XC_functional_name': 'GGA_XC_XLYP'},
286
+ 167: {'XC_functional_name': 'GGA_X_EB88'},
287
+ 168: {'XC_functional_name': 'GGA_C_PBE_MOL'},
288
+ 169: {'XC_functional_name': 'HYB_GGA_XC_PBE_MOL0'},
289
+ 170: {'XC_functional_name': 'GGA_XC_B97_D'},
290
+ 171: {'XC_functional_name': 'HYB_GGA_XC_PBE_SOL0'},
291
+ 172: {'XC_functional_name': 'HYB_GGA_XC_PBEB0'},
292
+ 173: {'XC_functional_name': 'GGA_XC_PBE1W'},
293
+ 174: {'XC_functional_name': 'GGA_XC_MPWLYP1W'},
294
+ 175: {'XC_functional_name': 'GGA_XC_PBELYP1W'},
295
+ 176: {'XC_functional_name': 'HYB_GGA_XC_PBE_MOLB0'},
296
+ 177: {'XC_functional_name': 'GGA_K_ABSP3'},
297
+ 178: {'XC_functional_name': 'GGA_K_ABSP4'},
298
+ 182: {'XC_functional_name': 'GGA_X_LBM'},
299
+ 183: {'XC_functional_name': 'GGA_X_OL2'},
300
+ 184: {'XC_functional_name': 'GGA_X_APBE'},
301
+ 185: {'XC_functional_name': 'GGA_K_APBE'},
302
+ 186: {'XC_functional_name': 'GGA_C_APBE'},
303
+ 187: {'XC_functional_name': 'GGA_K_TW1'},
304
+ 188: {'XC_functional_name': 'GGA_K_TW2'},
305
+ 189: {'XC_functional_name': 'GGA_K_TW3'},
306
+ 190: {'XC_functional_name': 'GGA_K_TW4'},
307
+ 191: {'XC_functional_name': 'GGA_X_HTBS'},
308
+ 192: {'XC_functional_name': 'GGA_X_AIRY'},
309
+ 193: {'XC_functional_name': 'GGA_X_LAG'},
310
+ 194: {'XC_functional_name': 'GGA_XC_MOHLYP'},
311
+ 195: {'XC_functional_name': 'GGA_XC_MOHLYP2'},
312
+ 196: {'XC_functional_name': 'GGA_XC_TH_FL'},
313
+ 197: {'XC_functional_name': 'GGA_XC_TH_FC'},
314
+ 198: {'XC_functional_name': 'GGA_XC_TH_FCFO'},
315
+ 199: {'XC_functional_name': 'GGA_XC_TH_FCO'},
316
+ 200: {'XC_functional_name': 'GGA_C_OPTC'},
317
+ 201: {'XC_functional_name': 'MGGA_X_LTA'},
318
+ 202: {'XC_functional_name': 'MGGA_X_TPSS'},
319
+ 203: {'XC_functional_name': 'MGGA_X_M06_L'},
320
+ 204: {'XC_functional_name': 'MGGA_X_GVT4'},
321
+ 205: {'XC_functional_name': 'MGGA_X_TAU_HCTH'},
322
+ 206: {'XC_functional_name': 'MGGA_X_BR89'},
323
+ 207: {'XC_functional_name': 'MGGA_X_BJ06'},
324
+ 208: {'XC_functional_name': 'MGGA_X_TB09'},
325
+ 209: {'XC_functional_name': 'MGGA_X_RPP09'},
326
+ 210: {'XC_functional_name': 'MGGA_X_2D_PRHG07'},
327
+ 211: {'XC_functional_name': 'MGGA_X_2D_PRHG07_PRP10'},
328
+ 212: {'XC_functional_name': 'MGGA_X_REVTPSS'},
329
+ 213: {'XC_functional_name': 'MGGA_X_PKZB'},
330
+ 214: {'XC_functional_name': 'MGGA_X_M05'},
331
+ 215: {'XC_functional_name': 'MGGA_X_M05_2X'},
332
+ 216: {'XC_functional_name': 'MGGA_X_M06_HF'},
333
+ 217: {'XC_functional_name': 'MGGA_X_M06'},
334
+ 218: {'XC_functional_name': 'MGGA_X_M06_2X'},
335
+ 219: {'XC_functional_name': 'MGGA_X_M08_HX'},
336
+ 220: {'XC_functional_name': 'MGGA_X_M08_SO'},
337
+ 221: {'XC_functional_name': 'MGGA_X_MS0'},
338
+ 222: {'XC_functional_name': 'MGGA_X_MS1'},
339
+ 223: {'XC_functional_name': 'MGGA_X_MS2'},
340
+ 224: {'XC_functional_name': 'HYB_MGGA_X_MS2H'},
341
+ 225: {'XC_functional_name': 'MGGA_X_M11'},
342
+ 226: {'XC_functional_name': 'MGGA_X_M11_L'},
343
+ 227: {'XC_functional_name': 'MGGA_X_MN12_L'},
344
+ 229: {'XC_functional_name': 'MGGA_C_CC06'},
345
+ 230: {'XC_functional_name': 'MGGA_X_MK00'},
346
+ 231: {'XC_functional_name': 'MGGA_C_TPSS'},
347
+ 232: {'XC_functional_name': 'MGGA_C_VSXC'},
348
+ 233: {'XC_functional_name': 'MGGA_C_M06_L'},
349
+ 234: {'XC_functional_name': 'MGGA_C_M06_HF'},
350
+ 235: {'XC_functional_name': 'MGGA_C_M06'},
351
+ 236: {'XC_functional_name': 'MGGA_C_M06_2X'},
352
+ 237: {'XC_functional_name': 'MGGA_C_M05'},
353
+ 238: {'XC_functional_name': 'MGGA_C_M05_2X'},
354
+ 239: {'XC_functional_name': 'MGGA_C_PKZB'},
355
+ 240: {'XC_functional_name': 'MGGA_C_BC95'},
356
+ 241: {'XC_functional_name': 'MGGA_C_REVTPSS'},
357
+ 242: {'XC_functional_name': 'MGGA_XC_TPSSLYP1W'},
358
+ 243: {'XC_functional_name': 'MGGA_X_MK00B'},
359
+ 244: {'XC_functional_name': 'MGGA_X_BLOC'},
360
+ 245: {'XC_functional_name': 'MGGA_X_MODTPSS'},
361
+ 246: {'XC_functional_name': 'GGA_C_PBELOC'},
362
+ 247: {'XC_functional_name': 'MGGA_C_TPSSLOC'},
363
+ 248: {'XC_functional_name': 'HYB_MGGA_X_MN12_SX'},
364
+ 249: {'XC_functional_name': 'MGGA_X_MBEEF'},
365
+ 250: {'XC_functional_name': 'MGGA_X_MBEEFVDW'},
366
+ 254: {'XC_functional_name': 'MGGA_XC_B97M_V'},
367
+ 255: {'XC_functional_name': 'GGA_XC_VV10'},
368
+ 257: {'XC_functional_name': 'MGGA_X_MVS'},
369
+ 258: {'XC_functional_name': 'GGA_C_PBEFE'},
370
+ 259: {'XC_functional_name': 'LDA_XC_KSDT'},
371
+ 260: {'XC_functional_name': 'MGGA_X_MN15_L'},
372
+ 261: {'XC_functional_name': 'MGGA_C_MN15_L'},
373
+ 262: {'XC_functional_name': 'GGA_C_OP_PW91'},
374
+ 263: {'XC_functional_name': 'MGGA_X_SCAN'},
375
+ 264: {'XC_functional_name': 'HYB_MGGA_X_SCAN0'},
376
+ 265: {'XC_functional_name': 'GGA_X_PBEFE'},
377
+ 266: {'XC_functional_name': 'HYB_GGA_XC_B97_1p'},
378
+ 267: {'XC_functional_name': 'MGGA_C_SCAN'},
379
+ 268: {'XC_functional_name': 'HYB_MGGA_X_MN15'},
380
+ 269: {'XC_functional_name': 'MGGA_C_MN15'},
381
+ 270: {'XC_functional_name': 'GGA_X_CAP'},
382
+ 401: {'XC_functional_name': 'HYB_GGA_XC_B3PW91'},
383
+ 402: {'XC_functional_name': 'HYB_GGA_XC_B3LYP'},
384
+ 403: {'XC_functional_name': 'HYB_GGA_XC_B3P86'},
385
+ 404: {'XC_functional_name': 'HYB_GGA_XC_O3LYP'},
386
+ 405: {'XC_functional_name': 'HYB_GGA_XC_mPW1K'},
387
+ 406: {'XC_functional_name': 'HYB_GGA_XC_PBEH'},
388
+ 407: {'XC_functional_name': 'HYB_GGA_XC_B97'},
389
+ 408: {'XC_functional_name': 'HYB_GGA_XC_B97_1'},
390
+ 410: {'XC_functional_name': 'HYB_GGA_XC_B97_2'},
391
+ 411: {'XC_functional_name': 'HYB_GGA_XC_X3LYP'},
392
+ 412: {'XC_functional_name': 'HYB_GGA_XC_B1WC'},
393
+ 413: {'XC_functional_name': 'HYB_GGA_XC_B97_K'},
394
+ 414: {'XC_functional_name': 'HYB_GGA_XC_B97_3'},
395
+ 415: {'XC_functional_name': 'HYB_GGA_XC_MPW3PW'},
396
+ 416: {'XC_functional_name': 'HYB_GGA_XC_B1LYP'},
397
+ 417: {'XC_functional_name': 'HYB_GGA_XC_B1PW91'},
398
+ 418: {'XC_functional_name': 'HYB_GGA_XC_mPW1PW'},
399
+ 419: {'XC_functional_name': 'HYB_GGA_XC_MPW3LYP'},
400
+ 420: {'XC_functional_name': 'HYB_GGA_XC_SB98_1a'},
401
+ 421: {'XC_functional_name': 'HYB_GGA_XC_SB98_1b'},
402
+ 422: {'XC_functional_name': 'HYB_GGA_XC_SB98_1c'},
403
+ 423: {'XC_functional_name': 'HYB_GGA_XC_SB98_2a'},
404
+ 424: {'XC_functional_name': 'HYB_GGA_XC_SB98_2b'},
405
+ 425: {'XC_functional_name': 'HYB_GGA_XC_SB98_2c'},
406
+ 426: {'XC_functional_name': 'HYB_GGA_X_SOGGA11_X'},
407
+ 427: {'XC_functional_name': 'HYB_GGA_XC_HSE03'},
408
+ 428: {'XC_functional_name': 'HYB_GGA_XC_HSE06'},
409
+ 429: {'XC_functional_name': 'HYB_GGA_XC_HJS_PBE'},
410
+ 430: {'XC_functional_name': 'HYB_GGA_XC_HJS_PBE_SOL'},
411
+ 431: {'XC_functional_name': 'HYB_GGA_XC_HJS_B88'},
412
+ 432: {'XC_functional_name': 'HYB_GGA_XC_HJS_B97X'},
413
+ 433: {'XC_functional_name': 'HYB_GGA_XC_CAM_B3LYP'},
414
+ 434: {'XC_functional_name': 'HYB_GGA_XC_TUNED_CAM_B3LYP'},
415
+ 435: {'XC_functional_name': 'HYB_GGA_XC_BHANDH'},
416
+ 436: {'XC_functional_name': 'HYB_GGA_XC_BHANDHLYP'},
417
+ 437: {'XC_functional_name': 'HYB_GGA_XC_MB3LYP_RC04'},
418
+ 438: {'XC_functional_name': 'HYB_MGGA_XC_M05'},
419
+ 439: {'XC_functional_name': 'HYB_MGGA_XC_M05_2X'},
420
+ 440: {'XC_functional_name': 'HYB_MGGA_XC_B88B95'},
421
+ 441: {'XC_functional_name': 'HYB_MGGA_XC_B86B95'},
422
+ 442: {'XC_functional_name': 'HYB_MGGA_XC_PW86B95'},
423
+ 443: {'XC_functional_name': 'HYB_MGGA_XC_BB1K'},
424
+ 444: {'XC_functional_name': 'HYB_MGGA_XC_M06_HF'},
425
+ 445: {'XC_functional_name': 'HYB_MGGA_XC_MPW1B95'},
426
+ 446: {'XC_functional_name': 'HYB_MGGA_XC_MPWB1K'},
427
+ 447: {'XC_functional_name': 'HYB_MGGA_XC_X1B95'},
428
+ 448: {'XC_functional_name': 'HYB_MGGA_XC_XB1K'},
429
+ 449: {'XC_functional_name': 'HYB_MGGA_XC_M06'},
430
+ 450: {'XC_functional_name': 'HYB_MGGA_XC_M06_2X'},
431
+ 451: {'XC_functional_name': 'HYB_MGGA_XC_PW6B95'},
432
+ 452: {'XC_functional_name': 'HYB_MGGA_XC_PWB6K'},
433
+ 453: {'XC_functional_name': 'HYB_GGA_XC_MPWLYP1M'},
434
+ 454: {'XC_functional_name': 'HYB_GGA_XC_REVB3LYP'},
435
+ 455: {'XC_functional_name': 'HYB_GGA_XC_CAMY_BLYP'},
436
+ 456: {'XC_functional_name': 'HYB_GGA_XC_PBE0_13'},
437
+ 457: {'XC_functional_name': 'HYB_MGGA_XC_TPSSH'},
438
+ 458: {'XC_functional_name': 'HYB_MGGA_XC_REVTPSSH'},
439
+ 459: {'XC_functional_name': 'HYB_GGA_XC_B3LYPs'},
440
+ 460: {'XC_functional_name': 'HYB_MGGA_XC_M08_HX'},
441
+ 461: {'XC_functional_name': 'HYB_MGGA_XC_M08_SO'},
442
+ 462: {'XC_functional_name': 'HYB_MGGA_XC_M11'},
443
+ 463: {'XC_functional_name': 'HYB_GGA_XC_WB97'},
444
+ 464: {'XC_functional_name': 'HYB_GGA_XC_WB97X'},
445
+ 465: {'XC_functional_name': 'HYB_GGA_XC_LRC_WPBEH'},
446
+ 466: {'XC_functional_name': 'HYB_GGA_XC_WB97X_V'},
447
+ 467: {'XC_functional_name': 'HYB_GGA_XC_LCY_PBE'},
448
+ 468: {'XC_functional_name': 'HYB_GGA_XC_LCY_BLYP'},
449
+ 469: {'XC_functional_name': 'HYB_GGA_XC_LC_VV10'},
450
+ 470: {'XC_functional_name': 'HYB_GGA_XC_CAMY_B3LYP'},
451
+ 471: {'XC_functional_name': 'HYB_GGA_XC_WB97X_D'},
452
+ 472: {'XC_functional_name': 'HYB_GGA_XC_HPBEINT'},
453
+ 473: {'XC_functional_name': 'HYB_GGA_XC_LRC_WPBE'},
454
+ 474: {'XC_functional_name': 'HYB_MGGA_X_MVSH'},
455
+ 475: {'XC_functional_name': 'HYB_GGA_XC_B3LYP5'},
456
+ 476: {'XC_functional_name': 'HYB_GGA_XC_EDF2'},
457
+ 477: {'XC_functional_name': 'HYB_GGA_XC_CAP0'},
458
+ 478: {'XC_functional_name': 'HYB_GGA_XC_LC_WPBE'},
459
+ 500: {'XC_functional_name': 'GGA_K_VW'},
460
+ 501: {'XC_functional_name': 'GGA_K_GE2'},
461
+ 502: {'XC_functional_name': 'GGA_K_GOLDEN'},
462
+ 503: {'XC_functional_name': 'GGA_K_YT65'},
463
+ 504: {'XC_functional_name': 'GGA_K_BALTIN'},
464
+ 505: {'XC_functional_name': 'GGA_K_LIEB'},
465
+ 506: {'XC_functional_name': 'GGA_K_ABSP1'},
466
+ 507: {'XC_functional_name': 'GGA_K_ABSP2'},
467
+ 508: {'XC_functional_name': 'GGA_K_GR'},
468
+ 509: {'XC_functional_name': 'GGA_K_LUDENA'},
469
+ 510: {'XC_functional_name': 'GGA_K_GP85'},
470
+ 511: {'XC_functional_name': 'GGA_K_PEARSON'},
471
+ 512: {'XC_functional_name': 'GGA_K_OL1'},
472
+ 513: {'XC_functional_name': 'GGA_K_OL2'},
473
+ 514: {'XC_functional_name': 'GGA_K_FR_B88'},
474
+ 515: {'XC_functional_name': 'GGA_K_FR_PW86'},
475
+ 516: {'XC_functional_name': 'GGA_K_DK'},
476
+ 517: {'XC_functional_name': 'GGA_K_PERDEW'},
477
+ 518: {'XC_functional_name': 'GGA_K_VSK'},
478
+ 519: {'XC_functional_name': 'GGA_K_VJKS'},
479
+ 520: {'XC_functional_name': 'GGA_K_ERNZERHOF'},
480
+ 521: {'XC_functional_name': 'GGA_K_LC94'},
481
+ 522: {'XC_functional_name': 'GGA_K_LLP'},
482
+ 523: {'XC_functional_name': 'GGA_K_THAKKAR'},
483
+ 524: {'XC_functional_name': 'GGA_X_WPBEH'},
484
+ 525: {'XC_functional_name': 'GGA_X_HJS_PBE'},
485
+ 526: {'XC_functional_name': 'GGA_X_HJS_PBE_SOL'},
486
+ 527: {'XC_functional_name': 'GGA_X_HJS_B88'},
487
+ 528: {'XC_functional_name': 'GGA_X_HJS_B97X'},
488
+ 529: {'XC_functional_name': 'GGA_X_ITYH'},
489
+ 530: {'XC_functional_name': 'GGA_X_SFAT'},
490
+ 531: {'XC_functional_name': 'HYB_MGGA_XC_WB97M_V'},
491
+ }
492
+
493
+
494
+ re_float = r'([\d\.E\+\-]+)'
495
+ re_n = r'[\n\r]'
496
+
497
+
498
+ class AbinitOutParser(TextParser):
499
+ def __init__(self):
500
+ self.energy_components = {
501
+ 'energy_kinetic_electronic': 'Kinetic energy',
502
+ 'energy_electronstatic': 'Hartree energy',
503
+ 'energy_XC': 'XC energy',
504
+ 'ewald': 'Ewald energy',
505
+ 'psp_core': 'PspCore energy',
506
+ 'psp_local': 'Loc. psp. energy',
507
+ 'psp_nonlocal': 'NL psp energy',
508
+ 'internal': '>>>>> Internal E',
509
+ 'energy_correction_entropy': r'\-kT*entropy',
510
+ 'energy_total': ' >>>>>>>>> Etotal',
511
+ 'energy_sum_eigenvalues': r'Band energy \(Ha\)',
512
+ }
513
+ self._input_vars = None
514
+ self._dataset_numbers = None
515
+ self._n_datasets = None
516
+ super().__init__(None)
517
+
518
+ def init_quantities(self):
519
+ self._quantities = [
520
+ Quantity(
521
+ 'program_version',
522
+ r'\.Version ([\w\.]+) of ABINIT',
523
+ repeats=False,
524
+ convert=False,
525
+ flatten=False,
526
+ ),
527
+ Quantity(
528
+ 'x_abinit_parallel_compilation',
529
+ r'\.\((\w+) version,',
530
+ repeats=False,
531
+ convert=False,
532
+ flatten=False,
533
+ ),
534
+ Quantity(
535
+ 'program_compilation_host',
536
+ r'prepared for a ([\w\.]+) computer',
537
+ repeats=False,
538
+ convert=False,
539
+ flatten=False,
540
+ ),
541
+ Quantity(
542
+ 'x_abinit_start_date',
543
+ r'\.Starting date : ([\w ]+)\.',
544
+ repeats=False,
545
+ convert=False,
546
+ flatten=False,
547
+ ),
548
+ Quantity(
549
+ 'x_abinit_start_time',
550
+ r'\- \( at (\w+) \)',
551
+ repeats=False,
552
+ convert=False,
553
+ flatten=False,
554
+ ),
555
+ Quantity(
556
+ 'x_abinit_input_file',
557
+ r'\- input\s*file\s*\-\> ([\w\.]+)',
558
+ repeats=False,
559
+ convert=False,
560
+ flatten=False,
561
+ ),
562
+ Quantity(
563
+ 'x_abinit_output_file',
564
+ r'\- output\s*file\s*\-\> ([\w\.]+)',
565
+ repeats=False,
566
+ convert=False,
567
+ flatten=False,
568
+ ),
569
+ Quantity(
570
+ 'x_abinit_input_files_root',
571
+ r'\- root for input\s*files \-\> (\w+)',
572
+ repeats=False,
573
+ convert=False,
574
+ flatten=False,
575
+ ),
576
+ Quantity(
577
+ 'x_abinit_output_files_root',
578
+ r'\- root for output\s*files \-\> (\w+)',
579
+ repeats=False,
580
+ convert=False,
581
+ flatten=False,
582
+ ),
583
+ Quantity(
584
+ 'x_abinit_total_cpu_time',
585
+ r'\-\s*Total cpu\s*time\s*\(s,m,h\):\s*([\d\.]+)',
586
+ dtype=float,
587
+ ),
588
+ Quantity(
589
+ 'x_abinit_total_wallclock_time',
590
+ r'\-\s*Total wall clock time\s*\(s,m,h\):\s*([\d\.]+)',
591
+ dtype=float,
592
+ ),
593
+ Quantity(
594
+ 'run_clean_end',
595
+ r'(Calculation completed)',
596
+ repeats=False,
597
+ convert=False,
598
+ flatten=False,
599
+ ),
600
+ ]
601
+
602
+ self._quantities.append(
603
+ Quantity(
604
+ 'input_variables',
605
+ r'\-outvars: echo values of preprocessed input variables \-+([\s\S]+?)\={10}',
606
+ repeats=False,
607
+ sub_parser=TextParser(
608
+ quantities=[
609
+ Quantity(
610
+ 'key_value',
611
+ r'([a-zA-Z\d]+)\s*([\d\.\+\-E\s]+)',
612
+ repeats=True,
613
+ )
614
+ ]
615
+ ),
616
+ )
617
+ )
618
+
619
+ def str_to_array(val_in):
620
+ val = val_in.strip().split('\n')
621
+ val = [v.split()[-3:] for v in val]
622
+ return np.array(val, dtype=float)
623
+
624
+ def str_to_stress_tensor(val_in):
625
+ val = np.array(val_in.split(), dtype=float)
626
+ stress_tensor = np.zeros((3, 3))
627
+ stress_tensor[0][0] = val[0]
628
+ stress_tensor[2][1] = stress_tensor[1][2] = val[1]
629
+ stress_tensor[1][1] = val[2]
630
+ stress_tensor[2][0] = stress_tensor[0][2] = val[3]
631
+ stress_tensor[2][2] = val[4]
632
+ stress_tensor[1][0] = stress_tensor[0][1] = val[5]
633
+ return stress_tensor * (ureg.hartree / ureg.bohr**3)
634
+
635
+ def str_to_eigenvalues(val_in):
636
+ return [float(v) for v in val_in.split() if v[-1].isdecimal()]
637
+
638
+ self_consistent = [
639
+ Quantity(
640
+ 'energy_total_scf_iteration',
641
+ r'ETOT\s*\d+\s*([\+\-\d\.Ee ]+)\n',
642
+ repeats=True,
643
+ dtype=float,
644
+ ),
645
+ Quantity(
646
+ 'convergence',
647
+ r'At SCF step\s*([0-9]+)\s*'
648
+ r', etot|, forces|vres2\s*=\s*[\-\+\d\.Ee]+?\s*<\s*tolvrs=\s*[\-\+\d\.Ee]+?\s*=>\s*'
649
+ r'([\w ]+)',
650
+ repeats=False,
651
+ ),
652
+ ]
653
+
654
+ relaxation = [
655
+ Quantity(
656
+ 'stress_tensor',
657
+ r'Cartesian components of stress tensor \(hartree/bohr\^3\)\s*'
658
+ r'sigma\(\d \d\)\s*=\s*([\-\+\d\.Ee]+)\s*'
659
+ r'sigma\(\d \d\)\s*=\s*([\-\+\d\.Ee]+)\s*'
660
+ r'sigma\(\d \d\)\s*=\s*([\-\+\d\.Ee]+)\s*'
661
+ r'sigma\(\d \d\)\s*=\s*([\-\+\d\.Ee]+)\s*'
662
+ r'sigma\(\d \d\)\s*=\s*([\-\+\d\.Ee]+)\s*'
663
+ r'sigma\(\d \d\)\s*=\s*([\-\+\d\.Ee]+)\s*',
664
+ repeats=False,
665
+ str_operation=str_to_stress_tensor,
666
+ convert=False,
667
+ ),
668
+ Quantity(
669
+ 'self_consistent',
670
+ r'SELF\-CONSISTENT\-FIELD CONVERGENCE\-*\s*(iter\s*Etot[\s\S]+?)\-*OUTPUT',
671
+ sub_parser=TextParser(quantities=self_consistent),
672
+ repeats=False,
673
+ ),
674
+ Quantity(
675
+ 'cartesian_coordinates',
676
+ r'Cartesian coordinates \(xcart\) \[bohr\]\s*([\s\d\.Ee\+\-]+)',
677
+ repeats=False,
678
+ str_operation=str_to_array,
679
+ convert=False,
680
+ unit=ureg.bohr,
681
+ ),
682
+ Quantity(
683
+ 'cartesian_forces',
684
+ r'Cartesian forces \(fcart\)[\s\S]+?\(free atoms\)\s*([\s\d\.Ee\+\-]+)',
685
+ repeats=False,
686
+ str_operation=str_to_array,
687
+ convert=False,
688
+ unit=ureg.hartree / ureg.bohr,
689
+ ),
690
+ Quantity(
691
+ 'energy_total',
692
+ r'Total energy \(etotal\) \[Ha\]=\s*([\-\+\d\.Ee]+)',
693
+ repeats=False,
694
+ dtype=float,
695
+ unit=ureg.hartree,
696
+ ),
697
+ ]
698
+
699
+ energy_components = [
700
+ Quantity(
701
+ key,
702
+ rf'\s*{val}\s*=\s*([\d\.E\-\+]+)',
703
+ repeats=False,
704
+ dtype=float,
705
+ unit=ureg.hartree,
706
+ )
707
+ for key, val in self.energy_components.items()
708
+ ]
709
+
710
+ results = [
711
+ Quantity(
712
+ 'cartesian_coordinates',
713
+ r'\s*cartesian coordinates \(angstrom\) at end:\s*([\s\d\.Ee\+\-]+)',
714
+ repeats=False,
715
+ str_operation=str_to_array,
716
+ convert=False,
717
+ unit=ureg.angstrom,
718
+ ),
719
+ Quantity(
720
+ 'cartesian_forces',
721
+ r'\s*cartesian forces \(hartree/bohr\) at end\:\s*([\s\d\.Ee\+\-]+)',
722
+ repeats=False,
723
+ str_operation=str_to_array,
724
+ convert=False,
725
+ unit=ureg.hartree / ureg.bohr,
726
+ ),
727
+ Quantity(
728
+ 'x_abinit_eig_filename',
729
+ r'\s*prteigrs : about to open file\s*(\S+)',
730
+ repeats=False,
731
+ convert=False,
732
+ ),
733
+ Quantity(
734
+ 'fermi_energy',
735
+ r'\s*Fermi \(or HOMO\) energy \(hartree\) =\s*([-+0-9.]+)',
736
+ repeats=False,
737
+ dtype=float,
738
+ unit=ureg.hartree,
739
+ ),
740
+ Quantity(
741
+ 'x_abinit_magnetisation',
742
+ r'\s*Magnetisation \(Bohr magneton\)=\s*([-+0-9.eEdD]*)\s*',
743
+ repeats=False,
744
+ dtype=float,
745
+ unit=ureg.bohr_magneton,
746
+ ),
747
+ Quantity(
748
+ 'eigenvalues',
749
+ r'\s*kpt#\s*(\d+), nband=\s*(\d+), wtk=\s*([\d\.]+)\s*, '
750
+ r'kpt=([\d\.\-\+Ee ]+)\s*\(reduced coord\)\s*([\d\.\-\+Ee\s]+)',
751
+ repeats=True,
752
+ str_operation=str_to_eigenvalues,
753
+ convert=False,
754
+ ),
755
+ Quantity(
756
+ 'occupation_numbers',
757
+ r'\s*occupation numbers for kpt#\s*\d+\s*([\d\.\-\+Ee ]+)',
758
+ repeats=True,
759
+ dtype=float,
760
+ ),
761
+ Quantity(
762
+ 'energy_total',
763
+ r'Total energy\(eV\)=\s*([\d\.\-\+Ee]+)\s*;',
764
+ repeats=False,
765
+ dtype=float,
766
+ unit=ureg.eV,
767
+ ),
768
+ Quantity(
769
+ 'stress_tensor',
770
+ r'Cartesian components of stress tensor \(hartree/bohr\^3\)\s*'
771
+ r'sigma\(\d \d\)\s*=\s*([\-\+\d\.Ee]+)\s*'
772
+ r'sigma\(\d \d\)\s*=\s*([\-\+\d\.Ee]+)\s*'
773
+ r'sigma\(\d \d\)\s*=\s*([\-\+\d\.Ee]+)\s*'
774
+ r'sigma\(\d \d\)\s*=\s*([\-\+\d\.Ee]+)\s*'
775
+ r'sigma\(\d \d\)\s*=\s*([\-\+\d\.Ee]+)\s*'
776
+ r'sigma\(\d \d\)\s*=\s*([\-\+\d\.Ee]+)\s*',
777
+ repeats=False,
778
+ str_operation=str_to_stress_tensor,
779
+ convert=False,
780
+ ),
781
+ ] + energy_components
782
+
783
+ self._quantities.append(
784
+ Quantity(
785
+ 'dataset',
786
+ r'==\s*(DATASET\s*\d+\s*==[\s\S]+?)(?:\-Cartesian components of stress tensor \(GPa\)|\s*prteigrs\s*\:\s*prtvol\=[\w\s\,\-\.\n]*===|\s*Average fulfillment[\s\w\[\]\-\:\.\%]*===|== END DATASET)',
787
+ repeats=True,
788
+ sub_parser=TextParser(
789
+ quantities=[
790
+ Quantity(
791
+ 'x_abinit_dataset_number',
792
+ r'DATASET\s*(\d+)',
793
+ dtype=int,
794
+ repeats=False,
795
+ ),
796
+ Quantity(
797
+ 'x_abinit_var_ixc',
798
+ r'\-\s*ixc\s*=\s*([\d\-]+)',
799
+ dtype=int,
800
+ repeats=False,
801
+ ),
802
+ Quantity(
803
+ 'x_abinit_vprim',
804
+ r'R\(\d\)=\s*(\-*[\d\.]+)\s*(\-*[\d\.]+)\s*(\-*[\d\.]+)\s*G\(\d\)=',
805
+ repeats=True,
806
+ dtype=float,
807
+ ),
808
+ Quantity(
809
+ 'x_abinit_unit_cell_volume',
810
+ r'Unit cell volume ucvol\s*=\s*([\d\.\+Ee]+)',
811
+ dtype=float,
812
+ unit=ureg.bohr**3,
813
+ ),
814
+ Quantity(
815
+ 'self_consistent',
816
+ r'\={10}\s*(iter\s*Etot[\s\S]+?)\={10}',
817
+ repeats=False,
818
+ sub_parser=TextParser(quantities=self_consistent),
819
+ ),
820
+ Quantity(
821
+ 'relaxation',
822
+ r'\-\-\- Iteration: \( \d+\/\d+\)([\s\S]+?Total energy \(etotal\) \[Ha\]=\s*[\-\+\d\.Ee]+)',
823
+ repeats=True,
824
+ sub_parser=TextParser(quantities=relaxation),
825
+ ),
826
+ Quantity(
827
+ 'results',
828
+ r'\-+iterations are completed or convergence reached\-+([\s\S]+)'
829
+ r'(?:(sigma\(\d \d\)\s*=\s*[\+\-\d\.E]+)|={80})',
830
+ repeats=False,
831
+ sub_parser=TextParser(quantities=results),
832
+ ),
833
+ ]
834
+ ),
835
+ )
836
+ )
837
+
838
+ rpa_quantities = [
839
+ Quantity(
840
+ 'precision_algorithm',
841
+ rf'{re_n}\.Using[a-zA-Z\s\;]+\=\s*(\d+)',
842
+ repeats=False,
843
+ ),
844
+ Quantity(
845
+ 'kmesh',
846
+ rf'{re_n}(\s*====\s*K-mesh[a-zA-Z\s]*wavefunctions[\s\S]+?)(?:\s*====\s*Q-mesh)',
847
+ repeats=False,
848
+ sub_parser=TextParser(
849
+ quantities=[
850
+ Quantity(
851
+ 'n_mesh',
852
+ rf'{re_n}\s*Number of points in the irreducible wedge\s*\:\s*(\d+)',
853
+ repeats=False,
854
+ ),
855
+ Quantity(
856
+ 'mesh',
857
+ rf'{re_n}[\d\)\s]+{re_float}\s*{re_float}\s*{re_float}\s*{re_float}',
858
+ repeats=True,
859
+ ),
860
+ ]
861
+ ),
862
+ ),
863
+ Quantity(
864
+ 'qmesh',
865
+ rf'{re_n}(\s*====\s*Q-mesh[a-zA-Z\s]*screening function[\s\S]+?)(?:\s*setmesh\:)',
866
+ repeats=False,
867
+ sub_parser=TextParser(
868
+ quantities=[
869
+ Quantity(
870
+ 'n_mesh',
871
+ rf'{re_n}\s*Number of points in the irreducible wedge\s*\:\s*(\d+)',
872
+ repeats=False,
873
+ ),
874
+ Quantity(
875
+ 'mesh',
876
+ rf'{re_n}[\d\)\s]+{re_float}\s*{re_float}\s*{re_float}\s*{re_float}',
877
+ repeats=True,
878
+ ),
879
+ ]
880
+ ),
881
+ ),
882
+ Quantity(
883
+ 'fftmesh',
884
+ r'FFT mesh size selected[\s\=]*(\d+)x\s*(\d+)x\s*(\d+)',
885
+ repeats=False,
886
+ ),
887
+ Quantity('n_fftmesh', r'total number of points[\s\=]*(\d+)', repeats=False),
888
+ Quantity(
889
+ 'symm_screening',
890
+ rf'{re_n}\- screening\:([a-zA-Z\-\s]+){re_n}',
891
+ repeats=False,
892
+ ),
893
+ Quantity(
894
+ 'max_band_occ',
895
+ rf'{re_n}\- Maximum band index for partially occupied states[a-zA-Z\s]+\=\s*(\d+)',
896
+ repeats=False,
897
+ ),
898
+ Quantity(
899
+ 'n_bands_per_proc',
900
+ rf'{re_n}\- Remaining bands to be divided among processors[a-zA-Z\s]+\=\s*(\d+)',
901
+ repeats=False,
902
+ ),
903
+ Quantity(
904
+ 'n_bands_per_node',
905
+ rf'{re_n}\- Number of bands treated by each node[a-zA-Z\s]+\~(\d+)',
906
+ repeats=False,
907
+ ),
908
+ Quantity(
909
+ 'n_electrons',
910
+ rf'{re_n}\s*Number of electrons calculated from density\s*\=\s*{re_float}'
911
+ rf'\;\s*Expected\s*\=\s*{re_float}'
912
+ rf'{re_n}\s*average of density\,\s*n\s*\=\s*{re_float}',
913
+ repeats=False,
914
+ ),
915
+ Quantity(
916
+ 'wigner_seitz_radius', rf'{re_n}\s*r_s\s*\=\s*{re_float}', repeats=False
917
+ ),
918
+ Quantity(
919
+ 'omega_plasma',
920
+ rf'{re_n}\s*omega_plasma\s*\=\s*{re_float}\s*\[(?P<__unit>\w+)\]',
921
+ repeats=False,
922
+ ),
923
+ ]
924
+
925
+ screening_quantities = rpa_quantities + [
926
+ Quantity(
927
+ 'frequencies',
928
+ rf'{re_n}\s*(calculating chi0 at frequencies \[[a-zA-Z]+\]\s*\:[\s\S]+?)(?:\-*{re_n}\s*q-point number\s*1)',
929
+ sub_parser=TextParser(
930
+ quantities=[
931
+ Quantity(
932
+ 'values',
933
+ rf'{re_n}\s*\d*\s*{re_float}\s*{re_float}',
934
+ repeats=True,
935
+ )
936
+ ]
937
+ ),
938
+ ),
939
+ Quantity(
940
+ 'static_diel_const',
941
+ rf'{re_n}\s*dielectric constant\s*\=\s*{re_float}',
942
+ repeats=False,
943
+ ),
944
+ Quantity(
945
+ 'static_diel_const_nofields',
946
+ rf'{re_n}\s*dielectric constant without local fields\s*\=\s*{re_float}',
947
+ repeats=False,
948
+ ),
949
+ Quantity(
950
+ 'chi_q',
951
+ rf'{re_n}(\s*q-point number\s*1[\s\S]+?)(?:\s*Average fulfillment[\s\w\[\]\-\:\.\%]*===)',
952
+ repeats=False,
953
+ sub_parser=TextParser(
954
+ quantities=[
955
+ Quantity(
956
+ 'q_point',
957
+ rf'\s*q-point number\s*(\d+)\s*q =\s*\(\s*{re_float}\,\s*{re_float}\,\s*{re_float}\)\s*\[r\.l\.u\.\]',
958
+ repeats=True,
959
+ ),
960
+ Quantity(
961
+ 'av_fulfillment',
962
+ rf'{re_n}\s*Average fulfillment[a-zA-Z\s\[\]\-\d]*\:\s*([\d\.]+)',
963
+ repeats=True,
964
+ ),
965
+ # TODO regex chi0(G, G') for each qpoint and frequency
966
+ ]
967
+ ),
968
+ ),
969
+ ]
970
+
971
+ self._quantities.append(
972
+ Quantity(
973
+ 'screening_dataset',
974
+ rf'{re_n}(==\s*DATASET\s*3[\s\S]+?)(?:==\s*DATASET\s*4|== END DATASET)',
975
+ repeats=False,
976
+ sub_parser=TextParser(quantities=screening_quantities),
977
+ )
978
+ )
979
+
980
+ def params_to_pairs(val_in):
981
+ key = '_'.join(val_in.split()[:-1]).replace('-', '_')
982
+ value = np.int(val_in.split()[-1])
983
+ return [key, value]
984
+
985
+ gw_quantities = rpa_quantities + [
986
+ Quantity(
987
+ 'ks_band_gaps',
988
+ rf'{re_n}\s*(\>\>\>\>\s*For spin\s*1[\s\S]+?)(?:\s*SIGMA fundamental parameters)',
989
+ repeats=False,
990
+ sub_parser=TextParser(
991
+ quantities=[
992
+ Quantity(
993
+ 'min_direct_gap',
994
+ rf'\s*Minimum direct gap\s*=\s*{re_float}\s*\[\w*\]\,\s*'
995
+ rf'located at k-point\s*\:\s*{re_float}\s*{re_float}\s*{re_float}',
996
+ repeats=False,
997
+ ),
998
+ Quantity(
999
+ 'fundamental_gap',
1000
+ rf'\s*Fundamental gap\s*=\s*{re_float}\s*\[(?P<__unit>\w+)\]',
1001
+ repeats=False,
1002
+ ),
1003
+ Quantity(
1004
+ 'k_top_valence_band',
1005
+ rf'\s*Top of valence bands at\s*\:\s*{re_float}\s*{re_float}\s*{re_float}',
1006
+ repeats=False,
1007
+ ),
1008
+ Quantity(
1009
+ 'k_bottom_conduction_band',
1010
+ rf'\s*Bottom of conduction at\s*\:\s*{re_float}\s*{re_float}\s*{re_float}',
1011
+ repeats=False,
1012
+ ),
1013
+ ]
1014
+ ),
1015
+ ),
1016
+ Quantity(
1017
+ 'sigma_parameters',
1018
+ rf'{re_n}(\s*SIGMA fundamental parameters[\s\S]+?)(?:\s*EPSILON\^\-1)',
1019
+ repeats=False,
1020
+ sub_parser=TextParser(
1021
+ quantities=[
1022
+ Quantity(
1023
+ 'model', rf'([a-zA-Z\s]+) MODEL\s*(\d+)', repeats=False
1024
+ ),
1025
+ Quantity(
1026
+ 'params',
1027
+ rf'\s*number of ([a-zA-Z\s\-\/]+)(\d+)',
1028
+ repeats=True,
1029
+ str_operation=params_to_pairs,
1030
+ ),
1031
+ Quantity(
1032
+ 'freq_step',
1033
+ rf'{re_n}\s*frequency step[a-zA-Z\s\/]*\[eV\]\s*{re_float}',
1034
+ repeats=False,
1035
+ ),
1036
+ Quantity(
1037
+ 'max_omega_sigma',
1038
+ rf'{re_n}\s*max omega for Sigma[a-zA-Z\s]*\[eV\]\s*{re_float}',
1039
+ repeats=False,
1040
+ ),
1041
+ Quantity(
1042
+ 'zcut_avoid',
1043
+ rf'{re_n}\s*zcut for avoiding poles\s*\[eV\]\s*{re_float}',
1044
+ repeats=False,
1045
+ ),
1046
+ ]
1047
+ ),
1048
+ ),
1049
+ Quantity(
1050
+ 'epsilon_inv',
1051
+ rf'{re_n}(\s*EPSILON\^\-1[\s\S]+?)(?:\s*Perturbative Calculation)',
1052
+ repeats=False,
1053
+ sub_parser=TextParser(
1054
+ quantities=[
1055
+ Quantity(
1056
+ 'dimensions',
1057
+ rf'\s*dimension of the eps\^\-1 matrix([a-zA-Z\s]+)(\d+)',
1058
+ repeats=True,
1059
+ str_operation=params_to_pairs,
1060
+ ),
1061
+ Quantity(
1062
+ 'params',
1063
+ rf'\s*number of ([a-zA-Z\s\-\/]+)(\d+)',
1064
+ repeats=True,
1065
+ str_operation=params_to_pairs,
1066
+ ),
1067
+ ]
1068
+ ),
1069
+ ),
1070
+ Quantity(
1071
+ 'self_energy_ee',
1072
+ rf'{re_n}(\-\-\-\s*\!SelfEnergy\_ee[\s\S]+?)(?:\.\.\.)',
1073
+ repeats=True,
1074
+ sub_parser=TextParser(
1075
+ quantities=[
1076
+ Quantity(
1077
+ 'kpoint',
1078
+ rf'{re_n}kpoint\s*\:[\s\[]*{re_float}\, *{re_float}\, *{re_float}',
1079
+ repeats=False,
1080
+ ),
1081
+ Quantity(
1082
+ 'params',
1083
+ rf'{re_n}([a-zA-Z\_\s]+)\:\s*([\d\.\-\+]+)',
1084
+ repeats=True,
1085
+ ),
1086
+ Quantity(
1087
+ 'data',
1088
+ rf'{re_n} *(\d+) *{re_float} *{re_float} *{re_float} *{re_float} *{re_float} *{re_float} *{re_float} *{re_float} *{re_float}',
1089
+ repeats=True,
1090
+ ),
1091
+ ]
1092
+ ),
1093
+ ),
1094
+ ]
1095
+
1096
+ self._quantities.append(
1097
+ Quantity(
1098
+ 'gw_dataset',
1099
+ rf'{re_n}(==\s*DATASET\s*4[\s\S]+?)(?:==\s*DATASET\s*5|==\s*END DATASET\s*\(S\))',
1100
+ repeats=False,
1101
+ sub_parser=TextParser(quantities=gw_quantities),
1102
+ )
1103
+ )
1104
+
1105
+ @property
1106
+ def dataset_numbers(self):
1107
+ if self._dataset_numbers is None:
1108
+ self._dataset_numbers = [
1109
+ d.get('x_abinit_dataset_number', 1) for d in self.get('dataset', [])
1110
+ ]
1111
+ return self._dataset_numbers
1112
+
1113
+ @property
1114
+ def n_datasets(self):
1115
+ if self._n_datasets is None:
1116
+ self._n_datasets = max(self.dataset_numbers) if self.dataset_numbers else 1
1117
+ return self._n_datasets
1118
+
1119
+ @property
1120
+ def input_vars(self):
1121
+ if self._input_vars is None:
1122
+ # set defaults
1123
+ self._input_vars = {
1124
+ key: [1] + [None] * (self.n_datasets - 1)
1125
+ for key in [
1126
+ 'ntypat',
1127
+ 'npsp',
1128
+ 'nshiftk',
1129
+ 'natrd',
1130
+ 'nsppol',
1131
+ 'nspden',
1132
+ 'nkpt',
1133
+ 'occopt',
1134
+ 'ixc',
1135
+ ]
1136
+ }
1137
+
1138
+ for key_val in self.get('input_variables', {}).get('key_value', []):
1139
+ key, n_dataset = re.search(r'(\D+)?(\d*)', key_val[0]).groups()
1140
+ self._input_vars.setdefault(key, [None] * self.n_datasets)
1141
+
1142
+ m_quantity = x_abinit_section_input.m_def.all_quantities.get(
1143
+ f'x_abinit_var_{key}'
1144
+ )
1145
+ if m_quantity is None:
1146
+ continue
1147
+
1148
+ if '-' in key_val: # exception when the next line starts with -
1149
+ key_val = key_val[:-1]
1150
+
1151
+ val = np.array(
1152
+ key_val[1:],
1153
+ dtype=m_quantity.type.standard_type()
1154
+ if hasattr(m_quantity.type, 'standard_type')
1155
+ else m_quantity.type,
1156
+ )
1157
+ if not m_quantity.shape:
1158
+ val = val[0]
1159
+ if n_dataset:
1160
+ self._input_vars[key][int(n_dataset) - 1] = val
1161
+ else:
1162
+ self._input_vars[key] = [val] * self.n_datasets
1163
+ return self._input_vars
1164
+
1165
+ def get_input_var(self, key, n_dataset, default=None):
1166
+ val = self.input_vars.get(key)
1167
+ if val is None or val[n_dataset - 1] is None:
1168
+ val = [default] * n_dataset
1169
+ return val[n_dataset - 1]
1170
+
1171
+ def get_atom_labels(self):
1172
+ znucl = self.get_input_var('znucl', 1)
1173
+ typat = self.get_input_var('typat', 1)
1174
+ if znucl is None or typat is None:
1175
+ return
1176
+ return [chemical_symbols[int(znucl[n_at - 1])] for n_at in typat]
1177
+
1178
+
1179
+ class AbinitParser(BeyondDFTWorkflowsParser):
1180
+ def __init__(self):
1181
+ self.out_parser = AbinitOutParser()
1182
+ self.dos_parser = DataTextParser()
1183
+ self.dataset = []
1184
+ self._child_archives = {}
1185
+ self._calculation_type = 'dft'
1186
+
1187
+ self._selfenergy_data_map = {
1188
+ 1: 'value_ks',
1189
+ 2: 'value_ks_xc',
1190
+ 3: 'value_exchange',
1191
+ 4: 'value_correlation',
1192
+ 7: 'value_xc',
1193
+ 9: 'value_qp',
1194
+ }
1195
+
1196
+ def parse_var(self):
1197
+ # TODO reshape input_var arrays
1198
+ sec_run = self.archive.run[-1]
1199
+ for i in range(len(self.dataset)):
1200
+ sec_dataset = x_abinit_section_dataset()
1201
+ sec_run.x_abinit_section_dataset.append(sec_dataset)
1202
+ sec_input = x_abinit_section_input()
1203
+ sec_dataset.x_abinit_section_input = sec_input
1204
+ for key, val in self.out_parser.input_vars.items():
1205
+ quantity_def = sec_input.m_def.all_quantities.get(f'x_abinit_var_{key}')
1206
+ if val[i] is None or quantity_def is None:
1207
+ continue
1208
+ try:
1209
+ shape = [
1210
+ self.out_parser.input_vars[s.split('_')[-1]][i]
1211
+ if isinstance(s, str)
1212
+ else s
1213
+ for s in quantity_def.shape
1214
+ ]
1215
+ sec_input.m_set(
1216
+ quantity_def,
1217
+ np.reshape(val[i], shape) if shape else val[i],
1218
+ )
1219
+ except Exception:
1220
+ pass
1221
+
1222
+ def parse_system(self):
1223
+ sec_run = self.archive.run[-1]
1224
+ sec_input = sec_run.x_abinit_section_dataset[0].x_abinit_section_input
1225
+
1226
+ atom_labels = self.out_parser.get_atom_labels()
1227
+ if atom_labels is None:
1228
+ return
1229
+ lattice_vectors = self.dataset[0].get('x_abinit_vprim') * ureg.bohr
1230
+ pbc = [v is not None for v in lattice_vectors]
1231
+
1232
+ # Always extracted from DATASET 1
1233
+ natom = sec_input.x_abinit_var_natom
1234
+ xcart = sec_input.x_abinit_var_xcart
1235
+ rprim = sec_input.x_abinit_var_rprim
1236
+ xred = sec_input.x_abinit_var_xred
1237
+ if xcart is not None:
1238
+ xcart = np.reshape(sec_input.x_abinit_var_xcart, (natom, 3))
1239
+ atom_positions = xcart
1240
+ elif xred is not None and rprim is not None:
1241
+ xred = np.reshape(sec_input.x_abinit_var_xred, (natom, 3))
1242
+ rprim = np.reshape(sec_input.x_abinit_var_rprim, (natom, 3))
1243
+ atom_positions = np.dot(xred, rprim.transpose()) * ureg.bohr
1244
+ else:
1245
+ if natom == 1: # handling exception
1246
+ atom_positions = np.array([[0.0, 0.0, 0.0]])
1247
+ else:
1248
+ self.logger.warning('Could not resolve atom positions.')
1249
+ return
1250
+
1251
+ sec_system = System()
1252
+ sec_run.system.append(sec_system)
1253
+ sec_atoms = Atoms()
1254
+ sec_system.atoms = sec_atoms
1255
+ sec_atoms.labels = atom_labels
1256
+ sec_atoms.positions = atom_positions
1257
+ sec_atoms.periodic = pbc
1258
+ sec_atoms.n_atoms = len(atom_labels)
1259
+ sec_atoms.lattice_vectors = lattice_vectors
1260
+
1261
+ def parse_method(self):
1262
+ sec_run = self.archive.run[-1]
1263
+ smearing_kinds = [
1264
+ '',
1265
+ '',
1266
+ '',
1267
+ 'fermi',
1268
+ 'marzari-vanderbilt',
1269
+ 'marzari-vanderbilt',
1270
+ 'methfessel-paxton',
1271
+ 'gaussian',
1272
+ '',
1273
+ ]
1274
+
1275
+ sec_method = Method()
1276
+ sec_run.method.append(sec_method)
1277
+ sec_dft = DFT()
1278
+ sec_method.dft = sec_dft
1279
+ sec_electronic = Electronic()
1280
+ sec_method.electronic = sec_electronic
1281
+ sec_electronic.method = 'DFT'
1282
+ # defined in DATASET 2
1283
+ if len(self.dataset) == 1:
1284
+ nsppol = int(self.out_parser.get_input_var('nsppol', 1, 1))
1285
+ else:
1286
+ nsppol = int(self.out_parser.get_input_var('nsppol', 2, 1))
1287
+ sec_electronic.n_spin_channels = nsppol
1288
+
1289
+ sec_scf = Scf()
1290
+ sec_method.scf = sec_scf
1291
+ sec_scf.n_max_iteration = int(self.out_parser.get_input_var('nstep', 1, 1))
1292
+ toldfe = self.out_parser.get_input_var('toldfe', 1, 0.0)
1293
+ if toldfe is not None:
1294
+ sec_scf.threshold_energy_change = toldfe * ureg.hartree
1295
+
1296
+ occopt = self.out_parser.get_input_var('occopt', 1, 1)
1297
+ smearing = smearing_kinds[occopt] if occopt < len(smearing_kinds) else ''
1298
+ sec_smearing = Smearing()
1299
+ sec_electronic.smearing = sec_smearing
1300
+ sec_smearing.kind = smearing
1301
+ tsmear = self.out_parser.get_input_var('tsmear', 1, 0.01)
1302
+ if tsmear is not None:
1303
+ sec_smearing.width = (tsmear * ureg.hartree).to('joule').magnitude
1304
+
1305
+ # basis set
1306
+ ecut = self.out_parser.get_input_var('ecut', 1)
1307
+ if ecut is not None:
1308
+ ecut = ecut * ureg.hartree
1309
+ sec_method.electrons_representation.append(
1310
+ BasisSetContainer(
1311
+ type='plane waves',
1312
+ scope=['wavefunction'],
1313
+ basis_set=[
1314
+ BasisSet(
1315
+ scope=['valence'],
1316
+ type='plane waves',
1317
+ cutoff=ecut,
1318
+ )
1319
+ ],
1320
+ )
1321
+ )
1322
+
1323
+ # DFT
1324
+ ixc = self.out_parser.get_input_var('ixc', 1, 1)
1325
+ if ixc >= 0:
1326
+ xc_functionals = ABINIT_NATIVE_IXC.get(ixc, [])
1327
+ else:
1328
+ xc_functionals = []
1329
+ functional1 = -ixc // 1000
1330
+ if functional1 > 0:
1331
+ xc_functionals.append(ABINIT_LIBXC_IXC.get(functional1))
1332
+ functional2 = -ixc - (-ixc // 1000) * 1000
1333
+ if functional2 > 0:
1334
+ xc_functionals.append(ABINIT_LIBXC_IXC.get(functional2))
1335
+
1336
+ sec_xc_functional = XCFunctional()
1337
+ sec_dft.xc_functional = sec_xc_functional
1338
+ for xc_functional in xc_functionals:
1339
+ for value in sorted(xc_functional.values()):
1340
+ if '_X_' in value:
1341
+ sec_xc_functional.exchange.append(Functional(name=value))
1342
+ elif '_C_' in value:
1343
+ sec_xc_functional.correlation.append(Functional(name=value))
1344
+ elif '_HYB_' in value:
1345
+ sec_xc_functional.hybrid.append(Functional(name=value))
1346
+ else:
1347
+ sec_xc_functional.contributions.append(Functional(name=value))
1348
+
1349
+ # Parsing KMesh
1350
+ if (
1351
+ self.out_parser.get_input_var('kptopt', 1, 4) < 0
1352
+ ): # negative kptopt sets band structure
1353
+ return
1354
+ sec_k_mesh = KMesh()
1355
+ sec_method.k_mesh = sec_k_mesh
1356
+ # Two exclusive input vars: ngkpt and kptrlatt
1357
+ for key_var in ['ngkpt', 'kptrlatt']:
1358
+ value = self.out_parser.get_input_var(key_var, 1)
1359
+ if value is not None:
1360
+ if key_var == 'ngkpt':
1361
+ sec_k_mesh.generation_method = 'Monkhorst-Pack'
1362
+ sec_k_mesh.grid = value
1363
+ sec_k_mesh.n_points = np.prod(value)
1364
+ elif (
1365
+ key_var == 'kptrlatt'
1366
+ ): # TODO cover kptrlatt and nshift=1, 2, 4, 8 situations
1367
+ pass
1368
+
1369
+ def parse_gw(self):
1370
+ sec_run = self.archive.run[-1]
1371
+ sec_method = Method()
1372
+ sec_run.method.append(sec_method)
1373
+
1374
+ # GW
1375
+ sec_gw = GW()
1376
+ sec_method.gw = sec_gw
1377
+ # KMesh
1378
+ nkptgw = self.out_parser.get_input_var('nkptgw', 4, 0)
1379
+ if nkptgw > 0:
1380
+ kptgw = np.reshape(
1381
+ self.out_parser.get_input_var('kptgw', 4, []), (nkptgw, 3)
1382
+ )
1383
+ sec_k_mesh = KMesh()
1384
+ sec_method.k_mesh = sec_k_mesh
1385
+ sec_k_mesh.n_points = nkptgw
1386
+ sec_k_mesh.points = kptgw
1387
+ # QMesh same as KMesh
1388
+ sec_gw.m_add_sub_section(GW.q_mesh, sec_k_mesh)
1389
+ # Type
1390
+ gwcalctype = self.out_parser.get_input_var('gwcalctype', 4, 0)
1391
+ if 0 <= gwcalctype <= 9:
1392
+ sec_gw.type = 'G0W0'
1393
+ elif 10 <= gwcalctype <= 19:
1394
+ sec_gw.type = 'ev-scGW'
1395
+ elif 20 <= gwcalctype <= 29:
1396
+ sec_gw.type = 'qp-scGW'
1397
+ else:
1398
+ self.logger.warning(
1399
+ 'GW type not supported (currently only for 0 <= gwcalctype <= 29).'
1400
+ )
1401
+ # Analytical continuation
1402
+ ppmodel = self.out_parser.get_input_var('ppmodel', 4, 0)
1403
+ if gwcalctype == 1:
1404
+ sec_gw.analytical_continuation = 'pade'
1405
+ elif gwcalctype == 2:
1406
+ sec_gw.analytical_continuation = 'contour_deformation'
1407
+ else:
1408
+ if ppmodel == 1:
1409
+ sec_gw.analytical_continuation = 'ppm_GodbyNeeds'
1410
+ elif ppmodel == 2:
1411
+ sec_gw.analytical_continuation = 'ppm_HybertsenLouie'
1412
+ elif ppmodel == 3:
1413
+ sec_gw.analytical_continuation = 'ppm_vonderLindenHorsh'
1414
+ elif ppmodel == 4:
1415
+ sec_gw.analytical_continuation = 'ppm_FaridEngel'
1416
+ else:
1417
+ sec_gw.analytical_continuation = 'contour_deformation'
1418
+ # FrequencyMesh
1419
+ frequency_values = (
1420
+ self.out_parser.get('screening_dataset', {})
1421
+ .get('frequencies', {})
1422
+ .get('values')
1423
+ )
1424
+ if frequency_values is not None:
1425
+ values = [freq[0] + freq[1] * 1j for freq in frequency_values]
1426
+ values = np.reshape(values, (len(values), 1))
1427
+ sec_freq_mesh = FrequencyMesh(
1428
+ dimensionality=1,
1429
+ n_points=len(frequency_values),
1430
+ points=values * ureg.eV,
1431
+ )
1432
+ else:
1433
+ freq_plasma = self.out_parser.get('gw_dataset', {}).get('omega_plasma', 0.0)
1434
+ values = [0.0, freq_plasma * 1j]
1435
+ values = np.reshape(values, (len(values), 1))
1436
+ sec_freq_mesh = FrequencyMesh(dimensionality=1, n_points=2, points=values)
1437
+ sec_method.m_add_sub_section(Method.frequency_mesh, sec_freq_mesh)
1438
+ # Screening
1439
+ occ_scr = self.out_parser.get_input_var('occ', 3, [])
1440
+ n_scr = len(occ_scr)
1441
+ n_occ_scr = len([occ for occ in occ_scr if occ > 0.0])
1442
+ n_empty_scr = n_scr - n_occ_scr
1443
+ sec_screening = Screening(n_states=n_scr, n_empty_states=n_empty_scr)
1444
+ sec_gw.m_add_sub_section(GW.screening, sec_screening)
1445
+ # Other paramters
1446
+ if self.out_parser.get_input_var('bdgw', 4, np.array(None)).all():
1447
+ sec_gw.interval_qp_corrections = [
1448
+ self.out_parser.get_input_var('bdgw', 4, []).min(),
1449
+ self.out_parser.get_input_var('bdgw', 4, []).max(),
1450
+ ]
1451
+ occ_gw = self.out_parser.get_input_var('occ', 4, [])
1452
+ n_gw = len(occ_gw)
1453
+ sec_gw.n_states = n_gw
1454
+ n_occ_gw = len([occ_gw[i] for i in range(n_gw) if occ_gw[i] > 0.0])
1455
+ sec_gw.n_empty_states = n_gw - n_occ_gw
1456
+
1457
+ def parse_workflow(self):
1458
+ workflow = None
1459
+
1460
+ geometry_optimizations = {
1461
+ 1: 'viscous_damped_md',
1462
+ 2: 'bfgs',
1463
+ 3: 'bfgs',
1464
+ 4: 'conjugate_gradient',
1465
+ 5: 'steepest_descent',
1466
+ 7: 'quenched_md',
1467
+ 10: 'dic_bfgs',
1468
+ 11: 'dic_bfgs',
1469
+ 20: 'diis',
1470
+ }
1471
+
1472
+ ionmov = self.out_parser.get_input_var('ionmov', 1, 0)
1473
+ vis = self.out_parser.get_input_var('vis', 1, 100.0)
1474
+ if ionmov in [2, 3, 4, 5, 7, 10, 11, 20] or (ionmov == 1 and vis > 0.0):
1475
+ workflow = GeometryOptimization(method=GeometryOptimizationMethod())
1476
+ workflow.method.method = geometry_optimizations[ionmov]
1477
+ tolmxf = self.out_parser.get_input_var('tolmxf', 1, 5e-5)
1478
+ if tolmxf is not None:
1479
+ workflow.method.convergence_tolerance_force_maximum = tolmxf * (
1480
+ ureg.hartree / ureg.bohr
1481
+ )
1482
+
1483
+ tolmxde = self.out_parser.get_input_var('tolmxde', 1, 0.0)
1484
+ if tolmxde is not None:
1485
+ workflow.method.convergence_tolerance_energy_difference = (
1486
+ tolmxde * ureg.hartree
1487
+ )
1488
+ elif ionmov in [6, 8, 12, 13, 14, 23] or (ionmov == 1 and vis == 0.0):
1489
+ workflow = MolecularDynamics()
1490
+ elif ionmov == 9:
1491
+ workflow = MolecularDynamics()
1492
+ else:
1493
+ workflow = SinglePoint()
1494
+
1495
+ self.archive.workflow2 = workflow
1496
+
1497
+ def parse_bandstructure(self, results, energy_fermi):
1498
+ if (
1499
+ self.out_parser.get_input_var('kptopt', 1, 4) > 0
1500
+ ): # negative kptopt sets band structure
1501
+ return
1502
+ # saving band structure after the dataset 2
1503
+ if results is None:
1504
+ return
1505
+ sec_run = self.archive.run[-1]
1506
+ sec_scc = sec_run.calculation[-1]
1507
+
1508
+ data = results.get('eigenvalues', None)
1509
+ if data is None:
1510
+ return
1511
+ nsppol = self.out_parser.get_input_var('nsppol', 2, 1)
1512
+ data = np.reshape(
1513
+ data, (nsppol, len(data) // nsppol, np.size(data) // len(data))
1514
+ )
1515
+
1516
+ nband = int(data.T[1].T[0][0])
1517
+ kpts = data.T[3:6].T[0]
1518
+ if len(kpts) == 1: # returning if only one kpoint (atoms or molecules)
1519
+ return
1520
+ eigs = data.T[6 : 6 + nband].T
1521
+ occs = results.get('occupation_numbers')
1522
+ if occs is not None:
1523
+ occs = np.reshape(
1524
+ occs, (nsppol, len(occs) // nsppol, np.size(occs) // len(occs))
1525
+ )
1526
+
1527
+ # TODO is this is good enough or should we parse ndivsm?
1528
+ sec_k_band = BandStructure()
1529
+ sec_scc.band_structure_electronic.append(sec_k_band)
1530
+ sec_k_band.energy_fermi = energy_fermi
1531
+ for k in range(len(kpts)):
1532
+ if k > 0:
1533
+ sec_k_band_segment = BandEnergies()
1534
+ sec_k_band.segment.append(sec_k_band_segment)
1535
+ sec_k_band_segment.n_kpoints = 2
1536
+ sec_k_band_segment.kpoints = kpts[k - 1 : k + 1]
1537
+ sec_k_band_segment.n_bands = nband
1538
+ sec_k_band_segment.energies = eigs[:, k - 1 : k + 1] * ureg.hartree
1539
+ if occs is not None:
1540
+ sec_k_band_segment.occupations = occs[:, k - 1 : k + 1]
1541
+
1542
+ def parse_dos(self):
1543
+ sec_run = self.archive.run[-1]
1544
+
1545
+ # Identifying the DS2_DOS files
1546
+ file_root = self.out_parser.get('x_abinit_output_files_root')
1547
+ if file_root is None:
1548
+ file_root = f'{os.path.basename(self.filepath).rstrip(".out")}_o'
1549
+ dos_file = os.path.join(self.maindir, f'{file_root}_DS2_DOS')
1550
+ if not os.path.isfile(dos_file):
1551
+ return
1552
+
1553
+ if sec_run.calculation[-1] is None:
1554
+ sec_scc = Calculation()
1555
+ sec_run.calculation.append(sec_scc)
1556
+ else:
1557
+ sec_scc = sec_run.calculation[-1]
1558
+
1559
+ self.dos_parser.mainfile = dos_file
1560
+ dos = self.dos_parser.data
1561
+ nsppol = self.out_parser.get_input_var('nsppol', 2, 1)
1562
+ dos = np.reshape(dos, (nsppol, len(dos) // nsppol, np.size(dos) // len(dos)))
1563
+
1564
+ for spin in range(nsppol):
1565
+ dos_spin = np.transpose(dos[spin])
1566
+ sec_dos = Dos()
1567
+ sec_scc.dos_electronic.append(sec_dos)
1568
+ sec_dos.spin_channel = spin if nsppol == 2 else None
1569
+ sec_dos.n_energies = len(dos_spin[0])
1570
+ sec_dos.energies = dos_spin[0] * ureg.hartree
1571
+
1572
+ sec_dos_total = DosValues()
1573
+ sec_dos.total.append(sec_dos_total)
1574
+ sec_dos_total.value = dos_spin[1] / ureg.hartree
1575
+ sec_dos_total.value_integrated = dos_spin[2]
1576
+
1577
+ def parse_groundstate_datasets(self):
1578
+ """
1579
+ DATASET 1 gives structural calculations.
1580
+ DATASET 2 gives charge self-consistent (DFT) calculations.
1581
+ """
1582
+ sec_run = self.archive.run[-1]
1583
+
1584
+ def parse_configurations(section):
1585
+ sec_scc = Calculation()
1586
+ sec_run.calculation.append(sec_scc)
1587
+ if sec_run.system is not None:
1588
+ sec_scc.system_ref = sec_run.system[-1]
1589
+ sec_scc.method_ref = sec_run.method[-1]
1590
+
1591
+ sec_energy = Energy()
1592
+ sec_scc.energy = sec_energy
1593
+ for key in self.out_parser.energy_components.keys():
1594
+ energy = section.get(key)
1595
+ if energy is None:
1596
+ continue
1597
+ key = key.lstrip('energy_')
1598
+ if key == 'internal':
1599
+ sec_energy.internal = energy
1600
+ elif hasattr(Energy, key):
1601
+ sec_energy.m_add_sub_section(
1602
+ getattr(Energy, key), EnergyEntry(value=energy)
1603
+ )
1604
+
1605
+ else:
1606
+ sec_energy.contributions.append(EnergyEntry(kind=key, value=energy))
1607
+
1608
+ forces = section.get('cartesian_forces')
1609
+ if forces is not None:
1610
+ sec_forces = Forces()
1611
+ sec_scc.forces = sec_forces
1612
+ sec_forces.total = ForcesEntry(value_raw=forces)
1613
+
1614
+ stress_tensor = section.get('stress_tensor')
1615
+ if stress_tensor is not None:
1616
+ sec_stress = Stress()
1617
+ sec_scc.stress = sec_stress
1618
+ sec_stress.total = StressEntry(value=stress_tensor)
1619
+
1620
+ fermi_energy = section.get('fermi_energy')
1621
+ if fermi_energy is not None:
1622
+ sec_energy.fermi = fermi_energy
1623
+
1624
+ def parse_scf(section):
1625
+ sec_scc = sec_run.calculation[-1]
1626
+
1627
+ self_consistent = section.get('self_consistent', {})
1628
+ if self_consistent.get('convergence', None) in [
1629
+ 'converged',
1630
+ 'is converged',
1631
+ 'are converged',
1632
+ ]:
1633
+ sec_scc.calculation_converged = True
1634
+
1635
+ energy_total_scf_iteration = self_consistent.get(
1636
+ 'energy_total_scf_iteration', []
1637
+ )
1638
+ for energy in energy_total_scf_iteration:
1639
+ sec_scf_iteration = ScfIteration()
1640
+ sec_scc.scf_iteration.append(sec_scf_iteration)
1641
+ sec_energy = Energy()
1642
+ sec_scf_iteration.energy = sec_energy
1643
+ sec_energy.total = EnergyEntry(value=energy[0] * ureg.hartree)
1644
+
1645
+ for nd in range(self.out_parser.n_datasets):
1646
+ results = self.dataset[nd].get('results')
1647
+ if results is None:
1648
+ continue
1649
+ parse_configurations(results)
1650
+ parse_scf(self.dataset[nd])
1651
+
1652
+ # Relaxation of the structure
1653
+ relaxation = self.dataset[nd].get('relaxation', [])
1654
+ for step in relaxation:
1655
+ if relaxation.index(step) > 0: # not parsing system for step 1
1656
+ sec_system = System()
1657
+ sec_run.system.append(sec_system)
1658
+ sec_atoms = Atoms()
1659
+ sec_system.atoms = sec_atoms
1660
+ atom_positions = step.get('cartesian_coordinates')
1661
+ sec_atoms.positions = atom_positions
1662
+ sec_atoms.labels = sec_run.system[0].atoms.labels
1663
+ sec_atoms.periodic = sec_run.system[0].atoms.periodic
1664
+ sec_atoms.n_atoms = sec_run.system[0].atoms.n_atoms
1665
+ sec_atoms.lattice_vectors = sec_run.system[0].atoms.lattice_vectors
1666
+ parse_configurations(step)
1667
+ parse_scf(step)
1668
+ self.parse_dos()
1669
+ if sec_run.calculation[-1].energy.fermi:
1670
+ self.parse_bandstructure(results, sec_run.calculation[-1].energy.fermi)
1671
+
1672
+ def parse_gw_datasets(self):
1673
+ """
1674
+ DATASET 3 gives screening calculations.
1675
+ DATASET 4 gives self-energy (GW) calculations.
1676
+ """
1677
+ sec_run = self.archive.run[-1]
1678
+
1679
+ def initialize_calculation_section():
1680
+ if sec_run.calculation:
1681
+ sec_scc = sec_run.calculation[-1]
1682
+ else:
1683
+ sec_scc = Calculation()
1684
+ sec_run.calculation.append(sec_scc)
1685
+ if sec_run.system is not None:
1686
+ sec_scc.system_ref = sec_run.system[-1]
1687
+ sec_scc.method_ref = sec_run.method[-1]
1688
+ return sec_scc
1689
+
1690
+ def parse_quantities(section, keys, value):
1691
+ if keys == 'symm_screening' and value:
1692
+ value = ' '.join(value)
1693
+ setattr(section, f'x_abinit_{keys}', value)
1694
+
1695
+ def parse_meshes(section, keys, value):
1696
+ sec_mesh = x_abinit_mesh()
1697
+ section.x_abinit_kqmesh.append(sec_mesh)
1698
+ sec_mesh.x_abinit_type = keys
1699
+ for subkeys in value.keys():
1700
+ setattr(sec_mesh, f'x_abinit_{subkeys}', value[subkeys])
1701
+
1702
+ # Screening dataset code-specific
1703
+ scr_dataset = self.out_parser.get('screening_dataset')
1704
+ if scr_dataset:
1705
+ sec_scc = initialize_calculation_section()
1706
+ sec_scr = x_abinit_screening_dataset()
1707
+ sec_scc.x_abinit_screening.append(sec_scr)
1708
+
1709
+ for keys in scr_dataset.keys():
1710
+ value = scr_dataset.get(keys)
1711
+ if not hasattr(value, 'quantities'):
1712
+ parse_quantities(sec_scr, keys, value)
1713
+ else:
1714
+ if keys == 'frequencies':
1715
+ sec_scr.x_abinit_frequencies = value['values']
1716
+ elif keys == 'chi_q':
1717
+ sec_chi_q = x_abinit_chi_q_data()
1718
+ sec_scr.x_abinit_chi_q = sec_chi_q
1719
+ for subkeys in value.keys():
1720
+ setattr(sec_chi_q, f'x_abinit_{subkeys}', value[subkeys])
1721
+ else:
1722
+ parse_meshes(sec_scr, keys, value)
1723
+
1724
+ # GW dataset code-specific
1725
+ gw_dataset = self.out_parser.get('gw_dataset')
1726
+ if gw_dataset:
1727
+ sec_scc = initialize_calculation_section()
1728
+ sec_gw_abinit = x_abinit_gw_dataset()
1729
+ sec_scc.x_abinit_gw.append(sec_gw_abinit)
1730
+
1731
+ for keys in gw_dataset.keys():
1732
+ value = gw_dataset.get(keys)
1733
+ if not hasattr(value, 'quantities'):
1734
+ parse_quantities(sec_gw_abinit, keys, value)
1735
+ else:
1736
+ if keys == 'ks_band_gaps':
1737
+ sec_ks_gaps = x_abinit_ks_band_gaps_params()
1738
+ sec_gw_abinit.x_abinit_ks_band_gaps.append(sec_ks_gaps)
1739
+ for subkeys in value.keys():
1740
+ setattr(sec_ks_gaps, f'x_abinit_{subkeys}', value[subkeys])
1741
+ elif keys == 'sigma_parameters':
1742
+ sec_sigma = x_abinit_sigma_params()
1743
+ sec_gw_abinit.x_abinit_sigma.append(sec_sigma)
1744
+ for subkeys in value.keys():
1745
+ if subkeys == 'model' and value[subkeys]:
1746
+ val = ' '.join([str(v) for v in value[subkeys]])
1747
+ elif subkeys == 'params' and value[subkeys]:
1748
+ val = dict(value[subkeys])
1749
+ else:
1750
+ val = value[subkeys]
1751
+ setattr(sec_sigma, f'x_abinit_{subkeys}', val)
1752
+ elif keys == 'epsilon_inv':
1753
+ sec_epsiloninv = x_abinit_epsilon_inv_params()
1754
+ sec_gw_abinit.x_abinit_epsilon_inv.append(sec_epsiloninv)
1755
+ for subkeys in value.keys():
1756
+ val = value.get('subkeys')
1757
+ if val:
1758
+ setattr(
1759
+ sec_epsiloninv, f'x_abinit_{subkeys}', dict(val)
1760
+ )
1761
+ else:
1762
+ parse_meshes(sec_gw_abinit, keys, value)
1763
+
1764
+ # GW specific outputs
1765
+ for selfenergy in gw_dataset.get('self_energy_ee', []):
1766
+ sec_k_eigen = BandEnergies()
1767
+ sec_scc.eigenvalues.append(sec_k_eigen)
1768
+ sec_k_eigen.n_kpoints = 1
1769
+ kpoints = [
1770
+ selfenergy.get('kpoint', []) for k in range(sec_k_eigen.n_kpoints)
1771
+ ]
1772
+ sec_k_eigen.kpoints = kpoints
1773
+ sec_k_eigen.n_bands = len(selfenergy.get('data', []))
1774
+ selfenergy_data = np.array(selfenergy.get('data', []))
1775
+ if selfenergy.get('params'):
1776
+ sec_k_eigen.n_spin_channels = selfenergy.get('params')[0][-1]
1777
+ sec_gap = x_abinit_qp_band_gaps_params()
1778
+ sec_k_eigen.x_abinit_qp_band_gaps_params = sec_gap
1779
+ sec_gap.x_abinit_value = (
1780
+ selfenergy.get('params')[1][-1] * ureg.eV
1781
+ ) # KS gap
1782
+ sec_gap.x_abinit_value_fundamental = (
1783
+ selfenergy.get('params')[2][-1] * ureg.eV
1784
+ ) # QP gap
1785
+ for i in self._selfenergy_data_map.keys():
1786
+ value = np.array(
1787
+ [
1788
+ [
1789
+ selfenergy_data[:, i]
1790
+ for s in range(sec_k_eigen.n_spin_channels)
1791
+ ]
1792
+ for k in range(sec_k_eigen.n_kpoints)
1793
+ ]
1794
+ )
1795
+ value = value * ureg.eV
1796
+ setattr(sec_k_eigen, self._selfenergy_data_map[i], value)
1797
+ value = np.array(
1798
+ [
1799
+ [
1800
+ selfenergy_data[:, 5]
1801
+ for s in range(sec_k_eigen.n_spin_channels)
1802
+ ]
1803
+ for k in range(sec_k_eigen.n_kpoints)
1804
+ ]
1805
+ )
1806
+ sec_k_eigen.qp_linearization_factor = value
1807
+
1808
+ def init_parser(self):
1809
+ self.out_parser.mainfile = self.filepath
1810
+ self.out_parser.logger = self.logger
1811
+ self.out_parser._input_vars = None
1812
+ self.out_parser._n_datasets = None
1813
+ self.out_parser._dataset_numbers = None
1814
+
1815
+ def reuse_parser(self, parser):
1816
+ self.out_parser.quantities = parser.out_parser.quantities
1817
+
1818
+ def get_mainfile_keys(self, **kwargs):
1819
+ self.out_parser.findall = False
1820
+ self.out_parser.mainfile = kwargs.get('filename')
1821
+ ds_numbers = self.out_parser.get('dataset_numbers')
1822
+ optdriver = self.out_parser.input_vars.get('optdriver', [])
1823
+ self.out_parser.findall = True
1824
+ if 4 in ds_numbers and (1 and 2 and 3) not in ds_numbers:
1825
+ return True
1826
+ if len(optdriver) == 4 and (optdriver[-1] == 4 or optdriver[-1] == 66):
1827
+ return ['GW', 'GW_workflow']
1828
+ return True
1829
+
1830
+ def parse(self, filepath, archive, logger):
1831
+ self.filepath = filepath
1832
+ self.archive = archive
1833
+ self.maindir = os.path.dirname(self.filepath)
1834
+ self.logger = logger if logger is not None else get_logger(__name__)
1835
+
1836
+ self.init_parser()
1837
+
1838
+ # Initial check for the presence of correctly parsed datasets
1839
+ self.dataset = self.out_parser.get('dataset', [])
1840
+ if len(self.dataset) < 1:
1841
+ self.logger.error('No datasets detected.')
1842
+ return
1843
+ if (
1844
+ 4 in self.out_parser.dataset_numbers
1845
+ and (1 and 2 and 3) not in self.out_parser.dataset_numbers
1846
+ ):
1847
+ self._calculation_type = 'gw'
1848
+
1849
+ sec_run = Run()
1850
+ self.archive.run.append(sec_run)
1851
+ sec_run.program = Program(
1852
+ name='ABINIT',
1853
+ version=self.out_parser.get('program_version', ''),
1854
+ compilation_host=self.out_parser.get('program_compilation_host', ''),
1855
+ )
1856
+
1857
+ section_run_keys = [
1858
+ 'x_abinit_parallel_compilation',
1859
+ 'x_abinit_start_date',
1860
+ 'x_abinit_start_time',
1861
+ 'x_abinit_input_file',
1862
+ 'x_abinit_output_file',
1863
+ 'x_abinit_input_files_root',
1864
+ 'x_abinit_output_files_root',
1865
+ 'x_abinit_total_cpu_time',
1866
+ 'x_abinit_total_wallclock_time',
1867
+ ]
1868
+
1869
+ for key in section_run_keys:
1870
+ val = self.out_parser.get(key)
1871
+ if val is None:
1872
+ continue
1873
+ setattr(sec_run, key, val)
1874
+
1875
+ if self.out_parser.get('run_clean_end') is not None:
1876
+ sec_run.clean_end = True
1877
+
1878
+ abi_time = datetime.strptime(
1879
+ str('%s %s')
1880
+ % (
1881
+ self.out_parser.get('x_abinit_start_date'),
1882
+ self.out_parser.get('x_abinit_start_time'),
1883
+ ),
1884
+ '%a %d %b %Y %Hh%M',
1885
+ )
1886
+ sec_run.time_run = TimeRun(
1887
+ date_start=(abi_time - datetime(1970, 1, 1)).total_seconds()
1888
+ )
1889
+
1890
+ # Parsing ABINIT input variables
1891
+ self.parse_var()
1892
+
1893
+ # Parse initial system from dataset 1
1894
+ self.parse_system()
1895
+
1896
+ if self._calculation_type == 'gw':
1897
+ self.parse_gw()
1898
+ self.parse_gw_datasets()
1899
+ else:
1900
+ self.parse_method()
1901
+ self.parse_groundstate_datasets()
1902
+
1903
+ self.parse_workflow()
1904
+
1905
+ gw_archive = self._child_archives.get('GW')
1906
+ optdriver = self.out_parser.input_vars.get('optdriver', [])
1907
+ if (
1908
+ gw_archive is not None
1909
+ and len(optdriver) == 4
1910
+ and (optdriver[-1] == 4 or optdriver[-1] == 66)
1911
+ ):
1912
+ # GW single point
1913
+ p = AbinitParser()
1914
+ p._calculation_type = 'gw'
1915
+ p.parse(filepath, gw_archive, logger)
1916
+
1917
+ # GW workflow
1918
+ gw_workflow_archive = self._child_archives.get('GW_workflow')
1919
+ try:
1920
+ self.parse_gw_workflow(gw_archive, gw_workflow_archive)
1921
+ except Exception:
1922
+ self.logger.error('Error parsing the automatic GW workflow')