Code: Select all
path = Path([ [[ 0.0, 0.0, 0.0],'$\Gamma$'],
[[ 0.5, 0.0, 0.0],'M'],
[[1./3.,1./3., 0.0],'K'],
[[ 0.0, 0.0, 0.0],'$\Gamma$'],
[[ 0.0, 0.0, 0.5],'A'],
[[ 0.5, 0.0, 0.5],'L'],
[[1./3.,1./3., 0.5],'H'],
[[ 0.0, 0.0, 0.5],'A']], [int(npoints*2),int(npoints),int(sqrt(5)*npoints), int(npoints*2),int(npoints),int(sqrt(5)*npoints), int(npoints*2)] )
Code: Select all
"""
Tutorial for YamboExcitonDB.
Plotting exciton wavefunction components in the BZ
EDIT the path below to point to the yambo SAVE folder.
"""
#save_path='BSE_saves/YAMBO_saves'
#bse_path ='BSE_saves/BSE_databases'
save_path='SAVE'
bse_path ='/c13scratch/jagjit/Cs3Bi2X9/yambo/Cs3Bi2I9/BSE_spectra/03_diag/3D_QP_BSE'
from yambopy import *
from qepy import *
import numpy as np
import matplotlib.pyplot as plt
if __name__ == "__main__":
Kspace_Plot = False
Bands_Plot = False
Bands_Plot_Interpolate = True
# Customly chosen Q-point
iQ=0 # 0-> Gamma point, i.e., optical absorption limit
# States to be merged together (because they are degenerate)
#
# You may try the following states:
#
# [1,2], [3,4], [5], [6,7]
#
states = [1,2]
# #
# Start Yambopy part #
# #
# Create "lattice" object by reading the ns.db1 database inside the yambo SAVE
ylat = YamboLatticeDB.from_db_file(filename=save_path+'/ns.db1')
yqp = YamboQPDB.from_db(filename=save_path+'/ndb.QP')
# Read exciton data at Q=iQ
#yexc = YamboExcitonDB.from_db_file(ylat,filename=bse_path+'/ndb.BS_diago_Q1')
yexc = YamboExcitonDB.from_db_file(ylat,filename=bse_path+'/ndb.BS_diago_Q1')
# Plot of exciton weights in k-space
if Kspace_Plot:
fig = plt.figure(figsize=(6,6))
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= 320)
plt.show()
k_space = 'k_space.pdf'
plt.savefig(k_space)
# Plot on top of the band structure
## [1.] Define path in crystal coordinates using class Path
npoints = 50
# path = Path([ [[ 0.0, 0.0, 0.0],'$\Gamma$'],
# [[ 0.5, 0.0, 0.0],'M'],
# [[1./3.,1./3., 0.0],'K'],
# [[ 0.0, 0.0, 0.0],'$\Gamma$']],
# [int(npoints*2),int(npoints),int(sqrt(5)*npoints)] )
path = Path([ [[ 0.0, 0.0, 0.0],'$\Gamma$'],
[[ 0.5, 0.0, 0.0],'M'],
[[1./3.,1./3., 0.0],'K'],
[[ 0.0, 0.0, 0.0],'$\Gamma$'],
[[ 0.0, 0.0, 0.5],'A'],
[[ 0.5, 0.0, 0.5],'L'],
[[1./3.,1./3., 0.5],'H'],
[[ 0.0, 0.0, 0.5],'A']], [int(npoints*2),int(npoints),int(sqrt(5)*npoints), int(npoints*2),int(npoints),int(sqrt(5)*npoints), int(npoints*2)] )
## [2.] Read electron energies
#yel = YamboSaveDB.from_db_file(folder=save_path+'/SAVE')
yqp = YamboQPDB.from_db(filename='ndb.QP',folder=save_path)
## [3.A] Plot without interpolating the values
if Bands_Plot:
fig = plt.figure(figsize=(4,6))
ax = fig.add_axes( [ 0.15, 0.15, 0.80, 0.80 ])
#exc_on_bands = yexc.get_exciton_bs(yqp,path,states,size=1.0)
exc_bands = yexc.get_exciton_bs(yqp,path,states,size=1.0)
#exc_on_bands.plot_ax(ax,color_bands='grey',c_weights='red')
exc_bands.plot_ax(ax,color_bands='grey',c_weights='red')
ax.set_ylim(-1.,7.)
plt.show()
bs_nint = 'bs_nint.pdf'
plt.savefig(bs_nint)
## [3.B] Interpolate the values
if Bands_Plot_Interpolate:
#yel.eigenvalues += -3.5+yel.get_fermi() # double back-shift correcting interpolate error
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_on_bands = yexc.interpolate(yqp,path,states,lpratio=10,f=None,size=0.5,verbose=True)
#exc_on_bands.plot_ax(ax,c_bands='black',c_weights='red',alpha_weights=0.5)
exc_bands = yexc.interpolate(yqp,path,states,f=None,size=0.5,verbose=True)
exc_bands.plot_ax(ax,c_bands='black',c_weights='red',alpha_weights=0.5)
ax.set_ylim(-8,8)
plt.show()
band = 'band_int.pdf'
plt.savefig(band, bbox_inches='tight')
# #
# End Yambopy part #
# #