digichem-core 6.10.3__py3-none-any.whl → 7.0.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.
- digichem/__init__.py +2 -2
- digichem/config/base.py +10 -1
- digichem/config/util.py +3 -2
- digichem/file/prattle.py +9 -7
- digichem/image/spectroscopy.py +17 -4
- digichem/input/__init__.py +1 -1
- digichem/input/digichem_input.py +39 -34
- digichem/parse/base.py +8 -6
- digichem/parse/cclib.py +10 -6
- digichem/parse/dump.py +31 -35
- digichem/parse/gaussian.py +2 -2
- digichem/parse/turbomole.py +2 -3
- digichem/parse/util.py +6 -5
- digichem/result/alignment/base.py +2 -2
- digichem/result/atom.py +4 -4
- digichem/result/base.py +53 -5
- digichem/result/dipole_moment.py +1 -1
- digichem/result/emission.py +5 -5
- digichem/result/energy.py +8 -8
- digichem/result/excited_state.py +20 -13
- digichem/result/ground_state.py +2 -2
- digichem/result/metadata.py +12 -21
- digichem/result/nmr.py +37 -28
- digichem/result/orbital.py +3 -3
- digichem/result/result.py +14 -14
- digichem/result/soc.py +3 -3
- digichem/result/spectroscopy.py +5 -4
- digichem/result/tdm.py +5 -5
- digichem/result/vibration.py +15 -6
- digichem/test/test_input.py +17 -3
- digichem/test/test_parsing.py +9 -0
- digichem/test/test_prattle.py +31 -2
- {digichem_core-6.10.3.dist-info → digichem_core-7.0.0.dist-info}/METADATA +1 -1
- {digichem_core-6.10.3.dist-info → digichem_core-7.0.0.dist-info}/RECORD +37 -37
- {digichem_core-6.10.3.dist-info → digichem_core-7.0.0.dist-info}/WHEEL +0 -0
- {digichem_core-6.10.3.dist-info → digichem_core-7.0.0.dist-info}/licenses/COPYING.md +0 -0
- {digichem_core-6.10.3.dist-info → digichem_core-7.0.0.dist-info}/licenses/LICENSE +0 -0
digichem/parse/util.py
CHANGED
|
@@ -60,7 +60,7 @@ def find_log_files_from_hint(hint):
|
|
|
60
60
|
# Remove any 'digichem.log' files as we know these are not calc log files.
|
|
61
61
|
# We don't actually write 'digichem.log' files anymore either (we use digichem.out instead),
|
|
62
62
|
# but older versions did...
|
|
63
|
-
log_files = [log_file for log_file in log_files if log_file.name not in ["digichem.log", "digichem.out", "silico.log", "silico.out"]]
|
|
63
|
+
log_files = [log_file for log_file in log_files if log_file.name not in ["digichem.log", "digichem.out", "silico.log", "silico.out", ".digichem.yaml"]]
|
|
64
64
|
else:
|
|
65
65
|
parent = hint.parent
|
|
66
66
|
log_files = [hint]
|
|
@@ -227,10 +227,10 @@ def parse_calculation(*log_files, options, parse_all = False, format_hint = "aut
|
|
|
227
227
|
open_log_files, open_aux_files = archive.open()
|
|
228
228
|
|
|
229
229
|
if parse_all:
|
|
230
|
-
results = from_log_files(*open_log_files, format_hint = format_hint, parser_options = parser_options, **open_aux_files).process_all(
|
|
230
|
+
results = from_log_files(*open_log_files, format_hint = format_hint, parser_options = parser_options, options = options, **open_aux_files).process_all()
|
|
231
231
|
|
|
232
232
|
else:
|
|
233
|
-
results = from_log_files(*open_log_files, format_hint = format_hint, parser_options = parser_options, **open_aux_files).process(
|
|
233
|
+
results = from_log_files(*open_log_files, format_hint = format_hint, parser_options = parser_options, options = options, **open_aux_files).process()
|
|
234
234
|
|
|
235
235
|
finally:
|
|
236
236
|
if not keep_archive:
|
|
@@ -379,7 +379,6 @@ def parse_and_merge_multiple_calculations(*multiple_results, options, parser_opt
|
|
|
379
379
|
:param multiple_results: A list of two dimensions, where the first dimension is a list of separate results to process, and the second dimension is a list of results that should be merged together.
|
|
380
380
|
:param options: A Digichem options nested dictionary containing options to control parsing.
|
|
381
381
|
:param format_hint: A hint as to the format of the given log files. Either 'auto' (to guess), 'log' (calc log file), 'sir' (digichem result file) or 'sid' (digichem database file).
|
|
382
|
-
:param pool: An optional subprocessing.pool object to use for parallel parsing.
|
|
383
382
|
:param init_func: An optional function to call to init each newly created process.
|
|
384
383
|
:param processes: The max number of processes to create the new pool object with.
|
|
385
384
|
:param auxiliary_files: An optional list of lists of dicts of auxiliary files. Each item in auxiliary_files should match the corresponding log file in multiple_results.
|
|
@@ -388,6 +387,7 @@ def parse_and_merge_multiple_calculations(*multiple_results, options, parser_opt
|
|
|
388
387
|
if auxiliary_files is None:
|
|
389
388
|
auxiliary_files = [None] * len(multiple_results)
|
|
390
389
|
|
|
390
|
+
pool = None
|
|
391
391
|
# Do some parsing.
|
|
392
392
|
# TODO: This parallelization isn't ideal, currently we process each group of to-be merged calcs separately, meaning processes can be wasted.
|
|
393
393
|
try:
|
|
@@ -402,7 +402,8 @@ def parse_and_merge_multiple_calculations(*multiple_results, options, parser_opt
|
|
|
402
402
|
return result_lists
|
|
403
403
|
|
|
404
404
|
finally:
|
|
405
|
-
pool
|
|
405
|
+
if pool:
|
|
406
|
+
pool.__exit__(None, None, None)
|
|
406
407
|
|
|
407
408
|
|
|
408
409
|
class open_for_parsing():
|
|
@@ -240,11 +240,11 @@ class Alignment(Atom_list, Dynamic_parent):
|
|
|
240
240
|
for atom in self:
|
|
241
241
|
print("{}, {}, {}, {}".format(atom.element, atom.coords[0], atom.coords[1], atom.coords[2]))
|
|
242
242
|
|
|
243
|
-
def
|
|
243
|
+
def _dump_(self, digichem_options, all):
|
|
244
244
|
"""
|
|
245
245
|
Get a representation of this result object in primitive format.
|
|
246
246
|
"""
|
|
247
|
-
dump_dict = super().
|
|
247
|
+
dump_dict = super()._dump_(digichem_options, all)
|
|
248
248
|
dump_dict['alignment_method'] = self.human_method_type
|
|
249
249
|
return dump_dict
|
|
250
250
|
|
digichem/result/atom.py
CHANGED
|
@@ -453,7 +453,7 @@ class Atom_list(Result_container, Unmergeable_container_mixin, Molecule_mixin):
|
|
|
453
453
|
"""
|
|
454
454
|
return self(Atom.list_from_coords(coords), charge = coords.charge)
|
|
455
455
|
|
|
456
|
-
def
|
|
456
|
+
def _dump_(self, digichem_options, all):
|
|
457
457
|
"""
|
|
458
458
|
Get a representation of this result object in primitive format.
|
|
459
459
|
"""
|
|
@@ -490,7 +490,7 @@ class Atom_list(Result_container, Unmergeable_container_mixin, Molecule_mixin):
|
|
|
490
490
|
},
|
|
491
491
|
"linearity_ratio": float(self.get_linear_ratio()),
|
|
492
492
|
"planarity_ratio": float(self.get_planar_ratio()),
|
|
493
|
-
"values": super().
|
|
493
|
+
"values": super()._dump_(digichem_options, all),
|
|
494
494
|
}
|
|
495
495
|
return dump_dict
|
|
496
496
|
|
|
@@ -522,7 +522,7 @@ class Atom_list(Result_container, Unmergeable_container_mixin, Molecule_mixin):
|
|
|
522
522
|
"""
|
|
523
523
|
Convert this list of atoms to mol format (useful for reading with rdkit).
|
|
524
524
|
"""
|
|
525
|
-
return Openprattle_converter
|
|
525
|
+
return Openprattle_converter(input_file_buffer = self.to_xyz(), input_file_path = "internal atoms object", input_file_type = "xyz").convert("mol", charge = self.charge)
|
|
526
526
|
|
|
527
527
|
def to_rdkit_molecule(self):
|
|
528
528
|
"""
|
|
@@ -673,7 +673,7 @@ class Atom(Atom_ABC):
|
|
|
673
673
|
"""
|
|
674
674
|
return math.sqrt( (self.coords[0] - foreign_atom.coords[0])**2 + (self.coords[1] - foreign_atom.coords[1])**2 + (self.coords[2] - foreign_atom.coords[2])**2)
|
|
675
675
|
|
|
676
|
-
def
|
|
676
|
+
def _dump_(self, digichem_options, all):
|
|
677
677
|
"""
|
|
678
678
|
Get a representation of this result object in primitive format.
|
|
679
679
|
"""
|
digichem/result/base.py
CHANGED
|
@@ -93,17 +93,55 @@ class Result_object():
|
|
|
93
93
|
|
|
94
94
|
return multiple_objects[0]
|
|
95
95
|
|
|
96
|
+
def calculate(self, item, digichem_options):
|
|
97
|
+
"""
|
|
98
|
+
Retrieve/calculate an on-demand value, caching the value if it has not already been retrieved.
|
|
99
|
+
|
|
100
|
+
This function is a wrapper around _get_dump_(), caching the calculation result to avoid
|
|
101
|
+
expensive recalculation.
|
|
102
|
+
|
|
103
|
+
:param item: The key corresponding to an item in this object's _get_dump_() dict.
|
|
104
|
+
:param digichem_options: Digichem options that will be passed to _get_dump_() (unused on a cache hit).
|
|
105
|
+
"""
|
|
106
|
+
if not hasattr(self, "_dump_cache"):
|
|
107
|
+
self._dump_cache = {}
|
|
108
|
+
|
|
109
|
+
if item in self._dump_cache:
|
|
110
|
+
# Cache hit.
|
|
111
|
+
return self._dump_cache[item]
|
|
112
|
+
|
|
113
|
+
else:
|
|
114
|
+
# Cache miss.
|
|
115
|
+
# Generate (and cache) the data.
|
|
116
|
+
self._dump_cache[item] = self.generate_for_dump()[item](digichem_options)
|
|
117
|
+
|
|
118
|
+
# And return of course.
|
|
119
|
+
return self._dump_cache[item]
|
|
120
|
+
|
|
96
121
|
def generate_for_dump(self):
|
|
97
122
|
"""
|
|
98
123
|
Method used to get a dictionary used to generate on-demand values for dumping.
|
|
99
124
|
|
|
100
125
|
This functionality is useful for hiding expense properties from the normal dump process, while still exposing them when specifically requested.
|
|
101
126
|
|
|
102
|
-
Each key in the returned
|
|
127
|
+
Each key in the returned dict is the name of a dumpable item, each value is a function to call with digichem_options as its only param.
|
|
103
128
|
"""
|
|
104
|
-
|
|
129
|
+
warnings.warn("generate_for_dump() is deprecated, use calculate() or _get_dump_() instead", DeprecationWarning)
|
|
130
|
+
return self._get_dump_()
|
|
105
131
|
|
|
106
|
-
def dump(self, digichem_options):
|
|
132
|
+
def dump(self, digichem_options, all = False):
|
|
133
|
+
# First, get simple key:value pairs.
|
|
134
|
+
base_dict = self._dump_(digichem_options, all)
|
|
135
|
+
|
|
136
|
+
# Then extend with generator ones if we have any.
|
|
137
|
+
if all:
|
|
138
|
+
generators = self._get_dump_()
|
|
139
|
+
for key in generators:
|
|
140
|
+
base_dict[key] = generators[key](digichem_options)
|
|
141
|
+
|
|
142
|
+
return base_dict
|
|
143
|
+
|
|
144
|
+
def _dump_(self, digichem_options, all):
|
|
107
145
|
"""
|
|
108
146
|
Abstract function that is called to dump the value of the result object to a primitive type, suitable for serializing with yaml.
|
|
109
147
|
|
|
@@ -112,6 +150,16 @@ class Result_object():
|
|
|
112
150
|
- 'units': The units of the result (for example, k m^-s).
|
|
113
151
|
"""
|
|
114
152
|
raise NotImplementedError("Implement in subclass")
|
|
153
|
+
|
|
154
|
+
def _get_dump_(self):
|
|
155
|
+
"""
|
|
156
|
+
Method used to get a dictionary used to generate on-demand values for dumping.
|
|
157
|
+
|
|
158
|
+
This functionality is useful for hiding expense properties from the normal dump process, while still exposing them when specifically requested.
|
|
159
|
+
|
|
160
|
+
Each key in the returned dict is the name of a dumpable item, each value is a function to call with digichem_options as its only param.
|
|
161
|
+
"""
|
|
162
|
+
return {}
|
|
115
163
|
|
|
116
164
|
|
|
117
165
|
class Floatable_mixin():
|
|
@@ -253,6 +301,6 @@ class Result_container(list, Result_object):
|
|
|
253
301
|
else:
|
|
254
302
|
return self.merge_default(*multiple_lists, **kwargs)
|
|
255
303
|
|
|
256
|
-
def
|
|
257
|
-
return [item.dump(digichem_options) for item in self]
|
|
304
|
+
def _dump_(self, digichem_options, all):
|
|
305
|
+
return [item.dump(digichem_options, all) for item in self]
|
|
258
306
|
|
digichem/result/dipole_moment.py
CHANGED
|
@@ -182,7 +182,7 @@ class Dipole_moment_ABC(Result_object):
|
|
|
182
182
|
except (FloatingPointError, ZeroDivisionError):
|
|
183
183
|
return 0
|
|
184
184
|
|
|
185
|
-
def
|
|
185
|
+
def _dump_(self, digichem_options, all):
|
|
186
186
|
"""
|
|
187
187
|
Get a representation of this result object in primitive format.
|
|
188
188
|
"""
|
digichem/result/emission.py
CHANGED
|
@@ -27,11 +27,11 @@ class Emissions(Result_object):
|
|
|
27
27
|
self.adiabatic = adiabatic if adiabatic is not None else {}
|
|
28
28
|
self.vertical = vertical if vertical is not None else {}
|
|
29
29
|
|
|
30
|
-
def
|
|
30
|
+
def _dump_(self, digichem_options, all):
|
|
31
31
|
# Several dumpers (JSON, DB backends based on JSON etc) don't support non-string keys...
|
|
32
32
|
return {
|
|
33
|
-
"adiabatic": {str(key):value.dump(digichem_options) for key,value in self.adiabatic.items()},
|
|
34
|
-
"vertical": {str(key):value.dump(digichem_options) for key,value in self.vertical.items()}
|
|
33
|
+
"adiabatic": {str(key):value.dump(digichem_options, all) for key,value in self.adiabatic.items()},
|
|
34
|
+
"vertical": {str(key):value.dump(digichem_options, all) for key,value in self.vertical.items()}
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
@classmethod
|
|
@@ -343,12 +343,12 @@ class Relaxed_excited_state(Excited_state):
|
|
|
343
343
|
else:
|
|
344
344
|
raise
|
|
345
345
|
|
|
346
|
-
def
|
|
346
|
+
def _dump_(self, digichem_options, all):
|
|
347
347
|
"""
|
|
348
348
|
Get a representation of this result object in primitive format.
|
|
349
349
|
"""
|
|
350
350
|
|
|
351
|
-
dump_dict = super().
|
|
351
|
+
dump_dict = super()._dump_(digichem_options, all)
|
|
352
352
|
dump_dict['emission_type'] = self.emission_type
|
|
353
353
|
dump_dict['ground_multiplicity'] = self.ground_multiplicity
|
|
354
354
|
dump_dict['excited_energy'] = {
|
digichem/result/energy.py
CHANGED
|
@@ -65,7 +65,7 @@ class Energies(Result_object):
|
|
|
65
65
|
scf = SCF_energy_list.from_parser(parser)
|
|
66
66
|
)
|
|
67
67
|
|
|
68
|
-
def
|
|
68
|
+
def _dump_(self, digichem_options, all):
|
|
69
69
|
"""
|
|
70
70
|
Get a representation of this result object in primitive format.
|
|
71
71
|
"""
|
|
@@ -74,11 +74,11 @@ class Energies(Result_object):
|
|
|
74
74
|
"value": float(self.final),
|
|
75
75
|
"units": "eV"
|
|
76
76
|
},
|
|
77
|
-
"scf": self.scf.dump(digichem_options),
|
|
78
|
-
"mp": self.mp.dump(digichem_options),
|
|
79
|
-
"cc": self.cc.dump(digichem_options)
|
|
77
|
+
"scf": self.scf.dump(digichem_options, all),
|
|
78
|
+
"mp": self.mp.dump(digichem_options, all),
|
|
79
|
+
"cc": self.cc.dump(digichem_options, all)
|
|
80
80
|
}
|
|
81
|
-
dump.update({"mp{}".format(index+2): energy.dump(digichem_options) for index, energy in enumerate(self.mp_energies)})
|
|
81
|
+
dump.update({"mp{}".format(index+2): energy.dump(digichem_options, all) for index, energy in enumerate(self.mp_energies)})
|
|
82
82
|
return dump
|
|
83
83
|
|
|
84
84
|
@classmethod
|
|
@@ -210,7 +210,7 @@ class Energy_list(Result_container, Unmergeable_container_mixin):
|
|
|
210
210
|
except AttributeError:
|
|
211
211
|
return self()
|
|
212
212
|
|
|
213
|
-
def
|
|
213
|
+
def _dump_(self, digichem_options, all):
|
|
214
214
|
"""
|
|
215
215
|
Get a representation of this result object in primitive format.
|
|
216
216
|
"""
|
|
@@ -270,11 +270,11 @@ class MP_energy_list(Energy_list):
|
|
|
270
270
|
super().__init__(items)
|
|
271
271
|
self.order = order
|
|
272
272
|
|
|
273
|
-
def
|
|
273
|
+
def _dump_(self, digichem_options, all):
|
|
274
274
|
"""
|
|
275
275
|
Get a representation of this result object in primitive format.
|
|
276
276
|
"""
|
|
277
|
-
dump = super().
|
|
277
|
+
dump = super()._dump_(digichem_options, all)
|
|
278
278
|
dump['order'] = self.order
|
|
279
279
|
return dump
|
|
280
280
|
|
digichem/result/excited_state.py
CHANGED
|
@@ -230,7 +230,7 @@ class Excited_state_list(Result_container):
|
|
|
230
230
|
merged.assign_levels()
|
|
231
231
|
return merged
|
|
232
232
|
|
|
233
|
-
def
|
|
233
|
+
def _get_dump_(self):
|
|
234
234
|
"""
|
|
235
235
|
Method used to get a dictionary used to generate on-demand values for dumping.
|
|
236
236
|
|
|
@@ -257,14 +257,21 @@ class Excited_state_list(Result_container):
|
|
|
257
257
|
# TODO: It's weird that these spectra are only available in dumped format, there should be some property/function on the class that also returns them...
|
|
258
258
|
spectrum_nm = Absorption_emission_graph.from_excited_states(
|
|
259
259
|
self,
|
|
260
|
-
digichem_options['absorption_spectrum']['fwhm'],
|
|
261
|
-
digichem_options['absorption_spectrum']['gaussian_resolution'],
|
|
262
|
-
digichem_options['absorption_spectrum']['gaussian_cutoff'],
|
|
260
|
+
fwhm = digichem_options['absorption_spectrum']['fwhm'],
|
|
261
|
+
resolution = digichem_options['absorption_spectrum']['gaussian_resolution'],
|
|
262
|
+
cutoff = digichem_options['absorption_spectrum']['gaussian_cutoff'],
|
|
263
|
+
filter = digichem_options['absorption_spectrum']['y_filter'],
|
|
263
264
|
use_jacobian = digichem_options['absorption_spectrum']['use_jacobian']
|
|
264
265
|
)
|
|
265
266
|
|
|
266
267
|
|
|
267
|
-
spectrum_ev = Spectroscopy_graph(
|
|
268
|
+
spectrum_ev = Spectroscopy_graph(
|
|
269
|
+
[(excited_state.energy, excited_state.oscillator_strength) for excited_state in self],
|
|
270
|
+
fwhm = digichem_options['absorption_spectrum']['fwhm'],
|
|
271
|
+
resolution = digichem_options['absorption_spectrum']['gaussian_resolution'],
|
|
272
|
+
cutoff = digichem_options['absorption_spectrum']['gaussian_cutoff'],
|
|
273
|
+
filter = digichem_options['absorption_spectrum']['y_filter']
|
|
274
|
+
)
|
|
268
275
|
|
|
269
276
|
try:
|
|
270
277
|
spectrum_nm_data = spectrum_nm.plot_cumulative_gaussian()
|
|
@@ -298,9 +305,9 @@ class Excited_state_list(Result_container):
|
|
|
298
305
|
}
|
|
299
306
|
}
|
|
300
307
|
|
|
301
|
-
def
|
|
308
|
+
def _dump_(self, digichem_options, all):
|
|
302
309
|
dump_dict = {
|
|
303
|
-
"values": super().
|
|
310
|
+
"values": super()._dump_(digichem_options, all),
|
|
304
311
|
}
|
|
305
312
|
|
|
306
313
|
# Add extra properties.
|
|
@@ -358,7 +365,7 @@ class Excited_state_transition(Result_object):
|
|
|
358
365
|
"""
|
|
359
366
|
return self.coefficient **2
|
|
360
367
|
|
|
361
|
-
def
|
|
368
|
+
def _dump_(self, digichem_options, all):
|
|
362
369
|
"""
|
|
363
370
|
Get a representation of this result object in primitive format.
|
|
364
371
|
"""
|
|
@@ -558,7 +565,7 @@ class Energy_state(Result_object, Floatable_mixin):
|
|
|
558
565
|
"""
|
|
559
566
|
return "{}({})".format(self.multiplicity_symbol, self.multiplicity_level)
|
|
560
567
|
|
|
561
|
-
def
|
|
568
|
+
def _dump_(self, digichem_options, all):
|
|
562
569
|
"""
|
|
563
570
|
Get a representation of this result object in primitive format.
|
|
564
571
|
"""
|
|
@@ -708,11 +715,11 @@ class Excited_state(Energy_state):
|
|
|
708
715
|
# Now convert to 0 -> 255 and return.
|
|
709
716
|
return [int(clr * 255) for clr in rgb]
|
|
710
717
|
|
|
711
|
-
def
|
|
718
|
+
def _dump_(self, digichem_options, all):
|
|
712
719
|
"""
|
|
713
720
|
Get a representation of this result object in primitive format.
|
|
714
721
|
"""
|
|
715
|
-
dump_dict = super().
|
|
722
|
+
dump_dict = super()._dump_(digichem_options, all)
|
|
716
723
|
dump_dict.update({
|
|
717
724
|
"wavelength": {
|
|
718
725
|
"value": float(self.wavelength),
|
|
@@ -725,8 +732,8 @@ class Excited_state(Energy_state):
|
|
|
725
732
|
},
|
|
726
733
|
"symmetry": self.symmetry,
|
|
727
734
|
"oscillator_strength": float(self.oscillator_strength) if self.oscillator_strength is not None else None,
|
|
728
|
-
"tdm": self.transition_dipole_moment.dump(digichem_options) if self.transition_dipole_moment is not None else None,
|
|
729
|
-
"transitions": [tran.dump(digichem_options) for tran in self.transitions],
|
|
735
|
+
"tdm": self.transition_dipole_moment.dump(digichem_options, all) if self.transition_dipole_moment is not None else None,
|
|
736
|
+
"transitions": [tran.dump(digichem_options, all) for tran in self.transitions],
|
|
730
737
|
})
|
|
731
738
|
return dump_dict
|
|
732
739
|
|
digichem/result/ground_state.py
CHANGED
|
@@ -35,11 +35,11 @@ class Ground_state(Energy_state):
|
|
|
35
35
|
"""
|
|
36
36
|
return self.charge == other.charge and self.multiplicity == other.multiplicity and self.energy == other.energy
|
|
37
37
|
|
|
38
|
-
def
|
|
38
|
+
def _dump_(self, digichem_options, all):
|
|
39
39
|
"""
|
|
40
40
|
Get a representation of this result object in primitive format.
|
|
41
41
|
"""
|
|
42
|
-
parent_dict = super().
|
|
42
|
+
parent_dict = super()._dump_(digichem_options, all)
|
|
43
43
|
return {
|
|
44
44
|
"index": parent_dict['index'],
|
|
45
45
|
"symbol": parent_dict['symbol'],
|
digichem/result/metadata.py
CHANGED
|
@@ -46,10 +46,10 @@ class Solvent(Result_object):
|
|
|
46
46
|
@classmethod
|
|
47
47
|
def from_parser(self, parser):
|
|
48
48
|
"""
|
|
49
|
-
Construct a
|
|
49
|
+
Construct a Solvent object from an output file parser.
|
|
50
50
|
|
|
51
51
|
:param parser: Output data parser.
|
|
52
|
-
:return: A populated
|
|
52
|
+
:return: A populated Solvent object.
|
|
53
53
|
"""
|
|
54
54
|
return self(
|
|
55
55
|
name = parser.data.metadata.get('solvent_name', None),
|
|
@@ -78,7 +78,7 @@ class Solvent(Result_object):
|
|
|
78
78
|
else:
|
|
79
79
|
return "Unknown"
|
|
80
80
|
|
|
81
|
-
def
|
|
81
|
+
def _dump_(self, digichem_options, all):
|
|
82
82
|
return {
|
|
83
83
|
"model": self.model,
|
|
84
84
|
"name": self.name,
|
|
@@ -142,6 +142,7 @@ class Metadata(Result_object):
|
|
|
142
142
|
|
|
143
143
|
def __init__(
|
|
144
144
|
self,
|
|
145
|
+
jobId = None,
|
|
145
146
|
name = None,
|
|
146
147
|
user = None,
|
|
147
148
|
log_files = None,
|
|
@@ -177,6 +178,7 @@ class Metadata(Result_object):
|
|
|
177
178
|
"""
|
|
178
179
|
Constructor for result Metadata objects.
|
|
179
180
|
|
|
181
|
+
:param jobId: If this result was generated from a digichem calculation, the relevant jobID.
|
|
180
182
|
:param name: Optional name of this calculation result.
|
|
181
183
|
:param user: The username of the user who parsed this result.
|
|
182
184
|
:param log_files: An optional list of text-based calculation log files from which this result was parsed.
|
|
@@ -203,6 +205,7 @@ class Metadata(Result_object):
|
|
|
203
205
|
:param memory_available: The maximum amount of memory available to this calculation (the amount requested by the user).
|
|
204
206
|
:param memory_used: The maximum amount of memory used by the calculation (the amount requested by the user).
|
|
205
207
|
"""
|
|
208
|
+
self.jobId = jobId
|
|
206
209
|
self.num_calculations = 1
|
|
207
210
|
self.name = name
|
|
208
211
|
self.user = user
|
|
@@ -453,6 +456,7 @@ class Metadata(Result_object):
|
|
|
453
456
|
|
|
454
457
|
# TODO: This doesn't seem to make sense; the parser already contains a metadata object...
|
|
455
458
|
return self(
|
|
459
|
+
jobId = parser.data.metadata.get('jobId', None),
|
|
456
460
|
name = parser.data.metadata.get('name', None),
|
|
457
461
|
user = parser.data.metadata.get('user', None),
|
|
458
462
|
log_files = parser.data.metadata.get('log_files', None),
|
|
@@ -485,7 +489,7 @@ class Metadata(Result_object):
|
|
|
485
489
|
# There is no metadata available, give up.
|
|
486
490
|
raise Result_unavailable_error("Metadata", "no metadata is available")
|
|
487
491
|
|
|
488
|
-
def
|
|
492
|
+
def _dump_(self, digichem_options, all):
|
|
489
493
|
"""
|
|
490
494
|
Get a representation of this result object in primitive format.
|
|
491
495
|
"""
|
|
@@ -497,6 +501,7 @@ class Metadata(Result_object):
|
|
|
497
501
|
}
|
|
498
502
|
|
|
499
503
|
attrs = [
|
|
504
|
+
"jobId",
|
|
500
505
|
"history",
|
|
501
506
|
"charge",
|
|
502
507
|
"multiplicity",
|
|
@@ -538,7 +543,7 @@ class Metadata(Result_object):
|
|
|
538
543
|
"value": self.pressure,
|
|
539
544
|
"units": "atm"
|
|
540
545
|
}
|
|
541
|
-
attr_dict["solvent"] = self.solvent.dump(digichem_options)
|
|
546
|
+
attr_dict["solvent"] = self.solvent.dump(digichem_options, all)
|
|
542
547
|
|
|
543
548
|
attr_dict['num_cpu'] = self.num_cpu
|
|
544
549
|
for attr_name in ("memory_used", "memory_available"):
|
|
@@ -554,7 +559,7 @@ class Metadata(Result_object):
|
|
|
554
559
|
"units": None
|
|
555
560
|
}
|
|
556
561
|
|
|
557
|
-
attr_dict['performance'] = self.performance.dump(digichem_options) if self.performance else None
|
|
562
|
+
attr_dict['performance'] = self.performance.dump(digichem_options, all) if self.performance else None
|
|
558
563
|
|
|
559
564
|
return attr_dict
|
|
560
565
|
|
|
@@ -731,20 +736,6 @@ class Performance(Result_object):
|
|
|
731
736
|
scratch_available = parser.data.metadata['performance']['scratch_available'].tolist()
|
|
732
737
|
)
|
|
733
738
|
|
|
734
|
-
|
|
735
|
-
return self(
|
|
736
|
-
duration = parser.data.metadata['performance'][:, 0].tolist(),
|
|
737
|
-
memory_used = parser.data.metadata['performance'][:, 1].tolist(),
|
|
738
|
-
memory_allocated = Memory(parser.data.metadata['memory_available']) if "memory_available" in parser.data.metadata else None,
|
|
739
|
-
memory_used_percent = parser.data.metadata['performance'][:, 2].tolist(),
|
|
740
|
-
memory_available = parser.data.metadata['performance'][:, 3].tolist(),
|
|
741
|
-
memory_available_percent = parser.data.metadata['performance'][:, 4].tolist(),
|
|
742
|
-
cpu_used = parser.data.metadata['performance'][:, 5].tolist(),
|
|
743
|
-
cpu_allocated = parser.data.metadata.get('num_cpu', None),
|
|
744
|
-
output_space = parser.data.metadata['performance'][:, 6].tolist(),
|
|
745
|
-
scratch_space = parser.data.metadata['performance'][:, 7].tolist()
|
|
746
|
-
)
|
|
747
|
-
|
|
748
739
|
@property
|
|
749
740
|
def max_mem(self):
|
|
750
741
|
"""
|
|
@@ -846,7 +837,7 @@ class Performance(Result_object):
|
|
|
846
837
|
)
|
|
847
838
|
|
|
848
839
|
|
|
849
|
-
def
|
|
840
|
+
def _dump_(self, digichem_options, all):
|
|
850
841
|
"""
|
|
851
842
|
Get a representation of this result object in primitive format.
|
|
852
843
|
"""
|