Commit cc0eb5aa authored by Pardini, Lorenzo (lopa)'s avatar Pardini, Lorenzo (lopa)
Browse files

fixed dos and gw

parent 4bda169e
...@@ -34,8 +34,9 @@ class DosHandler(xml.sax.handler.ContentHandler): ...@@ -34,8 +34,9 @@ class DosHandler(xml.sax.handler.ContentHandler):
# self.dosProjSectionGIndex = -1 # self.dosProjSectionGIndex = -1
def startElement(self, name, attrs): def startElement(self, name, attrs):
ha_per_joule = convert_unit(1, "hartree", "J")
bohr_cube_to_m_cube = convert_unit(1, "bohr^3", "m^3")
fromH = unit_conversion.convert_unit_function("hartree", "J") fromH = unit_conversion.convert_unit_function("hartree", "J")
# ev_per_joule = convert_unit(1, "eV", "J")
if name == "totaldos": if name == "totaldos":
self.dosSectionGIndex = self.backend.openSection("section_dos") self.dosSectionGIndex = self.backend.openSection("section_dos")
self.inDos = True self.inDos = True
...@@ -49,11 +50,11 @@ class DosHandler(xml.sax.handler.ContentHandler): ...@@ -49,11 +50,11 @@ class DosHandler(xml.sax.handler.ContentHandler):
self.inDosProj = True self.inDosProj = True
elif name == "point": elif name == "point":
if self.inDos: if self.inDos:
self.totDos.append(float(attrs.getValue('dos'))) self.totDos.append(ha_per_joule*bohr_cube_to_m_cube*float(attrs.getValue('dos')))
# self.energy.append(float(attrs.getValue('e'))) # self.energy.append(float(attrs.getValue('e')))
self.energy.append(fromH(float(attrs.getValue('e')))) self.energy.append(fromH(float(attrs.getValue('e'))))
elif self.inDosProj: elif self.inDosProj:
self.dosProj.append(float(attrs.getValue('dos'))) self.dosProj.append(ha_per_joule*bohr_cube_to_m_cube*float(attrs.getValue('dos')))
# self.energy.append(float(attrs.getValue('e'))) # self.energy.append(float(attrs.getValue('e')))
self.energy.append(fromH(float(attrs.getValue('e')))) self.energy.append(fromH(float(attrs.getValue('e'))))
elif name == "diagram": elif name == "diagram":
...@@ -102,7 +103,6 @@ class DosHandler(xml.sax.handler.ContentHandler): ...@@ -102,7 +103,6 @@ class DosHandler(xml.sax.handler.ContentHandler):
# print("self.dosProjSpin=",len(self.dosProjSpin)) # print("self.dosProjSpin=",len(self.dosProjSpin))
# print("self.dosProjDummy2=",len(self.dosProjDummy2)) # print("self.dosProjDummy2=",len(self.dosProjDummy2))
def endElement(self, name): def endElement(self, name):
# ev_per_joule = convert_unit(1, "eV", "J")
if name == 'totaldos': if name == 'totaldos':
self.inDos = False self.inDos = False
if not self.spinTreat: if not self.spinTreat:
......
...@@ -5,36 +5,32 @@ from nomadcore.simple_parser import mainFunction, CachingLevel ...@@ -5,36 +5,32 @@ from nomadcore.simple_parser import mainFunction, CachingLevel
from nomadcore.simple_parser import SimpleMatcher as SM from nomadcore.simple_parser import SimpleMatcher as SM
from nomadcore.local_meta_info import loadJsonFile, InfoKindEl from nomadcore.local_meta_info import loadJsonFile, InfoKindEl
from nomadcore.unit_conversion import unit_conversion from nomadcore.unit_conversion import unit_conversion
import os, sys, json import os, sys, json, logging
################################################################ ################################################################
# This is the subparser for the exciting GW output # This is the subparser for the exciting GW output
################################################################ ################################################################
class GWContext(object): class GWParser(object):
"""context for wien2k In2 parser""" """context for wien2k In2 parser"""
def __init__(self): def __init__(self):
self.parser = None
self.spinTreat = None self.spinTreat = None
self.vertexDist = [] self.vertexDist = []
self.vertexLabels = [] self.vertexLabels = []
self.vertexNum = 0 self.vertexNum = 0
def initialize_values(self): def parseGW(self, gwFile, backend, dftMethodSectionGindex, dftSingleConfigurationGindex):
"""allows to reset values if the same superContext is used to parse different files""" # logging.error("GW onClose_section_single_configuration_calculation")
pass backend.openNonOverlappingSection("section_single_configuration_calculation")
if dftSingleConfigurationGindex is not None:
def startedParsing(self, path, parser): backend.openNonOverlappingSection("section_calculation_to_calculation_refs")
backend.addValue("calculation_to_calculation_ref", dftSingleConfigurationGindex)
"""called when parsing starts""" backend.addValue("calculation_to_calculation_kind", "starting_point")
self.parser = parser backend.closeNonOverlappingSection("section_calculation_to_calculation_refs")
self.initialize_values()
def onClose_x_exciting_section_GW(self, backend, gIndex, section): dirPath = os.path.dirname(gwFile)
dirPath = os.path.dirname(self.parser.fIn.name)
if os.access(os.path.join(dirPath, "EVALQP.DAT"), os.F_OK): if os.access(os.path.join(dirPath, "EVALQP.DAT"), os.F_OK):
eigvalGWFile = os.path.join(dirPath, "EVALQP.DAT") eigvalGWFile = os.path.join(dirPath, "EVALQP.DAT")
elif os.access(os.path.join(dirPath, "EVALQP.TXT"), os.F_OK): elif os.access(os.path.join(dirPath, "EVALQP.TXT"), os.F_OK):
...@@ -50,7 +46,13 @@ class GWContext(object): ...@@ -50,7 +46,13 @@ class GWContext(object):
inputFile = os.path.join(dirPath, "input.xml") inputFile = os.path.join(dirPath, "input.xml")
if os.path.exists(inputFile): if os.path.exists(inputFile):
selfGWSetGIndex = backend.openSection("x_exciting_section_GW_settings") selfGWSetGIndex = backend.openSection("section_method")
backend.addValue('electronic_structure_method', "G0W0")
if dftMethodSectionGindex is not None:
m2mGindex = backend.openNonOverlappingSection("section_method_to_method_refs")
backend.addValue("method_to_method_ref", dftMethodSectionGindex)
backend.addValue("method_to_method_kind", "starting_point")
backend.closeNonOverlappingSection("section_method_to_method_refs")
singularity = 'mpd' singularity = 'mpd'
actype = 'pade' actype = 'pade'
npol = 0 npol = 0
...@@ -60,16 +62,16 @@ class GWContext(object): ...@@ -60,16 +62,16 @@ class GWContext(object):
fgrid = "gaule2" fgrid = "gaule2"
k1 = 0 k1 = 0
k2 = 0 k2 = 0
# f1 = 0 # f1 = 0
# f2 = 0 # f2 = 0
s1 = 0 s1 = 0
s2 = 0 s2 = 0
# m1 = 0 # m1 = 0
# m2 = 0 # m2 = 0
# bc1 = 0 # bc1 = 0
# bc2 = 0 # bc2 = 0
# sc1 = 0 # sc1 = 0
# sc2 = 0 # sc2 = 0
with open(inputFile) as g: with open(inputFile) as g:
i = 0 i = 0
while 1: while 1:
...@@ -80,16 +82,16 @@ class GWContext(object): ...@@ -80,16 +82,16 @@ class GWContext(object):
s = s.split('=') s = s.split('=')
if s[0] == "<gw": k1 = i if s[0] == "<gw": k1 = i
if s[0] == "</gw>": k2 = i if s[0] == "</gw>": k2 = i
# if s[0] == "<freqgrid": f1 = i # if s[0] == "<freqgrid": f1 = i
# if s[0] == "</freqgrid>": f2 = i # if s[0] == "</freqgrid>": f2 = i
if s[0] == "<selfenergy": s1 = i if s[0] == "<selfenergy": s1 = i
if s[0] == "</selfenergy>": s2 = i if s[0] == "</selfenergy>": s2 = i
# if s[0] == "<mixbasis": m1 = i # if s[0] == "<mixbasis": m1 = i
# if s[0] == "</mixbasis>": m2 = i # if s[0] == "</mixbasis>": m2 = i
# if s[0] == "<barecoul": bc1 = i # if s[0] == "<barecoul": bc1 = i
# if s[0] == "</barecoul>": bc2 = i # if s[0] == "</barecoul>": bc2 = i
# if s[0] == "<scrcoul": sc1 = i # if s[0] == "<scrcoul": sc1 = i
# if s[0] == "</scrcoul>": sc2 = i # if s[0] == "</scrcoul>": sc2 = i
with open(inputFile) as g: with open(inputFile) as g:
i = 0 i = 0
while 1: while 1:
...@@ -119,7 +121,7 @@ class GWContext(object): ...@@ -119,7 +121,7 @@ class GWContext(object):
backend.addValue("x_exciting_GW_self_energy_c_analytical_continuation", actype) backend.addValue("x_exciting_GW_self_energy_c_analytical_continuation", actype)
backend.addValue("x_exciting_GW_self_energy_c_number_of_poles", int(npol)) backend.addValue("x_exciting_GW_self_energy_c_number_of_poles", int(npol))
backend.addValue("x_exciting_GW_screened_Coulomb", scrtype) backend.addValue("x_exciting_GW_screened_Coulomb", scrtype)
backend.closeSection("x_exciting_section_GW_settings",selfGWSetGIndex) backend.closeSection("section_method",selfGWSetGIndex)
if os.path.exists(vertexGWFile): if os.path.exists(vertexGWFile):
with open(vertexGWFile) as g: with open(vertexGWFile) as g:
...@@ -147,8 +149,7 @@ class GWContext(object): ...@@ -147,8 +149,7 @@ class GWContext(object):
self.vertexLabels.append(f[1]) self.vertexLabels.append(f[1])
if os.path.exists(eigvalGWFile): if os.path.exists(eigvalGWFile):
eigvalGWOutGIndex = backend.openSection("x_exciting_section_GW_output") eigvalGWGIndex = backend.openSection("section_eigenvalues")
eigvalGWGIndex = backend.openSection("x_exciting_section_GW_qp_eigenvalues")
with open(eigvalGWFile) as g: with open(eigvalGWFile) as g:
qpGWKpoint=[] qpGWKpoint=[]
Sx = [[],[]] Sx = [[],[]]
...@@ -187,23 +188,21 @@ class GWContext(object): ...@@ -187,23 +188,21 @@ class GWContext(object):
Sc[i][-1].append(fromH(float(s[5]))) Sc[i][-1].append(fromH(float(s[5])))
qpE[i][-1].append(fromH(float(s[3]))) qpE[i][-1].append(fromH(float(s[3])))
Znk[i][-1].append(float(s[9])) Znk[i][-1].append(float(s[9]))
backend.addValue("x_exciting_GW_qp_eigenvalues_kpoints", qpGWKpoint) backend.addValue("eigenvalues_kpoints", qpGWKpoint)
backend.addValue("x_exciting_GW_qp_number_of_eigenvalues", len(qpE[0])) backend.addValue("number_of_eigenvalues", len(qpE[0]))
backend.addValue("x_exciting_GW_qp_number_of_eigenvalues_kpoints", len(qpGWKpoint)) backend.addValue("number_of_eigenvalues_kpoints", len(qpGWKpoint))
backend.addValue("x_exciting_GW_qp_eigenvalues_values", qpE) backend.addValue("eigenvalues_values", qpE)
backend.addValue("x_exciting_GW_qp_linearization_prefactor", Znk) backend.addValue("x_exciting_GW_qp_linearization_prefactor", Znk)
backend.closeSection("x_exciting_section_GW_qp_eigenvalues",eigvalGWGIndex) backend.closeSection("section_eigenvalues",eigvalGWGIndex)
selfGWGIndex = backend.openSection("x_exciting_section_GW_self_energy")
backend.addValue("x_exciting_GW_self_energy_x", Sx) backend.addValue("x_exciting_GW_self_energy_x", Sx)
backend.addValue("x_exciting_GW_self_energy_c", Sc) backend.addValue("x_exciting_GW_self_energy_c", Sc)
backend.closeSection("x_exciting_section_GW_self_energy",selfGWGIndex)
backend.closeSection("x_exciting_section_GW_output",eigvalGWOutGIndex) ####################DOS######################
####################DOS######################
if os.path.exists(dosGWFile): if os.path.exists(dosGWFile):
dosGWOutGIndex = backend.openSection("x_exciting_section_GW_output") dosGWGIndex = backend.openSection("section_dos")
dosGWGIndex = backend.openSection("x_exciting_section_GW_dos") ha_per_joule = unit_conversion.convert_unit(1, "hartree", "J")
bohr_cube_to_m_cube = unit_conversion.convert_unit(1, "bohr^3", "m^3")
fromH = unit_conversion.convert_unit_function("hartree", "J") fromH = unit_conversion.convert_unit_function("hartree", "J")
with open(dosGWFile) as g: with open(dosGWFile) as g:
dosValues = [[],[]] dosValues = [[],[]]
...@@ -213,23 +212,22 @@ class GWContext(object): ...@@ -213,23 +212,22 @@ class GWContext(object):
if not s: break if not s: break
s = s.strip() s = s.strip()
s = s.split() s = s.split()
ene, value = fromH(float(s[0])), float(s[1]) ene, value = fromH(float(s[0])), ha_per_joule*bohr_cube_to_m_cube*float(s[1])
dosEnergies.append(ene) dosEnergies.append(ene)
if not self.spinTreat: if not self.spinTreat:
for i in range(0,2): for i in range(0,2):
dosValues[i].append(value) dosValues[i].append(value)
else: else:
pass pass
backend.addValue("x_exciting_GW_dos_energies", dosEnergies) backend.addValue("dos_energies", dosEnergies)
backend.addValue("x_exciting_GW_dos_values", dosValues) backend.addValue("dos_values", dosValues)
backend.addValue("x_exciting_GW_number_of_dos_values", len(dosEnergies)) backend.addValue("number_of_dos_values", len(dosEnergies))
backend.closeSection("x_exciting_section_GW_dos",dosGWGIndex) backend.closeSection("section_dos",dosGWGIndex)
backend.closeSection("x_exciting_section_GW_output",dosGWOutGIndex)
##################BANDSTRUCTURE##################### ##################BANDSTRUCTURE#####################
if os.path.exists(bandCarbGWFile): if os.path.exists(bandCarbGWFile):
bandGWOutGIndex = backend.openSection("x_exciting_section_GW_output") bandGWGIndex = backend.openSection("section_k_band")
bandGWGIndex = backend.openSection("x_exciting_section_GW_k_band")
fromH = unit_conversion.convert_unit_function("hartree", "J") fromH = unit_conversion.convert_unit_function("hartree", "J")
with open(bandCarbGWFile) as g: with open(bandCarbGWFile) as g:
...@@ -293,16 +291,14 @@ class GWContext(object): ...@@ -293,16 +291,14 @@ class GWContext(object):
bandGWBE[i][j][-1].append(bandEnergiesSegm[j][l][i][k]) bandGWBE[i][j][-1].append(bandEnergiesSegm[j][l][i][k])
for i in range(0,len(Kindex)-1): for i in range(0,len(Kindex)-1):
bandGWSegmGIndex = backend.openSection("x_exciting_section_GW_k_band_segment") bandGWSegmGIndex = backend.openSection("section_k_band_segment")
backend.addValue("x_exciting_GW_band_energies", bandGWBE[i]) backend.addValue("band_energies", bandGWBE[i])
backend.closeSection("x_exciting_section_GW_k_band_segment",bandGWSegmGIndex) backend.closeSection("section_k_band_segment",bandGWSegmGIndex)
backend.closeSection("x_exciting_section_GW_k_band",bandGWGIndex) backend.closeSection("section_k_band",bandGWGIndex)
backend.closeSection("x_exciting_section_GW_output",bandGWOutGIndex)
if os.path.exists(bandBorGWFile) and not os.path.exists(bandCarbGWFile): if os.path.exists(bandBorGWFile) and not os.path.exists(bandCarbGWFile):
bandGWOutGIndex = backend.openSection("x_exciting_section_GW_output") bandGWGIndex = backend.openSection("section_k_band")
bandGWGIndex = backend.openSection("x_exciting_section_GW_k_band")
fromH = unit_conversion.convert_unit_function("hartree", "J") fromH = unit_conversion.convert_unit_function("hartree", "J")
with open(bandBorGWFile) as g: with open(bandBorGWFile) as g:
bandEnergies = [[[]],[[]]] bandEnergies = [[[]],[[]]]
...@@ -363,38 +359,11 @@ class GWContext(object): ...@@ -363,38 +359,11 @@ class GWContext(object):
bandGWBE[i][j][-1].append(bandEnergiesSegm[j][l][i][k]) bandGWBE[i][j][-1].append(bandEnergiesSegm[j][l][i][k])
for i in range(0,len(Kindex)-1): for i in range(0,len(Kindex)-1):
bandGWSegmGIndex = backend.openSection("x_exciting_section_GW_k_band_segment") bandGWSegmGIndex = backend.openSection("section_k_band_segment")
backend.addValue("x_exciting_GW_band_energies", bandGWBE[i]) backend.addValue("band_energies", bandGWBE[i])
backend.closeSection("x_exciting_section_GW_k_band_segment",bandGWSegmGIndex) backend.closeSection("section_k_band_segment",bandGWSegmGIndex)
backend.closeSection("x_exciting_section_GW_k_band",bandGWGIndex)
backend.closeSection("x_exciting_section_GW_output",bandGWOutGIndex)
def buildGWMatchers():
return SM(
name = 'root',
weak = True,
startReStr = "\*\s*GW input parameters\s*\*",
sections = ["x_exciting_section_GW","x_exciting_section_GW_settings"],
subMatchers = [
SM(r"\s*Number of empty states \(GW\):\s*(?P<x_exciting_GW_polarizability_empty_states>[0-9]+)\s*")
])
def get_cachingLevelForMetaName(metaInfoEnv, CachingLvl):
"""Sets the caching level for the metadata.
Args:
metaInfoEnv: metadata which is an object of the class InfoKindEnv in nomadcore.local_meta_info.py.
CachingLvl: Sets the CachingLevel for the sections k_band, run, and single_configuration_calculation.
This allows to run the parser without opening new sections.
Returns: backend.closeSection("section_k_band",bandGWGIndex)
Dictionary with metaname as key and caching level as value. backend.closeNonOverlappingSection("section_single_configuration_calculation")
""" # logging.error("done GW onClose_section_single_configuration_calculation")
# manually adjust caching of metadata
cachingLevelForMetaName = {
'section_run': CachingLvl,
'section_method': CachingLvl
}
return cachingLevelForMetaName
...@@ -8,6 +8,7 @@ from nomadcore.caching_backend import CachingLevel ...@@ -8,6 +8,7 @@ from nomadcore.caching_backend import CachingLevel
from nomadcore.unit_conversion import unit_conversion from nomadcore.unit_conversion import unit_conversion
import os, sys, json, exciting_parser_dos,exciting_parser_bandstructure, exciting_parser_gw #, exciting_parser_gw_bor import os, sys, json, exciting_parser_dos,exciting_parser_bandstructure, exciting_parser_gw #, exciting_parser_gw_bor
from ase import Atoms from ase import Atoms
import logging
class ExcitingParserContext(object): class ExcitingParserContext(object):
...@@ -24,40 +25,43 @@ class ExcitingParserContext(object): ...@@ -24,40 +25,43 @@ class ExcitingParserContext(object):
self.atom_labels = [] self.atom_labels = []
self.secMethodIndex = None self.secMethodIndex = None
self.secSystemIndex = None self.secSystemIndex = None
self.secGWIndex = None self.secSingleConfIndex = None
self.spinTreat = None self.spinTreat = None
self.sim_cell = [] self.sim_cell = []
self.cell_format = '' self.cell_format = ''
self.secRunIndex = None
def onOpen_section_system(self, backend, gIndex, section): def onOpen_section_system(self, backend, gIndex, section):
self.secSystemIndex = gIndex self.secSystemIndex = gIndex
def onOpen_section_single_configuration_calculation(self, backend, gIndex, section):
if self.secSingleConfIndex is None:
self.secSingleConfIndex = gIndex
def onOpen_section_method(self, backend, gIndex, section): def onOpen_section_method(self, backend, gIndex, section):
if self.secMethodIndex is None:
self.secMethodIndex = gIndex self.secMethodIndex = gIndex
def onClose_section_run(self, backend, gIndex, section):
# logging.error("BASE onClose_section_run")
self.secRunIndex = gIndex
mainFile = self.parser.fIn.fIn.name mainFile = self.parser.fIn.fIn.name
dirPath = os.path.dirname(self.parser.fIn.name) dirPath = os.path.dirname(self.parser.fIn.name)
gw_File = os.path.join(dirPath, "GW_INFO.OUT") gw_File = os.path.join(dirPath, "GW_INFO.OUT")
gwFile = os.path.join(dirPath, "GWINFO.OUT") gwFile = os.path.join(dirPath, "GWINFO.OUT")
if os.path.exists(gw_File): for gFile in [gw_File, gwFile]:
subSuperContext = exciting_parser_gw.GWContext() if os.path.exists(gFile):
subParser = AncillaryParser( # logging.error("Starting GW")
fileDescription = exciting_parser_gw.buildGWMatchers(), gwParser = exciting_parser_gw.GWParser()
parser = self.parser, gwParser.parseGW(gFile, backend,
cachingLevelForMetaName = exciting_parser_gw.get_cachingLevelForMetaName(self.metaInfoEnv, CachingLevel.PreOpenedIgnore), dftMethodSectionGindex = self.secMethodIndex,
superContext = subSuperContext) dftSingleConfigurationGindex = self.secSingleConfIndex)
with open(gw_File) as fIn:
subParser.parseFile(fIn) # logging.error("Finished GW")
elif os.path.exists(gwFile): break
subSuperContext = exciting_parser_gw.GWContext() # logging.error("done BASE onClose_section_run")
subParser = AncillaryParser(
fileDescription = exciting_parser_gw.buildGWMatchers(),
parser = self.parser,
cachingLevelForMetaName = exciting_parser_gw.get_cachingLevelForMetaName(self.metaInfoEnv, CachingLevel.PreOpenedIgnore),
superContext = subSuperContext)
with open(gwFile) as fIn:
subParser.parseFile(fIn)
def onClose_x_exciting_section_lattice_vectors(self, backend, gIndex, section): def onClose_x_exciting_section_lattice_vectors(self, backend, gIndex, section):
latticeX = section["x_exciting_geometry_lattice_vector_x"] latticeX = section["x_exciting_geometry_lattice_vector_x"]
...@@ -99,15 +103,15 @@ class ExcitingParserContext(object): ...@@ -99,15 +103,15 @@ class ExcitingParserContext(object):
backend.closeSection("section_XC_functionals", gi) backend.closeSection("section_XC_functionals", gi)
def onClose_section_single_configuration_calculation(self, backend, gIndex, section): def onClose_section_single_configuration_calculation(self, backend, gIndex, section):
# logging.error("BASE onClose_section_single_configuration_calculation")
backend.addValue('single_configuration_to_calculation_method_ref', self.secMethodIndex) backend.addValue('single_configuration_to_calculation_method_ref', self.secMethodIndex)
backend.addValue('single_configuration_calculation_to_system_ref', self.secSystemIndex) backend.addValue('single_configuration_calculation_to_system_ref', self.secSystemIndex)
dirPath = os.path.dirname(self.parser.fIn.name) dirPath = os.path.dirname(self.parser.fIn.name)
dosFile = os.path.join(dirPath, "dos.xml") dosFile = os.path.join(dirPath, "dos.xml")
bandFile = os.path.join(dirPath, "bandstructure.xml") bandFile = os.path.join(dirPath, "bandstructure.xml")
fermiSurfFile = os.path.join(dirPath, "FERMISURF.bxsf") fermiSurfFile = os.path.join(dirPath, "FERMISURF.bxsf")
gw_File = os.path.join(dirPath, "GW_INFO.OUT")
gwFile = os.path.join(dirPath, "GWINFO.OUT")
eigvalFile = os.path.join(dirPath, "EIGVAL.OUT") eigvalFile = os.path.join(dirPath, "EIGVAL.OUT")
# logging.error("done BASE onClose_section_single_configuration_calculation")
if os.path.exists(dosFile): if os.path.exists(dosFile):
with open(dosFile) as f: with open(dosFile) as f:
...@@ -115,10 +119,6 @@ class ExcitingParserContext(object): ...@@ -115,10 +119,6 @@ class ExcitingParserContext(object):
if os.path.exists(bandFile): if os.path.exists(bandFile):
with open(bandFile) as g: with open(bandFile) as g:
exciting_parser_bandstructure.parseBand(g, backend, self.spinTreat) exciting_parser_bandstructure.parseBand(g, backend, self.spinTreat)
if os.path.exists(gwFile) or os.path.exists(gw_File):
backend.addValue('electronic_structure_method', "G0W0")
else:
backend.addValue('electronic_structure_method', "DFT")
if os.path.exists(eigvalFile): if os.path.exists(eigvalFile):
eigvalGIndex = backend.openSection("section_eigenvalues") eigvalGIndex = backend.openSection("section_eigenvalues")
with open(eigvalFile) as g: with open(eigvalFile) as g:
...@@ -279,21 +279,10 @@ class ExcitingParserContext(object): ...@@ -279,21 +279,10 @@ class ExcitingParserContext(object):
self.atom_pos.append([pos[0][i], pos[1][i], pos[2][i]]) self.atom_pos.append([pos[0][i], pos[1][i], pos[2][i]])
self.atom_labels = self.atom_labels + (section['x_exciting_geometry_atom_labels'] * natom) self.atom_labels = self.atom_labels + (section['x_exciting_geometry_atom_labels'] * natom)
def onClose_section_method(self, backend, gIndex, value):
if value["electronic_structure_method"][-1] == "G0W0":
gi = backend.openSection("section_method_to_method_refs")
backend.addValue("method_to_method_ref", (gIndex - 1))
backend.addValue("method_to_method_kind", 'starting_point')
backend.closeSection("section_method_to_method_refs", gi)
gi = backend.openSection("section_calculation_to_calculation_refs")
backend.addValue("calculation_to_calculation_ref", (self.CalculationGIndex - 1))
backend.addValue("calculation_to_calculation_kind", 'starting_point')
backend.closeSection("section_calculation_to_calculation_refs", gi)
def onOpen_section_single_configuration_calculation(self, backend, gIndex, value):
self.CalculationGIndex = gIndex
def onClose_section_method(self, backend, gIndex, value):
if gIndex == self.secMethodIndex:
backend.addValue('electronic_structure_method', "DFT")
mainFileDescription = \ mainFileDescription = \
SM(name = "root matcher", SM(name = "root matcher",
......
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