Commits (5)
This diff is collapsed.
......@@ -276,8 +276,10 @@ class ExcitingParserContext(object):
try: # tmk:
with open(inputXSFile) as f:
exciting_parser_XS_input.parseInput(f, backend, self.rgkmax)
except IOError:
logger.error("File not found: %s" % (inputXSFile))
except FileNotFoundError:
logger.warning("File not found: {}" .format(inputXSFile))
except Exception as err:
logger.error("Exception on {}" .format(__file__), exc_info=err)
# xstype = section["x_exciting_xs_type"]
# print("xstype===",xstype)
# print("xsType===",exciting_parser_XS_input.InputHandler.self.xsType)
......@@ -369,18 +371,38 @@ class ExcitingParserContext(object):
outputEpsFile = os.path.join(dirPath, "EPSILON_BSE" + self.bsetype + '_SCR' + self.screentype + "_OC" + self.tensorComp[i] + ".OUT")
outputSigmaFile = os.path.join(dirPath, "SIGMA_BSE" + self.bsetype + '_SCR' + self.screentype + "_OC" + self.tensorComp[i] + ".OUT")
outputLossFile = os.path.join(dirPath, "LOSS_BSE" + self.bsetype + '_SCR' + self.screentype + "_OC" + self.tensorComp[i] + ".OUT")
with open(outputXSFile) as g:
xsParser = exciting_parser_xs.XSParser()
xsParser.parseExciton(outputXSFile, backend, excNum, excEn, excBindEn, osclStr, transCoeff) #, dftMethodSectionGindex = self.secMethodIndex,
with open(outputEpsFile) as g:
epsParser = exciting_parser_eps.EPSParser()
epsParser.parseEpsilon(outputEpsFile, backend, epsEn, epsilon) #, dftMethodSectionGindex = self.secMethodIndex,
with open(outputSigmaFile) as g:
sigmaParser = exciting_parser_eps.EPSParser()
sigmaParser.parseEpsilon(outputSigmaFile, backend, sigmaEn, sigma) #, dftMethodSectionGindex = self.secMethodIndex,
with open(outputLossFile) as g:
lossParser = exciting_parser_eps.EPSParser()
lossParser.parseEpsilon(outputLossFile, backend, lossEn, loss) #, dftMethodSectionGindex = self.secMethodIndex,
# - - - - -
try:
with open(outputXSFile) as g:
xsParser = exciting_parser_xs.XSParser()
xsParser.parseExciton(outputXSFile, backend, excNum, excEn, excBindEn, osclStr, transCoeff) #, dftMethodSectionGindex = self.secMethodIndex,
except FileNotFoundError:
logger.warning("File not found: {}" .format(outputXSFile))
except Exception as err:
logger.error("Exception on {}" .format(__file__), exc_info=err)
# - - - - -
try:
with open(outputEpsFile) as g:
epsParser = exciting_parser_eps.EPSParser()
epsParser.parseEpsilon(outputEpsFile, backend, epsEn, epsilon) #, dftMethodSectionGindex = self.secMethodIndex,
except FileNotFoundError:
logger.warning("File not found: {}" .format(outputEpsFile))
except Exception as err:
logger.error("Exception on Exciting subparser", exc_info=err)
# - - - - -
try:
with open(outputSigmaFile) as g:
sigmaParser = exciting_parser_eps.EPSParser()
sigmaParser.parseEpsilon(outputSigmaFile, backend, sigmaEn, sigma) #, dftMethodSectionGindex = self.secMethodIndex,
except FileNotFoundError:
logger.warning("File not found: {}" .format(outputSigmaFile))
except Exception as err:
logger.error("Exception on {}" .format(__file__), exc_info=err)
# with open(outputLossFile) as g:
# lossParser = exciting_parser_eps.EPSParser()
# lossParser.parseEpsilon(outputLossFile, backend, lossEn, loss) #, dftMethodSectionGindex = self.secMethodIndex,
# dftSingleConfigurationGindex = self.secSingleConfIndex)
backend.addValue("x_exciting_xs_bse_number_of_components",numberOfComponents)
backend.addValue("x_exciting_xs_bse_number_of_excitons",len(excNum))
......@@ -439,35 +461,40 @@ class ExcitingParserContext(object):
# dielTensSymIm = []
# dielTensNoSymIm = []
with open(QFile) as g:
while 1:
s = g.readline()
if not s: break
s = s.strip()
s = s.split()
if not is_number(s[1]):
# print("s===",s)
qpointNumber = int(s[0] )
else:
qPlusGCartesian.append([])
qPlusGLattice.append([])
qLattice.append([float(s[1]),float(s[2]),float(s[3])])
qCartesian.append([float(s[1]),float(s[2]),float(s[3])])
qPlusG.append(int(s[7]))
if self.xsTetra and self.xsAC and not self.xsNAR:
ext = "TET_AC_NAR"
elif not self.xsTetra and self.xsAC and not self.xsNAR:
ext = "AC_NAR"
elif not self.xsTetra and not self.xsAC and not self.xsNAR:
ext = "NAR"
elif self.xsTetra and self.xsAC and self.xsNAR:
ext = "TET_AC"
elif self.xsTetra and not self.xsAC and self.xsNAR:
ext = "TET"
elif self.xsTetra and not self.xsAC and not self.xsNAR:
ext = "TET_NAR"
else:
ext=""
try:
with open(QFile) as g:
while 1:
s = g.readline()
if not s: break
s = s.strip()
s = s.split()
if not is_number(s[1]):
qpointNumber = int(s[0] )
else:
qPlusGCartesian.append([])
qPlusGLattice.append([])
qLattice.append([float(s[1]),float(s[2]),float(s[3])])
qCartesian.append([float(s[1]),float(s[2]),float(s[3])])
qPlusG.append(int(s[7]))
if self.xsTetra and self.xsAC and not self.xsNAR:
ext = "TET_AC_NAR"
elif not self.xsTetra and self.xsAC and not self.xsNAR:
ext = "AC_NAR"
elif not self.xsTetra and not self.xsAC and not self.xsNAR:
ext = "NAR"
elif self.xsTetra and self.xsAC and self.xsNAR:
ext = "TET_AC"
elif self.xsTetra and not self.xsAC and self.xsNAR:
ext = "TET"
elif self.xsTetra and not self.xsAC and not self.xsNAR:
ext = "TET_NAR"
else:
ext=""
except FileNotFoundError:
logger.warning("File not found: {}" .format(QFile))
except Exception as err:
logger.error("Exception on {}" .format(__file__), exc_info=err)
# ---- QFile closing
# xstype = "BSE"
# self.xstype = "BSE"
# dummyBse = files[11:13]
......@@ -734,8 +761,13 @@ class ExcitingParserContext(object):
if xcNr == 100:
dirPath = os.path.dirname(self.parser.fIn.name)
inputGSFile = os.path.join(dirPath, "input.xml")
with open(inputGSFile) as f:
try:
with open(inputGSFile) as f:
exciting_parser_GS_input.parseInput(f, backend)
except FileNotFoundError:
logger.warning("File not found: {}" .format(inputGSFile))
except Exception as err:
logger.error("Exception while processing file {}" .format(inputGSFile), exc_info=err)
else:
for xcName in xc_internal_map[xcNr]:
self.xcName = xcName
......@@ -856,9 +888,14 @@ class ExcitingParserContext(object):
eigvalFile = os.path.join(dirPath, "EIGVAL.OUT")
# logger.error("done BASE onClose_section_single_configuration_calculation")
if os.path.exists(dosFile):
try:
with open(dosFile) as f:
exciting_parser_dos.parseDos(f, backend, self.spinTreat, self.unit_cell_vol)
except FileNotFoundError:
logger.warning("File not found: {}" .format(dosFile))
except Exception as err:
logger.error("Exception while processing file {}" .format(dosFile), exc_info=err)
if os.path.exists(bandFile):
with open(bandFile) as g:
exciting_parser_bandstructure.parseBand(g, backend, self.spinTreat)
......@@ -1200,7 +1237,7 @@ mainFileDescription = \
SM(startReStr = r"\s*atomic positions\s*\((?P<x_exciting_atom_position_format>[-a-zA-Z]+)\)\s*:\s*",
endReStr = r"\s*magnetic fields\s*",
subMatchers = [
SM(r"\s*(?P<x_exciting_geometry_atom_number>[+0-9]+)\s*:\s*(?P<x_exciting_geometry_atom_positions_x>[-+0-9.]+)\s*(?P<x_exciting_geometry_atom_positions_y>[-+0-9.]+)\s*(?P<x_exciting_geometry_atom_positions_z>[-+0-9.]+)", repeats = True)
SM(r"\s*(?P<x_exciting_geometry_atom_number>[+0-9]+)\s*:\s*(?P<x_exciting_geometry_atom_positions_x>[-+]?[0-9.]+)\s*(?P<x_exciting_geometry_atom_positions_y>[-+]?[0-9.]+)\s*(?P<x_exciting_geometry_atom_positions_z>[-+]?[0-9.]+)", repeats = True)
]) #,
# SM(startReStr = r"\s*magnetic fields\s*\((?P<x_exciting_magnetic_field_format>[-a-zA-Z]+)\)\s*:\s*",
# subMatchers = [
......@@ -1437,4 +1474,5 @@ class ExcitingParser():
cachingLevelForMetaName = cachingLevelForMetaName,
superContext=ExcitingParserContext(),
superBackend=backend)
# print("#"*50 + "\nPARSING ENDED. NORMALIZER FOLLOWS..."+"\n"*5)# tmk:
return backend