nomad-parser-plugins-atomistic 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.
- atomisticparsers/__init__.py +400 -0
- atomisticparsers/amber/__init__.py +19 -0
- atomisticparsers/amber/__main__.py +31 -0
- atomisticparsers/amber/metainfo/__init__.py +19 -0
- atomisticparsers/amber/metainfo/amber.py +495 -0
- atomisticparsers/amber/parser.py +42 -0
- atomisticparsers/asap/__init__.py +19 -0
- atomisticparsers/asap/__main__.py +31 -0
- atomisticparsers/asap/metainfo/__init__.py +19 -0
- atomisticparsers/asap/metainfo/asap.py +75 -0
- atomisticparsers/asap/parser.py +197 -0
- atomisticparsers/bopfox/__init__.py +19 -0
- atomisticparsers/bopfox/__main__.py +31 -0
- atomisticparsers/bopfox/metainfo/__init__.py +19 -0
- atomisticparsers/bopfox/metainfo/bopfox.py +225 -0
- atomisticparsers/bopfox/parser.py +808 -0
- atomisticparsers/dftbplus/__init__.py +19 -0
- atomisticparsers/dftbplus/__main__.py +31 -0
- atomisticparsers/dftbplus/metainfo/__init__.py +19 -0
- atomisticparsers/dftbplus/metainfo/dftbplus.py +217 -0
- atomisticparsers/dftbplus/parser.py +500 -0
- atomisticparsers/dlpoly/__init__.py +19 -0
- atomisticparsers/dlpoly/__main__.py +31 -0
- atomisticparsers/dlpoly/metainfo/__init__.py +19 -0
- atomisticparsers/dlpoly/metainfo/dl_poly.py +312 -0
- atomisticparsers/dlpoly/parser.py +798 -0
- atomisticparsers/gromacs/__init__.py +19 -0
- atomisticparsers/gromacs/__main__.py +31 -0
- atomisticparsers/gromacs/metainfo/__init__.py +19 -0
- atomisticparsers/gromacs/metainfo/gromacs.py +2388 -0
- atomisticparsers/gromacs/parser.py +1581 -0
- atomisticparsers/gromos/__init__.py +19 -0
- atomisticparsers/gromos/__main__.py +31 -0
- atomisticparsers/gromos/metainfo/__init__.py +19 -0
- atomisticparsers/gromos/metainfo/gromos.py +1995 -0
- atomisticparsers/gromos/parser.py +58 -0
- atomisticparsers/gulp/__init__.py +19 -0
- atomisticparsers/gulp/__main__.py +31 -0
- atomisticparsers/gulp/metainfo/__init__.py +19 -0
- atomisticparsers/gulp/metainfo/gulp.py +1117 -0
- atomisticparsers/gulp/parser.py +1316 -0
- atomisticparsers/h5md/__init__.py +19 -0
- atomisticparsers/h5md/__main__.py +31 -0
- atomisticparsers/h5md/metainfo/__init__.py +19 -0
- atomisticparsers/h5md/metainfo/h5md.py +239 -0
- atomisticparsers/h5md/parser.py +901 -0
- atomisticparsers/lammps/__init__.py +19 -0
- atomisticparsers/lammps/__main__.py +31 -0
- atomisticparsers/lammps/metainfo/__init__.py +19 -0
- atomisticparsers/lammps/metainfo/lammps.py +1417 -0
- atomisticparsers/lammps/parser.py +1753 -0
- atomisticparsers/libatoms/__init__.py +19 -0
- atomisticparsers/libatoms/__main__.py +31 -0
- atomisticparsers/libatoms/metainfo/__init__.py +19 -0
- atomisticparsers/libatoms/metainfo/lib_atoms.py +251 -0
- atomisticparsers/libatoms/parser.py +38 -0
- atomisticparsers/namd/__init__.py +19 -0
- atomisticparsers/namd/__main__.py +31 -0
- atomisticparsers/namd/metainfo/__init__.py +19 -0
- atomisticparsers/namd/metainfo/namd.py +1605 -0
- atomisticparsers/namd/parser.py +312 -0
- atomisticparsers/tinker/__init__.py +19 -0
- atomisticparsers/tinker/__main__.py +31 -0
- atomisticparsers/tinker/metainfo/__init__.py +18 -0
- atomisticparsers/tinker/metainfo/tinker.py +1363 -0
- atomisticparsers/tinker/parser.py +685 -0
- atomisticparsers/utils/__init__.py +22 -0
- atomisticparsers/utils/mdanalysis.py +662 -0
- atomisticparsers/utils/parsers.py +226 -0
- atomisticparsers/xtb/__init__.py +19 -0
- atomisticparsers/xtb/__main__.py +32 -0
- atomisticparsers/xtb/metainfo/__init__.py +19 -0
- atomisticparsers/xtb/metainfo/xtb.py +256 -0
- atomisticparsers/xtb/parser.py +979 -0
- nomad_parser_plugins_atomistic-1.0.dist-info/LICENSE +202 -0
- nomad_parser_plugins_atomistic-1.0.dist-info/METADATA +327 -0
- nomad_parser_plugins_atomistic-1.0.dist-info/RECORD +80 -0
- nomad_parser_plugins_atomistic-1.0.dist-info/WHEEL +5 -0
- nomad_parser_plugins_atomistic-1.0.dist-info/entry_points.txt +15 -0
- nomad_parser_plugins_atomistic-1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,500 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright The NOMAD Authors.
|
|
3
|
+
#
|
|
4
|
+
# This file is part of NOMAD.
|
|
5
|
+
# See https://nomad-lab.eu for further info.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
import os
|
|
20
|
+
import re
|
|
21
|
+
import io
|
|
22
|
+
import logging
|
|
23
|
+
import numpy as np
|
|
24
|
+
|
|
25
|
+
from nomad.units import ureg
|
|
26
|
+
from nomad.parsing.file_parser import TextParser, Quantity, FileParser, Parser
|
|
27
|
+
from runschema.run import Run, Program
|
|
28
|
+
from runschema.method import Method, TB
|
|
29
|
+
from runschema.system import System, Atoms
|
|
30
|
+
from runschema.calculation import (
|
|
31
|
+
Calculation,
|
|
32
|
+
Energy,
|
|
33
|
+
EnergyEntry,
|
|
34
|
+
ScfIteration,
|
|
35
|
+
BandEnergies,
|
|
36
|
+
Multipoles,
|
|
37
|
+
MultipolesEntry,
|
|
38
|
+
Forces,
|
|
39
|
+
ForcesEntry,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
re_n = r'[\n\r]'
|
|
44
|
+
re_f = r'[-+]?\d+\.\d*(?:[DdEe][-+]\d+)?'
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
class DetailedParser(TextParser):
|
|
48
|
+
def init_quantities(self):
|
|
49
|
+
def to_kpoint(val_in):
|
|
50
|
+
val = np.transpose(
|
|
51
|
+
np.array(
|
|
52
|
+
[line.split()[1:] for line in val_in.strip().splitlines()],
|
|
53
|
+
dtype=np.float64,
|
|
54
|
+
)
|
|
55
|
+
)
|
|
56
|
+
eigs = np.array([val[i] for i in range(len(val)) if i % 2 == 0])
|
|
57
|
+
occs = np.array([val[i] for i in range(len(val)) if i % 2 == 0])
|
|
58
|
+
return eigs, occs
|
|
59
|
+
|
|
60
|
+
self._quantities = [
|
|
61
|
+
Quantity(
|
|
62
|
+
'coordinates',
|
|
63
|
+
r'Coordinates of moved atoms \(au\):\s+([\d\.\-\+\s]+)',
|
|
64
|
+
dtype=np.dtype(np.float64),
|
|
65
|
+
repeats=True,
|
|
66
|
+
),
|
|
67
|
+
Quantity(
|
|
68
|
+
'charges',
|
|
69
|
+
r' Net atomic charges \(e\)\s+Atom +Net charge\s+([\d\.\-\+Ee\s]+)',
|
|
70
|
+
dtype=np.dtype(np.float64),
|
|
71
|
+
repeats=True,
|
|
72
|
+
),
|
|
73
|
+
Quantity(
|
|
74
|
+
'eigenvalues',
|
|
75
|
+
r'Eigenvalues \/H\s+([\d\.\-\+\s]+)',
|
|
76
|
+
dtype=np.dtype(np.float64),
|
|
77
|
+
repeats=True,
|
|
78
|
+
),
|
|
79
|
+
Quantity(
|
|
80
|
+
'occupations',
|
|
81
|
+
r'Fillings\s+([\d\.\-\+\s]+)',
|
|
82
|
+
dtype=np.dtype(np.float64),
|
|
83
|
+
repeats=True,
|
|
84
|
+
),
|
|
85
|
+
Quantity(
|
|
86
|
+
'eigenvalues_occupations',
|
|
87
|
+
rf'Eigenvalues \(H\) and fillings \(e\)\s+([\s\S]+?)Eigenvalues',
|
|
88
|
+
sub_parser=TextParser(
|
|
89
|
+
quantities=[
|
|
90
|
+
Quantity(
|
|
91
|
+
'kpoint',
|
|
92
|
+
r'K-points* \d+\:*\d*\s+([\d\.\-\+\s]+)',
|
|
93
|
+
str_operation=to_kpoint,
|
|
94
|
+
repeats=True,
|
|
95
|
+
)
|
|
96
|
+
]
|
|
97
|
+
),
|
|
98
|
+
),
|
|
99
|
+
Quantity(
|
|
100
|
+
'fermi_level',
|
|
101
|
+
rf'Fermi level: +({re_f}) H',
|
|
102
|
+
dtype=np.float64,
|
|
103
|
+
unit=ureg.hartree,
|
|
104
|
+
),
|
|
105
|
+
Quantity(
|
|
106
|
+
'energy_x_dftbp_band',
|
|
107
|
+
rf'Band energy: +({re_f}) H',
|
|
108
|
+
dtype=np.float64,
|
|
109
|
+
unit=ureg.hartree,
|
|
110
|
+
),
|
|
111
|
+
Quantity(
|
|
112
|
+
'energy_x_dftbp_ts',
|
|
113
|
+
rf'TS: +({re_f}) H',
|
|
114
|
+
dtype=np.float64,
|
|
115
|
+
unit=ureg.hartree,
|
|
116
|
+
),
|
|
117
|
+
Quantity(
|
|
118
|
+
'energy_x_dftbp_band_free',
|
|
119
|
+
rf'Band free energy \(E\-TS\): +({re_f}) H',
|
|
120
|
+
dtype=np.float64,
|
|
121
|
+
unit=ureg.hartree,
|
|
122
|
+
),
|
|
123
|
+
Quantity(
|
|
124
|
+
'energy_x_dftbp_band_t0',
|
|
125
|
+
rf'Extrapolated E\(0K\): +({re_f}) H',
|
|
126
|
+
dtype=np.float64,
|
|
127
|
+
unit=ureg.hartree,
|
|
128
|
+
),
|
|
129
|
+
Quantity(
|
|
130
|
+
'energy_sum_eigenvalues',
|
|
131
|
+
rf'Energy H0: +({re_f}) H',
|
|
132
|
+
dtype=np.float64,
|
|
133
|
+
unit=ureg.hartree,
|
|
134
|
+
),
|
|
135
|
+
Quantity(
|
|
136
|
+
'energy_x_dftbp_scc',
|
|
137
|
+
rf'Energy SCC: +({re_f}) H',
|
|
138
|
+
dtype=np.float64,
|
|
139
|
+
unit=ureg.hartree,
|
|
140
|
+
),
|
|
141
|
+
Quantity(
|
|
142
|
+
'energy_electronic',
|
|
143
|
+
rf'Total Electronic energy: +({re_f}) H',
|
|
144
|
+
dtype=np.float64,
|
|
145
|
+
unit=ureg.hartree,
|
|
146
|
+
),
|
|
147
|
+
Quantity(
|
|
148
|
+
'energy_nuclear_repulsion',
|
|
149
|
+
rf'Repulsive energy: +({re_f}) H',
|
|
150
|
+
dtype=np.float64,
|
|
151
|
+
unit=ureg.hartree,
|
|
152
|
+
),
|
|
153
|
+
Quantity(
|
|
154
|
+
'energy_x_dftbp_dispersion',
|
|
155
|
+
rf'Dispersion energy: +({re_f}) H',
|
|
156
|
+
dtype=np.float64,
|
|
157
|
+
unit=ureg.hartree,
|
|
158
|
+
),
|
|
159
|
+
Quantity(
|
|
160
|
+
'energy_total',
|
|
161
|
+
rf'Total energy: +({re_f}) H',
|
|
162
|
+
dtype=np.float64,
|
|
163
|
+
unit=ureg.hartree,
|
|
164
|
+
),
|
|
165
|
+
Quantity(
|
|
166
|
+
'energy_x_dftbp_total_mermin',
|
|
167
|
+
rf'Total Mermin free energy: +({re_f}) H',
|
|
168
|
+
dtype=np.float64,
|
|
169
|
+
unit=ureg.hartree,
|
|
170
|
+
),
|
|
171
|
+
Quantity(
|
|
172
|
+
'pressure',
|
|
173
|
+
rf'Pressure: +({re_f}) au',
|
|
174
|
+
dtype=np.float64,
|
|
175
|
+
unit=ureg.hartree / ureg.bohr**3,
|
|
176
|
+
),
|
|
177
|
+
Quantity(
|
|
178
|
+
'forces',
|
|
179
|
+
r'Total Forces\s+([\d\.\-\+\sE]+)',
|
|
180
|
+
dtype=np.dtype(np.float64),
|
|
181
|
+
repeats=True,
|
|
182
|
+
),
|
|
183
|
+
Quantity(
|
|
184
|
+
'dipole',
|
|
185
|
+
rf'Dipole moment +: +({re_f} +{re_f} +{re_f})',
|
|
186
|
+
dtype=np.dtype(np.float64),
|
|
187
|
+
repeats=True,
|
|
188
|
+
),
|
|
189
|
+
]
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
class GenParser(FileParser):
|
|
193
|
+
def parse(self, key=None):
|
|
194
|
+
self._results = dict()
|
|
195
|
+
|
|
196
|
+
geometry = self.mainfile_obj.read()
|
|
197
|
+
self.mainfile_obj.close()
|
|
198
|
+
if geometry is None:
|
|
199
|
+
return
|
|
200
|
+
|
|
201
|
+
input_file = re.search(r'\<\<\< +\"(\S+)\"', geometry)
|
|
202
|
+
if input_file:
|
|
203
|
+
with open(os.path.join(self.maindir, input_file.group(1))) as f:
|
|
204
|
+
geometry = f.read()
|
|
205
|
+
|
|
206
|
+
geometry = geometry.strip().splitlines()
|
|
207
|
+
n_atoms, lattice_type = geometry[0].split()
|
|
208
|
+
n_atoms = int(n_atoms)
|
|
209
|
+
elements = geometry[1].split()
|
|
210
|
+
symbols, positions = [], []
|
|
211
|
+
for n in range(2, n_atoms + 2):
|
|
212
|
+
line = geometry[n].split()
|
|
213
|
+
symbols.append(elements[int(line[1]) - 1])
|
|
214
|
+
positions.append(line[2:5])
|
|
215
|
+
lattice_vectors = None
|
|
216
|
+
if lattice_type in ['S', 'F']:
|
|
217
|
+
# line immediately after coordinates is origin
|
|
218
|
+
lattice_vectors = (
|
|
219
|
+
np.array(
|
|
220
|
+
[v.split() for v in geometry[n_atoms + 3 : n_atoms + 6]],
|
|
221
|
+
dtype=np.float64,
|
|
222
|
+
)
|
|
223
|
+
* ureg.angstrom
|
|
224
|
+
)
|
|
225
|
+
positions = np.array(positions, dtype=np.float64) * ureg.angstrom
|
|
226
|
+
if lattice_type == 'F':
|
|
227
|
+
# fractional coordinates
|
|
228
|
+
positions = np.dot(positions, lattice_vectors)
|
|
229
|
+
|
|
230
|
+
self._results['symbols'] = symbols
|
|
231
|
+
self._results['positions'] = positions
|
|
232
|
+
self._results['lattice_vectors'] = lattice_vectors
|
|
233
|
+
|
|
234
|
+
|
|
235
|
+
class HSDParser(FileParser):
|
|
236
|
+
def __init__(self):
|
|
237
|
+
super().__init__()
|
|
238
|
+
self._re_section_value = re.compile(
|
|
239
|
+
r'(?: *([A-Z]\w+) *= *(\w*) *\{|([A-Z][\w\[\]]+) *= *([^}]+)|(}))'
|
|
240
|
+
)
|
|
241
|
+
self.gen_parser = GenParser()
|
|
242
|
+
|
|
243
|
+
@property
|
|
244
|
+
def hsd(self):
|
|
245
|
+
if self._file_handler is None:
|
|
246
|
+
self._file_handler = open(self.mainfile)
|
|
247
|
+
return self._file_handler
|
|
248
|
+
|
|
249
|
+
def parse(self, key=None):
|
|
250
|
+
self._results = dict(data=dict())
|
|
251
|
+
|
|
252
|
+
line = self.hsd.readline()
|
|
253
|
+
current_section = self._results['data']
|
|
254
|
+
previous_sections = []
|
|
255
|
+
# value as a whole block
|
|
256
|
+
block = ''
|
|
257
|
+
while line:
|
|
258
|
+
matches = self._re_section_value.findall(line)
|
|
259
|
+
for match in matches:
|
|
260
|
+
section, sub_section, key, value, close = match
|
|
261
|
+
if section:
|
|
262
|
+
current_section[section] = dict()
|
|
263
|
+
block = ''
|
|
264
|
+
previous_sections.append(current_section)
|
|
265
|
+
current_section = current_section[section]
|
|
266
|
+
if sub_section:
|
|
267
|
+
current_section['_function'] = sub_section
|
|
268
|
+
if key and value:
|
|
269
|
+
value = value.strip().replace('"', '').replace("'", '')
|
|
270
|
+
try:
|
|
271
|
+
value = float(value)
|
|
272
|
+
except Exception:
|
|
273
|
+
pass
|
|
274
|
+
current_section[key] = value
|
|
275
|
+
if close:
|
|
276
|
+
if block:
|
|
277
|
+
current_section['_block'] = block
|
|
278
|
+
current_section = previous_sections[-1]
|
|
279
|
+
previous_sections.pop(-1)
|
|
280
|
+
if not matches:
|
|
281
|
+
block += line
|
|
282
|
+
line = self.hsd.readline()
|
|
283
|
+
|
|
284
|
+
self.gen_parser.mainfile = self.mainfile
|
|
285
|
+
# TODO why is this necessary when you assign mainfile?
|
|
286
|
+
# private variables should not be set
|
|
287
|
+
self.gen_parser._mainfile_obj = io.StringIO(
|
|
288
|
+
self._results.get('data', {}).get('Geometry', {}).get('_block', '')
|
|
289
|
+
)
|
|
290
|
+
self.gen_parser.parse()
|
|
291
|
+
self._results['symbols'] = self.gen_parser.symbols
|
|
292
|
+
self._results['positions'] = self.gen_parser.positions
|
|
293
|
+
self._results['lattice_vectors'] = self.gen_parser.lattice_vectors
|
|
294
|
+
|
|
295
|
+
|
|
296
|
+
class OutParser(TextParser):
|
|
297
|
+
def init_quantities(self):
|
|
298
|
+
self._quantities = [
|
|
299
|
+
Quantity('program_version', r'\| DFTB\+ +(.+)', flatten=False, dtype=str),
|
|
300
|
+
Quantity('input_file', r'Interpreting input file \'(\S+)\'', dtype=str),
|
|
301
|
+
Quantity(
|
|
302
|
+
'processed_input_file',
|
|
303
|
+
r'Processed input in HSD format written to \'(\S+)\'',
|
|
304
|
+
dtype=str,
|
|
305
|
+
),
|
|
306
|
+
Quantity(
|
|
307
|
+
'parser_version', r'Parser version: +(.+)', flatten=False, dtype=str
|
|
308
|
+
),
|
|
309
|
+
Quantity(
|
|
310
|
+
'sk_files',
|
|
311
|
+
r'Reading SK-files:\s+([\s\S]+?)Done',
|
|
312
|
+
str_operation=lambda x: [v.strip() for v in x.strip().splitlines()],
|
|
313
|
+
),
|
|
314
|
+
Quantity(
|
|
315
|
+
'input_parameters',
|
|
316
|
+
r'Starting initialization\.\.\.\s+\-+\s+([\s\S]+?)\-{50}',
|
|
317
|
+
sub_parser=TextParser(
|
|
318
|
+
quantities=[
|
|
319
|
+
Quantity(
|
|
320
|
+
'key_val',
|
|
321
|
+
rf'([A-Z].+?\: +[\w\-\+\. \(\)\:]+){re_n}',
|
|
322
|
+
str_operation=lambda x: [
|
|
323
|
+
v.strip() for v in x.strip().split(':', 1)
|
|
324
|
+
],
|
|
325
|
+
repeats=True,
|
|
326
|
+
),
|
|
327
|
+
Quantity(
|
|
328
|
+
'kpoints_weights',
|
|
329
|
+
rf'K\-points and weights: +([\s\S]+?){re_n} *{re_n}',
|
|
330
|
+
str_operation=lambda x: [
|
|
331
|
+
v.strip().split()[1:5] for v in x.strip().splitlines()
|
|
332
|
+
],
|
|
333
|
+
dtype=np.dtype(np.float64),
|
|
334
|
+
),
|
|
335
|
+
]
|
|
336
|
+
),
|
|
337
|
+
),
|
|
338
|
+
Quantity(
|
|
339
|
+
'step',
|
|
340
|
+
r'(Geometry step\: +\d+[\s\S]+?)(?:\-{50}|\Z)',
|
|
341
|
+
repeats=True,
|
|
342
|
+
sub_parser=TextParser(
|
|
343
|
+
quantities=[
|
|
344
|
+
Quantity(
|
|
345
|
+
'scf',
|
|
346
|
+
rf'\d+ +({re_f} +{re_f} +{re_f})',
|
|
347
|
+
repeats=True,
|
|
348
|
+
dtype=np.dtype(np.float64),
|
|
349
|
+
),
|
|
350
|
+
Quantity(
|
|
351
|
+
'energy_total',
|
|
352
|
+
rf'Total Energy: +({re_f}) +H',
|
|
353
|
+
dtype=np.float64,
|
|
354
|
+
unit=ureg.hartree,
|
|
355
|
+
),
|
|
356
|
+
Quantity(
|
|
357
|
+
'energy_total_t0',
|
|
358
|
+
rf'Extrapolated to 0: +({re_f}) +H',
|
|
359
|
+
dtype=np.float64,
|
|
360
|
+
unit=ureg.hartree,
|
|
361
|
+
),
|
|
362
|
+
Quantity(
|
|
363
|
+
'energy_x_dftbp_total_mermin',
|
|
364
|
+
rf'Total Mermin free energy: +({re_f}) +H',
|
|
365
|
+
dtype=np.float64,
|
|
366
|
+
unit=ureg.hartree,
|
|
367
|
+
),
|
|
368
|
+
Quantity(
|
|
369
|
+
'pressure',
|
|
370
|
+
rf'Pressure: +({re_f}) +au',
|
|
371
|
+
dtype=np.float64,
|
|
372
|
+
unit=ureg.hartree / ureg.bohr**3,
|
|
373
|
+
),
|
|
374
|
+
Quantity(
|
|
375
|
+
'maximum_force',
|
|
376
|
+
rf'Maximal force component: +({re_f})',
|
|
377
|
+
dtype=np.float64,
|
|
378
|
+
unit=ureg.hartree / ureg.bohr,
|
|
379
|
+
),
|
|
380
|
+
]
|
|
381
|
+
),
|
|
382
|
+
),
|
|
383
|
+
]
|
|
384
|
+
|
|
385
|
+
|
|
386
|
+
class DFTBPlusParser(Parser):
|
|
387
|
+
def __init__(self):
|
|
388
|
+
self.out_parser = OutParser()
|
|
389
|
+
self.hsd_parser = HSDParser()
|
|
390
|
+
self.detailed_parser = DetailedParser()
|
|
391
|
+
self.gen_parser = GenParser()
|
|
392
|
+
|
|
393
|
+
def write_to_archive(self) -> None:
|
|
394
|
+
self.out_parser.mainfile = self.mainfile
|
|
395
|
+
self.out_parser.logger = self.logger
|
|
396
|
+
self.hsd_parser.logger = self.logger
|
|
397
|
+
self.gen_parser.logger = self.logger
|
|
398
|
+
self.detailed_parser.logger = self.logger
|
|
399
|
+
self.maindir = os.path.dirname(self.mainfile)
|
|
400
|
+
|
|
401
|
+
sec_run = Run()
|
|
402
|
+
self.archive.run.append(sec_run)
|
|
403
|
+
sec_run.program = Program(
|
|
404
|
+
name='DFTB+', version=self.out_parser.get('program_version')
|
|
405
|
+
)
|
|
406
|
+
|
|
407
|
+
def parse_system(source):
|
|
408
|
+
sec_system = System()
|
|
409
|
+
sec_run.system.append(sec_system)
|
|
410
|
+
sec_system.atoms = Atoms(
|
|
411
|
+
labels=source.get('symbols'),
|
|
412
|
+
positions=source.get('positions'),
|
|
413
|
+
lattice_vectors=source.get('lattice_vectors'),
|
|
414
|
+
)
|
|
415
|
+
|
|
416
|
+
input_file = self.out_parser.get(
|
|
417
|
+
'processed_input_file', self.out_parser.get('input_file')
|
|
418
|
+
)
|
|
419
|
+
input_parameters = self.out_parser.input_parameters
|
|
420
|
+
if input_file.endswith('.hsd'):
|
|
421
|
+
self.hsd_parser.mainfile = os.path.join(self.maindir, input_file)
|
|
422
|
+
input_parameters = self.hsd_parser.get('data')
|
|
423
|
+
# parse initial structure
|
|
424
|
+
parse_system(self.hsd_parser)
|
|
425
|
+
|
|
426
|
+
for key in ['input_file', 'processed_input_file', 'parser_version']:
|
|
427
|
+
setattr(sec_run, f'x_dftbp_{key}', self.out_parser.get(key))
|
|
428
|
+
|
|
429
|
+
sec_method = Method()
|
|
430
|
+
sec_run.method.append(sec_method)
|
|
431
|
+
sec_tb = TB()
|
|
432
|
+
sec_method.tb = sec_tb
|
|
433
|
+
sec_tb.name = 'DFTB'
|
|
434
|
+
sec_tb.x_dftbp_input_parameters = input_parameters
|
|
435
|
+
sec_tb.x_dftbp_sk_files = self.out_parser.sk_files
|
|
436
|
+
|
|
437
|
+
for step in self.out_parser.get('step', []):
|
|
438
|
+
sec_scc = Calculation()
|
|
439
|
+
sec_run.calculation.append(sec_scc)
|
|
440
|
+
sec_scc.energy = Energy(
|
|
441
|
+
total=EnergyEntry(value=step.energy_total),
|
|
442
|
+
total_t0=EnergyEntry(value=step.energy_total_t0),
|
|
443
|
+
)
|
|
444
|
+
sec_scc.energy.x_dftbp_total_mermin = EnergyEntry(
|
|
445
|
+
value=step.energy_x_dftbp_total_mermin
|
|
446
|
+
)
|
|
447
|
+
sec_scc.pressure = step.pressure
|
|
448
|
+
for scf in step.get('scf', []):
|
|
449
|
+
sec_scf = ScfIteration()
|
|
450
|
+
sec_scc.scf_iteration.append(sec_scf)
|
|
451
|
+
sec_scf.energy = Energy(
|
|
452
|
+
total=EnergyEntry(value=scf[0] * ureg.hartree),
|
|
453
|
+
change=scf[1] * ureg.hartree,
|
|
454
|
+
)
|
|
455
|
+
|
|
456
|
+
# reference the initial structure
|
|
457
|
+
sec_run.calculation[0].system_ref = sec_run.system[0]
|
|
458
|
+
|
|
459
|
+
# parse the final relaxed structure
|
|
460
|
+
self.gen_parser.mainfile = os.path.join(self.maindir, 'geo_end.gen')
|
|
461
|
+
if self.gen_parser.mainfile is not None:
|
|
462
|
+
parse_system(self.gen_parser)
|
|
463
|
+
sec_run.calculation[-1].system_ref = sec_run.system[-1]
|
|
464
|
+
|
|
465
|
+
# properties in detailed.out
|
|
466
|
+
# TODO add more properties e.g. charges
|
|
467
|
+
self.detailed_parser.mainfile = os.path.join(self.maindir, 'detailed.out')
|
|
468
|
+
for key, val in self.detailed_parser.items():
|
|
469
|
+
if val is None:
|
|
470
|
+
continue
|
|
471
|
+
|
|
472
|
+
if key.startswith('energy_'):
|
|
473
|
+
setattr(
|
|
474
|
+
sec_scc.energy, key.replace('energy_', ''), EnergyEntry(value=val)
|
|
475
|
+
)
|
|
476
|
+
elif key == 'forces':
|
|
477
|
+
sec_scc.forces = Forces(
|
|
478
|
+
total=ForcesEntry(value=val * ureg.hartree / ureg.bohr)
|
|
479
|
+
)
|
|
480
|
+
elif key == 'fermi_level':
|
|
481
|
+
sec_scc.energy.fermi = val
|
|
482
|
+
elif key == 'pressure':
|
|
483
|
+
sec_scc.pressure = val
|
|
484
|
+
elif key == 'eigenvalues_occupations':
|
|
485
|
+
sec_eigenvalues = BandEnergies()
|
|
486
|
+
sec_scc.eigenvalues.append(sec_eigenvalues)
|
|
487
|
+
# TODO handle spin polarization
|
|
488
|
+
n_spin = 1
|
|
489
|
+
eigs = np.vstack([kpoint[0] for kpoint in val.get('kpoint', [])])
|
|
490
|
+
sec_eigenvalues.energies = (
|
|
491
|
+
np.reshape(eigs, (n_spin, *np.shape(eigs))) * ureg.hartree
|
|
492
|
+
)
|
|
493
|
+
occs = np.vstack([kpoint[1] for kpoint in val.get('kpoint', [])])
|
|
494
|
+
sec_eigenvalues.occupations = np.reshape(
|
|
495
|
+
occs, (n_spin, *np.shape(occs))
|
|
496
|
+
)
|
|
497
|
+
elif key == 'dipole':
|
|
498
|
+
sec_multipole = Multipoles()
|
|
499
|
+
sec_scc.multipoles.append(sec_multipole)
|
|
500
|
+
sec_multipole.dipole = MultipolesEntry(total=val)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright The NOMAD Authors.
|
|
3
|
+
#
|
|
4
|
+
# This file is part of NOMAD.
|
|
5
|
+
# See https://nomad-lab.eu for further info.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
from .parser import DLPolyParser
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright The NOMAD Authors.
|
|
3
|
+
#
|
|
4
|
+
# This file is part of NOMAD.
|
|
5
|
+
# See https://nomad-lab.eu for further info.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
import sys
|
|
20
|
+
import json
|
|
21
|
+
import logging
|
|
22
|
+
|
|
23
|
+
from nomad.utils import configure_logging
|
|
24
|
+
from nomad.datamodel import EntryArchive
|
|
25
|
+
from atomisticparsers.dlpoly import DLPolyParser
|
|
26
|
+
|
|
27
|
+
if __name__ == '__main__':
|
|
28
|
+
configure_logging(console_log_level=logging.DEBUG)
|
|
29
|
+
archive = EntryArchive()
|
|
30
|
+
DLPolyParser().parse(sys.argv[1], archive, logging)
|
|
31
|
+
json.dump(archive.m_to_dict(), sys.stdout, indent=2)
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
#
|
|
2
|
+
# Copyright The NOMAD Authors.
|
|
3
|
+
#
|
|
4
|
+
# This file is part of NOMAD.
|
|
5
|
+
# See https://nomad-lab.eu for further info.
|
|
6
|
+
#
|
|
7
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
8
|
+
# you may not use this file except in compliance with the License.
|
|
9
|
+
# You may obtain a copy of the License at
|
|
10
|
+
#
|
|
11
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
12
|
+
#
|
|
13
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
14
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
15
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
16
|
+
# See the License for the specific language governing permissions and
|
|
17
|
+
# limitations under the License.
|
|
18
|
+
#
|
|
19
|
+
from . import dl_poly
|