Exciton weight in by plot-excitondb.py
Posted: Fri Jul 25, 2025 3:32 pm
Hello,
I'm following the tutorial to plot the exciton weight by plot-excitondb.py. I'm doing it on my system (NiI2 spin polarized) and I have an error that says:
"
File "/users/3059354/program/yambopy/yambopy/dbs/excitondb.py", line 962, in get_exciton_bs
size *= 1.0/np.max(exc_weights)
"
I checked get_exciton_bs and I saw that there is an "if" for non spin-polarised case and an empty "elif" that is commented and that does not give an alternative script for spin-polarised cases.
"
def get_exciton_bs(self,energies_db,path,excitons,size=1,f=None,debug=False):
"""
Get a YambopyBandstructure object with the exciton band-structure
Arguments:
ax -> axis extance of matplotlib to add the plot to
lattice -> Lattice database
energies_db -> Energies database, can be either ElectronsDB or QPDB
path -> Path in the brillouin zone
"""
from qepy.lattice import Path
if not isinstance(path,Path):
raise ValueError('Path argument must be a instance of Path. Got %s instead'%type(path))
if self.spin_pol=='no':
bands_kpoints, exc_energies, exc_weights, path_car = self.exciton_bs(energies_db, path, excitons, debug)
exc_energies = exc_energies[:,self.start_band:self.mband]
exc_weights = exc_weights[:,self.start_band:self.mband]
#elif spin_pol=='pol':
if f: exc_weights = f(exc_weights)
size *= 1.0/np.max(exc_weights)
ybs = YambopyBandStructure(exc_energies, bands_kpoints, weights=exc_weights, kpath=path_car, size=size)
return ybs
"
Is there a way to bypass this error for spin-polarised system?
Thank you very much.
(Anna Romani, Queen's University Belfast, UK)
I'm following the tutorial to plot the exciton weight by plot-excitondb.py. I'm doing it on my system (NiI2 spin polarized) and I have an error that says:
"
File "/users/3059354/program/yambopy/yambopy/dbs/excitondb.py", line 962, in get_exciton_bs
size *= 1.0/np.max(exc_weights)
"
I checked get_exciton_bs and I saw that there is an "if" for non spin-polarised case and an empty "elif" that is commented and that does not give an alternative script for spin-polarised cases.
"
def get_exciton_bs(self,energies_db,path,excitons,size=1,f=None,debug=False):
"""
Get a YambopyBandstructure object with the exciton band-structure
Arguments:
ax -> axis extance of matplotlib to add the plot to
lattice -> Lattice database
energies_db -> Energies database, can be either ElectronsDB or QPDB
path -> Path in the brillouin zone
"""
from qepy.lattice import Path
if not isinstance(path,Path):
raise ValueError('Path argument must be a instance of Path. Got %s instead'%type(path))
if self.spin_pol=='no':
bands_kpoints, exc_energies, exc_weights, path_car = self.exciton_bs(energies_db, path, excitons, debug)
exc_energies = exc_energies[:,self.start_band:self.mband]
exc_weights = exc_weights[:,self.start_band:self.mband]
#elif spin_pol=='pol':
if f: exc_weights = f(exc_weights)
size *= 1.0/np.max(exc_weights)
ybs = YambopyBandStructure(exc_energies, bands_kpoints, weights=exc_weights, kpath=path_car, size=size)
return ybs
"
Is there a way to bypass this error for spin-polarised system?
Thank you very much.
(Anna Romani, Queen's University Belfast, UK)