def set(self,matrix):
'''
Set the basis.
Parameters
----------
matrix : callable
The function to get the single particle matrix.
'''
Eup,Uup,Edw,Udw=[],[],[],[]
for k in [()] if self.BZ is None else self.BZ.mesh('k'):
m=matrix(k)
es,us=sl.eigh(m[:m.shape[0]/2,:m.shape[0]/2])
Edw.append(es)
Udw.append(us)
es,us=sl.eigh(m[m.shape[0]/2:,m.shape[0]/2:])
Eup.append(es)
Uup.append(us)
Eup,Uup=np.asarray(Eup),np.asarray(Uup).transpose((1,0,2))
Edw,Udw=np.asarray(Edw),np.asarray(Udw).transpose((1,0,2))
if self.polarization=='up':
self._E1_=Edw
self._E2_=Eup
self._U1_=Udw
self._U2_=Uup
else:
self._E1_=Eup
self._E2_=Edw
self._U1_=Uup
self._U2_=Udw
评论列表
文章目录