Commits (2)
......@@ -110,23 +110,25 @@ class DosHandler(xml.sax.handler.ContentHandler):
def endElement(self, name):
if name == 'totaldos':
self.inDos = False
if not self.spinTreat:
self.numDosVal = len(self.energy)
self.totDosSpin[0] = self.totDos[0:self.numDosVal]
self.totDosSpin[1] = self.totDos[0:self.numDosVal]
self.energySpin = self.energy[0:self.numDosVal]
self.backend.addValue("dos_values", np.array(self.totDosSpin) * self.unitCellVol)
self.backend.addValue("dos_energies", self.energySpin + self.fermiEnergy)
self.backend.addValue("number_of_dos_values", self.numDosVal)
self.backend.addValue("dos_kind", "electronic")
else:
self.numDosVal = int(len(self.energy) / 2)
self.totDosSpin[0] = self.totDos[0:self.numDosVal]
self.totDosSpin[1] = self.totDos[self.numDosVal:int(2 * (self.numDosVal))]
self.energySpin = self.energy[0:self.numDosVal]
self.backend.addValue("dos_values", np.array(self.totDosSpin) * self.unitCellVol)
self.backend.addValue("dos_energies", self.energySpin + self.fermiEnergy)
self.backend.addValue("number_of_dos_values", self.numDosVal)
if self.fermiEnergy is not None:
if not self.spinTreat:
self.numDosVal = len(self.energy)
self.totDosSpin[0] = self.totDos[0:self.numDosVal]
self.totDosSpin[1] = self.totDos[0:self.numDosVal]
self.energySpin = self.energy[0:self.numDosVal]
self.backend.addValue("dos_values", np.array(self.totDosSpin) * self.unitCellVol)
self.backend.addValue("dos_energies", np.array(self.energySpin) + self.fermiEnergy)
self.backend.addValue("number_of_dos_values", self.numDosVal)
self.backend.addValue("dos_kind", "electronic")
else:
self.numDosVal = int(len(self.energy) / 2)
self.totDosSpin[0] = self.totDos[0:self.numDosVal]
self.totDosSpin[1] = self.totDos[self.numDosVal:int(2 * (self.numDosVal))]
self.energySpin = self.energy[0:self.numDosVal]
self.backend.addValue("dos_values", np.array(self.totDosSpin) * self.unitCellVol)
self.backend.addValue("dos_energies", np.array(self.energySpin) + self.fermiEnergy)
self.backend.addValue("number_of_dos_values", self.numDosVal)
self.backend.addValue("dos_kind", "electronic")
elif name == 'partialdos':
pass
......
......@@ -194,6 +194,7 @@ class GWParser(object):
# ############# DOS ##############
if os.path.exists(dosGWFile):
# print('\nPARSING GW DOS FILE\n') # TMK:
dosGWGIndex = backend.openSection("section_dos")
ha_per_joule = unit_conversion.convert_unit(1, "hartree", "J")
fromH = unit_conversion.convert_unit_function("hartree", "J")
......
......@@ -240,6 +240,8 @@ class ExcitingParserContext(object):
for gFile in [gw_File, gwFile]:
if os.path.exists(gFile):
gwParser = exciting_parser_gw.GWParser()
# print('Calling GW subparser @ nClose_section_run()\n')
gwParser.parseGW(gFile, backend,
dftMethodSectionGindex = self.secMethodIndex,
dftSingleConfigurationGindex = self.secSingleConfIndex,
......@@ -902,6 +904,7 @@ class ExcitingParserContext(object):
try:
with open(dosFile) as f:
# print('Calling dos subparser @ onClose_section_single_configuration_calculation()\n')
exciting_parser_dos.parseDos(f, backend, self.spinTreat, self.unit_cell_vol, energy_reference_fermi)
except FileNotFoundError:
logger.warning("File not found: {}" .format(dosFile))
......