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
excitonic weigths on top of the band structure
Moderators: palful, amolina, mbonacci
-
- Posts: 30
- Joined: Thu Jun 18, 2020 1:38 pm
excitonic weigths on top of the band structure
RongTianPang, Inner Mongolia University, Hohhot, China 

- palful
- Posts: 93
- Joined: Tue Jan 26, 2016 11:23 am
- Location: Modena and Milan
Re: excitonic weigths on top of the band structure
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
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
Dr. Fulvio Paleari
S3-CNR Institute of Nanoscience and MaX Center
Modena, Italy
S3-CNR Institute of Nanoscience and MaX Center
Modena, Italy
-
- Posts: 102
- Joined: Fri Mar 26, 2021 11:27 am
Re: excitonic weigths on top of the band structure
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
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
Quxiao in BIT,calculate the exciton
-
- Posts: 71
- Joined: Sat Jun 06, 2020 10:43 am
Re: excitonic weigths on top of the band structure
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
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
-----------------------------------------------------
Assistant Professor
Polytech - Paris-Saclay University
C2N, CNRS
10 Bd Thomas Gobert
91120 Palaiseau
Assistant Professor
Polytech - Paris-Saclay University
C2N, CNRS
10 Bd Thomas Gobert
91120 Palaiseau
- palful
- Posts: 93
- Joined: Tue Jan 26, 2016 11:23 am
- Location: Modena and Milan
Re: excitonic weigths on top of the band structure
Dear Davide,
The script you used, which is written just for the tutorial, uses by default the Kohn-Sham energies that are read by And in fact when you plot the save object is an argument:
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:
Now you can try to redo the exciton plot passing yqp as an argument instead of save.
Cheers,
Fulvio
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')
Code: Select all
exc_bands = yexc.get_exciton_bs(save,path,states,size=0.1)
Code: Select all
yqp = YamboQPDB.from_db(filename='ndb.QP')
Cheers,
Fulvio
Dr. Fulvio Paleari
S3-CNR Institute of Nanoscience and MaX Center
Modena, Italy
S3-CNR Institute of Nanoscience and MaX Center
Modena, Italy
-
- Posts: 71
- Joined: Sat Jun 06, 2020 10:43 am
Re: excitonic weigths on top of the band structure
Dear Fulvio,
Thanks a lot for your clarification! I thought that it automatically loaded the QP databases present in SAVE
Best,
Davide
Thanks a lot for your clarification! I thought that it automatically loaded the QP databases present in SAVE
Best,
Davide
-----------------------------------------------------
Assistant Professor
Polytech - Paris-Saclay University
C2N, CNRS
10 Bd Thomas Gobert
91120 Palaiseau
Assistant Professor
Polytech - Paris-Saclay University
C2N, CNRS
10 Bd Thomas Gobert
91120 Palaiseau