mirror of
https://github.com/triqs/dft_tools
synced 2024-08-30 07:43:40 +02:00
Consolidate rotloc and rotloc_all
This commit is contained in:
parent
aaa97f3d26
commit
da89062592
@ -208,29 +208,34 @@ class SumkDFT:
|
|||||||
return gf_upfolded
|
return gf_upfolded
|
||||||
|
|
||||||
|
|
||||||
def rotloc(self,icrsh,gf_to_rotate,direction):
|
def rotloc(self,ish,gf_to_rotate,direction,shells='corr'):
|
||||||
"""Local <-> Global rotation of a GF block.
|
"""Local <-> Global rotation of a GF block.
|
||||||
direction: 'toLocal' / 'toGlobal' """
|
direction: 'toLocal' / 'toGlobal' """
|
||||||
|
|
||||||
assert ((direction == 'toLocal') or (direction == 'toGlobal')),"rotloc: Give direction 'toLocal' or 'toGlobal'."
|
assert ((direction == 'toLocal') or (direction == 'toGlobal')),"rotloc: Give direction 'toLocal' or 'toGlobal'."
|
||||||
|
|
||||||
gf_rotated = gf_to_rotate.copy()
|
gf_rotated = gf_to_rotate.copy()
|
||||||
|
if shells == 'corr':
|
||||||
|
rot_mat_time_inv = self.rot_mat_time_inv
|
||||||
|
rot_mat = self.rot_mat
|
||||||
|
elif shells == 'all':
|
||||||
|
rot_mat_time_inv = self.rot_mat_all_time_inv
|
||||||
|
rot_mat = self.rot_mat_all
|
||||||
|
|
||||||
if direction == 'toGlobal':
|
if direction == 'toGlobal':
|
||||||
|
|
||||||
if (self.rot_mat_time_inv[icrsh] == 1) and self.SO:
|
if (rot_mat_time_inv[ish] == 1) and self.SO:
|
||||||
gf_rotated << gf_rotated.transpose()
|
gf_rotated << gf_rotated.transpose()
|
||||||
gf_rotated.from_L_G_R(self.rot_mat[icrsh].conjugate(),gf_rotated,self.rot_mat[icrsh].transpose())
|
gf_rotated.from_L_G_R(rot_mat[ish].conjugate(),gf_rotated,rot_mat[ish].transpose())
|
||||||
else:
|
else:
|
||||||
gf_rotated.from_L_G_R(self.rot_mat[icrsh],gf_rotated,self.rot_mat[icrsh].conjugate().transpose())
|
gf_rotated.from_L_G_R(rot_mat[ish],gf_rotated,rot_mat[ish].conjugate().transpose())
|
||||||
|
|
||||||
elif direction == 'toLocal':
|
elif direction == 'toLocal':
|
||||||
|
|
||||||
if (self.rot_mat_time_inv[icrsh] == 1) and self.SO:
|
if (rot_mat_time_inv[ish] == 1) and self.SO:
|
||||||
gf_rotated << gf_rotated.transpose()
|
gf_rotated << gf_rotated.transpose()
|
||||||
gf_rotated.from_L_G_R(self.rot_mat[icrsh].transpose(),gf_rotated,self.rot_mat[icrsh].conjugate())
|
gf_rotated.from_L_G_R(rot_mat[ish].transpose(),gf_rotated,rot_mat[ish].conjugate())
|
||||||
else:
|
else:
|
||||||
gf_rotated.from_L_G_R(self.rot_mat[icrsh].conjugate().transpose(),gf_rotated,self.rot_mat[icrsh])
|
gf_rotated.from_L_G_R(rot_mat[ish].conjugate().transpose(),gf_rotated,rot_mat[ish])
|
||||||
|
|
||||||
return gf_rotated
|
return gf_rotated
|
||||||
|
|
||||||
|
@ -40,32 +40,6 @@ class SumkDFTTools(SumkDFT):
|
|||||||
symmpar_data=symmpar_data, bands_data=bands_data, transp_data=transp_data)
|
symmpar_data=symmpar_data, bands_data=bands_data, transp_data=transp_data)
|
||||||
|
|
||||||
|
|
||||||
def rotloc_all(self,ish,gf_to_rotate,direction):
|
|
||||||
"""Local <-> Global rotation of a GF block.
|
|
||||||
direction: 'toLocal' / 'toGlobal' """
|
|
||||||
|
|
||||||
assert (direction == 'toLocal' or direction == 'toGlobal'),"rotloc_all: Give direction 'toLocal' or 'toGlobal'."
|
|
||||||
|
|
||||||
|
|
||||||
gf_rotated = gf_to_rotate.copy()
|
|
||||||
if direction == 'toGlobal':
|
|
||||||
if (self.rot_mat_all_time_inv[ish] == 1) and self.SO:
|
|
||||||
gf_rotated << gf_rotated.transpose()
|
|
||||||
gf_rotated.from_L_G_R(self.rot_mat_all[ish].conjugate(),gf_rotated,self.rot_mat_all[ish].transpose())
|
|
||||||
else:
|
|
||||||
gf_rotated.from_L_G_R(self.rot_mat_all[ish],gf_rotated,self.rot_mat_all[ish].conjugate().transpose())
|
|
||||||
|
|
||||||
elif direction == 'toLocal':
|
|
||||||
if (self.rot_mat_all_time_inv[ish] == 1) and self.SO:
|
|
||||||
gf_rotated << gf_rotated.transpose()
|
|
||||||
gf_rotated.from_L_G_R(self.rot_mat_all[ish].transpose(),gf_rotated,self.rot_mat_all[ish].conjugate())
|
|
||||||
else:
|
|
||||||
gf_rotated.from_L_G_R(self.rot_mat_all[ish].conjugate().transpose(),gf_rotated,self.rot_mat_all[ish])
|
|
||||||
|
|
||||||
|
|
||||||
return gf_rotated
|
|
||||||
|
|
||||||
|
|
||||||
def check_input_dos(self, om_min, om_max, n_om, beta=10, broadening=0.01):
|
def check_input_dos(self, om_min, om_max, n_om, beta=10, broadening=0.01):
|
||||||
|
|
||||||
|
|
||||||
@ -218,7 +192,7 @@ class SumkDFTTools(SumkDFT):
|
|||||||
# rotation to local coord. system:
|
# rotation to local coord. system:
|
||||||
if self.use_rotations:
|
if self.use_rotations:
|
||||||
for ish in range(self.n_shells):
|
for ish in range(self.n_shells):
|
||||||
for bname,gf in Gproj[ish]: Gproj[ish][bname] << self.rotloc_all(ish,gf,direction='toLocal')
|
for bname,gf in Gproj[ish]: Gproj[ish][bname] << self.rotloc(ish,gf,direction='toLocal',shells='all')
|
||||||
|
|
||||||
for ish in range(self.n_shells):
|
for ish in range(self.n_shells):
|
||||||
for bname,gf in Gproj[ish]:
|
for bname,gf in Gproj[ish]:
|
||||||
@ -467,7 +441,7 @@ class SumkDFTTools(SumkDFT):
|
|||||||
|
|
||||||
# Rotation to local:
|
# Rotation to local:
|
||||||
if self.use_rotations:
|
if self.use_rotations:
|
||||||
for bname,gf in Gproj[ish]: Gproj[ish][bname] << self.rotloc_all(ish,gf,direction='toLocal')
|
for bname,gf in Gproj[ish]: Gproj[ish][bname] << self.rotloc(ish,gf,direction='toLocal',shells='all')
|
||||||
|
|
||||||
isp = 0
|
isp = 0
|
||||||
for bname,gf in Gproj[ish]: #dmg.append(Gproj[ish].density()[bname])
|
for bname,gf in Gproj[ish]: #dmg.append(Gproj[ish].density()[bname])
|
||||||
|
Loading…
Reference in New Issue
Block a user