Skip to content
Snippets Groups Projects
Commit 41dd2129 authored by Mikkel Strange's avatar Mikkel Strange
Browse files

add more flexibly structure using try, except

parent 9fb4b631
No related branches found
No related tags found
No related merge requests found
......@@ -95,14 +95,25 @@ def parse(filename):
sref = 'single_configuration_calculation_to_system_ref'
p.addValue(mref, method_gid)
p.addValue(sref, system_gid)
p.addRealValue('energy_total',
c(f.get_total_energy(), 'eV'))
p.addArrayValues('atom_forces',
c(f.get_forces(),
'eV/angstrom'))
p.addArrayValues('atom_forces_raw',
c(f.get_forces(apply_constraint=False),
'eV/angstrom'))
try:
p.addRealValue('energy_total',
c(f.get_total_energy(), 'eV'))
except:
pass
try:
p.addArrayValues('atom_forces',
c(f.get_forces(),
'eV/angstrom'))
except:
pass
try:
p.addArrayValues('atom_forces_raw',
c(f.get_forces(apply_constraint=False),
'eV/angstrom'))
except:
pass
with o(p, 'section_sampling_method'):
ensemble_type = 'NVE' # default ensemble_type
if ds: # if there is a traj.description
......@@ -116,7 +127,10 @@ def parse(filename):
ds['optimizer'].lower())
elif ds['type'] == 'molecular-dynamics':
p.addValue('sampling_method', 'molecular_dynamics')
p.addRealValue('x_asap_temperature', ds['temperature'])
try:
p.addRealValue('x_asap_temperature', ds['temperature'])
except:
pass
md_type = ds['md-type']
if 'Langevin' in md_type:
p.addValue('x_asap_langevin_friction', ds['friction'])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment