From da89062592ab18cf67ae8b685e944118f8e84e98 Mon Sep 17 00:00:00 2001 From: Priyanka Seth Date: Thu, 8 Jan 2015 13:26:25 +0100 Subject: [PATCH] Consolidate rotloc and rotloc_all --- python/sumk_dft.py | 25 +++++++++++++++---------- python/sumk_dft_tools.py | 30 ++---------------------------- 2 files changed, 17 insertions(+), 38 deletions(-) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index cb769f82..894e96a9 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -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() ], diff --git a/python/sumk_dft_tools.py b/python/sumk_dft_tools.py index da8e81a0..bbea47dc 100644 --- a/python/sumk_dft_tools.py +++ b/python/sumk_dft_tools.py @@ -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])