from pytriqs.gf import * from pytriqs.gf.gf_fnt import rebinning_tau from pytriqs.archive import * from pytriqs.plot.mpl_interface import oplot with HDFArchive('slater_five_band.h5', 'r') as ar: # Calculate orbital- and spin-averaged Green's function G_tau = ar['G_tau-1'] g = G_tau['up_0'] # This gives a complex valued gf (required by rebinning_tau) g_tau_ave = Gf(mesh=g.mesh, target_shape=g.target_shape) for name, g in G_tau: g_tau_ave += g g_tau_ave = g_tau_ave / 10. g_tau_rebin = rebinning_tau(g_tau_ave, 1000) g_tau_rebin.name = r'$G_{\rm ave}$' oplot(g_tau_rebin, linewidth=2, label='G_avg')
N_max = 10 arch = HDFArchive('nonint.h5', 'r') for i in arch: subarch = arch[i] pp = PdfPages("G_nonint_%s.pdf" % i) G_tau = subarch['G_tau'] V = subarch['V'] e = subarch['e'] beta = G_tau.mesh.beta n_tau = len(G_tau.mesh) for m, b in enumerate(G_tau.indices): g_theor = GfImTime(indices=[0], beta=beta, n_points=n_tau) e1 = e[m] - V[m] e2 = e[m] + V[m] g_theor_w = GfImFreq(indices=[0], beta=beta) g_theor_w << 0.5 * inverse(iOmega_n - e1) + 0.5 * inverse(iOmega_n - e2) g_theor << InverseFourier(g_theor_w) plt.clf() G_bin = rebinning_tau(G_tau[b], 200) oplot(G_bin[0, 0], name="cthyb") oplot(g_theor[0, 0], name="Theory") pp.savefig(plt.gcf()) pp.close()
plt.bar(index-0.13, y_N1_up, bottom=y_N1_dn, align='center', width=0.15, color = 'tomato', label = '$\\uparrow$' ) plt.bar(index+0.13, y_N2_up, bottom=y_N2_dn, align='center', width=0.15, color = 'tomato') plt.legend(loc = 'upper center', fontsize = 9) pp.savefig() pp.close() # Plot Green's functions pp = PdfPages('G_tau_mg_beta%.0f_prob%.2f.pdf' % (beta,move_global_prob)) mg_pairs = [(a,b) for a,b in product(all_mg,all_mg) if a<b] spin_labels = {'up':'$\uparrow\uparrow$', 'dn':'$\downarrow\downarrow$'} for mg1, mg2 in mg_pairs: plt.clf() for s, i in product(('up','dn'),(0,1)): G_tau_1 = rebinning_tau(arch[mg1]['G_tau'][s], plot_n_tau) G_tau_2 = rebinning_tau(arch[mg2]['G_tau'][s], plot_n_tau) oplot(G_tau_1[i,i], alpha=0.25, mode='R', label="%s,%s,%i%i" % (mg1,s,i,i)) oplot(G_tau_2[i,i], alpha=0.25, mode='R', label="%s,%s,%i%i" % (mg2,s,i,i)) plt.title("Test move_global $\\beta$ = %.0f, move_global_prob = %.3f" % (beta,move_global_prob), fontsize=12) plt.ylim(-0.6,0.05) plt.ylabel('$G(\\tau)$') plt.legend(loc = 'lower center', fontsize = 9) pp.savefig() pp.close()
num_orbitals = 2 pp = PdfPages('G.pdf') ed_arch = HDFArchive('kanamori_offdiag.ed.h5', 'r') for use_qn in (True, False): file_name = "kanamori_offdiag" if use_qn: file_name += ".qn" file_name += ".h5" try: arch = HDFArchive(file_name, 'r') name = "cthyb (QN)" if use_qn else "cthyb" GF_up = rebinning_tau(arch['G_tau']['up'], 200) GF_dn = rebinning_tau(arch['G_tau']['dn'], 200) ed_opt = dict(lw=2.0, alpha=1.0) cthyb_opt = dict(lw=1.0, alpha=1.0) for o1, o2 in product(range(num_orbitals), repeat=2): plt.clf() plt.title('using_qn = ' + str(use_qn)) oplot(ed_arch['up'][o1, o2], name="ED,$\uparrow%i%i$" % (o1, o2), **ed_opt) oplotr(GF_up[o1, o2], name=name + ",$\uparrow%i%i$" % (o1, o2), **cthyb_opt) oploti(GF_up[o1, o2],
e = delta_params[cn]['e'] e1 = e - V e2 = e + V g_theor_w = GfImFreq(indices = [0], beta=beta, n_points=10) g_theor_w << 0.5*inverse(iOmega_n - e1) + 0.5*inverse(iOmega_n - e2) g_theor[nc,nc] << InverseFourier(g_theor_w) pp = PdfPages('G.pdf') for sn in spin_names: for nc, cn in enumerate(orb_names): plt.clf() gf = rebinning_tau(arch['G_tau'][mkind(sn,cn)[0]],200) # Plot the results oplot(gf, name="cthyb") # Plot the reference curve if use_interaction: oplot(g_ref[nc,nc], name="ED") else: oplot(g_theor[nc,nc], name="ED") axes = plt.gca() axes.set_title('$' + sn + '$, $' + cn + '$') axes.set_xlabel('$\\tau$') axes.set_ylabel('$G(\\tau)$') axes.set_ylim(-1,0) axes.legend(loc='lower center',prop={'size':14})
num_orbitals = 2 pp = PdfPages('G.pdf') ed_arch = HDFArchive('kanamori.ed.h5', 'r') for use_qn in (True, False): file_name = "kanamori" if use_qn: file_name += ".qn" file_name += ".h5" try: arch = HDFArchive(file_name, 'r') plt.clf() name = "cthyb (QN)" if use_qn else "cthyb" for o in range(num_orbitals): oplot(rebinning_tau(arch['G_tau']['up_%i' % o], 200), name=name + ",$\uparrow%i$" % o) oplot(rebinning_tau(arch['G_tau']['dn_%i' % o], 200), name=name + ",$\downarrow%i$" % o) oplot(ed_arch['up-%i' % o], name="ED,$\uparrow%i$" % o) oplot(ed_arch['dn-%i' % o], name="ED,$\downarrow%i$" % o) setup_fig() pp.savefig(plt.gcf()) except IOError: pass pp.close()
# Plot G(\tau) pp = PdfPages('G_asymm_bath.pdf') for e_group_name in arch: e_group = arch[e_group_name] e_group_ed = arch_ed[e_group_name] beta = e_group['beta'] U = e_group['U'] ed = e_group['ed'] V = e_group['V'] e = e_group['e'] plt.clf() oplot(rebinning_tau(e_group['G_tau']['up'],300),name="CTHYB,$\uparrow\uparrow$") oplot(rebinning_tau(e_group['G_tau']['dn'],300),name="CTHYB,$\downarrow\downarrow$") #oplot(rebinning_tau(e_group_ed['G_tau']['up'],300),name="ED,$\uparrow\uparrow$") #oplot(rebinning_tau(e_group_ed['G_tau']['dn'],300),name="ED,$\downarrow\downarrow$") oplot(e_group_ed['G_tau']['up'],name="ED,$\uparrow\uparrow$") oplot(e_group_ed['G_tau']['dn'],name="ED,$\downarrow\downarrow$") a = plt.gca() a.set_ylabel('$G(\\tau)$') a.set_xlim((0,beta)) a.set_ylim((-1,0)) a.legend(loc='lower right',prop={'size':8}) a.set_title("$U=%.1f$, $\epsilon_d=%.1f$, $V=%.1f$, $\epsilon_k=%.1f$" % (U,ed,V,e))
mkind = lambda spin: (spin, 0) if use_blocks else ("tot", spin) try: arch = HDFArchive(file_name, 'r') plt.clf() name_parts = [] if use_blocks: name_parts.append('Block') if use_qn: name_parts.append('QN') name = 'cthyb' + (' (' + ', '.join(name_parts) + ')' if len(name_parts) else '') for spin in spin_names: bn, i = mkind(spin) GF = rebinning_tau(arch['G_tau'][bn], 500) if use_blocks: oplot(GF, name=name + "," + { 'up': "$\uparrow\uparrow$", 'dn': "$\downarrow\downarrow$" }[spin]) else: i = spin_names.index(i) oplot(GF[i, i], name=name + "," + { 'up': "$\uparrow\uparrow$", 'dn': "$\downarrow\downarrow$" }[spin]) oplot(ed_arch[spin], name="ED," + {
N_max = 10 arch = HDFArchive('nonint.h5', 'r') for i in arch: subarch = arch[i] pp = PdfPages("G_nonint_%s.pdf" % i) G_tau = subarch['G_tau'] V = subarch['V'] e = subarch['e'] beta = G_tau.mesh.beta n_tau = len(G_tau.mesh) for m, b in enumerate(G_tau.indices): g_theor = GfImTime(indices=[0], beta=beta, n_points=n_tau) e1 = e[m] - V[m] e2 = e[m] + V[m] g_theor_w = GfImFreq(indices=[0], beta=beta) g_theor_w << 0.5 * inverse(iOmega_n - e1) + 0.5 * inverse(iOmega_n - e2) g_theor[0, 0] << InverseFourier(g_theor_w) plt.clf() oplot(rebinning_tau(G_tau[b][0, 0], 200), name="cthyb") oplot(g_theor[0, 0], name="Theory") pp.savefig(plt.gcf()) pp.close()