def solve_lattice_bse(parm, momsus=False): print '--> solve_lattice_bse' print 'nw =', parm.nw print 'nwf =', parm.nwf # ------------------------------------------------------------------ # -- Setup lattice bl = BravaisLattice([(1, 0, 0), (0, 1, 0)]) bz = BrillouinZone(bl) bzmesh = MeshBrillouinZone(bz, n_k=1) # only one k-point e_k = Gf(mesh=bzmesh, target_shape=[1, 1]) e_k *= 0. # ------------------------------------------------------------------ # -- Lattice single-particle Green's function mesh = MeshImFreq(beta=parm.beta, S='Fermion', n_max=parm.nwf_gf) parm.Sigma_iw = parm.G_iw.copy() G0_iw = parm.G_iw.copy() G0_iw << inverse(iOmega_n + 0.5 * parm.U) parm.Sigma_iw << inverse(G0_iw) - inverse(parm.G_iw) parm.mu = 0.5 * parm.U g_wk = lattice_dyson_g_wk(mu=parm.mu, e_k=e_k, sigma_w=parm.Sigma_iw) g_wr = fourier_wk_to_wr(g_wk) # ------------------------------------------------------------------ # -- Non-interacting generalized lattice susceptibility chi0_wr = chi0r_from_gr_PH(nw=parm.nw, nnu=parm.nwf, gr=g_wr) chi0_wk = chi0q_from_chi0r(chi0_wr) # ------------------------------------------------------------------ # -- Solve lattice BSE parm.chi_wk = chiq_from_chi0q_and_gamma_PH(chi0_wk, parm.gamma_m) # ------------------------------------------------------------------ # -- Store results and static results num = np.squeeze(parm.chi_wk.data.real) ref = np.squeeze(parm.chi_m.data.real) diff = np.max(np.abs(num - ref)) print 'diff =', diff parm.chi_w = chiq_sum_nu_q(parm.chi_wk) # static suscept return parm
def bubble_setup(beta, mu, tb_lattice, nk, nw, sigma_w=None): print tprf_banner(), "\n" print 'beta =', beta print 'mu =', mu print 'sigma =', (not (sigma == None)) norb = tb_lattice.NOrbitalsInUnitCell print 'nk =', nk print 'nw =', nw print 'norb =', norb print ntau = 4 * nw ntot = np.prod(nk) * norb**4 + np.prod(nk) * (nw + ntau) * norb**2 nbytes = ntot * np.complex128().nbytes ngb = nbytes / 1024.**3 print 'Approx. Memory Utilization: %2.2f GB\n' % ngb periodization_matrix = np.diag(np.array(list(nk), dtype=np.int32)) #print 'periodization_matrix =\n', periodization_matrix bz = BrillouinZone(tb_lattice.bl) bzmesh = MeshBrillouinZone(bz, periodization_matrix) print '--> ek' e_k = ek_tb_dispersion_on_bzmesh(tb_lattice, bzmesh, bz) if sigma is None: print '--> g0k' wmesh = MeshImFreq(beta=beta, S='Fermion', n_max=nw) g_wk = lattice_dyson_g0_wk(mu=mu, e_k=e_k, mesh=wmesh) else: print '--> gk' sigma_w = strip_sigma(nw, beta, sigma) g_wk = lattice_dyson_g_wk(mu=mu, e_k=e_k, sigma_w=sigma_w) print '--> gr_from_gk (k->r)' g_wr = fourier_wk_to_wr(g_wk) del g_wk print '--> grt_from_grw (w->tau)' g_tr = fourier_wr_to_tr(g_wr) del g_wr if sigma is None: return g_tr else: return g_tr, sigma_w
(-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 print('--> pi_bubble') PI_wk = bubble_PI_wk(g_wk) print('--> screened_interaction_W') Wr_wk = retarded_screened_interaction_Wr_wk(PI_wk, V_k) print('--> gw_self_energy') sigma_wk = gw_sigma_wk(Wr_wk, g_wk, fft_flag=True) sigma_wk_ref = gw_sigma_wk(Wr_wk, g_wk, fft_flag=False) np.testing.assert_array_almost_equal(sigma_wk.data, sigma_wk_ref.data) print('--> lattice_dyson_g_wk') g_wk = lattice_dyson_g_wk(mu, e_k, sigma_wk)
from common import * from triqs_tprf.linalg import inverse_PH from triqs_tprf.chi_from_gg2 import chi0_from_gg2_PH from triqs_tprf.utilities import G2_loc_fixed_fermionic_window_python from triqs_tprf.lattice import lattice_dyson_g_wk from triqs_tprf.bse import solve_lattice_bse # -- Solve the lattice BSE for several fermionic window sizes for nwf in [8, 10, 12, 20]: with HDFArchive('data_g2.h5', 'r') as a: p = a['p'] p.nwf, p.tail_corr_nwf = nwf, 100 # -- DMFT impurity vertex p.chi_m = p.G2_iw_ph[('up', 'up')] - p.G2_iw_ph[('up', 'do')] p.chi_m = G2_loc_fixed_fermionic_window_python(p.chi_m, nwf=p.nwf) p.chi0_m = chi0_from_gg2_PH(p.G_w['up'], p.chi_m) p.gamma_m = inverse_PH(p.chi0_m) - inverse_PH(p.chi_m) # -- Lattice BSE g_wk = lattice_dyson_g_wk(mu=p.mu, e_k=p.e_k, sigma_w=p.sigma_w)[0:1, 0:1] p.chi_kw, p.chi0_kw = solve_lattice_bse(g_wk, p.gamma_m, tail_corr_nwf=p.tail_corr_nwf) with HDFArchive('data_bse_nwf{:03d}.h5'.format(nwf), 'w') as a: a['p'] = p