From 6c908e9c6e7f29179f8f8895afc0cf4f03a76ae7 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Wed, 29 Aug 2018 11:29:46 +0200 Subject: [PATCH 01/35] block_structure: add check_gf method --- python/block_structure.py | 40 ++++++++++++++++++++++++ test/blockstructure.py | 65 ++++++++++++++++++++------------------- 2 files changed, 74 insertions(+), 31 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index f1501409..21f8e790 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -281,6 +281,46 @@ class BlockStructure(object): G = BlockGf(name_list = names, block_list = blocks) return G + def check_gf(self, G, ish=None): + """ check whether the Green's function G has the right structure + This throws an error if the structure of G is not the same + as ``gf_struct_solver``. + + Parameters + ---------- + G : BlockGf or list of BlockGf + Green's function to check + if it is a list, there should be as many entries as there + are shells, and the check is performed for all shells (unless + ish is given). + ish : int + shell index + default: 0 if G is just one Green's function is given, + check all if list of Green's functions is given + """ + + if isinstance(G, list): + assert len(G) == len(self.gf_struct_solver),\ + "list of G does not have the correct length" + if ish is None: + ishs = range(len(self.gf_struct_solver)) + else: + ishs = [ish] + for ish in ishs: + self.check_gf(G[ish], ish=ish) + return + + if ish is None: + ish = 0 + + for block in self.gf_struct_solver[ish]: + assert block in G.indices,\ + "block " + block + " not in G (shell {})".format(ish) + for block, gf in G: + assert block in self.gf_struct_solver[ish],\ + "block " + block + " not in struct (shell {})".format(ish) + assert list(gf.indices) == 2 * [map(str, self.gf_struct_solver[ish][block])],\ + "block " + block + " has wrong indices (shell {})".format(ish) def convert_gf(self,G,G_struct,ish=0,show_warnings=True,**kwargs): """ Convert BlockGf from its structure to this structure. diff --git a/test/blockstructure.py b/test/blockstructure.py index f7a68e5b..0123a141 100644 --- a/test/blockstructure.py +++ b/test/blockstructure.py @@ -4,7 +4,7 @@ from pytriqs.gf import * from pytriqs.utility.comparison_tests import assert_block_gfs_are_close from triqs_dft_tools.block_structure import BlockStructure -SK = SumkDFT('blockstructure.in.h5',use_dft_blocks=True) +SK = SumkDFT('blockstructure.in.h5', use_dft_blocks=True) original_bs = SK.block_structure @@ -13,56 +13,59 @@ pick1 = original_bs.copy() pick1.pick_gf_struct_solver([{'up_0': [1], 'up_1': [0], 'down_1': [0]}]) # check loading a block_structure from file -SK.block_structure = SK.load(['block_structure'],'mod')[0] +SK.block_structure = SK.load(['block_structure'], 'mod')[0] assert SK.block_structure == pick1, 'loading SK block structure from file failed' # check SumkDFT backward compatibility -sk_pick1 = BlockStructure(gf_struct_sumk = SK.gf_struct_sumk, - gf_struct_solver = SK.gf_struct_solver, - solver_to_sumk = SK.solver_to_sumk, - sumk_to_solver = SK.sumk_to_solver, - solver_to_sumk_block = SK.solver_to_sumk_block, - deg_shells = SK.deg_shells) +sk_pick1 = BlockStructure(gf_struct_sumk=SK.gf_struct_sumk, + gf_struct_solver=SK.gf_struct_solver, + solver_to_sumk=SK.solver_to_sumk, + sumk_to_solver=SK.sumk_to_solver, + solver_to_sumk_block=SK.solver_to_sumk_block, + deg_shells=SK.deg_shells) assert sk_pick1 == pick1, 'constructing block structure from SumkDFT properties failed' # check pick_gf_struct_sumk pick2 = original_bs.copy() -pick2.pick_gf_struct_sumk([{'up': [1, 2], 'down': [0,1]}]) +pick2.pick_gf_struct_sumk([{'up': [1, 2], 'down': [0, 1]}]) # check map_gf_struct_solver -mapping = [{ ('down_0', 0):('down', 0), - ('down_0', 1):('down', 2), - ('down_1', 0):('down', 1), - ('up_0', 0) :('down_1', 0), - ('up_0', 1) :('up_0', 0) }] +mapping = [{('down_0', 0): ('down', 0), + ('down_0', 1): ('down', 2), + ('down_1', 0): ('down', 1), + ('up_0', 0): ('down_1', 0), + ('up_0', 1): ('up_0', 0)}] map1 = original_bs.copy() map1.map_gf_struct_solver(mapping) # check create_gf -G1 = original_bs.create_gf(beta=40,n_points=3) +G1 = original_bs.create_gf(beta=40, n_points=3) i = 1 -for block,gf in G1: +for block, gf in G1: gf << SemiCircular(i) - i+=1 + i += 1 +original_bs.check_gf(G1) +original_bs.check_gf([G1]) # check approximate_as_diagonal offd = original_bs.copy() offd.approximate_as_diagonal() # check map_gf_struct_solver -G2 = map1.convert_gf(G1,original_bs,beta=40,n_points=3,show_warnings=False) +G2 = map1.convert_gf(G1, original_bs, beta=40, n_points=3, show_warnings=False) # check full_structure -full = BlockStructure.full_structure([{'up_0': [0, 1], 'up_1': [0], 'down_1': [0], 'down_0': [0, 1]}],None) +full = BlockStructure.full_structure( + [{'up_0': [0, 1], 'up_1': [0], 'down_1': [0], 'down_0': [0, 1]}], None) # check __eq__ -assert full==full, 'equality not correct (equal structures not equal)' -assert pick1==pick1, 'equality not correct (equal structures not equal)' -assert pick1!=pick2, 'equality not correct (different structures not different)' -assert original_bs!=offd, 'equality not correct (different structures not different)' +assert full == full, 'equality not correct (equal structures not equal)' +assert pick1 == pick1, 'equality not correct (equal structures not equal)' +assert pick1 != pick2, 'equality not correct (different structures not different)' +assert original_bs != offd, 'equality not correct (different structures not different)' if mpi.is_master_node(): - with HDFArchive('blockstructure.out.h5','w') as ar: + with HDFArchive('blockstructure.out.h5', 'w') as ar: ar['original_bs'] = original_bs ar['pick1'] = pick1 ar['pick2'] = pick2 @@ -75,10 +78,10 @@ if mpi.is_master_node(): # cannot use h5diff because BlockStructure testing is not implemented # there (and seems difficult to implement because it would mix triqs # and dft_tools) - with HDFArchive('blockstructure.out.h5','r') as ar,\ - HDFArchive('blockstructure.ref.h5','r') as ar2: - for k in ar2: - if isinstance(ar[k],BlockGf): - assert_block_gfs_are_close(ar[k],ar2[k],1.e-6) - else: - assert ar[k]==ar2[k], '{} not equal'.format(k) + with HDFArchive('blockstructure.out.h5', 'r') as ar,\ + HDFArchive('blockstructure.ref.h5', 'r') as ar2: + for k in ar2: + if isinstance(ar[k], BlockGf): + assert_block_gfs_are_close(ar[k], ar2[k], 1.e-6) + else: + assert ar[k] == ar2[k], '{} not equal'.format(k) From 2b490d14857c3b00bb0aea6b013fe4a05d8097f4 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Wed, 29 Aug 2018 12:03:14 +0200 Subject: [PATCH 02/35] block_structure: convert_gf: add G_out, let G_struct be sumk --- python/block_structure.py | 63 ++++++++++++++++++++++++++------------- test/blockstructure.py | 13 ++++++-- 2 files changed, 53 insertions(+), 23 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index 21f8e790..0f792d2a 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -283,6 +283,7 @@ class BlockStructure(object): def check_gf(self, G, ish=None): """ check whether the Green's function G has the right structure + This throws an error if the structure of G is not the same as ``gf_struct_solver``. @@ -322,8 +323,9 @@ class BlockStructure(object): assert list(gf.indices) == 2 * [map(str, self.gf_struct_solver[ish][block])],\ "block " + block + " has wrong indices (shell {})".format(ish) - def convert_gf(self,G,G_struct,ish=0,show_warnings=True,**kwargs): - """ Convert BlockGf from its structure to this structure. + def convert_gf(self, G, G_struct, ish=0, show_warnings=True, + G_out=None, **kwargs): + """ Convert BlockGf from its structure to this (solver) structure. .. warning:: @@ -335,8 +337,9 @@ class BlockStructure(object): ---------- G : BlockGf the Gf that should be converted - G_struct : GfStructure - the structure of that G + G_struct : BlockStructure or str + the structure of that G or 'sumk' (then, the structure of + the sumk Green's function of this BlockStructure is used) ish : int shell index show_warnings : bool or float @@ -354,30 +357,50 @@ class BlockStructure(object): warning_threshold = show_warnings show_warnings = True - G_new = self.create_gf(ish=ish,**kwargs) - for block in G_struct.gf_struct_solver[ish].keys(): - for i1 in G_struct.gf_struct_solver[ish][block]: - for i2 in G_struct.gf_struct_solver[ish][block]: - i1_sumk = G_struct.solver_to_sumk[ish][(block,i1)] - i2_sumk = G_struct.solver_to_sumk[ish][(block,i2)] + # we offer the possibility to convert to convert from sumk_dft + from_sumk = False + if isinstance(G_struct, str) and G_struct == 'sumk': + gf_struct_in = {block: indices + for block, indices in self.gf_struct_sumk[ish]} + from_sumk = True + else: + gf_struct_in = G_struct.gf_struct_solver[ish] + + # create a Green's function to hold the result + if G_out is None: + G_out = self.create_gf(ish=ish, **kwargs) + else: + self.check_gf(G_out, ish=ish) + + for block in gf_struct_in.keys(): + for i1 in gf_struct_in[block]: + for i2 in gf_struct_in[block]: + if from_sumk: + i1_sumk = (block, i1) + i2_sumk = (block, i2) + else: + i1_sumk = G_struct.solver_to_sumk[ish][(block, i1)] + i2_sumk = G_struct.solver_to_sumk[ish][(block, i2)] + i1_sol = self.sumk_to_solver[ish][i1_sumk] i2_sol = self.sumk_to_solver[ish][i2_sumk] if i1_sol[0] is None or i2_sol[0] is None: if show_warnings: if mpi.is_master_node(): - warn(('Element {},{} of block {} of G is not present '+ - 'in the new structure').format(i1,i2,block)) + warn(('Element {},{} of block {} of G is not present ' + + 'in the new structure').format(i1, i2, block)) continue - if i1_sol[0]!=i2_sol[0]: - if show_warnings and np.max(np.abs(G[block][i1,i2].data)) > warning_threshold: + if i1_sol[0] != i2_sol[0]: + if (show_warnings and + np.max(np.abs(G[block][i1, i2].data)) > warning_threshold): if mpi.is_master_node(): - warn(('Element {},{} of block {} of G is approximated '+ - 'to zero to match the new structure. Max abs value: {}').format( - i1,i2,block,np.max(np.abs(G[block][i1,i2].data)))) + warn(('Element {},{} of block {} of G is approximated ' + + 'to zero to match the new structure. Max abs value: {}').format( + i1, i2, block, np.max(np.abs(G[block][i1, i2].data)))) continue - G_new[i1_sol[0]][i1_sol[1],i2_sol[1]] = \ - G[block][i1,i2] - return G_new + G_out[i1_sol[0]][i1_sol[1], i2_sol[1]] = \ + G[block][i1, i2] + return G_out def approximate_as_diagonal(self): """ Create a structure for a GF with zero off-diagonal elements. diff --git a/test/blockstructure.py b/test/blockstructure.py index 0123a141..b96f38aa 100644 --- a/test/blockstructure.py +++ b/test/blockstructure.py @@ -40,10 +40,9 @@ map1.map_gf_struct_solver(mapping) # check create_gf G1 = original_bs.create_gf(beta=40, n_points=3) -i = 1 +widths = dict(up_0=1, up_1=2, down_0=4, down_1=3) for block, gf in G1: - gf << SemiCircular(i) - i += 1 + gf << SemiCircular(widths[block]) original_bs.check_gf(G1) original_bs.check_gf([G1]) @@ -58,6 +57,14 @@ G2 = map1.convert_gf(G1, original_bs, beta=40, n_points=3, show_warnings=False) full = BlockStructure.full_structure( [{'up_0': [0, 1], 'up_1': [0], 'down_1': [0], 'down_0': [0, 1]}], None) +G_sumk = BlockGf(mesh=G1.mesh, gf_struct=original_bs.gf_struct_sumk[0]) +for i in range(3): + G_sumk['up'][i, i] << SemiCircular(1 if i < 2 else 2) + G_sumk['down'][i, i] << SemiCircular(4 if i < 2 else 3) +G3 = original_bs.convert_gf(G_sumk, 'sumk', beta=40, n_points=3) +assert_block_gfs_are_close(G1, G3) + + # check __eq__ assert full == full, 'equality not correct (equal structures not equal)' assert pick1 == pick1, 'equality not correct (equal structures not equal)' From f0de5c62b59ad37fcff88fbf3f8d979309476561 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Wed, 29 Aug 2018 19:36:20 +0200 Subject: [PATCH 03/35] block_structure: add gf_struct_***_list and _dict now sumk is given in the list format and solver is given in the dict format --- python/block_structure.py | 84 +++++++++++++++++++++++++++++++++++---- python/sumk_dft.py | 16 ++++++++ test/blockstructure.py | 8 ++++ 3 files changed, 100 insertions(+), 8 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index 0f792d2a..c5f0bf68 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -5,6 +5,7 @@ from ast import literal_eval import pytriqs.utility.mpi as mpi from warnings import warn + class BlockStructure(object): """ Contains information about the Green function structure. @@ -37,12 +38,13 @@ class BlockStructure(object): maps from the solver block to the sumk block for *inequivalent* correlated shell ish """ - def __init__(self,gf_struct_sumk=None, - gf_struct_solver=None, - solver_to_sumk=None, - sumk_to_solver=None, - solver_to_sumk_block=None, - deg_shells=None): + + def __init__(self, gf_struct_sumk=None, + gf_struct_solver=None, + solver_to_sumk=None, + sumk_to_solver=None, + solver_to_sumk_block=None, + deg_shells=None): self.gf_struct_sumk = gf_struct_sumk self.gf_struct_solver = gf_struct_solver self.solver_to_sumk = solver_to_sumk @@ -50,6 +52,73 @@ class BlockStructure(object): self.solver_to_sumk_block = solver_to_sumk_block self.deg_shells = deg_shells + @property + def gf_struct_solver_list(self): + """ The structure of the solver Green's function + + This is returned as a + list (for each shell) + of lists (for each block) + of tuples (block_name, block_indices). + + That is, + ``gf_struct_solver_list[ish][b][0]`` + is the name of the block number ``b`` of shell ``ish``, and + ``gf_struct_solver_list[ish][b][1]`` + is a list of its indices. + + The list for each shell is sorted alphabetically by block name. + """ + # we sort by block name in order to get a reproducible result + return [sorted([(k, v) for k, v in gfs.iteritems()], key=lambda x: x[0]) + for gfs in self.gf_struct_solver] + + @property + def gf_struct_sumk_list(self): + """ The structure of the sumk Green's function + + This is returned as a + list (for each shell) + of lists (for each block) + of tuples (block_name, block_indices) + + That is, + ``gf_struct_sumk_list[ish][b][0]`` + is the name of the block number ``b`` of shell ``ish``, and + ``gf_struct_sumk_list[ish][b][1]`` + is a list of its indices. + """ + return self.gf_struct_sumk + + @property + def gf_struct_solver_dict(self): + """ The structure of the solver Green's function + + This is returned as a + list (for each shell) + of dictionaries. + + That is, + ``gf_struct_solver_dict[ish][bname]`` + is a list of the indices of block ``bname`` of shell ``ish``. + """ + return self.gf_struct_solver + + @property + def gf_struct_sumk_dict(self): + """ The structure of the sumk Green's function + + This is returned as a + list (for each shell) + of dictionaries. + + That is, + ``gf_struct_sumk_dict[ish][bname]`` + is a list of the indices of block ``bname`` of shell ``ish``. + """ + return [{block: indices for block, indices in gfs} + for gfs in self.gf_struct_sumk] + @classmethod def full_structure(cls,gf_struct,corr_to_inequiv): """ Construct structure that maps to itself. @@ -360,8 +429,7 @@ class BlockStructure(object): # we offer the possibility to convert to convert from sumk_dft from_sumk = False if isinstance(G_struct, str) and G_struct == 'sumk': - gf_struct_in = {block: indices - for block, indices in self.gf_struct_sumk[ish]} + gf_struct_in = self.gf_struct_sumk_dict[ish] from_sumk = True else: gf_struct_in = G_struct.gf_struct_solver[ish] diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 825b6b5d..66d7faac 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -2057,3 +2057,19 @@ class SumkDFT(object): def __set_deg_shells(self,value): self.block_structure.deg_shells = value deg_shells = property(__get_deg_shells,__set_deg_shells) + + @property + def gf_struct_solver_list(self): + return self.block_structure.gf_struct_solver_list + + @property + def gf_struct_sumk_list(self): + return self.block_structure.gf_struct_sumk_list + + @property + def gf_struct_solver_dict(self): + return self.block_structure.gf_struct_solver_dict + + @property + def gf_struct_sumk_dict(self): + return self.block_structure.gf_struct_sumk_dict diff --git a/test/blockstructure.py b/test/blockstructure.py index b96f38aa..eac85863 100644 --- a/test/blockstructure.py +++ b/test/blockstructure.py @@ -64,6 +64,14 @@ for i in range(3): G3 = original_bs.convert_gf(G_sumk, 'sumk', beta=40, n_points=3) assert_block_gfs_are_close(G1, G3) +assert original_bs.gf_struct_sumk_list ==\ + [[('up', [0, 1, 2]), ('down', [0, 1, 2])]] +assert original_bs.gf_struct_solver_dict ==\ + [{'up_0': [0, 1], 'up_1': [0], 'down_1': [0], 'down_0': [0, 1]}] +assert original_bs.gf_struct_sumk_dict ==\ + [{'down': [0, 1, 2], 'up': [0, 1, 2]}] +assert original_bs.gf_struct_solver_list ==\ + [[('down_0', [0, 1]), ('down_1', [0]), ('up_0', [0, 1]), ('up_1', [0])]] # check __eq__ assert full == full, 'equality not correct (equal structures not equal)' From d0f0c208650e5e8bc68de0014ca745a24e534498 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Thu, 30 Aug 2018 20:24:21 +0200 Subject: [PATCH 04/35] change isinstance for new TRIQS this fixes test analyse_block_structure_from_gf --- python/sumk_dft.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 66d7faac..5f84a3e5 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -868,7 +868,7 @@ class SumkDFT(object): the output G(tau) or A(w) """ # make a GfImTime from the supplied GfImFreq - if all(isinstance(g_sh._first(), GfImFreq) for g_sh in G): + if all(isinstance(g_sh.mesh, MeshImFreq) for g_sh in G): gf = [BlockGf(name_block_generator = [(name, GfImTime(beta=block.mesh.beta, indices=block.indices,n_points=len(block.mesh)+1)) for name, block in g_sh], make_copies=False) for g_sh in G] @@ -876,15 +876,15 @@ class SumkDFT(object): for name, g in gf[ish]: g.set_from_inverse_fourier(G[ish][name]) # keep a GfImTime from the supplied GfImTime - elif all(isinstance(g_sh._first(), GfImTime) for g_sh in G): + elif all(isinstance(g_sh.mesh, MeshImTime) for g_sh in G): gf = G # make a spectral function from the supplied GfReFreq - elif all(isinstance(g_sh._first(), GfReFreq) for g_sh in G): + elif all(isinstance(g_sh.mesh, MeshReFreq) for g_sh in G): gf = [g_sh.copy() for g_sh in G] for ish in range(len(gf)): for name, g in gf[ish]: g << 1.0j*(g-g.conjugate().transpose())/2.0/numpy.pi - elif all(isinstance(g_sh._first(), GfReTime) for g_sh in G): + elif all(isinstance(g_sh.mesh, MeshReTime) for g_sh in G): def get_delta_from_mesh(mesh): w0 = None for w in mesh: From ef979199af73f2987b9c0a2fe07fb64a53b99174 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Thu, 30 Aug 2018 20:49:12 +0200 Subject: [PATCH 05/35] sumk_dft: split transform_to_solver_blocks from extract_G_loc this is done in a backward-compatible manner --- python/block_structure.py | 28 +++++++++++++++ python/sumk_dft.py | 76 ++++++++++++++++++++++++++++----------- 2 files changed, 83 insertions(+), 21 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index c5f0bf68..2af7dffe 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -1,3 +1,28 @@ + +########################################################################## +# +# TRIQS: a Toolbox for Research in Interacting Quantum Systems +# +# Copyright (C) 2018 by G. J. Kraberger +# Copyright (C) 2018 by Simons Foundation +# Authors: G. J. Kraberger, O. Parcollet +# +# TRIQS is free software: you can redistribute it and/or modify it under the +# terms of the GNU General Public License as published by the Free Software +# Foundation, either version 3 of the License, or (at your option) any later +# version. +# +# TRIQS is distributed in the hope that it will be useful, but WITHOUT ANY +# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS +# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more +# details. +# +# You should have received a copy of the GNU General Public License along with +# TRIQS. If not, see . +# +########################################################################## + + import copy import numpy as np from pytriqs.gf import GfImFreq, BlockGf @@ -417,6 +442,9 @@ class BlockStructure(object): if float, set the threshold for the magnitude of an element about to be thrown away to trigger a warning (default: 1.e-10) + G_out : BlockGf + the output Green's function (if not given, a new one is + created) **kwargs : options passed to the constructor for the new Gf """ diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 5f84a3e5..23b91593 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -3,6 +3,7 @@ # # TRIQS: a Toolbox for Research in Interacting Quantum Systems # +# Copyright (C) 2018 by G. J. Kraberger # Copyright (C) 2011 by M. Aichhorn, L. Pourovskii, V. Vildosola # # TRIQS is free software: you can redistribute it and/or modify it under the @@ -631,29 +632,34 @@ class SumkDFT(object): for bname, gf in SK_Sigma_imp[icrsh]: gf << self.rotloc(icrsh, gf, direction='toGlobal') - def extract_G_loc(self, mu=None, iw_or_w='iw', with_Sigma=True, with_dc=True, broadening=None): + def extract_G_loc(self, mu=None, iw_or_w='iw', with_Sigma=True, with_dc=True, broadening=None, + transform_to_solver_blocks=True): r""" Extracts the local downfolded Green function by the Brillouin-zone integration of the lattice Green's function. Parameters ---------- mu : real, optional - Input chemical potential. If not provided the value of self.chemical_potential is used as mu. + Input chemical potential. If not provided the value of self.chemical_potential is used as mu. with_Sigma : boolean, optional - If True then the local GF is calculated with the self-energy self.Sigma_imp. + If True then the local GF is calculated with the self-energy self.Sigma_imp. with_dc : boolean, optional - If True then the double-counting correction is subtracted from the self-energy in calculating the GF. + If True then the double-counting correction is subtracted from the self-energy in calculating the GF. broadening : float, optional - Imaginary shift for the axis along which the real-axis GF is calculated. - If not provided, broadening will be set to double of the distance between mesh points in 'mesh'. - Only relevant for real-frequency GF. + Imaginary shift for the axis along which the real-axis GF is calculated. + If not provided, broadening will be set to double of the distance between mesh points in 'mesh'. + Only relevant for real-frequency GF. + transform_to_solver_blocks : bool, optional + If True (default), the returned G_loc will be transformed to the block structure ``gf_struct_solver``, + else it will be in ``gf_struct_sumk``. Returns ------- - G_loc_inequiv : list of BlockGf (Green's function) objects - List of the local Green's functions for all inequivalent correlated shells, - rotated into the corresponding local frames. - + G_loc : list of BlockGf (Green's function) objects + List of the local Green's functions for all (inequivalent) correlated shells, + rotated into the corresponding local frames. + If ``transform_to_solver_blocks`` is True, it will be one per correlated shell, else one per + inequivalent correlated shell. """ if mu is None: @@ -712,20 +718,48 @@ class SumkDFT(object): G_loc[icrsh][bname] << self.rotloc( icrsh, gf, direction='toLocal') + if transform_to_solver_blocks: + return self.transform_to_solver_blocks(G_loc) + + return G_loc + + def transform_to_solver_blocks(self, G_loc, G_out=None): + """ transform G_loc from sumk to solver space + + Parameters + ---------- + G_loc : list of BlockGf + a list of one BlockGf per correlated shell with a structure + according to ``gf_struct_sumk``, e.g. as returned by + :py:meth:`.extract_G_loc` with ``transform_to_solver_blocks=False``. + G_out : list of BlockGf + a list of one BlockGf per *inequivalent* correlated shell + with a structure according to ``gf_struct_solver``. + The output Green's function (if not given, a new one is + created) + + Returns + ------- + G_out + """ + if G_out is None: + G_out = [BlockGf(mesh=G_loc[0].mesh, + gf_struct=[(k, v) for k, v in self.gf_struct_solver[ish].iteritems()]) + for ish in range(self.n_inequiv_shells)] + else: + for ish in range(self.n_inequiv_shells): + self.block_structure.check_gf(G_out, ish=ish) + # transform to CTQMC blocks: for ish in range(self.n_inequiv_shells): - for block, inner in self.gf_struct_solver[ish].iteritems(): - for ind1 in inner: - for ind2 in inner: - block_sumk, ind1_sumk = self.solver_to_sumk[ - ish][(block, ind1)] - block_sumk, ind2_sumk = self.solver_to_sumk[ - ish][(block, ind2)] - G_loc_inequiv[ish][block][ind1, ind2] << G_loc[ - self.inequiv_to_corr[ish]][block_sumk][ind1_sumk, ind2_sumk] + self.block_structure.convert_gf( + G=G_loc[self.inequiv_to_corr[ish]], + G_struct='sumk', + ish=ish, + G_out=G_out[ish]) # return only the inequivalent shells: - return G_loc_inequiv + return G_out def analyse_block_structure(self, threshold=0.00001, include_shells=None, dm=None, hloc=None): r""" From d8a26931234ca6f8aa0eac0345ce1b93084c0435 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Thu, 30 Aug 2018 21:55:59 +0200 Subject: [PATCH 06/35] block_structure: introduce space parameter in methods convert_gf, create_gf, check_gf --- python/block_structure.py | 125 +++++++++++++++++++++++++++----------- python/sumk_dft.py | 9 +-- test/blockstructure.py | 2 +- 3 files changed, 96 insertions(+), 40 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index 2af7dffe..e256dfcb 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -349,8 +349,11 @@ class BlockStructure(object): self.sumk_to_solver[ish]=su2so self.solver_to_sumk_block[ish]=so2su_block - def create_gf(self,ish=0,gf_function=GfImFreq,**kwargs): - """ Create a zero BlockGf having the gf_struct_solver structure. + def create_gf(self, ish=0, gf_function=GfImFreq, space='solver', **kwargs): + """ Create a zero BlockGf having the correct structure. + + For ``space='solver'``, the structure is according to + ``gf_struct_solver``, else according to ``gf_struct_sumk``. When using GfImFreq as gf_function, typically you have to supply beta as keyword argument. @@ -359,27 +362,40 @@ class BlockStructure(object): ---------- ish : int shell index + If ``space='solver', the index of the of the inequivalent correlated shell, + if ``space='sumk'`, the index of the correlated shell gf_function : constructor function used to construct the Gf objects constituting the individual blocks; default: GfImFreq + space : 'solver' or 'sumk' + which space the structure should correspond to **kwargs : options passed on to the Gf constructor for the individual blocks """ - names = self.gf_struct_solver[ish].keys() - blocks=[] + if space == 'solver': + gf_struct = self.gf_struct_solver + elif space == 'sumk': + gf_struct = self.gf_struct_sumk_dict + else: + raise Exception( + "Argument space has to be either 'solver' or 'sumk'.") + + names = gf_struct[ish].keys() + blocks = [] for n in names: - G = gf_function(indices=self.gf_struct_solver[ish][n],**kwargs) + G = gf_function(indices=gf_struct[ish][n], **kwargs) blocks.append(G) - G = BlockGf(name_list = names, block_list = blocks) + G = BlockGf(name_list=names, block_list=blocks) return G - def check_gf(self, G, ish=None): + def check_gf(self, G, ish=None, space='solver'): """ check whether the Green's function G has the right structure This throws an error if the structure of G is not the same - as ``gf_struct_solver``. + as ``gf_struct_solver`` (for ``space=solver``) or + ``gf_struct_sumk`` (for ``space=sumk``).. Parameters ---------- @@ -392,34 +408,44 @@ class BlockStructure(object): shell index default: 0 if G is just one Green's function is given, check all if list of Green's functions is given + space : 'solver' or 'sumk' + which space the structure should correspond to """ + if space == 'solver': + gf_struct = self.gf_struct_solver + elif space == 'sumk': + gf_struct = self.gf_struct_sumk_dict + else: + raise Exception( + "Argument space has to be either 'solver' or 'sumk'.") + if isinstance(G, list): - assert len(G) == len(self.gf_struct_solver),\ + assert len(G) == len(gf_struct),\ "list of G does not have the correct length" if ish is None: - ishs = range(len(self.gf_struct_solver)) + ishs = range(len(gf_struct)) else: ishs = [ish] for ish in ishs: - self.check_gf(G[ish], ish=ish) + self.check_gf(G[ish], ish=ish, space=space) return if ish is None: ish = 0 - for block in self.gf_struct_solver[ish]: + for block in gf_struct[ish]: assert block in G.indices,\ "block " + block + " not in G (shell {})".format(ish) for block, gf in G: - assert block in self.gf_struct_solver[ish],\ + assert block in gf_struct[ish],\ "block " + block + " not in struct (shell {})".format(ish) - assert list(gf.indices) == 2 * [map(str, self.gf_struct_solver[ish][block])],\ + assert list(gf.indices) == 2 * [map(str, gf_struct[ish][block])],\ "block " + block + " has wrong indices (shell {})".format(ish) - def convert_gf(self, G, G_struct, ish=0, show_warnings=True, - G_out=None, **kwargs): - """ Convert BlockGf from its structure to this (solver) structure. + def convert_gf(self, G, G_struct, ish_from=0, ish_to=None, show_warnings=True, + G_out=None, space_from='solver', space_to='solver', ish=None, **kwargs): + """ Convert BlockGf from its structure to this structure. .. warning:: @@ -432,10 +458,13 @@ class BlockStructure(object): G : BlockGf the Gf that should be converted G_struct : BlockStructure or str - the structure of that G or 'sumk' (then, the structure of - the sumk Green's function of this BlockStructure is used) - ish : int - shell index + the structure of that G or None (then, this structure + is used) + ish_from : int + shell index of the input structure + ish_to : int + shell index of the output structure; if None (the default), + it is the same as ish_from show_warnings : bool or float whether to show warnings when elements of the Green's function get thrown away @@ -445,41 +474,67 @@ class BlockStructure(object): G_out : BlockGf the output Green's function (if not given, a new one is created) + space_from : 'solver' or 'sumk' + whether the Green's function ``G`` corresponds to the + solver or sumk structure of ``G_struct`` + space_to : 'solver' or 'sumk' + whether the output Green's function should be according to + the solver of sumk structure of this structure **kwargs : options passed to the constructor for the new Gf """ + if ish is not None: + warn( + 'The parameter ish in convert_gf is deprecated. Use ish_from and ish_to instead.') + ish_from = ish + ish_to = ish + + if ish_to is None: + ish_to = ish_from + warning_threshold = 1.e-10 if isinstance(show_warnings, float): warning_threshold = show_warnings show_warnings = True - # we offer the possibility to convert to convert from sumk_dft - from_sumk = False - if isinstance(G_struct, str) and G_struct == 'sumk': - gf_struct_in = self.gf_struct_sumk_dict[ish] - from_sumk = True + if G_struct is None: + G_struct = self + + if space_from == 'solver': + gf_struct_in = G_struct.gf_struct_solver[ish_from] + elif space_from == 'sumk': + gf_struct_in = G_struct.gf_struct_sumk_dict[ish_from] else: - gf_struct_in = G_struct.gf_struct_solver[ish] + raise Exception( + "Argument space_from has to be either 'solver' or 'sumk'.") # create a Green's function to hold the result if G_out is None: - G_out = self.create_gf(ish=ish, **kwargs) + G_out = self.create_gf(ish=ish_to, space=space_to, **kwargs) else: - self.check_gf(G_out, ish=ish) + self.check_gf(G_out, ish=ish_to, space=space_to) for block in gf_struct_in.keys(): for i1 in gf_struct_in[block]: for i2 in gf_struct_in[block]: - if from_sumk: + if space_from == 'sumk': i1_sumk = (block, i1) i2_sumk = (block, i2) - else: - i1_sumk = G_struct.solver_to_sumk[ish][(block, i1)] - i2_sumk = G_struct.solver_to_sumk[ish][(block, i2)] + elif space_from == 'solver': + i1_sumk = G_struct.solver_to_sumk[ish_from][(block, i1)] + i2_sumk = G_struct.solver_to_sumk[ish_from][(block, i2)] + + if space_to == 'sumk': + i1_sol = i1_sumk + i2_sol = i2_sumk + elif space_to == 'solver': + i1_sol = self.sumk_to_solver[ish_to][i1_sumk] + i2_sol = self.sumk_to_solver[ish_to][i2_sumk] + else: + raise Exception( + "Argument space_to has to be either 'solver' or 'sumk'.") - i1_sol = self.sumk_to_solver[ish][i1_sumk] - i2_sol = self.sumk_to_solver[ish][i2_sumk] if i1_sol[0] is None or i2_sol[0] is None: if show_warnings: if mpi.is_master_node(): diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 23b91593..1b93373c 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -743,8 +743,7 @@ class SumkDFT(object): G_out """ if G_out is None: - G_out = [BlockGf(mesh=G_loc[0].mesh, - gf_struct=[(k, v) for k, v in self.gf_struct_solver[ish].iteritems()]) + G_out = [self.block_structure.create_gf(ish=ish, mesh=G_loc[self.inequiv_to_corr[ish]].mesh) for ish in range(self.n_inequiv_shells)] else: for ish in range(self.n_inequiv_shells): @@ -754,8 +753,10 @@ class SumkDFT(object): for ish in range(self.n_inequiv_shells): self.block_structure.convert_gf( G=G_loc[self.inequiv_to_corr[ish]], - G_struct='sumk', - ish=ish, + G_struct=None, + ish_from=self.inequiv_to_corr[ish], + ish_to=ish, + space_from='sumk', G_out=G_out[ish]) # return only the inequivalent shells: diff --git a/test/blockstructure.py b/test/blockstructure.py index eac85863..7333620c 100644 --- a/test/blockstructure.py +++ b/test/blockstructure.py @@ -61,7 +61,7 @@ G_sumk = BlockGf(mesh=G1.mesh, gf_struct=original_bs.gf_struct_sumk[0]) for i in range(3): G_sumk['up'][i, i] << SemiCircular(1 if i < 2 else 2) G_sumk['down'][i, i] << SemiCircular(4 if i < 2 else 3) -G3 = original_bs.convert_gf(G_sumk, 'sumk', beta=40, n_points=3) +G3 = original_bs.convert_gf(G_sumk, None, space_from='sumk', beta=40, n_points=3) assert_block_gfs_are_close(G1, G3) assert original_bs.gf_struct_sumk_list ==\ From 9076baf9d66b01ef931fbf703086af5d16bcc069 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Thu, 30 Aug 2018 22:39:35 +0200 Subject: [PATCH 07/35] sumk_dft: split transform_to_sumk_blocks from put_Sigma this is done in a backward-compatible manner --- python/sumk_dft.py | 102 ++++++++++++++++++++++++++++++--------------- 1 file changed, 68 insertions(+), 34 deletions(-) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 1b93373c..08eedafc 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -576,61 +576,95 @@ class SumkDFT(object): return G_latt - def set_Sigma(self, Sigma_imp): - self.put_Sigma(Sigma_imp) + def set_Sigma(self, Sigma_imp, transform_to_sumk_blocks=True): + self.put_Sigma(Sigma_imp, transform_to_sumk_blocks) - def put_Sigma(self, Sigma_imp): + def put_Sigma(self, Sigma_imp, transform_to_sumk_blocks=True): r""" - Inserts the impurity self-energies into the sumk_dft class. + Insert the impurity self-energies into the sumk_dft class. Parameters ---------- Sigma_imp : list of BlockGf (Green's function) objects - List containing impurity self-energy for all inequivalent correlated shells. - Self-energies for equivalent shells are then automatically set by this function. - The self-energies can be of the real or imaginary-frequency type. + List containing impurity self-energy for all (inequivalent) correlated shells. + Self-energies for equivalent shells are then automatically set by this function. + The self-energies can be of the real or imaginary-frequency type. + transform_to_sumk_blocks : bool, optional + If True (default), the input Sigma_imp will be transformed to the block structure ``gf_struct_sumk``, + else it has to be given in ``gf_struct_sumk``. """ - assert isinstance( - Sigma_imp, list), "put_Sigma: Sigma_imp has to be a list of Sigmas for the correlated shells, even if it is of length 1!" - assert len( - Sigma_imp) == self.n_inequiv_shells, "put_Sigma: give exactly one Sigma for each inequivalent corr. shell!" + if transform_to_sumk_blocks: + Sigma_imp = self.transform_to_sumk_blocks(Sigma_imp) - # init self.Sigma_imp_(i)w: - if all( (isinstance(gf, Gf) and isinstance (gf.mesh, MeshImFreq)) for bname, gf in Sigma_imp[0]): + assert isinstance(Sigma_imp, list),\ + "put_Sigma: Sigma_imp has to be a list of Sigmas for the correlated shells, even if it is of length 1!" + assert len(Sigma_imp) == self.n_corr_shells,\ + "put_Sigma: give exactly one Sigma for each corr. shell!" + + if all((isinstance(gf, Gf) and isinstance(gf.mesh, MeshImFreq)) for bname, gf in Sigma_imp[0]): # Imaginary frequency Sigma: - self.Sigma_imp_iw = [BlockGf(name_block_generator=[(block, GfImFreq(indices=inner, mesh=Sigma_imp[0].mesh)) - for block, inner in self.gf_struct_sumk[icrsh]], make_copies=False) + self.Sigma_imp_iw = [self.block_structure.create_gf(ish=icrsh, mesh=Sigma_imp[icrsh].mesh, space='sumk') for icrsh in range(self.n_corr_shells)] SK_Sigma_imp = self.Sigma_imp_iw - elif all( isinstance(gf, Gf) and isinstance (gf.mesh, MeshReFreq) for bname, gf in Sigma_imp[0]): + elif all(isinstance(gf, Gf) and isinstance(gf.mesh, MeshReFreq) for bname, gf in Sigma_imp[0]): # Real frequency Sigma: - self.Sigma_imp_w = [BlockGf(name_block_generator=[(block, GfReFreq(indices=inner, mesh=Sigma_imp[0].mesh)) - for block, inner in self.gf_struct_sumk[icrsh]], make_copies=False) + self.Sigma_imp_w = [self.block_structure.create_gf(ish=icrsh, mesh=Sigma_imp[icrsh].mesh, gf_function=GfReFreq, space='sumk') for icrsh in range(self.n_corr_shells)] SK_Sigma_imp = self.Sigma_imp_w else: - raise ValueError, "put_Sigma: This type of Sigma is not handled." + raise ValueError, "put_Sigma: This type of Sigma is not handled, give either BlockGf of GfReFreq or GfImFreq." + + # rotation from local to global coordinate system: + for icrsh in range(self.n_corr_shells): + for bname, gf in SK_Sigma_imp[icrsh]: + if self.use_rotations: + gf << self.rotloc(icrsh, + Sigma_imp[icrsh][bname], + direction='toGlobal') + else: + gf << Sigma_imp[icrsh][bname] + + def transform_to_sumk_blocks(self, Sigma_imp, Sigma_out=None): + r""" transform Sigma from solver to sumk space + + Parameters + ---------- + Sigma_imp : list of BlockGf (Green's function) objects + List containing impurity self-energy for all inequivalent correlated shells. + The self-energies can be of the real or imaginary-frequency type. + Sigma_out : list of BlockGf + list of one BlockGf per correlated shell with the block structure + according to ``gf_struct_sumk``; if None, it will be created + """ + + assert isinstance(Sigma_imp, list),\ + "transform_to_sumk_blocks: Sigma_imp has to be a list of Sigmas for the inequivalent correlated shells, even if it is of length 1!" + assert len(Sigma_imp) == self.n_inequiv_shells,\ + "transform_to_sumk_blocks: give exactly one Sigma for each inequivalent corr. shell!" + + if Sigma_out is None: + Sigma_out = [self.block_structure.create_gf(ish=icrsh, mesh=Sigma_imp[self.corr_to_inequiv[icrsh]].mesh, space='sumk') + for icrsh in range(self.n_corr_shells)] + else: + for icrsh in range(self.n_corr_shells): + self.block_structure.check_gf(Sigma_out, + ish=icrsh, + space='sumk') # transform the CTQMC blocks to the full matrix: for icrsh in range(self.n_corr_shells): # ish is the index of the inequivalent shell corresponding to icrsh ish = self.corr_to_inequiv[icrsh] - for block, inner in self.gf_struct_solver[ish].iteritems(): - for ind1 in inner: - for ind2 in inner: - block_sumk, ind1_sumk = self.solver_to_sumk[ - ish][(block, ind1)] - block_sumk, ind2_sumk = self.solver_to_sumk[ - ish][(block, ind2)] - SK_Sigma_imp[icrsh][block_sumk][ - ind1_sumk, ind2_sumk] << Sigma_imp[ish][block][ind1, ind2] - - # 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') + self.block_structure.convert_gf( + G=Sigma_imp[ish], + G_struct=None, + space_from='solver', + space_to='sumk', + ish_from=ish, + ish_to=icrsh, + G_out=Sigma_out[icrsh]) + return Sigma_out def extract_G_loc(self, mu=None, iw_or_w='iw', with_Sigma=True, with_dc=True, broadening=None, transform_to_solver_blocks=True): From 31cb7a0ea4794413d463c86dd1982cae20769c03 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Fri, 31 Aug 2018 17:52:01 +0200 Subject: [PATCH 08/35] block_structure: prepare for transformation this includes some TODOs that need to be fixed --- python/block_structure.py | 112 ++++++++++++++++++++++++++++++++------ python/sumk_dft.py | 3 + 2 files changed, 97 insertions(+), 18 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index e256dfcb..1d5bb3b2 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -62,6 +62,43 @@ class BlockStructure(object): maps from the solver block to the sumk block for *inequivalent* correlated shell ish + deg_shells : list of lists of lists OR list of lists of dicts + In the simple format, ``deg_shells[ish][grp]`` is a list of + block names; ``ish`` is the index of the inequivalent correlated shell, + ``grp`` is the index of the group of symmetry-related blocks. + When the name of two blocks is in the same group, that means that + these two blocks are the same by symmetry. + + In the more general format, ``deg_shells[ish][grp]`` is a + dictionary whose keys are the block names that are part of the + group. The values of the dict for each key are tuples ``(v, conj)``, + where ``v`` is a transformation matrix with the same matrix dimensions + as the block and ``conj`` is a bool (whether or not to conjugate). + Two blocks with ``v_1, conj_1`` and ``v_2, conj_2`` being in the same + symmetry group means that + + .. math:: + + C_1(v_1^\dagger G_1 v_1) = C_2(v_2^\dagger G_2 v_2), + + where the :math:`G_i` are the Green's functions of the block, + and the functions :math:`C_i` conjugate their argument if the bool + ``conj_i`` is ``True``. + transformation : list of numpy.array or list of dict + a list with entries for each ``ish`` giving transformation matrices + that are used on the Green's function in ``sumk`` space when before + converting to the ``solver`` space + Up to the change in block structure, + + .. math:: + + G_{solver} = T G_{sumk} T^\dagger + + if :math:`T` is the ``transformation`` of that particular shell. + + Note that for each shell this can either be a numpy array which + applies to all blocks or a dict with a transformation matrix for + each block. """ def __init__(self, gf_struct_sumk=None, @@ -69,13 +106,15 @@ class BlockStructure(object): solver_to_sumk=None, sumk_to_solver=None, solver_to_sumk_block=None, - deg_shells=None): + deg_shells=None, + transformation=None): self.gf_struct_sumk = gf_struct_sumk self.gf_struct_solver = gf_struct_solver self.solver_to_sumk = solver_to_sumk self.sumk_to_solver = sumk_to_solver self.solver_to_sumk_block = solver_to_sumk_block self.deg_shells = deg_shells + self.transformation = transformation @property def gf_struct_solver_list(self): @@ -144,6 +183,13 @@ class BlockStructure(object): return [{block: indices for block, indices in gfs} for gfs in self.gf_struct_sumk] + @property + def effective_transformation(self): + # TODO: if transformation is None, return np.eye + # TODO: zero out all the lines of the transformation that are + # not included in gf_struct_solver + return self.transformation + @classmethod def full_structure(cls,gf_struct,corr_to_inequiv): """ Construct structure that maps to itself. @@ -294,6 +340,10 @@ class BlockStructure(object): but the sumk Gf. """ + # TODO: when there is a transformation matrix, this should + # first zero out the corresponding rows of (a copy of) T and then + # pick_gf_struct_solver all lines of (the copy of) T that have at least + # one non-zero entry gfs = [] # construct gfs, which is the equivalent of new_gf_struct @@ -309,9 +359,8 @@ class BlockStructure(object): gfs[ish][ind_sol[0]].append(ind_sol[1]) self.pick_gf_struct_solver(gfs) - - def map_gf_struct_solver(self,mapping): - """ Map the Green function structure from one struct to another. + def map_gf_struct_solver(self, mapping): + r""" Map the Green function structure from one struct to another. Parameters ---------- @@ -319,35 +368,51 @@ class BlockStructure(object): the dict consists of elements (from_block,from_index) : (to_block,to_index) that maps from one structure to the other + (one for each shell; use a mapping ``None`` for a shell + you want to leave unchanged) + + Examples + -------- + + Consider a `gf_struct_solver` consisting of two :math:`1 \times 1` + blocks, `block_1` and `block_2`. Say you want to have a new block + structure where you merge them into one block because you want to + introduce an off-diagonal element. You could perform the mapping + via:: + + map_gf_struct_solver([{('block_1',0) : ('block', 0) + ('block_2',0) : ('block', 1)}]) """ for ish in range(len(mapping)): + if mapping[ish] is None: + continue gf_struct = {} so2su = {} su2so = {} so2su_block = {} - for frm,to in mapping[ish].iteritems(): + for frm, to in mapping[ish].iteritems(): if not to[0] in gf_struct: - gf_struct[to[0]]=[] + gf_struct[to[0]] = [] gf_struct[to[0]].append(to[1]) - so2su[to]=self.solver_to_sumk[ish][frm] - su2so[self.solver_to_sumk[ish][frm]]=to + so2su[to] = self.solver_to_sumk[ish][frm] + su2so[self.solver_to_sumk[ish][frm]] = to if to[0] in so2su_block: if so2su_block[to[0]] != \ - self.solver_to_sumk_block[ish][frm[0]]: + self.solver_to_sumk_block[ish][frm[0]]: warn("solver block '{}' maps to more than one sumk block: '{}', '{}'".format( - to[0],so2su_block[to[0]],self.solver_to_sumk_block[ish][frm[0]])) + to[0], so2su_block[to[0]], self.solver_to_sumk_block[ish][frm[0]])) else: - so2su_block[to[0]]=\ + so2su_block[to[0]] =\ self.solver_to_sumk_block[ish][frm[0]] for k in self.sumk_to_solver[ish].keys(): if not k in su2so: - su2so[k] = (None,None) - self.gf_struct_solver[ish]=gf_struct - self.solver_to_sumk[ish]=so2su - self.sumk_to_solver[ish]=su2so - self.solver_to_sumk_block[ish]=so2su_block + su2so[k] = (None, None) + self.gf_struct_solver[ish] = gf_struct + self.solver_to_sumk[ish] = so2su + self.sumk_to_solver[ish] = su2so + self.solver_to_sumk_block[ish] = so2su_block def create_gf(self, ish=0, gf_function=GfImFreq, space='solver', **kwargs): """ Create a zero BlockGf having the correct structure. @@ -484,6 +549,8 @@ class BlockStructure(object): options passed to the constructor for the new Gf """ + # TODO: use effective_transformation here + if ish is not None: warn( 'The parameter ish in convert_gf is deprecated. Use ish_from and ish_to instead.') @@ -607,7 +674,7 @@ class BlockStructure(object): for prop in [ "gf_struct_sumk", "gf_struct_solver", "solver_to_sumk", "sumk_to_solver", "solver_to_sumk_block", - "deg_shells"]: + "deg_shells","transformation"]: if not compare(getattr(self,prop),getattr(other,prop)): return False return True @@ -620,9 +687,13 @@ class BlockStructure(object): ret = {} for element in [ "gf_struct_sumk", "gf_struct_solver", - "solver_to_sumk_block","deg_shells"]: + "solver_to_sumk_block","deg_shells", + "transformation"]: ret[element] = getattr(self,element) + if ret["transformation"] is None: + ret["transformation"] = "None" + def construct_mapping(mapping): d = [] for ish in range(len(mapping)): @@ -648,6 +719,9 @@ class BlockStructure(object): d[ish][literal_eval(k)] = literal_eval(v) return d + if 'transformation' in D and D['transformation'] == "None": + D['transformation'] = None + D['solver_to_sumk']=reconstruct_mapping(D['solver_to_sumk']) D['sumk_to_solver']=reconstruct_mapping(D['sumk_to_solver']) return cls(**D) @@ -679,6 +753,8 @@ class BlockStructure(object): else: for key in self.deg_shells[ish][l]: s+=' '+key+'\n' + s += "transformation\n" + s += str(self.transformation) return s from pytriqs.archive.hdf_archive_schemes import register_class diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 08eedafc..1b7c3d18 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -36,6 +36,9 @@ from warnings import warn from scipy import compress from scipy.optimize import minimize +# TODO: check where the transformation in block_structure has to enter +# - DC + class SumkDFT(object): """This class provides a general SumK method for combining ab-initio code and pytriqs.""" From 5fd74f73b71477102d90f2c10eb438eb45c4f487 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Tue, 4 Sep 2018 19:02:10 +0200 Subject: [PATCH 09/35] start with Sr2RuO4 guide --- doc/documentation.rst | 1 + doc/guide/Sr2RuO4.rst | 40 ++++++++ doc/guide/Sr2RuO4/Sr2RuO4.indmftpr | 17 ++++ doc/guide/Sr2RuO4/Sr2RuO4.struct | 96 +++++++++++++++++++ .../Sr2RuO4/calculate_dos_wannier_basis.py | 15 +++ 5 files changed, 169 insertions(+) create mode 100644 doc/guide/Sr2RuO4.rst create mode 100644 doc/guide/Sr2RuO4/Sr2RuO4.indmftpr create mode 100644 doc/guide/Sr2RuO4/Sr2RuO4.struct create mode 100644 doc/guide/Sr2RuO4/calculate_dos_wannier_basis.py diff --git a/doc/documentation.rst b/doc/documentation.rst index b000a6c8..45f071d6 100644 --- a/doc/documentation.rst +++ b/doc/documentation.rst @@ -26,6 +26,7 @@ User guide guide/dftdmft_singleshot guide/SrVO3 guide/dftdmft_selfcons + guide/Sr2RuO4 guide/analysis guide/full_tutorial guide/transport diff --git a/doc/guide/Sr2RuO4.rst b/doc/guide/Sr2RuO4.rst new file mode 100644 index 00000000..a1e3c8b9 --- /dev/null +++ b/doc/guide/Sr2RuO4.rst @@ -0,0 +1,40 @@ +.. _Sr2RuO4: + +Spin-orbit coupled calculations (single-shot) +============================================= + +There are two main ways of including the spin-orbit coupling (SO) term into +DFT+DMFT calculations: + +- by performing a DFT calculation including SO and then doing a DMFT calculation on top, or +- by performing a DFT calculation without SO and then adding the SO term on the model level. + +Treatment of SO in DFT +---------------------- + +For now, TRIQS/DFTTools does only work with Wien2k when performing calculations with SO. +Of course, the general Hk framework is also possible. +But the way VASP treats SO is fundamentally different to the way Wien2k treats it and the interface does not handle that at the moment. + +Therefore, this guide assumes that Wien2k is being used. + +First, a Wien2k calculation including SO has to be performed. +For details, we refer the reader to the documentation of Wien2k. +The interface to Wien2k only works when the DFT calculation is done both spin-polarized and with SO (that means that you have to initialize the Wien2k calculation accordingly and then run with ``runsp -sp``). + +Performing the projection +~~~~~~~~~~~~~~~~~~~~~~~~~ + +Note that the final ``x lapw2 -almd -so -up`` and ``x lapw2 -almd -so -dn`` have to be run *on a single core*, which implies that, before, ``x lapw1 -up``, ``x lapw2 -dn``, and ``x lapwso -up`` have to be run in single-core mode (once). + +In the ``case.indmftpr`` file, the spin-orbit flag has to be set to ``1`` for the correlated atoms. +For example, for the compound Sr\ :sub:`2`\ RuO\ :sub:`4`, with the struct file :download:`Sr2RuO4.struct `, we would e.g. use the ``indmftpr`` file :download:`found here `. +Then, ``dmftproj -sp -so`` has to be called. +As usual, it is important to check for warnings (e.g., about eigenvalues of the overlap matrix) in the output of ``dmftproj`` and adapt the window until these warnings disappear. + +Note that in presence of SO, it is not possible to project only onto the :math:`t_{2g}` subshell because it is not an irreducible representation. +A redesign of the orthonormalization procedure might happen in the long term, which might allow that. + +We strongly suggest using the :py:meth:`.dos_wannier_basis` functionality of the :py:class:`.SumkDFTTools` class (see :download:`calculate_dos_wannier_basis.py `) and compare the Wannier-projected orbitals to the original DFT DOS (they should be more or less equal). +Note that, with SO, there are usually off-diagonal elements of the spectral function, which can also be imaginary. +The imaginary part can be found in the third column of the files ``DOS_wann_...``. diff --git a/doc/guide/Sr2RuO4/Sr2RuO4.indmftpr b/doc/guide/Sr2RuO4/Sr2RuO4.indmftpr new file mode 100644 index 00000000..fa8e6be5 --- /dev/null +++ b/doc/guide/Sr2RuO4/Sr2RuO4.indmftpr @@ -0,0 +1,17 @@ +4 ! Nsort +2 1 2 2 ! Multiplicities +3 ! lmax +complex ! Sr +0 0 0 0 +0 0 0 0 +cubic ! Ru +0 0 2 0 ! include d-shell as correlated +0 0 0 0 ! there are no irreps with SO +1 ! SO-flag +complex ! O1 +0 0 0 0 +0 0 0 0 +complex ! O2 +0 0 0 0 +0 0 0 0 +-0.7 1.4 ! energy window (Ry) diff --git a/doc/guide/Sr2RuO4/Sr2RuO4.struct b/doc/guide/Sr2RuO4/Sr2RuO4.struct new file mode 100644 index 00000000..5cfd9a0d --- /dev/null +++ b/doc/guide/Sr2RuO4/Sr2RuO4.struct @@ -0,0 +1,96 @@ +Sr2RuO4 s-o calc. M|| 0.00 0.00 1.00 +B 4 39_I + RELA + 7.300012 7.300012 24.044875 90.000000 90.000000 90.000000 +ATOM -1: X=0.00000000 Y=0.00000000 Z=0.35240000 + MULT= 2 ISPLIT=-2 + -1: X=0.00000000 Y=0.00000000 Z=0.64760000 +Sr2+ NPT= 781 R0=.000010000 RMT= 2.26000 Z: 38.00000 +LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000 + 0.0000000 1.0000000 0.0000000 + 0.0000000 0.0000000 1.0000000 +ATOM -2: X=0.00000000 Y=0.00000000 Z=0.00000000 + MULT= 1 ISPLIT=-2 +Ru4+ NPT= 781 R0=.000010000 RMT= 1.95000 Z: 44.00000 +LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000 + 0.0000000 1.0000000 0.0000000 + 0.0000000 0.0000000 1.0000000 +ATOM -3: X=0.50000000 Y=0.00000000 Z=0.00000000 + MULT= 2 ISPLIT= 8 + -3: X=0.00000000 Y=0.50000000 Z=0.00000000 +O 2- NPT= 781 R0=.000100000 RMT= 1.68000 Z: 8.00000 +LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000 + 0.0000000 1.0000000 0.0000000 + 0.0000000 0.0000000 1.0000000 +ATOM -4: X=0.00000000 Y=0.00000000 Z=0.16350000 + MULT= 2 ISPLIT=-2 + -4: X=0.00000000 Y=0.00000000 Z=0.83650000 +O 2- NPT= 781 R0=.000100000 RMT= 1.68000 Z: 8.00000 +LOCAL ROT MATRIX: 1.0000000 0.0000000 0.0000000 + 0.0000000 1.0000000 0.0000000 + 0.0000000 0.0000000 1.0000000 + 16 NUMBER OF SYMMETRY OPERATIONS + 0-1 0 0.00000000 + 1 0 0 0.00000000 + 0 0-1 0.00000000 + 1 A 2 so. oper. type orig. index +-1 0 0 0.00000000 + 0-1 0 0.00000000 + 0 0-1 0.00000000 + 2 A 3 + 1 0 0 0.00000000 + 0 1 0 0.00000000 + 0 0-1 0.00000000 + 3 A 6 + 0-1 0 0.00000000 + 1 0 0 0.00000000 + 0 0 1 0.00000000 + 4 A 8 + 0 1 0 0.00000000 +-1 0 0 0.00000000 + 0 0-1 0.00000000 + 5 A 9 +-1 0 0 0.00000000 + 0-1 0 0.00000000 + 0 0 1 0.00000000 + 6 A 11 + 1 0 0 0.00000000 + 0 1 0 0.00000000 + 0 0 1 0.00000000 + 7 A 14 + 0 1 0 0.00000000 +-1 0 0 0.00000000 + 0 0 1 0.00000000 + 8 A 15 + 1 0 0 0.00000000 + 0-1 0 0.00000000 + 0 0-1 0.00000000 + 9 B 1 + 0 1 0 0.00000000 + 1 0 0 0.00000000 + 0 0-1 0.00000000 + 10 B 4 + 0-1 0 0.00000000 +-1 0 0 0.00000000 + 0 0-1 0.00000000 + 11 B 5 + 1 0 0 0.00000000 + 0-1 0 0.00000000 + 0 0 1 0.00000000 + 12 B 7 +-1 0 0 0.00000000 + 0 1 0 0.00000000 + 0 0-1 0.00000000 + 13 B 10 + 0 1 0 0.00000000 + 1 0 0 0.00000000 + 0 0 1 0.00000000 + 14 B 12 + 0-1 0 0.00000000 +-1 0 0 0.00000000 + 0 0 1 0.00000000 + 15 B 13 +-1 0 0 0.00000000 + 0 1 0 0.00000000 + 0 0 1 0.00000000 + 16 B 16 diff --git a/doc/guide/Sr2RuO4/calculate_dos_wannier_basis.py b/doc/guide/Sr2RuO4/calculate_dos_wannier_basis.py new file mode 100644 index 00000000..7cb8462a --- /dev/null +++ b/doc/guide/Sr2RuO4/calculate_dos_wannier_basis.py @@ -0,0 +1,15 @@ +from triqs_dft_tools.converters.wien2k_converter import Wien2kConverter +from triqs_dft_tools import SumkDFTTools + +filename = 'Sr2RuO4' + +conv = Wien2kConverter(filename = filename,hdf_filename=filename+'.h5') +conv.convert_dft_input() + +SK = SumkDFTTools(filename+'.h5') +mesh = (-10.0,10.0,500) +SK.dos_wannier_basis(broadening=(mesh[1]-mesh[0])/float(mesh[2]), + mesh=mesh, + save_to_file=True, + with_Sigma=False, + with_dc=False) From 2d481198766cf8ce30b40370080fceb29911dbea Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Fri, 7 Sep 2018 11:27:07 +0200 Subject: [PATCH 10/35] block_structure: effective_transformation_sumk --- python/block_structure.py | 52 ++++++++++++++++++++++++++++++++---- test/blockstructure.py | 55 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 101 insertions(+), 6 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index 1d5bb3b2..42227c82 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -133,6 +133,8 @@ class BlockStructure(object): The list for each shell is sorted alphabetically by block name. """ + if self.gf_struct_solver is None: + return None # we sort by block name in order to get a reproducible result return [sorted([(k, v) for k, v in gfs.iteritems()], key=lambda x: x[0]) for gfs in self.gf_struct_solver] @@ -180,15 +182,55 @@ class BlockStructure(object): ``gf_struct_sumk_dict[ish][bname]`` is a list of the indices of block ``bname`` of shell ``ish``. """ + if self.gf_struct_sumk is None: + return None return [{block: indices for block, indices in gfs} for gfs in self.gf_struct_sumk] @property - def effective_transformation(self): - # TODO: if transformation is None, return np.eye - # TODO: zero out all the lines of the transformation that are - # not included in gf_struct_solver - return self.transformation + def effective_transformation_sumk(self): + trans = copy.deepcopy(self.transformation) + if self.gf_struct_sumk is None: + raise Exception('gf_struct_sumk not set.') + if self.gf_struct_solver is None: + raise Exception('gf_struct_solver not set.') + + if trans is None: + trans = [{block: np.eye(len(indices)) for block, indices in gfs} + for gfs in self.gf_struct_sumk] + + assert isinstance(trans, list),\ + "transformation has to be a list" + + assert len(trans) == len(self.gf_struct_sumk),\ + "give one transformation per correlated shell" + + for icrsh in range(len(trans)): + if trans[icrsh] is None: + trans[icrsh] = {block: np.eye(len(indices)) + for block, indices in self.gf_struct_sumk[icrsh]} + + if not isinstance(trans[icrsh], dict): + trans[icrsh] = {block: copy.deepcopy(trans[icrsh]) + for block, indices in self.gf_struct_sumk[icrsh]} + + assert trans[icrsh].keys() == self.gf_struct_sumk_dict[icrsh].keys(),\ + "wrong block names used in transformation (icrsh = {})".format(icrsh) + + for block in trans[icrsh]: + assert trans[icrsh][block].shape[0] == trans[icrsh][block].shape[1],\ + "Transformation has to be quadratic; throwing away orbitals can be achieved on the level of the mapping. (icrsh = {}, block = {})".format(icrsh, block) + + assert trans[icrsh][block].shape[0] == len(self.gf_struct_sumk_dict[icrsh][block]),\ + "Transformation block shape does not match gf_struct_sumk. (icrsh = {}, block = {})".format(icrsh, block) + + # zero out all the lines of the transformation that are + # not included in gf_struct_solver + for iorb, norb in enumerate(self.gf_struct_sumk_dict[icrsh][block]): + if self.sumk_to_solver[icrsh][(block, norb)][0] is None: + trans[icrsh][block][iorb, :] = 0.0 + return trans + @classmethod def full_structure(cls,gf_struct,corr_to_inequiv): diff --git a/test/blockstructure.py b/test/blockstructure.py index 7333620c..b0da8c5c 100644 --- a/test/blockstructure.py +++ b/test/blockstructure.py @@ -3,15 +3,38 @@ from pytriqs.utility.h5diff import h5diff from pytriqs.gf import * from pytriqs.utility.comparison_tests import assert_block_gfs_are_close from triqs_dft_tools.block_structure import BlockStructure +import numpy as np +from pytriqs.utility.h5diff import compare, failures + + +def cmp(a, b, precision=1.e-15): + compare('', a, b, 0, precision) + if failures: + raise AssertionError('\n'.join(failures)) SK = SumkDFT('blockstructure.in.h5', use_dft_blocks=True) original_bs = SK.block_structure +cmp(original_bs.effective_transformation_sumk, + [{'down': np.array([[1., 0., 0.], + [0., 1., 0.], + [0., 0., 1.]]), + 'up': np.array([[1., 0., 0.], + [0., 1., 0.], + [0., 0., 1.]])}]) # check pick_gf_struct_solver pick1 = original_bs.copy() pick1.pick_gf_struct_solver([{'up_0': [1], 'up_1': [0], 'down_1': [0]}]) +cmp(pick1.effective_transformation_sumk, + [{'down': np.array([[0., 0., 0.], + [0., 0., 0.], + [0., 0., 1.]]), + 'up': np.array([[0., 0., 0.], + [0., 1., 0.], + [0., 0., 1.]])}]) + # check loading a block_structure from file SK.block_structure = SK.load(['block_structure'], 'mod')[0] assert SK.block_structure == pick1, 'loading SK block structure from file failed' @@ -25,10 +48,36 @@ sk_pick1 = BlockStructure(gf_struct_sumk=SK.gf_struct_sumk, deg_shells=SK.deg_shells) assert sk_pick1 == pick1, 'constructing block structure from SumkDFT properties failed' +cmp(pick1.effective_transformation_sumk, + [{'down': np.array([[0., 0., 0.], + [0., 0., 0.], + [0., 0., 1.]]), + 'up': np.array([[0., 0., 0.], + [0., 1., 0.], + [0., 0., 1.]])}]) + # check pick_gf_struct_sumk pick2 = original_bs.copy() pick2.pick_gf_struct_sumk([{'up': [1, 2], 'down': [0, 1]}]) +cmp(pick2.effective_transformation_sumk, + [{'down': np.array([[1., 0., 0.], + [0., 1., 0.], + [0., 0., 0.]]), + 'up': np.array([[0., 0., 0.], + [0., 1., 0.], + [0., 0., 1.]])}]) + +pick3 = pick2.copy() +pick3.transformation = [np.reshape(range(9), (3, 3))] +cmp(pick3.effective_transformation_sumk, + [{'down': np.array([[0, 1, 2], + [3, 4, 5], + [0, 0, 0]]), + 'up': np.array([[0, 0, 0], + [3, 4, 5], + [6, 7, 8]])}]) + # check map_gf_struct_solver mapping = [{('down_0', 0): ('down', 0), ('down_0', 1): ('down', 2), @@ -61,7 +110,11 @@ G_sumk = BlockGf(mesh=G1.mesh, gf_struct=original_bs.gf_struct_sumk[0]) for i in range(3): G_sumk['up'][i, i] << SemiCircular(1 if i < 2 else 2) G_sumk['down'][i, i] << SemiCircular(4 if i < 2 else 3) -G3 = original_bs.convert_gf(G_sumk, None, space_from='sumk', beta=40, n_points=3) +G3 = original_bs.convert_gf(G_sumk, + None, + space_from='sumk', + beta=40, + n_points=3) assert_block_gfs_are_close(G1, G3) assert original_bs.gf_struct_sumk_list ==\ From bc78560ee1184f6da5652fe89c70d200545800ac Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Fri, 7 Sep 2018 14:40:43 +0200 Subject: [PATCH 11/35] block_structure: add corr_to_inequiv --- python/block_structure.py | 37 ++++++++++++++++---- python/sumk_dft.py | 18 ++++++++-- test/analyse_block_structure_from_gf.ref.h5 | Bin 73312 -> 76008 bytes test/blockstructure.in.h5 | Bin 66104 -> 67352 bytes test/blockstructure.py | 3 +- test/blockstructure.ref.h5 | Bin 248384 -> 240784 bytes 6 files changed, 48 insertions(+), 10 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index 42227c82..df0cc2e9 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -107,6 +107,7 @@ class BlockStructure(object): sumk_to_solver=None, solver_to_sumk_block=None, deg_shells=None, + corr_to_inequiv = None, transformation=None): self.gf_struct_sumk = gf_struct_sumk self.gf_struct_solver = gf_struct_solver @@ -114,6 +115,7 @@ class BlockStructure(object): self.sumk_to_solver = sumk_to_solver self.solver_to_sumk_block = solver_to_sumk_block self.deg_shells = deg_shells + self.corr_to_inequiv = corr_to_inequiv self.transformation = transformation @property @@ -187,6 +189,24 @@ class BlockStructure(object): return [{block: indices for block, indices in gfs} for gfs in self.gf_struct_sumk] + @property + def inequiv_to_corr(self): + if self.corr_to_inequiv is None: + return None + N_solver = len(np.unique(self.corr_to_inequiv)) + if self.gf_struct_solver is not None: + assert N_solver == len(self.gf_struct_solver) + assert sorted(np.unique(self.corr_to_inequiv)) == range(N_solver),\ + "an inequivalent shell is missing in corr_to_inequiv" + return [self.corr_to_inequiv.index(icrsh) + for icrsh in range(N_solver)] + + @inequiv_to_corr.setter + def inequiv_to_corr(self, value): + if value is None: + return + assert self.inequiv_to_corr == value, "Trying to set incompatible inequiv_to_corr" + @property def effective_transformation_sumk(self): trans = copy.deepcopy(self.transformation) @@ -285,7 +305,8 @@ class BlockStructure(object): solver_to_sumk = copy.deepcopy(solver_to_sumk), sumk_to_solver = solver_to_sumk, solver_to_sumk_block = s2sblock, - deg_shells = [[] for ish in range(len(gf_struct))]) + deg_shells = [[] for ish in range(len(gf_struct))], + corr_to_inequiv = corr_to_inequiv) def pick_gf_struct_solver(self,new_gf_struct): """ Pick selected orbitals within blocks. @@ -716,7 +737,7 @@ class BlockStructure(object): for prop in [ "gf_struct_sumk", "gf_struct_solver", "solver_to_sumk", "sumk_to_solver", "solver_to_sumk_block", - "deg_shells","transformation"]: + "deg_shells","transformation", "corr_to_inequiv"]: if not compare(getattr(self,prop),getattr(other,prop)): return False return True @@ -730,8 +751,10 @@ class BlockStructure(object): ret = {} for element in [ "gf_struct_sumk", "gf_struct_solver", "solver_to_sumk_block","deg_shells", - "transformation"]: + "transformation", "corr_to_inequiv"]: ret[element] = getattr(self,element) + if ret[element] is None: + ret[element] = 'None' if ret["transformation"] is None: ret["transformation"] = "None" @@ -761,8 +784,9 @@ class BlockStructure(object): d[ish][literal_eval(k)] = literal_eval(v) return d - if 'transformation' in D and D['transformation'] == "None": - D['transformation'] = None + for elem in D: + if D[elem]=="None": + D[elem] = None D['solver_to_sumk']=reconstruct_mapping(D['solver_to_sumk']) D['sumk_to_solver']=reconstruct_mapping(D['sumk_to_solver']) @@ -770,7 +794,8 @@ class BlockStructure(object): def __str__(self): s='' - s+= "gf_struct_sumk "+str( self.gf_struct_sumk)+'\n' + s+= "corr_to_inequiv "+str(self.corr_to_inequiv)+'\n' + s+= "gf_struct_sumk "+str(self.gf_struct_sumk)+'\n' s+= "gf_struct_solver "+str(self.gf_struct_solver)+'\n' s+= "solver_to_sumk_block "+str(self.solver_to_sumk_block)+'\n' for el in ['solver_to_sumk','sumk_to_solver']: diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 1b7c3d18..854ee564 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -98,6 +98,8 @@ class SumkDFT(object): self.misc_data = misc_data self.h_field = h_field + self.block_structure = BlockStructure() + # Read input from HDF: things_to_read = ['energy_unit', 'n_k', 'k_dep_projection', 'SP', 'SO', 'charge_below', 'density_required', 'symm_op', 'n_shells', 'shells', 'n_corr_shells', 'corr_shells', 'use_rotations', 'rot_mat', @@ -123,8 +125,6 @@ class SumkDFT(object): self.spin_names_to_ind[iso][ self.spin_block_names[iso][isp]] = isp * self.SP - self.block_structure = BlockStructure() - # GF structure used for the local things in the k sums # Most general form allowing for all hybridisation, i.e. largest # blocks possible @@ -187,7 +187,7 @@ class SumkDFT(object): # initialise variables on all nodes to ensure mpi broadcast works at # the end for it in things_to_read: - setattr(self, it, 0) + setattr(self, it, None) subgroup_present = 0 if mpi.is_master_node(): @@ -2145,3 +2145,15 @@ class SumkDFT(object): @property def gf_struct_sumk_dict(self): return self.block_structure.gf_struct_sumk_dict + + def __get_corr_to_inequiv(self): + return self.block_structure.corr_to_inequiv + def __set_corr_to_inequiv(self, value): + self.block_structure.corr_to_inequiv = value + corr_to_inequiv = property(__get_corr_to_inequiv, __set_corr_to_inequiv) + + def __get_inequiv_to_corr(self): + return self.block_structure.inequiv_to_corr + def __set_inequiv_to_corr(self, value): + self.block_structure.inequiv_to_corr = value + inequiv_to_corr = property(__get_inequiv_to_corr, __set_inequiv_to_corr) diff --git a/test/analyse_block_structure_from_gf.ref.h5 b/test/analyse_block_structure_from_gf.ref.h5 index 7acea34d680aa13c55ebfa786da8eea4044c2812..e046860512cd1a04b2918461f2c7fecf8a0cf7ba 100644 GIT binary patch delta 6538 zcmai24RBP|6@K?FKksdR*d&H*Hoz_d62jjy#IhnfTgN(#MF?Oe1%*WfB4S*SpOs=+ zT7M!_=`N?546VBOQ&!Nrk8~s;mc^k?V6d}*LsJkNtksB&EVkkbj`rSj-rY^!IMbbh zbG~!WyZ5~FoqON8=|0e}=Xk$ZE$^u{>uz(fh-rS$AlzSfwrKRLtp|@|n9+C>!4NE7 z>*ek_aJ2tSPvB`XGRwECjg%n`#I5 zeYC;CVK>=pttnGO`}%cRIOipM(DF-+?&}wuL^w5>WP|0GS&GUMO~o8(rjfQV$q)%G z^)M;QuVEA6+#@6-mS1>7U%##=Ex)JY<^+fph2rgQSTTGC@3;w`AF@!2?}jYg)M4e* zA-oOoPvL$x+~0-=*ziCb)@@kM-Fto~;Z6Aki);?X0(0?C1yo`iFSX%8Hte$DG8-;O z{L{h$6*h-!Y`D^fWuf$bqpG-B4Id7J_@43Y&E6g+Gu${F6WuYqkZ6zXu^Jm5V#Bh| zdM`7~hGqTr9{1VsaKeQ|Uu$z1A#m?RkF?=Y0!wlf5!czUEco8za>w+>V-PPWOi*WY z7;D4hY}?^-zvyGPJkdkiCQf$c9Yk;S`UnHxDL3~` z#N)NAp2qNaHQYBSw4>Bp9gvkEe(GIA7LI~h=WS1atTSicG#YlDN^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3~!d?D15wP z$Ib;oj?F*PRmY-?17x)Z;bU#EoNk1k)i(I_rWNk5T9ib(m_EEH5|S=7y0svQ2}m*l z>Y}*g$=uCS0p=x+ZO}UZ4-*i%ReVEFh6+GV7`fE|`JWt$aiBVL2tH}_qBNC(WZ23y z;p8v6gqEx>VR(g0aIZ26*m@g=M-QTP-rnj8Oip)!ZN?ArY+Ho?c#}@pJtQ0Fh zDwzTOzTQ9jx=g#L3`tdRJ@X7nx(um5+OV0!#1krZZ1Ip&n=sS*wo-UqvrY}(<#fF6 zzCT&r^Lh3<2;AX&dV59%PUQ1!E)AQ$^WuLA0jL>T?-hk?D-F4Y z!~)XR$Y(u zFZWe<3VIBat_L{>-^Iv|TOJ4%Sbj)WCcO*+iU!p(BqMoX1T`oQPAUZ`8uXD3EYlFY YMy)zZh5JfjPbmzR!Z3q_o(dHGABpst-~a#s diff --git a/test/blockstructure.py b/test/blockstructure.py index b0da8c5c..92f5f3b6 100644 --- a/test/blockstructure.py +++ b/test/blockstructure.py @@ -45,7 +45,8 @@ sk_pick1 = BlockStructure(gf_struct_sumk=SK.gf_struct_sumk, solver_to_sumk=SK.solver_to_sumk, sumk_to_solver=SK.sumk_to_solver, solver_to_sumk_block=SK.solver_to_sumk_block, - deg_shells=SK.deg_shells) + deg_shells=SK.deg_shells, + corr_to_inequiv=SK.corr_to_inequiv) assert sk_pick1 == pick1, 'constructing block structure from SumkDFT properties failed' cmp(pick1.effective_transformation_sumk, diff --git a/test/blockstructure.ref.h5 b/test/blockstructure.ref.h5 index c9eb42303698a3aad0d5067b8d916f9d52d8ea7b..d85903cf04181b46dd7763275e790d8b7ab2196d 100644 GIT binary patch literal 240784 zcmeHw3!EfZS#Kp9pn(7#!lMC&=9vxz=!AgHLuitabPz(5#LzsaHk;k_lHHxo>~5Iw z90Tg0h(iz^5zGh|98t8diVmokxrjRARY!acKId{#N94lXdr=2}Ah)W&|G&HHn>t-p zJyrAQs!n!Jf2Y1WkN^3;|M||TuBvx7uDbdG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`UyC;MC*_a99Q5*E!OC+A{ue?0S*96^u zg~YR8;~o-cw7f>c8UH=&w7;X*!a5`9`Rn^qdc9ZzPMOAw__g+;$r@i%f8)k;y~y+H zozGh*ec$DDtno9g6RnrZ_}J(`)H-nk{6TGr+xvoV+$EsrC))WE@SgqS{KWYqt#zWF zU-mDq+Oh0XaFr-vSvKs8axB7l5-{Q0Cj1K<#YExT%B;iq3qc@$wjB%tks`&Vu`;ma#t8sJTk80~W{g3naXxW#jxO3!bt z#Tvi#>#fJEH{5Ss#`{5S3}BSsy7U{ON5R$AxQ%|%-eD!6@tpXwg!ebHT;e(XsU{Of z49D&Jz54x@Y0W=TcDlYSc3K}%-bMEDlz_HV+FuL!&0gXAy)}NJ*GHd!uESJ)kozP% zQ$dG(&zCr$pJ!>P_qdkdCwf^^?O=O~P$a;0x|Y{y_~CzEJ*)5cHsFs?Bcwm!>+~}$ z`VlSQm1+FxpHBVuU_Z8s0v00ph>KHrudu1!{T@$$vV(@Ex8Kr=HICWUZ|`yaomllp z&BLt^6#nvlx1lWCr{`g!;s)Mh&bn)T`;{M@ubG}S;2Yk;G0R3#P`(?2lZF;6Ym-y8O*2ijVqmol zq6l*(0ounhdfi4i|3{)1SqVe$dv3xW=}(qECiPc=-&wU|+{>juspT~q&g_Oixg5(6 z5Iym}AKV09nZ}KNV)@g9^_Tme^AUV?R8(FYTpsry<|Fusv*nEKOUoxae{MC_IA&M> h`X1N6xySWy?Q#9q>%}tYS&8Q9^9$ Date: Fri, 7 Sep 2018 15:31:41 +0200 Subject: [PATCH 12/35] 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), From ff40e8e0f02055c29887f3391975596cdc3ff830 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Tue, 11 Sep 2018 14:30:17 +0200 Subject: [PATCH 13/35] [doc] block_structure: small fixes --- doc/reference/block_structure.rst | 5 ++-- python/block_structure.py | 49 +++++++++++++++++++++++++++---- 2 files changed, 45 insertions(+), 9 deletions(-) diff --git a/doc/reference/block_structure.rst b/doc/reference/block_structure.rst index ad4004c8..1fe1bebb 100644 --- a/doc/reference/block_structure.rst +++ b/doc/reference/block_structure.rst @@ -9,8 +9,8 @@ The block structure can also be written to and read from HDF files. .. warning:: Do not write the individual elements of this class to a HDF file, - as they belong together and changing one without the other can - result in unexpected results. Always write the BlockStructure + as they belong together and changing one without the other can + result in unexpected results. Always write the BlockStructure object as a whole. Writing the sumk_to_solver and solver_to_sumk elements @@ -19,4 +19,3 @@ The block structure can also be written to and read from HDF files. .. autoclass:: triqs_dft_tools.block_structure.BlockStructure :members: :show-inheritance: - diff --git a/python/block_structure.py b/python/block_structure.py index c9cb03dd..b0ce1228 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -84,6 +84,9 @@ class BlockStructure(object): where the :math:`G_i` are the Green's functions of the block, and the functions :math:`C_i` conjugate their argument if the bool ``conj_i`` is ``True``. + corr_to_inequiv : list + a list where, for each correlated shell, the index of the corresponding + inequivalent correlated shell is given transformation : list of numpy.array or list of dict a list with entries for each ``ish`` giving transformation matrices that are used on the Green's function in ``sumk`` space when before @@ -123,7 +126,7 @@ class BlockStructure(object): """ The structure of the solver Green's function This is returned as a - list (for each shell) + list (for each shell) of lists (for each block) of tuples (block_name, block_indices). @@ -146,7 +149,7 @@ class BlockStructure(object): """ The structure of the sumk Green's function This is returned as a - list (for each shell) + list (for each shell) of lists (for each block) of tuples (block_name, block_indices) @@ -163,7 +166,7 @@ class BlockStructure(object): """ The structure of the solver Green's function This is returned as a - list (for each shell) + list (for each shell) of dictionaries. That is, @@ -177,7 +180,7 @@ class BlockStructure(object): """ The structure of the sumk Green's function This is returned as a - list (for each shell) + list (for each shell) of dictionaries. That is, @@ -191,6 +194,9 @@ class BlockStructure(object): @property def inequiv_to_corr(self): + """ A list mapping an inequivalent correlated shell to a correlated shell + """ + if self.corr_to_inequiv is None: return None N_solver = len(np.unique(self.corr_to_inequiv)) @@ -209,6 +215,12 @@ class BlockStructure(object): @property def effective_transformation_sumk(self): + """ Return the effective transformation matrix + + A list of dicts, one for every correlated shell. In the dict, + there is a transformation matrix (as numpy array) for each + block in sumk space, that is used to transform the block. + """ trans = copy.deepcopy(self.transformation) if self.gf_struct_sumk is None: raise Exception('gf_struct_sumk not set.') @@ -253,6 +265,31 @@ class BlockStructure(object): @property def effective_transformation_solver(self): + """ Return the effective transformation matrix + + A list of dicts, one for every inequivalent correlated shell. + In the dict, there is a transformation matrix (as numpy array) + for each block in solver space, that is used to transform from + the sumk block (see :py:meth:`.solver_to_sumk_block`) to the + solver block. + + + For a solver block ``b`` for inequivalent correlated shell ``ish``, + the corresponding block of the solver Green's function is:: + + # the effective transformation matrix for the block + T = block_structure.effective_transformation_solver[ish][b] + # the index of the correlated shell + icrsh = block_structure.inequiv_to_corr[ish] + # the name of the corresponding sumk block + block_sumk = block_structure.solver_to_sumk_block[icrsh][b] + # transform the Green's function + G_solver[ish][b].from_L_G_R(T, G_sumk[icrsh][block_sumk], T.conjugate().transpose()) + + The functionality of that code block is implemented in + :py:meth:`.convert_gf` (i.e., you don't need to use this directly). + """ + eff_trans_sumk = self.effective_transformation_sumk ets = [] @@ -512,8 +549,8 @@ class BlockStructure(object): ---------- ish : int shell index - If ``space='solver', the index of the of the inequivalent correlated shell, - if ``space='sumk'`, the index of the correlated shell + If ``space='solver'``, the index of the of the inequivalent correlated shell, + if ``space='sumk'``, the index of the correlated shell gf_function : constructor function used to construct the Gf objects constituting the individual blocks; default: GfImFreq From 6a889fab8c237abb11a3e11475c67639ce4b5d32 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Thu, 13 Sep 2018 13:57:54 +0200 Subject: [PATCH 14/35] block_structure: convert_gf with transformation --- python/block_structure.py | 96 +++++++++++++++++++++++---------------- test/blockstructure.py | 24 +++++++++- 2 files changed, 80 insertions(+), 40 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index b0ce1228..6d700d83 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -29,6 +29,7 @@ from pytriqs.gf import GfImFreq, BlockGf from ast import literal_eval import pytriqs.utility.mpi as mpi from warnings import warn +from collections import defaultdict class BlockStructure(object): @@ -209,10 +210,23 @@ class BlockStructure(object): @inequiv_to_corr.setter def inequiv_to_corr(self, value): + # a check for backward compatibility if value is None: return assert self.inequiv_to_corr == value, "Trying to set incompatible inequiv_to_corr" + @property + def sumk_to_solver_block(self): + if self.corr_to_inequiv is None: + return None + ret = [] + for icrsh, ish in enumerate(self.corr_to_inequiv): + d = defaultdict(list) + for block_solver, block_sumk in self.solver_to_sumk_block[ish].iteritems(): + d[block_sumk].append(block_solver) + ret.append(d) + return ret + @property def effective_transformation_sumk(self): """ Return the effective transformation matrix @@ -671,8 +685,6 @@ class BlockStructure(object): options passed to the constructor for the new Gf """ - # TODO: use effective_transformation here - if ish is not None: warn( 'The parameter ish in convert_gf is deprecated. Use ish_from and ish_to instead.') @@ -691,55 +703,61 @@ class BlockStructure(object): G_struct = self if space_from == 'solver': - gf_struct_in = G_struct.gf_struct_solver[ish_from] + gf_struct_from = G_struct.gf_struct_solver[ish_from] + eff_trans_from = G_struct.effective_transformation_solver[ish_from] + block_mapping_from = G_struct.sumk_to_solver_block[ish_from] elif space_from == 'sumk': - gf_struct_in = G_struct.gf_struct_sumk_dict[ish_from] + gf_struct_from = G_struct.gf_struct_sumk_dict[ish_from] + eff_trans_from = {block: np.eye(len(indices)) + for block, indices in G_struct.gf_struct_sumk[ish_from]} + block_mapping_from = {b: [b] for b in gf_struct_from} else: raise Exception( "Argument space_from has to be either 'solver' or 'sumk'.") + if space_to == 'solver': + gf_struct_to = self.gf_struct_solver[ish_to] + eff_trans_to = self.effective_transformation_solver[ish_to] + block_mapping_to = self.solver_to_sumk_block[ish_to] + elif space_to == 'sumk': + gf_struct_to = self.gf_struct_sumk_dict[ish_to] + eff_trans_to = {block: np.eye(len(indices)) + for block, indices in self.gf_struct_sumk_list[ish_to]} + block_mapping_to = {b: b for b in gf_struct_to} + else: + raise Exception( + "Argument space_to has to be either 'solver' or 'sumk'.") + # create a Green's function to hold the result if G_out is None: G_out = self.create_gf(ish=ish_to, space=space_to, **kwargs) else: self.check_gf(G_out, ish=ish_to, space=space_to) - for block in gf_struct_in.keys(): - for i1 in gf_struct_in[block]: - for i2 in gf_struct_in[block]: - if space_from == 'sumk': - i1_sumk = (block, i1) - i2_sumk = (block, i2) - elif space_from == 'solver': - i1_sumk = G_struct.solver_to_sumk[ish_from][(block, i1)] - i2_sumk = G_struct.solver_to_sumk[ish_from][(block, i2)] + for block_to in gf_struct_to.keys(): + block_intermediate = block_mapping_to[block_to] + block_from = block_mapping_from[block_intermediate] + T_to = eff_trans_to[block_to] + g_help = G_out[block_to].copy() + for block in block_from: + T_from = eff_trans_from[block] + g_help.from_L_G_R(np.dot(T_to, np.conjugate(np.transpose(T_from))), + G[block], + np.dot(T_from, np.conjugate(np.transpose(T_to)))) + G_out[block_to] << G_out[block_to] + g_help - if space_to == 'sumk': - i1_sol = i1_sumk - i2_sol = i2_sumk - elif space_to == 'solver': - i1_sol = self.sumk_to_solver[ish_to][i1_sumk] - i2_sol = self.sumk_to_solver[ish_to][i2_sumk] - else: - raise Exception( - "Argument space_to has to be either 'solver' or 'sumk'.") - - if i1_sol[0] is None or i2_sol[0] is None: - if show_warnings: - if mpi.is_master_node(): - warn(('Element {},{} of block {} of G is not present ' + - 'in the new structure').format(i1, i2, block)) - continue - if i1_sol[0] != i2_sol[0]: - if (show_warnings and - np.max(np.abs(G[block][i1, i2].data)) > warning_threshold): - if mpi.is_master_node(): - warn(('Element {},{} of block {} of G is approximated ' + - 'to zero to match the new structure. Max abs value: {}').format( - i1, i2, block, np.max(np.abs(G[block][i1, i2].data)))) - continue - G_out[i1_sol[0]][i1_sol[1], i2_sol[1]] = \ - G[block][i1, i2] + if show_warnings: + # we back-transform it + G_back = G_struct.convert_gf(G_out, self, ish_from=ish_to, + ish_to=ish_from, + show_warnings=False, # else we get an endless loop + space_from=space_to, space_to=space_from, **kwargs) + for name, gf in G_back: + maxdiff = np.max(np.abs(G_back[name].data - G[name].data), + axis=0) + if np.any(maxdiff > warning_threshold): + warn('Block {} maximum difference:\n'.format(name) + + str(maxdiff)) return G_out def approximate_as_diagonal(self): diff --git a/test/blockstructure.py b/test/blockstructure.py index 482bd570..27ff65ab 100644 --- a/test/blockstructure.py +++ b/test/blockstructure.py @@ -2,6 +2,7 @@ from triqs_dft_tools.sumk_dft import * from pytriqs.utility.h5diff import h5diff from pytriqs.gf import * from pytriqs.utility.comparison_tests import assert_block_gfs_are_close +from scipy.linalg import expm from triqs_dft_tools.block_structure import BlockStructure import numpy as np from pytriqs.utility.h5diff import compare, failures @@ -127,7 +128,14 @@ offd = original_bs.copy() offd.approximate_as_diagonal() # check map_gf_struct_solver -G2 = map1.convert_gf(G1, original_bs, beta=40, n_points=3, show_warnings=False) +import warnings +with warnings.catch_warnings(record=True) as w: + G2 = map1.convert_gf(G1, original_bs, beta=40, n_points=3, + show_warnings=True) + assert len(w) == 1 + assert issubclass(w[-1].category, UserWarning) + assert "Block up_1 maximum difference" in str(w[-1].message) + # check full_structure full = BlockStructure.full_structure( @@ -144,6 +152,20 @@ G3 = original_bs.convert_gf(G_sumk, n_points=3) assert_block_gfs_are_close(G1, G3) +# check convert_gf with transformation +# np.random.seed(894892309) +H = np.random.rand(3, 3) + 1.0j * np.random.rand(3, 3) +H = H + H.conjugate().transpose() +T = expm(1.0j * H) +G_T = G_sumk.copy() +for block, gf in G_T: + gf.from_L_G_R(T.conjugate().transpose(), gf, T) +transformed_bs = original_bs.copy() +transformed_bs.transformation = [T] +G_bT = transformed_bs.convert_gf(G_T, None, space_from='sumk', + beta=40, n_points=3) +assert_block_gfs_are_close(G1, G_bT) + assert original_bs.gf_struct_sumk_list ==\ [[('up', [0, 1, 2]), ('down', [0, 1, 2])]] assert original_bs.gf_struct_solver_dict ==\ From 8130d6b9fc907f9d94108ef89158ca69cc5502b6 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Thu, 13 Sep 2018 16:27:12 +0200 Subject: [PATCH 15/35] block_structure: pick_gf_struct_sumk with transformation plus little bug fixes --- python/block_structure.py | 77 ++++++++++++++++++++++++++------------- python/sumk_dft.py | 2 +- test/blockstructure.py | 16 ++++++++ 3 files changed, 68 insertions(+), 27 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index 6d700d83..79812cb0 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -217,10 +217,10 @@ class BlockStructure(object): @property def sumk_to_solver_block(self): - if self.corr_to_inequiv is None: + if self.inequiv_to_corr is None: return None ret = [] - for icrsh, ish in enumerate(self.corr_to_inequiv): + for ish, icrsh in enumerate(self.inequiv_to_corr): d = defaultdict(list) for block_solver, block_sumk in self.solver_to_sumk_block[ish].iteritems(): d[block_sumk].append(block_solver) @@ -252,6 +252,7 @@ class BlockStructure(object): "give one transformation per correlated shell" for icrsh in range(len(trans)): + ish = self.corr_to_inequiv[icrsh] if trans[icrsh] is None: trans[icrsh] = {block: np.eye(len(indices)) for block, indices in self.gf_struct_sumk[icrsh]} @@ -273,7 +274,7 @@ class BlockStructure(object): # zero out all the lines of the transformation that are # not included in gf_struct_solver for iorb, norb in enumerate(self.gf_struct_sumk_dict[icrsh][block]): - if self.sumk_to_solver[icrsh][(block, norb)][0] is None: + if self.sumk_to_solver[ish][(block, norb)][0] is None: trans[icrsh][block][iorb, :] = 0.0 return trans @@ -381,7 +382,7 @@ class BlockStructure(object): deg_shells = [[] for ish in range(len(gf_struct))], corr_to_inequiv = corr_to_inequiv) - def pick_gf_struct_solver(self,new_gf_struct): + def pick_gf_struct_solver(self, new_gf_struct): """ Pick selected orbitals within blocks. This throws away parts of the Green's function that (for some @@ -419,28 +420,28 @@ class BlockStructure(object): gf_struct = new_gf_struct[ish] # create new solver_to_sumk - so2su={} + so2su = {} so2su_block = {} - for blk,idxs in gf_struct.items(): + for blk, idxs in gf_struct.items(): for i in range(len(idxs)): - so2su[(blk,i)]=self.solver_to_sumk[ish][(blk,idxs[i])] - so2su_block[blk]=so2su[(blk,i)][0] + so2su[(blk, i)] = self.solver_to_sumk[ish][(blk, idxs[i])] + so2su_block[blk] = so2su[(blk, i)][0] self.solver_to_sumk[ish] = so2su self.solver_to_sumk_block[ish] = so2su_block # create new sumk_to_solver - for k,v in self.sumk_to_solver[ish].items(): - blk,ind=v + for k, v in self.sumk_to_solver[ish].items(): + blk, ind = v if blk in gf_struct and ind in gf_struct[blk]: new_ind = gf_struct[blk].index(ind) - self.sumk_to_solver[ish][k]=(blk,new_ind) + self.sumk_to_solver[ish][k] = (blk, new_ind) else: - self.sumk_to_solver[ish][k]=(None,None) + self.sumk_to_solver[ish][k] = (None, None) # reindexing gf_struct so that it starts with 0 for k in gf_struct: - gf_struct[k]=range(len(gf_struct[k])) - self.gf_struct_solver[ish]=gf_struct + gf_struct[k] = range(len(gf_struct[k])) + self.gf_struct_solver[ish] = gf_struct - def pick_gf_struct_sumk(self,new_gf_struct): + def pick_gf_struct_sumk(self, new_gf_struct): """ Pick selected orbitals within blocks. This throws away parts of the Green's function that (for some @@ -475,24 +476,46 @@ class BlockStructure(object): However, the indices are not according to the solver Gf but the sumk Gf. """ + eff_trans_sumk = self.effective_transformation_sumk - # TODO: when there is a transformation matrix, this should - # first zero out the corresponding rows of (a copy of) T and then - # pick_gf_struct_solver all lines of (the copy of) T that have at least - # one non-zero entry + assert len(eff_trans_sumk) == len(new_gf_struct),\ + "new_gf_struct has the wrong length" + + new_gf_struct_transformed = copy.deepcopy(new_gf_struct) + + # when there is a transformation matrix, this first zeroes out + # the corresponding rows of (a copy of) T and then applies + # pick_gf_struct_solver for all lines of T that have at least + # one non-zero entry + + for icrsh in range(len(new_gf_struct)): + for block, indices in self.gf_struct_sumk[icrsh]: + if not block in new_gf_struct[icrsh]: + del new_gf_struct_transformed[block] + continue + T = eff_trans_sumk[icrsh][block] + for index in indices: + if not index in new_gf_struct[icrsh][block]: + T[:, index] = 0.0 + new_indices = [] + for index in indices: + if np.any(np.abs(T[index, :]) > 1.e-15): + new_indices.append(index) + new_gf_struct_transformed[icrsh][block] = new_indices gfs = [] # construct gfs, which is the equivalent of new_gf_struct # but according to the solver Gf, by using the sumk_to_solver # mapping - for ish in range(len(new_gf_struct)): + for icrsh in range(len(new_gf_struct_transformed)): + ish = self.corr_to_inequiv[icrsh] gfs.append({}) - for block in new_gf_struct[ish].keys(): - for ind in new_gf_struct[ish][block]: - ind_sol = self.sumk_to_solver[ish][(block,ind)] - if not ind_sol[0] in gfs[ish]: - gfs[ish][ind_sol[0]]=[] - gfs[ish][ind_sol[0]].append(ind_sol[1]) + for block in new_gf_struct_transformed[icrsh].keys(): + for ind in new_gf_struct_transformed[icrsh][block]: + ind_sol = self.sumk_to_solver[ish][(block, ind)] + if not ind_sol[0] in gfs[icrsh]: + gfs[icrsh][ind_sol[0]] = [] + gfs[icrsh][ind_sol[0]].append(ind_sol[1]) self.pick_gf_struct_solver(gfs) def map_gf_struct_solver(self, mapping): @@ -730,6 +753,8 @@ class BlockStructure(object): # create a Green's function to hold the result if G_out is None: + if not 'mesh' in kwargs and not 'beta' in kwargs: + kwargs['mesh'] = G.mesh G_out = self.create_gf(ish=ish_to, space=space_to, **kwargs) else: self.check_gf(G_out, ish=ish_to, space=space_to) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 854ee564..1ae7febb 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -1080,7 +1080,7 @@ class SumkDFT(object): full_structure = BlockStructure.full_structure( [{sp:range(self.corr_shells[self.inequiv_to_corr[ish]]['dim']) for sp in self.spin_block_names[self.corr_shells[self.inequiv_to_corr[ish]]['SO']]} - for ish in range(self.n_inequiv_shells)],None) + for ish in range(self.n_inequiv_shells)],self.corr_to_inequiv) G_transformed = [ self.block_structure.convert_gf(G[ish], full_structure, ish, mesh=G[ish].mesh.copy(), show_warnings=threshold, diff --git a/test/blockstructure.py b/test/blockstructure.py index 27ff65ab..f7a581be 100644 --- a/test/blockstructure.py +++ b/test/blockstructure.py @@ -106,6 +106,22 @@ cmp(pick3.effective_transformation_solver, 'down_0': np.array([[0, 1, 2], [3, 4, 5]])}]) +pick4 = original_bs.copy() +pick4.transformation = [np.array([[0, 1, 0], [1, 0, 0], [0, 0, 1]])] +pick4.pick_gf_struct_sumk([{'up': [1, 2], 'down': [0, 1]}]) +cmp(pick2.gf_struct_sumk, pick4.gf_struct_sumk) +cmp(pick2.gf_struct_solver, pick4.gf_struct_solver) +assert pick4.sumk_to_solver == [{('up', 0): ('up_0', 0), + ('up', 1): (None, None), + ('up', 2): ('up_1', 0), + ('down', 2): (None, None), + ('down', 1): ('down_0', 1), + ('down', 0): ('down_0', 0)}] +assert pick4.solver_to_sumk == [{('up_1', 0): ('up', 2), + ('up_0', 0): ('up', 0), + ('down_0', 0): ('down', 0), + ('down_0', 1): ('down', 1)}] + # check map_gf_struct_solver mapping = [{('down_0', 0): ('down', 0), ('down_0', 1): ('down', 2), From f0b1599379847d5778aeaa18ffafb2ebc86d7c00 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Thu, 13 Sep 2018 17:11:30 +0200 Subject: [PATCH 16/35] SumkDFT: transform in calc_dc --- python/sumk_dft.py | 35 ++++++++++++++++++++--------------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 1ae7febb..03e4cbbb 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -36,9 +36,6 @@ from warnings import warn from scipy import compress from scipy.optimize import minimize -# TODO: check where the transformation in block_structure has to enter -# - DC - class SumkDFT(object): """This class provides a general SumK method for combining ab-initio code and pytriqs.""" @@ -1526,21 +1523,22 @@ class SumkDFT(object): dc_imp : gf_struct_sumk like Double-counting self-energy term. dc_energ : list of floats - Double-counting energy corrections for each correlated shell. + Double-counting energy corrections for each correlated shell. """ self.dc_imp = dc_imp self.dc_energ = dc_energ - def calc_dc(self, dens_mat, orb=0, U_interact=None, J_hund=None, use_dc_formula=0, use_dc_value=None): + def calc_dc(self, dens_mat, orb=0, U_interact=None, J_hund=None, + use_dc_formula=0, use_dc_value=None, transform=True): r""" - Calculates and sets the double counting corrections. + Calculate and set the double counting corrections. If 'use_dc_value' is provided the double-counting term is uniformly initialized with this constant and 'U_interact' and 'J_hund' are ignored. - If 'use_dc_value' is None the correction is evaluated according to + If 'use_dc_value' is None the correction is evaluated according to one of the following formulae: * use_dc_formula = 0: fully-localised limit (FLL) @@ -1558,19 +1556,21 @@ class SumkDFT(object): Parameters ---------- dens_mat : gf_struct_solver like - Density matrix for the specified correlated shell. + Density matrix for the specified correlated shell. orb : int, optional - Index of an inequivalent shell. + Index of an inequivalent shell. U_interact : float, optional - Value of interaction parameter `U`. + Value of interaction parameter `U`. J_hund : float, optional - Value of interaction parameter `J`. + Value of interaction parameter `J`. use_dc_formula : int, optional - Type of double-counting correction (see description). + Type of double-counting correction (see description). use_dc_value : float, optional - Value of the double-counting correction. If specified - `U_interact`, `J_hund` and `use_dc_formula` are ignored. - + Value of the double-counting correction. If specified + `U_interact`, `J_hund` and `use_dc_formula` are ignored. + transform : bool + whether or not to use the transformation in block_structure + to transform the dc """ for icrsh in range(self.n_corr_shells): @@ -1651,6 +1651,11 @@ class SumkDFT(object): mpi.report( "DC for shell %(icrsh)i = %(use_dc_value)f" % locals()) mpi.report("DC energy = %s" % self.dc_energ[icrsh]) + if transform: + for sp in spn: + T = self.block_structure.effective_transformation_sumk[icrsh][sp] + self.dc_imp[icrsh][sp] = numpy.dot(T.conjugate().transpose(), + numpy.dot(self.dc_imp[icrsh][sp], T)) def add_dc(self, iw_or_w="iw"): r""" From 8e4c923d21a50f6598ffd2bf3a7dfbb0dafd3002 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Mon, 17 Sep 2018 13:32:50 +0200 Subject: [PATCH 17/35] [block_structure] create_matrix etc. --- python/block_structure.py | 195 ++++++++++++++++++++++++++++++++------ python/sumk_dft.py | 5 + test/blockstructure.py | 16 ++++ 3 files changed, 189 insertions(+), 27 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index 79812cb0..f7f3317c 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -598,6 +598,36 @@ class BlockStructure(object): blocks """ + return self._create_gf_or_matrix(ish, gf_function, BlockGf, space, **kwargs) + + def create_matrix(self, ish=0, space='solver', dtype=np.complex_): + """ Create a zero matrix having the correct structure. + + For ``space='solver'``, the structure is according to + ``gf_struct_solver``, else according to ``gf_struct_sumk``. + + Parameters + ---------- + ish : int + shell index + If ``space='solver'``, the index of the of the inequivalent correlated shell, + if ``space='sumk'``, the index of the correlated shell + space : 'solver' or 'sumk' + which space the structure should correspond to + """ + + def gf_function(indices): + return np.zeros((len(indices), len(indices)), dtype=dtype) + + def block_function(name_list, block_list): + d = dict() + for i in range(len(name_list)): + d[name_list[i]] = block_list[i] + return d + + return self._create_gf_or_matrix(ish, gf_function, block_function, space) + + def _create_gf_or_matrix(self, ish=0, gf_function=GfImFreq, block_function=BlockGf, space='solver', **kwargs): if space == 'solver': gf_struct = self.gf_struct_solver elif space == 'sumk': @@ -611,7 +641,7 @@ class BlockStructure(object): for n in names: G = gf_function(indices=gf_struct[ish][n], **kwargs) blocks.append(G) - G = BlockGf(name_list=names, block_list=blocks) + G = block_function(name_list=names, block_list=blocks) return G def check_gf(self, G, ish=None, space='solver'): @@ -636,6 +666,34 @@ class BlockStructure(object): which space the structure should correspond to """ + return self._check_gf_or_matrix(G, ish, space) + + def check_matrix(self, G, ish=None, space='solver'): + """ check whether the matrix G has the right structure + + This throws an error if the structure of G is not the same + as ``gf_struct_solver`` (for ``space=solver``) or + ``gf_struct_sumk`` (for ``space=sumk``).. + + Parameters + ---------- + G : dict of matrices or list of dict of matrices + matrix to check + if it is a list, there should be as many entries as there + are shells, and the check is performed for all shells (unless + ish is given). + ish : int + shell index + default: 0 if G is just one matrix is given, + check all if list of dicts is given + space : 'solver' or 'sumk' + which space the structure should correspond to + """ + + return self._check_gf_or_matrix(G, ish, space) + + def _check_gf_or_matrix(self, G, ish=None, space='solver'): + if space == 'solver': gf_struct = self.gf_struct_solver elif space == 'sumk': @@ -658,16 +716,28 @@ class BlockStructure(object): if ish is None: ish = 0 - for block in gf_struct[ish]: - assert block in G.indices,\ - "block " + block + " not in G (shell {})".format(ish) - for block, gf in G: - assert block in gf_struct[ish],\ - "block " + block + " not in struct (shell {})".format(ish) - assert list(gf.indices) == 2 * [map(str, gf_struct[ish][block])],\ - "block " + block + " has wrong indices (shell {})".format(ish) + if isinstance(G, BlockGf): + for block in gf_struct[ish]: + assert block in G.indices,\ + "block " + block + " not in G (shell {})".format(ish) + for block, gf in G: + assert block in gf_struct[ish],\ + "block " + block + " not in struct (shell {})".format(ish) + assert list(gf.indices) == 2 * [map(str, gf_struct[ish][block])],\ + "block " + block + \ + " has wrong indices (shell {})".format(ish) + else: + for block in gf_struct[ish]: + assert block in G,\ + "block " + block + " not in G (shell {})".format(ish) + for block, gf in G.iteritems(): + assert block in gf_struct[ish],\ + "block " + block + " not in struct (shell {})".format(ish) + assert range(len(gf)) == 2 * [map(str, gf_struct[ish][block])],\ + "block " + block + \ + " has wrong indices (shell {})".format(ish) - def convert_gf(self, G, G_struct, ish_from=0, ish_to=None, show_warnings=True, + def convert_gf(self, G, G_struct=None, ish_from=0, ish_to=None, show_warnings=True, G_out=None, space_from='solver', space_to='solver', ish=None, **kwargs): """ Convert BlockGf from its structure to this structure. @@ -714,6 +784,56 @@ class BlockStructure(object): ish_from = ish ish_to = ish + return self._convert_gf_or_matrix(G, G_struct, ish_from, ish_to, + show_warnings, G_out, space_from, space_to, **kwargs) + + def convert_matrix(self, G, G_struct=None, ish_from=0, ish_to=None, show_warnings=True, + G_out=None, space_from='solver', space_to='solver'): + """ Convert matrix from its structure to this structure. + + .. warning:: + + Elements that are zero in the new structure due to + the new block structure will be just ignored, thus + approximated to zero. + + Parameters + ---------- + G : dict of numpy array + the matrix that should be converted + G_struct : BlockStructure or str + the structure of that G or None (then, this structure + is used) + ish_from : int + shell index of the input structure + ish_to : int + shell index of the output structure; if None (the default), + it is the same as ish_from + show_warnings : bool or float + whether to show warnings when elements of the Green's + function get thrown away + if float, set the threshold for the magnitude of an element + about to be thrown away to trigger a warning + (default: 1.e-10) + G_out : dict of numpy array + the output numpy array (if not given, a new one is + created) + space_from : 'solver' or 'sumk' + whether the matrix ``G`` corresponds to the + solver or sumk structure of ``G_struct`` + space_to : 'solver' or 'sumk' + whether the output matrix should be according to + the solver of sumk structure of this structure + **kwargs : + options passed to the constructor for the new Gf + """ + + return self._convert_gf_or_matrix(G, G_struct, ish_from, ish_to, + show_warnings, G_out, space_from, space_to) + + def _convert_gf_or_matrix(self, G, G_struct=None, ish_from=0, ish_to=None, show_warnings=True, + G_out=None, space_from='solver', space_to='solver', **kwargs): + if ish_to is None: ish_to = ish_from @@ -751,35 +871,56 @@ class BlockStructure(object): raise Exception( "Argument space_to has to be either 'solver' or 'sumk'.") - # create a Green's function to hold the result - if G_out is None: - if not 'mesh' in kwargs and not 'beta' in kwargs: - kwargs['mesh'] = G.mesh - G_out = self.create_gf(ish=ish_to, space=space_to, **kwargs) + if isinstance(G, BlockGf): + # create a Green's function to hold the result + if G_out is None: + if not 'mesh' in kwargs and not 'beta' in kwargs: + kwargs['mesh'] = G.mesh + G_out = self.create_gf(ish=ish_to, space=space_to, **kwargs) + else: + self.check_gf(G_out, ish=ish_to, space=space_to) + elif isinstance(G, dict): + if G_out is None: + G_out = self.create_matrix(ish=ish_to, space=space_to) + else: + self.check_matrix(G_out, ish=ish_to, space=space_to) else: - self.check_gf(G_out, ish=ish_to, space=space_to) + raise Exception('G is neither BlockGf nor dict.') for block_to in gf_struct_to.keys(): + if isinstance(G, BlockGf): + G_out[block_to].zero() + else: + G_out[block_to][:] = 0.0 block_intermediate = block_mapping_to[block_to] block_from = block_mapping_from[block_intermediate] T_to = eff_trans_to[block_to] g_help = G_out[block_to].copy() for block in block_from: T_from = eff_trans_from[block] - g_help.from_L_G_R(np.dot(T_to, np.conjugate(np.transpose(T_from))), - G[block], - np.dot(T_from, np.conjugate(np.transpose(T_to)))) - G_out[block_to] << G_out[block_to] + g_help + if isinstance(G, BlockGf): + g_help.from_L_G_R(np.dot(T_to, np.conjugate(np.transpose(T_from))), + G[block], + np.dot(T_from, np.conjugate(np.transpose(T_to)))) + G_out[block_to] << G_out[block_to] + g_help + else: + g_help = np.dot(np.dot(T_to, np.conjugate(np.transpose(T_from))), + np.dot(G[block], + np.dot(T_from, np.conjugate(np.transpose(T_to))))) + G_out[block_to] += g_help if show_warnings: # we back-transform it - G_back = G_struct.convert_gf(G_out, self, ish_from=ish_to, - ish_to=ish_from, - show_warnings=False, # else we get an endless loop - space_from=space_to, space_to=space_from, **kwargs) - for name, gf in G_back: - maxdiff = np.max(np.abs(G_back[name].data - G[name].data), - axis=0) + G_back = G_struct._convert_gf_or_matrix(G_out, self, ish_from=ish_to, + ish_to=ish_from, + show_warnings=False, # else we get an endless loop + space_from=space_to, space_to=space_from, **kwargs) + for name, gf in (G_back if isinstance(G, BlockGf) else G_back.iteritems()): + if isinstance(G, BlockGf): + maxdiff = np.max(np.abs(G_back[name].data - G[name].data), + axis=0) + else: + maxdiff = G_back[name] - G[name] if np.any(maxdiff > warning_threshold): warn('Block {} maximum difference:\n'.format(name) + str(maxdiff)) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 03e4cbbb..4fb912a8 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -776,6 +776,9 @@ class SumkDFT(object): ------- G_out """ + + assert isinstance(G_loc, list), "G_loc must be a list (with elements for each correlated shell)" + if G_out is None: G_out = [self.block_structure.create_gf(ish=ish, mesh=G_loc[self.inequiv_to_corr[ish]].mesh) for ish in range(self.n_inequiv_shells)] @@ -1009,6 +1012,8 @@ class SumkDFT(object): the Green's function transformed into the new block structure """ + assert isinstance(G, list), "G must be a list (with elements for each correlated shell)" + gf = self._get_hermitian_quantity_from_gf(G) # initialize the variables diff --git a/test/blockstructure.py b/test/blockstructure.py index f7a581be..30aec6f6 100644 --- a/test/blockstructure.py +++ b/test/blockstructure.py @@ -31,6 +31,15 @@ cmp(original_bs.effective_transformation_solver, 'down_0': np.array([[1., 0., 0.], [0., 1., 0.]])}]) +created_matrix = original_bs.create_matrix() +cmp(created_matrix, + {'up_0': np.array([[0. + 0.j, 0. + 0.j], + [0. + 0.j, 0. + 0.j]]), + 'up_1': np.array([[0. + 0.j]]), + 'down_1': np.array([[0. + 0.j]]), + 'down_0': np.array([[0. + 0.j, 0. + 0.j], + [0. + 0.j, 0. + 0.j]])}) + # check pick_gf_struct_solver pick1 = original_bs.copy() @@ -152,6 +161,13 @@ with warnings.catch_warnings(record=True) as w: assert issubclass(w[-1].category, UserWarning) assert "Block up_1 maximum difference" in str(w[-1].message) +m2 = map1.convert_matrix(created_matrix, original_bs, show_warnings=True) +cmp(m2, + {'down': np.array([[0. + 0.j, 0. + 0.j, 0. + 0.j], + [0. + 0.j, 0. + 0.j, 0. + 0.j], + [0. + 0.j, 0. + 0.j, 0. + 0.j]]), + 'up_0': np.array([[0. + 0.j]]), + 'down_1': np.array([[0. + 0.j]])}) # check full_structure full = BlockStructure.full_structure( From 1705e5268f2915592cdf15a32ed09ec4abec6d38 Mon Sep 17 00:00:00 2001 From: "Gernot J. Kraberger" <16017581+gkraberger@users.noreply.github.com> Date: Thu, 7 Feb 2019 14:09:18 +0100 Subject: [PATCH 18/35] blockstructure: adapt deg_shells in pick --- python/block_structure.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/python/block_structure.py b/python/block_structure.py index f7f3317c..fd34c48a 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -436,6 +436,24 @@ class BlockStructure(object): self.sumk_to_solver[ish][k] = (blk, new_ind) else: self.sumk_to_solver[ish][k] = (None, None) + # adapt deg_shells + if self.deg_shells is not None: + for degsh in self.deg_shells[ish]: + for key in degsh.keys(): + if isinstance(degsh, dict): + if not key in gf_struct: + del degsh[key] + continue + if gf_struct[key] != self.gf_struct_solver[ish][key]: + v, C = degsh[key] + degsh[key][0] = \ + v[gf_struct[key], :][:, gf_struct[key]] + warn( + 'Removing shells from degenerate shell {}. Cannot guarantee that they continue to be equivalent.') + else: + if not key in gf_struct: + degsh.remove(key) + continue # reindexing gf_struct so that it starts with 0 for k in gf_struct: gf_struct[k] = range(len(gf_struct[k])) From 51275c772d5411324e47ae963802d569a5fbfafa Mon Sep 17 00:00:00 2001 From: Hermann Ulrich Schnait Date: Tue, 4 Jun 2019 16:48:23 +0200 Subject: [PATCH 19/35] Bugfix in Blockstructure Test --- python/block_structure.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index fd34c48a..7563c224 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -439,8 +439,8 @@ class BlockStructure(object): # adapt deg_shells if self.deg_shells is not None: for degsh in self.deg_shells[ish]: - for key in degsh.keys(): - if isinstance(degsh, dict): + if isinstance(degsh, dict): + for key in degsh.keys(): if not key in gf_struct: del degsh[key] continue @@ -450,7 +450,8 @@ class BlockStructure(object): v[gf_struct[key], :][:, gf_struct[key]] warn( 'Removing shells from degenerate shell {}. Cannot guarantee that they continue to be equivalent.') - else: + else: # degshell is list + for key in degsh: if not key in gf_struct: degsh.remove(key) continue From 743ff09cac3cc19b2dd59f22447fb21c81c8ad71 Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Wed, 5 Jun 2019 09:24:53 +0200 Subject: [PATCH 20/35] Changed 'orb' parameter to 'ish' for consistency --- python/sumk_dft.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 4fb912a8..d3f5ebea 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -1692,7 +1692,7 @@ class SumkDFT(object): return sigma_minus_dc - def symm_deg_gf(self, gf_to_symm, orb): + def symm_deg_gf(self, gf_to_symm, ish=0): r""" Averages a GF over degenerate shells. @@ -1704,8 +1704,8 @@ class SumkDFT(object): ---------- gf_to_symm : gf_struct_solver like Input and output GF (i.e., it gets overwritten) - orb : int - Index of an inequivalent shell. + ish : int + Index of an inequivalent shell. (default value 0) """ @@ -1713,7 +1713,7 @@ class SumkDFT(object): # an h5 file, self.deg_shells might be None if self.deg_shells is None: return - for degsh in self.deg_shells[orb]: + for degsh in self.deg_shells[ish]: # ss will hold the averaged orbitals in the basis where the # blocks are all equal # i.e. maybe_conjugate(v^dagger gf v) From 3d0adafad27bb09203907deb7c65943d40de0eb3 Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Wed, 5 Jun 2019 11:43:00 +0200 Subject: [PATCH 21/35] Modified test-reference files to changed degshells when picking gf-struct --- test/blockstructure.in.h5 | Bin 67352 -> 67352 bytes test/blockstructure.ref.h5 | Bin 240784 -> 240784 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/test/blockstructure.in.h5 b/test/blockstructure.in.h5 index 7e03651c9fa5b68fa3be4e9480d8a2a236ed296c..f4d2cada3e2ec1a058b2848f6dc39fe9cfd6e882 100644 GIT binary patch delta 47 zcmV+~0MP%Kjs%#F1h62Kv%t3y0+TS77?Thh5VKg8W)cAblfS4bvtTDc0h3^;GP7E$ FzFfCz5{du- delta 53 zcmV-50LuTEjs%#F1h62K0T8jV2Lh8&fe4c@mKc-ZkxsLgmM9Vd0+YX}DU*;82m%1A Lv9S&TvZ@$e9gY*s diff --git a/test/blockstructure.ref.h5 b/test/blockstructure.ref.h5 index d85903cf04181b46dd7763275e790d8b7ab2196d..74857307853722ac906bdc6a2acc24abf214744f 100644 GIT binary patch delta 107 zcmbPmlW)RJzJ?aYEld@cw>Lau6kwX(ag|A8vcf5W={rIgJ+}Y2$|T1$S?@L1bcGvC z3L6hdFiw7OG-~^%n@n=0Pz?_Pn86yha|ANWF@n_^1TllvPJgh1IePoyVCJ(C0BeUU AV*mgE delta 117 zcmbPmlW)RJzJ?aYEld@cw;Mz<3NTIYxXL6k{lO{5i0wbFGRZMbu9M=Lu5g1%VY-7j zBPY{Mri~kU87DtD8nu1XO(wZgsHO)2%o39~JPDZY5y*TGti>RRSz&U3B_~rbGf2nu P2P>GPw;v8>J{ti5g~Tkk From ba79a7f7086c07a63de5ed1afba5e3445ef42c7a Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Wed, 5 Jun 2019 12:10:12 +0200 Subject: [PATCH 22/35] Modified map_gf_struct to remove degshells + update test case --- python/block_structure.py | 1 + test/blockstructure.ref.h5 | Bin 240784 -> 240784 bytes 2 files changed, 1 insertion(+) diff --git a/python/block_structure.py b/python/block_structure.py index 7563c224..b7ea824f 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -591,6 +591,7 @@ class BlockStructure(object): self.solver_to_sumk[ish] = so2su self.sumk_to_solver[ish] = su2so self.solver_to_sumk_block[ish] = so2su_block + self.deg_shells[ish] = [] def create_gf(self, ish=0, gf_function=GfImFreq, space='solver', **kwargs): """ Create a zero BlockGf having the correct structure. diff --git a/test/blockstructure.ref.h5 b/test/blockstructure.ref.h5 index 74857307853722ac906bdc6a2acc24abf214744f..4b2ab4040bfde95433a1fbdb888e0b7d8734ae82 100644 GIT binary patch delta 49 zcmbPmlW)RJzJ@J~-+U*3J0-RK$0BA9rpXN#1*U5RFiK2caFxlgy)S?fh?%zc1u!$k F001_66m0+i delta 47 zcmbPmlW)RJzJ@J~-+U+gF-tLh2-&U`$tcD&T_b=|V(JE_i1rx)j6lq^eMSKDk7xk1 CHxZiv From 187499b00f72157b6501e90cf738b2209ebac70a Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Wed, 5 Jun 2019 16:24:38 +0200 Subject: [PATCH 23/35] Bugfixes in block_structure --- python/block_structure.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index b7ea824f..e5659b49 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -451,10 +451,11 @@ class BlockStructure(object): warn( 'Removing shells from degenerate shell {}. Cannot guarantee that they continue to be equivalent.') else: # degshell is list - for key in degsh: + degsh1 = copy.deepcopy(degsh) # in order to not remove a key while iterating + for key in degsh1: if not key in gf_struct: + warn('Removing shells from degenerate shell {}.') degsh.remove(key) - continue # reindexing gf_struct so that it starts with 0 for k in gf_struct: gf_struct[k] = range(len(gf_struct[k])) @@ -510,7 +511,7 @@ class BlockStructure(object): for icrsh in range(len(new_gf_struct)): for block, indices in self.gf_struct_sumk[icrsh]: if not block in new_gf_struct[icrsh]: - del new_gf_struct_transformed[block] + #del new_gf_struct_transformed[block] # this MUST be wrong, as new_gf_struct_transformed needs to have a integer index for icrsh... # error when index is not kept at all continue T = eff_trans_sumk[icrsh][block] for index in indices: From 159ee1166eaeba8be14a87ff86d8b98cd595a9a7 Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Tue, 18 Jun 2019 09:59:45 +0200 Subject: [PATCH 24/35] Thread show_warnings through to extract_gloc in SK --- python/sumk_dft.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index d3f5ebea..db914cd9 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -667,7 +667,7 @@ class SumkDFT(object): return Sigma_out def extract_G_loc(self, mu=None, iw_or_w='iw', with_Sigma=True, with_dc=True, broadening=None, - transform_to_solver_blocks=True): + transform_to_solver_blocks=True, show_warnings=True): r""" Extracts the local downfolded Green function by the Brillouin-zone integration of the lattice Green's function. @@ -686,6 +686,9 @@ class SumkDFT(object): transform_to_solver_blocks : bool, optional If True (default), the returned G_loc will be transformed to the block structure ``gf_struct_solver``, else it will be in ``gf_struct_sumk``. + show_warnings : bool, optional + Displays warning messages during transformation + (Only effective if transform_to_solver_blocks = True Returns ------- @@ -753,11 +756,11 @@ class SumkDFT(object): icrsh, gf, direction='toLocal') if transform_to_solver_blocks: - return self.transform_to_solver_blocks(G_loc) + return self.transform_to_solver_blocks(G_loc, show_warnings=show_warnings) return G_loc - def transform_to_solver_blocks(self, G_loc, G_out=None): + def transform_to_solver_blocks(self, G_loc, G_out=None, show_warnings = True): """ transform G_loc from sumk to solver space Parameters @@ -794,7 +797,8 @@ class SumkDFT(object): ish_from=self.inequiv_to_corr[ish], ish_to=ish, space_from='sumk', - G_out=G_out[ish]) + G_out=G_out[ish], + show_warnings = show_warnings) # return only the inequivalent shells: return G_out From 32356a06baf4c01d7ca9465cdb68e709b39c0b13 Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Tue, 18 Jun 2019 14:57:19 +0200 Subject: [PATCH 25/35] Calculate diagonalization in solver blocks --- python/block_structure.py | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/python/block_structure.py b/python/block_structure.py index e5659b49..3062956f 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -942,9 +942,23 @@ class BlockStructure(object): axis=0) else: maxdiff = G_back[name] - G[name] - if np.any(maxdiff > warning_threshold): + + if space_to == 'solver': # do comparison in solver (ignore diff. in ignored orbitals) + maxdiff = G_struct._convert_gf_or_matrix({'ud':maxdiff}, self, ish_from=ish_from, + ish_to=ish_to, + show_warnings=False, + space_from=space_from, space_to=space_to, **kwargs) + + for block in maxdiff: + maxdiff_b = maxdiff[block] + if np.any(maxdiff_b > warning_threshold): + warn('Block {} maximum difference:\n'.format(name) + str(maxdiff)) + + + elif np.any(maxdiff > warning_threshold): warn('Block {} maximum difference:\n'.format(name) + str(maxdiff)) + return G_out def approximate_as_diagonal(self): From 6623a397392f87175c51a32e1529567151afade3 Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Tue, 18 Jun 2019 14:57:46 +0200 Subject: [PATCH 26/35] Display transformation warnings only for relevant (solver) blocks --- python/trans_basis.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/trans_basis.py b/python/trans_basis.py index 91a014a5..ef573efc 100644 --- a/python/trans_basis.py +++ b/python/trans_basis.py @@ -48,7 +48,7 @@ class TransBasis: self.T = copy.deepcopy(self.SK.T[0]) self.w = numpy.identity(SK.corr_shells[0]['dim']) - def calculate_diagonalisation_matrix(self, prop_to_be_diagonal='eal'): + def calculate_diagonalisation_matrix(self, prop_to_be_diagonal='eal', calc_in_solver_blocks = False): """ Calculates the diagonalisation matrix w, and stores it as member of the class. @@ -76,6 +76,13 @@ class TransBasis: "trans_basis: not a valid quantitiy to be diagonal. Choices are 'eal' or 'dm'.") return 0 + if calc_in_solver_blocks: + trafo = self.SK.block_structure.transformation + self.SK.block_structre.transform = None + prop_solver = self.SK.block_structre.convert_matrix(prop, space_from='sumk', space_to='solver') + prop = self.SK.block_structre.convert_matrix(prop_solver, space_from='solver', space_to='sumk') + self.SK.block_structre.transform = trafo + if self.SK.SO == 0: self.eig, self.w = numpy.linalg.eigh(prop['up']) # calculate new Transformation matrix From a44f3d36f4f089254cb6a154e5287afd12ef6cc4 Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Tue, 18 Jun 2019 16:35:25 +0200 Subject: [PATCH 27/35] Reworked Diagonalization function to ignore 'picked out' obitals (e.g. egs) --- python/trans_basis.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/python/trans_basis.py b/python/trans_basis.py index ef573efc..f00140d6 100644 --- a/python/trans_basis.py +++ b/python/trans_basis.py @@ -78,10 +78,15 @@ class TransBasis: if calc_in_solver_blocks: trafo = self.SK.block_structure.transformation - self.SK.block_structre.transform = None - prop_solver = self.SK.block_structre.convert_matrix(prop, space_from='sumk', space_to='solver') - prop = self.SK.block_structre.convert_matrix(prop_solver, space_from='solver', space_to='sumk') - self.SK.block_structre.transform = trafo + self.SK.block_structure.transform = None + prop_solver = self.SK.block_structure.convert_matrix(prop, space_from='sumk', space_to='solver') + v= [] + for name in prop_solver: + v[name] = numpy.linalg.eigh(prop_solver[name])[1] + self.w = self.SK.block_structure.convert_matrix(v, space_from='solver', space_to='sumk')['ud' if self.SK.SO else 'up'] + self.T = numpy.dot(self.T.transpose().conjugate(), + self.w).conjugate().transpose() + self.SK.block_structure.transform = trafo if self.SK.SO == 0: self.eig, self.w = numpy.linalg.eigh(prop['up']) From d66950a043fad7507fe8f1a81edf8c4c9d6829b7 Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Tue, 18 Jun 2019 16:53:23 +0200 Subject: [PATCH 28/35] Remove show_warning again as it is not necessary anymore --- python/sumk_dft.py | 52 +++++++++++++++++++++------------------------- 1 file changed, 24 insertions(+), 28 deletions(-) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index db914cd9..8da2751e 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -52,11 +52,11 @@ class SumkDFT(object): hdf_file : string Name of hdf5 containing the data. h_field : scalar, optional - The value of magnetic field to add to the DFT Hamiltonian. + The value of magnetic field to add to the DFT Hamiltonian. The contribution -h_field*sigma is added to diagonal elements of the Hamiltonian. It cannot be used with the spin-orbit coupling on; namely h_field is set to 0 if self.SO=True. use_dft_blocks : boolean, optional - If True, the local Green's function matrix for each spin is divided into smaller blocks + If True, the local Green's function matrix for each spin is divided into smaller blocks with the block structure determined from the DFT density matrix of the corresponding correlated shell. Alternatively and additionally, the block structure can be analysed using :meth:`analyse_block_structure ` @@ -64,7 +64,7 @@ class SumkDFT(object): dft_data : string, optional Name of hdf5 subgroup in which DFT data for projector and lattice Green's function construction are stored. symmcorr_data : string, optional - Name of hdf5 subgroup in which DFT data on symmetries of correlated shells + Name of hdf5 subgroup in which DFT data on symmetries of correlated shells (symmetry operations, permutaion matrices etc.) are stored. parproj_data : string, optional Name of hdf5 subgroup in which DFT data on non-normalized projectors for non-correlated @@ -291,10 +291,10 @@ class SumkDFT(object): bname : string Block name of the target block of the lattice Green's function. - gf_to_downfold : Gf + gf_to_downfold : Gf Block of the Green's function that is to be downfolded. - gf_inp : Gf - FIXME + gf_inp : Gf + FIXME shells : string, optional - if shells='corr': orthonormalized projectors for correlated shells are used for the downfolding. @@ -343,10 +343,10 @@ class SumkDFT(object): bname : string Block name of the target block of the lattice Green's function. - gf_to_upfold : Gf + gf_to_upfold : Gf Block of the Green's function that is to be upfolded. - gf_inp : Gf - FIXME + gf_inp : Gf + FIXME shells : string, optional - if shells='corr': orthonormalized projectors for correlated shells are used for the upfolding. @@ -391,10 +391,10 @@ class SumkDFT(object): - if shells='corr': ish labels all correlated shells (equivalent or not) - if shells='all': ish labels only representative (inequivalent) non-correlated shells - gf_to_rotate : Gf + gf_to_rotate : Gf Block of the Green's function that is to be rotated. direction : string - The direction of rotation can be either + The direction of rotation can be either - 'toLocal' : global -> local transformation, - 'toGlobal' : local -> global transformation. @@ -444,7 +444,7 @@ class SumkDFT(object): def lattice_gf(self, ik, mu=None, iw_or_w="iw", beta=40, broadening=None, mesh=None, with_Sigma=True, with_dc=True): r""" - Calculates the lattice Green function for a given k-point from the DFT Hamiltonian and the self energy. + Calculates the lattice Green function for a given k-point from the DFT Hamiltonian and the self energy. Parameters ---------- @@ -467,7 +467,7 @@ class SumkDFT(object): Data defining mesh on which the real-axis GF will be calculated, given in the form (om_min,om_max,n_points), where om_min is the minimum omega, om_max is the maximum omega and n_points is the number of points. with_Sigma : boolean, optional - If True the GF will be calculated with the self-energy stored in self.Sigmaimp_(w/iw), for real/Matsubara GF, respectively. + If True the GF will be calculated with the self-energy stored in self.Sigmaimp_(w/iw), for real/Matsubara GF, respectively. In this case the mesh is taken from the self.Sigma_imp object. If with_Sigma=True but self.Sigmaimp_(w/iw) is not present, with_Sigma is reset to False. with_dc : boolean, optional @@ -667,7 +667,7 @@ class SumkDFT(object): return Sigma_out def extract_G_loc(self, mu=None, iw_or_w='iw', with_Sigma=True, with_dc=True, broadening=None, - transform_to_solver_blocks=True, show_warnings=True): + transform_to_solver_blocks=True): r""" Extracts the local downfolded Green function by the Brillouin-zone integration of the lattice Green's function. @@ -686,9 +686,6 @@ class SumkDFT(object): transform_to_solver_blocks : bool, optional If True (default), the returned G_loc will be transformed to the block structure ``gf_struct_solver``, else it will be in ``gf_struct_sumk``. - show_warnings : bool, optional - Displays warning messages during transformation - (Only effective if transform_to_solver_blocks = True Returns ------- @@ -756,11 +753,11 @@ class SumkDFT(object): icrsh, gf, direction='toLocal') if transform_to_solver_blocks: - return self.transform_to_solver_blocks(G_loc, show_warnings=show_warnings) + return self.transform_to_solver_blocks(G_loc) return G_loc - def transform_to_solver_blocks(self, G_loc, G_out=None, show_warnings = True): + def transform_to_solver_blocks(self, G_loc, G_out=None): """ transform G_loc from sumk to solver space Parameters @@ -797,16 +794,15 @@ class SumkDFT(object): ish_from=self.inequiv_to_corr[ish], ish_to=ish, space_from='sumk', - G_out=G_out[ish], - show_warnings = show_warnings) + G_out=G_out[ish]) # return only the inequivalent shells: return G_out def analyse_block_structure(self, threshold=0.00001, include_shells=None, dm=None, hloc=None): r""" - Determines the block structure of local Green's functions by analysing the structure of - the corresponding density matrices and the local Hamiltonian. The resulting block structures + Determines the block structure of local Green's functions by analysing the structure of + the corresponding density matrices and the local Hamiltonian. The resulting block structures for correlated shells are stored in the :class:`SumkDFT.block_structure ` attribute. Parameters @@ -969,7 +965,7 @@ class SumkDFT(object): else: return w-w0 gf = [BlockGf(name_block_generator = [(name, GfReFreq( - window=(-numpy.pi*(len(block.mesh)-1) / (len(block.mesh)*get_delta_from_mesh(block.mesh)), + window=(-numpy.pi*(len(block.mesh)-1) / (len(block.mesh)*get_delta_from_mesh(block.mesh)), numpy.pi*(len(block.mesh)-1) / (len(block.mesh)*get_delta_from_mesh(block.mesh))), n_points=len(block.mesh), indices=block.indices)) for name, block in g_sh], make_copies=False) for g_sh in G] @@ -1348,7 +1344,7 @@ class SumkDFT(object): - if 'using_point_integration': Only works for diagonal hopping matrix (true in wien2k). beta : float, optional - Inverse temperature. + Inverse temperature. Returns ------- @@ -1756,7 +1752,7 @@ class SumkDFT(object): def total_density(self, mu=None, iw_or_w="iw", with_Sigma=True, with_dc=True, broadening=None): r""" - Calculates the total charge within the energy window for a given chemical potential. + Calculates the total charge within the energy window for a given chemical potential. The chemical potential is either given by parameter `mu` or, if it is not specified, taken from `self.chemical_potential`. @@ -1773,7 +1769,7 @@ class SumkDFT(object): with - .. math:: n(k) = Tr G_{\nu\nu'}(k, i\omega_{n}). + .. math:: n(k) = Tr G_{\nu\nu'}(k, i\omega_{n}). The calculation is done in the global coordinate system, if distinction is made between local/global. @@ -2064,7 +2060,7 @@ class SumkDFT(object): return dc def check_projectors(self): - """Calculated the density matrix from projectors (DM = P Pdagger) to check that it is correct and + """Calculated the density matrix from projectors (DM = P Pdagger) to check that it is correct and specifically that it matches DFT.""" dens_mat = [numpy.zeros([self.corr_shells[icrsh]['dim'], self.corr_shells[icrsh]['dim']], numpy.complex_) for icrsh in range(self.n_corr_shells)] From 810b315c92e44a735b893ef0a3a7b4148a023a4a Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Tue, 18 Jun 2019 16:53:44 +0200 Subject: [PATCH 29/35] Fixing TransBasis --- python/trans_basis.py | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/python/trans_basis.py b/python/trans_basis.py index f00140d6..7bd2ee4e 100644 --- a/python/trans_basis.py +++ b/python/trans_basis.py @@ -60,6 +60,10 @@ class TransBasis: - 'eal' : local hamiltonian (i.e. crystal field) - 'dm' : local density matrix + calc_in_solver_blocks : bool, optional + Whether the property shall be diagonalized in the + full sumk structure, or just in the solver structure. + Returns ------- wsqr : double @@ -78,26 +82,27 @@ class TransBasis: if calc_in_solver_blocks: trafo = self.SK.block_structure.transformation - self.SK.block_structure.transform = None + self.SK.block_structure.transformation = None + prop_solver = self.SK.block_structure.convert_matrix(prop, space_from='sumk', space_to='solver') - v= [] + v= {} for name in prop_solver: v[name] = numpy.linalg.eigh(prop_solver[name])[1] self.w = self.SK.block_structure.convert_matrix(v, space_from='solver', space_to='sumk')['ud' if self.SK.SO else 'up'] self.T = numpy.dot(self.T.transpose().conjugate(), self.w).conjugate().transpose() - self.SK.block_structure.transform = trafo - - if self.SK.SO == 0: - self.eig, self.w = numpy.linalg.eigh(prop['up']) - # calculate new Transformation matrix - self.T = numpy.dot(self.T.transpose().conjugate(), - self.w).conjugate().transpose() + self.SK.block_structure.transformation = trafo else: - self.eig, self.w = numpy.linalg.eigh(prop['ud']) - # calculate new Transformation matrix - self.T = numpy.dot(self.T.transpose().conjugate(), - self.w).conjugate().transpose() + if self.SK.SO == 0: + self.eig, self.w = numpy.linalg.eigh(prop['up']) + # calculate new Transformation matrix + self.T = numpy.dot(self.T.transpose().conjugate(), + self.w).conjugate().transpose() + else: + self.eig, self.w = numpy.linalg.eigh(prop['ud']) + # calculate new Transformation matrix + self.T = numpy.dot(self.T.transpose().conjugate(), + self.w).conjugate().transpose() # measure for the 'unity' of the transformation: wsqr = sum(abs(self.w.diagonal())**2) / self.w.diagonal().size From f695ccac7a384ababd1c2f16dc30d515f1431175 Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Mon, 24 Jun 2019 10:03:43 +0200 Subject: [PATCH 30/35] Ignore imaginary part of the density when calculating mu --- python/sumk_dft.py | 58 +++++++++++++++++++++++++--------------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 8da2751e..38b8195c 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -52,11 +52,11 @@ class SumkDFT(object): hdf_file : string Name of hdf5 containing the data. h_field : scalar, optional - The value of magnetic field to add to the DFT Hamiltonian. + The value of magnetic field to add to the DFT Hamiltonian. The contribution -h_field*sigma is added to diagonal elements of the Hamiltonian. It cannot be used with the spin-orbit coupling on; namely h_field is set to 0 if self.SO=True. use_dft_blocks : boolean, optional - If True, the local Green's function matrix for each spin is divided into smaller blocks + If True, the local Green's function matrix for each spin is divided into smaller blocks with the block structure determined from the DFT density matrix of the corresponding correlated shell. Alternatively and additionally, the block structure can be analysed using :meth:`analyse_block_structure ` @@ -64,7 +64,7 @@ class SumkDFT(object): dft_data : string, optional Name of hdf5 subgroup in which DFT data for projector and lattice Green's function construction are stored. symmcorr_data : string, optional - Name of hdf5 subgroup in which DFT data on symmetries of correlated shells + Name of hdf5 subgroup in which DFT data on symmetries of correlated shells (symmetry operations, permutaion matrices etc.) are stored. parproj_data : string, optional Name of hdf5 subgroup in which DFT data on non-normalized projectors for non-correlated @@ -291,10 +291,10 @@ class SumkDFT(object): bname : string Block name of the target block of the lattice Green's function. - gf_to_downfold : Gf + gf_to_downfold : Gf Block of the Green's function that is to be downfolded. - gf_inp : Gf - FIXME + gf_inp : Gf + FIXME shells : string, optional - if shells='corr': orthonormalized projectors for correlated shells are used for the downfolding. @@ -343,10 +343,10 @@ class SumkDFT(object): bname : string Block name of the target block of the lattice Green's function. - gf_to_upfold : Gf + gf_to_upfold : Gf Block of the Green's function that is to be upfolded. - gf_inp : Gf - FIXME + gf_inp : Gf + FIXME shells : string, optional - if shells='corr': orthonormalized projectors for correlated shells are used for the upfolding. @@ -391,10 +391,10 @@ class SumkDFT(object): - if shells='corr': ish labels all correlated shells (equivalent or not) - if shells='all': ish labels only representative (inequivalent) non-correlated shells - gf_to_rotate : Gf + gf_to_rotate : Gf Block of the Green's function that is to be rotated. direction : string - The direction of rotation can be either + The direction of rotation can be either - 'toLocal' : global -> local transformation, - 'toGlobal' : local -> global transformation. @@ -444,7 +444,7 @@ class SumkDFT(object): def lattice_gf(self, ik, mu=None, iw_or_w="iw", beta=40, broadening=None, mesh=None, with_Sigma=True, with_dc=True): r""" - Calculates the lattice Green function for a given k-point from the DFT Hamiltonian and the self energy. + Calculates the lattice Green function for a given k-point from the DFT Hamiltonian and the self energy. Parameters ---------- @@ -467,7 +467,7 @@ class SumkDFT(object): Data defining mesh on which the real-axis GF will be calculated, given in the form (om_min,om_max,n_points), where om_min is the minimum omega, om_max is the maximum omega and n_points is the number of points. with_Sigma : boolean, optional - If True the GF will be calculated with the self-energy stored in self.Sigmaimp_(w/iw), for real/Matsubara GF, respectively. + If True the GF will be calculated with the self-energy stored in self.Sigmaimp_(w/iw), for real/Matsubara GF, respectively. In this case the mesh is taken from the self.Sigma_imp object. If with_Sigma=True but self.Sigmaimp_(w/iw) is not present, with_Sigma is reset to False. with_dc : boolean, optional @@ -667,7 +667,7 @@ class SumkDFT(object): return Sigma_out def extract_G_loc(self, mu=None, iw_or_w='iw', with_Sigma=True, with_dc=True, broadening=None, - transform_to_solver_blocks=True): + transform_to_solver_blocks=True, show_warnings=True): r""" Extracts the local downfolded Green function by the Brillouin-zone integration of the lattice Green's function. @@ -686,6 +686,9 @@ class SumkDFT(object): transform_to_solver_blocks : bool, optional If True (default), the returned G_loc will be transformed to the block structure ``gf_struct_solver``, else it will be in ``gf_struct_sumk``. + show_warnings : bool, optional + Displays warning messages during transformation + (Only effective if transform_to_solver_blocks = True Returns ------- @@ -753,11 +756,11 @@ class SumkDFT(object): icrsh, gf, direction='toLocal') if transform_to_solver_blocks: - return self.transform_to_solver_blocks(G_loc) + return self.transform_to_solver_blocks(G_loc, show_warnings=show_warnings) return G_loc - def transform_to_solver_blocks(self, G_loc, G_out=None): + def transform_to_solver_blocks(self, G_loc, G_out=None, show_warnings = True): """ transform G_loc from sumk to solver space Parameters @@ -794,15 +797,16 @@ class SumkDFT(object): ish_from=self.inequiv_to_corr[ish], ish_to=ish, space_from='sumk', - G_out=G_out[ish]) + G_out=G_out[ish], + show_warnings = show_warnings) # return only the inequivalent shells: return G_out def analyse_block_structure(self, threshold=0.00001, include_shells=None, dm=None, hloc=None): r""" - Determines the block structure of local Green's functions by analysing the structure of - the corresponding density matrices and the local Hamiltonian. The resulting block structures + Determines the block structure of local Green's functions by analysing the structure of + the corresponding density matrices and the local Hamiltonian. The resulting block structures for correlated shells are stored in the :class:`SumkDFT.block_structure ` attribute. Parameters @@ -965,7 +969,7 @@ class SumkDFT(object): else: return w-w0 gf = [BlockGf(name_block_generator = [(name, GfReFreq( - window=(-numpy.pi*(len(block.mesh)-1) / (len(block.mesh)*get_delta_from_mesh(block.mesh)), + window=(-numpy.pi*(len(block.mesh)-1) / (len(block.mesh)*get_delta_from_mesh(block.mesh)), numpy.pi*(len(block.mesh)-1) / (len(block.mesh)*get_delta_from_mesh(block.mesh))), n_points=len(block.mesh), indices=block.indices)) for name, block in g_sh], make_copies=False) for g_sh in G] @@ -1344,7 +1348,7 @@ class SumkDFT(object): - if 'using_point_integration': Only works for diagonal hopping matrix (true in wien2k). beta : float, optional - Inverse temperature. + Inverse temperature. Returns ------- @@ -1752,7 +1756,7 @@ class SumkDFT(object): def total_density(self, mu=None, iw_or_w="iw", with_Sigma=True, with_dc=True, broadening=None): r""" - Calculates the total charge within the energy window for a given chemical potential. + Calculates the total charge within the energy window for a given chemical potential. The chemical potential is either given by parameter `mu` or, if it is not specified, taken from `self.chemical_potential`. @@ -1769,7 +1773,7 @@ class SumkDFT(object): with - .. math:: n(k) = Tr G_{\nu\nu'}(k, i\omega_{n}). + .. math:: n(k) = Tr G_{\nu\nu'}(k, i\omega_{n}). The calculation is done in the global coordinate system, if distinction is made between local/global. @@ -1808,8 +1812,10 @@ class SumkDFT(object): # collect data from mpi: dens = mpi.all_reduce(mpi.world, dens, lambda x, y: x + y) mpi.barrier() - - return dens + import numpy as np + if np.abs(np.imag(dens)) > 1e-20: + mpi.report("Warning: Imaginary part in density will be ignored ({})".format(str(np.abs(np.imag(dens))))) + return np.real(dens) def set_mu(self, mu): r""" @@ -2060,7 +2066,7 @@ class SumkDFT(object): return dc def check_projectors(self): - """Calculated the density matrix from projectors (DM = P Pdagger) to check that it is correct and + """Calculated the density matrix from projectors (DM = P Pdagger) to check that it is correct and specifically that it matches DFT.""" dens_mat = [numpy.zeros([self.corr_shells[icrsh]['dim'], self.corr_shells[icrsh]['dim']], numpy.complex_) for icrsh in range(self.n_corr_shells)] From bd228de7689ff1f3f321f57d3576946d001c13af Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Mon, 24 Jun 2019 10:15:09 +0200 Subject: [PATCH 31/35] Add adapt_deg_shells method and call it in map_gf_struct --- python/block_structure.py | 50 ++++++++++++++++++++++++--------------- 1 file changed, 31 insertions(+), 19 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index 3062956f..79394657 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -437,30 +437,39 @@ class BlockStructure(object): else: self.sumk_to_solver[ish][k] = (None, None) # adapt deg_shells - if self.deg_shells is not None: - for degsh in self.deg_shells[ish]: - if isinstance(degsh, dict): - for key in degsh.keys(): - if not key in gf_struct: - del degsh[key] - continue - if gf_struct[key] != self.gf_struct_solver[ish][key]: - v, C = degsh[key] - degsh[key][0] = \ - v[gf_struct[key], :][:, gf_struct[key]] - warn( - 'Removing shells from degenerate shell {}. Cannot guarantee that they continue to be equivalent.') - else: # degshell is list - degsh1 = copy.deepcopy(degsh) # in order to not remove a key while iterating - for key in degsh1: - if not key in gf_struct: - warn('Removing shells from degenerate shell {}.') - degsh.remove(key) + + self.adapt_deg_shells(gf_struct, ish) + + # reindexing gf_struct so that it starts with 0 for k in gf_struct: gf_struct[k] = range(len(gf_struct[k])) self.gf_struct_solver[ish] = gf_struct + def adapt_deg_shells(gf_struct, ish=0): + """ Adapts the deg_shells to a new gf_struct + Internally called when using pick_gf_struct and map_gf_struct + """ + if self.deg_shells is not None: + for degsh in self.deg_shells[ish]: + if isinstance(degsh, dict): + for key in degsh.keys(): + if not key in gf_struct: + del degsh[key] + continue + if gf_struct[key] != self.gf_struct_solver[ish][key]: + v, C = degsh[key] + degsh[key][0] = \ + v[gf_struct[key], :][:, gf_struct[key]] + warn( + 'Removing shells from degenerate shell {}. Cannot guarantee that they continue to be equivalent.') + else: # degshell is list + degsh1 = copy.deepcopy(degsh) # in order to not remove a key while iterating + for key in degsh1: + if not key in gf_struct: + warn('Removing shells from degenerate shell {}.') + degsh.remove(key) + def pick_gf_struct_sumk(self, new_gf_struct): """ Pick selected orbitals within blocks. @@ -588,6 +597,9 @@ class BlockStructure(object): for k in self.sumk_to_solver[ish].keys(): if not k in su2so: su2so[k] = (None, None) + + adapt_deg_shells(gf_struct, ish) + self.gf_struct_solver[ish] = gf_struct self.solver_to_sumk[ish] = so2su self.sumk_to_solver[ish] = su2so From 9bc4643fdf9fc5e2fe99dc7784eeef3119ac5e7f Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Mon, 24 Jun 2019 12:33:22 +0200 Subject: [PATCH 32/35] Update unit tests and bugfixes in BlockStructure --- python/block_structure.py | 12 ++++++------ python/sumk_dft.py | 4 ++-- test/analyse_block_structure_from_gf.py | 7 +++---- 3 files changed, 11 insertions(+), 12 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index 79394657..fca33d5d 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -446,7 +446,7 @@ class BlockStructure(object): gf_struct[k] = range(len(gf_struct[k])) self.gf_struct_solver[ish] = gf_struct - def adapt_deg_shells(gf_struct, ish=0): + def adapt_deg_shells(self, gf_struct, ish=0): """ Adapts the deg_shells to a new gf_struct Internally called when using pick_gf_struct and map_gf_struct """ @@ -598,7 +598,7 @@ class BlockStructure(object): if not k in su2so: su2so[k] = (None, None) - adapt_deg_shells(gf_struct, ish) + self.adapt_deg_shells(gf_struct, ish) self.gf_struct_solver[ish] = gf_struct self.solver_to_sumk[ish] = so2su @@ -816,7 +816,6 @@ class BlockStructure(object): 'The parameter ish in convert_gf is deprecated. Use ish_from and ish_to instead.') ish_from = ish ish_to = ish - return self._convert_gf_or_matrix(G, G_struct, ish_from, ish_to, show_warnings, G_out, space_from, space_to, **kwargs) @@ -866,7 +865,6 @@ class BlockStructure(object): def _convert_gf_or_matrix(self, G, G_struct=None, ish_from=0, ish_to=None, show_warnings=True, G_out=None, space_from='solver', space_to='solver', **kwargs): - if ish_to is None: ish_to = ish_from @@ -955,8 +953,10 @@ class BlockStructure(object): else: maxdiff = G_back[name] - G[name] - if space_to == 'solver': # do comparison in solver (ignore diff. in ignored orbitals) - maxdiff = G_struct._convert_gf_or_matrix({'ud':maxdiff}, self, ish_from=ish_from, + if space_to == 'solver' and self == G_struct: # do comparison in solver (ignore diff. in ignored orbitals) + tmp = self.create_matrix(space='sumk') + tmp[name] = maxdiff + maxdiff = G_struct._convert_gf_or_matrix(tmp, self, ish_from=ish_from, ish_to=ish_to, show_warnings=False, space_from=space_from, space_to=space_to, **kwargs) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 38b8195c..40c3e1b5 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -1090,9 +1090,9 @@ class SumkDFT(object): G_transformed = [ self.block_structure.convert_gf(G[ish], full_structure, ish, mesh=G[ish].mesh.copy(), show_warnings=threshold, - gf_function=type(G[ish]._first())) + gf_function=type(G[ish]._first()), space_from='sumk', space_to='solver') for ish in range(self.n_inequiv_shells)] - + #print 'c' if analyse_deg_shells: self.analyse_deg_shells(G_transformed, threshold, include_shells) return G_transformed diff --git a/test/analyse_block_structure_from_gf.py b/test/analyse_block_structure_from_gf.py index 5a831444..442a7fff 100644 --- a/test/analyse_block_structure_from_gf.py +++ b/test/analyse_block_structure_from_gf.py @@ -26,7 +26,6 @@ G = SK.extract_G_loc() # the original block structure block_structure1 = SK.block_structure.copy() - G_new = SK.analyse_block_structure_from_gf(G) # the new block structure @@ -163,9 +162,9 @@ for conjugate in conjugate_values: G_new = SK.analyse_block_structure_from_gf(G, 1.e-7) # transform G_noisy etc. to the new block structure - G_noisy = SK.block_structure.convert_gf(G_noisy, block_structure1, beta = G_noisy.mesh.beta) - G_pre_transform = SK.block_structure.convert_gf(G_pre_transform, block_structure1, beta = G_noisy.mesh.beta) - G_noisy_pre_transform = SK.block_structure.convert_gf(G_noisy_pre_transform, block_structure1, beta = G_noisy.mesh.beta) + G_noisy = SK.block_structure.convert_gf(G_noisy, block_structure1, beta = G_noisy.mesh.beta, space_from='sumk') + G_pre_transform = SK.block_structure.convert_gf(G_pre_transform, block_structure1, beta = G_noisy.mesh.beta, space_from='sumk') + G_noisy_pre_transform = SK.block_structure.convert_gf(G_noisy_pre_transform, block_structure1, beta = G_noisy.mesh.beta, space_from='sumk') assert len(SK.deg_shells[0]) == 2, "wrong number of equivalent groups found" assert sorted([len(d) for d in SK.deg_shells[0]]) == [2,3], "wrong number of members in the equivalent groups found" From 8016152c5eca658d789904ac79a363a35cdfeb13 Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Thu, 27 Jun 2019 12:12:33 +0200 Subject: [PATCH 33/35] Documentation for basis rotations --- doc/documentation.rst | 8 ++++ doc/guide/BasisRotation.rst | 76 +++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 doc/guide/BasisRotation.rst diff --git a/doc/documentation.rst b/doc/documentation.rst index 45f071d6..d40b1dd6 100644 --- a/doc/documentation.rst +++ b/doc/documentation.rst @@ -27,6 +27,14 @@ User guide guide/SrVO3 guide/dftdmft_selfcons guide/Sr2RuO4 + guide/BasisRotation + +Postprocessing +-------------- + +.. toctree:: + :maxdepth: 2 + guide/analysis guide/full_tutorial guide/transport diff --git a/doc/guide/BasisRotation.rst b/doc/guide/BasisRotation.rst new file mode 100644 index 00000000..dda0a573 --- /dev/null +++ b/doc/guide/BasisRotation.rst @@ -0,0 +1,76 @@ +.. _plovasp: + +Numerical Treatment of the Sign-Problem: Basis Rotations +======= + +When performing calculations with off-diagonal complex hybridisation or local Hamiltonian, one is +often limited by the fermionic sign-problem. However, as the sign is no +physical observable, one can try to improve the calculation by rotating +to another basis. + +While the choice of basis to perform the calculation in can be chosen +arbitrarily, two choices which have shown good results are the basis +which diagonalizes the local Hamiltonian or the density matrix of then +system. + +The transformation matrix can be stored in the :class:`BlockStructure` and the +transformation is automatically performed when using :class:`SumkDFT`'s :meth:`extract_G_loc` +and :meth:`put_Sigma` (see below). + + +Finding the Transformation Matrix +----------------- + +The :class:`TransBasis` class offers a simple mehod to calculate the transformation +matrices to a basis where either the local Hamiltonian or the density matrix +is diagonal:: + + from triqs_dft_tools.trans_basis import TransBasis + TB = TransBasis(SK) + TB.calculate_diagonalisation_matrix(prop_to_be_diagonal='eal', calc_in_solver_blocks = True) + + SK.block_structure.transformation = [{'ud':TB.w}] + + + +Transforming Green's functions manually +----------------- + +One can transform Green's functions manually using the :meth:`convert_gf` method:: + + # Rotate a Green's function from solver-space to sumk-space + new_gf = block_structure.convert_gf(old_gf, space_from='solver', space_to='sumk') + + + +Automatic transformation during the DMFT loop +----------------- + +During a DMFT loop one is switching back and forth between Sumk-Space and Solver-Space +in each iteration. Once the block_structure.transformation property is set, this can be +done automatically:: + + for it in range(iteration_offset, iteration_offset + n_iterations): + # every GF is in solver space here + S.G0_iw << inverse(S.Sigma_iw + inverse(S.G_iw)) + + # solve the impurity in solver space -> hopefully better sign + S.solve(h_int = H, **p) + + # calc_dc(..., transform = True) by default + SK.calc_dc(S.G_iw.density(), U_interact=U, J_hund=J, orb=0, use_dc_formula=DC_type) + + # put_Sigma(..., transform_to_sumk_blocks = True) by default + SK.put_Sigma([S.Sigma_iw]) + + SK.calc_mu() + + # extract_G_loc(..., transform_to_solver_blocks = True) by default + S.G_iw << SK.extract_G_loc()[0] + +.. warning:: + One must not forget to also transform the interaction Hamiltonian to the diagonal basis! + This can be done with the :meth:`transform_U_matrix` method. However, due to different + conventions in this method, one must pass the conjugated version of the transformation matrix:: + + U_trans = transform_U_matrix(U, SK.block_structure.transformation[0]['ud'].conjugate()) From e40f3159896e2b5fedfb4e18e4e16ed751dd297b Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Wed, 10 Jul 2019 17:15:48 +0200 Subject: [PATCH 34/35] Implement calculate_diagonalization_matrix method into SK --- python/sumk_dft.py | 74 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 74 insertions(+) diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 40c3e1b5..69d95640 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -1333,7 +1333,81 @@ class SumkDFT(object): # a block was found, break out of the loop break + + def calculate_diagonalization_matrix(self, prop_to_be_diagonal='eal', calc_in_solver_blocks=False, write_to_blockstructure = True, ish=0): + """ + Calculates the diagonalisation matrix, and (optionally) stores it in the BlockStructure. + Parameters + ---------- + prop_to_be_diagonal : string, optional + Defines the property to be diagonalized. + + - 'eal' : local hamiltonian (i.e. crystal field) + - 'dm' : local density matrix + + calc_in_solver_blocks : bool, optional + Whether the property shall be diagonalized in the + full sumk structure, or just in the solver structure. + + write_to_blockstructure : bool, optional + Whether the diagonalization matrix shall be written to + the BlockStructure directly. + ish : int, optional + Number of the correlated shell to be diagonalized. + + Returns + ------- + trafo : dict + The transformation matrix for each spin-block in the correlated shell + + """ + trafo = {} + + + if prop_to_be_diagonal == 'eal': + prop = self.eff_atomic_levels()[ish] + elif prop_to_be_diagonal == 'dm': + prop = self.density_matrix(method='using_point_integration')[ish] + else: + mpi.report( + "calculate_diagonalization_matrix: not a valid quantitiy to be diagonal. Choices are 'eal' or 'dm'.") + return 0 + + if calc_in_solver_blocks: + trafo_tmp = self.block_structure.transformation + self.block_structure.transformation = None + + prop_solver = self.block_structure.convert_matrix(prop, space_from='sumk', space_to='solver') + t= {} + for name in prop_solver: + t[name] = numpy.linalg.eigh(prop_solver[name])[1].conjugate().transpose() + trafo = self.block_structure.convert_matrix(t, space_from='solver', space_to='sumk') + #self.T = numpy.dot(self.T.transpose().conjugate(), + # self.w).conjugate().transpose() + self.block_structure.transformation = trafo_tmp + else: + for name in prop: + t = numpy.linalg.eigh(prop[name])[1].conjugate().transpose() + trafo[name] = t + # calculate new Transformation matrix + #self.T = numpy.dot(self.T.transpose().conjugate(), + # self.w).conjugate().transpose() + + # measure for the 'unity' of the transformation: + #wsqr = sum(abs(self.w.diagonal())**2) / self.w.diagonal().size + #return wsqr + + if write_to_blockstructure: + if self.block_structure.transformation == None: + self.block_structure.transformation = [{} for icrsh in range(self.n_corr_shells)] + for sp in self.spin_block_names[self.corr_shells[icrsh]['SO']]: + self.block_structure.transformation[icrsh][sp] = numpy.eye(self.corr_shells[icrsh]['dim'], self.corr_shells[icrsh]['dim'], numpy.complex_) + + self.block_structure.transformation[ish] = trafo + + return trafo + def density_matrix(self, method='using_gf', beta=40.0): """Calculate density matrices in one of two ways. From e7cddf3e7e320ab855c2c1d946ab7393ed289391 Mon Sep 17 00:00:00 2001 From: Hermann Schnait Date: Thu, 18 Jul 2019 11:59:50 +0200 Subject: [PATCH 35/35] Bugfix in calculate_diagonalization_matrix for more than one deg shell --- python/block_structure.py | 1 - python/sumk_dft.py | 6 ++++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/python/block_structure.py b/python/block_structure.py index fca33d5d..5739482c 100644 --- a/python/block_structure.py +++ b/python/block_structure.py @@ -726,7 +726,6 @@ class BlockStructure(object): return self._check_gf_or_matrix(G, ish, space) def _check_gf_or_matrix(self, G, ish=None, space='solver'): - if space == 'solver': gf_struct = self.gf_struct_solver elif space == 'sumk': diff --git a/python/sumk_dft.py b/python/sumk_dft.py index 69d95640..7408cce2 100644 --- a/python/sumk_dft.py +++ b/python/sumk_dft.py @@ -1401,8 +1401,10 @@ class SumkDFT(object): if write_to_blockstructure: if self.block_structure.transformation == None: self.block_structure.transformation = [{} for icrsh in range(self.n_corr_shells)] - for sp in self.spin_block_names[self.corr_shells[icrsh]['SO']]: - self.block_structure.transformation[icrsh][sp] = numpy.eye(self.corr_shells[icrsh]['dim'], self.corr_shells[icrsh]['dim'], numpy.complex_) + for icrsh in range(self. n_corr_shells): + for sp in self.spin_block_names[self.corr_shells[icrsh]['SO']]: + self.block_structure.transformation[icrsh][sp] = numpy.eye(self.corr_shells[icrsh]['dim'], dtype=numpy.complex_) + self.block_structure.transformation[ish] = trafo