From 469cf083557b12d8500a45a9edcbccfbcbebeece Mon Sep 17 00:00:00 2001 From: Riccardo Reho Date: Tue, 2 Dec 2025 09:41:56 +0100 Subject: [PATCH 1/2] fix indentation in pwxml.py --- qepy/pwxml.py | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/qepy/pwxml.py b/qepy/pwxml.py index f5848f41..d46084ec 100644 --- a/qepy/pwxml.py +++ b/qepy/pwxml.py @@ -255,24 +255,28 @@ def read_datafile_schema(self,filename): if self.lsda == False: # occupations = 'smearing' if self.occ_type == 'smearing': - if self.occ_type == 'fixed' and self.lsda == False: - print('Fermi energy for the case occ: %s and spin polarization false' % self.occ_type) - self.fermi = float(self.datafile_xml.find("output/band_structure/highestOccupiedLevel").text)*HatoeV - print('Fermi energy = %lf eV' % self.fermi) - self.eigen1 = np.array(self.eigen1)*HatoeV - self.fermi + print('Fermi energy for the case occ: %s and spin polarization false' % self.occ_type) + self.fermi = float(self.datafile_xml.find("output/band_structure/fermi_energy").text)*HatoeV + print('Fermi energy = %lf eV' % self.fermi) + self.eigen1 = np.array(self.eigen1)*HatoeV - self.fermi # occupations = 'fixed' - else: - try: - print('Fermi energy for the case occ: %s and spin polarization false' % self.occ_type) - self.fermi = float(self.datafile_xml.find("output/band_structure/fermi_energy").text)*HatoeV - print('Fermi energy = %lf eV' % self.fermi) - self.eigen1 = np.array(self.eigen1)*HatoeV - self.fermi - except AttributeError: - print('Fermi energy for the case occ: %s and spin polarization false' % self.occ_type) - print('Attention!!!! Two fermi levels detected') - fermis = self.datafile_xml.find("output/band_structure/two_fermi_energies").text.split() - self.fermis = [float(fermis[0])*HatoeV,float(fermis[1])*HatoeV] - self.fermi = self.fermis[1] # set to spin minority energy + elif self.occ_type == 'fixed': + print('Fermi energy for the case occ: %s and spin polarization false' % self.occ_type) + self.fermi = float(self.datafile_xml.find("output/band_structure/highestOccupiedLevel").text)*HatoeV + print('Fermi energy = %lf eV' % self.fermi) + self.eigen1 = np.array(self.eigen1)*HatoeV - self.fermi + else: + try: + print('Fermi energy for the case occ: %s and spin polarization false' % self.occ_type) + self.fermi = float(self.datafile_xml.find("output/band_structure/fermi_energy").text)*HatoeV + print('Fermi energy = %lf eV' % self.fermi) + self.eigen1 = np.array(self.eigen1)*HatoeV - self.fermi + except AttributeError: + print('Fermi energy for the case occ: %s and spin polarization false' % self.occ_type) + print('Attention!!!! Two fermi levels detected') + fermis = self.datafile_xml.find("output/band_structure/two_fermi_energies").text.split() + self.fermis = [float(fermis[0])*HatoeV,float(fermis[1])*HatoeV] + self.fermi = self.fermis[1] if self.lsda == True: # occupations = 'smearing' From b0d7632e77b066f9026e37edba7fab89390673ac Mon Sep 17 00:00:00 2001 From: Riccardo Reho Date: Thu, 19 Feb 2026 18:43:39 +0100 Subject: [PATCH 2/2] normalization on exciton dipoles --- yambopy/bse/excitondipoles.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/yambopy/bse/excitondipoles.py b/yambopy/bse/excitondipoles.py index 70d42136..2baf899c 100644 --- a/yambopy/bse/excitondipoles.py +++ b/yambopy/bse/excitondipoles.py @@ -135,7 +135,7 @@ def exc_dipoles_pol(lattice_path,dipoles_path=None,bse_path=None,save_files=True # Since we have dipoles for emission, we do not conjugate BS_wfc # Then the results are directly the exciton dipoles for emission dip_exc = np.einsum('nkcv,kicv->in',BS_wfc,dip_expanded, - optimize=True).astype(dtype=dipoles.dtype) + optimize=True).astype(dtype=dipoles.dtype)/np.sqrt(yexc.nkpoints) if save_files: if dip_file[-4:]!='.npy': dip_file = dip_file+'.npy'