## questions on the using of plot-excitondb.py

Post here any question you encounter when running the scripts of the yambo-py suite. Post here problem strictly to the python interface as problem coming from the yambo runs should go in the appropriate subforum.

Moderators: palful, amolina, mbonacci

sun
Posts: 3
Joined: Fri Apr 12, 2024 9:22 pm
Location: Rice University, Houston, TX, United States
Contact:

### questions on the using of plot-excitondb.py

Dear Developers,

I tried yambopy and found it is very strong and versatile. I have a question about the using, that is when I input: python plot-excitondb.py
it shows:

19 kpoints expanded to 144
Ground state energy: 1.765612
Intensity: 0.360372
1st-excited state energy: 1.769712
Intensity: 0.000000
This interpolation is provided by the SKW interpolator implemented in Abipy
19 kpoints expanded to 144
Found 24 symmetries in point group
rmax [13 13 13] msize: 19683
gen points 0.24698424339294434
nshells 1386
shells 0.011551618576049805
stars 1.1475365161895752
r2max [ 9 -8 2]
end 0.0024149417877197266
Using: 190 star-functions. nstars/nk: 10.0
FIT vs input data: Mean Absolute Error= 4.885e-11 (meV)
Interpolation completed in 0.072 (s)
Found 24 symmetries in point group
rmax [13 13 13] msize: 19683
gen points 0.24494242668151855
nshells 1386
shells 0.011464834213256836
stars 1.1547348499298096
r2max [ 9 -8 2]
end 0.0022423267364501953
Using: 190 star-functions. nstars/nk: 10.0
FIT vs input data: Mean Absolute Error= 2.195e-12 (meV)
Interpolation completed in 0.071 (s)
Traceback (most recent call last):
File "plot-excitondb.py", line 66, in <module>
yexc.plot_exciton_2D_ax(ax,states,mode='hexagon',limfactor=0.8,scale= 600)
File "/home/may0d/Codes/Miniconda3/envs/deepmd/lib/python3.8/site-packages/yambopy/dbs/excitondb.py", line 822, in plot_exciton_2D_ax
File "/home/may0d/Codes/Miniconda3/envs/deepmd/lib/python3.8/site-packages/yambopy/plot/plotting.py", line 52, in BZ_Wigner_Seitz
if lat_type[:3]=='Hex': return BZ_hexagon(lattice.rlat,center=center,orientation=orientation,color=color,linewidth=linewidth)
TypeError: 'NoneType' object is not subscriptable

could you please tell me how can I resolve this issue? It seems like nothing generated.

This is the content of my script:
#from __future__ import print_function, division
from qepy import *
from yambopy import *
import matplotlib.pyplot as plt
import os

npoints = 20

fig = plt.figure(figsize=(4,6))
ax = fig.add_axes( [ 0.15, 0.15, 0.80, 0.80 ])

# Define path in reduced coordinates using Class Path

