Beispiel #1
0
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 triqs.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()
Beispiel #2
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 triqs.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()
Beispiel #3
0
# -- Extrapolation to nwf -> oo
ps = ParameterCollections(objects=ps)
x, y = 1. / ps.nwf, ps.chi_G
sidx = np.argsort(x)
x, y = x[sidx], y[sidx]
p = np.polyfit(x, y, 1)
y0 = np.polyval(p, 0)
X = np.linspace(0, x.max())
Y = np.polyval(p, X)

subp = [1, 2, 1]
plt.subplot(*subp)
subp[-1] += 1
plt.plot(0, y0, 'rx')
plt.plot(0, 0.3479, 'r+')
plt.subplot(*subp)
subp[-1] += 1
plt.plot(X, Y, '--k', lw=1.0, zorder=-100)
plt.plot(0, 0.3479, 'r+', label=r'Field')
plt.plot(0, y0, 'rx', label=r'BSE')
plt.grid(True)
plt.legend(loc='best', fontsize=8)
plt.xlabel(r'$1/N_\nu$')
plt.ylabel(r'$\chi(\mathbf{0})$')
plt.title(
    r'$\lim_{n_\nu \rightarrow \infty} \, \chi(\mathbf{0}) \approx $' + \
    '${:3.4f}$'.format(y0))
plt.tight_layout()
plt.savefig('figure_bse.svg')
plt.show()
Beispiel #4
0
    styles = {256: '^b', 128: '>r', 64: '<g', 32: '.m', 16: '.c', 8: '.y'}

    for filename in filenames:
        print('--> Loading:', filename)
        with HDFArchive(filename, 'r') as s:
            p = s['p']

        if hasattr(p, 'chi'):
            style = styles[p.nwf]
            plt.plot(1. / p.beta, p.chi, style, alpha=0.5)

    for nw in np.sort(list(styles.keys())):
        style = styles[nw]
        plt.plot([], [],
                 style,
                 alpha=0.5,
                 label=r'Analytic Tr$[\chi_m]/\beta^2$, $n_w=%i$' % nw)

    # ------------------------------------------------------------------

    plt.legend(loc='best', fontsize=6, frameon=False)
    #plt.xlabel(r'$\beta$')
    plt.xlabel(r'$T$')
    plt.ylabel(r'$\chi_m$')
    plt.loglog([], [])

    plt.tight_layout()
    plt.savefig('figure_hubbard_atom_static_magnetic_susceptibility.pdf')
    plt.show()
Beispiel #5
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()
Beispiel #6
0
data = np.squeeze(chi0w0.data[iw_zero_idx])

data = -1.0 * data
vmax = np.max(data.real)

plt.title('Square-lattice ' + r'$\chi_0(q, \omega=0)$, $\beta=%2.2f$' % beta)
plt.pcolor(qx.reshape((n_k, n_k)),
           qy.reshape((n_k, n_k)),
           data.reshape((n_k, n_k)).real,
           cmap='magma',
           vmin=0,
           vmax=vmax)

plt.colorbar()
plt.axis('equal')
plt.xlabel('$q_x/\pi$')
plt.ylabel('$q_y/\pi$')
plt.tight_layout()
plt.savefig('figure_chi0q_w0_square_latt.pdf')

# -- Plot Gamma and M point dynamic susceptibilities

opt = dict(vmin=-0.01, vmax=0.01, cmap='PuOr')
plt.figure(figsize=(12, 8))

subp = [3, 4, 1]

for q in [[0, 0, 0], [n_k / 2, n_k / 2, 0], [n_k / 2, 0, 0]]:

    qidx = bzmesh.index_to_linear(q)
Beispiel #7
0
G, Sigma = {}, {}

for solver in solver_lst:
    dat = HDFArchive('results/' + solver + '.h5', 'r')
    G[solver] = dat['G']
    Sigma[solver] = G0_iw.copy()
    Sigma[solver] << inverse(G0_iw) - inverse(G[solver])

# === For every block and solver, plot Green function and Self energy

block_lst = list(G[solver_lst[0]].indices)
n_blocks = len(block_lst)

for g, name in [[G, 'G'], [Sigma, '$\Sigma$']]:

    plt.subplots(n_blocks, 1, figsize=(10, 6 * n_blocks))

    for i, block in enumerate(block_lst, 1):
        fig = plt.subplot(n_blocks, 1, i)
        fig.set_title(name + "[" + block + "]")
        for solver in solver_lst:
            marker = marker_lst[solver_lst.index(solver)]
            oplot(g[solver][block][0, 0],
                  marker,
                  name=name + "[0,0]_%s" % solver)
        plt.xlabel("$\omega_n$")
        plt.ylabel(name + "[" + block + "]$(i\omega_n)$")

    plt.tight_layout()
    plt.show()
Beispiel #8
0
from common import *
from triqs.plot.mpl_interface import oplot, oplotr, oploti, plt

with HDFArchive('data_sc.h5', 'r') as a:
    ps = a['ps']
p = ps.objects[-1]

plt.figure(figsize=(3.25 * 2, 5))
subp = [2, 2, 1]

plt.subplot(*subp)
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)