Page 1 of 1
					
				excitonic weigths on top of the band structure
				Posted: Sat Apr 17, 2021 2:20 pm
				by pangrt
				Dear all,
I am trying the tutorial to calculate excitonic weigths on top of the band structure.Through <python3 plot-excitondb.py>, I got the band structure with exciton weight. I want to know how I can get the original data of this picture. 
Thanks!
Pangrt
			 
			
					
				Re: excitonic weigths on top of the band structure
				Posted: Thu Apr 22, 2021 1:49 pm
				by palful
				Dear Pangrt,
The scripts uses kpoint coordinates in the BZ, band energies, and exciton weights.
All these quantities are accessible in their raw format either via yambopy or directly via yambo. 
Yambopy: 
- kpoint coordinates are accessible via the 
YamboLatticeDB object (instanced as in the 
plot-excitondb script). For example, if 
ylat is the name of the object, then the kpt Cartesian coordinates are given by the attribute 
ylat.car_kpoints.
- dft eigenvalues are accessible via the 
YamboSaveDB object (instanced as in the 
plot-excitondb script). For example, if 
ysave is the name of the object, then the eigenvalues are given by the attribute 
ysave.eigenvalues.
- excitonic weights are accessible via the 
YamboExcitonDB object (instanced as in the 
plot-excitondb script). For example, if 
yexc is the name of the object, then the <kvc|exc> coefficients are given by the attribute 
yexc.eigenvectors, and the transition table to connect kvc indices to exc indices by 
yexc.table.
Yambo
- kpoint coordinates and band energies are readable from the yambo outputs and report, as well as directly from the netcdf database 
SAVE/ns.db1.
- excitonic weights are accessible by using 
ypp -e a as explained for example 
here (they are also stored the netcdf databases 
ndb.BS_diago_*).
Just the x,y data in the plots
If you are interested in just the data in the form in which they are plotted by the 
plot-excitondb script, I suggest the following: in order to perform the plot of the excitonic weights on top of the band structure, 
plot-excitondb calls the function 
plot_ax which is in 
yambopy/yambopy/plot/bandstructure.py at line 166. Here, you can edit the code so that it prints the x, y and weights axes.
I hope this helps.
Cheers,
Fulvio
 
			
					
				Re: excitonic weigths on top of the band structure
				Posted: Mon May 24, 2021 9:03 am
				by Quxiao
				Dear Palful:
        I  read  that method you proposed,at the end of the reply,you mentioned that I could edit the code to print the x,y and weights axes,I try to print that by adding a line:print (x) after the 184 line in bandstructure.py.In my  opion,when I run the plot-excitondb.py,that could Call the plot_ax in the bandstructure.py,then print the x,however,it is not appear,so I am confused about that. I could not see these files like the YamboSAVEDB,and just a liittle Programming ability ,Could you give me some advise to explain that?or Could you teach me how to edit the code in bandstructure.py? Thank you very much! 
                                                                                                                                                                                                                                                                                                                                                                                                                      Quxiao
			 
			
					
				Re: excitonic weigths on top of the band structure
				Posted: Wed Nov 03, 2021 3:17 pm
				by DavidPolito93
				Dear All,
I have followed the bn tutorial in order to obtain the excitonic weight on top of the bandstructure for my material. 
However the electronic bandstructure that is plotted is the DFT one, which doesn't take into account the GW corrections to the QP eigenvalues.
Here's the script:
#from __future__ import print_function, division
from qepy import *
from yambopy import *
import matplotlib.pyplot as plt
import os
interpolate = False
npoints = 51
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']], [int(npoints),1,1] )
# SAVE database
save = YamboSaveDB.from_db_file(folder='./SAVE')
# Lattice information
lat  = YamboLatticeDB.from_db_file(filename='SAVE/ns.db1')
# Exciton database read from db file
yexc = YamboExcitonDB.from_db_file(lat,filename='ndb.BS_diago_Q1',folder='./')
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 = [2]
# 1. Plot exciton weights in band structure NOT interpolated
exc_bands = yexc.get_exciton_bs(save,path,states,size=0.1)
exc_bands.plot_ax(ax,color_bands='black',c_weights='red')
plt.show()
Am I forgetting somethin?
Best,
Davide Romanin
			 
			
					
				Re: excitonic weigths on top of the band structure
				Posted: Wed Nov 03, 2021 7:15 pm
				by palful
				Dear Davide,
The script you used, which is written just for the tutorial, uses by default the Kohn-Sham energies that are read by 
Code: Select all
save = YamboSaveDB.from_db_file(folder='./SAVE')
 And in fact when you plot the 
save object is an argument: 
Code: Select all
exc_bands = yexc.get_exciton_bs(save,path,states,size=0.1)
Now, aside from this specific tutorial, this script should be modified by the user in order to adapt it to the specific case of interest. In your case, you can for example read the quasiparticle database using the 
YamboQPDB class: 
Code: Select all
yqp = YamboQPDB.from_db(filename='ndb.QP')
Now you can try to redo the exciton plot passing 
yqp as an argument instead of 
save.
Cheers,
Fulvio
 
			
					
				Re: excitonic weigths on top of the band structure
				Posted: Thu Nov 04, 2021 10:48 am
				by DavidPolito93
				Dear Fulvio,
Thanks a lot for your clarification! I thought that it automatically loaded the QP databases present in SAVE
Best,
Davide