Example #1
0
    #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])
        S.G0_iw[b][0,0] << inverse(iOmega_n - e[m] - delta_w)

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

    # Solve the problem
    S.solve(h_int=H, **p)
Example #2
0
def five_plus_five(use_interaction=True):

    results_file_name = "5_plus_5." + ("int."
                                       if use_interaction else "") + "h5"

    # Block structure of GF
    L = 2  # d-orbital
    spin_names = ("up", "dn")
    orb_names = cubic_names(L)

    # Input parameters
    beta = 40.
    mu = 26

    U = 4.0
    J = 0.7
    F0 = U
    F2 = J * (14.0 / (1.0 + 0.63))
    F4 = F2 * 0.63

    # Dump the local Hamiltonian to a text file (set to None to disable dumping)
    H_dump = "H.txt"
    # Dump Delta parameters to a text file (set to None to disable dumping)
    Delta_dump = "Delta_params.txt"

    # Hybridization function parameters
    # Delta(\tau) is diagonal in the basis of cubic harmonics
    # Each component of Delta(\tau) is represented as a list of single-particle
    # terms parametrized by pairs (V_k,\epsilon_k).
    delta_params = {
        "xy": {
            'V': 0.2,
            'e': -0.2
        },
        "yz": {
            'V': 0.2,
            'e': -0.15
        },
        "z^2": {
            'V': 0.2,
            'e': -0.1
        },
        "xz": {
            'V': 0.2,
            'e': 0.05
        },
        "x^2-y^2": {
            'V': 0.2,
            'e': 0.4
        }
    }

    atomic_levels = {
        ('up_xy', 0): -0.2,
        ('dn_xy', 0): -0.2,
        ('up_yz', 0): -0.15,
        ('dn_yz', 0): -0.15,
        ('up_z^2', 0): -0.1,
        ('dn_z^2', 0): -0.1,
        ('up_xz', 0): 0.05,
        ('dn_xz', 0): 0.05,
        ('up_x^2-y^2', 0): 0.4,
        ('dn_x^2-y^2', 0): 0.4
    }

    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"] = 5000
    p["n_warmup_cycles"] = 500
    p["n_cycles"] = int(1.e1 / mpi.size)
    #p["n_cycles"] = int(5.e5 / mpi.size)
    #p["n_cycles"] = int(5.e6 / mpi.size)
    p["partition_method"] = "autopartition"
    p["measure_G_tau"] = True
    p["move_shift"] = True
    p["move_double"] = True
    p["measure_pert_order"] = False
    p["performance_analysis"] = False
    p["use_trace_estimator"] = False

    mpi.report("Welcome to 5+5 (5 orbitals + 5 bath sites) test.")

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

    H = Operator()

    if use_interaction:
        # Local Hamiltonian
        U_mat = U_matrix(L, [F0, F2, F4], basis='cubic')
        H += h_int_slater(spin_names, orb_names, U_mat, False, H_dump=H_dump)
    else:
        mu = 0.

    p["h_int"] = H

    # Quantum numbers (N_up and N_down)
    QN = [Operator(), Operator()]
    for cn in orb_names:
        for i, sn in enumerate(spin_names):
            QN[i] += n(*mkind(sn, cn))
    if 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...")

    H_hyb = Operator()

    # Set hybridization function
    if Delta_dump: Delta_dump_file = open(Delta_dump, 'w')
    for sn, cn in product(spin_names, orb_names):
        bn, i = mkind(sn, cn)
        V = delta_params[cn]['V']
        e = delta_params[cn]['e']

        delta_w = Gf(mesh=MeshImFreq(beta, 'Fermion', n_iw), target_shape=[])
        delta_w << (V**2) * inverse(iOmega_n - e)

        S.G0_iw[bn][i, i] << inverse(iOmega_n + mu - atomic_levels[(bn, i)] -
                                     delta_w)

        cnb = cn + '_b'  # bath level
        a = sn + '_' + cn
        b = sn + '_' + cn + '_b'

        H_hyb += ( atomic_levels[(bn,i)] - mu ) * n(a, 0) + \
            n(b,0) * e + V * ( c(a,0) * c_dag(b,0) + c(b,0) * c_dag(a,0) )

        # Dump Delta parameters
        if Delta_dump:
            Delta_dump_file.write(bn + '\t')
            Delta_dump_file.write(str(V) + '\t')
            Delta_dump_file.write(str(e) + '\n')

    if mpi.is_master_node():
        filename_ham = 'data_Ham%s.h5' % ('_int' if use_interaction else '')
        with HDFArchive(filename_ham, 'w') as arch:
            arch['H'] = H_hyb + H
            arch['gf_struct'] = gf_struct
            arch['beta'] = beta

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

    # Solve the problem
    S.solve(**p)

    # Save the results
    if mpi.is_master_node():
        Results = HDFArchive(results_file_name, 'w')
        Results['G_tau'] = S.G_tau
        Results['G0_iw'] = S.G0_iw
        Results['use_interaction'] = use_interaction
        Results['delta_params'] = delta_params
        Results['spin_names'] = spin_names
        Results['orb_names'] = orb_names

        import __main__
        Results.create_group("log")
        log = Results["log"]
        log["version"] = version.version
        log["triqs_hash"] = version.triqs_hash
        log["cthyb_hash"] = version.cthyb_hash
        log["script"] = inspect.getsource(__main__)
Example #3
0
import numpy as np
import pytriqs.utility.mpi as mpi
from pytriqs.gf import GfImFreq, SemiCircular, inverse, iOmega_n
from pytriqs.operators import n, c, c_dag
from pytriqs.archive import HDFArchive
from triqs_cthyb import SolverCore

cp = dict(beta=10.0,
          gf_struct=[['up', [0]], ['do', [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,
Example #4
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"]
from triqs_cthyb import SolverCore

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],
Example #6
0
def anderson(use_qn=True, use_blocks=True):

    spin_names = ("up","dn")
    mkind = lambda spin: (spin,0) if use_blocks else ("tot",spin)

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

    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"] = 50000
    p["n_cycles"] = 5000000
    p["measure_density_matrix"] = True
    p["use_norm_as_weight"] = True

    results_file_name = "anderson"
    if use_blocks: results_file_name += ".block"
    if use_qn: results_file_name += ".qn"
    results_file_name += ".h5"

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

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

    QN = []
    if use_qn:
        for spin in spin_names: QN.append(n(*mkind(spin)))
        p["quantum_numbers"] = QN
        p["partition_method"] = "quantum_numbers"

    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() ] # convert from dict to list of lists
            
    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
    delta_w = Gf(mesh=MeshImFreq(beta, 'Fermion', n_iw), target_shape=[])
    delta_w << (V**2) * inverse(iOmega_n - epsilon) + (V**2) * inverse(iOmega_n + epsilon)
    for spin in spin_names:
        bn, i = mkind(spin)
        S.G0_iw[bn][i,i] << inverse(iOmega_n + mu - {'up':h,'dn':-h}[spin] - delta_w)

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

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

    # Save the results
    if mpi.is_master_node():
        static_observables = {'Nup' : n(*mkind("up")), 'Ndn' : n(*mkind("dn")), 'unity' : Operator(1.0)}
        dm = S.density_matrix
        for oname in static_observables.keys():
            print oname, trace_rho_op(dm,static_observables[oname],S.h_loc_diagonalization)

        with HDFArchive(results_file_name,'w') as Results:
            Results['G_tau'] = S.G_tau
Example #7
0
# ----------------------------------------------------------------------

from pyed.OperatorUtils import relabel_operators
from pyed.ParameterCollection import ParameterCollection

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

    if mpi.is_master_node():
        with HDFArchive('data_model.h5', 'r') as A:
            p = A["p"]
    else:
        p = None
    p = mpi.bcast(p)

    S = SolverCore(beta=p.beta, gf_struct=p.gf_struct, n_tau=p.ntau, n_iw=p.nw)

    S.G0_iw['0'] << p.g0t_iw

    solve_parameters = dict(
        h_int=p.Ht_int,
        max_time=-1,
        random_name="",
        random_seed=123 * mpi.rank + 567,
        length_cycle=100,
        n_warmup_cycles=int(1e4),
        #n_cycles = int(1e9) / mpi.size,
        n_cycles=int(1e7) / mpi.size,
        move_double=True,
        measure_G2_iw_ph=True,
        measure_G2_n_fermionic=10,