def plot_p(p): xlim = [-50, 50] subp = [3, 1, 1] plt.subplot(*subp) subp[-1] += 1 oploti(p.g0_w[0, 0], label=r'$G_0(i\omega_n)$') oploti(p.g_w[0, 0], label=r'$G(i\omega_n)$') oploti(p.sigma_w[0, 0], label=r'$\Sigma(i\omega_n)$') plt.legend(loc='best') plt.xlim(xlim) plt.subplot(*subp) subp[-1] += 1 oplotr(p.G_tau_raw['up'], alpha=0.75) oplotr(p.G_tau['up']) plt.gca().legend().set_visible(False) plt.subplot(*subp) subp[-1] += 1 G_l = p.G_l.copy() for b, g in G_l: G_l[b].data[:] = np.abs(g.data) oplotr(G_l['up'], 'o-') plt.semilogy([], []) plt.gca().legend().set_visible(False) plt.tight_layout() plt.savefig('figure_field_sc_gf.svg')
diff = np.max(np.abs(Delta_tau.data - Delta_tau_ref.data)) print 'Delta_tau diff =', diff np.testing.assert_array_almost_equal(Delta_tau.data, Delta_tau_ref.data) assert( diff < 1e-8 ) diff = np.max(np.abs(Delta_iw.data - Delta_iw_ref.data)) print 'Delta_iw diff =', diff np.testing.assert_array_almost_equal(Delta_iw.data, Delta_iw_ref.data) assert( diff < 1e-7 ) if False: from pytriqs.plot.mpl_interface import oplot, oplotr, oploti, plt plt.figure() oplotr(Delta_tau - Delta_tau_ref) plt.show() plt.figure() oplotr(Delta_tau) oplotr(Delta_tau_ref) plt.figure() oplotr(Delta_iw) oplotr(Delta_iw_ref) plt.figure() oploti(Delta_iw) oploti(Delta_iw_ref) plt.show()
nw=1, nwf=p.n_iw / 2, nwf_gf=p.n_iw, ) a = analytic_hubbard_atom(**parm.dict()) a.G_iw.name = r'$G_{analytic}$' plt.figure(figsize=(3.25 * 2, 3 * 2)) subp = [2, 2, 1] plt.subplot(*subp) subp[-1] += 1 oploti(p.G_iw) oploti(a.G_iw) plt.subplot(*subp) subp[-1] += 1 diff = a.G_iw.copy() diff << p.G_iw['up'] - a.G_iw diff.name = r'$G_{ctint} - G_{analytic}$' oplot(diff) plt.subplot(*subp) subp[-1] += 1 vmax = np.max(np.abs(p.chi_m.data.real)) opt = dict(vmax=vmax, vmin=-vmax, cmap='PuOr') data = np.squeeze(p.chi_m.data.real) plt.pcolormesh(data, **opt)
a['Delta_iw_ref'] = Delta_iw_ref a['Delta_iw_fit'] = Delta_iw_fit # -- Plot from pytriqs.plot.mpl_interface import oplot, oplotr, oploti, plt plt.figure(figsize=(10, 10)) ylim = [-4, 4] plt.plot([w_min.imag]*2, ylim, 'sr-', lw=0.5) plt.plot([w_max.imag]*2, ylim, 'sr-', lw=0.5) for i1, i2 in itertools.product(range(2), repeat=2): oplotr(Delta_iw[i1, i2], alpha=0.1) oploti(Delta_iw[i1, i2], alpha=0.1) oplotr(Delta_iw_ref[i1, i2], lw=4, alpha=0.25) oploti(Delta_iw_ref[i1, i2], lw=4, alpha=0.25) oplotr(Delta_iw_fit[i1, i2]) oploti(Delta_iw_fit[i1, i2]) ax = plt.gca() ax.legend_ = None plt.ylim([-1, 1]) plt.tight_layout() plt.savefig(figure_filename) plt.show(); exit()
print 'h_loc =\n', h_loc print 'h_loc_ref =\n', h_loc_ref Delta_tau_ref = S.Delta_tau['0'] Delta_iw_ref = Delta_iw.copy() Delta_iw_ref << Fourier(Delta_tau_ref) diff = h_loc - h_loc_ref print 'h_loc diff =', diff for ops, prefactor in diff: print prefactor, ops assert (np.abs(prefactor) < 1e-10) diff = np.max(np.abs(Delta_tau.data - Delta_tau_ref.data)) print 'Delta_tau diff =', diff np.testing.assert_array_almost_equal(Delta_tau.data, Delta_tau_ref.data) assert (diff < 1e-8) diff = np.max(np.abs(Delta_iw.data - Delta_iw_ref.data)) print 'Delta_iw diff =', diff np.testing.assert_array_almost_equal(Delta_iw.data, Delta_iw_ref.data) assert (diff < 1e-7) if False: from pytriqs.plot.mpl_interface import oplot, oplotr, oploti, plt oplotr(Delta_tau - Delta_tau_ref) oploti(Delta_tau - Delta_tau_ref) plt.show() exit()
subp[-1] += 1 plt.plot(ps.iter, ps.dG_l, 's-') plt.ylabel('$\max | \Delta G_l |$') plt.xlabel('Iteration') plt.semilogy([], []) plt.subplot(*subp) subp[-1] += 1 for b, g in p.G_l: p.G_l[b].data[:] = np.abs(g.data) oplotr(p.G_l['up'], 'o-', label=None) plt.ylabel('$| G_l |$') plt.semilogy([], []) plt.subplot(*subp) subp[-1] += 1 oplotr(p.G_tau_raw['up'], alpha=0.75, label='Binned') oplotr(p.G_tau['up'], label='Legendre') plt.legend(loc='best', fontsize=8) plt.ylabel(r'$G(\tau)$') plt.subplot(*subp) subp[-1] += 1 oploti(p.sigma_w[0, 0], '.-', label=None) plt.ylabel(r'$\Sigma(i\omega_n)$') plt.xlim([-100, 100]) plt.tight_layout() plt.savefig('figure_sc.svg') plt.show()