def processing(BETA, U, tp, ax): with tdp.HDFArchive('DIMER_PM_B{}_tp0.3.h5'.format(BETA)) as data: # print(data) giw = tdp.get_giw(data['U' + str(U)], slice(-1, -3, -1)) giw_s = np.squeeze(.5 * (giw['sym_up'].data + giw['sym_dw'].data)) giw_s = giw_s[len(giw_s) / 2:len(giw_s) / 2 + 300] w_n = gf.matsubara_freq(BETA, len(giw_s)) giw_a = np.squeeze(.5 * (giw['asym_up'].data + giw['asym_dw'].data)) giw_a = giw_a[len(giw_a) / 2:len(giw_a) / 2 + 300] # more Avgs giw_s = 0.5j * (giw_s + giw_a).imag + 0.5 * (giw_s - giw_a).real x = int(.9 * BETA) der1 = (giw_s.real * w_n**2)[x:int(1.2 * BETA)].mean() der2 = ((giw_s.imag + 1 / w_n) * w_n**3)[x:int(1.2 * BETA)].mean() tails = -1j / w_n + der1 / w_n**2 + der2 * 1j / w_n**3 giw_s[x:] = tails[x:] sidab = 1j * w_n - tp - .25 * giw_s - 1 / giw_s w = np.linspace(0, 1, 40) swa = gf.pade_continuation(sidab, w_n[:int(1.8 * BETA)], 1j * w) ax[0].plot(w_n, sidab.imag) ax[0].plot(w, swa.imag, "k:") ax[1].plot(w_n, sidab.real) ax[1].plot(w, swa.real, "k:") sig_11_0 = np.polyfit(w_n[:2], sidab.imag[:2], 1)[1] rtp = np.polyfit(w_n[:2], sidab.real[:2], 1)[1] return swa.imag[0], swa.real[0], sig_11_0, rtp
def ipt_g_s(u_int, tp, BETA, seed, w): giw_d, giw_o, siw_d, siw_o, w_n = ipt_u_tp(u_int, tp, BETA, seed) w_set = np.arange(0, 541, 4) ss = gf.pade_continuation(1j * siw_d.imag + siw_o.real, w_n, w + 0.0005j, w_set) # A-bond gst = gf.semi_circle_hiltrans(w - tp - (ss.real - 1j * np.abs(ss.imag))) return gst, ss, w
def ipt_co_s(u_int, tp, BETA, seed, w): giw_d, giw_o, siw_d, siw_o, w_n = ipt_u_tp(u_int, tp, BETA, seed) w_set = list(np.arange(0, 20, 1)) w_set = w_set + list(np.arange(20, 120, 2)) w_set = w_set + list(np.arange(120, 512, 8)) sa = gf.pade_continuation(1j * siw_d.imag - siw_o.real, w_n, w + 0.0005j, w_set) # A-bond sa = sa.real - 1j * np.abs(sa.imag) return sa
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
dos = np.exp(-2 * eps_k**2) / np.sqrt(np.pi / 2) de = eps_k[1] - eps_k[0] dosde = (dos * de).reshape(-1, 1) nf = fermi_dist(omega, BETA) ############################################################################### # Insulator Calculations # ---------------------- ig_iwn, is_iwn = dmft_loop(U, 0.5, -1.j / (w_n - 1 / w_n), w_n, tau, conv=1e-12) igw = pade_continuation(ig_iwn, w_n, omega, np.arange(100)) isigma_w = pade_continuation(is_iwn, w_n, omega, np.arange(100)) lat_gf = 1 / (np.add.outer(-eps_k, omega + 4e-2j) - isigma_w) lat_Aw = -lat_gf.imag / np.pi icond = optical_conductivity(lat_Aw, lat_Aw, nf, omega, dosde) ############################################################################### # Metal Calculations # ------------------ mg_iwn, s_iwn = dmft_loop(U, 0.5, greenF(w_n), w_n, tau, conv=1e-10) mgw = pade_continuation(mg_iwn, w_n, omega, np.arange(100)) msigma_w = omega - 0.25 * mgw - 1 / mgw lat_gf = 1 / (np.add.outer(-eps_k, omega + 4e-2j) - msigma_w) lat_Aw = -lat_gf.imag / np.pi mcond = optical_conductivity(lat_Aw, lat_Aw, nf, omega, dosde)
# Insulator # --------- # u_int = 3.5 BETA = 100. tp = 0.3 title = "IPT lattice dimer\n" r"$U = {}$, $t_\perp = {}$, $\beta = {}$".format( u_int, tp, BETA) giw_d, giw_o, siw_d, siw_o, g0iw_d, g0iw_o, w_n = ipt_u_tp( u_int, tp, BETA, "ins") w = np.linspace(-3, 3, 800) eps_k = np.linspace(-1., 1., 61) w_set = np.concatenate((np.arange(100), np.arange(100, 200, 2))) plt.figure() g0wd = gf.pade_continuation(1j * g0iw_d.imag, w_n, w, w_set) plt.plot(w, g0wd.real, label=r"$\Re e G0_{11}$") plt.plot(w, g0wd.imag, label=r"$\Im m G0_{11}$") plt.legend(loc=0) plt.ylim([-2, 4]) plt.xlabel(r"$\omega$") plt.ylabel(r"$G0_{11}(\omega)$") plt.title(title) plt.xticks(np.linspace(-3, 3, 13)) plt.figure() g0wo = gf.pade_continuation(g0iw_o.real, w_n, w, w_set) plt.plot(w, g0wo.real, label=r"$\Re e G0_{12}$") plt.plot(w, g0wo.imag, label=r"$\Im m G0_{12}$") plt.legend(loc=0) plt.ylim([-5, 1])
args = parser.parse_args() BETA = args.BETA tp = args.tp w_n = gf.matsubara_freq(100., 300) w = np.linspace(-4, 4, 1000) w_set = np.arange(100) eps_k = np.linspace(-1., 1., 61) with tdp.HDFArchive(args.file) as data: for u_str in data: giw = tdp.get_giw(data[u_str], slice(-1, -5, -1)) giw_s = np.squeeze(.5 * (giw['sym_up'].data + giw['sym_dw'].data)) giw_s = giw_s[len(giw_s) / 2:len(giw_s) / 2 + 300] gs = gf.pade_continuation(giw_s, w_n, w, w_set) siw_s = 1j * w_n - tp - .25 * giw_s - 1 / giw_s ss = gf.pade_continuation(siw_s, w_n, w, w_set) gst = gf.semi_circle_hiltrans( w - tp - (ss.real - 1j * np.abs(ss.imag))) lat_gfs = 1 / np.add.outer(-eps_k, w - tp + 5e-2j - ss) Aw = np.clip(-lat_gfs.imag / np.pi, 0, 2) U = float(u_str[1:]) title = r'IPT lattice dimer $U={}$, $t_\perp={}$, $\beta={}$'.format( U, tp, BETA) ax = plot_greenfunct(w, gs, title, r'$G$') plot_greenfunct(w, gst, title, r'$G$', ax) plot_greenfunct(w, 1 / (w - tp - .25 * gst), title, r'$G0$', ax) plt.savefig('DOS_B100_tp{}_U{}.png'.format(tp, U))
return giw_d, giw_o, siw_d, siw_o plt.close('all') u_int = 3.5 BETA = 100. tau, w_n = gf.tau_wn_setup(dict(BETA=BETA, N_MATSUBARA=1024)) giw_d, giw_o = 1 / (1j * w_n + 4j / w_n), np.zeros_like(w_n) + 0j w = np.linspace(-4, 4, 2**13 + 1) giw_dt0, giw_ot0, siw_dt0, siw_ot0 = dmft_solve(giw_d, giw_o, BETA, u_int, 0, tau, w_n) w_set = np.concatenate((np.arange(80), np.arange(80, 150, 5))) gwdt0 = gf.pade_continuation(1j * giw_dt0.imag, w_n, w, w_set) swdt0 = gf.pade_continuation(1j * siw_dt0.imag, w_n, w, w_set) swdt0 = swdt0.real - 1j * np.abs(swdt0.imag) giw_dt03, giw_ot03, siw_dt03, siw_ot03 = dmft_solve(giw_d, giw_o, BETA, u_int, 0.3, tau, w_n) gwdt03 = gf.pade_continuation(1j * giw_dt03.imag, w_n, w, w_set) swdt03 = gf.pade_continuation(1j * siw_dt03.imag, w_n, w, w_set) swdt03 = swdt03.real - 1j * np.abs(swdt03.imag) fig, axes = plt.subplots(3, 2, sharex=True) fig.subplots_adjust(hspace=0, wspace=0.0) plot_gf(gwdt0, swdt0, axes[:, 0]) plot_gf(gwdt03, swdt03, axes[:, 1]) axes[0, 0].set_ylabel(r'$A_{11}(\omega)$')
giwss = np.array([np.concatenate((gf.gt_fouriertrans( np.load(s).reshape(-1, 128).sum(0) * .25, tau, w_n, ders), tail[x:2 * x])) for s in sources]).T giwf = np.concatenate((giwss[::-1].conj(), giwss)) #ngiwf = np.delete(giwf, [132, 144], 1) ngiwf = giwf nwn = np.concatenate((-wnl[:2 * x][::-1], wnl[:2 * x])) #plt.plot(nwn, ngiwf.imag) #plt.plot(nwn, ngiwf.real) sst = ngiwf.std(1) plt.plot(nwn, sst) avgiw = ngiwf.mean(1) sst[sst < 2e-3] = 2e-3 nsiw = (1j * nwn - .3 - .25 * avgiw).reshape(-1, 1) - 1 / ngiwf avsiw = nsiw.mean(1) ssiw = nsiw.std(1) ssiw[ssiw < .01] = .005 plt.plot(nwn, sst) plt.plot(nwn, .0007 / (nwn**2 + .2**2) + 2e-4) omega = np.linspace(-4, 4, 600) gw = gf.pade_continuation(avgiw, nwn, omega, np.arange(128, 200)) sw = gf.pade_continuation(avsiw, nwn, omega, np.arange(128, 200)) plt.plot(omega, gw.imag, lw=3) plt.plot(omega, sw.imag, lw=3) np.savez('/home/oscar/dev/Maxent/Dimer_{}_g_b{}U{}'.format(seed, beta, u_int), w_n=nwn, giw=avgiw, std=sst, gw_pade=gw, w=omega) np.savez('/home/oscar/dev/Maxent/Dimer_{}_s_b{}U{}'.format(seed, beta, u_int), w_n=nwn, giw=avsiw, std=ssiw, gw_pade=sw, w=omega) plt.plot(ngiwf[128]) plt.show()
def construct_dispersions(BETA, u_int, tp, seed): siw_d, siw_o, w_n = ipt_u_tp(u_int, tp, BETA, seed) w = np.linspace(-3, 3, 800) eps_k = np.linspace(-1., 1., 61) w_set = np.arange(200) ss = gf.pade_continuation(1j * siw_d.imag + siw_o.real, w_n, w, w_set) # A-bond sa = gf.pade_continuation(1j * siw_d.imag - siw_o.real, w_n, w, w_set) # bond lat_gfs = 1 / np.add.outer(-eps_k, w - tp + 5e-2j - ss) lat_gfa = 1 / np.add.outer(-eps_k, w + tp + 5e-2j - sa) Aw = np.clip(-.5 * (lat_gfa + lat_gfs).imag / np.pi, 0, 2) title = 'Spectral Function dispersion\n$U={}$, $t_\\perp={}$, $\\beta={}$'.format( u_int, tp, BETA) # Continuate in Sigma Diagonal then return to local plot_band_dispersion(w, Aw, 'Local ' + title, eps_k, 'intensity') file_r = "Aew_B{}U{}tp{}_{}_".format(BETA, u_int, tp, seed) plt.savefig(file_r + 'psl.png', format='png', transparent=False, bbox_inches='tight', pad_inches=0.05) # Continuate in Sigma Diagonal only plot anti-bonding Aw = np.clip(-lat_gfs.imag / np.pi, 0, 2) plot_band_dispersion(w, Aw, 'Anti-Bond ' + title, eps_k, 'intensity') plt.savefig(file_r + 'psa.png', format='png', transparent=False, bbox_inches='tight', pad_inches=0.05) # Continuate the dispersion on G(e, w)_AA Ag = [] for e in eps_k: gd = dimer.mat_inv(1j * w_n - e - 1j * siw_d.imag, -tp - siw_o.real)[0] Ag.append( np.clip( np.abs(-gf.pade_continuation(gd, w_n, w + 1e-2j, w_set).imag / np.pi), 0, 2)) plot_band_dispersion(w, np.asarray(Ag), 'Local ' + title, eps_k, 'intensity') plt.savefig(file_r + 'pgl.png', format='png', transparent=False, bbox_inches='tight', pad_inches=0.05) # Continuate on G(e, w)_AA but skipping frequencies for smooth output w_set = np.arange(0, 200, 4) Ag = [] for e in eps_k: gd = dimer.mat_inv(1j * w_n - e - 1j * siw_d.imag, -tp - siw_o.real)[0] Ag.append( np.clip( np.abs(-gf.pade_continuation(gd, w_n, w + 1e-2j, w_set).imag / np.pi), 0, 2)) plot_band_dispersion(w, np.asarray(Ag), 'Local ' + title, eps_k, 'intensity') plt.savefig(file_r + 'pgls.png', format='png', transparent=False, bbox_inches='tight', pad_inches=0.05)