# Copyright 2016-2018 The NOMAD Developers Group
# Copyright 2017-2018 Lorenzo Pardini
#
# Licensed under the Apache License, Version 2.0 (the "License");
......
# Copyright 2016-2018 The NOMAD Developers Group
# Copyright 2017-2018 Lorenzo Pardini
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -22,10 +23,10 @@ from nomadcore.unit_conversion import unit_conversion
class InputHandler(xml.sax.handler.ContentHandler):
def __init__(self, backend, rgkmax):
# self.xsType = None
# self.xsType = None
self.rgkmax = rgkmax[0]
self.rgkmaxScr = rgkmax[0]
# print("self.rgkmax===",self.rgkmax)
# print("self.rgkmax===",self.rgkmax)
self.backend = backend
self.inputSectionGIndex = -1
self.inXSInput = False
......@@ -47,14 +48,15 @@ class InputHandler(xml.sax.handler.ContentHandler):
self.scissor = 0.0
self.vkloffXS = [0.0, 0.0, 0.0]
self.vkloffXSDum = [0.0, 0.0, 0.0]
# self.vkloffScr = [-1.0, -1.0, -1.0]
# self.vkloffScrDum = "-1.0 -1.0 -1.0"
# self.vkloffScr = [-1.0, -1.0, -1.0]
# self.vkloffScrDum = "-1.0 -1.0 -1.0"
self.screening = "none"
self.bse = False
# self.screentype = "full"
############ BSE variables################
# self.screentype = "full"
############ BSE variables ################
self.aresbse = True
# self.bsetype = "singlet"
# self.bsetype = "singlet"
self.lmaxdielt = 14
self.nstlbse = [0, 0, 0, 0]
self.nstlbseDum = [0, 0, 0, 0]
......@@ -80,17 +82,16 @@ class InputHandler(xml.sax.handler.ContentHandler):
self.nwacont = 0
self.tetra = False
self.tetradf = "false"
# self.xstype = "BSE"
# self.xstype = "BSE"
def endDocument(self):
# pass
# if self.freqgrid == "none":
# self.backend.addValue("gw_max_frequency", self.freqmax)
# self.backend.addValue("gw_frequency_grid_type", self.fgrid)
# self.backend.addValue("gw_number_of_frequencies", self.nomeg)
# self.backend.addValue("gw_basis_set", "mixed")
# self.backend.addValue("gw_qp_equation_treatment", "linearization")
# pass
#if self.freqgrid == "none":
# self.backend.addValue("gw_max_frequency", self.freqmax)
# self.backend.addValue("gw_frequency_grid_type", self.fgrid)
# self.backend.addValue("gw_number_of_frequencies", self.nomeg)
# self.backend.addValue("gw_basis_set", "mixed")
#self.backend.addValue("gw_qp_equation_treatment", "linearization")
if self.tetradf == "true":
self.backend.addValue("x_exciting_xs_tetra", True)
......@@ -103,9 +104,9 @@ class InputHandler(xml.sax.handler.ContentHandler):
self.ngridkXS[j] = int(self.ngridkXSDum[j])
self.vkloffXS[j] = float(self.vkloffXSDum[j])
self.ngridkScr[j] = int(self.ngridkScrDum[j])
# self.nstlbse[j] = int (self.nstlbseDum[j])
# self.nstlxas[j] = int (self.nstlxasDum[j])
# self.vkloffScr[j] = float(self.vkloffScrDum[j])
# self.nstlbse[j] = int (self.nstlbseDum[j])
# self.nstlxas[j] = int (self.nstlxasDum[j])
# self.vkloffScr[j] = float(self.vkloffScrDum[j])
for j in range(0,4):
self.nstlbse[j] = int (self.nstlbseDum[j])
......@@ -123,14 +124,13 @@ class InputHandler(xml.sax.handler.ContentHandler):
self.backend.addValue("x_exciting_xs_bse_xasedge", self.xasedge)
self.backend.addValue("x_exciting_xs_bse_xasspecies", self.xasspecies)
self.backend.addValue("x_exciting_xs_bse_xas_number_of_bands", self.nstlxas)
# self.backend.addValue("x_exciting_xs_bse_xas_number_of_bands", self.nstlxas)
# for j in range(0,4):
# self.nstlbse[j] = int (self.nstlbseDum[j])
# for j in range(0,2):
# self.nstlxas[j] = int (self.nstlxasDum[j])
# self.backend.addValue("x_exciting_xs_bse_xas_number_of_bands", self.nstlxas)
# self.backend.addValue("x_exciting_xs_screeninig_vkloff", self.vkloffScr)
# for j in range(0,4):
# self.nstlbse[j] = int (self.nstlbseDum[j])
# for j in range(0,2):
# self.nstlxas[j] = int (self.nstlxasDum[j])
# self.backend.addValue("x_exciting_xs_screeninig_vkloff", self.vkloffScr)
if self.rgkmaxXs == 0.0:
self.backend.addValue("x_exciting_xs_rgkmax", self.rgkmax)
......@@ -149,14 +149,14 @@ class InputHandler(xml.sax.handler.ContentHandler):
self.backend.addValue("x_exciting_xs_bse_rgkmax", float(self.rgkmaxBse))
def startElement(self, name, attrs):
# xsType = None
# xsType = None
if name == "xs":
# self.inputSectionGIndex = self.backend.openSection("section_system")
# self.inputSectionGIndex = self.backend.openSection("section_system")
self.inXSInput = True
xstype = attrs.getValue('xstype')
self.backend.addValue("x_exciting_xs_xstype", xstype)
self.backend.addValue('x_exciting_electronic_structure_method', xstype)
# print("xstyppe===",xstype)
# print("xstyppe===",xstype)
try:
self.broad = attrs.getValue('broad')
......@@ -213,7 +213,7 @@ class InputHandler(xml.sax.handler.ContentHandler):
try:
dummy = attrs.getValue('ngridk')
self.ngridkScrDum = dummy.split()
# print("dummo===",self.ngridkScrDum)
# print("dummo===",self.ngridkScrDum)
except:
self.ngridkScrDum = [0, 0, 0]
try:
......@@ -226,25 +226,25 @@ class InputHandler(xml.sax.handler.ContentHandler):
except:
self.backend.addValue("x_exciting_xs_screening_type", self.screentype)
# self.aresbse = "true"
# self.bsetype = "singlet"
# self.lmaxdielt = 14
# self.nstlbse = [0, 0, 0, 0]
# self.nstlxas = [0, 0]
# self.rgkmaxBse = rgkmax[0]
# self.sciavbd = "true"
# self.sciavqbd = "false"
# self.sciavqhd = "false"
# self.sciavqwg = "false"
# self.sciavtype = "spherical"
# self.xas = "false"
# self.xasatom = 0
# self.xasedge = "K"
# self.xasspecies = 0
# self.aresbse = "true"
# self.bsetype = "singlet"
# self.lmaxdielt = 14
# self.nstlbse = [0, 0, 0, 0]
# self.nstlxas = [0, 0]
# self.rgkmaxBse = rgkmax[0]
# self.sciavbd = "true"
# self.sciavqbd = "false"
# self.sciavqhd = "false"
# self.sciavqwg = "false"
# self.sciavtype = "spherical"
# self.xas = "false"
# self.xasatom = 0
# self.xasedge = "K"
# self.xasspecies = 0
elif name == "BSE":
self.bse = True
# xsType = "BSE"
# xsType = "BSE"
try:
self.aresbse = attrs.getValue('aresbse')
if self.aresbse == "true":
......@@ -260,10 +260,10 @@ class InputHandler(xml.sax.handler.ContentHandler):
self.backend.addValue("x_exciting_xs_bse_angular_momentum_cutoff", self.lmaxdielt)
try:
self.rgkmaxBse = attrs.getValue('rgkmax')
# self.backend.addValue("x_exciting_xs_bse_rgkmax", float(self.rgkmax))
# self.backend.addValue("x_exciting_xs_bse_rgkmax", float(self.rgkmax))
except:
pass
# self.backend.addValue("x_exciting_xs_bse_rgkmax", self.rgkmax)
# self.backend.addValue("x_exciting_xs_bse_rgkmax", self.rgkmax)
try:
self.sciavbd = attrs.getValue('sciavbd')
if self.sciavqbd == "true":
......@@ -304,33 +304,33 @@ class InputHandler(xml.sax.handler.ContentHandler):
try:
self.xas = attrs.getValue('xas')
if self.xas == "false":
# print("xas===",self.xas)
# print("xas===",self.xas)
self.backend.addValue("x_exciting_xs_bse_xas", False)
else:
# print("xas===",self.xas)
# print("xas===",self.xas)
self.backend.addValue("x_exciting_xs_bse_xas", True)
except:
# print("xasdefault===",self.xas)
# print("xasdefault===",self.xas)
self.backend.addValue("x_exciting_xs_bse_xas", self.xas)
try:
self.xasatom = int(attrs.getValue('xasatom'))
# self.backend.addValue("x_exciting_xs_bse_xasatom", self.xasatom)
# self.backend.addValue("x_exciting_xs_bse_xasatom", self.xasatom)
except:
pass
# self.backend.addValue("x_exciting_xs_bse_xasatom", self.xasatom)
# self.backend.addValue("x_exciting_xs_bse_xasatom", self.xasatom)
try:
self.xasedge = attrs.getValue('xasedge')
# self.backend.addValue("x_exciting_xs_bse_xasedge", self.xasedge)
# self.backend.addValue("x_exciting_xs_bse_xasedge", self.xasedge)
except:
pass
# self.backend.addValue("x_exciting_xs_bse_xasedge", self.xasedge)
# self.backend.addValue("x_exciting_xs_bse_xasedge", self.xasedge)
try:
self.xasspecies = int(attrs.getValue('xasspecies'))
# self.backend.addValue("x_exciting_xs_bse_xasspecies", self.xasspecies)
# self.backend.addValue("x_exciting_xs_bse_xasspecies", self.xasspecies)
except:
pass
# self.backend.addValue("x_exciting_xs_bse_xasspecies", self.xasspecies)
# if self.xas == False:
# self.backend.addValue("x_exciting_xs_bse_xasspecies", self.xasspecies)
# if self.xas == False:
try:
dummy = attrs.getValue('nstlbse')
self.nstlbseDum = dummy.split()
......@@ -435,13 +435,13 @@ class InputHandler(xml.sax.handler.ContentHandler):
self.tetra = True
try:
self.tetradf = attrs.getValue('tetradf')
# if self.tetradf == "true":
# selfbackend.addValue("x_exciting_xs_tetra", True)
# else:
# self.backend.addValue("x_exciting_xs_tetra", False)
# if self.tetradf == "true":
# selfbackend.addValue("x_exciting_xs_tetra", True)
# else:
# self.backend.addValue("x_exciting_xs_tetra", False)
except:
self.tetradf == "false"
# self.backend.addValue("x_exciting_xs_tetra", False)
# self.backend.addValue("x_exciting_xs_tetra", False)
def endElement(self, name):
pass
......
# Copyright 2016-2018 The NOMAD Developers Group
# Copyright 2017-2018 Lorenzo Pardini
#
# Licensed under the Apache License, Version 2.0 (the "License");
......
# Copyright 2016-2018 The NOMAD Developers Group
# Copyright 2017-2018 Lorenzo Pardini
#
# Licensed under the Apache License, Version 2.0 (the "License");
......
# Copyright 2016-2018 The NOMAD Developers Group
# Copyright 2017-2018 Lorenzo Pardini
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -40,8 +41,9 @@ class EPSParser(object):
def startedParsing(self, path, parser):
"""called when parsing starts"""
self.parser = parser
# allows to reset values if the same superContext is used to parse different files
# self.initialize_values()
# allows to reset values if the same superContext is used
# to parse different files
# self.initialize_values()
def parseEpsilon(self, epsFile, backend, epsEn, epsilon):
with open(epsFile) as g:
......
# Copyright 2016-2018 The NOMAD Developers Group
# Copyright 2017-2018 Lorenzo Pardini
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -41,11 +42,13 @@ class GWParser(object):
def startedParsing(self, path, parser):
"""called when parsing starts"""
self.parser = parser
# allows to reset values if the same superContext is used to parse different files
# self.initialize_values()
# allows to reset values if the same superContext is used
# to parse different files
#s self.initialize_values()
def parseGW(self, gwFile, backend, dftMethodSectionGindex, dftSingleConfigurationGindex, xcName, unitCellVol,gmaxvr):
# logging.error("GW onClose_section_single_configuration_calculation")
def parseGW(self, gwFile, backend, dftMethodSectionGindex,
dftSingleConfigurationGindex, xcName, unitCellVol, gmaxvr):
# logging.error("GW onClose_section_single_configuration_calculation")
self.gmaxvr = float(gmaxvr[0])
self.unitCellVol = float(unitCellVol[0])
backend.openNonOverlappingSection("section_single_configuration_calculation")
......@@ -189,8 +192,7 @@ class GWParser(object):
backend.addValue("gw_self_energy_c", Sc)
backend.addValue("gw_xc_potential", Vxc)
####################DOS######################
# ############# DOS ##############
if os.path.exists(dosGWFile):
dosGWGIndex = backend.openSection("section_dos")
ha_per_joule = unit_conversion.convert_unit(1, "hartree", "J")
......@@ -215,8 +217,7 @@ class GWParser(object):
backend.addValue("number_of_dos_values", len(dosEnergies))
backend.closeSection("section_dos",dosGWGIndex)
##################BANDSTRUCTURE#####################
# ############### BANDSTRUCTURE ###############
if os.path.exists(bandCarbGWFile):
bandGWGIndex = backend.openSection("section_k_band")
fromH = unit_conversion.convert_unit_function("hartree", "J")
......@@ -356,47 +357,47 @@ class GWParser(object):
backend.closeSection("section_k_band",bandGWGIndex)
backend.closeNonOverlappingSection("section_single_configuration_calculation")
# logging.error("done GW onClose_section_single_configuration_calculation")
# def onOpen_section_method(self, backend, gIndex, section):
# fava = section["gw_frequency_number"]
# print("fava=",fava)
# def onClose_section_single_configuration_calculation(self, backend, gIndex, section):
# if dftSingleConfigurationGindex is not None:
## if self.secSingleConfIndex is None:
## self.secSingleConfIndex = gIndex
## singleGIndex = backend.openSection("section_single_configuration_calculation")
# fermi = section["gw_fermi_energy"]
# fundamental = section["gw_fundamental_gap"]
# optical = section["gw_optical_gap"]
# backend.addValue("gw_fermi_energy", fermi)
# backend.addValue("gw_fundamental_gap", fundamental)
# backend.addValue("gw_optical_gap", optical)
## backend.closeSection("section_single_configuration_calculation",singleGIndex)
# else:
# singleGIndex = backend.openSection("section_single_configuration_calculation")
# fermi = section["gw_fermi_energy"]
# fundamental = section["gw_fundamental_gap"]
# optical = section["gw_optical_gap"]
# backend.addValue("gw_fermi_energy", fermi)
# backend.addValue("gw_fundamental_gap", fundamental)
# backend.addValue("gw_optical_gap", optical)
# backend.closeSection("section_single_configuration_calculation",singleGIndex)
# logging.error("done GW onClose_section_single_configuration_calculation")
# def onOpen_section_method(self, backend, gIndex, section):
# fava = section["gw_frequency_number"]
# print("fava=",fava)
# def onClose_section_single_configuration_calculation(self, backend, gIndex, section):
# if dftSingleConfigurationGindex is not None:
# if self.secSingleConfIndex is None:
# self.secSingleConfIndex = gIndex
# singleGIndex = backend.openSection("section_single_configuration_calculation")
# fermi = section["gw_fermi_energy"]
# fundamental = section["gw_fundamental_gap"]
# optical = section["gw_optical_gap"]
# backend.addValue("gw_fermi_energy", fermi)
# backend.addValue("gw_fundamental_gap", fundamental)
# backend.addValue("gw_optical_gap", optical)
# backend.closeSection("section_single_configuration_calculation",singleGIndex)
# else:
# singleGIndex = backend.openSection("section_single_configuration_calculation")
# fermi = section["gw_fermi_energy"]
# fundamental = section["gw_fundamental_gap"]
# optical = section["gw_optical_gap"]
# backend.addValue("gw_fermi_energy", fermi)
# backend.addValue("gw_fundamental_gap", fundamental)
# backend.addValue("gw_optical_gap", optical)
# backend.closeSection("section_single_configuration_calculation",singleGIndex)
def buildGWMatchers():
return SM(
name = 'root',
weak = True,
startReStr = "\=\s*Main GW output file\s*\=",
# sections = ["section_run"],
# sections = ["section_run"],
subMatchers = [
SM(
startReStr = "\-\s*frequency grid\s*\-",
endReStr = "\-\s*Peak memory estimate \(Mb, per process\)\:\s*\-",
sections = ["section_method"],
subMatchers = [
# SM(r"\s*Type\:\s*\<\s*(?P<gw_dummy>[-a-zA-Z]+)\s*\>"),
# SM(r"\s*Type\:\s*\<\s*(?P<gw_dummy>[-a-zA-Z]+)\s*\>"),
SM(r"\s*(?P<gw_frequency_number>[0-9]+)\s*(?P<gw_frequency_values__hartree>[0-9]\.[0-9]*([E]?[-]?[-0-9]+))\s*(?P<gw_frequency_weights>[0-9]\.[0-9]*([E]?[-]?[-0-9]+))", repeats = True)
]),
SM(
......@@ -412,10 +413,10 @@ def buildGWMatchers():
])
def get_cachingLevelForMetaName(metaInfoEnv, CachingLvl):
cachingLevelForMetaName = {}
# 'section_single_configuration_calculation': CachingLvl
# }
# cachingLevelForMetaName["gw_fundamental_gap"] = CachingLevel.Cache
# cachingLevelForMetaName["gw_optical_gap"] = CachingLevel.Cache
# cachingLevelForMetaName["gw_fermi_energy"] = CachingLevel.Cache
# 'section_single_configuration_calculation': CachingLvl
# }
# cachingLevelForMetaName["gw_fundamental_gap"] = CachingLevel.Cache
# cachingLevelForMetaName["gw_optical_gap"] = CachingLevel.Cache
# cachingLevelForMetaName["gw_fermi_energy"] = CachingLevel.Cache
return cachingLevelForMetaName
# Copyright 2016-2018 The NOMAD Developers Group
# Copyright 2017-2018 Lorenzo Pardini
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -82,7 +83,7 @@ class InputHandler(xml.sax.handler.ContentHandler):
def startElement(self, name, attrs):
fromH = unit_conversion.convert_unit_function("hartree", "J")
if name == "gw":
# self.inputSectionGIndex = self.backend.openSection("section_system")
# self.inputSectionGIndex = self.backend.openSection("section_system")
self.inGWInput = True
try:
self.coreflag = attrs.getValue('coreflag')
......
# Copyright 2016-2018 The NOMAD Developers Group
# Copyright 2017-2018 Lorenzo Pardini
#
# Licensed under the Apache License, Version 2.0 (the "License");
......@@ -35,7 +36,7 @@ class XSParser(object):
"""called when parsing starts"""
self.parser = parser
# allows to reset values if the same superContext is used to parse different files
# self.initialize_values()
# self.initialize_values()
def parseExciton(self, excFile, backend, excNum, excEn, excBindEn, osclStr, transCoeff):
with open(excFile) as g:
......
This diff is collapsed.
# Copyright 2016-2018 The NOMAD Developers Group
# Copyright 2017-2018 Lorenzo Pardini
#
# Licensed under the Apache License, Version 2.0 (the "License");
......