meta 2.0 changes

parent 49782a92
......@@ -56,6 +56,10 @@ json_section_template = """{
def metaN(metaName):
"""Retrurns a normalized meta name"""
return metaName.replace(".", "_").lower()
class OctInputVar:
def __init__(self, name, octtype, section):
self.name = name
......@@ -65,7 +69,7 @@ class OctInputVar:
def _get_json(self, role, supername):
description = (r'Octopus %s \"%s\" of type \"%s\" in section \"%s\"'
% (role, self.name, self.octtype, self.section))
return json_template % dict(name='%s_%s' % (supername, self.name),
return json_template % dict(name=metaN('%s_%s' % (supername, self.name)),
dtypeStr=octtype2nomadtype[self.octtype],
supername=supername,
description=description)
......
......@@ -57,6 +57,9 @@ those if many uploaded calculations contain those formats. I think it
is largely irrelevant.
"""
def metaN(metaName):
"""Retrurns a normalized meta name"""
return metaName.replace(".", "_").lower()
def parse_infofile(meta_info_env, pew, fname):
with open(fname) as fd:
......@@ -77,9 +80,9 @@ def parse_infofile(meta_info_env, pew, fname):
'Ion-ion': 'x_octopus_info_energy_ion_ion',
'Eigenvalues': 'energy_sum_eigenvalues',
'Hartree': 'energy_electrostatic',
'Exchange': 'energy_X',
'Correlation': 'energy_C',
'vanderWaals': 'energy_van_der_Waals',
'Exchange': 'energy_x',
'Correlation': 'energy_c',
'vanderWaals': 'energy_van_der_waals',
'-TS': 'energy_correction_entropy',
'Kinetic': 'electronic_kinetic_energy'}
......@@ -91,7 +94,7 @@ def parse_infofile(meta_info_env, pew, fname):
break
if tokens[0] in names:
pew.addValue(names[tokens[0]],
pew.addValue(metaN(names[tokens[0]]),
convert_unit(float(tokens[2]), nomadunit))
......@@ -364,7 +367,7 @@ def register_octopus_keywords(pew, category, kwargs):
# Some keywords (e.g. Spacing) specify float as type, but they
# can actually be blocks. (block is a type itself)
else:
pew.addValue(name, value)
pew.addValue(metaN(name), value)
def parse(fname, fd):
......@@ -553,16 +556,20 @@ def parse(fname, fd):
xcfunctional = kwargs.get('xcfunctional', default_xc)
for functional in xcfunctional.split('+'):
functional = functional.strip().upper()
with open_section('section_XC_functionals'):
pew.addValue('XC_functional_name', functional)
with open_section('section_xc_functionals'):
pew.addValue('xc_functional_name', functional)
forces = calc.results.get('forces')
if forces is not None:
pew.addArrayValues('atom_forces_free_raw',
fId = pew.openSection('section_atom_forces')
pew.addValue('atom_forces_quantity', 'energy_free')
pew.addValue('atom_forces_constraints', 'raw')
pew.addArrayValues('atom_forces',
convert_unit(forces, 'eV'))
pew.closeSection('section_atom_forces', fId)
# Convergence parameters?
pew.addValue('single_configuration_to_calculation_method_ref',
pew.addValue('single_configuration_calculation_to_method_ref',
method_gid)
with open_section('section_eigenvalues'):
......
......@@ -53,8 +53,8 @@ Simulation Box:
"parser-octopus/setup_paths.py",
"nomad_meta_info/public.nomadmetainfo.json",
"nomad_meta_info/common.nomadmetainfo.json",
"nomad_meta_info/meta_types.nomadmetainfo.json",
"nomad_meta_info/octopus.autogenerated.nomadmetainfo.json",
"nomad_meta_info/meta.nomadmetainfo.json",
"nomad_meta_info/octopus_autogenerated.nomadmetainfo.json",
"nomad_meta_info/octopus.nomadmetainfo.json"
) ++ DefaultPythonInterpreter.commonFiles(),
dirMap = Map(
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment