Exemplo n.º 1
0
def DMFT_SCC(fDelta, fileGf):
    """This subroutine creates Delta.inp from Gf.out for DMFT on bethe
    lattice: Delta=t^2*G If Gf.out does not exist, it creates Gf.out
    which corresponds to the non-interacting model In the latter case
    also creates the inpurity cix file, which contains information
    about the atomic states."""
    w_n = gf.matsubara_freq(BETA, 3 * BETA)
    try:
        hyb = 0.25 * np.squeeze(np.load(fileGf))
        # If output file exists, start from previous iteration
        delta = np.array([w_n, hyb.real, hyb.imag])
        if args.AFM:
            delta = np.array(
                [w_n, hyb[1].real, hyb[1].imag, hyb[0].real, hyb[0].imag])
    except Exception:  # otherwise start from non-interacting limit
        print('Starting from non-interacting model at beta' + str(BETA))
        hyb = 0.25 * gf.greenF(w_n)
        if args.insulator:
            hyb = 0.25 * gf.greenF(w_n, sigma=-1j * args.U[0]**2 / 4 / w_n)

        # creating impurity cix file
        with open(params['cix'][0], 'w') as f:
            f.write(icix)

        # Preparing input file Delta.inp
        delta = np.array([w_n, hyb.real, hyb.imag])
        if args.AFM:
            delta = np.array([w_n, hyb.real, hyb.imag, hyb.real, hyb.imag])

    np.savetxt(fDelta, delta.T)
Exemplo n.º 2
0
def plot_tails(BETA, U, tp, ax=None):
    w_n = gf.matsubara_freq(BETA, BETA, BETA / 2.)
    if ax is None:
        ax = plt
    ax.plot(w_n, -1 / w_n, '--')
    ax.plot(w_n, -tp / w_n**2, '--')
    ax.plot(w_n, -1 / w_n + (U**2 / 4 + 0.25) / w_n**3, '--')
Exemplo n.º 3
0
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
Exemplo n.º 4
0
def test_pade():
    """Test pade Analytical Continuation for the semi-circular DOS"""
    w_n = gf.matsubara_freq(200)
    giw = gf.greenF(w_n)
    omega = np.linspace(-0.7, 0.7, 100)  # avoid semicircle edges
    gw_ref = gf.greenF(-1j * omega + 1e-5)
    pade_c = gf.pade_coefficients(giw, w_n)
    gw_cont = gf.pade_rec(pade_c, omega, w_n)
    assert np.allclose(gw_ref, gw_cont, 1e-3)
Exemplo n.º 5
0
def test_hilbert_trans_integral(halfbandwidth):
    """Test hilbert transform of semi-circle to direct integral"""

    w = np.linspace(-3, 3, 2**9)
    w_n = gf.matsubara_freq(20)
    giw = gf.greenF(w_n, D=halfbandwidth)
    rho_w = dos.bethe_lattice(w, halfbandwidth / 2)
    Apiw = np.array([simps(rho_w / (1j * iw - w), w) for iw in w_n])

    assert np.allclose(Apiw, giw, 2e-4)
Exemplo n.º 6
0
def collect_bined_saves():
    binede_dat = glob('gtau_bin_*')
    G = np.array([np.load(dfile) for dfile in binede_dat])
    gtau = G.mean(1)
    tau, w_n = gf.tau_wn_setup(dict(BETA=32., N_MATSUBARA=32))
    fw = gf.matsubara_freq(32., 64, -63)

    giw = gf.gt_fouriertrans(gtau, tau, w_n, [1., 0., .25 + 2.5**2 / 4])

    sgiw = np.concatenate((giw.conj().T[::-1], giw.T))
    np.savez('bined', w_n=fw, giw=sgiw)
Exemplo n.º 7
0
def refine_mat_solution(end_solver, u_int):
    """Takes the end converged dmft solver in matsubara frequencies
    and increases the range of the matsubara frequencies to get
    nicer plots"""

    beta = end_solver.beta
    sim = TwoSite_Matsubara(beta, end_solver.t, beta)
    sim.omega = 1j * matsubara_freq(beta)
    sim.mu = end_solver.mu
    sim.solve(u_int / 2, u_int, end_solver.hyb_V())

    return sim
Exemplo n.º 8
0
def test_tail_fit(moments):
    wn = gf.matsubara_freq(50)
    moment = np.array(moments)
    tail = gf.tail(wn, moment * np.array([1j, 1, 1j]),
                   np.arange(len(moment)) + 1)
    tailn = np.sum(
        np.random.randn(len(wn), 2) * 0.00005 * np.array((1, 1j)), 1)
    tail = tail + tailn

    fit_moments = gf.lin_tail_fit(wn, tail, -20, 30)[1]
    print(fit_moments - moment)
    assert np.allclose(moment, fit_moments, atol=3e-3)
Exemplo n.º 9
0
def refine_mat_solution(end_solver, u_int):
    """Takes the end converged dmft solver in matsubara frequencies
    and increases the range of the matsubara frequencies to get
    nicer plots"""

    beta = end_solver.beta
    sim = TwoSite_Matsubara(beta, end_solver.t, beta)
    sim.omega = 1j*matsubara_freq(beta)
    sim.mu = end_solver.mu
    sim.solve(u_int/2, u_int, end_solver.hyb_V())

    return sim
Exemplo n.º 10
0
def test_tail_fit_semicirc():
    wn = gf.matsubara_freq(50)
    gci = gf.greenF(wn)
    tailn = np.sum(
        np.random.randn(len(wn), 2) * 0.00006 * np.array(
            (1, 1j)), 1) / (wn**2 + 3)
    tail = gci + tailn

    fit_moments = gf.lin_tail_fit(wn, tail, -45, 45)[1]
    moment = np.array((-1, 0, 0.25))
    print(fit_moments - moment)
    assert np.allclose(moment, fit_moments, atol=7e-3)
Exemplo n.º 11
0
def test_hilbert_trans_func(halfbandwidth):
    """Test Hilbert transforms of semi-circle"""
    # Match in the 2 forms
    w_n = gf.matsubara_freq(200)
    giw = gf.greenF(w_n, sigma=-1j / w_n, mu=-0.2, D=halfbandwidth)
    ss = gf.semi_circle_hiltrans(1j * w_n - .2 + 1j / w_n, D=halfbandwidth)
    assert np.allclose(ss, giw)

    # corresponds to semi-circle
    w = np.linspace(-3, 3, 2**9)
    ss = gf.semi_circle_hiltrans(w + 1e-5j, D=halfbandwidth)
    assert np.allclose(dos.bethe_lattice(w, halfbandwidth / 2),
                       -ss.imag / np.pi,
                       atol=1e-4)
Exemplo n.º 12
0
def ploter(fname, args):
    array = np.load(fname)
    if args.transpose:
        array = np.transpose(array)

    print('The inspected array has a shape: {}'.format(array.shape))
    x = np.arange(len(array))
    if args.beta:
        x = gf.matsubara_freq(args.beta, len(array))
    if 'complex' in str(array.dtype):
        plt.plot(x, array.real, '--')
        plt.plot(x, array.imag, '-')
        plt.title('-- is real, - is imaginary')
    else:
        plt.plot(x, array)
Exemplo n.º 13
0
def plot_fit_dos(beta, avg, filestr='SB_PM_B{}', xlim=2):
    """Plot the evolution of the Green's function in DMFT iterations"""
    _, axes = plt.subplots(1, 2, figsize=(13, 8))

    u_range, fit_gf, lgiw = fit_dos(beta, avg, filestr)
    w_n = gf.matsubara_freq(beta, len(lgiw[0]))
    omega = np.arange(0, w_n[2], 0.05)
    for u_int, gfit, giw in zip(u_range, fit_gf, lgiw):
        axes[0].plot(w_n, giw.imag, 'o:', label='U=' + str(u_int))
        axes[0].plot(omega, gfit(omega), 'k:')

    axes[0].set_xlim([0, xlim])
    axes[1].plot(u_range, [dos(0) for dos in fit_gf], 'o-')

    plt.show()
    plt.close()
Exemplo n.º 14
0
def estimate_dos_at_fermi_level_U_vs_tp(tpr, ulist, beta, phase):
    dos_fl = []
    w_n = gf.matsubara_freq(beta, 3)
    save_file = 'dimer_ipt_{}_B{}.npy'.format(phase, beta)
    if os.path.exists(save_file):
        return -np.load(save_file).T

    for tp in tpr:
        filestr = 'disk/phase_Dimer_ipt_{}_B{}/tp{:.3}/giw.npy'.format(
            phase, beta, tp)
        gfs = np.load(filestr)
        dos_fl.append(
            np.array([gf.fit_gf(w_n, gfs[i][0][:3])(0.) for i in ulist]))

    np.save(save_file, dos_fl)

    return -np.array(dos_fl).T
Exemplo n.º 15
0
def estimate_dos_at_fermi_level_T_vs_U(tp, ulist, temp, phase):
    dos_fl = []
    save_file = 'dimer_ipt_{}_tp{:.2}.npy'.format(phase, tp)
    if os.path.exists(save_file):
        return -np.load(save_file)

    for T in temp:
        w_n = gf.matsubara_freq(1 / T, 3)
        filestr = 'disk/phase_Dimer_ipt_{}_tp{}/B{:.5}/giw.npy'.format(
            phase, tp, 1 / T)
        gfs = np.load(filestr)
        dos_fl.append(
            np.array([gf.fit_gf(w_n, gfs[i][0][:3])(0.) for i in ulist]))

    np.save(save_file, dos_fl)

    return -np.array(dos_fl)
Exemplo n.º 16
0
def dos_at_fermi_level_fixbeta(xlist, ylist, beta, phasename, datapath):
    dos_fl = []
    w_n = gf.matsubara_freq(beta, 3)
    save_file = 'phase_dimer_ipt_{}.npy'.format(phasename)
    if os.path.exists(save_file):
        dos_fl = np.load(save_file)
        return dos_fl

    for xdat in xlist:
        filestr = datapath.format(phasename, xdat)
        gfs = np.load(filestr)
        dos_fl.append(np.array([gf.fit_gf(w_n, gfs[i][0][:3])(0.)
                                for i in ylist]))

    dos_fl = -np.array(dos_fl).T
    np.save(save_file, dos_fl)

    return dos_fl
Exemplo n.º 17
0
def dos_at_fermi_level_temp(xlist, temp, phasename, datapath):
    dos_fl = []
    save_file = 'phase_dimer_ipt_{}.npy'.format(phasename)
    if os.path.exists(save_file):
        dos_fl = np.load(save_file)
        return dos_fl

    for T in temp:
        w_n = gf.matsubara_freq(1 / T, 3)
        filestr = datapath.format(phasename, 1 / T)
        gfs = np.load(filestr)
        dos_fl.append(np.array([gf.fit_gf(w_n, gfs[i][0][:3])(0.)
                                for i in xlist]))

    dos_fl = -np.array(dos_fl)
    np.save(save_file, dos_fl)

    return dos_fl
Exemplo n.º 18
0
def DMFT_SCC(fDelta):
    """This subroutine creates Delta.inp from Gf.out for DMFT on bethe
    lattice: Delta=t^2*G If Gf.out does not exist, it creates Gf.out
    which corresponds to the non-interacting model In the latter case
    also creates the inpurity cix file, which contains information
    about the atomic states."""
    fileGf = 'Gf.out'
    try:
        Gf = np.loadtxt(fileGf).T
        # If output file exists, start from previous iteration
    except Exception:  # otherwise start from non-interacting limit
        print('Starting from non-interacting model at beta' + str(BETA))
        w_n = gf.matsubara_freq(BETA)
        Gf = gf.greenF(w_n)
        Gf = np.array([w_n, Gf.real, Gf.imag])

    # Preparing input file Delta.inp
    delta = np.array(
        [Gf[0], 0.25 * Gf[1], 0.25 * Gf[2], 0.25 * Gf[1], 0.25 * Gf[2]]).T
    np.savetxt(fDelta, delta)
Exemplo n.º 19
0
def test_dimer_energies(u_int, mu, tp, beta=100):
    h_loc, (a_up, b_up, a_dw, b_dw) = dimer.hamiltonian(u_int, mu, tp)
    e_imp = (tp * (a_up.T * b_up + a_dw.T * b_dw + b_up.T * a_up +
                   b_dw.T * a_dw)).todense()
    eig_e, eig_v = op.diagonalize(h_loc.todense())
    w_n = gf.matsubara_freq(beta, 2**8)  # n=2**7=256
    gf_di = op.gf_lehmann(eig_e, eig_v, a_up.T, beta, 1j * w_n)
    gf_of = op.gf_lehmann(eig_e, eig_v, a_up.T, beta, 1j * w_n, b_up)
    ekin_gf = dimer.ekin(gf_di, gf_of, w_n, tp, beta, 0)
    ekin_ed = op.expected_value(e_imp, eig_e, eig_v, beta)

    assert abs(ekin_ed - ekin_gf) < 5e-4

    epot_gf = dimer.epot(gf_di, w_n, beta, u_int**2 / 4 + tp**2, ekin_gf,
                         u_int)

    docc = (a_up.T * a_up * a_dw.T * a_dw +
            b_up.T * b_up * b_dw.T * b_dw).todense()

    epot_ed = op.expected_value(docc, eig_e, eig_v, beta) * u_int

    assert abs(epot_ed - epot_gf) < 1e-3
Exemplo n.º 20
0
def estimate_gap_U_vs_tp(tpr, u_range, beta, phase):
    w_n = gf.matsubara_freq(beta, max(2**ceil(log(6 * beta) / log(2)), 256))

    gaps = []
    for tp in tpr:
        filestr = 'disk/phase_Dimer_ipt_{}_B{}/tp{:.3}/giw.npy'.format(
            phase, beta, tp)
        gfs = np.load(filestr)

        for i, u_int in enumerate(u_range):
            gf_aa, gf_ab = 1j * gfs[i][0], gfs[i][1]
            gr_ss, gr_sa = dimer.pade_diag(
                gf_aa, gf_ab, w_n, np.arange(0, beta + 100, 9, dtype=np.int),
                w)
            gloc = (gr_ss + gr_sa) / 2

            gaps.append(measure_gap(gloc, rw))
            #plt.plot(w, -gloc.imag + i * 0.1)
            #plt.plot(gaps[-1] / 2, i * 0.1, 'o')

    gaps = np.array(gaps).reshape(len(tpr), len(u_range)).T

    return gaps
Exemplo n.º 21
0
Aw = data['Aw']
w = data['w']

plt.plot(w, Aw)
plt.show()

###############################################################################
# High temperature seeds
# ----------------------

hot_beta = np.round(1 / np.arange(1 / 25, .2, 1.44e-3), 3)
gfsiw = []
wnli = []
for beta in hot_beta:
    freq = 2 * int(beta * 3)
    wnh = gf.matsubara_freq(beta, freq, 1 - freq)
    wnli.append(wnh)
    print(beta)
    gfsiw.append(hilbert_trans(1j * wnh, w, differential_weight(w), Aw, 0))
    plt.plot(wnh, gfsiw[-1].imag, 'o:')
    plt.plot(wnh, gfsiw[-1].real, 'o:')

    # triqs blocks
    gfarr = GfImFreq(indices=[0], beta=beta, n_points=int(beta * 3))
    G_iw = BlockGf(name_list=['asym_dw', 'asym_up', 'sym_dw', 'sym_up'],
                   block_list=(gfarr, gfarr, gfarr, gfarr), make_copies=True)
    dlat.gf_sym_2_triqs_blockgf(gfsiw[-1], G_iw, u_int, tp)

    with HDFArchive('DIMER_PM_met_B{}_tp0.3.h5'.format(beta), 'a') as dest:
        dest['/U{}/it000/G_iw'.format(u_int)] = G_iw
Exemplo n.º 22
0
    def __init__(self, beta=100, t=1, nfreq=20):
        super(TwoSite_Matsubara, self).__init__(beta, t)

        self.omega = 1j*matsubara_freq(beta, nfreq)
        self.solve(0, 0, 0)
Exemplo n.º 23
0
f, axw = plt.subplots(2, sharex=True)
f.subplots_adjust(hspace=0)
w = np.linspace(-1.5, 1.5, 500) + 1j*1e-2
for mu, c in zip(mu_v, c_v):
    gws = gf(w, M, mu, beta)
    for gw in gws:
        first = np.allclose(gw, gws[0])
        axw[0].plot(w.real, gw.real, c if first else c+'--',
                    label=r'$\mu={}$'.format(mu) if first else None)
        axw[1].plot(w.real, -1*gw.imag/np.pi, c if first else c+'--')
axw[0].legend()
axw[0].set_title(r'Real Frequencies Green functions, $\beta={}$, $M={}$'.format(beta, M))
axw[0].set_ylabel(r'$\Re e G(\omega)$')
axw[1].set_ylabel(r'$A(\omega)$')
axw[1].set_xlabel(r'$\omega$')


g, axwn = plt.subplots(2, sharex=True)
g.subplots_adjust(hspace=0)
wn = matsubara_freq(beta, 32)
for mu, c in zip(mu_v, c_v):
    giw = gf(1j*wn, M, mu, beta)[0]
    axwn[0].plot(wn, giw.real, c+'s-', label=r'$\mu={}$'.format(mu))
    axwn[1].plot(wn, giw.imag, c+'o-')
axwn[0].legend()
axwn[0].set_title(r'Matsubara Green functions, $\beta={}$, $M={}$'.format(beta, M))
axwn[1].set_xlabel(r'$\omega_n$')
axwn[0].set_ylabel(r'$\Re e G(i\omega_n)$')
axwn[1].set_ylabel(r'$\Im m G(i\omega_n)$')
Exemplo n.º 24
0
# S = w -tp - t^2 G_sym - G_sym^-1

fac = np.arctan(10 * np.sqrt(3) / 2.5)
omega = np.tan(np.linspace(-fac, fac, 351)) * 2.5 / np.sqrt(3)

tp = 0.5
BETA = 100.
u_int = 1.67
u_str = 'U' + str(u_int)
workdir = "/home/oscar/orlando/dev/dmft-learn/examples/dimer_bethe/tp03f/"
workdir = "/home/oscar/orlando/dev/dmft-learn/examples/dimer_bethe/"

filename = workdir + 'DIMER_PM_{}_B{}_tp{}.h5'.format('ins', BETA, tp)
giw = dimer.extract_flat_gf_iter(filename, u_int, 2)
nfreq = giw.shape[-1]
wn = gf.matsubara_freq(BETA, nfreq, 1 - nfreq)

giw = giw.reshape(-1, 2, 2, nfreq)
giw[:, 1] = -giw[:, 1].conjugate()
giw = giw.reshape(-1, nfreq)
gerr = giw.std(0).clip(3e-4)


defaultM = gaussian(omega, tp, tp**2 + 0.25 + u_int**2 / 4)

Model_gw = Maxent(omega=omega, defaultModel=defaultM, tol=1e-5,
                  minimizer='Bryan', w_n=wn, giw=giw.mean(0),
                  giw_std=gerr, max_nfreq=int(2 * BETA))
Model_gw.getAllSpecFs(alphamin=0.6, alphamax=2, numAlpha=24)

fig, ax = plt.subplots(1, 2, gridspec_kw=dict(
Exemplo n.º 25
0
f.subplots_adjust(hspace=0)
w = np.linspace(-1.5, 1.5, 500) + 1j * 1e-2
for mu, c in zip(mu_v, c_v):
    gw = gf(w, U, mu, beta)
    axw[0].plot(w.real, gw.real, c, label=r'$\mu={}$'.format(mu))
    axw[1].plot(w.real, -1 * gw.imag / np.pi, c)
axw[0].legend()
axw[0].set_title(r'Real Frequencies Green functions, $\beta={}$'.format(beta))
axw[0].set_ylabel(r'$\Re e G(\omega)$')
axw[1].set_ylabel(r'$A(\omega)$')
axw[1].set_xlabel(r'$\omega$')

gwp, axwn = plt.subplots(2, sharex=True)
gwp.subplots_adjust(hspace=0)
gtp, axt = plt.subplots()
wn = matsubara_freq(beta, 64)
tau = np.linspace(0, beta, 2**10)
for mu, c in zip(mu_v, c_v):
    giw = gf(1j * wn, U, mu, beta)
    axwn[0].plot(wn, giw.real, c + 's-', label=r'$\mu={}$'.format(mu))
    axwn[1].plot(wn, giw.imag, c + 'o-')

    gt = gw_invfouriertrans(giw, tau, wn)
    axt.plot(tau, gt, label=r'$\mu={}$'.format(mu))

axwn[0].legend()
axwn[0].set_title(r'Matsubara Green functions, $\beta={}$'.format(beta))
axwn[1].set_xlabel(r'$\omega_n$')
axwn[0].set_ylabel(r'$\Re e G(i\omega_n)$')
axwn[1].set_ylabel(r'$\Im m G(i\omega_n)$')
Exemplo n.º 26
0
def test_fit_gf():
    """Test the interpolation of Green function in Bethe Lattice"""
    w_n = gf.matsubara_freq(100, 3)
    giw = gf.greenF(w_n).imag
    cont_g = gf.fit_gf(w_n, giw)
    assert abs(cont_g(0.) + 2.) < 1e-4
Exemplo n.º 27
0

if __name__ == '__main__':
    parser = argparse.ArgumentParser(description='Make plots out of CTQMC results',
                                     formatter_class=argparse.ArgumentDefaultsHelpFormatter)
    parser.add_argument('-BETA', metavar='B', type=float,
                        default=200., help='The inverse temperature')
    parser.add_argument('-tp', default=0.18, type=float,
                        help='The dimerization strength')
    parser.add_argument('-file', default='DIMER_{simt}_B{BETA}_tp{tp}.h5',
                        help='File to process')
    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)))
Exemplo n.º 28
0
    Gd, Gc = dimer.gf_met(-1j * w, mu, tab, t, 0.)
    Gd, Gc = dimer.self_consistency(w, Gd, Gc, mu, tab, t2)

    plt.plot(w.real, -Gd.imag / np.pi, label=r'$t_c={}$'.format(tab))
#    plt.plot(w.real, Gd.real, label=r'$\Re e Gd$')
#    plt.plot(w.real, Gc.real, label=r'$\Re e Gc$')
#    plt.plot(w.real, Gc.imag, label=r'$\Im m Gc$')

plt.legend(loc=0)
plt.xlabel(r'$\omega$')
plt.ylabel(r'$A(\omega)$')

######################################################################
# Matsubara frequency Green's function
# ====================================

w_n = gf.matsubara_freq(50., 512)
iw_n = 1j * w_n
plt.figure()
for tab in [0, 0.25, 0.5, 0.75, 1.1]:

    Gd, Gc = dimer.gf_met(w_n, mu, tab, t, 0.)
    Gd, Gc = dimer.self_consistency(iw_n, Gd, Gc, mu, tab, t2)

    plt.plot(w_n, Gd.imag, 'o-', label=r'$t_c={}$'.format(tab))

plt.legend(loc=0)
plt.xlim([0, 6.5])
plt.xlabel(r'$i\omega_n$')
plt.ylabel(r'$G(i\omega_n)$')
Exemplo n.º 29
0
    def __init__(self, beta=100, t=1, nfreq=20):
        super(TwoSite_Matsubara, self).__init__(beta, t)

        self.omega = 1j * matsubara_freq(beta, nfreq)
        self.solve(0, 0, 0)
Exemplo n.º 30
0
# Redo from the QMC tau, tail following G(tau) discontinuity
gt = gtau.sum(0) * .5
gt = np.concatenate((gt, [-1 - gt[0]]))
taub = np.concatenate((tau, [64.]))

gtautck = splrep(taub, gt, s=0)
dev0 = [splev(0, gtautck, der=i) for i in range(4)]
devb = [splev(64, gtautck, der=i) for i in range(4)]

ders = np.abs(-gf.np.array(dev0) - gf.np.array(devb))

taud = np.arange(0, 64, 64 / 1024.)
plt.plot(taub, gt, taud, splev(taud, gtautck, der=0), '+-')

wnl = gf.matsubara_freq(64., 1024)
gif = gf.gt_fouriertrans(splev(taud, gtautck, der=0), taud, wnl, ders)
# plt.plot(wnl, gif.real * wnl**2, wnl, (gif.imag + 1 / wnl) * wnl**3)
# plt.ylim([-3, 3])

# tail replacement
tail = -1j / wnl - ders[1] / wnl**2 + \
    ders[2] * 1j / wnl**3 + ders[3] / wnl**4
x = 64
gif[x:] = tail[x:]
# plt.plot(wnl, gif.real * wnl**2, wnl, (gif.imag + 1 / wnl) * wnl**3)
plt.figure('G(iwn)')
plt.plot(wnl, gif.real, 'o:', label='metal Re')
plt.plot(wnl, gif.imag, 's:', label='metal Im')