Пример #1
0
def setup_dmft_calculation(p):

    p = copy.deepcopy(p)
    p.iter = 0

    # -- Local Hubbard interaction
    from pytriqs.operators import n
    p.solve.h_int = p.U*n('up', 0)*n('do', 0) - 0.5*p.U*(n('up', 0) + n('do', 0))

    # -- 2D square lattice w. nearest neighbour hopping t
    from triqs_tprf.tight_binding import TBLattice
    T = -p.t * np.eye(2)
    H = TBLattice(
        units = [(1, 0, 0), (0, 1, 0)],
        orbital_positions = [(0,0,0)]*2,
        orbital_names = ['up', 'do'],
        hopping = {(0, +1) : T, (0, -1) : T, (+1, 0) : T, (-1, 0) : T})
    
    p.e_k = H.on_mesh_brillouin_zone(n_k = (p.n_k, p.n_k, 1))

    # -- Initial zero guess for the self-energy    
    p.sigma_w = Gf(mesh=MeshImFreq(p.init.beta, 'Fermion', p.init.n_iw), target_shape=[2, 2])
    p.sigma_w.zero()

    return p
Пример #2
0
def get_static_observables(parms, spin_names, flavor_names):
    ret = {
            'N' : triqs_ops.Operator(),
            'Sz' : triqs_ops.Operator(),
            }
    for sn, s in enumerate(spin_names):
        for o in flavor_names:
            sp = mkind(s, o)
            ret['N'] += triqs_ops.n(*sp)
            ret['Sz'] += (-1)**sn * triqs_ops.n(*sp)
    return ret
Пример #3
0
def get_quantum_numbers(parms, spin_names, flavor_names, is_kanamori):
    qn = []
    for s in spin_names:
        tmp = triqs_ops.Operator()
        for o in flavor_names:
            tmp += triqs_ops.n(*mkind(s, o))
        qn.append(tmp)
    if is_kanamori:
        for o in flavor_names:
            dn = triqs_ops.n(*mkind(spin_names[0], o))\
                 - triqs_ops.n(*mkind(spin_names[1],o))
            qn.append(dn*dn)
    return qn
Пример #4
0
p = {}
p["max_time"] = -1
p["random_name"] = ""
p["random_seed"] = 123 * mpi.rank + 567
p["length_cycle"] = 50
p["n_warmup_cycles"] = 20000
p["n_cycles"] = 1000000
p["performance_analysis"] = True
p["measure_pert_order"] = True

# Block structure of GF
gf_struct = [['up', [0]], ['dn', [0]]]

# Hamiltonian
H = U * n("up", 0) * n("dn", 0)

# Quantum numbers
qn = [n("up", 0), n("dn", 0)]
p["partition_method"] = "quantum_numbers"
p["quantum_numbers"] = qn

# Construct solver
S = SolverCore(beta=beta, gf_struct=gf_struct, n_tau=n_tau, n_iw=n_iw)


def read_histo(f, type_of_col_1):
    histo = []
    for line in f:
        cols = filter(lambda s: s, line.split(' '))
        histo.append((type_of_col_1(cols[0]), float(cols[1]), float(cols[2])))
Пример #5
0
          n_iw=1025,
          n_tau=2500,
          n_l=20)

solver = SolverCore(**cp)

# Set hybridization function
mu = 0.5
half_bandwidth = 1.0
delta_w = GfImFreq(indices=[0], beta=cp['beta'])
delta_w << (half_bandwidth / 2.0)**2 * SemiCircular(half_bandwidth)
for name, g0 in solver.G0_iw:
    g0 << inverse(iOmega_n + mu - delta_w)

sp = dict(
    h_int=n('up', 0) * n('do', 0) + c_dag('up', 0) * c('do', 0) +
    c_dag('do', 0) * c('up', 0),
    max_time=-1,
    length_cycle=50,
    n_warmup_cycles=50,
    n_cycles=500,
    move_double=False,
)

solver.solve(**sp)

filename = 'h5_read_write.h5'

