def loop_u_tp(u_range, tp_range, beta, seed='mott gap'): """Solves IPT dimer and return Im Sigma_AA, Re Simga_AB returns list len(betarange) x 2 Sigma arrays """ tau, w_n = gf.tau_wn_setup( dict(BETA=beta, N_MATSUBARA=max(2**ceil(log(4 * beta) / log(2)), 256))) giw_d, giw_o = dimer.gf_met(w_n, 0., 0., 0.5, 0.) if seed == 'I': giw_d, giw_o = 1 / (1j * w_n - 4j / w_n), np.zeros_like(w_n) + 0j sigma_iw = [] iterations = [] for tp, u_int in zip(tp_range, u_range): giw_d, giw_o, loops = dimer.ipt_dmft_loop(beta, u_int, tp, giw_d, giw_o, tau, w_n, 1e-3) iterations.append(loops) g0iw_d, g0iw_o = dimer.self_consistency(1j * w_n, 1j * giw_d.imag, giw_o.real, 0., tp, 0.25) siw_d, siw_o = ipt.dimer_sigma(u_int, tp, g0iw_d, g0iw_o, tau, w_n) sigma_iw.append((siw_d.imag, siw_o.real)) print(np.array(iterations)) return sigma_iw
def dmft_solve(giw_d, giw_o, beta, u_int, tp, tau, w_n): giw_d, giw_o, loops = dimer.ipt_dmft_loop(BETA, u_int, tp, giw_d, giw_o, tau, w_n, 1e-12) g0iw_d, g0iw_o = dimer.self_consistency(1j * w_n, 1j * giw_d.imag, giw_o.real, 0., tp, 0.25) siw_d, siw_o = ipt.dimer_sigma(u_int, tp, g0iw_d, g0iw_o, tau, w_n) return giw_d, giw_o, siw_d, siw_o
def estimate_zero_w_sigma_T_vs_U(tp, u_range, temp, phase): sd_zew, so_zew = [], [] u_range = u_range if phase == 'met' else u_range[::-1] save_file = 'dimer_ipt_{}_Z_tp{:.2}.npy'.format(phase, tp) if os.path.exists(save_file): return np.load(save_file) for T in temp: beta = 1 / T tau, w_n = gf.tau_wn_setup( dict(BETA=beta, N_MATSUBARA=max(2**ceil(log(6 * beta) / log(2)), 256))) filestr = 'disk/phase_Dimer_ipt_{}_tp{:.2}/B{:.5}/giw.npy'.format( phase, tp, beta) gfs = np.load(filestr) for i, u_int in enumerate(u_range): giw_d, giw_o = 1j * gfs[i][0], gfs[i][1] g0iw_d, g0iw_o = dimer.self_consistency( 1j * w_n, giw_d, giw_o, 0., tp, 0.25) siw_d, siw_o = ipt.dimer_sigma(u_int, tp, g0iw_d, g0iw_o, tau, w_n) sd_zew.append(np.polyfit(w_n[:2], siw_d[:2].imag, 1)) so_zew.append(np.polyfit(w_n[:2], siw_o[:2].real, 1)) sd_zew = np.array(sd_zew).reshape(len(temp), len(u_range), -1) so_zew = np.array(so_zew).reshape(len(temp), len(u_range), -1) np.save(save_file, (sd_zew, so_zew)) return sd_zew, so_zew
def test_selfconsistency(tp): """Check that the Bethe lattice self-consistency is working""" _, w_n = tau_wn_setup(dict(BETA=100., N_MATSUBARA=400)) giwd, giwo = dimer.gf_met(w_n, 0., tp, 0.5, 0.) g0iwd, g0iwo = dimer.self_consistency(1j * w_n, giwd, giwo, 0., tp, 0.25) assert np.allclose(giwd, g0iwd) assert np.allclose(giwo, g0iwo)
def loop_u_tp(u_range, tprange, beta, seed='mott gap'): tau, w_n = gf.tau_wn_setup(dict(BETA=beta, N_MATSUBARA=max(5 * beta, 256))) giw_d, giw_o = dimer.gf_met(w_n, 0., 0., 0.5, 0.) if seed == 'mott gap': giw_d, giw_o = 1 / (1j * w_n + 4j / w_n), np.zeros_like(w_n) + 0j giw_s = [] sigma_iw = [] ekin, epot = [], [] iterations = [] for u_int, tp in zip(u_range, tprange): giw_d, giw_o, loops = dimer.ipt_dmft_loop(beta, u_int, tp, giw_d, giw_o, tau, w_n) giw_s.append((giw_d, giw_o)) iterations.append(loops) g0iw_d, g0iw_o = dimer.self_consistency(1j * w_n, 1j * giw_d.imag, giw_o.real, 0., tp, 0.25) siw_d, siw_o = ipt.dimer_sigma(u_int, tp, g0iw_d, g0iw_o, tau, w_n) sigma_iw.append((siw_d.copy(), siw_o.copy())) ekin.append(dimer.ekin(giw_d, giw_o, w_n, tp, beta)) epot.append( dimer.epot(giw_d, w_n, beta, u_int**2 / 4 + tp**2, ekin[-1], u_int) / 4) # last division because I want per spin epot print(np.array(iterations)) return np.array(giw_s), np.array(sigma_iw), np.array(ekin), np.array( epot), w_n
def ipt_u_tp(u_int, tp, beta, seed="ins"): tau, w_n = gf.tau_wn_setup(dict(BETA=beta, N_MATSUBARA=1024)) giw_d, giw_o = dimer.gf_met(w_n, 0., 0., 0.5, 0.) if seed == "ins": giw_d, giw_o = 1 / (1j * w_n + 4j / w_n), np.zeros_like(w_n) + 0j giw_d, giw_o, loops = dimer.ipt_dmft_loop( beta, u_int, tp, giw_d, giw_o, tau, w_n, 1e-12) g0iw_d, g0iw_o = dimer.self_consistency( 1j * w_n, 1j * giw_d.imag, giw_o.real, 0., tp, 0.25) siw_d, siw_o = ipt.dimer_sigma(u_int, tp, g0iw_d, g0iw_o, tau, w_n) return giw_d, giw_o, siw_d, siw_o, g0iw_d, g0iw_o, w_n
def dmft_solve(giw_d, giw_o, u_int, tp, beta, tau, w_n): giw_d, giw_o, loops = dimer.ipt_dmft_loop( beta, u_int, tp, giw_d, giw_o, tau, w_n) g0iw_d, g0iw_o = dimer.self_consistency( 1j * w_n, 1j * giw_d.imag, giw_o.real, 0., tp, 0.25) siw_d, siw_o = ipt.dimer_sigma(u_int, tp, g0iw_d, g0iw_o, tau, w_n) ekin = dimer.ekin(giw_d, giw_o, w_n, tp, beta) # last division because I want per spin epot epot = dimer.epot(giw_d, w_n, beta, u_int ** 2 / 4 + tp**2, ekin, u_int) / 4 return (giw_d, giw_o), (siw_d, siw_o), ekin, epot, loops
def ipt_u_tp(u_int, tp, beta, seed='ins'): tau, w_n = gf.tau_wn_setup(dict(BETA=beta, N_MATSUBARA=2**8)) tau, w_n = gf.tau_wn_setup( dict(BETA=beta, N_MATSUBARA=max(2**ceil(log(8 * beta) / log(2)), 256))) giw_d, giw_o = dimer.gf_met(w_n, 0., 0., 0.5, 0.) if seed == 'ins': giw_d, giw_o = 1 / (1j * w_n + 4j / w_n), np.zeros_like(w_n) + 0j giw_d, giw_o, loops = dimer.ipt_dmft_loop( beta, u_int, tp, giw_d, giw_o, tau, w_n, 1e-7) g0iw_d, g0iw_o = dimer.self_consistency( 1j * w_n, 1j * giw_d.imag, giw_o.real, 0., tp, 0.25) siw_d, siw_o = ipt.dimer_sigma(u_int, tp, g0iw_d, g0iw_o, tau, w_n) return giw_d, giw_o, siw_d, siw_o, g0iw_d, g0iw_o, w_n
def loop_u_tp(u_range, tprange, beta, seed='mott gap'): tau, w_n = gf.tau_wn_setup(dict(BETA=beta, N_MATSUBARA=max(5 * beta, 256))) giw_d, giw_o = dimer.gf_met(w_n, 0., 0., 0.5, 0.) if seed == 'mott gap': giw_d, giw_o = 1 / (1j * w_n + 4j / w_n), np.zeros_like(w_n) + 0j sigma_iw = [] for u_int, tp in zip(u_range, tprange): giw_d, giw_o, loops = dimer.ipt_dmft_loop( beta, u_int, tp, giw_d, giw_o, tau, w_n) g0iw_d, g0iw_o = dimer.self_consistency( 1j * w_n, 1j * giw_d.imag, giw_o.real, 0., tp, 0.25) siw_d, siw_o = ipt.dimer_sigma(u_int, tp, g0iw_d, g0iw_o, tau, w_n) sigma_iw.append((siw_d.copy(), siw_o.copy())) print(seed, ' U', u_int, ' tp: ', tp, ' loops: ', loops) return np.array(sigma_iw), w_n
def zero_f_meas(giw_d, giw_o, murange, tp, u_cut): sd_zew, so_zew = [], [] for u_int in murange: giw_d, giw_o, _ = dimer.ipt_dmft_loop(BETA, u_int, tp, giw_d, giw_o, tau, w_n, 1e-3) g0iw_d, g0iw_o = dimer.self_consistency(1j * w_n, 1j * giw_d.imag, giw_o.real, 0., TP, 0.25) siw_d, siw_o = ipt.dimer_sigma(u_int, tp, g0iw_d, g0iw_o, tau, w_n) sd_zew.append(np.polyfit(w_n[:2], siw_d[:2].imag, 1)) so_zew.append(np.polyfit(w_n[:2], siw_o[:2].real, 1)) sd_zew, so_zew = np.array(sd_zew), np.array(so_zew) dw_sig11 = np.ma.masked_array(sd_zew[:, 0], murange >= u_cut) zet = 1 / (1 - dw_sig11.T) tpp = (TP + so_zew[:, 1].T) return zet, tpp
def estimate_zero_w_sigma_U_vs_tp(tpr, u_range, beta, phase): sd_zew, so_zew = [], [] tau, w_n = gf.tau_wn_setup( dict(BETA=beta, N_MATSUBARA=max(2**ceil(log(8 * beta) / log(2)), 256))) for tp in tpr: filestr = 'disk/phase_Dimer_ipt_{}_B{}/tp{:.3}/giw.npy'.format( phase, beta, tp) gfs = np.load(filestr) for i, u_int in enumerate(u_range): giw_d, giw_o = 1j * gfs[i][0], gfs[i][1] g0iw_d, g0iw_o = dimer.self_consistency(1j * w_n, giw_d, giw_o, 0., tp, 0.25) siw_d, siw_o = dimer_sigma(u_int, tp, g0iw_d, g0iw_o, tau, w_n) sd_zew.append(np.polyfit(w_n[:2], siw_d[:2].imag, 1)) so_zew.append(np.polyfit(w_n[:2], siw_o[:2].real, 1)) sd_zew = np.array(sd_zew).reshape(len(tpr), len(u_range), -1) so_zew = np.array(so_zew).reshape(len(tpr), len(u_range), -1) return sd_zew, so_zew
def ipt_u_tp(urange, tp, beta, w): tau, w_n = gf.tau_wn_setup(dict(BETA=beta, N_MATSUBARA=2**11)) giw_d, giw_o = dimer.gf_met(w_n, 0., tp, 0.5, 0.) w_set = list(np.arange(0, 120, 2)) w_set = w_set + list(np.arange(120, 512, 8)) imgss = [] for u_int in urange: giw_d, giw_o, loops = dimer.ipt_dmft_loop(beta, u_int, tp, giw_d, giw_o, tau, w_n, 1e-9) g0iw_d, g0iw_o = dimer.self_consistency(1j * w_n, 1j * giw_d.imag, giw_o.real, 0., tp, 0.25) siw_d, siw_o = ipt_imag.dimer_sigma(u_int, tp, g0iw_d, g0iw_o, tau, w_n) ss = gf.pade_continuation(1j * siw_d.imag + siw_o.real, w_n, w + 0.0005j, w_set) # A-bond imgss.append( gf.semi_circle_hiltrans(w - tp - (ss.real - 1j * np.abs(ss.imag)))) return imgss
import dmft.common as gf import dmft.dimer as dimer ###################################################################### # Real frequency spectral function # ================================ w = 1e-3j + np.linspace(-4, 4, 2**10) mu, t = 0, 0.5 t2 = t**2 plt.figure() for tab in [0, 0.25, 0.5, 0.75, 1.1]: Gd, Gc = dimer.gf_met(-1j * w, mu, tab, t, 0.) Gd, Gc = dimer.self_consistency(w, Gd, Gc, mu, tab, t2) plt.plot(w.real, -Gd.imag / np.pi, label=r'$t_c={}$'.format(tab)) # plt.plot(w.real, Gd.real, label=r'$\Re e Gd$') # plt.plot(w.real, Gc.real, label=r'$\Re e Gc$') # plt.plot(w.real, Gc.imag, label=r'$\Im m Gc$') plt.legend(loc=0) plt.xlabel(r'$\omega$') plt.ylabel(r'$A(\omega)$') ###################################################################### # Matsubara frequency Green's function # ==================================== w_n = gf.matsubara_freq(50., 512)
w = np.linspace(-4, 4, 2**12) dw = w[1] - w[0] BETA = 756. tau, w_n = gf.tau_wn_setup(dict(BETA=BETA, N_MATSUBARA=2**12)) nfp = gf.fermi_dist(w, BETA) U, tp = 3.4, 0.3 # Matsubara giw_d, giw_o = dimer.gf_met(w_n, 0., tp, 0.5, 0.) giw_d, giw_o, _ = dimer.ipt_dmft_loop(BETA, U, tp, giw_d, giw_o, tau, w_n, 5e-4) g0iw_d, g0iw_o = dimer.self_consistency(1j * w_n, 1j * giw_d.imag, giw_o.real, 0., tp, 0.25) siw_d, siw_o = ipt_imag.dimer_sigma(U, tp, g0iw_d, g0iw_o, tau, w_n) # Continuate sigma with Padé w_set = np.array([0, 3] + list(range(5, 761, 7))) ss, _ = dimer.pade_diag(1j * siw_d.imag, siw_o.real, w_n, w_set, w + 0.0005j) ############################################################################### # Low Energy in Sigma matsubara # ----------------------------- fig, ax = plt.subplots(2, 1, sharex=True) plot_spectral(w, tp, ss, ax, (-7, 5), zero_f_meas_mat(siw_d, siw_o)) # ax[1].set_title('Low Energy Matsubara sigma + Padé Sigma for plot') # fig.savefig('IPT_comp_mat_lowe.pdf')