示例#1
0
from triqs_tprf.tight_binding import TBLattice

t_r = TBLattice(
    units=[(1, 0, 0)],
    hopping={
        # nearest neighbour hopping -t
        (
            0, ): h_loc,
        (+1, ): T,
        (-1, ): T,
    },
    orbital_positions=[(0, 0, 0)] * norb,
    orbital_names=['up_0', 'do_0', 'up_1', 'do_1'],
)

e_k = t_r.on_mesh_brillouin_zone(n_k=(256, 1, 1))

# ----------------------------------------------------------------------
# -- Bare susceptibility from Green's function bubble

nw = 20
beta = 0.544

from pytriqs.gf import MeshImFreq, Idx

wmesh = MeshImFreq(beta=beta, S='Fermion', n_max=nw)

from triqs_tprf.lattice import lattice_dyson_g0_wk

g0_wk = lattice_dyson_g0_wk(mu=0., e_k=e_k, mesh=wmesh)
示例#2
0
import sys

import numpy as np

from pytriqs.gf import Gf, MeshImFreq, Idx

from triqs_tprf.tight_binding import TBLattice
from triqs_tprf.lattice import lattice_dyson_g0_wk

norb, nk, nw = [int(ele) for ele in sys.argv[1:]]

t = -2.0 * np.eye(norb)
t_r = TBLattice(
    units=[(1, 0, 0)],
    hopping={
        (+1, ): t,
        (-1, ): t,
    },
    orbital_positions=[(0, 0, 0)] * norb,
    orbital_names=[str(ele) for ele in range(norb)],
)

e_k = t_r.on_mesh_brillouin_zone((nk, 1, 1))
wmesh = MeshImFreq(beta=1.0, S='Fermion', n_max=nw)

g0_wk = lattice_dyson_g0_wk(mu=0.0, e_k=e_k, mesh=wmesh)

print g0_wk.data.shape
示例#3
0
    T = -t * np.eye(2)

    t_r = TBLattice(
        units=[(1, 0, 0)],
        hopping={
            # nearest neighbour hopping -t
            (
                0, ): h_loc,
            (+1, ): T,
            (-1, ): T,
        },
        orbital_positions=[(0, 0, 0)] * 2,
        orbital_names=['up', 'do'],
    )

    e_k = t_r.on_mesh_brillouin_zone(n_k)

    # -- Local double occupancy operator

    gf_struct = [[0, [0, 1]]]

    docc = n(0, 0) * n(0, 1)

    Sz = 0.5 * np.diag([1., -1.])

    # -- Sweep in interaction U

    U_vec = np.arange(9., -0.5, -1.5)
    h_vec = 1e-3 * np.linspace(-1., 1., num=11)

    res = []
示例#4
0
norbs = 6
nk = 8
nw = 128
beta = 40.0

full_units = [(1, 0, 0), (0, 1, 0), (0, 0, 1)]
all_nn_hoppings = list(itertools.product([-1, 0, 1], repeat=dim)) 
non_diagonal_hoppings = [ele for ele in all_nn_hoppings if sum(np.abs(ele)) == 1] 

t = -1.0 * np.eye(norbs)

H = TBLattice(
            units = full_units[:dim],
            hopping = {hop : t for hop in non_diagonal_hoppings},
            orbital_positions = [(0,0,0)]*norbs,
            )
e_k = H.on_mesh_brillouin_zone(n_k=[nk]*dim + [1]*(3-dim))

wmesh = MeshImFreq(beta=beta, S='Fermion', n_max=nw)

print('--> Dyson g0_wk')
t = time.time()
g0_wk = lattice_dyson_g0_wk(mu=0.0, e_k=e_k, mesh=wmesh)
print(' {} seconds'.format(time.time() - t))

print('--> Bubble chi0_wk')
t = time.time()
chi0_wk = imtime_bubble_chi0_wk(g0_wk, nw=nw)
print(' {} seconds'.format(time.time() - t))

示例#5
0
# -- Setup model, RPA susceptibilities and spin/charge interaction

full_units = [(1, 0, 0), (0, 1, 0), (0, 0, 1)]
all_nn_hoppings = list(itertools.product([-1, 0, 1], repeat=p.dim)) 
non_diagonal_hoppings = [ele for ele in all_nn_hoppings if sum(np.abs(ele)) == 1] 

t = -p.t * np.eye(p.norbs)

H = TBLattice(
            units = full_units[:p.dim],
            hopping = {hop : t for hop in non_diagonal_hoppings},
            orbital_positions = [(0,0,0)]*p.norbs,
            )

e_k = H.on_mesh_brillouin_zone(n_k=[p.nk]*p.dim + [1]*(3-p.dim))

# A bigger w-mesh is needed to construct a Gamma with a twice as big w-mesh than GF
big_factor = 2.0

wmesh = MeshImFreq(beta=p.beta, S='Fermion', n_max=p.nw)
wmesh_big = MeshImFreq(beta=p.beta, S='Fermion', n_max=int(big_factor*p.nw))

g0_wk = lattice_dyson_g0_wk(mu=p.mu, e_k=e_k, mesh=wmesh)
g0_wk_big = lattice_dyson_g0_wk(mu=p.mu, e_k=e_k, mesh=wmesh_big)

chi0_wk_big = imtime_bubble_chi0_wk(g0_wk_big, nw=int(big_factor*p.nw)+1)

U_c, U_s = kanamori_charge_and_spin_quartic_interaction_tensors(p.norbs, p.U, 0, 0, 0)

chi_s_big = solve_rpa_PH(chi0_wk_big, U_s)
示例#6
0
import numpy as np
from triqs_tprf.tight_binding import TBLattice
import triqs_tprf as trpf
from pytriqs.gf import *
from triqs_tprf.lattice import lattice_dyson_g0_wk
import matplotlib.pyplot as plt
t = 1.0
H = TBLattice(
    units=[(1, 0, 0), (0, 1, 0)],
    hopping={
        # nearest neighbour hopping -t
        (0, +1): -t * np.eye(2),
        (0, -1): -t * np.eye(2),
        (+1, 0): -t * np.eye(2),
        (-1, 0): -t * np.eye(2),
    },
    orbital_positions=[(0, 0, 0)] * 2,
    orbital_names=['up', 'do'],
)
e_k = H.on_mesh_brillouin_zone(n_k=(32, 32, 1))

beta = 50
n_iw = 130
mu = -5
imesh = MeshImFreq(beta, 'Fermion', n_iw)
g = lattice_dyson_g0_wk(mu, e_k, imesh)

gm = GfImFreq(mesh=imesh, data=g[(0, 0)].data[:, 0].reshape(-1, 1, 1), beta=50)
g_pade = GfReFreq(window=(-2, 2), n_points=200, target_shape=[1, 1])
g_pade.set_from_pade(gm)
print(g_pade.data.shape)
示例#7
0
def test_square_lattice_chi00():
    
    # ------------------------------------------------------------------
    # -- Discretizations
    
    n_k = (2, 2, 1)
    nw_g = 500
    nn = 400
    nw = 1
    
    # ------------------------------------------------------------------
    # -- tight binding parameters

    beta = 20.0
    mu = 0.0
    t = 1.0
    
    h_loc = np.array([
        [-0.3, -0.5],
        [-0.5, .4],
        ])
        
    T = - t * np.array([
        [1., 0.23],
        [0.23, 0.5],
        ])

    # ------------------------------------------------------------------
    # -- tight binding
    
    print '--> tight binding model'
    t_r = TBLattice(
        units = [(1, 0, 0), (0, 1, 0)],
        hopping = {
            # nearest neighbour hopping -t
            ( 0, 0): h_loc,
            ( 0,+1): T,
            ( 0,-1): T,
            (+1, 0): T,
            (-1, 0): T,
            },
        orbital_positions = [(0,0,0)]*2,
        orbital_names = ['up_0', 'do_0'],
        )

    e_k = t_r.on_mesh_brillouin_zone(n_k)
    kmesh = e_k.mesh

    wmesh = MeshImFreq(beta=beta, S='Fermion', n_max=nw_g)

    print '--> g0_wk'
    g0_wk = lattice_dyson_g0_wk(mu=mu, e_k=e_k, mesh=wmesh)

    print '--> g0_wr'
    g0_wr = fourier_wk_to_wr(g0_wk)

    print '--> g0_tr' 
    g0_tr = fourier_wr_to_tr(g0_wr)
    
    # ------------------------------------------------------------------
    # -- anaytic chi00
    
    print '--> chi00_wk analytic'
    chi00_wk_analytic = lindhard_chi00_wk(e_k=e_k, nw=nw, beta=beta, mu=mu)

    print '--> chi00_wr analytic'
    chi00_wr_analytic = chi_wr_from_chi_wk(chi00_wk_analytic)
    
    # ------------------------------------------------------------------
    # -- imtime chi00

    print '--> chi0_tr_from_grt_PH'
    chi00_tr = chi0_tr_from_grt_PH(g0_tr)
    
    print '--> chi_wr_from_chi_tr'
    chi00_wr = chi_wr_from_chi_tr(chi00_tr, nw=1)

    print '--> chi_w0r_from_chi_tr'
    chi00_wr_ref = chi_w0r_from_chi_tr(chi00_tr)

    print '--> chi0_w0r_from_grt_PH'
    chi00_wr_opt = chi0_w0r_from_grt_PH(g0_tr)

    print 'dchi00_wr     =', np.max(np.abs(chi00_wr_analytic.data - chi00_wr.data))
    print 'dchi00_wr_ref =', np.max(np.abs(chi00_wr_analytic.data - chi00_wr_ref.data))
    print 'dchi00_wr_opt =', np.max(np.abs(chi00_wr_analytic.data - chi00_wr_opt.data))

    np.testing.assert_array_almost_equal(
        chi00_wr_analytic.data, chi00_wr.data, decimal=8)

    np.testing.assert_array_almost_equal(
        chi00_wr_analytic.data, chi00_wr_ref.data, decimal=4)

    np.testing.assert_array_almost_equal(
        chi00_wr_analytic.data, chi00_wr_opt.data, decimal=4)

    print '--> chi_wk_from_chi_wr'
    chi00_wk_imtime = chi_wk_from_chi_wr(chi00_wr)
    
    # ------------------------------------------------------------------
    # -- imtime chi00 helper function

    chi00_wk_imtime_2 = imtime_bubble_chi0_wk(g0_wk, nw=1)    

    # ------------------------------------------------------------------
    # -- imfreq chi00
    
    print '--> chi00_wnr'
    chi00_wnr = chi0r_from_gr_PH(nw=1, nn=nn, g_nr=g0_wr)

    print '--> chi00_wnk'
    chi00_wnk = chi0q_from_chi0r(chi00_wnr)

    # -- Test per k and w calculator for chi0_wnk
    print '--> chi00_wnk_ref'
    from triqs_tprf.lattice import chi0q_from_g_wk_PH
    chi00_wnk_ref = chi0q_from_g_wk_PH(nw=1, nn=nn, g_wk=g0_wk)

    diff = np.max(np.abs(chi00_wnk.data - chi00_wnk_ref.data))
    print 'chi00_wnk diff =', diff
    np.testing.assert_array_almost_equal(chi00_wnk.data, chi00_wnk_ref.data)
    
    print '--> chi00_wk_imfreq'
    chi00_wk_imfreq = chi0q_sum_nu(chi00_wnk)

    print '--> chi00_wk_imfreq_tail_corr'
    chi00_wk_imfreq_tail_corr = chi0q_sum_nu_tail_corr_PH(chi00_wnk)

    # ------------------------------------------------------------------
    # -- Compare results

    def cf_chi_w0(chi1, chi2, decimal=9):
        chi1, chi2 = chi1[Idx(0), :].data, chi2[Idx(0), :].data
        diff = np.linalg.norm(chi1 - chi2)
        print '|dchi| =', diff
        np.testing.assert_array_almost_equal(chi1, chi2, decimal=decimal)
    
    print '--> Cf analytic with imtime'
    cf_chi_w0(chi00_wk_analytic, chi00_wk_imtime, decimal=7)

    print '--> Cf analytic with imtime 2'
    cf_chi_w0(chi00_wk_analytic, chi00_wk_imtime_2, decimal=4)
    
    print '--> Cf analytic with imfreq'
    cf_chi_w0(chi00_wk_analytic, chi00_wk_imfreq, decimal=2)

    print '--> Cf analytic with imfreq (tail corr)'
    cf_chi_w0(chi00_wk_analytic, chi00_wk_imfreq_tail_corr, decimal=5)
    units=[(1, 0, 0), (0, 1, 0)],
    hopping={
        # nearest neighbour hopping -t
        (0, +1):
        -t_intra * np.eye(n_orb_spin) - t_inter * inter_orbital_hopping,
        (0, -1):
        -t_intra * np.eye(n_orb_spin) - t_inter * inter_orbital_hopping,
        (+1, 0):
        -t_intra * np.eye(n_orb_spin) - t_inter * inter_orbital_hopping,
        (-1, 0):
        -t_intra * np.eye(n_orb_spin) - t_inter * inter_orbital_hopping,
    },
    orbital_positions=[(0, 0, 0)] * n_orb_spin,
)

e_k = H.on_mesh_brillouin_zone(n_k=(16, 16, 1))
print(e_k)

# ----------------------------------------------------------------------
# -- Bare susceptibility from Green's function bubble

from pytriqs.gf import MeshImFreq
from triqs_tprf.lattice import lattice_dyson_g0_wk

wmesh = MeshImFreq(beta=5.0, S='Fermion', n_max=30)
g0_wk = lattice_dyson_g0_wk(mu=0., e_k=e_k, mesh=wmesh)

from triqs_tprf.lattice_utils import imtime_bubble_chi0_wk
chi00_wk = imtime_bubble_chi0_wk(g0_wk, nw=1)

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