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))
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))
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 # Construct the solver S = SolverCore(beta=beta, gf_struct=gf_struct, n_iw=1025, n_tau=10000)
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__)
# 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) if mpi.is_master_node(): with HDFArchive("slater.out.h5", 'w') as Results: Results["G_tau"] = S.G_tau
# GF structure gf_struct = set_operator_structure(spin_names, orb_names, False) mkind = get_mkind(False, None) # Conversion from TRIQS to Pomerol notation for operator indices index_converter = { mkind(sn, bn): ("atom", bi, "down" if sn == "dn" else "up") for sn, (bi, bn) in product(spin_names, enumerate(orb_names)) } # Make PomerolED solver object ed = PomerolED(index_converter, verbose=True) # Hamiltonian H = h_int_slater(spin_names, orb_names, U_mat, False) # Number of particles N = N_op(spin_names, orb_names, False) # z-component of spin Sz = S_op('z', spin_names, orb_names, False) # z-component of angular momentum Lz = L_op('z', spin_names, orb_names, off_diag=False, basis='spherical') # Double check that we are actually using integrals of motion h_comm = lambda op: H * op - op * H assert h_comm(N).is_zero() assert h_comm(Sz).is_zero() assert h_comm(Lz).is_zero()
map_operator_structure=map_operator_structure) Lz = L_op('z', spin_names, orb_names, map_operator_structure=map_operator_structure, basis='spherical') Jz = Sz + Lz # LS coupling term # LS = ls_op(spin_names, orb_names, off_diag=off_diag, basis = 'spherical') # Hamiltonian # U_mat = U_matrix(L, radial_integrals = [F0,F2,F4], basis='spherical') U_mat = U_matrix(L, U_int=U, J_hund=J, basis='spherical') H_int = h_int_slater(spin_names, orb_names, U_mat, map_operator_structure=map_operator_structure) # H -= mu*N # H += ls_coupling * LS # Double check that we are actually using integrals of motion # h_comm = lambda op: H*op - op*H # str_if_commute = lambda op: "= 0" if h_comm(op).is_zero() else "!= 0" # print "Check integrals of motion:" # print "[H, N]", str_if_commute(N) # print "[H, Sz]", str_if_commute(Sz) # print "[H, Lz]", str_if_commute(Lz) # print "[H, Jz]", str_if_commute(Jz)
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 mpi.report("Constructing the solver...") # Construct the solver S = SolverCore(beta=beta, gf_struct=gf_struct, n_tau=n_tau, n_iw=n_iw)
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 mpi.report("Constructing the solver...") # Construct the solver S = SolverCore(beta=beta, gf_struct=gf_struct, n_tau=n_tau, n_iw=n_iw)
print "Block structure of single-particle Green's functions:", gf_struct print "index_converter:", index_converter # Operators N = N_op(spin_names, orb_names, off_diag=off_diag) Sz = S_op('z', spin_names, orb_names, off_diag=off_diag) Lz = L_op('z', spin_names, orb_names, off_diag=off_diag, basis='spherical') Jz = Sz + Lz # LS coupling term LS = ls_op(spin_names, orb_names, off_diag=off_diag, basis='spherical') # Hamiltonian # U_mat = U_matrix(L, radial_integrals = [F0,F2,F4], basis='spherical') U_mat = U_matrix(L, U_int=U, J_hund=J, basis='spherical') H = h_int_slater(spin_names, orb_names, U_mat, off_diag=off_diag) H -= mu * N H += ls_coupling * LS # Double check that we are actually using integrals of motion h_comm = lambda op: H * op - op * H str_if_commute = lambda op: "= 0" if h_comm(op).is_zero() else "!= 0" print "Check integrals of motion:" print "[H, N]", str_if_commute(N) print "[H, Sz]", str_if_commute(Sz) print "[H, Lz]", str_if_commute(Lz) print "[H, Jz]", str_if_commute(Jz) #####################