Commit 60a2a47f authored by Daria Tomecka's avatar Daria Tomecka
Browse files

wien2k: add number of k-points and in0 input file

parent 222fac77
......@@ -4,7 +4,7 @@ from nomadcore.simple_parser import mainFunction, AncillaryParser, CachingLevel
from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.local_meta_info import loadJsonFile, InfoKindEl
import os, sys, json
import wien2k_parser_struct
import wien2k_parser_struct, wien2k_parser_in0
class Wien2kContext(object):
"""context for wien2k parser"""
......@@ -28,20 +28,33 @@ class Wien2kContext(object):
section["x_wien2k_release_date"][0])
def onOpen_section_system(self, backend, gIndex, section):
structSuperContext = wien2k_parser_struct.Wien2kStructContext()
structParser = AncillaryParser(
fileDescription = wien2k_parser_struct.buildStructureMatchers(),
parser = self.parser,
cachingLevelForMetaName = wien2k_parser_struct.get_cachingLevelForMetaName(self.metaInfoEnv, CachingLevel.PreOpenedIgnore),
superContext = structSuperContext)
mainFile = self.parser.fIn.fIn.name
fName = mainFile[:-4] + ".struct"
if os.path.exists(fName):
structSuperContext = wien2k_parser_struct.Wien2kStructContext()
structParser = AncillaryParser(
fileDescription = wien2k_parser_struct.buildStructureMatchers(),
parser = self.parser,
cachingLevelForMetaName = wien2k_parser_struct.get_cachingLevelForMetaName(self.metaInfoEnv, CachingLevel.PreOpenedIgnore),
superContext = structSuperContext)
with open(fName) as fIn:
structParser.parseFile(fIn)
def onOpen_section_method(self, backend, gIndex, section):
mainFile = self.parser.fIn.fIn.name
fName = mainFile[:-4] + ".in0"
if os.path.exists(fName):
subSuperContext = wien2k_parser_in0.Wien2kIn0Context()
subParser = AncillaryParser(
fileDescription = wien2k_parser_in0.buildIn0Matchers(),
parser = self.parser,
cachingLevelForMetaName = wien2k_parser_in0.get_cachingLevelForMetaName(self.metaInfoEnv, CachingLevel.PreOpenedIgnore),
superContext = subSuperContext)
with open(fName) as fIn:
subParser.parseFile(fIn)
# description of the input
mainFileDescription = SM(
name = 'root',
......@@ -66,22 +79,25 @@ mainFileDescription = SM(
sections=["section_scf_iteration"],
repeats = True,
subMatchers=[
SM(r":NATO :\s*(?P<x_wien2k_number_of_independent_atoms>[0-9]+)INDEPENDENT AND\s*(?P<x_wien2k_total_atoms>[0-9]+)\s*TOTAL ATOMS IN UNITCELL"),
SM(r":NATO\s*:\s*(?P<x_wien2k_nr_of_independent_atoms>[0-9]+)\s*INDEPENDENT AND\s*(?P<x_wien2k_total_atoms>[0-9]+)\s*TOTAL ATOMS IN UNITCELL"),
SM(r"\s*SUBSTANCE: (?P<x_wien2k_system_name>.*)"),
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__angstrom3>[0-9.]+)"),
SM(r":ENE : \W*\w*\W*\TOTAL ENERGY IN Ry =\s*(?P<x_wien2k_total_ene>[-+0-9.]+)"),
SM(r":FER : (\w*\s*)*-\s\w*\W\w*\WM\W*=\s*(?P<x_wien2k_fermi_ene>[-+0-9.]+)"),
SM(r":GAP : (?P<x_wien2k_ene_gap_Ry>[-+0-9.]+)\s*Ry\s*=\s*(?P<x_wien2k_ene_gap_eV>[-+0-9.]+)\s*eV\s*\W*\w*\s\W"),
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":KPT\s*:\s*NUMBER\s*OF\s*K-POINTS:\s*(?P<x_wien2k_nr_kpts>[-+0-9.]+)"),
SM(r":GAP :\s*(?P<x_wien2k_ene_gap_Ry>[-+0-9.]+)\s*Ry\s*=\s*(?P<x_wien2k_ene_gap_eV>[-+0-9.]+)\s*eV\s*.*"),
SM(r":FER : (\w*\s*)*-\s\w*\W\w*\WM\W*=\s*(?P<x_wien2k_fermi_ene>[-+0-9.]+)"),
SM(r":MMTOT: TOTAL MAGNETIC MOMENT IN CELL =\s*(?P<x_wien2k_mmtot>[-+0-9.]+)"),
SM(r":MMINT: MAGNETIC MOMENT IN INTERSTITIAL =\s*(?P<x_wien2k_mmint>[-+0-9.]+)"),
SM(r":MMI001: MAGNETIC MOMENT IN SPHERE 1 =\s*(?P<x_wien2k_mmi001>[-+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":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\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":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)
]
)
]
......
......@@ -33,6 +33,51 @@
"superNames": [
"x_wien2k_section_equiv_atoms"
]
},{
"description": "name of atom, labelling non-equvalent atoms",
"dtypeStr": "C",
"name": "x_wien2k_atom_name",
"repeats": true,
"shape": [],
"superNames": [
"x_wien2k_section_equiv_atoms"
]
},{
"description": "number of radial mesh points",
"dtypeStr": "i",
"name": "x_wien2k_NPT",
"repeats": true,
"shape": [],
"superNames": [
"x_wien2k_section_equiv_atoms"
]
},{
"description": "atomic sphere radius (muffin-tin radius)",
"dtypeStr": "f",
"name": "x_wien2k_RMT",
"repeats": true,
"shape": [],
"superNames": [
"x_wien2k_section_equiv_atoms"
]
},{
"description": "first radial mesh point",
"dtypeStr": "f",
"name": "x_wien2k_R0",
"repeats": true,
"shape": [],
"superNames": [
"x_wien2k_section_equiv_atoms"
]
},{
"description": "atomic number Z",
"dtypeStr": "f",
"name": "x_wien2k_atomic_number_Z",
"repeats": true,
"shape": [],
"superNames": [
"x_wien2k_section_equiv_atoms"
]
}, {
"description": "header (labels) of wien2k.",
"kindStr": "type_section",
......@@ -103,6 +148,62 @@
"superNames": [
"section_scf_iteration"
]
}, {
"description": "relativistic or nonrelativistic calculation mode",
"dtypeStr": "C",
"name": "x_wien2k_calc_mode",
"shape": [],
"superNames": [
"section_system"
]
}, {
"description": "unit cell parameters - a",
"dtypeStr": "f",
"name": "x_wien2k_unit_cell_param_a",
"shape": [],
"superNames": [
"section_system"
]
}, {
"description": "unit cell parameters - b",
"dtypeStr": "f",
"name": "x_wien2k_unit_cell_param_b",
"shape": [],
"superNames": [
"section_system"
]
}, {
"description": "unit cell parameters - c",
"dtypeStr": "f",
"name": "x_wien2k_unit_cell_param_c",
"shape": [],
"superNames": [
"section_system"
]
}, {
"description": "unit cell parameters - alfa",
"dtypeStr": "f",
"name": "x_wien2k_angle_between_unit_axis_alfa",
"shape": [],
"superNames": [
"section_system"
]
}, {
"description": "unit cell parameters - beta",
"dtypeStr": "f",
"name": "x_wien2k_angle_between_unit_axis_beta",
"shape": [],
"superNames": [
"section_system"
]
}, {
"description": "unit cell parameters - gamma",
"dtypeStr": "f",
"name": "x_wien2k_angle_between_unit_axis_gamma",
"shape": [],
"superNames": [
"section_system"
]
}, {
"description": "total number of atoms in the cell",
"dtypeStr": "i",
......@@ -111,6 +212,30 @@
"superNames": [
"section_scf_iteration"
]
}, {
"description": "lattice parameter a in this calculation",
"dtypeStr": "f",
"name": "x_wien2k_lattice_const_a",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "lattice parameter b in this calculation",
"dtypeStr": "f",
"name": "x_wien2k_lattice_const_b",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "lattice parameter c in this calculation",
"dtypeStr": "f",
"name": "x_wien2k_lattice_const_c",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "unit cell volume",
"dtypeStr": "f",
......@@ -119,9 +244,191 @@
"superNames": [
"section_scf_iteration"
],
"units": "m^3"
"units": "bohr^3"
}, {
"description": "total energy",
"dtypeStr": "f",
"name": "x_wien2k_total_ene",
"shape": [],
"superNames": [
"section_scf_iteration"
],
"units": "Ry"
}, {
"description": "Fermi energy",
"dtypeStr": "f",
"name": "x_wien2k_fermi_ene",
"shape": [],
"superNames": [
"section_scf_iteration"
],
"units": "Ry"
}, {
"description": "energy gap in Ry",
"dtypeStr": "f",
"name": "x_wien2k_ene_gap_Ry",
"shape": [],
"superNames": [
"section_scf_iteration"
],
"units": "Ry"
}, {
"description": "energy gap in eV",
"dtypeStr": "f",
"name": "x_wien2k_ene_gap_eV",
"shape": [],
"superNames": [
"section_scf_iteration"
],
"units": "eV"
}, {
"description": "matrix size",
"dtypeStr": "i",
"name": "x_wien2k_matrix_size",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "rkm",
"dtypeStr": "f",
"name": "x_wien2k_rkm",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "LOs",
"dtypeStr": "i",
"name": "x_wien2k_LOs",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "total magnetic moment in cell",
"dtypeStr": "f",
"name": "x_wien2k_mmtot",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "magnetic moment in the interstital region",
"dtypeStr": "f",
"name": "x_wien2k_mmint",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "magnetic moment inside the sphere",
"dtypeStr": "f",
"name": "x_wien2k_mmi001",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "force on atom xx in mRy/bohr (in the local (for each atom) cartesian coordinate system): |F|",
"dtypeStr": "f",
"name": "x_wien2k_for_abs",
"repeats": true,
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "force on atom xx in mRy/bohr (in the local (for each atom) cartesian coordinate system): Fx",
"dtypeStr": "f",
"name": "x_wien2k_for_x",
"repeats": true,
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "force on atom xx in mRy/bohr (in the local (for each atom) cartesian coordinate system): Fy",
"dtypeStr": "f",
"name": "x_wien2k_for_y",
"repeats": true,
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "force on atom xx in mRy/bohr (in the local (for each atom) cartesian coordinate system): Fz",
"dtypeStr": "f",
"name": "x_wien2k_for_z",
"repeats": true,
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "force on atom xx in mRy/bohr (in the global coordinate system of the unit cell (in the same way as the atomic positions are specified)): Fx",
"dtypeStr": "f",
"name": "x_wien2k_for_x_gl",
"repeats": true,
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "force on atom xx in mRy/bohr (in the global coordinate system of the unit cell (in the same way as the atomic positions are specified)): Fy",
"dtypeStr": "f",
"name": "x_wien2k_for_y_gl",
"repeats": true,
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "force on atom xx in mRy/bohr (in the global coordinate system of the unit cell (in the same way as the atomic positions are specified)): Fz",
"dtypeStr": "f",
"name": "x_wien2k_for_z_gl",
"repeats": true,
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "number of atom, labelling atoms",
"dtypeStr": "C",
"name": "x_wien2k_atom_nr",
"repeats": true,
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "number of sphere, labelling spheres",
"dtypeStr": "C",
"name": "x_wien2k_sphere_nr",
"repeats": true,
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "total difference charge density for atom xx between last 2 iterations",
"dtypeStr": "f",
"name": "x_wien2k_tot_diff_charge",
"repeats": true,
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "total interstitial charge",
"dtypeStr": "f",
"name": "x_wien2k_tot_int_charge",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "Version of wien2k.",
"description": "Version of WIEN2k.",
"dtypeStr": "C",
"name": "x_wien2k_version",
"shape": [],
......
{
"type": "nomad_meta_info_1_0",
"description": "meta info used by the wien2k parser. All names are expected to start with x_wien2k_",
"dependencies": [ {
"relativePath": "common.nomadmetainfo.json"
}, {
"relativePath": "meta_types.nomadmetainfo.json"
}],
"metaInfos": [ {
"description": "position of atom x in internal units",
"dtypeStr": "f",
"name": "x_wien2k_atom_pos_x",
"repeats": true,
"shape": [],
"superNames": [
"x_wien2k_section_equiv_atoms"
]
}, {
"description": "position of atom y in internal units",
"dtypeStr": "f",
"name": "x_wien2k_atom_pos_y",
"repeats": true,
"shape": [],
"superNames": [
"x_wien2k_section_equiv_atoms"
]
}, {
"description": "position of atom z in internal units",
"dtypeStr": "f",
"name": "x_wien2k_atom_pos_z",
"repeats": true,
"shape": [],
"superNames": [
"x_wien2k_section_equiv_atoms"
]
}, {
"description": "header (labels) of wien2k.",
"kindStr": "type_section",
"name": "x_wien2k_header",
"superNames": [
"section_run"
]
}, {
"description": "scf iteration number",
"dtypeStr": "i",
"name": "x_wien2k_iteration_number",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "number of inequivalent atoms in the unit cell",
"dtypeStr": "i",
"name": "x_wien2k_nonequiv_atoms",
"shape": [],
"superNames": [
"section_system"
]
}, {
"description": "number of independent atoms in the cell",
"dtypeStr": "i",
"name": "x_wien2k_number_of_independent_atoms",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "exchange correlation potential option",
"dtypeStr": "i",
"name": "x_wien2k_potential_option",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "Release date of wien2k.",
"dtypeStr": "C",
"name": "x_wien2k_release_date",
"shape": [],
"superNames": [
"x_wien2k_header"
]
}, {
"description": "section containing a class of equivalent atoms",
"kindStr": "type_section",
"name": "x_wien2k_section_equiv_atoms",
"superNames": [
"section_system"
]
}, {
"description": "user given name for this system given in the struct file",
"dtypeStr": "C",
"name": "x_wien2k_system_nameIn",
"shape": [],
"superNames": [
"section_system"
]
}, {
"description": "user given name for this system",
"dtypeStr": "C",
"name": "x_wien2k_system_name",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "total number of atoms in the cell",
"dtypeStr": "i",
"name": "x_wien2k_total_atoms",
"shape": [],
"superNames": [
"section_scf_iteration"
]
}, {
"description": "unit cell volume",
"dtypeStr": "f",
"name": "x_wien2k_unit_cell_volume",
"shape": [],
"superNames": [
"section_scf_iteration"
],
"units": "m^3"
}, {
"description": "Version of wien2k.",
"dtypeStr": "C",
"name": "x_wien2k_version",
"shape": [],
"superNames": [
"x_wien2k_header"
]
}]
}
......@@ -69,7 +69,19 @@ mainFileDescription = SM(
SM(r":NATO :\s*(?P<x_wien2k_number_of_independent_atoms>[0-9]+)INDEPENDENT AND\s*(?P<x_wien2k_total_atoms>[0-9]+)\s*TOTAL ATOMS IN UNITCELL"),
SM(r"\s*SUBSTANCE: (?P<x_wien2k_system_name>.*)"),
SM(r":POT\s*:\s*POTENTIAL OPTION\s*(?P<x_wien2k_potential_option>[0-9]+)"),
SM(r":VOL\s*:\s*UNIT CELL VOLUME\s*=\s*(?P<x_wien2k_unit_cell_volume__angstrom3>[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__angstrom3>[0-9.]+)"),
SM(r":ENE : \W*\w*\W*\TOTAL ENERGY IN Ry =\s*(?P<x_wien2k_total_ene>[-+0-9.]+)"),
SM(r":FER : (\w*\s*)*-\s\w*\W\w*\WM\W*=\s*(?P<x_wien2k_fermi_ene>[-+0-9.]+)"),
SM(r":GAP : (?P<x_wien2k_ene_gap_Ry>[-+0-9.]+)\s*Ry\s*=\s*(?P<x_wien2k_ene_gap_eV>[-+0-9.]+)\s*eV\s*\W*\w*\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":MMTOT: TOTAL MAGNETIC MOMENT IN CELL =\s*(?P<x_wien2k_mmtot>[-+0-9.]+)"),
SM(r":MMINT: MAGNETIC MOMENT IN INTERSTITIAL =\s*(?P<x_wien2k_mmint>[-+0-9.]+)"),
SM(r":MMI001: MAGNETIC MOMENT IN SPHERE 1 =\s*(?P<x_wien2k_mmi001>[-+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":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.]+)")
]
)
]
......
from builtins import object
import setup_paths
from nomadcore.simple_parser import mainFunction, AncillaryParser, CachingLevel
from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.local_meta_info import loadJsonFile, InfoKindEl