Exemple #1
0
def run_slater(L, is_cubic):
    for l in L:
        orb_names = range(2 * l + 1)
        num_orbitals = len(orb_names)
        gf_struct = set_operator_structure(spin_names, orb_names, True)
        mkind = get_mkind(True, None)

        F = [3.0 * (0.3**k) for k in range(l + 1)]

        U_mat = U_matrix(l, F, basis='cubic' if is_cubic else 'spherical')
        h_int = h_int_slater(spin_names, orb_names, U_mat, True)

        h_k = np.zeros((num_orbitals, num_orbitals))

        # Quantum numbers
        QN = [
            sum([n(*mkind("up", o)) for o in orb_names], Operator()),  # N_up
            sum([n(*mkind("dn", o)) for o in orb_names], Operator())
        ]  # N_down

        eig_qn, time_qn = partition(h_int, h_k, gf_struct, QN)
        eig_ap, time_ap = partition(h_int, h_k, gf_struct)

        model = "Slater, %i orbitals" % num_orbitals
        model += (" (cubic basis)" if is_cubic else " (spherical basis)")
        print_line(model, 2**(2 * num_orbitals), (len(eig_qn), time_qn),
                   (len(eig_ap), time_ap))
Exemple #2
0
def run_kanamori(max_orbitals,orbital_mixing):
    for num_orbitals in range(2,max_orbitals+1):
        orb_names = range(num_orbitals)
        gf_struct = set_operator_structure(spin_names,orb_names,True)
        mkind = get_mkind(True,None)

        U = 1.0*(np.ones((num_orbitals,num_orbitals))-np.eye(num_orbitals))
        Up = 2.0*np.ones((num_orbitals,num_orbitals))
        J = 0.2
        V = 0.3

        h_k = V*np.ones((num_orbitals,num_orbitals)) if orbital_mixing else V*np.eye(num_orbitals)
        h_int = h_int_kanamori(spin_names,orb_names,U,Up,J,True)

        # Quantum numbers
        QN = [sum([n(*mkind("up",o)) for o in orb_names],Operator()),   # N_up
              sum([n(*mkind("dn",o)) for o in orb_names],Operator())]   # N_down
        if not orbital_mixing:
            # PS quantum number
            QN.append(Operator())
            for i, o in enumerate(orb_names):
                dn = n(*mkind("up",o)) - n(*mkind("dn",o))
                QN[2] += (2**i)*dn*dn

        eig_qn,time_qn = partition(h_int,h_k,gf_struct,QN)
        eig_ap,time_ap = partition(h_int,h_k,gf_struct)

        model = "Kanamori, %i orbitals"%num_orbitals
        if orbital_mixing: model += " (orbital mixing)"
        print_line(model,2**(2*num_orbitals),(len(eig_qn),time_qn),(len(eig_ap),time_ap))
Exemple #3
0
def run_kanamori(max_orbitals, orbital_mixing):
    for num_orbitals in range(2, max_orbitals + 1):
        orb_names = range(num_orbitals)
        gf_struct = set_operator_structure(spin_names, orb_names, True)
        mkind = get_mkind(True, None)

        U = 1.0 * (np.ones(
            (num_orbitals, num_orbitals)) - np.eye(num_orbitals))
        Up = 2.0 * np.ones((num_orbitals, num_orbitals))
        J = 0.2
        V = 0.3

        h_k = V * np.ones(
            (num_orbitals,
             num_orbitals)) if orbital_mixing else V * np.eye(num_orbitals)
        h_int = h_int_kanamori(spin_names, orb_names, U, Up, J, True)

        # Quantum numbers
        QN = [
            sum([n(*mkind("up", o)) for o in orb_names], Operator()),  # N_up
            sum([n(*mkind("dn", o)) for o in orb_names], Operator())
        ]  # N_down
        if not orbital_mixing:
            # PS quantum number
            QN.append(Operator())
            for i, o in enumerate(orb_names):
                dn = n(*mkind("up", o)) - n(*mkind("dn", o))
                QN[2] += (2**i) * dn * dn

        eig_qn, time_qn = partition(h_int, h_k, gf_struct, QN)
        eig_ap, time_ap = partition(h_int, h_k, gf_struct)

        model = "Kanamori, %i orbitals" % num_orbitals
        if orbital_mixing: model += " (orbital mixing)"
        print_line(model, 2**(2 * num_orbitals), (len(eig_qn), time_qn),
                   (len(eig_ap), time_ap))
Exemple #4
0
def run_slater(L,is_cubic):
    for l in L:
        orb_names = range(2*l+1)
        num_orbitals = len(orb_names)
        gf_struct = set_operator_structure(spin_names,orb_names,True)
        mkind = get_mkind(True,None)

        F = [3.0*(0.3**k) for k in range(l+1)]

        U_mat = U_matrix(l,F,basis='cubic' if is_cubic else 'spherical')
        h_int = h_int_slater(spin_names,orb_names,U_mat,True)

        h_k = np.zeros((num_orbitals,num_orbitals))

        # Quantum numbers
        QN = [sum([n(*mkind("up",o)) for o in orb_names],Operator()),   # N_up
              sum([n(*mkind("dn",o)) for o in orb_names],Operator())]   # N_down

        eig_qn,time_qn = partition(h_int,h_k,gf_struct,QN)
        eig_ap,time_ap = partition(h_int,h_k,gf_struct)

        model = "Slater, %i orbitals"%num_orbitals
        model += (" (cubic basis)" if is_cubic else " (spherical basis)")
        print_line(model,2**(2*num_orbitals),(len(eig_qn),time_qn),(len(eig_ap),time_ap))
Exemple #5
0
num_orbitals = 2
mu = 1.0
U = 2.0
J = 0.2
h = 0.1

# Poles of delta
epsilon = 2.3

# Hybridization matrices
V = 2.0 * np.eye(num_orbitals) + 0.2 * (np.ones(num_orbitals) - np.eye(num_orbitals))

# Block structure of GF
spin_names = ('up','dn')
orb_names = range(num_orbitals)
gf_struct = set_operator_structure(spin_names,orb_names,True)

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

# 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 += h*S_op('z',spin_names,orb_names,True)

# Set hybridization function
delta_w = GfImFreq(indices = orb_names, beta=beta)
delta_w << inverse(iOmega_n - epsilon) + inverse(iOmega_n + epsilon)
delta_w.from_L_G_R(V, delta_w, V)
Exemple #6
0
F0 = 4.0
F2 = 0.5

spin_names = ("up","dn")
cubic_names = map(str,range(2*L+1))
U_mat = U_matrix(L, radial_integrals=[F0,F2], basis="spherical")

# Parameters
p = {}
p["verbosity"] = 0
p["length_cycle"] = 50
p["n_warmup_cycles"] = 0
p["n_cycles"] = 0

# Block structure of GF
gf_struct = set_operator_structure(spin_names,cubic_names,False)

# Local Hamiltonian
H = h_int_slater(spin_names,cubic_names,U_mat,False)

# Observables
N = N_op(spin_names,cubic_names,False)
S2 = S2_op(spin_names,cubic_names,False)
Sz = S_op('z',spin_names,cubic_names,False)
L2 = L2_op(spin_names,cubic_names,False)
Lz = L_op('z',spin_names,cubic_names,False)
LS = LS_op(spin_names,cubic_names,False)

# Additional splitting terms to lift the degeneracies
H += 0.22*Sz
H += 0.33*Lz
Exemple #7
0
    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"] = 3000000

    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"
Exemple #8
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/10
p["n_cycles"] = 3200000/10
p["use_norm_as_weight"] = True
p["measure_density_matrix"] = False

results_file_name = "kanamori_offdiag." + ("qn." if use_qn else "") + "h5"

mpi.report("Welcome to Kanamori (off-diagonal) benchmark.")

gf_struct = set_operator_structure(spin_names,orb_names,True)
mkind = get_mkind(True,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,True)

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"
Exemple #9
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__)
Exemple #10
0
cubic_names = map(str, range(2 * L + 1))
U_mat = U_matrix(L, radial_integrals=[F0, F2, F4], basis="cubic")

# Parameters
p = {}
p["max_time"] = -1
p["random_name"] = ""
p["random_seed"] = 123 * mpi.rank + 567
p["length_cycle"] = 50
p["n_warmup_cycles"] = 50
p["n_cycles"] = 5000
p["measure_g_l"] = True
p["move_double"] = False

# Block structure of GF
gf_struct = set_operator_structure(spin_names, cubic_names, False)

# Local Hamiltonian
H = h_int_slater(spin_names, cubic_names, U_mat, False)

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

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

S.solve(h_int=H, **p)
Exemple #11
0
    assert( T1.shape == T2.shape )
    for idxs in itertools.product(*[ range(x) for x in T1.shape ]):
        print idxs, T1[idxs], T2[idxs]
        
# ----------------------------------------------------------------------    
if __name__ == '__main__':

    U = 1.0
    J = 0.3
    
    orb_names = ['xy', 'xz', 'yz']
    spin_names = ['up', 'do']
    norb = len(orb_names)

    gf_struct = set_operator_structure(spin_names, orb_names, True) # orbital off diag
    fundamental_operators = fundamental_operators_from_gf_struct(gf_struct)
    
    U_ab, UPrime_ab = U_matrix_kanamori(
        n_orb=len(orb_names), U_int=U, J_hund=J)
    
    H_int = h_int_kanamori(
        spin_names, orb_names, U_ab, UPrime_ab, J_hund=J,
        off_diag=True, map_operator_structure=None, H_dump=None) # orgital offdiag

    U_abcd = get_rpa_tensor(H_int, fundamental_operators)
    
    U_c, U_s = split_quartic_tensor_in_charge_and_spin(U_abcd)

    U_abcd_ref = quartic_tensor_from_charge_and_spin(U_c, U_s)
g2_n_wf = 10

#####################
# Input for Pomerol #
#####################

spin_names = ("up", "dn")
orb_names = map(str, range(-L, L + 1))
# orb_names = range(-L, L+1)  # This also works

flag_so = True if ls_coupling != 0 else False

# GF and operator structure
if not flag_so:
    # ('up', '-2'), ('dn', '-2'), etc
    gf_struct = set_operator_structure(spin_names, orb_names, off_diag=True)
    map_operator_structure = {(s, o): (s, o)
                              for s, o in product(spin_names, orb_names)}
else:
    # ('ud', 'up_-2'), ('ud', 'dn_-2'), etc
    gf_struct = {
        'ud':
        [str(s) + '_' + str(o) for s, o in product(spin_names, orb_names)]
    }
    map_operator_structure = {(s, o): ('ud', str(s) + '_' + str(o))
                              for s, o in product(spin_names, orb_names)}
# print gf_struct
# print map_operator_structure

# Operators
N = N_op(spin_names, orb_names, map_operator_structure=map_operator_structure)
Exemple #13
0
p["random_name"] = ""
p["random_seed"] = 123 * mpi.rank + 567
p["length_cycle"] = 50
p["n_warmup_cycles"] = 1000
p["n_cycles"] = 30000
p["partition_method"] = "autopartition"
p["measure_g_tau"] = True
p["move_shift"] = 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)

# 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)

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