diff --git a/parser/parser-wien2k/wien2k_parser.py b/parser/parser-wien2k/wien2k_parser.py index 5e09f623a28f3b6b3d0cc149109284eefd6e03ef..bec43c356ab62b8c13e624a8cd28472958a7c7c2 100644 --- a/parser/parser-wien2k/wien2k_parser.py +++ b/parser/parser-wien2k/wien2k_parser.py @@ -6,6 +6,12 @@ from nomadcore.local_meta_info import loadJsonFile, InfoKindEl import os, sys, json import wien2k_parser_struct, wien2k_parser_in0, wien2k_parser_in1c, wien2k_parser_in2c, wien2k_parser_in1, wien2k_parser_in2 + +################################################################ +# This is the parser for the main output file (.scp) of WIEN2k. +################################################################ + + class Wien2kContext(object): """context for wien2k parser""" @@ -163,7 +169,8 @@ mainFileDescription = SM( # loading metadata from nomad-meta-info/meta_info/nomad_meta_info/fhi_aims.nomadmetainfo.json parserInfo = { - "name": "Wien2k" + "name": "Wien2k", + "version": "1.0" } metaInfoPath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"../../../../nomad-meta-info/meta_info/nomad_meta_info/wien2k.nomadmetainfo.json")) diff --git a/parser/parser-wien2k/wien2k_parser_backups/wien2k_parser.py b/parser/parser-wien2k/wien2k_parser_backups/wien2k_parser.py index 2cc2f47fa6cab541079bdf1b65c5136e6d8f9de6..b56404a22e3b4cbf398fb1db20a846a6bdb7e248 100644 --- a/parser/parser-wien2k/wien2k_parser_backups/wien2k_parser.py +++ b/parser/parser-wien2k/wien2k_parser_backups/wien2k_parser.py @@ -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, wien2k_parser_in1c, wien2k_parser_in2c, wien2k_parser_in1, wien2k_parser_in2 class Wien2kContext(object): """context for wien2k parser""" @@ -28,20 +28,84 @@ 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) + + + mainFile = self.parser.fIn.fIn.name + fName = mainFile[:-4] + ".in1c" + if os.path.exists(fName): + subSuperContext = wien2k_parser_in1c.Wien2kIn1cContext() + subParser = AncillaryParser( + fileDescription = wien2k_parser_in1c.buildIn1cMatchers(), + parser = self.parser, + cachingLevelForMetaName = wien2k_parser_in1c.get_cachingLevelForMetaName(self.metaInfoEnv, CachingLevel.PreOpenedIgnore), + superContext = subSuperContext) + with open(fName) as fIn: + subParser.parseFile(fIn) + + + mainFile = self.parser.fIn.fIn.name + fName = mainFile[:-4] + ".in2c" + if os.path.exists(fName): + subSuperContext = wien2k_parser_in2c.Wien2kIn2cContext() + subParser = AncillaryParser( + fileDescription = wien2k_parser_in2c.buildIn2cMatchers(), + parser = self.parser, + cachingLevelForMetaName = wien2k_parser_in2c.get_cachingLevelForMetaName(self.metaInfoEnv, CachingLevel.PreOpenedIgnore), + superContext = subSuperContext) + with open(fName) as fIn: + subParser.parseFile(fIn) + + mainFile = self.parser.fIn.fIn.name + fName = mainFile[:-4] + ".in1" + if os.path.exists(fName): + subSuperContext = wien2k_parser_in1.Wien2kIn1Context() + subParser = AncillaryParser( + fileDescription = wien2k_parser_in1.buildIn1Matchers(), + parser = self.parser, + cachingLevelForMetaName = wien2k_parser_in1.get_cachingLevelForMetaName(self.metaInfoEnv, CachingLevel.PreOpenedIgnore), + superContext = subSuperContext) + with open(fName) as fIn: + subParser.parseFile(fIn) + + + mainFile = self.parser.fIn.fIn.name + fName = mainFile[:-4] + ".in2" + if os.path.exists(fName): + subSuperContext = wien2k_parser_in2.Wien2kIn2Context() + subParser = AncillaryParser( + fileDescription = wien2k_parser_in2.buildIn2Matchers(), + parser = self.parser, + cachingLevelForMetaName = wien2k_parser_in2.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 +130,30 @@ 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":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_Ry>[-+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>[-+0-9.]+)"), + SM(r":GMA\s*:\s*POTENTIAL\sAND\sCHARGE\sCUT-OFF\s*[0-9.]+\s*Ry\W\W[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":NTO\s*:\s*\sTOTAL\s*INTERSTITIAL\s*CHARGE=\s*(?P<x_wien2k_tot_int_charge_nm>[-+0-9.]+)"), + SM(r":NTO(?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_nm>[-+0-9.]+)",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":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.]+)"), + 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<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) ] ) ] @@ -92,6 +164,7 @@ mainFileDescription = SM( parserInfo = { "name": "Wien2k" +# "version": "1.0" } metaInfoPath = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(__file__)),"../../../../nomad-meta-info/meta_info/nomad_meta_info/wien2k.nomadmetainfo.json")) diff --git a/parser/parser-wien2k/wien2k_parser_backups/wien2k_parser_struct.py b/parser/parser-wien2k/wien2k_parser_backups/wien2k_parser_struct.py index 72e24285e05c2253a67d579993315f26c621d098..01d3c49589da9f290efab4444797c90a0cac20bb 100644 --- a/parser/parser-wien2k/wien2k_parser_backups/wien2k_parser_struct.py +++ b/parser/parser-wien2k/wien2k_parser_backups/wien2k_parser_struct.py @@ -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"][0] + 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 diff --git a/parser/parser-wien2k/wien2k_parser_in0.py b/parser/parser-wien2k/wien2k_parser_in0.py index b602d6a2a3988845a08125bb9882f9d868de6b13..6f02c1c571286711035398805814f05b29cdb3e2 100644 --- a/parser/parser-wien2k/wien2k_parser_in0.py +++ b/parser/parser-wien2k/wien2k_parser_in0.py @@ -5,6 +5,13 @@ from nomadcore.simple_parser import SimpleMatcher as SM from nomadcore.local_meta_info import loadJsonFile, InfoKindEl import os, sys, json + + +################################################################ +# This is the subparser for the WIEN2k input file (.in0) +################################################################ + + class Wien2kIn0Context(object): """context for wien2k struct parser""" @@ -21,6 +28,85 @@ 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): + xc_index = section["x_wien2k_indxc"][0] + xc_map_legend = { + + 5: ['LDA_C_PW_RPA'], + XC_LDA: ['LDA_X_2D'], + + 13: ['GGA_X_PBE', 'GGA_C_PBE'], + XC_PBE:['GGA_X_PBE', 'GGA_C_PBE'], + + 19: ['GGA_X_PBE_SOL', 'GGA_C_PBE_SOL:'], + XC_PBESOL: ['GGA_X_PBE_SOL', 'GGA_C_PBE_SOL:'], + + 11: ['GGA_X_WC'], + XC_WC: ['GGA_X_WC'], + + 17: ['GGA_X_PW91'], + EC_PW91: ['GGA_X_PW91'], + VC_PW91: ['GGA_X_PW91'], + + 28: ['MGGA_X_TB09'], + XC_MBJ: ['MGGA_X_TB09'], + + 29: ['MGGA_C_REVTPSS, GGA_C_REGTPSS'], + XC_REVTPSS: ['MGGA_C_REVTPSS, GGA_C_REGTPSS'], + + 24: ['GGA_X_B88', 'GGA_C_LYP'], + EX_B88: ['GGA_X_B88'], + VX_B88: ['GGA_X_B88'], + EC_LYP: ['GGA_C_LYP'], + VC_LYP: ['GGA_C_LYP'], + + 18: ['HYB_GGA_XC_B3PW91'], + XC_B3PW91: ['HYB_GGA_XC_B3PW91'], + + 27: ['MGGA_X_TPSS','MGGA_C_TPSS'], + XC_TPSS: ['MGGA_X_TPSS','MGGA_C_TPSS'], + + 46:['GGA_X_HTBS'], + XC_HTBS: ['GGA_X_HTBS'], + + 47: ['HYB_GGA_XC_B3LYP'], + XC_B3LYP: ['HYB_GGA_XC_B3LYP'], + + +# 51: ['-'], +# EX_SLDA: +# VX_SLDA: + +# 52: ['-'], +# EX_SPBE: +# VX_SPBE: + +# 53: ['-'], +# EX_SWC: +# VX_SWC: + +# 54: ['-'], +# EX_SPBESOL: +# VX_SPBESOL: + +# 55: ['-'], +# EX_SB88: +# VX_SB88: + + 6: ['HF_X'], + EX_LDA: ['HF_X'], + VX_LDA: ['HF_X'] + } + +# # Push the functional string into the backend +# xc_map_legend = functionalMap.get(indxc) +# if not xc_map_legend: +# raise Exception("Unhandled xc functional %s found" % functional) + + 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) # description of the input def buildIn0Matchers(): @@ -28,26 +114,16 @@ def buildIn0Matchers(): name = 'root', weak = True, startReStr = "", - sections = ["section_run", "section_method"], + sections = ["section_run", "section_method", "section_XC_functionals"], subMatchers = [ # SM(name = 'systemName', # startReStr = r"(?P<x_wien2k_system_nameIn>.*)"), - SM(r"(?P<x_wien2k_switch>\w*)\s*(?P<x_wien2k_indxc>[0-9]+)\s*.*"), + 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]+).*") -# SM(r"(?P<x_wien2k_calc_mode>.*)"), -# SM(r"\s*(?P<x_wien2k_unit_cell_param_a>[-+0-9]*\.\d{0,6}){0,10}\s*(?P<x_wien2k_unit_cell_param_b>[-+0-9]*\.\d{0,6}){0,10}\s*(?P<x_wien2k_unit_cell_param_c>[-+0-9]*\.\d{0,6}){0,10}\s*(?P<x_wien2k_angle_between_unit_axis_alfa>[-+]?[0-9]*\.\d{0,6}){0,10}\s*(?P<x_wien2k_angle_between_unit_axis_beta>[-+]?[0-9]*\.\d{0,6}){0,10}\s*(?P<x_wien2k_angle_between_unit_axis_gamma>[-+]?[0-9]*\.\d*)"), -# SM(r"\s*ATOM\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, -# sections=["x_wien2k_section_equiv_atoms"], -# subMatchers=[ -# 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.]+)",) -# ] -# ) ]) + + def get_cachingLevelForMetaName(metaInfoEnv, CachingLvl): """Sets the caching level for the metadata. diff --git a/parser/parser-wien2k/wien2k_parser_in1.py b/parser/parser-wien2k/wien2k_parser_in1.py index ab4a58be08f6a788931a2d9a305febd2fcda9c64..d552d8189a88b968b62ad5973d453cc381316f42 100644 --- a/parser/parser-wien2k/wien2k_parser_in1.py +++ b/parser/parser-wien2k/wien2k_parser_in1.py @@ -5,6 +5,12 @@ from nomadcore.simple_parser import SimpleMatcher as SM from nomadcore.local_meta_info import loadJsonFile, InfoKindEl import os, sys, json + +################################################################ +# This is the subparser for the WIEN2k input file (.in1) +################################################################ + + class Wien2kIn1Context(object): """context for wien2k struct parser""" diff --git a/parser/parser-wien2k/wien2k_parser_in1c.py b/parser/parser-wien2k/wien2k_parser_in1c.py index 218e775ddc36410952cc3635c8f1f4c7a308e3e3..f8a0ab9e4a5d8d151af3e5f50551b59fe4367138 100644 --- a/parser/parser-wien2k/wien2k_parser_in1c.py +++ b/parser/parser-wien2k/wien2k_parser_in1c.py @@ -5,6 +5,12 @@ from nomadcore.simple_parser import SimpleMatcher as SM from nomadcore.local_meta_info import loadJsonFile, InfoKindEl import os, sys, json + +################################################################ +# This is the subparser for the WIEN2k input file (.in1c) +################################################################ + + class Wien2kIn1cContext(object): """context for wien2k struct parser""" diff --git a/parser/parser-wien2k/wien2k_parser_in2.py b/parser/parser-wien2k/wien2k_parser_in2.py index 947daf573b1ef42e865d2e09a55d16c9ebcaa48d..a00e61ce3ad5446b59b73c413e66c7db19a94603 100644 --- a/parser/parser-wien2k/wien2k_parser_in2.py +++ b/parser/parser-wien2k/wien2k_parser_in2.py @@ -5,6 +5,12 @@ from nomadcore.simple_parser import SimpleMatcher as SM from nomadcore.local_meta_info import loadJsonFile, InfoKindEl import os, sys, json + +################################################################ +# This is the subparser for the WIEN2k input file (.in2) +################################################################ + + class Wien2kIn2Context(object): """context for wien2k struct parser""" @@ -32,20 +38,11 @@ def buildIn2Matchers(): subMatchers = [ # SM(name = 'systemName', # startReStr = r"(?P<x_wien2k_system_nameIn>.*)"), - SM(r"\s*(?P<x_wien2k_in2c_switch>[A-Z]+)\s*.*") -# 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>.*)"), -# SM(r"\s*(?P<x_wien2k_unit_cell_param_a>[-+0-9]*\.\d{0,6}){0,10}\s*(?P<x_wien2k_unit_cell_param_b>[-+0-9]*\.\d{0,6}){0,10}\s*(?P<x_wien2k_unit_cell_param_c>[-+0-9]*\.\d{0,6}){0,10}\s*(?P<x_wien2k_angle_between_unit_axis_alfa>[-+]?[0-9]*\.\d{0,6}){0,10}\s*(?P<x_wien2k_angle_between_unit_axis_beta>[-+]?[0-9]*\.\d{0,6}){0,10}\s*(?P<x_wien2k_angle_between_unit_axis_gamma>[-+]?[0-9]*\.\d*)"), -# SM(r"\s*ATOM\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, -# sections=["x_wien2k_section_equiv_atoms"], -# subMatchers=[ -# 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_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<smearing_kind>[A-Z]+)\s*\s*(?P<smearing_width>[-+0-9.]+)\s*.*"), + SM(r"\s*(?P<x_wien2k_in2c_gmax>[-+0-9.]+)\s*GMAX") + ]) def get_cachingLevelForMetaName(metaInfoEnv, CachingLvl): diff --git a/parser/parser-wien2k/wien2k_parser_in2c.py b/parser/parser-wien2k/wien2k_parser_in2c.py index 4d0d171439e5739d31bbaaa3501b3cfbf375d59a..d12cf62926aa230f8cb9e43380b55f5591f8d4f4 100644 --- a/parser/parser-wien2k/wien2k_parser_in2c.py +++ b/parser/parser-wien2k/wien2k_parser_in2c.py @@ -5,6 +5,12 @@ from nomadcore.simple_parser import SimpleMatcher as SM from nomadcore.local_meta_info import loadJsonFile, InfoKindEl import os, sys, json + +################################################################ +# This is the subparser for the WIEN2k input file (.in2c) +################################################################ + + class Wien2kIn2cContext(object): """context for wien2k struct parser""" diff --git a/parser/parser-wien2k/wien2k_parser_struct.py b/parser/parser-wien2k/wien2k_parser_struct.py index 01d3c49589da9f290efab4444797c90a0cac20bb..2d4f44bf5becfe4b7555a16baf708530e614032b 100644 --- a/parser/parser-wien2k/wien2k_parser_struct.py +++ b/parser/parser-wien2k/wien2k_parser_struct.py @@ -6,6 +6,12 @@ from nomadcore.local_meta_info import loadJsonFile, InfoKindEl import os, sys, json, logging import numpy as np + +################################################################ +# This is the subparser for the main WIEN2k input file (.struct) +################################################################ + + class Wien2kStructContext(object): """context for wien2k struct parser"""