with HDFArchive(filename, 'w') as A:
    A['solver'] = solver
Пример #6
0
    g0_wk = lattice_dyson_g0_wk(mu=mu, e_k=e_k, mesh=wmesh)

    chi00_wk = imtime_bubble_chi0_wk(g0_wk, nw=1)

    # ------------------------------------------------------------------
    # -- RPA
    
    fundamental_operators = [c(0, 0), c(0, 1)]
    
    chi_wk_vec = []
    U_vec = np.arange(1.0, 5.0, 1.0)

    for u in U_vec:
        print '--> RPA chi_wk, U =', u

        H_int = u * n(0, 0) * n(0, 1)
        U_int_abcd = quartic_tensor_from_operator(H_int, fundamental_operators)

        print U_int_abcd.reshape((4, 4)).real
        
        U_int_abcd = quartic_permutation_symmetrize(U_int_abcd)
        print U_int_abcd.reshape((4, 4)).real
        
        # -- Group in Gamma order cc^+cc^+ ( from c^+c^+cc )

        U_abcd = np.zeros_like(U_int_abcd)
        for a, b, c, d in itertools.product(range(U_abcd.shape[0]), repeat=4):
            U_abcd[a, b, c, d] = U_int_abcd[b, d, a, c]

        chi_wk = solve_rpa_PH(chi00_wk, U_abcd)
Пример #7
0
g2_n_wf = 5

# GF structure
gf_struct = {'up' : [0], 'dn' : [0]}

# Conversion from TRIQS to Pomerol notation for operator indices
index_converter = {}
index_converter.update({(sn, 0) : ("loc", 0, "down" if sn == "dn" else "up") for sn in spin_names})
index_converter.update({("B%i_%s" % (k, sn), 0) : ("bath" + str(k), 0, "down" if sn == "dn" else "up")
                        for k, sn in product(range(len(epsilon)), spin_names)})

# Make PomerolED solver object
ed = PomerolED(index_converter, verbose = True)

# Local Hamiltonian
H_loc = e_d*(n('up', 0) + n('dn', 0)) + h*(n('up', 0) - n('dn', 0))

# Bath Hamiltonian
H_bath = sum(eps*n("B%i_%s" % (k, sn), 0)
             for sn, (k, eps) in product(spin_names, enumerate(epsilon)))

# Hybridization Hamiltonian
H_hyb = Operator()
for k, v in enumerate(V):
    H_hyb += sum(        v   * c_dag("B%i_%s" % (k, sn), 0) * c(sn, 0) +
                 np.conj(v)  * c_dag(sn, 0) * c("B%i_%s" % (k, sn), 0)
                 for sn in spin_names)

# Complete Hamiltonian
H = H_loc + H_hyb + H_bath
Пример #8
0
def make_calc(beta=2.0, h_field=0.0):

    # ------------------------------------------------------------------
    # -- Hubbard atom with two bath sites, Hamiltonian

    p = ParameterCollection(
        beta=beta,
        V1=2.0,
        V2=5.0,
        epsilon1=0.10,
        epsilon2=3.00,
        h_field=h_field,
        mu=0.0,
        U=5.0,
        ntau=800,
        niw=15,
    )

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

    print '--> Solving SIAM with parameters'
    print p

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

    up, do = 'up', 'dn'
    docc = c_dag(up, 0) * c(up, 0) * c_dag(do, 0) * c(do, 0)
    mA = c_dag(up, 0) * c(up, 0) - c_dag(do, 0) * c(do, 0)

    nA = c_dag(up, 0) * c(up, 0) + c_dag(do, 0) * c(do, 0)
    nB = c_dag(up, 1) * c(up, 1) + c_dag(do, 1) * c(do, 1)
    nC = c_dag(up, 2) * c(up, 2) + c_dag(do, 2) * c(do, 2)

    p.H = -p.mu * nA + p.U * docc + p.h_field * mA + \
        p.epsilon1 * nB + p.epsilon2 * nC + \
        p.V1 * (c_dag(up,0)*c(up,1) + c_dag(up,1)*c(up,0) + \
              c_dag(do,0)*c(do,1) + c_dag(do,1)*c(do,0) ) + \
        p.V2 * (c_dag(up,0)*c(up,2) + c_dag(up,2)*c(up,0) + \
              c_dag(do,0)*c(do,2) + c_dag(do,2)*c(do,0) )

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

    fundamental_operators = [
        c(up, 0), c(do, 0),
        c(up, 1), c(do, 1),
        c(up, 2), c(do, 2)
    ]

    ed = TriqsExactDiagonalization(p.H, fundamental_operators, p.beta)

    g_tau = GfImTime(beta=beta, statistic='Fermion', n_points=400, indices=[0])
    g_iw = GfImFreq(beta=beta, statistic='Fermion', n_points=10, indices=[0])

    p.G_tau = BlockGf(name_list=[up, do],
                      block_list=[g_tau] * 2,
                      make_copies=True)
    p.G_iw = BlockGf(name_list=[up, do],
                     block_list=[g_iw] * 2,
                     make_copies=True)

    ed.set_g2_tau(p.G_tau[up][0, 0], c(up, 0), c_dag(up, 0))
    ed.set_g2_tau(p.G_tau[do][0, 0], c(do, 0), c_dag(do, 0))

    ed.set_g2_iwn(p.G_iw[up][0, 0], c(up, 0), c_dag(up, 0))
    ed.set_g2_iwn(p.G_iw[do][0, 0], c(do, 0), c_dag(do, 0))

    p.magnetization = ed.get_expectation_value(0.5 * mA)

    p.O_tau = Gf(mesh=MeshImTime(beta, 'Fermion', 400), target_shape=[])
    ed.set_g2_tau(p.O_tau, n(up, 0), n(do, 0))
    p.O_tau.data[:] *= -1.

    p.exp_val = ed.get_expectation_value(n(up, 0) * n(do, 0))

    # ------------------------------------------------------------------
    # -- Store to hdf5

    filename = 'data_pyed_h_field_%4.4f.h5' % h_field
    with HDFArchive(filename, 'w') as res:
        res['p'] = p
Пример #9
0
from pytriqs.operators import n, c, c_dag, Operator
import pytriqs.utility.mpi as mpi
from pytriqs.gf import Gf, MeshImFreq, MeshImTime, iOmega_n, inverse, Fourier, InverseFourier

beta = 10.0

gf_struct = [['0', [0, 1]]]
target_shape = [2, 2]

nw = 48
nt = 3 * nw

S = SolverCore(beta=beta, gf_struct=gf_struct, n_iw=nw, n_tau=nt)

h_int = n('0', 0) * n('0', 1)

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

Delta_iw = Gf(mesh=wmesh, target_shape=target_shape)

Ek = np.array([
    [1.00,  0.75],
    [0.75, -1.20],
    ])

E_loc = np.array([
    [0.2, 0.3],
    [0.3, 0.4],
    ])
Пример #10
0
if __name__ == '__main__':

    orb_idxs = list(range(3))
    gf_struct = [['up', orb_idxs], ['do', orb_idxs]]

    fundamental_operators = fundamental_operators_from_gf_struct(gf_struct)

    beta = 10.0
    U = 2.0
    mu = 1.0
    h = 0.1
    #V = 0.5
    V = 1.0
    epsilon = 2.3

    H = U * n('up', 0) * n('do', 0) + \
        - mu * (n('up', 0) + n('do', 0)) + \
        h * n('up', 0) - h * n('do', 0) + \
        epsilon * (n('up', 1) + n('do', 1)) - epsilon * (n('up', 2) + n('do', 2)) + \
        V * ( c_dag('up', 0) * c('up', 1) + c_dag('up', 1) * c('up', 0) ) + \
        V * ( c_dag('do', 0) * c('do', 1) + c_dag('do', 1) * c('do', 0) ) + \
        V * ( c_dag('up', 0) * c('up', 2) + c_dag('up', 2) * c('up', 0) ) + \
        V * ( c_dag('do', 0) * c('do', 2) + c_dag('do', 2) * c('do', 0) )

    ed = TriqsExactDiagonalization(H, fundamental_operators, beta)

    n_tau = 101
    G_tau_up = Gf(mesh=MeshImTime(beta, 'Fermion', n_tau), target_shape=[])
    G_tau_do = Gf(mesh=MeshImTime(beta, 'Fermion', n_tau), target_shape=[])

    ed.set_g2_tau(G_tau_up, c('up', 0), c_dag('up', 0))
