Skip to content
Snippets Groups Projects
Commit 18e0afb0 authored by Daria Tomecka's avatar Daria Tomecka
Browse files

wien2k: updates and parsing charge distances between two interations

parent 90c94f2a
No related branches found
No related tags found
No related merge requests found
......@@ -121,10 +121,10 @@ mainFileDescription = SM(
SM(r":DTO(?P<x_wien2k_atom_nr>[-+0-9]+)[0-9]*:\sTOTAL\s*DIFFERENCE\s*CHARGE\W*\w*\s*IN\s*SPHERE\s*(?P<x_wien2k_sphere_nr>[-+0-9]+)\s*=\s*(?P<x_wien2k_tot_diff_charge>[-+0-9.]+)", repeats = True),
SM(r":CTO\s*:\s*\sTOTAL\s*INTERSTITIAL\s*CHARGE=\s*(?P<x_wien2k_tot_int_charge>[-+0-9.]+)"),
SM(r":CTO(?P<x_wien2k_atom_nr>[-+0-9]+)[0-9]*:\s*\sTOTAL\s*CHARGE\s*IN\s*SPHERE\s*(?P<x_wien2k_sphere_nr>[-+0-9]+)\s*=\s*(?P<x_wien2k_tot_charge_in_sphere>[-+0-9.]+)",repeats = True),
SM(r":ENE\s*:\s*\W*\w*\W*\s*TOTAL\s*ENERGY\s*IN\s*Ry\s*=\s*(?P<x_wien2k_total_ene>[-+0-9.]+)"),
SM(r":ENE\s*:\s*\W*\w*\W*\s*TOTAL\s*ENERGY\s*IN\s*Ry\s*=\s*(?P<energy_total>[-+0-9.]+)"),
SM(r":FOR[0-9]*:\s*(?P<x_wien2k_atom_nr>[0-9]+).ATOM\s*(?P<x_wien2k_for_abs>[0-9.]+)\s*(?P<x_wien2k_for_x>[-++0-9.]+)\s*(?P<x_wien2k_for_y>[-+0-9.]+)\s*(?P<x_wien2k_for_z>[-+0-9.]+)\s*partial\sforces", repeats = True),
SM(r":FGL[0-9]*:\s*(?P<x_wien2k_atom_nr>[0-9]+).ATOM\s*(?P<x_wien2k_for_x_gl>[-+0-9.]+)\s*(?P<x_wien2k_for_y_gl>[-+0-9.]+)\s*(?P<x_wien2k_for_z_gl>[-+0-9.]+)\s*partial\sforces", repeats = True)
SM(r":FGL[0-9]*:\s*(?P<x_wien2k_atom_nr>[0-9]+).ATOM\s*(?P<x_wien2k_for_x_gl>[-+0-9.]+)\s*(?P<x_wien2k_for_y_gl>[-+0-9.]+)\s*(?P<x_wien2k_for_z_gl>[-+0-9.]+)\s*partial\sforces", repeats = True),
SM(r":DIS\s*:\s*CHARGE\sDISTANCE\s*\W*[0-9.]+\sfor\satom\s*[0-9]*\sspin\s[0-9]*\W\s*(?P<x_wien2k_charge_distance>[0-9.]+)")
]
)
]
......
......@@ -3,7 +3,8 @@ import setup_paths
from nomadcore.simple_parser import mainFunction, CachingLevel
from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.local_meta_info import loadJsonFile, InfoKindEl
import os, sys, json
import os, sys, json, logging
import numpy as np
class Wien2kStructContext(object):
"""context for wien2k struct parser"""
......@@ -21,6 +22,25 @@ class Wien2kStructContext(object):
# allows to reset values if the same superContext is used to parse different files
self.initialize_values()
def onClose_section_system(self, backend, gIndex, section):
equiv_atoms = section["x_wien2k_section_equiv_atoms"]
#logging.error("section: %s", section)
labels = []
pos = []
for eqAtoms in equiv_atoms:
label = eqAtoms["x_wien2k_atom_name"]
x = eqAtoms["x_wien2k_atom_pos_x"]
y = eqAtoms["x_wien2k_atom_pos_y"]
z = eqAtoms["x_wien2k_atom_pos_z"]
if len(x) != len(y) or len(x) != len(z):
raise Exception("incorrect parsing, different number of x,y,z components")
groupPos = [[x[i],y[i],z[i]] for i in range(len(x))]
nAt = len(groupPos)
labels += [label for i in range(nAt)]
pos += groupPos
backend.addValue("atom_labels", labels)
backend.addValue("atom_positions", pos)
# description of the input
def buildStructureMatchers():
......@@ -66,6 +86,7 @@ def get_cachingLevelForMetaName(metaInfoEnv, CachingLvl):
'section_system': CachingLvl
}
cachingLevelForMetaName["x_wien2k_system_nameIn"] = CachingLevel.ForwardAndCache
cachingLevelForMetaName["x_wien2k_section_equiv_atoms"] = CachingLevel.ForwardAndCache
return cachingLevelForMetaName
# loading metadata from nomad-meta-info/meta_info/nomad_meta_info/fhi_aims.nomadmetainfo.json
......@@ -30,6 +30,8 @@ object Wien2kParser extends SimpleExternalParserGenerator(
"parser-wien2k/wien2k_parser_in0.py",
"parser-wien2k/wien2k_parser_in1c.py",
"parser-wien2k/wien2k_parser_in2c.py",
"parser-wien2k/wien2k_parser_in1.py",
"parser-wien2k/wien2k_parser_in2.py",
"parser-wien2k/wien2k_parser_struct.py",
"parser-wien2k/setup_paths.py",
"nomad_meta_info/public.nomadmetainfo.json",
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment