# Bath hamiltonian in matrix representation h_bath_mat = diag(eps_bath) - matrix([[0, t_bath], [t_bath, 0]]) # Coupling matrix V_mat = matrix([[1., 1.], [1., 1.]]) # ==== Local Hamiltonian ==== c_dag_vec = { s: matrix([[c_dag(s,o) for o in orb_names]]) for s in spin_names } c_vec = { s: matrix([[c(s,o)] for o in orb_names]) for s in spin_names } h_0 = sum(c_dag_vec[s] * h_0_mat * c_vec[s] for s in spin_names)[0,0] Umat, Upmat = U_matrix_kanamori(n_orb, U_int=U, J_hund=J) h_int = h_int_kanamori(spin_names, orb_names, Umat, Upmat, J, off_diag=True) h_imp = h_0 + h_int # ==== Bath & Coupling hamiltonian ==== orb_bath_names = ['b_' + str(o) for o in orb_names] c_dag_bath_vec = { s: matrix([[c_dag(s, o) for o in orb_bath_names]]) for s in spin_names } c_bath_vec = { s: matrix([[c(s, o)] for o in orb_bath_names]) for s in spin_names } h_bath = sum(c_dag_bath_vec[s] * h_bath_mat * c_bath_vec[s] for s in spin_names)[0,0] h_coup = sum(c_dag_vec[s] * V_mat * c_bath_vec[s] + c_dag_bath_vec[s] * V_mat * c_vec[s] for s in spin_names)[0,0] # FIXME Adjoint # ==== Total impurity hamiltonian ==== h_tot = h_imp + h_coup + h_bath # ==== Green function structure ====
from triqs.operators.util import U_matrix_kanamori, h_int_kanamori from triqs_tprf.OperatorUtils import fundamental_operators_from_gf_struct from triqs_tprf.rpa_tensor import get_rpa_tensor U = 1.0 J = 0.1 spin_names = ['up', 'do'] orb_names = list(range(norb)) # TRIQS uses spin as slow index gf_struct = [[spin_name, norb] for spin_name in spin_names] Umat, Upmat = U_matrix_kanamori(n_orb=norb, U_int=U, J_hund=J) H_int = h_int_kanamori(spin_names, orb_names, U=Umat, Uprime=Upmat, J_hund=J, off_diag=True) fundamental_operators = fundamental_operators_from_gf_struct(gf_struct) U_abcd = get_rpa_tensor(H_int, fundamental_operators) # given in cc^+cc^+ # ---------------------------------------------------------------------- # -- Lattice susceptbility in the RPA approximation from triqs_tprf.lattice import solve_rpa_PH chi_wk = solve_rpa_PH(chi00_wk, U_abcd) # ======================================================================
# Coupling matrix V_mat = matrix([[1., 1., 1.], [1., 1., 1.], [1., 1., 1.]]) # ==== Local Hamiltonian ==== c_dag_vec = { s: matrix([[c_dag(s, o) for o in range(n_orb)]]) for s in block_names } c_vec = {s: matrix([[c(s, o)] for o in range(n_orb)]) for s in block_names} h_0 = sum(c_dag_vec[s] * h_0_mat * c_vec[s] for s in block_names)[0, 0] Umat, Upmat = U_matrix_kanamori(n_orb, U_int=U, J_hund=J) h_int = h_int_kanamori(block_names, range(n_orb), Umat, Upmat, J, off_diag=True) h_imp = h_0 + h_int # ==== Bath & Coupling hamiltonian ==== c_dag_bath_vec = { s: matrix([[c_dag(s, o) for o in range(n_orb, n_orb + n_orb_bath)]]) for s in block_names } c_bath_vec = { s: matrix([[c(s, o)] for o in range(n_orb, n_orb + n_orb_bath)]) for s in block_names }
n_idx = len(idx_lst) # ==== Local Hamiltonian ==== c_dag_vec = matrix([[c_dag('bl', idx) for idx in idx_lst]]) c_vec = matrix([[c('bl', idx)] for idx in idx_lst]) h_0_mat = TBL._hop[(0, 0, 0)] h_0 = (c_dag_vec * h_0_mat * c_vec)[0, 0] Umat, Upmat = U_matrix_kanamori(len(orb_names), U_int=U, J_hund=J) op_map = {(s, o): ('bl', i) for i, (s, o) in enumerate(product(block_names, orb_names))} h_int = h_int_kanamori(block_names, orb_names, Umat, Upmat, J, off_diag=True, map_operator_structure=op_map) h_imp = h_0 + h_int # ==== Non-Interacting Impurity Green function ==== iw_mesh = MeshImFreq(beta, 'Fermion', n_iw) k_mesh = MeshBrZone(TBL.bz, n_k) k_iw_mesh = MeshProduct(k_mesh, iw_mesh) G0_k_iw = BlockGf(mesh=k_iw_mesh, gf_struct=gf_struct) G0_iw = BlockGf(mesh=iw_mesh, gf_struct=gf_struct) iw_vec = array([iw.value * np.eye(n_idx) for iw in iw_mesh]) k_vec = array([k.value for k in k_mesh])