Пример #11
0
def run_calculation(use_qn=True):

    # Input parameters
    beta = 10.0
    U = 2.0
    mu = 1.0
    epsilon = 2.3
    t = 0.1

    n_iw = 1025
    n_tau = 10001

    p = {}
    p["max_time"] = -1
    p["random_name"] = ""
    p["random_seed"] = 123 * mpi.rank + 567
    p["length_cycle"] = 50
    p["n_warmup_cycles"] = 20000
    p["n_cycles"] = 1000000

    results_file_name = "spinless"
    if use_qn: results_file_name += ".qn"
    results_file_name += ".h5"

    mpi.report(
        "Welcome to spinless (spinless electrons on a correlated dimer) test.")

    H = U * n("tot", "A") * n("tot", "B")

    QN = []
    if use_qn:
        QN.append(n("tot", "A") + n("tot", "B"))
        p["partition_method"] = "quantum_numbers"
        p["quantum_numbers"] = QN

    gf_struct = [["tot", ["A", "B"]]]

    mpi.report("Constructing the solver...")

    ## Construct the solver
    S = SolverCore(beta=beta, gf_struct=gf_struct, n_iw=n_iw, n_tau=n_tau)

    mpi.report("Preparing the hybridization function...")

    ## Set hybridization function
    delta_w = GfImFreq(indices=["A", "B"], beta=beta)
    delta_w << inverse(iOmega_n - np.array([[epsilon, -t], [-t, epsilon]])
                       ) + inverse(iOmega_n -
                                   np.array([[-epsilon, -t], [-t, -epsilon]]))
    S.G0_iw["tot"] << inverse(iOmega_n - np.array([[-mu, -t], [-t, -mu]]) -
                              delta_w)

    mpi.report("Running the simulation...")

    ## Solve the problem
    S.solve(h_int=H, **p)

    ## Save the results
    if mpi.is_master_node():
        with HDFArchive(results_file_name, 'w') as Results:
            Results["tot"] = S.G_tau["tot"]
Пример #12
0
p = {}
p["max_time"] = -1
p["random_name"] = ""
p["random_seed"] = 123 * mpi.rank + 567
p["length_cycle"] = 50
p["n_warmup_cycles"] = 50000
p["n_cycles"] = 5000000
p["measure_G_tau"] = False
p["measure_G_l"] = True

results_file_name = "legendre.h5"

mpi.report("Welcome to Legendre (1 correlated site + symmetric bath) test.")

H = U*n(*mkind("up"))*n(*mkind("dn"))

QN = []
for spin in spin_names: QN.append(n(*mkind(spin)))

gf_struct = {}
for spin in spin_names:
    bn, i = mkind(spin)
    gf_struct.setdefault(bn,[]).append(i)
gf_struct = [ [key, value] for key, value in gf_struct.items() ]

mpi.report("Constructing the solver...")

