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 loop_tp_u(tprange, u_range, beta, filestr, seed='mott gap'): save_dir = filestr.format(beta) if np.allclose(tprange, tprange[0]) and 'tp' not in save_dir: save_dir = os.path.join(save_dir, 'tp' + str(tprange[0])) elif np.allclose(u_range, u_range[0]): save_dir = os.path.join(save_dir, 'U' + str(u_range[0])) if not os.path.exists(save_dir): os.makedirs(save_dir) setup = { 'beta': beta, 'tprange': tprange.tolist(), 'u_range': u_range.tolist() } with open(save_dir + '/setup', 'w') as conf: json.dump(setup, conf, indent=2) ############################################################################### tau, w_n = gf.tau_wn_setup( dict(BETA=beta, N_MATSUBARA=max(2**ceil(log(6 * beta) / log(2)), 256))) giw_d, giw_o = dimer.gf_met(w_n, 0., tprange[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 = [] for tp, u_int in zip(tprange, u_range): giw_d, giw_o, loops = dimer.ipt_dmft_loop(beta, u_int, tp, giw_d, giw_o, tau, w_n, 1 / 5 / beta) giw_s.append((giw_d.imag, giw_o.real)) np.save(save_dir + '/giw', np.array(giw_s))
def test_ipt_dimer_pm_g(u_int, result, beta=50.): tau, w_n = tau_wn_setup(dict(BETA=beta, N_MATSUBARA=256)) giw_d, giw_o = dimer.gf_met(w_n, 0., 0, 0.5, 0.) giw_d = dimer.ipt_dmft_loop(beta, u_int, 0, giw_d, giw_o, tau, w_n, 1e-5)[0][:64] assert np.allclose(result, giw_d, atol=3e-3)
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 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 loop_urange(urange, tp, beta): ekin, epot = [], [] tau, w_n = gf.tau_wn_setup(dict(BETA=beta, N_MATSUBARA=2**10)) giw_d, giw_o = dimer.gf_met(w_n, 0., 0., 0.5, 0.) for u_int in urange: giw_d, giw_o, _ = dimer.ipt_dmft_loop(beta, u_int, tp, giw_d, giw_o, tau, w_n, 1e-4) 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 + 0.25, ekin[-1], u_int)) return np.array(ekin), np.array(epot)
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 loop_beta(u_int, tp, betarange, seed): avgH = [] for beta in betarange: 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 == 'I': giw_d, giw_o = 1 / (1j * w_n - 4j / w_n), np.zeros_like(w_n) + 0j giw_d, giw_o, _ = dimer.ipt_dmft_loop( beta, u_int, tp, giw_d, giw_o, tau, w_n, 1e-6) ekin = dimer.ekin(giw_d[:int(8 * beta)], giw_o[:int(8 * beta)], w_n[:int(8 * beta)], tp, beta) epot = dimer.epot(giw_d[:int(8 * beta)], w_n[:int(8 * beta)], beta, u_int ** 2 / 4 + tp**2 + 0.25, ekin, u_int) avgH.append(ekin + epot) return np.array(avgH)
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
ax[1].set_ylim(*ylim) 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')