H = H_int + get_quadratic_operator(T, fop) up, do = spin_names index_converter = { (up, 0): ('loc', 0, 'up'), (do, 0): ('loc', 0, 'down'), (up, 1): ('loc', 1, 'up'), (do, 1): ('loc', 1, 'down'), (up, 2): ('loc', 2, 'up'), (do, 2): ('loc', 2, 'down'), (up, 3): ('loc', 3, 'up'), (do, 3): ('loc', 3, 'down'), (up, 4): ('loc', 4, 'up'), (do, 4): ('loc', 4, 'down'), (up, 5): ('loc', 5, 'up'), (do, 5): ('loc', 5, 'down'), } ed = PomerolED(index_converter, verbose=True) ed.diagonalize(H) gf_struct_up = [[up, [0, 1]]] gf_struct_do = [[do, [0, 1]]] G_tau_up = ed.G_tau(gf_struct_up, beta, n_tau=100) G_tau_do = ed.G_tau(gf_struct_do, beta, n_tau=100) with HDFArchive('kanamori_offdiag.pomerol.h5', 'w') as Results: Results['up'] = G_tau_up Results['dn'] = G_tau_do
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) p.convert_keys_from_string_to_python('index_converter') pom = PomerolED(p.index_converter, verbose=True) pom.diagonalize(p.H) p.g_iw = pom.G_iw(p.gf_struct, p.beta, n_iw=400) p.g_tau = pom.G_tau(p.gf_struct, p.beta, n_tau=200)['0'] p.tau = np.array([float(tau) for tau in p.g_tau.mesh]) opt = dict(block_order='AABB', beta=p.beta, gf_struct=p.gf_struct, blocks=set([('0', '0')]), n_iw=1, n_inu=10) p.g4_ph = pom.G2_iw_inu_inup(channel='PH', **opt)['0', '0'] if mpi.is_master_node(): with HDFArchive('data_pomerol.h5', 'w') as A: A['p'] = p
def make_calc(nw=10, 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.00, epsilon2=4.00, h_field=h_field, mu=2.0, U=5.0, ntau=40, niw=15, n_inu=nw, ) # ------------------------------------------------------------------ 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) ) # ------------------------------------------------------------------ # -- Exact diagonalization # Conversion from TRIQS to Pomerol notation for operator indices # TRIQS: block_name, inner_index # Pomerol: site_label, orbital_index, spin_name index_converter = { (up, 0): ('loc', 0, 'up'), (do, 0): ('loc', 0, 'down'), (up, 1): ('loc', 1, 'up'), (do, 1): ('loc', 1, 'down'), (up, 2): ('loc', 2, 'up'), (do, 2): ('loc', 2, 'down'), } # -- Create Exact Diagonalization instance ed = PomerolED(index_converter, verbose=True) ed.diagonalize(p.H) # -- Diagonalize H gf_struct = [[up, [0]], [do, [0]]] # -- Single-particle Green's functions p.G_iw = ed.G_iw(gf_struct, beta, n_iw=100) p.G_tau = ed.G_tau(gf_struct, beta, n_tau=400) # -- Particle-particle two-particle Matsubara frequency Green's function opt = dict(block_order='AABB', beta=beta, gf_struct=gf_struct, blocks=set([(up, up), (up, do)]), n_iw=1, n_inu=p.n_inu) p.G2_iw_ph = ed.G2_iw_inu_inup(channel='PH', **opt) # ------------------------------------------------------------------ # -- Store to hdf5 mpi.barrier() if mpi.is_master_node(): filename = 'data_pomerol_h_field_%4.4f.h5' % h_field with HDFArchive(filename, 'w') as res: res['p'] = p
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) # Compute G(\omega) G_w = ed.G_w(gf_struct, beta, energy_window, n_w, 0.01) ########### # G^{(2)} # ########### common_g2_params = { 'gf_struct': gf_struct, 'beta': beta, 'blocks': g2_blocks, 'n_iw': g2_n_iw }
def make_calc(): # ------------------------------------------------------------------ # -- Hubbard atom with two bath sites, Hamiltonian params = dict( beta=2.0, V1=2.0, V2=5.0, epsilon1=0.00, epsilon2=4.00, mu=2.0, U=5.0, ntau=40, niw=15, ) # ------------------------------------------------------------------ class Dummy(): def __init__(self): pass d = Dummy() # storage space d.params = params print '--> Solving SIAM with parameters' for key, value in params.items(): print '%10s = %-10s' % (key, str(value)) globals()[key] = value # populate global namespace # ------------------------------------------------------------------ up, do = 'up', 'dn' docc = 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) d.H = -mu * nA + epsilon1 * nB + epsilon2 * nC + U * docc + \ 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) ) + \ 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) ) # ------------------------------------------------------------------ # -- Exact diagonalization # Conversion from TRIQS to Pomerol notation for operator indices # TRIQS: block_name, inner_index # Pomerol: site_label, orbital_index, spin_name index_converter = { (up, 0): ('loc', 0, 'up'), (do, 0): ('loc', 0, 'down'), (up, 1): ('loc', 1, 'up'), (do, 1): ('loc', 1, 'down'), (up, 2): ('loc', 2, 'up'), (do, 2): ('loc', 2, 'down'), } # -- Create Exact Diagonalization instance ed = PomerolED(index_converter, verbose=True) ed.diagonalize(d.H) # -- Diagonalize H gf_struct = [[up, [0]], [do, [0]]] # -- Single-particle Green's functions G_iw = ed.G_iw(gf_struct, beta, n_iw=niw) G_tau = ed.G_tau(gf_struct, beta, n_tau=ntau) G_w = ed.G_w(gf_struct, beta, energy_window=(-2.5, 2.5), n_w=100, im_shift=0.01) d.G_iw = G_iw['up'] d.G_tau = G_tau['up'] d.G_w = G_w['up'] # -- Particle-particle two-particle Matsubara frequency Green's function opt = dict(block_order='AABB', beta=beta, gf_struct=gf_struct, blocks=set([("up", "dn")]), n_iw=niw, n_inu=niw) G2_iw = ed.G2_iw_inu_inup(channel='AllFermionic', **opt) d.G2_iw = G2_iw['up', 'dn'] G2_iw_pp = ed.G2_iw_inu_inup(channel='PP', **opt) d.G2_iw_pp = G2_iw_pp['up', 'dn'] G2_iw_ph = ed.G2_iw_inu_inup(channel='PH', **opt) d.G2_iw_ph = G2_iw_ph['up', 'dn'] # ------------------------------------------------------------------ # -- Store to hdf5 filename = 'data_pomerol.h5' with HDFArchive(filename, 'w') as res: for key, value in d.__dict__.items(): res[key] = value