# Construct the solver
S = SolverCore(beta=beta, gf_struct=gf_struct, n_tau=n_tau, n_iw=n_iw, n_l=n_l)
Пример #13
0
    chi0_q0_ref = chi0_q0_integral(t, beta)

    print 'chi0_q0     =', chi00_wk[Idx(0), Idx(0, 0, 0)][0, 0, 0, 0].real
    print 'chi0_q0_ref =', chi0_q0_ref

    np.testing.assert_almost_equal(
        chi00_wk_analytic[Idx(0), Idx(0, 0, 0)][0, 0, 0, 0], chi0_q0_ref)

    # ------------------------------------------------------------------
    # -- RPA tensor

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

    from pytriqs.operators import n, c, c_dag, Operator, dagger
    H_int = U * n(0, 0) * n(0, 1)
    print 'H_int =', H_int

    from triqs_tprf.rpa_tensor import get_rpa_tensor
    from triqs_tprf.rpa_tensor import fundamental_operators_from_gf_struct

    fundamental_operators = fundamental_operators_from_gf_struct(gf_struct)
    print fundamental_operators
    U_abcd = get_rpa_tensor(H_int, fundamental_operators)

    print 'U_abcd =\n', U_abcd.reshape((4, 4))

    # ------------------------------------------------------------------
    # -- RPA

    from triqs_tprf.lattice import solve_rpa_PH
Пример #14
0
import pytriqs.utility.mpi as mpi
from pytriqs.gf import inverse, iOmega_n, SemiCircular, BlockGf
from pytriqs.operators import n
from pytriqs.archive import HDFArchive

from triqs_cthyb import Solver

# ----------------------------------------------------------------------
if __name__ == '__main__':

    solv = Solver(beta=10., gf_struct=[['0', [0]]])
    solv.G0_iw['0'][0, 0] << inverse(iOmega_n - 0.5 - SemiCircular(2.))

    solv.solve(
        h_int=1.0 * n('0', 0),
        n_warmup_cycles=int(1e0),
        n_cycles=int(1e1 / mpi.size),
    )

    if mpi.is_master_node():

        filename = 'data.h5'

        with HDFArchive(filename, 'w') as res:
            res['solv'] = solv

        with HDFArchive(filename, 'r') as res:
            ref_solv = res['solv']

        cf_attr = [
Пример #15
0
          n_iw=1025,
          n_tau=2500,
          n_l=20)

solver = SolverCore(**cp)

# Set hybridization function
mu = 0.5
half_bandwidth = 1.0
delta_w = GfImFreq(indices=[0], beta=cp['beta'])
delta_w << (half_bandwidth / 2.0)**2 * SemiCircular(half_bandwidth)
for name, g0 in solver.G0_iw:
    g0 << inverse(iOmega_n + mu - delta_w)

sp = dict(
    h_int=n('up', 0) * n('do', 0),
    max_time=-1,
    length_cycle=50,
    n_warmup_cycles=50,
    n_cycles=500,
    move_double=False,
)

solver.solve(**sp)

sp = solver.last_solve_parameters
cp = solver.last_constr_parameters

filename = 'h5_read_write.h5'

with HDFArchive(filename, 'w') as A:
Пример #16
0
U = 1.0  # Coulomb repulsion
mu = 0.4  # Chemical potential
h_field = 0.01

spin_names = ("up", "dn")

# Conversion from TRIQS to Pomerol notation for operator indices
index_converter = {}
index_converter.update({(sn, 0): ("A", 0, "down" if sn == "dn" else "up")
                        for sn in spin_names})

# Make PomerolED solver object
ed = PomerolED(index_converter, verbose=True)

# Hamiltonian
H = -mu * (n('up', 0) + n('dn', 0)) - h_field * (n('up', 0) - n('dn', 0))
H += U * n('up', 0) * n('dn', 0)

# Diagonalize H
ed.diagonalize(H)

# Compute reference values of <n('up', 0)> and <n('dn', 0)>
w = np.array([
    1.0,
    np.exp(beta * (mu + h_field)),
    np.exp(beta * (mu - h_field)),
    np.exp(-beta * (-2 * mu + U))
])
Z = np.sum(w)
w /= Z
n_up_ref, n_dn_ref = complex(w[1] + w[3]), complex(w[2] + w[3])
Пример #17
0
n_tau = 10001

p = {}
p["max_time"] = -1
p["random_name"] = ""
p["random_seed"] = 123 * mpi.rank + 567
p["length_cycle"] = 50
p["n_warmup_cycles"] = 100000
p["n_cycles"] = 1000000
p["measure_G_tau"] = True
p["measure_density_matrix"] = True
p["use_norm_as_weight"] = True

