From e9bfb3ed2c126d76174c2a94250c897e51d01713 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Fri, 7 Sep 2018 15:31:41 +0200 Subject: [PATCH] block_structure: effective_transformation_solver --- python/block_structure.py | 22 ++++++++++++++++++++++ test/blockstructure.py | 26 ++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/python/block_structure.py b/python/block_structure.py index df0cc2e9..c9cb03dd 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -251,6 +251,28 @@ class BlockStructure(object): trans[icrsh][block][iorb, :] = 0.0 return trans + @property + def effective_transformation_solver(self): + eff_trans_sumk = self.effective_transformation_sumk + + ets = [] + for ish in range(len(self.gf_struct_solver)): + icrsh = self.inequiv_to_corr[ish] + ets.append(dict()) + for block in self.gf_struct_solver[ish]: + block_sumk = self.solver_to_sumk_block[ish][block] + T = eff_trans_sumk[icrsh][block_sumk] + ets[ish][block] = np.zeros((len(self.gf_struct_solver[ish][block]), + len(T)), + dtype=T.dtype) + for i in self.gf_struct_solver[ish][block]: + i_sumk = self.solver_to_sumk[ish][block, i] + assert i_sumk[0] == block_sumk,\ + "Wrong block in solver_to_sumk" + i_sumk = i_sumk[1] + ets[ish][block][i, :] = T[i_sumk, :] + return ets + @classmethod def full_structure(cls,gf_struct,corr_to_inequiv): diff --git a/test/blockstructure.py b/test/blockstructure.py index 92f5f3b6..482bd570 100644 --- a/test/blockstructure.py +++ b/test/blockstructure.py @@ -22,6 +22,14 @@ cmp(original_bs.effective_transformation_sumk, 'up': np.array([[1., 0., 0.], [0., 1., 0.], [0., 0., 1.]])}]) +cmp(original_bs.effective_transformation_solver, + [{'up_0': np.array([[1., 0., 0.], + [0., 1., 0.]]), + 'up_1': np.array([[0., 0., 1.]]), + 'down_1': np.array([[0., 0., 1.]]), + 'down_0': np.array([[1., 0., 0.], + [0., 1., 0.]])}]) + # check pick_gf_struct_solver pick1 = original_bs.copy() @@ -34,6 +42,10 @@ cmp(pick1.effective_transformation_sumk, 'up': np.array([[0., 0., 0.], [0., 1., 0.], [0., 0., 1.]])}]) +cmp(pick1.effective_transformation_solver, + [{'up_0': np.array([[0., 1., 0.]]), + 'up_1': np.array([[0., 0., 1.]]), + 'down_1': np.array([[0., 0., 1.]])}]) # check loading a block_structure from file SK.block_structure = SK.load(['block_structure'], 'mod')[0] @@ -56,6 +68,10 @@ cmp(pick1.effective_transformation_sumk, 'up': np.array([[0., 0., 0.], [0., 1., 0.], [0., 0., 1.]])}]) +cmp(pick1.effective_transformation_solver, + [{'up_0': np.array([[0., 1., 0.]]), + 'up_1': np.array([[0., 0., 1.]]), + 'down_1': np.array([[0., 0., 1.]])}]) # check pick_gf_struct_sumk pick2 = original_bs.copy() @@ -68,6 +84,11 @@ cmp(pick2.effective_transformation_sumk, 'up': np.array([[0., 0., 0.], [0., 1., 0.], [0., 0., 1.]])}]) +cmp(pick2.effective_transformation_solver, + [{'up_0': np.array([[0., 1., 0.]]), + 'up_1': np.array([[0., 0., 1.]]), + 'down_0': np.array([[1., 0., 0.], + [0., 1., 0.]])}]) pick3 = pick2.copy() pick3.transformation = [np.reshape(range(9), (3, 3))] @@ -78,6 +99,11 @@ cmp(pick3.effective_transformation_sumk, 'up': np.array([[0, 0, 0], [3, 4, 5], [6, 7, 8]])}]) +cmp(pick3.effective_transformation_solver, + [{'up_0': np.array([[3, 4, 5]]), + 'up_1': np.array([[6, 7, 8]]), + 'down_0': np.array([[0, 1, 2], + [3, 4, 5]])}]) # check map_gf_struct_solver mapping = [{('down_0', 0): ('down', 0),