3
0
mirror of https://github.com/triqs/dft_tools synced 2024-06-01 02:45:33 +02:00

Consolidate rotloc and rotloc_all

This commit is contained in:
Priyanka Seth 2015-01-08 13:26:25 +01:00
parent aaa97f3d26
commit da89062592
2 changed files with 17 additions and 38 deletions

View File

@ -208,29 +208,34 @@ class SumkDFT:
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.
direction: 'toLocal' / 'toGlobal' """
assert ((direction == 'toLocal') or (direction == 'toGlobal')),"rotloc: Give direction 'toLocal' or 'toGlobal'."
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 (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.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:
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':
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.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:
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
@ -342,7 +347,7 @@ class SumkDFT:
# rotation from local to global coordinate system:
if self.use_rotations:
for icrsh in range(self.n_corr_shells):
for bname,gf in SK_Sigma_imp[icrsh]: gf << self.rotloc(icrsh, gf, direction = 'toGlobal')
for bname,gf in SK_Sigma_imp[icrsh]: gf << self.rotloc(icrsh,gf,direction='toGlobal')
def extract_G_loc(self, mu = None, with_Sigma = True):
@ -379,7 +384,7 @@ class SumkDFT:
# Gloc is rotated to the local coordinate system:
if self.use_rotations:
for icrsh in range(self.n_corr_shells):
for bname,gf in Gloc[icrsh]: Gloc[icrsh][bname] << self.rotloc(icrsh,gf,direction = 'toLocal')
for bname,gf in Gloc[icrsh]: Gloc[icrsh][bname] << self.rotloc(icrsh,gf,direction='toLocal')
# transform to CTQMC blocks:
Gloc_inequiv = [ BlockGf( name_block_generator = [ (block,GfImFreq(indices = inner, mesh = Gloc[0].mesh)) for block,inner in self.gf_struct_solver[ish].iteritems() ],

View File

@ -40,32 +40,6 @@ class SumkDFTTools(SumkDFT):
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):
@ -218,7 +192,7 @@ class SumkDFTTools(SumkDFT):
# rotation to local coord. system:
if self.use_rotations:
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 bname,gf in Gproj[ish]:
@ -467,7 +441,7 @@ class SumkDFTTools(SumkDFT):
# Rotation to local:
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
for bname,gf in Gproj[ish]: #dmg.append(Gproj[ish].density()[bname])