move_global_prob = 0.05

H = U * n(*mkind("up", 1)) * n(*mkind("dn", 1)) + U * n(*mkind("up", 2)) * n(
    *mkind("dn", 2))

# Global moves
gm_flip_spins_1 = {
    'flip_spins_1': {
        mkind("up", 1): mkind("dn", 1),
        mkind("dn", 1): mkind("up", 1)
    }
}
gm_flip_spins_all = {
    'flip_spins_all': {
        mkind("up", 1): mkind("dn", 1),
        mkind("dn", 1): mkind("up", 1),
        mkind("up", 2): mkind("dn", 2),
        mkind("dn", 2): mkind("up", 2)
Пример #18
0
# Pomerol: site_label, orbital_index, spin_name
index_converter = {}

# Local degrees of freedom
index_converter.update({(sn, o): ("loc", o, "down" if sn == "dn" else "up")
                        for sn, o in product(spin_names, orb_names)})
# Bath degrees of freedom
index_converter.update({("B_" + sn, o):
                        ("bath", o, "down" if sn == "dn" else "up")
                        for sn, o in product(spin_names, orb_names)})

# Make PomerolED solver object
ed = PomerolED(index_converter, verbose=True)

# Number of particles on the impurity
N = sum(n(sn, o) for sn, o in product(spin_names, orb_names))

# Local Hamiltonian
H_loc = h_int_kanamori(spin_names, orb_names,
                       np.array([[0, U - 3 * J], [U - 3 * J, 0]]),
                       np.array([[U, U - 2 * J], [U - 2 * J, U]]), J, True)
H_loc -= mu * N

# Bath Hamiltonian
H_bath = sum(epsilon[o] * n("B_" + sn, o)
             for sn, o in product(spin_names, orb_names))

# Hybridization Hamiltonian
H_hyb = sum(V[o1, o2] * c_dag("B_" + sn, o1) * c(sn, o2) +
            np.conj(V[o2, o1]) * c_dag(sn, o1) * c("B_" + sn, o2)
            for sn, o1, o2 in product(spin_names, orb_names, orb_names))
Пример #19
0
p = {}
p["max_time"] = -1
p["random_name"] = ""
p["random_seed"] = 123 * mpi.rank + 567
p["length_cycle"] = 50
p["n_warmup_cycles"] = 50000
p["n_cycles"] = 5000000
p["measure_G_tau"] = False
p["measure_G_l"] = True

results_file_name = "legendre.h5"

mpi.report("Welcome to Legendre (1 correlated site + symmetric bath) test.")

H = U * n(*mkind("up")) * n(*mkind("dn"))

QN = []
for spin in spin_names:
    QN.append(n(*mkind(spin)))

gf_struct = {}
for spin in spin_names:
    bn, i = mkind(spin)
    gf_struct.setdefault(bn, []).append(i)
gf_struct = [[key, value] for key, value in gf_struct.items()]

mpi.report("Constructing the solver...")

# Construct the solver
S = SolverCore(beta=beta, gf_struct=gf_struct, n_tau=n_tau, n_iw=n_iw, n_l=n_l)
Пример #20
0
p["n_warmup_cycles"] = 50000
p["n_cycles"] = 1200000

for modes in range(1,N_max+1):
    V = [0.2]*modes
    e = [-0.2]*modes

    #gf_struct = {str(n):[0] for n in range(0,len(V))}
    gf_struct = [ [str(bidx), [0]] for bidx in range(0,len(V)) ]

    # Local Hamiltonian
    H = Operator()

    # Quantum numbers (N_up and N_down)
    QN = []
    for b, idxs in gf_struct: QN.append(n(b,0))
    p["partition_method"] = "quantum_numbers"
    p["quantum_numbers"] = QN
    
    mpi.report("Constructing the solver...")

    # Construct the solver
    S = SolverCore(beta=beta, gf_struct=gf_struct, n_tau=n_tau, n_iw=n_iw)

    mpi.report("Preparing the hybridization function...")

    # Set hybridization function
    #for m, b in enumerate(sorted(gf_struct.keys())):
    for m, (b, idxs) in enumerate(gf_struct):
        delta_w = Gf(mesh=S.G0_iw.mesh, target_shape=[])
        delta_w << (V[m]**2) * inverse(iOmega_n - e[m])
Пример #21
0
p["n_cycles"] = 1200000

for modes in range(1, N_max + 1):
    V = [0.2] * modes
    e = [-0.2] * modes

    #gf_struct = {str(n):[0] for n in range(0,len(V))}
    gf_struct = [[str(bidx), [0]] for bidx in range(0, len(V))]

    # Local Hamiltonian
    H = Operator()

    # Quantum numbers (N_up and N_down)
    QN = []
    for b, idxs in gf_struct:
        QN.append(n(b, 0))
    p["partition_method"] = "quantum_numbers"
    p["quantum_numbers"] = QN

    mpi.report("Constructing the solver...")

    # Construct the solver
    S = SolverCore(beta=beta, gf_struct=gf_struct, n_tau=n_tau, n_iw=n_iw)

    mpi.report("Preparing the hybridization function...")

    # Set hybridization function
    #for m, b in enumerate(sorted(gf_struct.keys())):
    for m, (b, idxs) in enumerate(gf_struct):
        delta_w = GfImFreq(indices=[0], beta=beta)
        delta_w << (V[m]**2) * inverse(iOmega_n - e[m])
Пример #22
0
    results_file_name = "kanamori" + (".qn" if use_qn else "") + ".h5"

    mpi.report("Welcome to Kanamori benchmark.")

    gf_struct = set_operator_structure(spin_names,orb_names,False)
    mkind = get_mkind(False,None)

    ## Hamiltonian
    H = h_int_kanamori(spin_names,orb_names,
                       np.array([[0,U-3*J],[U-3*J,0]]),
                       np.array([[U,U-2*J],[U-2*J,U]]),
                       J,False)

    if use_qn:
        QN = [sum([n(*mkind("up",o)) for o in orb_names],Operator()),
              sum([n(*mkind("dn",o)) for o in orb_names],Operator())]
        for o in orb_names:
            dn = n(*mkind("up",o)) - n(*mkind("dn",o))
            QN.append(dn*dn)
        p["partition_method"] = "quantum_numbers"
        p["quantum_numbers"] = QN

    mpi.report("Constructing the solver...")

    # Construct the solver
    S = SolverCore(beta=beta, gf_struct=gf_struct, n_tau=n_tau, n_iw=n_iw)

    mpi.report("Preparing the hybridization function...")

    # Set hybridization function
Пример #23
0
    Units = np.dot(P, Units_prim)
    print 'Units =\n', Units
    
    t_r = TBSuperLattice(t_r_prim, P)
    t_r.bz = BrillouinZone(t_r.bl)
    
    e_k = t_r.on_mesh_brillouin_zone(n_k)
    print e_k.target_shape
    
    print 'eps(k=0) =\n', e_k[Idx(0, 0, 0)]

    # -- Local double occ and spin operators

    gf_struct = [[0, [0, 1, 2, 3]]]

    docc = n(0, 0) * n(0, 2) + n(0, 1) * n(0, 3)

    print 'docc =', docc
    
    sigma_x = 0.5 * np.rot90(np.diag([1., 1.]))
    sigma_y = 0.5 * np.rot90(np.diag([1.j, -1.j]))
    sigma_z = 0.5 * np.diag([1., -1.])

    print 'sigma_x =\n', sigma_x
    print 'sigma_y =\n', sigma_y
    print 'sigma_z =\n', sigma_z
    
    Sx1 = np.kron(sigma_x, np.diag([1., 0.]))
    Sx2 = np.kron(sigma_x, np.diag([0., 1.]))

    Sy1 = np.kron(sigma_y, np.diag([1., 0.]))
Пример #24
0
            (
                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 = []

    M0 = np.zeros((2, 2))
    M = -5.0 * Sz
    mu = 0.

    for U in U_vec:
Пример #25
0
g2_blocks = set([("up", "up"), ("up", "dn"), ("dn", "up")])

gf_struct = {"up": orb_names, "dn": orb_names}
print "Block structure of single-particle Green's functions:", gf_struct

# Conversion from TRIQS to Pomerol notation for operator indices
# TRIQS: block_name, inner_index
# Pomerol: site_label, orbital_index, spin_name
index_converter = {(sn, o): ("loc", o, "down" if sn == "dn" else "up")
                   for sn, o in product(spin_names, orb_names)}

# Make PomerolED solver object
ed = PomerolED(index_converter, verbose=True)

# Number of particles on the impurity
N = sum(n(sn, o) for sn, o in product(spin_names, orb_names))

# Hamiltonian
H = h_int_kanamori(spin_names, orb_names,
                   np.array([[0, U - 3 * J], [U - 3 * J, 0]]),
                   np.array([[U, U - 2 * J], [U - 2 * J, U]]), J, True)
H -= mu * N

# Diagonalize H
ed.diagonalize(H)

# Compute G(i\omega)
G_iw = ed.G_iw(gf_struct, beta, n_iw)

# Compute G(\tau)
G_tau = ed.G_tau(gf_struct, beta, n_tau)
Пример #26
0
# GF structure
gf_struct = {'up': [0], 'dn': [0]}

# Conversion from TRIQS to Pomerol notation for operator indices
index_converter = {}
index_converter.update({(sn, 0): ("loc", 0, "down" if sn == "dn" else "up")
                        for sn in spin_names})
index_converter.update({("B%i_%s" % (k, sn), 0):
                        ("bath" + str(k), 0, "down" if sn == "dn" else "up")
                        for k, sn in product(range(len(epsilon)), spin_names)})

# Make PomerolED solver object
ed = PomerolED(index_converter, verbose=True)

# Number of particles on the impurity
H_loc = -mu * (n('up', 0) + n('dn', 0)) + U * n('up', 0) * n('dn', 0)

# Bath Hamiltonian
H_bath = sum(eps * n("B%i_%s" % (k, sn), 0)
             for sn, (k, eps) in product(spin_names, enumerate(epsilon)))

# Hybridization Hamiltonian
H_hyb = Operator()
for k, v in enumerate(V):
    H_hyb += sum(v * c_dag("B%i_%s" % (k, sn), 0) * c(sn, 0) +
                 np.conj(v) * c_dag(sn, 0) * c("B%i_%s" % (k, sn), 0)
                 for sn in spin_names)

# Complete Hamiltonian
H = H_loc + H_hyb + H_bath
Пример #27
0
        post_process=True,
    )

    p.version = ParameterCollection()
    p.version.grab_attribs(version, ['version', 'ctint_hash', 'triqs_hash'])

    # -- The alpha tensor

    p.diag = 0.5 + p.delta
    p.odiag = 0.5 - p.delta
    p.solve.alpha = [[[p.diag, p.odiag] for i in indices]
                     for bl, indices in p.gf_struct]

    # -- Total impurity hamiltonian and interaction part

    p.H_0 = -p.mu * (n('up', 0) + n('dn', 0)) - p.h * (n('up', 0) - n('dn', 0))
    p.H_int = p.U * n('up', 0) * n('dn', 0)
    p.H = p.H_0 + p.H_int
    p.solve.h_int = p.H_int

    # -- Non-Interacting Impurity Green function

    iw_mesh = MeshImFreq(p.beta, 'Fermion', p.n_iw)
    p.G0_iw = Gf_from_struct(mesh=iw_mesh, struct=p.gf_struct)

    h_field_dict = dict(up=p.h, dn=-p.h)
    for name, g0_iw in p.G0_iw:
        h_field = h_field_dict[name]
        g0_iw << inverse(iOmega_n + p.mu + h_field)

    # -- CTINT