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,750 @@
1
+ #
2
+ # Copyright The NOMAD Authors.
3
+ #
4
+ # This file is part of NOMAD.
5
+ # See https://nomad-lab.eu for further info.
6
+ #
7
+ # Licensed under the Apache License, Version 2.0 (the "License");
8
+ # you may not use this file except in compliance with the License.
9
+ # You may obtain a copy of the License at
10
+ #
11
+ # http://www.apache.org/licenses/LICENSE-2.0
12
+ #
13
+ # Unless required by applicable law or agreed to in writing, software
14
+ # distributed under the License is distributed on an "AS IS" BASIS,
15
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ # See the License for the specific language governing permissions and
17
+ # limitations under the License.
18
+ #
19
+
20
+ import os
21
+ import logging
22
+ import numpy as np
23
+
24
+ from datetime import datetime
25
+
26
+ from nomad.units import ureg
27
+ from nomad.parsing.file_parser import TextParser, Quantity
28
+ from runschema.run import Run, Program, TimeRun
29
+ from runschema.method import Method, BasisSet, BasisSetContainer
30
+ from runschema.system import System, Atoms
31
+ from runschema.calculation import (
32
+ Calculation,
33
+ ScfIteration,
34
+ Energy,
35
+ EnergyEntry,
36
+ BandEnergies,
37
+ Charges,
38
+ Multipoles,
39
+ MultipolesEntry,
40
+ VibrationalFrequencies,
41
+ )
42
+ from simulationworkflowschema import (
43
+ GeometryOptimization,
44
+ GeometryOptimizationMethod,
45
+ Thermodynamics,
46
+ ThermodynamicsResults,
47
+ )
48
+
49
+ from .metainfo import dmol3 # pylint: disable=unused-import
50
+
51
+
52
+ re_f = r'[-+]?\d*\.\d*(?:[Ee][-+]\d+)?'
53
+ re_n = r'[\n\r]'
54
+ MOL = 6.02214076e23
55
+
56
+
57
+ class MainfileParser(TextParser):
58
+ def init_quantities(self):
59
+ coordinates_quantities = [
60
+ Quantity(
61
+ 'labels_positions',
62
+ rf'([A-Z][a-z]* +{re_f} +{re_f} +{re_f})',
63
+ repeats=True,
64
+ )
65
+ ]
66
+
67
+ scf_quantity = Quantity(
68
+ 'scf',
69
+ r'Start Computing SCF Energy/Gradient([\s\S]+?)End Computing SCF Energy/Gradient',
70
+ repeats=True,
71
+ sub_parser=TextParser(
72
+ quantities=[
73
+ Quantity(
74
+ 'iteration',
75
+ rf'Ef +({re_f} +{re_f} +{re_f} +{re_f} +\d+)',
76
+ repeats=True,
77
+ dtype=np.dtype(np.float64),
78
+ ),
79
+ Quantity(
80
+ 'eigenvalues',
81
+ rf'state +eigenvalue +occupation\s+\(au\) +\(ev\)\s+'
82
+ rf'((?:\d+ +\S+ +\d+ +\S+ +{re_f} +{re_f} +{re_f}\s+)+)',
83
+ repeats=True,
84
+ str_operation=lambda x: np.transpose(
85
+ [v.split()[4:] for v in x.strip().splitlines()]
86
+ ),
87
+ ),
88
+ Quantity(
89
+ 'n_electrons',
90
+ rf'Total number electrons\: +({re_f})',
91
+ dtype=np.float64,
92
+ ),
93
+ Quantity(
94
+ 'coordinates',
95
+ r'ATOMIC COORDINATES \(au\).+\s*df +x +y +z +.+\s*\-+\s+'
96
+ rf'((?:df +[A-Z][a-z]* +{re_f} +{re_f} +{re_f}.+\s+)+)',
97
+ sub_parser=TextParser(quantities=coordinates_quantities),
98
+ ),
99
+ Quantity(
100
+ 'final',
101
+ rf'\-+\s+Total E.+\s+\-+\s+Ef +({re_f}.+)',
102
+ dtype=np.float64,
103
+ ),
104
+ Quantity(
105
+ 'energy_binding',
106
+ rf'binding energy +({re_f})Ha',
107
+ dtype=np.float64,
108
+ unit=ureg.hartree,
109
+ ),
110
+ ]
111
+ ),
112
+ )
113
+
114
+ self._quantities = [
115
+ Quantity(
116
+ 'program_version',
117
+ r'Materials Studio DMol\^3 version (\S+)',
118
+ dtype=str,
119
+ flatten=False,
120
+ ),
121
+ Quantity(
122
+ 'x_dmol3_program_compilation_date',
123
+ r'compiled on (\w+ \d+ \d+ \d+\:\d+:\d+)',
124
+ dtype=str,
125
+ flatten=False,
126
+ ),
127
+ Quantity(
128
+ 'date_start',
129
+ r'DATE\: +(\w+ \d+ \d+\:\d+\:\d+ \d+)',
130
+ dtype=str,
131
+ flatten=False,
132
+ ),
133
+ Quantity(
134
+ 'coordinates',
135
+ rf'\$coordinates\s+([\s\S]+?)\$end',
136
+ flatten=False,
137
+ sub_parser=TextParser(quantities=coordinates_quantities),
138
+ ),
139
+ Quantity(
140
+ 'simulation_parameters',
141
+ r'INPUT_DMOL keywords.+\s+.+([\s\S]+?)\>8',
142
+ sub_parser=TextParser(
143
+ quantities=[
144
+ Quantity(
145
+ 'calculation_type', rf'{re_n}Calculate +(\S+)', dtype=str
146
+ ),
147
+ Quantity(
148
+ 'functional_name', rf'{re_n}Functional +(\S+)', dtype=str
149
+ ),
150
+ Quantity(
151
+ 'pseudopotential_name',
152
+ rf'{re_n}Pseudopotential +(\S+)',
153
+ dtype=str,
154
+ ),
155
+ Quantity('basis_name', rf'{re_n}Basis +(\S+)', dtype=str),
156
+ Quantity(
157
+ 'spin_polarization',
158
+ rf'{re_n}Spin_Polarization +(\S+)',
159
+ dtype=str,
160
+ ),
161
+ Quantity('spin', rf'{re_n}Spin +(\d+)', dtype=np.int32),
162
+ Quantity(
163
+ 'rcut', rf'{re_n}Atom_Rcut +({re_f})', dtype=np.float64
164
+ ),
165
+ Quantity(
166
+ 'integration_grid',
167
+ rf'{re_n}Integration_Grid +(\S+)',
168
+ dtype=str,
169
+ ),
170
+ Quantity('aux_partition', rf'{re_n} +(\d+)', dtype=np.int32),
171
+ Quantity(
172
+ 'aux_density', rf'{re_n}Aux_Density +(\d+)', dtype=str
173
+ ),
174
+ Quantity(
175
+ 'charge', rf'{re_n}Charge +({re_f})', dtype=np.float64
176
+ ),
177
+ Quantity('symmetry', rf'{re_n}Symmetry +(\S+)', dtype=str),
178
+ Quantity(
179
+ 'mulliken_analysis',
180
+ rf'{re_n}Mulliken_Analysis +(\S+)',
181
+ dtype=str,
182
+ ),
183
+ Quantity(
184
+ 'hirshfeld_analysis',
185
+ rf'{re_n}Hirshfeld_Analysis +(\S+)',
186
+ dtype=str,
187
+ ),
188
+ Quantity(
189
+ 'partial_dos', rf'{re_n}Partial_Dos +(\S+)', dtype=str
190
+ ),
191
+ Quantity(
192
+ 'electrostatic_moments',
193
+ rf'{re_n}Electrostatic_Moments +(\S+)',
194
+ dtype=str,
195
+ ),
196
+ Quantity(
197
+ 'nuclear_efg', rf'{re_n}Nuclear_EFG +(\S+)', dtype=str
198
+ ),
199
+ Quantity(
200
+ 'optical_absorption',
201
+ rf'{re_n}Optical_Absorption +(\S+)',
202
+ dtype=str,
203
+ ),
204
+ Quantity('kpoints', rf'{re_n}Kpoints +(\S+)', dtype=str),
205
+ Quantity(
206
+ 'scf_density_convergence',
207
+ rf'{re_n}SCF_Density_Convergence +({re_f})',
208
+ dtype=np.float64,
209
+ ),
210
+ Quantity(
211
+ 'scf_spin_mixing',
212
+ rf'{re_n}SCF_Spin_Mixing +({re_f})',
213
+ dtype=np.float64,
214
+ ),
215
+ Quantity(
216
+ 'scf_charge_mixing',
217
+ rf'{re_n}SCF_Charge_Mixing +({re_f})',
218
+ dtype=np.float64,
219
+ ),
220
+ Quantity('scf_diis', rf'{re_n}SCF_DIIS +(\d+) +(\S+)'),
221
+ Quantity(
222
+ 'scf_iterations',
223
+ rf'{re_n}SCF_Iterations +(\d+)',
224
+ dtype=np.int32,
225
+ ),
226
+ Quantity(
227
+ 'scf_number_bad_steps',
228
+ rf'{re_n}SCF_Number_Bad_Steps +(\d+)',
229
+ dtype=np.int32,
230
+ ),
231
+ Quantity('scf_direct', rf'{re_n}SCF_Direct +(\S+)', dtype=str),
232
+ Quantity(
233
+ 'scf_restart', rf'{re_n}SCF_Restart +(\S+)', dtype=str
234
+ ),
235
+ Quantity(
236
+ 'occupation',
237
+ rf'{re_n}Occupation +(.+?) +<\-\-',
238
+ str_operation=lambda x: x.strip().split(),
239
+ ),
240
+ Quantity(
241
+ 'opt_energy_convergence',
242
+ rf'{re_n}OPT_Energy_Convergence +({re_f})',
243
+ dtype=np.float64,
244
+ ),
245
+ Quantity(
246
+ 'opt_gradient_convergence',
247
+ rf'{re_n}OPT_Gradient_Convergence +({re_f})',
248
+ dtype=np.float64,
249
+ ),
250
+ Quantity(
251
+ 'opt_displacement_convergence',
252
+ rf'{re_n}OPT_Displacement_Convergence +({re_f})',
253
+ dtype=np.float64,
254
+ ),
255
+ Quantity(
256
+ 'opt_iterations',
257
+ rf'{re_n}OPT_Iterations +(\d+)',
258
+ dtype=np.int32,
259
+ ),
260
+ Quantity(
261
+ 'opt_coordinate_system',
262
+ rf'{re_n}OPT_Coordinate_System +(\S+)',
263
+ dtype=str,
264
+ ),
265
+ Quantity('opt_gdiis', rf'{re_n}OPT_Gdiis +(\S+)', dtype=str),
266
+ Quantity(
267
+ 'opt_max_displacement',
268
+ rf'{re_n}OPT_Max_Displacement +({re_f})',
269
+ dtype=np.float64,
270
+ ),
271
+ Quantity(
272
+ 'opt_steep_tol',
273
+ rf'{re_n}OPT_Steep_Tol +({re_f})',
274
+ dtype=np.float64,
275
+ ),
276
+ Quantity(
277
+ 'opt_hessian_project',
278
+ rf'{re_n}OPT_Hessian_Project +(\S+)',
279
+ dtype=str,
280
+ ),
281
+ ]
282
+ ),
283
+ ),
284
+ Quantity(
285
+ 'optimization',
286
+ r'Entering Optimization Section \+\+\+([\s\S]+?)(?:\+\+\+|\Z)',
287
+ sub_parser=TextParser(
288
+ quantities=[
289
+ scf_quantity,
290
+ Quantity(
291
+ 'geometry',
292
+ r'Start Getting New Geometry([\s\S]+?)End Getting New Geometry',
293
+ repeats=True,
294
+ sub_parser=TextParser(
295
+ quantities=[
296
+ Quantity(
297
+ 'coordinates',
298
+ r'Input Coordinates \(Angstroms\)\s+\-+\s+ATOM +X +Y +Z\s+'
299
+ rf'((?:\d+ +[A-Z][a-z]* +{re_f} +{re_f} +{re_f}\s+)+)',
300
+ sub_parser=TextParser(
301
+ quantities=coordinates_quantities
302
+ ),
303
+ ),
304
+ Quantity(
305
+ 'tolerance',
306
+ rf'tolerance:\S+ +({re_f} +{re_f} +{re_f})',
307
+ dtype=np.dtype(np.float64),
308
+ ),
309
+ Quantity(
310
+ 'energy_gradient',
311
+ rf'opt\=\= +(\d+ +{re_f} +{re_f} +{re_f} +{re_f})',
312
+ dtype=np.dtype(np.float64),
313
+ ),
314
+ ]
315
+ ),
316
+ ),
317
+ ]
318
+ ),
319
+ ),
320
+ Quantity(
321
+ 'properties',
322
+ r'Entering Properties Section \+\+\+([\s\S]+?)(?:\+\+\+|\Z)',
323
+ sub_parser=TextParser(
324
+ quantities=[
325
+ Quantity(
326
+ 'hirschfeld',
327
+ rf'Charge partitioning by Hirshfeld method\:\s+((?:[A-Z][a-z]* +\d+ +charge +{re_f}\s+)+)',
328
+ sub_parser=TextParser(
329
+ quantities=[
330
+ Quantity(
331
+ 'label',
332
+ r'([A-Z][a-z]*)',
333
+ repeats=True,
334
+ dtype=str,
335
+ ),
336
+ Quantity(
337
+ 'charge',
338
+ rf'({re_f})',
339
+ repeats=True,
340
+ dtype=np.float64,
341
+ ),
342
+ ]
343
+ ),
344
+ ),
345
+ Quantity(
346
+ 'dipole_moment',
347
+ rf'dipole magnitude\:.+?({re_f}) debye',
348
+ dtype=np.float64,
349
+ ),
350
+ Quantity(
351
+ 'mulliken',
352
+ rf'Mulliken atomic charges\:\s*charge +spin\s+((?:[A-Z][a-z]*\([ \d]+\) +{re_f} +{re_f}\s+)+)',
353
+ sub_parser=TextParser(
354
+ quantities=[
355
+ Quantity(
356
+ 'charge',
357
+ rf'\) +({re_f})',
358
+ dtype=np.float64,
359
+ repeats=True,
360
+ ),
361
+ Quantity(
362
+ 'spin',
363
+ rf'({re_f}) *{re_n}',
364
+ dtype=np.float64,
365
+ repeats=True,
366
+ ),
367
+ ]
368
+ ),
369
+ ),
370
+ ]
371
+ ),
372
+ ),
373
+ Quantity(
374
+ 'vibrations',
375
+ r'Entering Vibrations Section \+\+\+([\s\S]+?)(?:\+\+\+|\Z)',
376
+ sub_parser=TextParser(
377
+ quantities=[
378
+ scf_quantity,
379
+ # TODO map it to scf
380
+ Quantity(
381
+ 'dipole_moment',
382
+ rf'dipole magnitude\:.+?({re_f}) debye',
383
+ dtype=np.float64,
384
+ repeats=True,
385
+ ),
386
+ Quantity(
387
+ 'vibrational_frequencies',
388
+ rf'vibrational frequencies, intensities\s+mode.+\s+((?:\d+ +{re_f} +{re_f} +{re_f}\s+)+)',
389
+ dtype=np.dtype(np.float64),
390
+ flatten=False,
391
+ str_operation=lambda x: [
392
+ v.split()[2] for v in x.strip().splitlines()
393
+ ],
394
+ unit=1 / ureg.cm,
395
+ ),
396
+ Quantity(
397
+ 'normal_modes',
398
+ r'Frequencies \(cm\-1\) and normal modes\s+.+\s+'
399
+ r'((?:[A-Z][a-z]* +x.+\s+y.+\s+z.+\s+)+)',
400
+ sub_parser=TextParser(
401
+ quantities=[
402
+ Quantity('label', r'([A-Z][a-z]*)', repeats=True),
403
+ Quantity(
404
+ 'value',
405
+ rf'(?:x|y|z) +({re_f}.+)',
406
+ repeats=True,
407
+ dtype=np.dtype(np.float64),
408
+ ),
409
+ ]
410
+ ),
411
+ ),
412
+ Quantity(
413
+ 'thermodynamic_quantities',
414
+ r'(STANDARD THERMODYNAMIC QUANTITIES AT[\s\S]+?G,Total\:.+)',
415
+ sub_parser=TextParser(
416
+ quantities=[
417
+ Quantity(
418
+ 'temperature',
419
+ rf'AT +({re_f}) K',
420
+ dtype=np.float64,
421
+ unit=ureg.kelvin,
422
+ ),
423
+ Quantity(
424
+ 'pressure',
425
+ rf'AND +({re_f}) ATM',
426
+ dtype=np.float64,
427
+ unit=ureg.atm,
428
+ ),
429
+ Quantity(
430
+ 'energy_zero_point',
431
+ rf'Zero point vibrational energy\: +({re_f}) kcal/mol',
432
+ dtype=np.float64,
433
+ ),
434
+ Quantity(
435
+ 'x_dmol3_h_trans',
436
+ rf'H,Trans *\: +({re_f}) kcal/mol',
437
+ dtype=np.float64,
438
+ ),
439
+ Quantity(
440
+ 'x_dmol3_h_rot',
441
+ rf'H,Rot *\: +({re_f}) kcal/mol',
442
+ dtype=np.float64,
443
+ ),
444
+ Quantity(
445
+ 'x_dmol3_h_pv',
446
+ rf'H,pV *\: +({re_f}) kcal/mol',
447
+ dtype=np.float64,
448
+ ),
449
+ Quantity(
450
+ 'x_dmol3_h_vib_minus_zpve',
451
+ rf'H,Vib \- ZPVE *\: +({re_f}) kcal/mol',
452
+ dtype=np.float64,
453
+ ),
454
+ Quantity(
455
+ 'x_dmol3_s_trans',
456
+ rf'S,Trans *\: +({re_f}) +cal/mol\.K',
457
+ dtype=np.float64,
458
+ ),
459
+ Quantity(
460
+ 'x_dmol3_s_rot',
461
+ rf'S,Rot *\: +({re_f}) +cal/mol\.K',
462
+ dtype=np.float64,
463
+ ),
464
+ Quantity(
465
+ 'x_dmol3_s_vib',
466
+ rf'S,Vib *\: +({re_f}) +cal/mol\.K',
467
+ dtype=np.float64,
468
+ ),
469
+ Quantity(
470
+ 'x_dmol3_c_trans',
471
+ rf'C,Trans *\: +({re_f}) +cal/mol\.K',
472
+ dtype=np.float64,
473
+ ),
474
+ Quantity(
475
+ 'x_dmol3_c_rot',
476
+ rf'C,Rot *\: +({re_f}) +cal/mol\.K',
477
+ dtype=np.float64,
478
+ ),
479
+ Quantity(
480
+ 'x_dmol3_c_vib',
481
+ rf'C,Vib *\: +({re_f}) +cal/mol\.K',
482
+ dtype=np.float64,
483
+ ),
484
+ Quantity(
485
+ 'x_dmol3_h_total_minus_zpve',
486
+ rf'H,Total \- ZPVE *\: +({re_f}) kcal/mol',
487
+ dtype=np.float64,
488
+ ),
489
+ Quantity(
490
+ 'x_dmol3_s_total',
491
+ rf'S,Total *\: +({re_f}) +cal/mol\.K',
492
+ dtype=np.float64,
493
+ ),
494
+ Quantity(
495
+ 'x_dmol3_c_total',
496
+ rf'C,Total \(p\) *\: +({re_f}) +cal/mol\.K',
497
+ dtype=np.float64,
498
+ ),
499
+ Quantity(
500
+ 'x_dmol3_g_total',
501
+ rf'G,Total *\: +({re_f}) +kcal/mol',
502
+ dtype=np.float64,
503
+ ),
504
+ ]
505
+ ),
506
+ ),
507
+ Quantity(
508
+ 'thermodynamic_quantities_steps',
509
+ r'T +Entropy +Heat_Capacity +Enthalpy +Free_Energy\s+'
510
+ rf'\(K\).+\s+.+\s+\_+\s+((?:\d+ +{re_f} +{re_f} +{re_f} +{re_f} +{re_f}\s+)+)',
511
+ flatten=False,
512
+ str_operation=lambda x: [
513
+ v.split() for v in x.strip().splitlines()
514
+ ],
515
+ dtype=np.dtype(np.float64),
516
+ ),
517
+ ]
518
+ ),
519
+ ),
520
+ ]
521
+
522
+ @property
523
+ def parameters(self):
524
+ return {
525
+ key: val
526
+ for key, val in self.get('simulation_parameters', {}).get('key_value', [])
527
+ }
528
+
529
+
530
+ class Dmol3Parser:
531
+ def __init__(self):
532
+ self.mainfile_parser = MainfileParser()
533
+
534
+ def parse(self, filepath, archive, logger):
535
+ self.filepath = os.path.abspath(filepath)
536
+ self.archive = archive
537
+ self.logger = logging.getLogger(__name__) if logger is None else logger
538
+
539
+ # initialize the parsers
540
+ self.mainfile_parser.logger = self.logger
541
+ self.mainfile_parser.mainfile = self.filepath
542
+
543
+ sec_run = Run()
544
+ archive.run.append(sec_run)
545
+ sec_run.program = Program(
546
+ version=self.mainfile_parser.get('program_version'),
547
+ x_dmol3_compilation_date=self.mainfile_parser.get(
548
+ 'x_dmol3_program_compilation_date'
549
+ ),
550
+ )
551
+
552
+ if self.mainfile_parser.date_start is not None:
553
+ date = datetime.strptime(
554
+ self.mainfile_parser.date_start, '%b %d %H:%M:%S %Y'
555
+ )
556
+ sec_run.time_run = TimeRun(date_start=date.timestamp())
557
+
558
+ # section method
559
+ sec_method = Method()
560
+ sec_run.method.append(sec_method)
561
+ # basis set
562
+ sec_method.electrons_representation = [
563
+ BasisSetContainer(
564
+ type='atom-centered orbitals',
565
+ scope=['wavefunction'],
566
+ basis_set=[
567
+ BasisSet(
568
+ type='numeric AOs',
569
+ scope=['full-electron'],
570
+ )
571
+ ],
572
+ )
573
+ ]
574
+ # simulation parameters
575
+ for key, val in self.mainfile_parser.simulation_parameters.items():
576
+ if key == 'scf_diis':
577
+ sec_method.x_dmol3_diis_number = val[0]
578
+ sec_method.x_dmol3_diis_name = val[1]
579
+ elif key == 'occupation':
580
+ sec_method.x_dmol3_occupation_name = val[0]
581
+ if len(val) > 1:
582
+ sec_method.x_dmol3_occupation_width = val[1]
583
+ else:
584
+ setattr(sec_method, f'x_dmol3_{key}', val)
585
+
586
+ def parse_system(source):
587
+ if source.coordinates is None:
588
+ return
589
+
590
+ sec_system = System()
591
+ sec_run.system.append(sec_system)
592
+ sec_system.atoms = Atoms(
593
+ labels=[v[0] for v in source.coordinates.get('labels_positions', [])],
594
+ positions=[
595
+ v[1:4] for v in source.coordinates.get('labels_positions', [])
596
+ ]
597
+ * ureg.bohr,
598
+ )
599
+ return sec_system
600
+
601
+ def parse_calculation(source, target=None):
602
+ if target is None:
603
+ target = Calculation()
604
+ sec_run.calculation.append(target)
605
+
606
+ # energies
607
+ time_initial = (
608
+ sec_run.calculation[-2].time_physical
609
+ if len(sec_run.calculation) > 1
610
+ else 0 * ureg.s
611
+ )
612
+ if source.final is not None:
613
+ target.energy = Energy(
614
+ total=EnergyEntry(value=source.final[0] * ureg.hartree),
615
+ x_dmol3_binding=EnergyEntry(value=source.energy_binding),
616
+ )
617
+ target.time_physical = source.final[-2] * ureg.minute
618
+ target.time_calculation = target.time_physical - time_initial
619
+
620
+ # scf iteration
621
+ for iteration in source.get('iteration', []):
622
+ time_initial = (
623
+ target.scf_iteration[-1].time_physical
624
+ if target.scf_iteration
625
+ else time_initial
626
+ )
627
+ sec_scf = ScfIteration()
628
+ target.scf_iteration.append(sec_scf)
629
+ sec_scf.energy = Energy(
630
+ total=EnergyEntry(value=iteration[0] * ureg.hartree),
631
+ x_dmol3_binding=EnergyEntry(value=iteration[1] * ureg.hartree),
632
+ )
633
+ sec_scf.time_physical = iteration[-2] * ureg.minute
634
+ sec_scf.time_calculation = sec_scf.time_physical - time_initial
635
+ # add energies data from last scf step
636
+ if source.iteration:
637
+ target.energy.x_dmol3_binding = sec_scf.energy.x_dmol3_binding
638
+
639
+ # eigenvalues
640
+ if source.eigenvalues is not None:
641
+ sec_eigenvalues = BandEnergies()
642
+ target.eigenvalues.append(sec_eigenvalues)
643
+ # TODO handle number of kpoints
644
+ energies = [e[0] for e in source.eigenvalues]
645
+ # index 1 is energies in eV
646
+ occupations = [e[2] for e in source.eigenvalues]
647
+ spin = 1 if occupations[0][0] > 1 else 2
648
+ shape = (spin, len(energies), len(energies[0]))
649
+ sec_eigenvalues.energies = np.reshape(energies, shape) * ureg.hartree
650
+ sec_eigenvalues.occupations = np.reshape(occupations, shape)
651
+
652
+ # population analysis
653
+ for method in ['hirschfeld', 'mulliken']:
654
+ population = source.get(method)
655
+ if population is None:
656
+ continue
657
+ sec_charges = Charges()
658
+ target.charges.append(sec_charges)
659
+ sec_charges.analysis_method = method
660
+ if population.charge is not None:
661
+ sec_charges.value = population.charge * ureg.elementary_charge
662
+ if population.spin is not None:
663
+ sec_charges.spins = population.spin
664
+
665
+ # dipole momentp
666
+ if source.dipole_moment is not None:
667
+ sec_multipole = Multipoles()
668
+ target.multipoles.append(sec_multipole)
669
+ sec_multipole.dipole = MultipolesEntry(
670
+ total=[source.dipole_moment]
671
+ if isinstance(source.dipole_moment, float)
672
+ else source.dipole_moment
673
+ )
674
+
675
+ # vibrational frequencies
676
+ if source.vibrational_frequencies is not None:
677
+ sec_vibrations = VibrationalFrequencies()
678
+ target.vibrational_frequencies.append(sec_vibrations)
679
+ sec_vibrations.value = source.vibrational_frequencies
680
+ # normal modes
681
+ if source.normal_modes is not None:
682
+ value = source.normal_modes.value
683
+ n_atoms = len(source.normal_modes.label)
684
+ sec_vibrations.x_dmol3_normal_modes = np.transpose(
685
+ np.reshape(value, (n_atoms, 3, len(value[0]))), axes=(2, 0, 1)
686
+ )
687
+
688
+ # thermodynamics quantities
689
+ if source.thermodynamic_quantities is not None:
690
+ for key, val in source.thermodynamic_quantities.items():
691
+ if key == 'energy_zero_point':
692
+ target.energy.zero_point = EnergyEntry(
693
+ value=source.thermodynamic_quantities.energy_zero_point
694
+ * ureg.J
695
+ * 4184.0
696
+ / MOL
697
+ )
698
+ else:
699
+ setattr(target, key, val)
700
+
701
+ return target
702
+
703
+ # TODO put workflows into separate archives
704
+ workflow = None
705
+ if self.mainfile_parser.optimization is not None:
706
+ for scf in self.mainfile_parser.optimization.get('scf', []):
707
+ sec_system = parse_system(scf)
708
+ sec_calc = parse_calculation(scf)
709
+ sec_calc.system_ref = sec_system
710
+ workflow = GeometryOptimization(method=GeometryOptimizationMethod())
711
+ tolerance = self.mainfile_parser.optimization.get('geometry', [{}])[0].get(
712
+ 'tolerance', [0, 0, 0]
713
+ )
714
+ workflow.method.convergence_tolerance_energy_difference = (
715
+ tolerance[0] * ureg.hartree
716
+ )
717
+ workflow.method.convergence_tolerance_force_maximum = (
718
+ tolerance[1] * ureg.hartree / ureg.bohr
719
+ )
720
+ workflow.method.convergence_tolerance_displacement_maximum = (
721
+ tolerance[2] * ureg.bohr
722
+ )
723
+
724
+ if self.mainfile_parser.properties is not None:
725
+ parse_calculation(self.mainfile_parser.properties, sec_run.calculation[-1])
726
+
727
+ if self.mainfile_parser.vibrations is not None:
728
+ workflow = Thermodynamics(results=ThermodynamicsResults())
729
+ for scf in self.mainfile_parser.vibrations.get('scf', []):
730
+ sec_system = parse_system(scf)
731
+ sec_calc = parse_calculation(scf)
732
+ sec_calc.system_ref = sec_system
733
+ parse_calculation(self.mainfile_parser.vibrations, sec_calc)
734
+ # thermodynamics workflow
735
+ thermo_data = self.mainfile_parser.vibrations.thermodynamic_quantities_steps
736
+ if thermo_data is not None:
737
+ thermo_data = np.transpose(thermo_data)
738
+ # calorie is not a ureg unit
739
+ workflow.results.temperature = thermo_data[1]
740
+ workflow.results.entropy = (
741
+ thermo_data[2] * ureg.J * 4.184 / ureg.K / MOL
742
+ )
743
+ workflow.results.heat_capacity_c_p = (
744
+ thermo_data[3] * ureg.J * 4.184 / ureg.K / MOL
745
+ )
746
+ workflow.results.enthalpy = thermo_data[4] * ureg.J * 4184.0 / MOL
747
+ workflow.results.gibbs_free_energy = (
748
+ thermo_data[5] * ureg.J * 4184.0 / MOL
749
+ )
750
+ archive.workflow2 = workflow