Commit 7636d097 authored by Lauri Himanen's avatar Lauri Himanen
Browse files

Fixed normalization issue in DOS values, removed the output of normalized dos energies.

parent 09b898ce
......@@ -116,21 +116,18 @@ class DosHandler(xml.sax.handler.ContentHandler):
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.backend.addValue("dos_energies", self.energySpin + self.fermiEnergy)
self.backend.addValue("number_of_dos_values", self.numDosVal)
self.backend.addValue("dos_kind","electronic")
self.backend.addValue("dos_kind", "electronic")
else:
self.numDosVal = int(len(self.energy)/2)
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.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.backend.addValue("dos_energies", self.energySpin + self.fermiEnergy)
self.backend.addValue("number_of_dos_values", self.numDosVal)
if self.fermiEnergy is not None:
self.backend.addValue("dos_energies_normalized", self.energySpin - self.fermiEnergy)
elif name == 'partialdos':
pass
elif name == 'interstitialdos':
......
......@@ -770,12 +770,18 @@ class ExcitingParserContext(object):
backend.closeSection("section_XC_functionals", gi)
def onClose_section_single_configuration_calculation(self, backend, gIndex, section):
fermi_energy = None
# Determine the Fermi energy for this calculation.
energy_reference_fermi = None
try:
fermi_energy = backend.superBackend.get_value('x_exciting_fermi_energy', g_index=gIndex).m
backend.addArrayValues('energy_reference_fermi', [fermi_energy, fermi_energy]) # always two spin channels
energy_reference_fermi = backend.superBackend.get_value('x_exciting_fermi_energy', g_index=gIndex).m
except KeyError:
pass
try:
energy_reference_fermi = backend.superBackend.get_value('gw_fermi_energy', g_index=gIndex).m
except KeyError:
pass
if energy_reference_fermi is not None:
backend.addArrayValues('energy_reference_fermi', [energy_reference_fermi, energy_reference_fermi]) # always two spin channels
# logger.error("BASE onClose_section_single_configuration_calculation")
backend.addValue('single_configuration_to_calculation_method_ref', self.secMethodIndex)
backend.addValue('single_configuration_calculation_to_system_ref', self.secSystemIndex)
......@@ -891,7 +897,7 @@ class ExcitingParserContext(object):
try:
with open(dosFile) as f:
exciting_parser_dos.parseDos(f, backend, self.spinTreat, self.unit_cell_vol, fermi_energy)
exciting_parser_dos.parseDos(f, backend, self.spinTreat, self.unit_cell_vol, energy_reference_fermi)
except FileNotFoundError:
logger.warning("File not found: {}" .format(dosFile))
except Exception as err:
......
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