def setup_dmft_calculation(p): p = copy.deepcopy(p) p.iter = 0 # -- Local Hubbard interaction from pytriqs.operators import n p.solve.h_int = p.U*n('up', 0)*n('do', 0) - 0.5*p.U*(n('up', 0) + n('do', 0)) # -- 2D square lattice w. nearest neighbour hopping t from triqs_tprf.tight_binding import TBLattice T = -p.t * np.eye(2) H = TBLattice( units = [(1, 0, 0), (0, 1, 0)], orbital_positions = [(0,0,0)]*2, orbital_names = ['up', 'do'], hopping = {(0, +1) : T, (0, -1) : T, (+1, 0) : T, (-1, 0) : T}) p.e_k = H.on_mesh_brillouin_zone(n_k = (p.n_k, p.n_k, 1)) # -- Initial zero guess for the self-energy p.sigma_w = Gf(mesh=MeshImFreq(p.init.beta, 'Fermion', p.init.n_iw), target_shape=[2, 2]) p.sigma_w.zero() return p
beta = 1.3 N_tot = 0.7 n_k = (256, 1, 1) # -- One dimensional tight binding model t = 1.0 h_loc = np.zeros((2, 2)) T = -t * np.eye(2) t_r = TBLattice( units=[(1, 0, 0)], hopping={ # nearest neighbour hopping -t ( 0, ): h_loc, (+1, ): T, (-1, ): T, }, orbital_positions=[(0, 0, 0)] * 2, orbital_names=['up', 'do'], ) e_k = t_r.on_mesh_brillouin_zone(n_k) # -- Local double occupancy operator gf_struct = [[0, [0, 1]]] docc = n(0, 0) * n(0, 1) Sz = 0.5 * np.diag([1., -1.])
import sys import numpy as np from pytriqs.gf import Gf, MeshImFreq, Idx from triqs_tprf.tight_binding import TBLattice from triqs_tprf.lattice import lattice_dyson_g0_wk norb, nk, nw = [int(ele) for ele in sys.argv[1:]] t = -2.0 * np.eye(norb) t_r = TBLattice( units=[(1, 0, 0)], hopping={ (+1, ): t, (-1, ): t, }, orbital_positions=[(0, 0, 0)] * norb, orbital_names=[str(ele) for ele in range(norb)], ) e_k = t_r.on_mesh_brillouin_zone((nk, 1, 1)) wmesh = MeshImFreq(beta=1.0, S='Fermion', n_max=nw) g0_wk = lattice_dyson_g0_wk(mu=0.0, e_k=e_k, mesh=wmesh) print g0_wk.data.shape
n_k = (64, 64, 1) nw = 100 beta = 5.0 mu = 0.0 t = 1.0 print('--> tight binding model') T = -t * np.eye(1) t_r = TBLattice( units=[(1, 0, 0), (0, 1, 0)], hopping={ # nearest neighbour hopping -t (0, +1): T, (0, -1): T, (+1, 0): T, (-1, 0): T, }, orbital_positions=[(0, 0, 0)], orbital_names=['0'], ) print('--> dispersion e_k') kmesh = t_r.get_kmesh(n_k) e_k = t_r.fourier(kmesh) print('--> lattice g0_wk') wmesh = MeshImFreq(beta=beta, S='Fermion', n_max=nw) g0_wk = lattice_dyson_g0_wk(mu=mu, e_k=e_k, mesh=wmesh) # -- Call TPRF chi0_wk bubble calc
dim = 3 norbs = 6 nk = 8 nw = 128 beta = 40.0 full_units = [(1, 0, 0), (0, 1, 0), (0, 0, 1)] all_nn_hoppings = list(itertools.product([-1, 0, 1], repeat=dim)) non_diagonal_hoppings = [ele for ele in all_nn_hoppings if sum(np.abs(ele)) == 1] t = -1.0 * np.eye(norbs) H = TBLattice( units = full_units[:dim], hopping = {hop : t for hop in non_diagonal_hoppings}, orbital_positions = [(0,0,0)]*norbs, ) e_k = H.on_mesh_brillouin_zone(n_k=[nk]*dim + [1]*(3-dim)) wmesh = MeshImFreq(beta=beta, S='Fermion', n_max=nw) print('--> Dyson g0_wk') t = time.time() g0_wk = lattice_dyson_g0_wk(mu=0.0, e_k=e_k, mesh=wmesh) print(' {} seconds'.format(time.time() - t)) print('--> Bubble chi0_wk') t = time.time() chi0_wk = imtime_bubble_chi0_wk(g0_wk, nw=nw) print(' {} seconds'.format(time.time() - t))
beta = 1.3 N_tot = 0.7 * 2 n_k = (8, 1, 1) # -- One dimensional tight binding model t = 1.0 h_loc = np.zeros((2, 2)) T = - t * np.eye(2) t_r_prim = TBLattice( units = [(1, 0, 0)], hopping = { # nearest neighbour hopping -t (0,): h_loc, (+1,): T, (-1,): T, }, orbital_positions = [(0,0,0)] * 2, orbital_names = ['up', 'do'], ) # -- Two site super lattice P = np.array([[ 2 ]]) Units_prim = np.array(t_r_prim.Units) print 'Units_prim =\n', Units_prim Units = np.dot(P, Units_prim) print 'Units =\n', Units
t_intra = 1.0 t_inter = 0.1 inter_orbital_hopping = np.zeros((n_orb_spin, n_orb_spin)) inter_orbital_hopping[0, 1] = inter_orbital_hopping[1, 0] = 1 inter_orbital_hopping[2, 3] = inter_orbital_hopping[3, 2] = 1 H = TBLattice( units=[(1, 0, 0), (0, 1, 0)], hopping={ # nearest neighbour hopping -t (0, +1): -t_intra * np.eye(n_orb_spin) - t_inter * inter_orbital_hopping, (0, -1): -t_intra * np.eye(n_orb_spin) - t_inter * inter_orbital_hopping, (+1, 0): -t_intra * np.eye(n_orb_spin) - t_inter * inter_orbital_hopping, (-1, 0): -t_intra * np.eye(n_orb_spin) - t_inter * inter_orbital_hopping, }, orbital_positions=[(0, 0, 0)] * n_orb_spin, ) e_k = H.on_mesh_brillouin_zone(n_k=(16, 16, 1)) print(e_k) # ---------------------------------------------------------------------- # -- Bare susceptibility from Green's function bubble from pytriqs.gf import MeshImFreq
spin_names, orb_names, U_mat, UPrime_mat, J_hund=J, off_diag=False, map_operator_structure=None, H_dump=None) # orbital diag # ------------------------------------------------------------------ # -- Tightbinding model t = 1.0 h_loc = np.kron(np.eye(2), np.diag([0., -0.1, 0.1])) T = - t * np.kron(np.eye(2), np.diag([0.01, 1., 1.])) t_r = TBLattice( units = [(1, 0, 0)], hopping = { # nearest neighbour hopping -t (0,): h_loc, (+1,): T, (-1,): T, }, orbital_positions = [(0,0,0)] * 6, orbital_names = ['up_0', 'up_1', 'up_2', 'do_0', 'do_1', 'do_2'], ) Sz = np.kron(np.diag([+0.5, -0.5]), np.eye(norb//2)) if True: h_loc = np.kron(np.eye(2), np.diag([0.])) T = - t * np.kron(np.eye(2), np.diag([1.0])) t_r = TBLattice( units = [(1, 0, 0)], hopping = {
import sys import numpy as np from triqs.gf import Gf, MeshImFreq, Idx from triqs_tprf.tight_binding import TBLattice from triqs_tprf.lattice import lattice_dyson_g0_wk norb, nk, nw = [int(ele) for ele in sys.argv[1:]] t = -2.0 * np.eye(norb) t_r = TBLattice( units=[(1, 0, 0)], hopping={ (+1, ): t, (-1, ): t, }, orbital_positions=[(0, 0, 0)] * norb, orbital_names=[str(ele) for ele in range(norb)], ) kmesh = t_r.get_kmesh((nk, 1, 1)) e_k = t_r.fourier(kmesh) wmesh = MeshImFreq(beta=1.0, S='Fermion', n_max=nw) g0_wk = lattice_dyson_g0_wk(mu=0.0, e_k=e_k, mesh=wmesh) print(g0_wk.data.shape)
import numpy as np from triqs_tprf.tight_binding import TBLattice import triqs_tprf as trpf from pytriqs.gf import * from triqs_tprf.lattice import lattice_dyson_g0_wk import matplotlib.pyplot as plt t = 1.0 H = TBLattice( units=[(1, 0, 0), (0, 1, 0)], hopping={ # nearest neighbour hopping -t (0, +1): -t * np.eye(2), (0, -1): -t * np.eye(2), (+1, 0): -t * np.eye(2), (-1, 0): -t * np.eye(2), }, orbital_positions=[(0, 0, 0)] * 2, orbital_names=['up', 'do'], ) e_k = H.on_mesh_brillouin_zone(n_k=(32, 32, 1)) beta = 50 n_iw = 130 mu = -5 imesh = MeshImFreq(beta, 'Fermion', n_iw) g = lattice_dyson_g0_wk(mu, e_k, imesh) gm = GfImFreq(mesh=imesh, data=g[(0, 0)].data[:, 0].reshape(-1, 1, 1), beta=50) g_pade = GfReFreq(window=(-2, 2), n_points=200, target_shape=[1, 1]) g_pade.set_from_pade(gm) print(g_pade.data.shape)
norbs = 6 nk = 8 nw = 128 beta = 40.0 full_units = [(1, 0, 0), (0, 1, 0), (0, 0, 1)] all_nn_hoppings = list(itertools.product([-1, 0, 1], repeat=dim)) non_diagonal_hoppings = [ ele for ele in all_nn_hoppings if sum(np.abs(ele)) == 1 ] t = -1.0 * np.eye(norbs) H = TBLattice( units=full_units[:dim], hopping={hop: t for hop in non_diagonal_hoppings}, orbital_positions=[(0, 0, 0)] * norbs, ) kmesh = H.get_kmesh(n_k=[nk] * dim + [1] * (3 - dim)) e_k = H.fourier(kmesh) wmesh = MeshImFreq(beta=beta, S='Fermion', n_max=nw) print('--> Dyson g0_wk') t = time.time() g0_wk = lattice_dyson_g0_wk(mu=0.0, e_k=e_k, mesh=wmesh) print(' {} seconds'.format(time.time() - t)) print('--> Bubble chi0_wk') t = time.time() chi0_wk = imtime_bubble_chi0_wk(g0_wk, nw=nw)
t_intra = 1.0 t_inter = 0.1 inter_orbital_hopping = np.zeros((n_orb_spin, n_orb_spin)) inter_orbital_hopping[0, 1] = inter_orbital_hopping[1, 0] = 1 inter_orbital_hopping[2, 3] = inter_orbital_hopping[3, 2] = 1 H = TBLattice( units=[(1, 0, 0), (0, 1, 0)], hopping={ # nearest neighbour hopping -t (0, +1): -t_intra * np.eye(n_orb_spin) - t_inter * inter_orbital_hopping, (0, -1): -t_intra * np.eye(n_orb_spin) - t_inter * inter_orbital_hopping, (+1, 0): -t_intra * np.eye(n_orb_spin) - t_inter * inter_orbital_hopping, (-1, 0): -t_intra * np.eye(n_orb_spin) - t_inter * inter_orbital_hopping, }, orbital_positions=[(0, 0, 0)] * n_orb_spin, ) kmesh = H.get_kmesh(n_k=(16, 16, 1)) e_k = H.fourier(kmesh) print(e_k) # ---------------------------------------------------------------------- # -- Bare susceptibility from Green's function bubble
beta = 1.3 N_tot = 0.7 n_k = (256, 1, 1) # -- One dimensional tight binding model t = 1.0 h_loc = np.zeros((2, 2)) T = -t * np.eye(2) t_r = TBLattice( units=[(1, 0, 0)], hopping={ # nearest neighbour hopping -t ( 0, ): h_loc, (+1, ): T, (-1, ): T, }, orbital_positions=[(0, 0, 0)] * 2, orbital_names=['up', 'do'], ) kmesh = t_r.get_kmesh(n_k) e_k = t_r.fourier(kmesh) # -- Local double occupancy operator gf_struct = [[0, 2]] docc = n(0, 0) * n(0, 1)
from triqs.gf import Gf, MeshImFreq, Idx # ---------------------------------------------------------------------- nw = 100 norb = 1 beta = 10.0 V = 1.0 mu = 0.0 t = -1.0 * np.eye(norb) t_r = TBLattice( units=[(1, 0, 0)], hopping={ (+1, ): t, (-1, ): t, }, orbital_positions=[(0, 0, 0)] * norb, ) kmesh = t_r.get_kmesh(n_k=(8, 1, 1)) e_k = t_r.fourier(kmesh) print(e_k.data) kmesh = e_k.mesh wmesh = MeshImFreq(beta, 'Fermion', nw) g_wk = lattice_dyson_g0_wk(mu=mu, e_k=e_k, mesh=wmesh) V_k = Gf(mesh=kmesh, target_shape=[norb] * 4) V_k.data[:] = V
def __init__(self, tb_lattice, super_lattice_units, cluster_sites=None, remove_internal_hoppings=False): """ * tb_lattice: The underlying lattice * super_lattice_units: The unit vectors of the superlattice in the tb_lattice (integer) coordinates * cluster_sites [None]: Coordinates of the cluster in tb_lattice coordinates. If None, an automatic computation of cluster positions is made as follows: it takes all points whose coordinates in the basis of the superlattice are in [0, 1[^dimension * remove_internal_hoppings: If true, the hopping terms are removed inside the cluster. Useful to add Hartree Fock terms at the boundary of a cluster, e.g. """ #if not isinstance(tb_lattice, TBLattice): raise ValueError, "tb_lattice should be an instance of TBLattice" self.__BaseLattice = tb_lattice dim = tb_lattice.dim try: self.__super_lattice_units = numpy.array(super_lattice_units, copy=True) assert self.__super_lattice_units.shape == (dim, dim) except: raise ValueError, "super_lattice_units is not correct. Cf Doc. value is %s, dim = %s " % ( super_lattice_units, dim) Ncluster_sites = int( numpy.rint(abs(numpy.linalg.det(self.__super_lattice_units)))) assert Ncluster_sites > 0, "Superlattice vectors are not independant !" self._M = self.__super_lattice_units.transpose() self._Mtilde = numpy.array(numpy.rint( numpy.linalg.inv(self._M) * Ncluster_sites), dtype=int) self.__remove_internal_hoppings = remove_internal_hoppings #self.norb = tb_lattice.NOrbitalsInUnitCell self.Norb = tb_lattice.NOrbitalsInUnitCell * Ncluster_sites # cluster_sites computation if cluster_sites != None: self.__cluster_sites = list(cluster_sites)[:] else: # Computes the position of the cluster automatically self.__cluster_sites = [] #We tile the super-cell with the tb_lattice points and retains # the points inside it and store it. #M=numpy.array(self.__super_lattice_units) # BUG! M = numpy.array(self.__super_lattice_units.transpose()) assert M.shape == tuple( 2 * [dim] ), "Tiling Construct: super_lattice_units does not have the correct size" #Minv = Ncluster_sites*numpy.linalg.inverse(M) #+0.5 # +0.5 is for the round #Mtilde = Minv.astype(numpy.Int) # now is integer. Mtilde = nint_strict(Ncluster_sites * numpy.linalg.inv(M)) #print 'Mtilde (inside cluster sites) =\n', Mtilde.__repr__() # round to the closest integer, with assert that precision is <1.e-9 if dim == 1: a = (max(M[0, :]), 0, 0) elif dim == 2: a = (2 * max(M[0, :]), 2 * max(M[1, :]), 0) elif dim == 3: a = (3 * max(M[0, :]), 3 * max(M[1, :]), 3 * max(M[2, :])) else: raise ValueError, "dim is not between 1 and 3 !!" r = lambda i: range(-a[i], a[i] + 1) for nx in r(0): for ny in r(1): for nz in r(2): nv = numpy.array([nx, ny, nz][0:dim]) k_sl = numpy.dot(Mtilde, nv) if (min(k_sl) >= 0) and ( max(k_sl) < Ncluster_sites ): # The point is a point of the cluster. We store it. self.__cluster_sites.append(nv.tolist()) assert len( self.__cluster_sites ) == Ncluster_sites, """Number of cluster positions incorrect (compared to the volume of unit cell of the Superlattice)""" self.Ncluster_sites = Ncluster_sites # creating a dictionnary position_of_sites -> number e.g. (1, 0): 2 etc... # self._clustersites_hash = dict ([ (tuple(pos), n) for n, pos in enumerate(self.cluster_sites)]) #print 'Ns = ', self.Ncluster_sites #print 'cluster_sites =', self.__cluster_sites #print 'M =\n', self._M.__repr__() #print 'Mtilde =\n', self._Mtilde.__repr__() #import numpy as np #print 'M*Mtilde =\n', np.dot(self._M, self._Mtilde) #exit() # Compute the new Hopping in the supercell Hopping = self.fold(tb_lattice.hopping_dict(), remove_internal_hoppings) if 0: for k, v in Hopping.items(): print k print v.real # Compute the new units of the lattice in real coordinates Units = numpy.dot(self.__super_lattice_units, tb_lattice.Units) # Positions and names of orbitals in the supercell: just translate all orbitals for cluster site positions # in R^3 coordinates. Orbital_Positions = [ POS + tb_lattice.latt_to_real_x(CS) for POS in tb_lattice.OrbitalPositions for CS in self.__cluster_sites ] #Orbital_Names = [ '%s%s'%(n, s) for n in tb_lattice.OrbitalNames for s in range(Ncluster_sites)] site_index_list, orbital_index_list = range(1, Ncluster_sites + 1), tb_lattice.OrbitalNames if len(orbital_index_list) == 1: Orbital_Names = [s for s in site_index_list] elif len(site_index_list) == 1 and len(orbital_index_list) > 1: Orbital_Names = [o for o in orbital_index_list] elif len(site_index_list) > 1 and len(orbital_index_list) > 1: Orbital_Names = [(pos, o) for o in orbital_index_list for pos in site_index_list] #print tb_lattice.OrbitalNames #Orbital_Names TBLattice.__init__(self, Units, Hopping, Orbital_Positions, Orbital_Names) # we pass False since the folding has arealdy been done in tb_lattice assert self.Norb == self.NOrbitalsInUnitCell
n_k = (64, 64, 1) nw = 100 beta = 5.0 mu = 0.0 t = 1.0 print '--> tight binding model' T = -t * np.eye(1) t_r = TBLattice( units=[(1, 0, 0), (0, 1, 0)], hopping={ # nearest neighbour hopping -t (0, +1): T, (0, -1): T, (+1, 0): T, (-1, 0): T, }, orbital_positions=[(0, 0, 0)], orbital_names=['0'], ) print '--> dispersion e_k' e_k = t_r.on_mesh_brillouin_zone(n_k) print '--> lattice g0_wk' wmesh = MeshImFreq(beta=beta, S='Fermion', n_max=nw) g0_wk = lattice_dyson_g0_wk(mu=mu, e_k=e_k, mesh=wmesh) # -- Call TPRF chi0_wk bubble calc chi00_wk = imtime_bubble_chi0_wk(g0_wk, nw=1)
def test_square_lattice_chi00(): # ------------------------------------------------------------------ # -- Discretizations n_k = (2, 2, 1) nw_g = 500 nnu = 400 nw = 1 # ------------------------------------------------------------------ # -- tight binding parameters beta = 20.0 mu = 0.0 t = 1.0 h_loc = np.array([ [-0.3, -0.5], [-0.5, .4], ]) T = -t * np.array([ [1., 0.23], [0.23, 0.5], ]) # ------------------------------------------------------------------ # -- tight binding print '--> tight binding model' t_r = TBLattice( units=[(1, 0, 0), (0, 1, 0)], hopping={ # nearest neighbour hopping -t (0, 0): h_loc, (0, +1): T, (0, -1): T, (+1, 0): T, (-1, 0): T, }, orbital_positions=[(0, 0, 0)] * 2, orbital_names=['up_0', 'do_0'], ) e_k = t_r.on_mesh_brillouin_zone(n_k) kmesh = e_k.mesh wmesh = MeshImFreq(beta=beta, S='Fermion', n_max=nw_g) print '--> g0_wk' g0_wk = lattice_dyson_g0_wk(mu=mu, e_k=e_k, mesh=wmesh) print '--> g0_wr' g0_wr = fourier_wk_to_wr(g0_wk) print '--> g0_tr' g0_tr = fourier_wr_to_tr(g0_wr) # ------------------------------------------------------------------ # -- anaytic chi00 print '--> chi00_wk analytic' chi00_wk_analytic = lindhard_chi00_wk(e_k=e_k, nw=nw, beta=beta, mu=mu) print '--> chi00_wr analytic' chi00_wr_analytic = chi_wr_from_chi_wk(chi00_wk_analytic) # ------------------------------------------------------------------ # -- imtime chi00 print '--> chi0_tr_from_grt_PH' chi00_tr = chi0_tr_from_grt_PH(g0_tr) print '--> chi_wr_from_chi_tr' chi00_wr = chi_wr_from_chi_tr(chi00_tr, nw=1) print '--> chi_w0r_from_chi_tr' chi00_wr_ref = chi_w0r_from_chi_tr(chi00_tr) print '--> chi0_w0r_from_grt_PH' chi00_wr_opt = chi0_w0r_from_grt_PH(g0_tr) print 'dchi00_wr =', np.max( np.abs(chi00_wr_analytic.data - chi00_wr.data)) print 'dchi00_wr_ref =', np.max( np.abs(chi00_wr_analytic.data - chi00_wr_ref.data)) print 'dchi00_wr_opt =', np.max( np.abs(chi00_wr_analytic.data - chi00_wr_opt.data)) np.testing.assert_array_almost_equal(chi00_wr_analytic.data, chi00_wr.data, decimal=8) np.testing.assert_array_almost_equal(chi00_wr_analytic.data, chi00_wr_ref.data, decimal=4) np.testing.assert_array_almost_equal(chi00_wr_analytic.data, chi00_wr_opt.data, decimal=4) print '--> chi_wk_from_chi_wr' chi00_wk_imtime = chi_wk_from_chi_wr(chi00_wr) # ------------------------------------------------------------------ # -- imtime chi00 helper function chi00_wk_imtime_2 = imtime_bubble_chi0_wk(g0_wk, nw=1) # ------------------------------------------------------------------ # -- imfreq chi00 print '--> chi00_wnr' chi00_wnr = chi0r_from_gr_PH(nw=1, nnu=nnu, gr=g0_wr) print '--> chi00_wnk' chi00_wnk = chi0q_from_chi0r(chi00_wnr) # -- Test per k and w calculator for chi0_wnk print '--> chi00_wnk_ref' from triqs_tprf.lattice import chi0q_from_g_wk_PH chi00_wnk_ref = chi0q_from_g_wk_PH(nw=1, nnu=nnu, g_wk=g0_wk) diff = np.max(np.abs(chi00_wnk.data - chi00_wnk_ref.data)) print 'chi00_wnk diff =', diff np.testing.assert_array_almost_equal(chi00_wnk.data, chi00_wnk_ref.data) print '--> chi00_wk_imfreq' chi00_wk_imfreq = chi0q_sum_nu(chi00_wnk) print '--> chi00_wk_imfreq_tail_corr' chi00_wk_imfreq_tail_corr = chi0q_sum_nu_tail_corr_PH(chi00_wnk) # ------------------------------------------------------------------ # -- Compare results def cf_chi_w0(chi1, chi2, decimal=9): chi1, chi2 = chi1[Idx(0), :].data, chi2[Idx(0), :].data diff = np.linalg.norm(chi1 - chi2) print '|dchi| =', diff np.testing.assert_array_almost_equal(chi1, chi2, decimal=decimal) print '--> Cf analytic with imtime' cf_chi_w0(chi00_wk_analytic, chi00_wk_imtime, decimal=7) print '--> Cf analytic with imtime 2' cf_chi_w0(chi00_wk_analytic, chi00_wk_imtime_2, decimal=4) print '--> Cf analytic with imfreq' cf_chi_w0(chi00_wk_analytic, chi00_wk_imfreq, decimal=2) print '--> Cf analytic with imfreq (tail corr)' cf_chi_w0(chi00_wk_analytic, chi00_wk_imfreq_tail_corr, decimal=5)
from pytriqs.gf import Gf, MeshImFreq, Idx # ---------------------------------------------------------------------- nw = 100 norb = 1 beta = 10.0 V = 1.0 mu = 0.0 t = -1.0 * np.eye(norb) t_r = TBLattice( units=[(1, 0, 0)], hopping={ (+1, ): t, (-1, ): t, }, orbital_positions=[(0, 0, 0)] * norb, ) e_k = t_r.on_mesh_brillouin_zone(n_k=(8, 1, 1)) print e_k.data kmesh = e_k.mesh wmesh = MeshImFreq(beta, 'Fermion', nw) g_wk = lattice_dyson_g0_wk(mu=mu, e_k=e_k, mesh=wmesh) V_k = Gf(mesh=kmesh, target_shape=[norb] * 4) V_k.data[:] = V