path = Path([ [[ 0.0, 0.0, 0.0],'\$\Gamma\$'],
[[ 0.5, 0.0, 0.0],'M'],
[[2./3.,1./3., 0.0],'K'],
[[ 0.0, 0.0, 0.0],'\$\Gamma\$']], [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )

# SAVE database
save = YamboSaveDB.from_db_file(folder='/lustre/scratch/sun/Exciton/SAVE/')

# Lattice information
lat = YamboLatticeDB.from_db_file(filename='/lustre/scratch/sun/Exciton/SAVE/ns.db1')

# Exciton database read from db file
if os.path.isfile('/lustre/scratch/sun/Exciton/all_Bz-BSE-Diagonalization-3-16/ndb.BS_diago_Q01'):
yexc = YamboExcitonDB.from_db_file(lat,filename='ndb.BS_diago_Q01',folder='/lustre/scratch/sun/Exciton/all_Bz-BSE-Diagonalization-3-16/')
if os.path.isfile('/lustre/scratch/sun/Exciton/all_Bz-BSE-Diagonalization-3-16/ndb.BS_diago_Q1'):
yexc = YamboExcitonDB.from_db_file(lat,filename='ndb.BS_diago_Q1',folder='/lustre/scratch/sun/Exciton/all_Bz-BSE-Diagonalization-3-16/')

print("Ground state energy: %lf" % yexc.eigenvalues[0].real )
print("Intensity: %lf" % (yexc.get_intensities()[0].real+yexc.get_intensities()[1].real) )
print("1st-excited state energy: %lf" % yexc.eigenvalues[2].real )
print("Intensity: %lf" % (yexc.get_intensities()[2].real+yexc.get_intensities()[3].real) )

# List of states to be merged
states = [1,2]

# 1. Plot exciton weights in band structure NOT interpolated

exc_bands = yexc.get_exciton_bs(save,path,states,size=1.0)
exc_bands.plot_ax(ax,color_bands='grey',c_weights='red')

plt.show()

# 2. Plot exciton weights in band structure INTERPOLATED

fig = plt.figure(figsize=(4,6))
ax = fig.add_axes( [ 0.15, 0.15, 0.80, 0.80 ])

# In case of problems with the interpolation, try to increase lpratio
exc_bands_inter = yexc.interpolate(save,path,states,lpratio=10,f=None,size=0.5,verbose=True)

exc_bands_inter.plot_ax(ax,color_bands='grey',c_weights='red',alpha_weights=0.5,c_label='\$X_1\$')

plt.show()

# 3. Plot exciton weights in a 2D map of the BZ

fig = plt.figure(figsize=(4,4))
ax = fig.add_axes( [ 0.15, 0.15, 0.80, 0.80 ])

yexc.plot_exciton_2D_ax(ax,states,mode='hexagon',limfactor=0.8,scale= 600)

plt.show()

In addition, I only find ndb.BS_diago_Q1 in my folder and didn't find ndb.BS_diago_Q01.
Thank you.

Best,
Sun
Dr. Minglei Sun
Rice University, Houston, TX, United States

palful
Posts: 62
Joined: Tue Jan 26, 2016 11:23 am
Location: Modena and Milan

### Re: questions on the using of plot-excitondb.py

Dear Sun,

May I ask you to add a signature in your profile settings with your name and affiliation? It is a rule of the forum.

Coming to your question. Which lattice type ('ibrav') are you setting in your quantum espresso calculation? Is it ibrav=0 by any chance?

Fulvio
Dr. Fulvio Paleari
S3-CNR Institute of Nanoscience and MaX Center
Modena, Italy

sun
Posts: 3
Joined: Fri Apr 12, 2024 9:22 pm
Location: Rice University, Houston, TX, United States
Contact:

### Re: questions on the using of plot-excitondb.py

palful wrote: Wed Apr 17, 2024 4:05 pm Dear Sun,

May I ask you to add a signature in your profile settings with your name and affiliation? It is a rule of the forum.

Coming to your question. Which lattice type ('ibrav') are you setting in your quantum espresso calculation? Is it ibrav=0 by any chance?

Fulvio
Dear Fulvio,

Thanks for the reply. I have changed the profile according to your request per the rule of the forum.

Indeed, I used ibrav = 0 in QE calculations, is that the reason?
Thank you.

Best,
Sun
Dr. Minglei Sun
Rice University, Houston, TX, United States

palful
Posts: 62
Joined: Tue Jan 26, 2016 11:23 am
Location: Modena and Milan

### Re: questions on the using of plot-excitondb.py

Dear Sun,

Yes, it was a small bug related to the fact that the code expected the lattice type descriptor to always be a string, but in the case of ibrav=0 it was mistakenly set to None.

I made a small patch that should solve the problem, you should reinstall yambopy following the instruction for installation from the latest patch.

Don't hesitate to let me know if the issue persists.

Cheers,
Fulvio
Dr. Fulvio Paleari
S3-CNR Institute of Nanoscience and MaX Center
Modena, Italy

sun
Posts: 3
Joined: Fri Apr 12, 2024 9:22 pm
Location: Rice University, Houston, TX, United States
Contact:

### Re: questions on the using of plot-excitondb.py

Dear Fulvio,

I see. I will have a try. Thank you very much for your great help!

Best,
Minglei

palful wrote: Thu Apr 18, 2024 1:41 pm Dear Sun,

Yes, it was a small bug related to the fact that the code expected the lattice type descriptor to always be a string, but in the case of ibrav=0 it was mistakenly set to None.

I made a small patch that should solve the problem, you should reinstall yambopy following the instruction for installation from the latest patch.

Don't hesitate to let me know if the issue persists.

Cheers,
Fulvio
Dr. Minglei Sun
Rice University, Houston, TX, United States