Commit 320a9541 authored by Mohamed, Fawzi Roberto (fawzi)'s avatar Mohamed, Fawzi Roberto (fawzi)
Browse files

meta 2.0 changes

parent f768736e
......@@ -135,14 +135,14 @@ class Wien2kContext(object):
if self.rootSecMethodIndex is None:
self.rootSecMethodIndex = gIndex
self.secMethodIndex = gIndex
# self.secMethodIndex["single_configuration_to_calculation_method_ref"] = gIndex
# self.secMethodIndex["single_configuration_calculation_to_method_ref"] = gIndex
def onClose_section_single_configuration_calculation(self, backend, gIndex, section):
# write number of SCF iterations
backend.addValue('number_of_scf_iterations', self.scfIterNr)
# write the references to section_method and section_system
backend.addValue('single_configuration_to_calculation_method_ref', self.secMethodIndex)
backend.addValue('single_configuration_calculation_to_method_ref', self.secMethodIndex)
backend.addValue('single_configuration_calculation_to_system_ref', self.secSystemIndex)
......@@ -174,7 +174,9 @@ class Wien2kContext(object):
atom_force.append(api)
if atom_force:
# need to transpose array since its shape is [number_of_atoms,3] in\the metadata
backend.addArrayValues('atom_forces', np.transpose(np.asarray(atom_force)))
fId = backend.openSection('section_atom_forces')
backend.addArrayValues('atom_forces', np.transpose(np.asarray(atom_force)))
backend.closeSection('section_atom_forces', fId)
mainFile = self.parser.fIn.fIn.name
fName = mainFile[:-4] + ".struct"
......@@ -227,11 +229,11 @@ mainFileDescription = SM(
SM(r":POT\s*:\s*POTENTIAL OPTION\s*(?P<x_wien2k_potential_option>[0-9]+)"),
SM(r":LAT\s*:\s*LATTICE CONSTANTS=\s*(?P<x_wien2k_lattice_const_a>[0-9.]+)\s*(?P<x_wien2k_lattice_const_b>[0-9.]+)\s*(?P<x_wien2k_lattice_const_c>[0-9.]+)"),
SM(r":VOL\s*:\s*UNIT CELL VOLUME\s*=\s*(?P<x_wien2k_unit_cell_volume_bohr3>[0-9.]+)"),
SM(r":RKM : MATRIX SIZE (?P<x_wien2k_matrix_size>[0-9]+)\s*LOs:\s*(?P<x_wien2k_LOs>[0-9.]+)\s*RKM=\s*(?P<x_wien2k_rkm>[0-9.]+)\s*WEIGHT=\s*[0-9.]*\s*\w*:"),
SM(r":RKM : MATRIX SIZE (?P<x_wien2k_matrix_size>[0-9]+)\s*LOs:\s*(?P<x_wien2k_los>[0-9.]+)\s*RKM=\s*(?P<x_wien2k_rkm>[0-9.]+)\s*WEIGHT=\s*[0-9.]*\s*\w*:"),
SM(r":KPT\s*:\s*NUMBER\s*OF\s*K-POINTS:\s*(?P<x_wien2k_nr_kpts>[-+0-9.]+)"),
#SM(r":GMA\s*:\s*POTENTIAL\sAND\sCHARGE\sCUT-OFF\s*(?P<x_wien2k_cutoff>[0-9.]+)\s*Ry\*\*[0-9.]+"),
SM(r":GMA\s*:\s*POTENTIAL\sAND\sCHARGE\sCUT-OFF\s*(?P<x_wien2k_cutoff>[0-9.]+)\s*Ry\W\W[0-9.]+"),
SM(r":GAP\s*:\s*(?P<x_wien2k_ene_gap__rydberg>[-+0-9.]+)\s*Ry\s*=\s*(?P<x_wien2k_ene_gap_eV>[-+0-9.]+)\s*eV\s*.*"),
SM(r":GAP\s*:\s*(?P<x_wien2k_ene_gap__rydberg>[-+0-9.]+)\s*Ry\s*=\s*(?P<x_wien2k_ene_gap_ev>[-+0-9.]+)\s*eV\s*.*"),
SM(r":NOE\s*:\s*NUMBER\sOF\sELECTRONS\s*=\s*(?P<x_wien2k_noe>[0-9.]+)"),
SM(r":FER\s*:\s(\w*\s*)*-\s\w*\W\w*\WM\W*=\s*(?P<x_wien2k_fermi_ene__rydberg>[-+0-9.]+)"),
SM(r":GMA\s*:\s*POTENTIAL\sAND\sCHARGE\sCUT-OFF\s*[0-9.]+\s*Ry\W\W[0-9.]+"),
......@@ -262,7 +264,7 @@ mainFileDescription = SM(
cachingLevelForMetaName = {
"XC_functional_name": CachingLevel.ForwardAndCache,
"xc_functional_name": CachingLevel.ForwardAndCache,
"energy_total": CachingLevel.ForwardAndCache
}
......
......@@ -46,7 +46,7 @@ class Wien2kIn0Context(object):
# allows to reset values if the same superContext is used to parse different files
self.initialize_values()
def onClose_x_wien2k_section_XC(self, backend, gIndex, section):
def onClose_x_wien2k_section_xc(self, backend, gIndex, section):
xc_index = section["x_wien2k_indxc"] #[0]
#logging.error("winsectxc: %s -> %s", section, xc_index)
if not xc_index:
......@@ -127,9 +127,9 @@ class Wien2kIn0Context(object):
for xc_name in xc_map_legend:
# for xc_name in xc_map_legend[xc_index]:
s = backend.openSection("section_XC_functionals")
backend.addValue("XC_functional_name", xc_name)
backend.closeSection("section_XC_functionals", s)
s = backend.openSection("section_xc_functionals")
backend.addValue("xc_functional_name", xc_name)
backend.closeSection("section_xc_functionals", s)
# description of the input
def buildIn0Matchers():
......@@ -140,8 +140,8 @@ def buildIn0Matchers():
sections = ["section_run", "section_method"],
subMatchers = [
# SM(name = 'systemName',
# startReStr = r"(?P<x_wien2k_system_nameIn>.*)"),
SM(r"(?P<x_wien2k_switch>\w*)\s*(?P<x_wien2k_indxc>\w*)\s*.*",sections = ['x_wien2k_section_XC']),
# startReStr = r"(?P<x_wien2k_system_namein>.*)"),
SM(r"(?P<x_wien2k_switch>\w*)\s*(?P<x_wien2k_indxc>\w*)\s*.*",sections = ['x_wien2k_section_xc']),
SM(r"\s*(?P<x_wien2k_ifft_x>[0-9]+)\s*(?P<x_wien2k_ifft_y>[0-9]+)\s*(?P<x_wien2k_ifft_z>[0-9]+)\s*(?P<x_wien2k_ifft_factor>[0-9.]+)\s*(?P<x_wien2k_iprint>[0-9]+).*")
])
......
......@@ -55,7 +55,7 @@ def buildIn1Matchers():
sections = ["section_run", "section_method"],
subMatchers = [
# SM(name = 'systemName',
# startReStr = r"(?P<x_wien2k_system_nameIn>.*)"),
# startReStr = r"(?P<x_wien2k_system_namein>.*)"),
SM(r"\s*(?P<x_wien2k_wf_switch>[\w*]+)\s*EF=[-+.0-9]*\s*\W*WFFIL, WFPRI, ENFIL, SUPWF\W"),
SM(r"\s*(?P<x_wien2k_rkmax>[0-9.]+)\s*[0-9]+\s*[0-9]+\s*\WR-..\WK-...; MAX \w*.*")
# SM(r"(?P<x_wien2k_calc_mode>.*)"),
......@@ -67,7 +67,7 @@ def buildIn1Matchers():
# SM(r"\s*[-0-9]+:\s*X=(?P<x_wien2k_atom_pos_x>[-+0-9.eEdD]+)\s*Y=(?P<x_wien2k_atom_pos_y>[-+0-9.eEdD]+)\s*Z=(?P<x_wien2k_atom_pos_z>[-+0-9.eEdD]+)",
# repeats=True
# ),
# SM(r"\s*(?P<x_wien2k_atom_name>^.+)\s*NPT=\s*(?P<x_wien2k_NPT>[0-9]+)\s*R0=(?P<x_wien2k_R0>[0-9.]+)\s*RMT=\s*(?P<x_wien2k_RMT>[0-9.]+)\s*Z:\s*(?P<x_wien2k_atomic_number_Z>[0-9.]+)",)
# SM(r"\s*(?P<x_wien2k_atom_name>^.+)\s*NPT=\s*(?P<x_wien2k_npt>[0-9]+)\s*R0=(?P<x_wien2k_r0>[0-9.]+)\s*RMT=\s*(?P<x_wien2k_rmt>[0-9.]+)\s*Z:\s*(?P<x_wien2k_atomic_number_z>[0-9.]+)",)
# ]
# )
])
......
......@@ -55,7 +55,7 @@ def buildIn1cMatchers():
sections = ["section_run", "section_method"],
subMatchers = [
# SM(name = 'systemName',
# startReStr = r"(?P<x_wien2k_system_nameIn>.*)"),
# startReStr = r"(?P<x_wien2k_system_namein>.*)"),
SM(r"\s*(?P<x_wien2k_wf_switch>[\w*]+)\s*EF=[-+.0-9]*\s*\W*WFFIL, WFPRI, ENFIL, SUPWF\W"),
SM(r"\s*(?P<x_wien2k_rkmax>[0-9.]+)\s*[0-9]+\s*[0-9]+\s*\WR-..\WK-...; MAX \w*.*")
# SM(r"(?P<x_wien2k_calc_mode>.*)"),
......@@ -67,7 +67,7 @@ def buildIn1cMatchers():
# SM(r"\s*[-0-9]+:\s*X=(?P<x_wien2k_atom_pos_x>[-+0-9.eEdD]+)\s*Y=(?P<x_wien2k_atom_pos_y>[-+0-9.eEdD]+)\s*Z=(?P<x_wien2k_atom_pos_z>[-+0-9.eEdD]+)",
# repeats=True
# ),
# SM(r"\s*(?P<x_wien2k_atom_name>^.+)\s*NPT=\s*(?P<x_wien2k_NPT>[0-9]+)\s*R0=(?P<x_wien2k_R0>[0-9.]+)\s*RMT=\s*(?P<x_wien2k_RMT>[0-9.]+)\s*Z:\s*(?P<x_wien2k_atomic_number_Z>[0-9.]+)",)
# SM(r"\s*(?P<x_wien2k_atom_name>^.+)\s*NPT=\s*(?P<x_wien2k_npt>[0-9]+)\s*R0=(?P<x_wien2k_r0>[0-9.]+)\s*RMT=\s*(?P<x_wien2k_rmt>[0-9.]+)\s*Z:\s*(?P<x_wien2k_atomic_number_z>[0-9.]+)",)
# ]
# )
])
......
......@@ -56,7 +56,7 @@ def buildIn2Matchers():
sections = ["section_run", "section_method"],
subMatchers = [
# SM(name = 'systemName',
# startReStr = r"(?P<x_wien2k_system_nameIn>.*)"),
# startReStr = r"(?P<x_wien2k_system_namein>.*)"),
SM(r"\s*(?P<x_wien2k_in2c_switch>[A-Z]+)\s*.*"),
SM(r"\s*(?P<x_wien2k_in2c_emin>[-+0-9.]+)\s*(?P<x_wien2k_in2c_ne>[-+0-9.]+)\s*(?P<x_wien2k_in2c_espermin>[-+0-9.]+)\s*(?P<x_wien2k_in2c_esper0>[-+0-9.]+)\s*.*"),
SM(r"\s*(?P<x_wien2k_smearing_kind>[A-Z]+)\s*\s*(?P<x_wien2k_smearing_width__rydberg>[-+0-9.]+)\s*.*"),
......
......@@ -97,7 +97,7 @@ def buildStructureMatchers():
sections = ["section_run", "section_system"],
subMatchers = [
SM(name = 'systemName',
startReStr = r"(?P<x_wien2k_system_nameIn>.*)"),
startReStr = r"(?P<x_wien2k_system_namein>.*)"),
SM(r"\w+\s*LATTICE,NONEQUIV\.ATOMS.\s*(?P<x_wien2k_nonequiv_atoms>[0-9]+)"),
SM(r"(?P<x_wien2k_calc_mode>.*)"),
# SM(r"\s*(?P<x_wien2k_unit_cell_param_a>[-+0-9.eEdD]+)\s*(?P<x_wien2k_unit_cell_param_b>[-+0-9.eEdD]+)\s*(?P<x_wien2k_unit_cell_param_c>[-+0-9.eEdD]+)\s*(?P<x_wien2k_angle_between_unit_axis_alfa>[-+0-9.eEdD]{9})\s*(?P<x_wien2k_angle_between_unit_axis_beta>[-+0-9.eEdD]{9})\s*(?P<x_wien2k_angle_between_unit_axis_gamma>[-+0-9.eEdD]+)"),
......@@ -110,7 +110,7 @@ def buildStructureMatchers():
repeats=True
),
# SM(r"\s*(?P<atom>.{10})\s*NPT=\s*(?P<NPT>[0-9]+)\s*R0=(?P<r0>[0-9.]+)\s*RMT=\s*(?P<rmt>[0-9.]+)\s*Z:\s*(?P<z>[0-9.]+)",)
SM(r"\s*(?P<x_wien2k_atom_name>^.+)\s*NPT=\s*(?P<x_wien2k_NPT>[0-9]+)\s*R0=(?P<x_wien2k_R0>[0-9.]+)\s*RMT=\s*(?P<x_wien2k_RMT>[0-9.]+)\s*Z:\s*(?P<x_wien2k_atomic_number_Z>[0-9.]+)",)
SM(r"\s*(?P<x_wien2k_atom_name>^.+)\s*NPT=\s*(?P<x_wien2k_npt>[0-9]+)\s*R0=(?P<x_wien2k_r0>[0-9.]+)\s*RMT=\s*(?P<x_wien2k_rmt>[0-9.]+)\s*Z:\s*(?P<x_wien2k_atomic_number_z>[0-9.]+)",)
]
)
])
......@@ -131,7 +131,7 @@ def get_cachingLevelForMetaName(metaInfoEnv, CachingLvl):
'section_run': CachingLvl,
'section_system': CachingLvl
}
cachingLevelForMetaName["x_wien2k_system_nameIn"] = CachingLevel.ForwardAndCache
cachingLevelForMetaName["x_wien2k_system_namein"] = CachingLevel.ForwardAndCache
cachingLevelForMetaName["x_wien2k_section_equiv_atoms"] = CachingLevel.ForwardAndCache
cachingLevelForMetaName["atom_labels"] = CachingLevel.ForwardAndCache
return cachingLevelForMetaName
......
......@@ -52,7 +52,7 @@ object Wien2kParser extends SimpleExternalParserGenerator(
"parser-wien2k/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/meta.nomadmetainfo.json",
"nomad_meta_info/wien2k.nomadmetainfo.json"
) ++ DefaultPythonInterpreter.commonFiles(),
dirMap = Map(
......
Supports Markdown
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