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,1371 @@
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 logging
21
+ import numpy as np
22
+
23
+ from nomad.units import ureg
24
+ from nomad.parsing.file_parser import TextParser, Quantity
25
+
26
+ from runschema.run import Run, Program
27
+ from runschema.method import (
28
+ Electronic,
29
+ Method,
30
+ BasisSet,
31
+ DFT,
32
+ XCFunctional,
33
+ Functional,
34
+ BasisSetContainer,
35
+ Scf,
36
+ )
37
+ from runschema.system import System, Atoms
38
+ from runschema.calculation import (
39
+ Calculation,
40
+ Energy,
41
+ EnergyEntry,
42
+ ScfIteration,
43
+ BandEnergies,
44
+ Charges,
45
+ ChargesValue,
46
+ Spectra,
47
+ )
48
+ from simulationworkflowschema import GeometryOptimization, GeometryOptimizationMethod
49
+
50
+ re_n = r'\r*\n'
51
+
52
+
53
+ class OutParser(TextParser):
54
+ def __init__(self):
55
+ super().__init__()
56
+
57
+ def init_quantities(self):
58
+ re_float = r'[-+]?\d+\.?\d*(?:[Ee][-+]\d+)?'
59
+
60
+ self._energy_mapping = {
61
+ 'Total Energy': 'energy_total',
62
+ 'Nuclear Repulsion': 'energy_nuclear_repulsion',
63
+ 'Electronic Energy': 'elec_energy',
64
+ 'One Electron Energy': 'one_elec_energy',
65
+ 'Two Electron Energy': 'two_elec_energy',
66
+ 'Potential Energy': 'potential_energy',
67
+ 'Kinetic Energy': 'energy_kinetic_electronic',
68
+ r'E\(X\)': 'energy_exchange',
69
+ r'E\(C\)': 'energy_correlation',
70
+ r'E\(XC\)': 'energy_XC',
71
+ }
72
+
73
+ self._timing_mapping = {
74
+ 'Total time': 'final_time',
75
+ 'Sum of individual times': 'sum_individual_times',
76
+ 'Fock matrix formation': 'fock_matrix_formation',
77
+ 'Coulomb formation': 'coulomb_formation',
78
+ r'Split\-RI-J': 'split_rj',
79
+ 'XC integration': 'xc_integration',
80
+ r'Basis function eval\.': 'basis_fn_evaluation',
81
+ r'Density eval\.': 'density_evaluation',
82
+ r'XC\-Functional eval\.': 'xc_functional_evaluation',
83
+ r'XC\-Potential eval\.': 'potential_evaluation',
84
+ 'Diagonalization': 'diagonalization',
85
+ 'Density matrix formation': 'density_matrix_formation',
86
+ 'Population analysis': 'population_analysis',
87
+ 'Initial guess': 'initial_guess',
88
+ 'Orbital Transformation': 'orbital_transformation',
89
+ 'Orbital Orthonormalization': 'orbital_orthonormalization',
90
+ 'DIIS solution': 'diis_solution',
91
+ 'Grid generation': 'grid_generation',
92
+ 'Total SCF gradient time': 'scf_gradient',
93
+ }
94
+
95
+ def str_to_cartesian_coordinates(val_in):
96
+ val = [v.split() for v in val_in.strip().split('\n')]
97
+ symbols = [v[0][:2] for v in val]
98
+ coordinates = np.array([v[1:4] for v in val], dtype=float)
99
+ return symbols, coordinates * ureg.angstrom
100
+
101
+ basis_set_quantities = [
102
+ Quantity('basis_set_atom_labels', r'Type\s*(\w+)', repeats=True),
103
+ Quantity('basis_set', r':\s*(\w+)\s*contracted\s*to', repeats=True),
104
+ Quantity('basis_set_contracted', r'(\w+)\s*pattern', repeats=True),
105
+ ]
106
+
107
+ basis_set_statistics_quantities = [
108
+ Quantity(
109
+ 'nb_of_primitive_gaussian_shells',
110
+ r'# of primitive gaussian shells\s*\.+\s*(\d+)',
111
+ repeats=True,
112
+ dtype=int,
113
+ ),
114
+ Quantity(
115
+ 'nb_of_primitive_gaussian_functions',
116
+ r'# of primitive gaussian functions\s*\.+\s*(\d+)',
117
+ repeats=True,
118
+ dtype=int,
119
+ ),
120
+ Quantity(
121
+ 'nb_of_contracted_shells',
122
+ r'# of contracted shells\s*\.+\s*(\d+)',
123
+ repeats=True,
124
+ dtype=int,
125
+ ),
126
+ Quantity(
127
+ 'nb_of_contracted_basis_functions',
128
+ r'# of contracted (?:aux-)?basis functions\s*\.+\s*(\d+)',
129
+ repeats=True,
130
+ dtype=int,
131
+ ),
132
+ Quantity(
133
+ 'highest_angular_moment',
134
+ r'Highest angular momentum\s*\.+\s*(\d+)',
135
+ repeats=True,
136
+ dtype=int,
137
+ ),
138
+ Quantity(
139
+ 'maximum_contraction_depth',
140
+ r'Maximum contraction depth\s*\.+\s*(\d+)',
141
+ repeats=True,
142
+ dtype=int,
143
+ ),
144
+ ]
145
+
146
+ grid_quantities = [
147
+ Quantity(
148
+ 'gral_integ_accuracy',
149
+ rf'General Integration Accuracy\s*IntAcc\s*\.+\s*({re_float})',
150
+ dtype=float,
151
+ ),
152
+ Quantity(
153
+ 'radial_grid_type',
154
+ r'Radial Grid Type\s*RadialGrid\s*\.+\s*(\S+)',
155
+ convert=False,
156
+ ),
157
+ Quantity(
158
+ 'angular_grid',
159
+ r'Angular Grid \(max\. acc\.\)\s*AngularGrid\s*\.+\s*(\S+)',
160
+ convert=False,
161
+ ),
162
+ Quantity(
163
+ 'grid_pruning_method',
164
+ r'Angular grid pruning method\s*GridPruning\s*\.+\s*(.+)',
165
+ flatten=False,
166
+ convert=False,
167
+ ),
168
+ Quantity(
169
+ 'weight_gener_scheme',
170
+ r'Weight generation scheme\s*WeightScheme\s*\.+\s*(\w+)',
171
+ convert=False,
172
+ ),
173
+ Quantity(
174
+ 'basis_fn_cutoff',
175
+ rf'Basis function cutoff\s*BFCut\s*\.+\s*({re_float})',
176
+ dtype=float,
177
+ ),
178
+ Quantity(
179
+ 'integr_weight_cutoff',
180
+ rf'Integration weight cutoff\s*WCut\s*\.+\s*({re_float})',
181
+ dtype=float,
182
+ ),
183
+ Quantity(
184
+ 'nb_grid_pts_after_initial_pruning',
185
+ r'# of grid points \(after initial pruning\)\s*\.+\s*(\d+)',
186
+ dtype=int,
187
+ ),
188
+ Quantity(
189
+ 'nb_grid_pts_after_weights_screening',
190
+ r'# of grid points \(after weights\+screening\)\s*\.+\s*(\d+)',
191
+ dtype=int,
192
+ ),
193
+ Quantity(
194
+ 'total_nb_grid_pts',
195
+ r'Total number of grid points\s*\.+\s*(\d+)',
196
+ dtype=int,
197
+ ),
198
+ Quantity(
199
+ 'total_nb_batches', r'Total number of batches\s*\.+\s*(\d+)', dtype=int
200
+ ),
201
+ Quantity(
202
+ 'avg_nb_points_per_batch',
203
+ r'Average number of points per batch\s*\.+\s*(\d+)',
204
+ dtype=int,
205
+ ),
206
+ Quantity(
207
+ 'avg_nb_grid_pts_per_atom',
208
+ r'Average number of grid points per atom\s*\.+\s*(\d+)',
209
+ dtype=int,
210
+ ),
211
+ ]
212
+
213
+ scf_convergence_quantities = [
214
+ Quantity(
215
+ name.lower().replace(' ', '_').replace('-', '_'),
216
+ rf'%s\s*\.+\s*({re_float})\s* Tolerance :\s*({re_float})' % name,
217
+ dtype=float,
218
+ )
219
+ for name in [
220
+ 'Last Energy change',
221
+ 'Last MAX-Density change',
222
+ 'Last RMS-Density change',
223
+ ]
224
+ ]
225
+
226
+ population_quantities = [
227
+ Quantity(
228
+ 'atomic_charges',
229
+ r'[A-Z]+ ATOMIC CHARGES.*\n\-+([\s\S]+?)\-{10}',
230
+ sub_parser=TextParser(
231
+ quantities=[
232
+ Quantity('species', r'\n *\d+\s*(\w+)', repeats=True),
233
+ Quantity(
234
+ 'charge', rf':\s*({re_float})', repeats=True, dtype=float
235
+ ),
236
+ Quantity(
237
+ 'total_charge',
238
+ rf'Sum of atomic charges\s*:\s*({re_float})',
239
+ dtype=float,
240
+ ),
241
+ ]
242
+ ),
243
+ ),
244
+ Quantity(
245
+ 'orbital_charges',
246
+ rf'[A-Z]+ REDUCED ORBITAL CHARGES.*\s*\-+([\s\S]+?{re_n}{re_n})',
247
+ sub_parser=TextParser(
248
+ quantities=[
249
+ Quantity(
250
+ 'atom',
251
+ r'([A-Z][a-z]?\s*[spdf][\s\S]+?)\n *(?:\d|\Z)',
252
+ repeats=True,
253
+ sub_parser=TextParser(
254
+ quantities=[
255
+ Quantity(
256
+ 'species', r'([A-Z][a-z]?)', convert=False
257
+ ),
258
+ Quantity(
259
+ 'charge',
260
+ rf'([spdf]\S*)\s*:\s*({re_float})',
261
+ repeats=True,
262
+ ),
263
+ ]
264
+ ),
265
+ )
266
+ ]
267
+ ),
268
+ ),
269
+ ]
270
+
271
+ self_consistent_quantities = [
272
+ Quantity(
273
+ 'scf_settings',
274
+ r'SCF SETTINGS\s*\-+([\s\S]+?)\-{10}',
275
+ sub_parser=TextParser(
276
+ quantities=[
277
+ Quantity(
278
+ 'XC_functional_type',
279
+ r'Ab initio Hamiltonian\s*Method\s*\.+\s*(\S+)',
280
+ convert=False,
281
+ ),
282
+ Quantity(
283
+ 'XC_functional_type',
284
+ r'Density Functional\s*Method\s*\.+\s*(\S+)',
285
+ convert=False,
286
+ ),
287
+ Quantity(
288
+ 'exchange_functional',
289
+ r'Exchange Functional\s*Exchange\s*\.+\s*(\S+)',
290
+ convert=False,
291
+ ),
292
+ Quantity(
293
+ 'xalpha_param',
294
+ rf'X-Alpha parameter\s*XAlpha\s*\.+\s*({re_float})',
295
+ dtype=float,
296
+ ),
297
+ Quantity(
298
+ 'beckes_beta_param',
299
+ rf'Becke\'s b parameter\s*XBeta\s*\.+\s*({re_float})',
300
+ dtype=float,
301
+ ),
302
+ Quantity(
303
+ 'correl_functional',
304
+ r'Correlation Functional Correlation\s*\.+\s*(\S+)',
305
+ convert=False,
306
+ ),
307
+ Quantity(
308
+ 'lda_part_of_gga_corr',
309
+ r'LDA part of GGA corr\.\s*LDAOpt\s*\.+\s*(\S+)',
310
+ convert=False,
311
+ ),
312
+ Quantity(
313
+ 'scalar_relativistic_method',
314
+ r'Scalar relativistic method\s*\.+\s*(\w+)',
315
+ convert=False,
316
+ ),
317
+ Quantity(
318
+ 'speed_of_light_used',
319
+ rf'Speed of light used\s*Velit\s*\.+\s*({re_float})',
320
+ dtype=float,
321
+ ),
322
+ Quantity(
323
+ 'hf_type',
324
+ r'Hartree-Fock type\s*HFTyp\s*\.+\s*(\w+)',
325
+ convert=False,
326
+ ),
327
+ Quantity(
328
+ 'total_charge',
329
+ rf'Total Charge\s*Charge\s*\.+\s*({re_float})',
330
+ dtype=float,
331
+ ),
332
+ Quantity(
333
+ 'multiplicity',
334
+ rf'Multiplicity\s*Mult\s*\.+\s*({re_float})',
335
+ dtype=float,
336
+ ),
337
+ Quantity(
338
+ 'nelectrons',
339
+ rf'Number of Electrons\s*NEL\s*\.+\s*({re_float})',
340
+ dtype=float,
341
+ ),
342
+ Quantity(
343
+ 'nuclear_repulsion',
344
+ rf'Nuclear Repulsion\s*ENuc\s*\.+\s*({re_float})',
345
+ dtype=float,
346
+ unit=ureg.hartree,
347
+ ),
348
+ Quantity(
349
+ 'convergence_check_mode',
350
+ r'Convergence Check Mode ConvCheckMode\s*\.+\s*(\S+)',
351
+ convert=False,
352
+ ),
353
+ Quantity(
354
+ 'energy_change_tolerance',
355
+ rf'Energy Change\s*TolE\s*\.+\s*({re_float})',
356
+ dtype=float,
357
+ unit=ureg.hartree,
358
+ ),
359
+ Quantity(
360
+ '1_elect_energy_change',
361
+ rf'1\-El\. energy change\s*\.+\s*({re_float})',
362
+ dtype=float,
363
+ ),
364
+ ]
365
+ ),
366
+ ),
367
+ Quantity(
368
+ 'dft_grid_generation',
369
+ r'DFT GRID GENERATION\s*\-+([\s\S]+?\-{10})',
370
+ sub_parser=TextParser(quantities=grid_quantities),
371
+ ),
372
+ Quantity(
373
+ 'scf_iterations',
374
+ r'SCF ITERATIONS\s*\-+([\s\S]+?)\*{10}',
375
+ sub_parser=TextParser(
376
+ quantities=[
377
+ Quantity(
378
+ 'energy',
379
+ rf'\n *\d+\s*({re_float})\s*{re_float}',
380
+ repeats=True,
381
+ dtype=float,
382
+ unit=ureg.hartree,
383
+ )
384
+ ]
385
+ ),
386
+ ),
387
+ Quantity(
388
+ 'final_grid',
389
+ r'Setting up the final grid:([\s\S]+?)\-{10}',
390
+ sub_parser=TextParser(quantities=grid_quantities),
391
+ ),
392
+ Quantity(
393
+ 'total_scf_energy',
394
+ r'TOTAL SCF ENERGY\s*\-+([\s\S]+?)\-{10}',
395
+ sub_parser=TextParser(
396
+ quantities=[
397
+ Quantity(
398
+ name,
399
+ rf'%s\s*:\s*({re_float})' % key,
400
+ dtype=float,
401
+ unit=ureg.hartree,
402
+ )
403
+ for key, name in self._energy_mapping.items()
404
+ ]
405
+ + [
406
+ Quantity(
407
+ 'virial_ratio',
408
+ rf'Virial Ratio\s*:\s*({re_float})',
409
+ dtype=float,
410
+ ),
411
+ Quantity(
412
+ 'nb_elect_alpha_channel',
413
+ rf'N\(Alpha\)\s*:\s*({re_float})',
414
+ dtype=float,
415
+ ),
416
+ Quantity(
417
+ 'nb_elect_beta_channel',
418
+ rf'N\(Beta\)\s*:\s*({re_float})',
419
+ dtype=float,
420
+ ),
421
+ Quantity(
422
+ 'nb_elect_total',
423
+ rf'N\(Total\)\s*:\s*({re_float})',
424
+ dtype=float,
425
+ ),
426
+ ]
427
+ ),
428
+ ),
429
+ Quantity(
430
+ 'scf_convergence',
431
+ r'SCF CONVERGENCE\s*\-+([\s\S]+?)\-{10}',
432
+ sub_parser=TextParser(quantities=scf_convergence_quantities),
433
+ ),
434
+ Quantity(
435
+ 'orbital_energies',
436
+ rf'NO\s*OCC\s*E\(Eh\)\s*E\(eV\)\s*([\s\S]+?){re_n}{re_n}',
437
+ str_operation=lambda x: np.array(
438
+ [v.split()[:4] for v in x.split('\n')], dtype=float
439
+ ),
440
+ repeats=True,
441
+ ),
442
+ Quantity(
443
+ 'mulliken',
444
+ r'MULLIKEN POPULATION ANALYSIS \*\s*\*+([\s\S]+?)\*{10}',
445
+ sub_parser=TextParser(quantities=population_quantities),
446
+ ),
447
+ Quantity(
448
+ 'timings',
449
+ r'\n *TIMINGS\s*\-+\s*([\s\S]+?)\-{10}',
450
+ sub_parser=TextParser(
451
+ quantities=[
452
+ Quantity(
453
+ name,
454
+ rf'%s\s*\.+\s*({re_float})' % key,
455
+ dtype=float,
456
+ unit=ureg.s,
457
+ )
458
+ for key, name in self._timing_mapping.items()
459
+ ]
460
+ ),
461
+ ),
462
+ Quantity(
463
+ 'time_calculation',
464
+ r'Total SCF time\: (\d+) days (\d+) hours (\d+) min (\d+) sec ',
465
+ dytpe=np.dtype(np.float64),
466
+ ),
467
+ ]
468
+
469
+ # TODO parse more properties, add to metainfo
470
+ tddft_quantities = [
471
+ Quantity(
472
+ 'absorption_spectrum_electric',
473
+ r'ABSORPTION SPECTRUM VIA TRANSITION ELECTRIC DIPOLE MOMENTS\s*'
474
+ r'\-+[\s\S]+?\-+\n([\s\S]+?)\-{10}',
475
+ str_operation=lambda x: [v.split() for v in x.strip().split('\n')],
476
+ )
477
+ ]
478
+
479
+ # TODO parse more properties, add to metainfo
480
+ mp2_quantities = [
481
+ Quantity(
482
+ 'mp2_basis_dimension',
483
+ r'Dimension of the basis\s*\.+\s*(\d+)',
484
+ dtype=int,
485
+ ),
486
+ Quantity(
487
+ 'scaling_mp2_energy',
488
+ rf'Overall scaling of the MP2 energy\s*\.+\s*({re_float})',
489
+ dtype=float,
490
+ ),
491
+ Quantity(
492
+ 'mp2_aux_basis_dimension',
493
+ r'Dimension of the aux\-basis\s*\.+\s*(\d+)',
494
+ dtype=int,
495
+ ),
496
+ Quantity(
497
+ 'energy_method_current',
498
+ rf'RI\-MP2 CORRELATION ENERGY:\s*({re_float})',
499
+ dtype=float,
500
+ unit=ureg.hartree,
501
+ ),
502
+ Quantity(
503
+ 'energy_total',
504
+ rf'MP2 TOTAL ENERGY:\s*({re_float})',
505
+ dtype=float,
506
+ unit=ureg.hartree,
507
+ ),
508
+ ]
509
+
510
+ def str_to_iteration_energy(val_in):
511
+ val = [v.split() for v in val_in.strip().split('\n')]
512
+ keys = val[0]
513
+ val = np.transpose(
514
+ np.array([v for v in val[1:] if len(v) == len(keys)], dtype=float)
515
+ )
516
+ return {keys[i]: val[i] for i in range(len(keys))}
517
+
518
+ ci_quantities = [
519
+ Quantity(
520
+ 'electronic_structure_method',
521
+ r'Correlation treatment\s*\.+\s*(\S+)',
522
+ convert=False,
523
+ ),
524
+ Quantity(
525
+ 'single_excitations_on_off',
526
+ r'Single excitations\s*\.+\s*(\S+)',
527
+ convert=False,
528
+ ),
529
+ Quantity(
530
+ 'orbital_opt_on_off',
531
+ r'Orbital optimization\s*\.+\s*(\S+)',
532
+ convert=False,
533
+ ),
534
+ Quantity(
535
+ 'z_vector_calc_on_off',
536
+ r'Calculation of Z vector\s*\.+\s*(\S+)',
537
+ convert=False,
538
+ ),
539
+ Quantity(
540
+ 'Brueckner_orbitals_calc_on_off',
541
+ r'Calculation of Brueckner orbitals\s*\.+\s*(\S+)',
542
+ convert=False,
543
+ ),
544
+ Quantity(
545
+ 'perturbative_triple_excitations_on_off',
546
+ r'Perturbative triple excitations\s*\.+\s*(\S+)',
547
+ convert=False,
548
+ ),
549
+ Quantity(
550
+ 'f12_correction_on_off',
551
+ r'Calculation of F12 correction\s*\.+\s*(\S+)',
552
+ convert=False,
553
+ ),
554
+ Quantity(
555
+ 'frozen_core_treatment',
556
+ r'Frozen core treatment\s*\.+\s*(.+)',
557
+ flatten=False,
558
+ convert=False,
559
+ ),
560
+ Quantity(
561
+ 'reference_wave_function',
562
+ r'Reference Wavefunction\s*\.+\s*(.+)',
563
+ flatten=False,
564
+ convert=False,
565
+ ),
566
+ Quantity(
567
+ 'nb_of_atomic_orbitals', r'Number of AO\'s\s*\.+\s*(\d+)', dtype=int
568
+ ),
569
+ Quantity(
570
+ 'nb_of_electrons', r'Number of electrons\s*\.+\s*(\d+)', dtype=int
571
+ ),
572
+ Quantity(
573
+ 'nb_of_correlated_electrons',
574
+ r'Number of correlated electrons\s*\.+\s*(\d+)',
575
+ dtype=int,
576
+ ),
577
+ Quantity(
578
+ 'integral_transformation',
579
+ r'Integral transformation\s*\.+\s*(.+)',
580
+ flatten=False,
581
+ convert=False,
582
+ ),
583
+ Quantity(
584
+ 'level_shift_amplitude_update',
585
+ rf'Level shift for amplitude update\s*\.+\s*({re_float})',
586
+ dtype=float,
587
+ ),
588
+ Quantity(
589
+ 'coulomb_transformation_type',
590
+ r'Transformation type\s*\.+\s*(.+)',
591
+ flatten=False,
592
+ convert=False,
593
+ ),
594
+ Quantity(
595
+ 'coulomb_transformation_dimension_basis',
596
+ r'Dimension of the basis\s*\.+\s*(\d+)',
597
+ dtype=int,
598
+ ),
599
+ Quantity(
600
+ 'nb_internal_alpha_mol_orbitals',
601
+ r'Number of internal alpha\-MOs\s*\.+\s*(\d+)',
602
+ dtype=int,
603
+ ),
604
+ Quantity(
605
+ 'nb_internal_beta_mol_orbitals',
606
+ r'Number of internal beta\-MOs\s*\.+\s*(\d+)',
607
+ dtype=int,
608
+ ),
609
+ Quantity('pair_cutoff', rf'Pair cutoff\s*\.+\s*({re_float})', dtype=float),
610
+ Quantity(
611
+ 'atomic_orbital_integral_source',
612
+ r'AO\-integral source\s*\.+\s*(.+)',
613
+ flatten=False,
614
+ convert=False,
615
+ ),
616
+ Quantity(
617
+ 'integral_package_used',
618
+ r'Integral package used\s*\.+\s*(.+)',
619
+ flatten=False,
620
+ convert=False,
621
+ ),
622
+ Quantity(
623
+ 'nb_alpha_pairs_included',
624
+ r'Number of Alpha\-MO pairs included\s*\.+\s*(\d+)',
625
+ dtype=int,
626
+ ),
627
+ Quantity(
628
+ 'nb_beta_pairs_included',
629
+ r'Number of Beta\-MO pairs included\s*\.+\s*(\d+)',
630
+ dtype=int,
631
+ ),
632
+ Quantity(
633
+ 'mp2_energy_spin_aa',
634
+ rf'EMP2\(aa\)=\s*({re_float})',
635
+ dtype=float,
636
+ unit=ureg.hartree,
637
+ ),
638
+ Quantity(
639
+ 'mp2_energy_spin_bb',
640
+ rf'EMP2\(bb\)=\s*({re_float})',
641
+ dtype=float,
642
+ unit=ureg.hartree,
643
+ ),
644
+ Quantity(
645
+ 'mp2_energy_spin_ab',
646
+ rf'EMP2\(ab\)=\s*({re_float})',
647
+ dtype=float,
648
+ unit=ureg.hartree,
649
+ ),
650
+ Quantity(
651
+ 'mp2_initial_guess',
652
+ rf'E\(0\)\s*\.+\s*({re_float})',
653
+ dtype=float,
654
+ unit=ureg.hartree,
655
+ ),
656
+ Quantity(
657
+ 'mp2_energy',
658
+ rf'E\(MP2\)\s*\.+\s*({re_float})',
659
+ dtype=float,
660
+ unit=ureg.hartree,
661
+ ),
662
+ Quantity(
663
+ 'mp2_total_energy',
664
+ rf'Initial E\(tot\)\s*\.+\s*({re_float})',
665
+ dtype=float,
666
+ unit=ureg.hartree,
667
+ ),
668
+ Quantity(
669
+ 'T_and_T_energy',
670
+ rf'<T\|T>\s*\.+\s*({re_float})',
671
+ dtype=float,
672
+ unit=ureg.hartree,
673
+ ),
674
+ Quantity(
675
+ 'total_nb_pairs_included',
676
+ r'Number of pairs included\s*\.+\s*(\d+)',
677
+ dtype=int,
678
+ ),
679
+ Quantity(
680
+ 'iteration_energy',
681
+ r'(Iter\s*E\(tot\)[\s\S]+?)\-{3}',
682
+ str_operation=str_to_iteration_energy,
683
+ convert=False,
684
+ ),
685
+ Quantity(
686
+ 'ccsd_correlation_energy',
687
+ rf'E\(CORR\)\s*\.+\s*({re_float})',
688
+ dtype=float,
689
+ unit=ureg.hartree,
690
+ ),
691
+ Quantity(
692
+ 'ccsd_total_energy',
693
+ rf'E\(TOT\)\s*\.+\s*({re_float})',
694
+ dtype=float,
695
+ unit=ureg.hartree,
696
+ ),
697
+ Quantity(
698
+ 'single_norm_half_ss',
699
+ rf'Singles Norm <S\|S>\*\*1/2\s*\.+\s*({re_float})',
700
+ dtype=float,
701
+ unit=ureg.hartree,
702
+ ),
703
+ Quantity(
704
+ 't1_diagnostic',
705
+ rf'T1 diagnostic\s*\.+\s*({re_float})',
706
+ dtype=float,
707
+ unit=ureg.hartree,
708
+ ),
709
+ Quantity(
710
+ 'ccsdt_total_triples_correction',
711
+ rf'Triples Correction \(T\)\s*\.+\s*({re_float})',
712
+ dtype=float,
713
+ unit=ureg.hartree,
714
+ ),
715
+ Quantity(
716
+ 'ccsdt_aaa_triples_contribution',
717
+ rf'alpha\-alpha\-alpha\s*\.+\s*({re_float})',
718
+ dtype=float,
719
+ unit=ureg.hartree,
720
+ ),
721
+ Quantity(
722
+ 'ccsdt_aab_triples_contribution',
723
+ rf'alpha\-alpha\-beta\s*\.+\s*({re_float})',
724
+ dtype=float,
725
+ unit=ureg.hartree,
726
+ ),
727
+ # typo in metainfo?
728
+ Quantity(
729
+ 'ccsdt_aba_triples_contribution',
730
+ rf'alpha\-beta\-beta\s*\.+\s*({re_float})',
731
+ dtype=float,
732
+ unit=ureg.hartree,
733
+ ),
734
+ Quantity(
735
+ 'ccsdt_bbb_triples_contribution',
736
+ rf'beta\-beta\-beta\s*\.+\s*({re_float})',
737
+ dtype=float,
738
+ unit=ureg.hartree,
739
+ ),
740
+ Quantity(
741
+ 'ccsdt_final_corr_energy',
742
+ rf'Final correlation energy\s*\.+\s*({re_float})',
743
+ dtype=float,
744
+ unit=ureg.hartree,
745
+ ),
746
+ Quantity(
747
+ 'ccsd_final_energy',
748
+ rf'E\(CCSD\)\s*\.+\s*({re_float})',
749
+ dtype=float,
750
+ unit=ureg.hartree,
751
+ ),
752
+ Quantity(
753
+ 'energy_total',
754
+ rf'E\(CCSD\(T\)\)\s*\.+\s*({re_float})',
755
+ dtype=float,
756
+ unit=ureg.hartree,
757
+ ),
758
+ ]
759
+
760
+ calculation_quantities = [
761
+ Quantity(
762
+ 'cartesian_coordinates',
763
+ rf'CARTESIAN COORDINATES \(ANGSTROEM\)\s*\-+\s*([\s\S]+?){re_n}{re_n}',
764
+ str_operation=str_to_cartesian_coordinates,
765
+ ),
766
+ Quantity(
767
+ 'basis_set',
768
+ r'\n *BASIS SET INFORMATION\s*\-+([\s\S]+?)\-{10}',
769
+ sub_parser=TextParser(quantities=basis_set_quantities),
770
+ ),
771
+ Quantity(
772
+ 'auxiliary_basis_set',
773
+ r'\n *AUXILIARY BASIS SET INFORMATION\s*\-+([\s\S]+?)\-{10}',
774
+ sub_parser=TextParser(quantities=basis_set_quantities),
775
+ ),
776
+ Quantity(
777
+ 'basis_set_statistics',
778
+ r'BASIS SET STATISTICS AND STARTUP INFO([\s\S]+?)\-{10}',
779
+ sub_parser=TextParser(quantities=basis_set_statistics_quantities),
780
+ ),
781
+ Quantity(
782
+ 'self_consistent',
783
+ r'((?:ORCA SCF|DFT GRID GENERATION)\s*\-+[\s\S]+?(?:\-{70}|\Z))',
784
+ sub_parser=TextParser(quantities=self_consistent_quantities),
785
+ ),
786
+ Quantity(
787
+ 'tddft',
788
+ r'ORCA TD\-DFT(?:/TDA)* CALCULATION\s*\-+\s*([\s\S]+?E\(tot\).*)',
789
+ sub_parser=TextParser(quantities=tddft_quantities),
790
+ ),
791
+ Quantity(
792
+ 'mp2',
793
+ r'ORCA MP2 CALCULATION([\s\S]+?MP2 TOTAL ENERGY:.+)',
794
+ sub_parser=TextParser(quantities=mp2_quantities),
795
+ ),
796
+ Quantity(
797
+ 'ci',
798
+ r'ORCA\-MATRIX DRIVEN CI([\s\S]+?E\(CCSD\(T\)\).*)',
799
+ sub_parser=TextParser(quantities=ci_quantities),
800
+ ),
801
+ ]
802
+
803
+ geometry_optimization_quantities = [
804
+ Quantity(
805
+ '%s_tol' % key.lower().replace(' ', '_').replace('.', ''),
806
+ rf'%s\s*(\w+)\s*\.+\s*({re_float})' % key,
807
+ dtype=float,
808
+ )
809
+ for key in [
810
+ 'Energy Change',
811
+ 'Max. Gradient',
812
+ 'RMS Gradient',
813
+ 'Max. Displacement',
814
+ 'RMS Displacement',
815
+ ]
816
+ ]
817
+
818
+ geometry_optimization_quantities += [
819
+ Quantity('update_method', r'Update method\s*(\w+)\s*\.+\s*(.+)'),
820
+ Quantity('coords_choice', r'Choice of coordinates\s*(\w+)\s*\.+\s*(.+)'),
821
+ Quantity('initial_hessian', r'Initial Hessian\s*(\w+)\s*\.+\s*(.+)'),
822
+ ]
823
+
824
+ geometry_optimization_quantities += [
825
+ Quantity(
826
+ 'cycle',
827
+ r'OPTIMIZATION CYCLE\s*\d+\s*\*\s*\*+([\s\S]+?)(?:\*\s*GEOMETRY|OPTIMIZATION RUN DONE|\Z)',
828
+ repeats=True,
829
+ sub_parser=TextParser(quantities=calculation_quantities),
830
+ ),
831
+ Quantity(
832
+ 'final_energy_evaluation',
833
+ r'FINAL ENERGY EVALUATION AT THE STATIONARY POINT([\s\S]+?FINAL SINGLE POINT ENERGY.*)',
834
+ sub_parser=TextParser(quantities=calculation_quantities),
835
+ ),
836
+ ]
837
+
838
+ self._quantities = [
839
+ Quantity(
840
+ 'program_version',
841
+ r'Program Version\s*([\w_.].*)',
842
+ convert=False,
843
+ flatten=False,
844
+ ),
845
+ Quantity(
846
+ 'program_svn', r'\(SVN:\s*\$([^$]+)\$\)\s', convert=False, flatten=False
847
+ ),
848
+ Quantity(
849
+ 'program_compilation_date',
850
+ r'\(\$Date\:\s*(\w.+?)\s*\$\)',
851
+ convert=False,
852
+ flatten=False,
853
+ ),
854
+ Quantity(
855
+ 'input_file',
856
+ r'INPUT FILE\s*\=+([\s\S]+?)END OF INPUT',
857
+ sub_parser=TextParser(
858
+ quantities=[
859
+ Quantity('xc_functional', r'\d+>\s*!\s*(\S+)'),
860
+ Quantity('tier', r'(\w+SCF)'),
861
+ ]
862
+ ),
863
+ ),
864
+ Quantity(
865
+ 'single_point',
866
+ r'\* Single Point Calculation \*\s*\*+([\s\S]+?(?:FINAL SINGLE POINT ENERGY.*|\Z))',
867
+ sub_parser=TextParser(quantities=calculation_quantities),
868
+ ),
869
+ Quantity(
870
+ 'geometry_optimization',
871
+ r'\* Geometry Optimization Run \*\s*\*+([\s\S]+?(?:OPTIMIZATION RUN DONE|\Z))',
872
+ sub_parser=TextParser(quantities=geometry_optimization_quantities),
873
+ ),
874
+ ]
875
+
876
+
877
+ class OrcaParser:
878
+ def __init__(self):
879
+ self.out_parser = OutParser()
880
+
881
+ # TODO list adapted from old parser, is incomplete and entries may be incorrect
882
+ self._xc_functional_map = {
883
+ 'HF': ['HS_X'],
884
+ 'HFS': ['HF_X'],
885
+ 'XALPHA': ['HF_X', 'LDA_C_XALPHA'],
886
+ 'LSD': ['LDA_X', 'LDA_C_VWN_RPA', 'VWN5_RPA'],
887
+ 'LDA': ['LDA_X', 'LDA_C_VWN_RPA', 'VWN5_RPA'],
888
+ 'VWN': ['LDA_X', 'LDA_C_VWN_RPA', 'VWN5_RPA'],
889
+ 'VWN5': ['LDA_X', 'LDA_C_VWN_RPA', 'VWN5_RPA'],
890
+ 'VWN3': ['LDA_X', 'LDA_C_VWN_3'],
891
+ 'PWLDA': ['LDA_X', 'LDA_C_PW'],
892
+ 'BNULL': ['GGA_X_B88'],
893
+ 'BVWN': ['GGA_X_B88', 'LDA_C_VWN_RPA', 'VWN5_RPA'],
894
+ 'BP': ['LDA_X', 'GGA_X_B88', 'LDA_C_VWN', 'GGA_C_P86'],
895
+ 'BP86': ['LDA_X', 'GGA_X_B88', 'LDA_C_VWN', 'GGA_C_P86'],
896
+ 'PW91': ['GGA_X_PW91', 'GGA_C_PW91'],
897
+ 'PWP': ['GGA_X_PW91', 'GGA_C_P86'],
898
+ 'MPWPW': ['GGA_X_MPW91', 'GGA_C_PW91'],
899
+ 'MPWLYP': ['GGA_X_MPW91', 'GGA_C_LYP'],
900
+ 'BLYP': ['GGA_X_B88', 'GGA_C_LYP'],
901
+ 'GP': ['GGA_X_G96', 'GGA_C_P86'],
902
+ 'GLYP': ['GGA_X_G96', 'GGA_C_LYP'],
903
+ 'PBE': ['GGA_X_PBE', 'GGA_C_PBE'],
904
+ 'REVPBE': ['GGA_X_PBE_R', 'GGA_C_PBE'],
905
+ 'RPBE': ['GGA_X_RPBE', 'GGA_C_PBE'],
906
+ 'OLYP': ['GGA_X_OPTX', 'GGA_C_LYP', 'GGA_XC_OPWLYP_D'],
907
+ 'OPBE': ['GGA_XC_OPBE_D'],
908
+ 'XLYP': ['GGA_XC_XLYP'],
909
+ 'B97-D': ['GGA_XC_B97_D'],
910
+ 'B97-D3': ['GGA_XC_B97_D'],
911
+ 'TPSS': ['LDA_X', 'MGGA_X_TPSS', 'LDA_C_PW', 'MGGA_C_TPSS'],
912
+ 'TPSSh': ['HYB_MGGA_XC_TPSSH'],
913
+ 'M06L': ['MGGA_X_M06_L', 'MGGA_C_M06_L'],
914
+ 'M06': ['MGGA_X_M06', 'MGGA_C_M06'],
915
+ 'M062X': ['MGGA_X_M06_2X', 'MGGA_C_M06_2X'],
916
+ 'B1LYP': ['HYB_GGA_XC_B1LYP'],
917
+ 'B3LYP': ['HYB_GGA_XC_B3LYP'],
918
+ 'B1P': ['HYB_GGA_XC_B1PW91'],
919
+ 'B3P': ['HYB_GGA_XC_B3P86'],
920
+ 'B3PW': ['HYB_GGA_XC_B3PW91'],
921
+ 'G1LYP': ['GGA_X_G96', 'GGA_C_OP_G96'],
922
+ 'PBE0': ['HYB_GGA_XC_PBEH'],
923
+ 'PW1PW': ['HYB_GGA_XC_B1PW91'],
924
+ 'PWP91_1': ['HYB_GGA_XC_B1PW91'],
925
+ 'PWP1': ['HYB_GGA_XC_B1PW91'],
926
+ 'mPW1PW': ['HYB_GGA_XC_MPW1PW'],
927
+ 'mPW1LYP': ['HYB_GGA_XC_MPWLYP1M'],
928
+ 'O3LYP': ['HYB_GGA_XC_O3LYP'],
929
+ 'X3LYP': ['HYB_GGA_XC_X3LYP'],
930
+ 'PW6B95': ['HYB_MGGA_XC_PW6B95'],
931
+ 'B97': ['HYB_GGA_XC_B97'],
932
+ 'BHANDHLYP': ['HYB_GGA_XC_BHANDHLYP'],
933
+ 'B2PLYP': ['HYB_GGA_XC_B2PLYP'],
934
+ 'MB2PLYP': ['HYB_GGA_XC_MB2PLYP'],
935
+ 'PWPB95': ['HYB_MGGA_XC_MPW1B95'],
936
+ }
937
+
938
+ self._functional_type = {
939
+ 'SLATER': 'LDA',
940
+ 'B88': 'GGA',
941
+ 'G96': 'GGA',
942
+ 'PW91': 'GGA',
943
+ 'MPW': 'GGA',
944
+ 'PBE': 'GGA',
945
+ 'RPBE': 'GGA',
946
+ 'OPTX': 'GGA',
947
+ 'X': 'GGA',
948
+ 'TPSS': 'MGGA',
949
+ 'B97D': 'GGA',
950
+ 'B97BECKE': 'GGA',
951
+ 'SCAN': 'MGGA',
952
+ 'VWN5': 'LDA',
953
+ 'VWN3': 'LDA',
954
+ 'PWLDA': 'LDA',
955
+ 'P86': 'GGA',
956
+ 'LYP': 'GGA',
957
+ }
958
+
959
+ def parse_method(self, section):
960
+ sec_method = Method()
961
+ self.archive.run[-1].method.append(sec_method)
962
+
963
+ trivial = [None] * 2
964
+ _native_tier_map = {
965
+ 'SloppySCF': 3.0e-05,
966
+ 'LooseSCF': 1.0e-05,
967
+ 'NormalSCF': 1.0e-06,
968
+ 'StrongSCF': 3.0e-07,
969
+ 'TightSCF': 1.0e-08,
970
+ 'VeryTightSCF': 1.0e-09,
971
+ 'ExtremeSCF': 1.0e-14,
972
+ } # https://sites.google.com/site/orcainputlibrary/numerical-precision
973
+ _native_tier_map = {k.lower(): v for k, v in _native_tier_map.items()}
974
+ sec_scf = Scf(
975
+ native_tier=self.out_parser.get('input_file', {}).get('tier'),
976
+ )
977
+ scf_convergence = (
978
+ self.out_parser.get('single_point', {})
979
+ .get('self_consistent', {})
980
+ .get('scf_convergence', {})
981
+ )
982
+ if threshold_energy_change := scf_convergence.get(
983
+ 'last_energy_change', trivial
984
+ )[-1]:
985
+ sec_scf.threshold_energy_change = (
986
+ threshold_energy_change * ureg.hartree
987
+ ) # TODO: extract this from the setup, so it is present even whan a calcultion does not finish properly
988
+ sec_scf.threshold_density_change = scf_convergence.get(
989
+ 'last_rms_density_change', trivial
990
+ )[-1]
991
+ sec_scf.x_orca_last_max_density_change = scf_convergence.get(
992
+ 'last_max_density_change', trivial
993
+ )[-1]
994
+ if sec_scf.native_tier and not sec_scf.threshold_energy_change:
995
+ sec_scf.threshold_energy_change = (
996
+ _native_tier_map[sec_scf.native_tier.lower()] * ureg.hartree
997
+ )
998
+ sec_method.scf = sec_scf # TODO check if the section is filled
999
+
1000
+ # Basis set
1001
+ # all values are set at the basis_set level
1002
+ # TODO fix metainfo so variables take lists
1003
+ sec_basis_sets = []
1004
+ for kind, kind_map in [
1005
+ ('basis_set', 'wavefunction'),
1006
+ ('auxiliary_basis_set', 'auxiliary'),
1007
+ ]:
1008
+ basis_set = section.get(kind)
1009
+ if basis_set is None:
1010
+ continue
1011
+ exctraction_keys = [
1012
+ 'basis_set',
1013
+ 'basis_set_atom_labels',
1014
+ 'basis_set_contracted',
1015
+ ]
1016
+ for key in exctraction_keys:
1017
+ vals = basis_set.get(key, [])
1018
+ for bs_index, val in enumerate(vals):
1019
+ prefix = (
1020
+ ''
1021
+ if key == 'basis_set_atom_labels'
1022
+ else kind.split('basis_set', maxsplit=1)[0]
1023
+ )
1024
+ metainfo_name = 'x_orca_%s%s' % (prefix, key)
1025
+ # Note: this assumes that each `extraction_key` follows the same order. Not my assumption
1026
+ if bs_index >= len(sec_basis_sets):
1027
+ sec_basis_sets.append(
1028
+ BasisSet(
1029
+ type='gaussians',
1030
+ )
1031
+ )
1032
+ setattr(sec_basis_sets[bs_index], metainfo_name, val)
1033
+ sec_method.electrons_representation = [
1034
+ BasisSetContainer(
1035
+ type='atom-centered orbitals',
1036
+ scope=[kind_map],
1037
+ basis_set=sec_basis_sets,
1038
+ )
1039
+ ]
1040
+
1041
+ # gaussian basis sets
1042
+ for em in sec_method.electrons_representation:
1043
+ if 'wavefunction' in em.scope:
1044
+ if basis_set := section.get('basis_set_statistics'):
1045
+ sec_basis_set = BasisSet(
1046
+ type='gaussians',
1047
+ )
1048
+ for key, val in basis_set.items():
1049
+ if val is None:
1050
+ continue
1051
+ for n in range(len(val)):
1052
+ ext = '' if n == 0 else '_aux'
1053
+ setattr(sec_basis_set, 'x_orca_%s%s' % (key, ext), val[n])
1054
+ em.basis_set.append(sec_basis_set)
1055
+
1056
+ sec_dft = DFT()
1057
+ sec_method.dft = sec_dft
1058
+ sec_electronic = Electronic()
1059
+ sec_method.electronic = sec_electronic
1060
+ # TODO identify DFT+U
1061
+ sec_electronic.method = 'DFT'
1062
+
1063
+ scf_settings = section.get('self_consistent', {}).get('scf_settings', {})
1064
+ for key, val in scf_settings.items():
1065
+ if val is not None:
1066
+ if hasattr(val, 'units'):
1067
+ if val.units == 'hartree':
1068
+ val = val.to('joule').magnitude
1069
+ setattr(sec_method, 'x_orca_%s' % key, val)
1070
+
1071
+ dft_grid_generation = section.get('self_consistent', {}).get(
1072
+ 'dft_grid_generation', {}
1073
+ )
1074
+ for key, val in dft_grid_generation.items():
1075
+ if val is not None:
1076
+ setattr(sec_method, 'x_orca_%s' % key, val)
1077
+
1078
+ final_grid = section.get('self_consistent', {}).get('final_grid', {})
1079
+ for key, val in final_grid.items():
1080
+ if val is not None:
1081
+ setattr(sec_method, 'x_orca_%s' % key, val)
1082
+
1083
+ # xc functional
1084
+ # get type from input card
1085
+ xc_functional = (
1086
+ self.out_parser.get('input_file', {}).get('xc_functional', '').upper()
1087
+ )
1088
+ xc_functionals = self._xc_functional_map.get(xc_functional, [])
1089
+ # if not in map, get it from explicit exchange and correlation settings
1090
+ if len(xc_functionals) == 0:
1091
+ xc_functional_type = scf_settings.get('XC_functional_type', '')
1092
+ if xc_functional_type.startswith('Hartree-Fock'):
1093
+ xc_functionals = self._xc_functional_map.get('HF', [])
1094
+
1095
+ elif xc_functional_type.startswith('DFT'):
1096
+ exchange = (
1097
+ scf_settings.get('exchange_functional')
1098
+ .upper()
1099
+ .replace('-', '')
1100
+ .split('_')[0]
1101
+ )
1102
+ exchange_type = self._functional_type.get(exchange, None)
1103
+ if exchange_type is not None:
1104
+ xc_functionals.append('%s_X_%s' % (exchange_type, exchange))
1105
+
1106
+ if scf_settings.get('xalpha_param') is not None:
1107
+ xc_functionals.append('LDA_X')
1108
+
1109
+ correlation = (
1110
+ scf_settings.get('correl_functional')
1111
+ .upper()
1112
+ .replace('-', '')
1113
+ .split('_')[0]
1114
+ )
1115
+ correlation_type = self._functional_type.get(correlation, None)
1116
+ if correlation_type is not None:
1117
+ xc_functionals.append('%s_C_%s' % (correlation_type, correlation))
1118
+
1119
+ lda_correlation = scf_settings.get('lda_part_of_gga_corr')
1120
+ if lda_correlation is not None:
1121
+ xc_functionals.append('LDA_C_%s' % (lda_correlation))
1122
+
1123
+ if len(xc_functionals) == 0:
1124
+ self.logger.warning(
1125
+ 'Cannot resolve xc functional', data=dict(name=xc_functional)
1126
+ )
1127
+
1128
+ sec_xc_functional = XCFunctional()
1129
+ sec_dft.xc_functional = sec_xc_functional
1130
+ for functional in xc_functionals:
1131
+ if '_X_' in functional or functional.endswith('_X'):
1132
+ sec_xc_functional.exchange.append(Functional(name=functional))
1133
+ elif '_C_' in functional or functional.endswith('_C'):
1134
+ sec_xc_functional.correlation.append(Functional(name=functional))
1135
+ elif 'HYB' in functional:
1136
+ sec_xc_functional.hybrid.append(Functional(name=functional))
1137
+ else:
1138
+ sec_xc_functional.contributions.append(Functional(name=functional))
1139
+
1140
+ for calculation_type in ['tddft', 'mp2', 'ci']:
1141
+ calculation = section.get(calculation_type)
1142
+ if calculation is None:
1143
+ continue
1144
+ method = calculation.get('electronic_structure_method')
1145
+ method = calculation_type.upper() if method is None else method
1146
+ sec_method = Method()
1147
+ self.archive.run[-1].method.append(sec_method)
1148
+ sec_method.electronic = Electronic(method=method)
1149
+
1150
+ for key, val in calculation.items():
1151
+ if val is not None:
1152
+ if hasattr(val, 'units'):
1153
+ if val.units == 'hartree':
1154
+ val = val.to('joule').magnitude
1155
+ setattr(sec_method, 'x_orca_%s' % key, val)
1156
+
1157
+ sec_method.starting_method_ref = self.archive.run[-1].method[0]
1158
+ sec_method.methods_ref = [self.archive.run[-1].method[0]]
1159
+
1160
+ return sec_method
1161
+
1162
+ def parse_system(self, section):
1163
+ sec_system = System()
1164
+ self.archive.run[-1].system.append(sec_system)
1165
+ sec_atoms = Atoms()
1166
+ sec_system.atoms = sec_atoms
1167
+ if section.get('cartesian_coordinates') is not None:
1168
+ symbols, coordinates = section.get('cartesian_coordinates')
1169
+ sec_atoms.labels = symbols
1170
+ sec_atoms.positions = coordinates
1171
+ sec_atoms.periodic = [False] * 3
1172
+ return sec_system
1173
+
1174
+ def parse_scc(self, section):
1175
+ sec_run = self.archive.run[-1]
1176
+ initial_time = (
1177
+ sec_run.calculation[-1].time_physical if sec_run.calculation else 0 * ureg.s
1178
+ )
1179
+ sec_scc = Calculation()
1180
+ sec_run.calculation.append(sec_scc)
1181
+
1182
+ self_consistent = section.get('self_consistent')
1183
+ if self_consistent is None:
1184
+ return sec_scc
1185
+
1186
+ sec_energy = Energy()
1187
+ sec_scc.energy = sec_energy
1188
+ scf_energy = self_consistent.get('total_scf_energy', None)
1189
+ if scf_energy is not None:
1190
+ sec_energy.total = EnergyEntry(value=scf_energy.get('energy_total'))
1191
+ energy_keys = list(self.out_parser._energy_mapping.values())
1192
+ for key, val in scf_energy.items():
1193
+ if val is not None:
1194
+ if key.startswith('energy_'):
1195
+ sec_energy.m_add_sub_section(
1196
+ getattr(Energy, key.replace('energy_', '').lower()),
1197
+ EnergyEntry(value=val),
1198
+ )
1199
+ else:
1200
+ if key in energy_keys:
1201
+ val = val.to('joule').magnitude
1202
+ setattr(sec_scc, 'x_orca_%s' % key, val)
1203
+
1204
+ scf_iterations = self_consistent.get('scf_iterations', None)
1205
+ if scf_iterations is not None:
1206
+ for energy in scf_iterations.get('energy', []):
1207
+ sec_scf_iteration = ScfIteration()
1208
+ sec_scc.scf_iteration.append(sec_scf_iteration)
1209
+ sec_scf_iteration.energy = Energy(total=EnergyEntry(value=energy))
1210
+
1211
+ # method-specific quantities
1212
+ for calculation_type in ['tddft', 'mp2', 'ci']:
1213
+ calculation = section.get(calculation_type)
1214
+ if calculation is None:
1215
+ continue
1216
+ for key, val in calculation.items():
1217
+ if hasattr(val, 'units'):
1218
+ if val.units == 'hartree':
1219
+ val = val.to('joule').magnitude
1220
+ setattr(sec_scc, 'x_orca_%s' % key, val)
1221
+
1222
+ # eigenvalues
1223
+ orbital_energies = self_consistent.get('orbital_energies')
1224
+ if orbital_energies is not None:
1225
+ sec_eigenvalues = BandEnergies()
1226
+ sec_scc.eigenvalues.append(sec_eigenvalues)
1227
+ orbital_energies = np.transpose(orbital_energies[:2])
1228
+ occupation = orbital_energies[1].T
1229
+ occupation = np.reshape(
1230
+ occupation, (len(occupation), 1, len(occupation[0]))
1231
+ )
1232
+ values = orbital_energies[2].T
1233
+ values = np.reshape(values, (len(values), 1, len(values[0]))) * ureg.hartree
1234
+ sec_eigenvalues.energies = values
1235
+ sec_eigenvalues.occupations = occupation
1236
+
1237
+ # mulliken
1238
+ mulliken = self_consistent.get('mulliken')
1239
+ if mulliken is not None:
1240
+ atomic_charges = mulliken.get('atomic_charges')
1241
+ orbital_charges = mulliken.get('orbital_charges')
1242
+
1243
+ sec_charges = Charges()
1244
+ sec_scc.charges.append(sec_charges)
1245
+ sec_charges.analysis_method = 'mulliken'
1246
+ sec_charges.n_charges_atoms = len(atomic_charges.get('species', []))
1247
+ sec_charges.value = atomic_charges.charge
1248
+ for atom in range(len(atomic_charges.get('species', []))):
1249
+ for orbital, orbital_charge in orbital_charges.atom[atom].get(
1250
+ 'charge', []
1251
+ ):
1252
+ sec_charges_value = ChargesValue()
1253
+ sec_charges.orbital_projected.append(sec_charges_value)
1254
+ sec_charges_value.atom_index = atom
1255
+ sec_charges_value.atom_label = orbital_charges.atom[atom].species
1256
+ sec_charges_value.orbital = orbital
1257
+ sec_charges_value.value = orbital_charge
1258
+
1259
+ sec_charges.total = atomic_charges.total_charge
1260
+
1261
+ # excitations
1262
+ spectrum = section.get('tddft', {}).get('absorption_spectrum_electric')
1263
+ if spectrum is not None:
1264
+ sec_spectra = Spectra()
1265
+ sec_scc.spectra.append(sec_spectra)
1266
+ spectrum = [val for val in spectrum if len(val) == 8]
1267
+ spectrum = np.transpose(spectrum)
1268
+ sec_spectra.excitation_energies = spectrum[1] * ureg.c * ureg.h / ureg.cm
1269
+ sec_spectra.oscillator_strengths = spectrum[3]
1270
+ sec_spectra.transition_dipole_moments = (
1271
+ np.transpose(spectrum[5:7]) * ureg.elementary_charge * ureg.bohr
1272
+ )
1273
+
1274
+ # timings
1275
+ time = self_consistent.get('time_calculation')
1276
+ if time is not None:
1277
+ sec_scc.time_calculation = (
1278
+ time[0] * 24 * 3600 + time[1] * 3600 + time[2] * 60 + time[3]
1279
+ )
1280
+ sec_scc.time_physical = initial_time + sec_scc.time_calculation
1281
+ timings = self_consistent.get('timings', {})
1282
+ for key, val in timings.items():
1283
+ if val is not None:
1284
+ if key == 'final_time' or key == 'scf_gradient':
1285
+ sec_scc.time_calculation = val
1286
+ sec_scc.time_physical = initial_time + sec_scc.time_calculation
1287
+ else:
1288
+ setattr(sec_scc, 'x_orca_%s' % key, val.magnitude)
1289
+
1290
+ return sec_scc
1291
+
1292
+ def parse_configurations(self):
1293
+ def parse_configuration(section):
1294
+ if section is None:
1295
+ return
1296
+ sec_method = self.parse_method(section)
1297
+ sec_system = self.parse_system(section)
1298
+ sec_scc = self.parse_scc(section)
1299
+ sec_scc.method_ref = sec_method
1300
+ sec_scc.system_ref = sec_system
1301
+
1302
+ parse_configuration(self.out_parser.get('single_point'))
1303
+
1304
+ workflow = None
1305
+
1306
+ geometry_optimization = self.out_parser.get('geometry_optimization')
1307
+ if geometry_optimization is not None:
1308
+ for cycle in geometry_optimization.get('cycle', []):
1309
+ parse_configuration(cycle)
1310
+
1311
+ parse_configuration(geometry_optimization.get('final_energy_evaluation'))
1312
+
1313
+ workflow = GeometryOptimization(method=GeometryOptimizationMethod())
1314
+ for key, val in geometry_optimization.items():
1315
+ if key in ['cycle', 'final_energy_evaluation'] or val is None:
1316
+ continue
1317
+ if key.endswith('tol'):
1318
+ if 'gradient' in key:
1319
+ val[1] = (
1320
+ (val[1] * ureg.hartree / ureg.bohr)
1321
+ .to('joule/meter')
1322
+ .magnitude
1323
+ )
1324
+ if 'max' in key:
1325
+ workflow.method.convergence_tolerance_force_maximum = val[1]
1326
+ elif 'displacement' in key:
1327
+ val[1] = (val[1] * ureg.bohr).to('meter').magnitude
1328
+ if 'max' in key:
1329
+ workflow.method.convergence_tolerance_displacement_maximum = val[
1330
+ 1
1331
+ ]
1332
+ else:
1333
+ val[1] = (val[1] * ureg.hartree).to('joule').magnitude
1334
+ if 'energy' in key:
1335
+ workflow.method.convergence_tolerance_energy_difference = (
1336
+ val[1]
1337
+ )
1338
+ setattr(workflow, 'x_orca_%s_value' % key, val[1])
1339
+ val = val[0]
1340
+ elif key in ['update_method', 'coords_choice', 'initial_hessian']:
1341
+ setattr(workflow, 'x_orca_%s_name' % key, ' '.join(val[1:]))
1342
+ val = val[0]
1343
+ setattr(workflow, 'x_orca_%s' % key, val)
1344
+
1345
+ self.archive.workflow2 = workflow
1346
+
1347
+ def init_parser(self, filepath, logger):
1348
+ self.out_parser.mainfile = filepath
1349
+ self.out_parser.logger = logger
1350
+
1351
+ def parse(self, filepath, archive, logger):
1352
+ self.filepath = filepath
1353
+ self.archive = archive
1354
+ self.logger = logging.getLogger(__name__) if logger is None else logger
1355
+ self.init_parser(filepath, logger)
1356
+
1357
+ sec_run = Run()
1358
+ self.archive.run.append(sec_run)
1359
+ sec_run.program = Program(name='ORCA')
1360
+ version = []
1361
+ for key in ['program_version', 'program_svn', 'program_compilation_date']:
1362
+ val = self.out_parser.get(key)
1363
+ if val is not None:
1364
+ setattr(sec_run, 'x_orca_%s' % key, val)
1365
+ version.append(val)
1366
+ sec_run.program.version = ' '.join(version)
1367
+ sec_run.program.compilation_date = self.out_parser.get(
1368
+ 'program_compilation_date'
1369
+ )
1370
+
1371
+ self.parse_configurations()