def window_conv_depr():

    nwf_vec = np.array([5, 10, 20, 40, 80, 160, 320])
    diff_vec = np.zeros_like(nwf_vec, dtype=np.float)

    for idx, nwf in enumerate(nwf_vec):
        d = analytic_solution(beta=2.0, U=5.0, nw=1, nwf=nwf)
        diff = np.max(np.abs(d.gamma_m.data - d.gamma_m_num.data))
        diff_vec[idx] = diff
        print 'nwf, diff =', idx, nwf, diff

    print diff_vec

    from pytriqs.plot.mpl_interface import oplot, oplotr, oploti, plt

    x = 1. / nwf_vec

    plt.figure(figsize=(3.25, 3))

    plt.plot(x, diff_vec, 'o-', alpha=0.75)
    plt.xlabel(r'$1/n_{w}$')
    plt.ylabel(r'$\max|\Gamma_{ana} - \Gamma_{num}|$')
    plt.ylim([0, diff_vec.max()])
    plt.xlim([0, x.max()])

    plt.tight_layout()
    plt.savefig('figure_bse_hubbard_atom_convergence.pdf')
    plt.show()
Exemple #2
0
from pytriqs.gf.local import GfImFreq, SemiCircular

g = GfImFreq(indices = ['eg1','eg2'], beta = 50, n_points = 1000, name = "egBlock")

g['eg1','eg1'] = SemiCircular(half_bandwidth = 1)
g['eg2','eg2'] = SemiCircular(half_bandwidth = 2)

from pytriqs.plot.mpl_interface import oplot, plt
oplot(g, '-o', x_window = (0,10))
plt.ylim(-2,1)

Exemple #3
0
    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()

Exemple #4
0
from pytriqs.gf.local import GfReFreq
from pytriqs.archive import HDFArchive
from math import pi

R = HDFArchive('myfile.h5', 'r') 
 
from pytriqs.plot.mpl_interface import oplot, plt

for name, g in R.items() :  # iterate on the elements of R, like a dict ...
    oplot( (- 1/pi * g).imag, "-o", name = name)

plt.xlim(-1,1) 
plt.ylim(0,7) 

p.savefig("./tut_ex3b.png") 

from pytriqs.gf.local import GfImFreq, SemiCircular

g = GfImFreq(indices=['eg1', 'eg2'], beta=50, n_points=1000, name="egBlock")

g['eg1', 'eg1'] = SemiCircular(half_bandwidth=1)
g['eg2', 'eg2'] = SemiCircular(half_bandwidth=2)

from pytriqs.plot.mpl_interface import oplot, plt
oplot(g, '-o', x_window=(0, 10))
plt.ylim(-2, 1)
Exemple #6
0
from pytriqs.gf.local import GfReFreq
from pytriqs.archive import HDFArchive
from math import pi

R = HDFArchive('myfile.h5', 'r')

from pytriqs.plot.mpl_interface import oplot, plt

for name, g in R.items():  # iterate on the elements of R, like a dict ...
    oplot((-1 / pi * g).imag, "-o", name=name)

plt.xlim(-1, 1)
plt.ylim(0, 7)

p.savefig("./tut_ex3b.png")
Exemple #7
0
    qidx = bzmesh.index_to_linear(q)

    print '-'*72
    print 'q =', q
    print 'qidx =', qidx
    print 'q_list[qidx] =', q_list[qidx]
    print 'q_list[qidx]/np.pi =', np.array(q_list[qidx])/np.pi
    
    data = np.squeeze(chi0w0.data[:, qidx])
    print data.shape
    
    plt.subplot(*subp); subp[-1] += 1
    plt.title(r'$q = \pi \times$ %s' % str(np.array(q_list[qidx])/np.pi))
    plt.plot(data.real)
    plt.ylabel(r'Re[$\chi_0(i\omega)$]')
    plt.ylim([-vmax, 0.1*vmax])

    plt.subplot(*subp); subp[-1] += 1
    plt.plot(data.imag)
    plt.ylabel(r'Im[$\chi_0(i\omega)$]')

    plt.subplot(*subp); subp[-1] += 1
    plt.pcolormesh(chi0q.data[:,:,qidx,0,0,0,0].real, **opt)
    plt.colorbar()
    plt.axis('equal')
    plt.title(r'Re[$\chi_0(i\omega, i\nu)$]')
    plt.xlabel(r'$\nu$')
    plt.ylabel(r'$\omega$')

    plt.subplot(*subp); subp[-1] += 1
    plt.pcolormesh(chi0q.data[:,:,qidx,0,0,0,0].imag, **opt)
Exemple #8
0
ps = []
filenames = np.sort(glob.glob('data_B_*.h5'))
for filename in filenames:
    with HDFArchive(filename, 'r') as a:
        p = a['ps'].objects[-1]
    ps.append(p)
ps = ParameterCollections(ps)

B, M = ps.B, ps.M
B = np.concatenate((-B[1:][::-1], B))
M = np.concatenate((-M[1:][::-1], M))
p = np.polyfit(M, B, 5)
m = np.linspace(-0.5, 0.5, num=1000)
b = np.polyval(p, m)
chi = 1. / np.polyval(np.polyder(p, 1), 0.).real

plt.figure(figsize=(3.25 * 1.5, 2.5 * 1.5))
plt.title(r'$\chi = \frac{dM}{dB}|_{B=0} \approx $' + '$ {:3.4f}$'.format(chi))
plt.plot(B, M, 'o', alpha=0.75, label='DMFT field')
plt.plot(b, m, '-', alpha=0.75, label='Poly fit')
plt.legend(loc='upper left')
plt.grid(True)
plt.xlabel(r'$B$')
plt.ylabel(r'$M$')
plt.xlim([B.min(), B.max()])
plt.ylim([-0.5, 0.5])
plt.tight_layout()
plt.savefig('figure_field.svg')
plt.show()
Exemple #9
0
    for idx, nwf in enumerate(nwf_vec):
        d = analytic_hubbard_atom(beta=2.0,
                                  U=5.0,
                                  nw=1,
                                  nwf=nwf,
                                  nwf_gf=2 * nwf)
        diff_vec[idx] = np.max(np.abs(d.gamma_m.data - d.gamma_m_num.data))
        print 'nwf, diff =', idx, nwf, diff_vec[idx]

    # ------------------------------------------------------------------
    # -- Plot

    from pytriqs.plot.mpl_interface import oplot, oplotr, oploti, plt

    x = 1. / nwf_vec

    plt.figure(figsize=(3.25, 3))

    plt.plot(x, diff_vec, 'o-', alpha=0.75)

    plt.xlabel(r'$1/n_{w}$')
    plt.ylabel(r'$\max|\Gamma_{ana} - \Gamma_{num}|$')

    plt.ylim([0, diff_vec.max()])
    plt.xlim([0, x.max()])

    plt.tight_layout()
    plt.savefig('figure_bse_hubbard_atom_convergence.pdf')

    plt.show()