Can you introduce that in case the linear optical absorption was calculated using "yambo -o c" with “nspin=2” in quantum espresso, how can I got the dipole matrix element corresponding to SPIN UP and SPIN DOWN transition?
My question comes from the error I met during running the following code
Code: Select all
ylat = YamboLatticeDB.from_db_file(filename='./SAVE/ns.db1')
ydip = YamboDipolesDB(ylat,save="./SAVE/",filename='ndb.dipoles')
yel = YamboElectronsDB(ylat,save='./SAVE/')
320 is the value of nbnd I set in the quantum espresso.File ~/software/miniconda3/envs/pynotebook/lib/python3.12/site-packages/yambopy-1-py3.12.egg/yambopy/dbs/dipolesdb.py:193, in YamboDipolesDB.expandDipoles(self, dipoles, field_dir, field_dir3)
189 tra = np.dot(pro,sym)
191 for c,v in product(list(range(self.nbandsc)),list(range(self.nbandsv))):
192 #rotate dipoles
--> 193 self.dipoles[nk_fbz,:,indexc+c,indexv+v] = np.dot(tra,dip[:,c,v])
195 #make hermitian
196 for c,v in product(list(range(self.nbandsc)),list(range(self.nbandsv))):
ValueError: shapes (3,3) and (320,2) not aligned: 3 (dim 1) != 320 (dim 0)
In this post (viewtopic.php?t=1214) it is said that
However, I found that the dipoledb.py in yambopy seems to have only 5 index, and the real and imaginary part was the last index:in the new ndb.dipoles the matrix elements DIP(3)_cvk sigma are stored with the indexes running as follow
(first index run faster):
a) real, imaginary part
b) cartesian index (xyz)
c) conduction band index
d) valence band index
e) k-point index (if you fragment this index goes into the fragment index)
f) if n_sp_pol>1, spin index (if you fragment this index goes into the fragment index)
Code: Select all
dip = (dip[:,:,:,:,0]+1j*dip[:,:,:,:,1]) # Read as nk,nv,nc,it
Huang
--------
Tongji University, PR China