def analytic_hubbard_atom(beta, U, nw, nwf, nwf_gf): d = ParameterCollection() d.beta, d.U, d.nw, d.nwf, d.nwf_gf = beta, U, nw, nwf, nwf_gf g_iw = single_particle_greens_function(beta=beta, U=U, nw=nwf_gf) d.G_iw = g_iw # make block gf of the single gf G_iw_block = BlockGf(name_list=['up', 'dn'], block_list=[g_iw, g_iw]) g_mat = block_iw_AB_to_matrix_valued(G_iw_block) d.chi_m = chi_ph_magnetic(beta=beta, U=U, nw=nw, nwf=nwf) d.chi0_m = chi0_from_gg2_PH(g_mat, d.chi_m) # -- Numeric vertex from BSE d.gamma_m_num = inverse_PH(d.chi0_m) - inverse_PH(d.chi_m) # -- Analytic vertex d.gamma_m = gamma_ph_magnetic(beta=beta, U=U, nw=nw, nwf=nwf) # -- Analytic magnetization expecation value # -- and static susceptibility d.Z = 2. + 2 * np.exp(-beta * 0.5 * U) d.m2 = 0.25 * (2 / d.Z) d.chi_m_static = 2. * beta * d.m2 d.label = r'Analytic' return d
def make_calc(beta=2.0, h_field=0.0): # ------------------------------------------------------------------ # -- Hubbard atom with two bath sites, Hamiltonian p = ParameterCollection( beta = beta, h_field = h_field, U = 5.0, ntau = 40, niw = 15, ) p.mu = 0.5*p.U # ------------------------------------------------------------------ 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) p.H = -p.mu * nA + p.U * docc + p.h_field * mA # ------------------------------------------------------------------ fundamental_operators = [c(up,0), c(do,0)] ed = TriqsExactDiagonalization(p.H, fundamental_operators, p.beta) g_tau = GfImTime(beta=beta, statistic='Fermion', n_points=40, indices=[0]) g_iw = GfImFreq(beta=beta, statistic='Fermion', n_points=10, indices=[0]) p.G_tau = BlockGf(name_list=[up,do], block_list=[g_tau]*2, make_copies=True) p.G_iw = BlockGf(name_list=[up,do], block_list=[g_iw]*2, make_copies=True) ed.set_g2_tau(p.G_tau[up], c(up,0), c_dag(up,0)) ed.set_g2_tau(p.G_tau[do], c(do,0), c_dag(do,0)) ed.set_g2_iwn(p.G_iw[up], c(up,0), c_dag(up,0)) ed.set_g2_iwn(p.G_iw[do], c(do,0), c_dag(do,0)) p.magnetization = ed.get_expectation_value(0.5 * mA) p.magnetization2 = ed.get_expectation_value(0.25 * mA * mA) # ------------------------------------------------------------------ # -- Store to hdf5 filename = 'data_pyed_h_field_%4.4f.h5' % h_field with HDFArchive(filename,'w') as res: res['p'] = p
def make_calc(): # ------------------------------------------------------------------ # -- Hamiltonian p = ParameterCollection( beta = 0.5, U = 0.5, nw = 1, nwf = 15, V = 1.0, eps = 0.2, ) p.nwf_gf = 4 * p.nwf p.mu = 0.5*p.U # ------------------------------------------------------------------ ca_up, cc_up = c('0', 0), c_dag('0', 0) ca_do, cc_do = c('0', 1), c_dag('0', 1) ca0_up, cc0_up = c('1', 0), c_dag('1', 0) ca0_do, cc0_do = c('1', 1), c_dag('1', 1) docc = cc_up * ca_up * cc_do * ca_do nA = cc_up * ca_up + cc_do * ca_do hybridiz = p.V * (cc0_up * ca_up + cc_up * ca0_up + cc0_do * ca_do + cc_do * ca0_do) bath_lvl = p.eps * (cc0_up * ca0_up + cc0_do * ca0_do) p.H_int = p.U * docc p.H = -p.mu * nA + p.H_int + hybridiz + bath_lvl # ------------------------------------------------------------------ # -- 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 = { ('0', 0) : ('loc', 0, 'up'), ('0', 1) : ('loc', 0, 'down'), ('1', 0) : ('loc', 1, 'up'), ('1', 1) : ('loc', 1, 'down'), } # -- Create Exact Diagonalization instance ed = PomerolED(index_converter, verbose=True) ed.diagonalize(p.H) # -- Diagonalize H p.gf_struct = [['0', [0, 1]]] # -- Single-particle Green's functions p.G_iw = ed.G_iw(p.gf_struct, p.beta, n_iw=p.nwf_gf)['0'] # -- Particle-particle two-particle Matsubara frequency Green's function opt = dict( beta=p.beta, gf_struct=p.gf_struct, blocks=set([("0", "0")]), n_iw=p.nw, n_inu=p.nwf) p.G2_iw_ph = ed.G2_iw_inu_inup(channel='PH', **opt)[('0', '0')] filename = 'data_pomerol.h5' with HDFArchive(filename,'w') as res: res['p'] = p import os os.system('tar czvf data_pomerol.tar.gz data_pomerol.h5') os.remove('data_pomerol.h5')
def analytic_hubbard_atom(beta, U, nw, nwf, nwf_gf): r""" Compute dynamical response functions for the Hubbard atom at half filling. This function returns an object that contains the single-particle Greens function :math:`G(\omega)`, the magnetic two-particle generalized susceptibility :math:`\chi_m(\omega, \nu, \nu')`, and the corresponding bare bubble :math:`\chi^{(0)}_m(\omega, \nu, \nu')`, and the magnetic vertex function :math:`\Gamma_m(\omega, \nu, \nu')`. This is implemented using analytical formulas from Thunstrom et al. [PRB 98, 235107 (2018)] please cite the paper if you use this function! In particular this is one exact solution to the Bethe-Salpeter equation, that is the infinite matrix inverse problem: .. math:: \Gamma_m = [\chi^{(0)}_m]^{-1} - \chi_m^{-1} Parameters ---------- beta : float Inverse temperature. U : float Hubbard U interaction parameter. nw : int Number of bosonic Matsubara frequencies in the computed two-particle response functions. nwf : int Number of fermionic Matsubara frequencies in the computed two-particle response functions. nwf_gf : int Number of fermionic Matsubara frequencies in the computed single-particle Greens function. Returns ------- p : ParameterCollection Object containing all the response functions and some other observables, `p.G_iw`, `p.chi_m`, `p.chi0_m`, `p.gamma_m`, `p.Z`, `p.m2`, `p.chi_m_static`. """ d = ParameterCollection() d.beta, d.U, d.nw, d.nwf, d.nwf_gf = beta, U, nw, nwf, nwf_gf g_iw = single_particle_greens_function(beta=beta, U=U, nw=nwf_gf) d.G_iw = g_iw # make block gf of the single gf G_iw_block = BlockGf(name_list=['up', 'dn'], block_list=[g_iw, g_iw]) g_mat = block_iw_AB_to_matrix_valued(G_iw_block) d.chi_m = chi_ph_magnetic(beta=beta, U=U, nw=nw, nwf=nwf) d.chi0_m = chi0_from_gg2_PH(g_mat, d.chi_m) # -- Numeric vertex from BSE d.gamma_m_num = inverse_PH(d.chi0_m) - inverse_PH(d.chi_m) # -- Analytic vertex d.gamma_m = gamma_ph_magnetic(beta=beta, U=U, nw=nw, nwf=nwf) # -- Analytic magnetization expecation value # -- and static susceptibility d.Z = 2. + 2 * np.exp(-beta * 0.5 * U) d.m2 = 0.25 * (2 / d.Z) d.chi_m_static = 2. * beta * d.m2 d.label = r'Analytic' return d
def make_calc(): # ------------------------------------------------------------------ # -- Hubbard atom with two bath sites, Hamiltonian p = ParameterCollection( beta=1.0, U=5.0, nw=1, nwf=20, ) p.nwf_gf = 4 * p.nwf p.mu = 0.5 * p.U # ------------------------------------------------------------------ ca_up, cc_up = c('0', 0), c_dag('0', 0) ca_do, cc_do = c('0', 1), c_dag('0', 1) docc = cc_up * ca_up * cc_do * ca_do nA = cc_up * ca_up + cc_do * ca_do p.H = -p.mu * nA + p.U * docc # ------------------------------------------------------------------ # -- 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 = { ('0', 0): ('loc', 0, 'up'), ('0', 1): ('loc', 0, 'down'), } # -- Create Exact Diagonalization instance ed = PomerolED(index_converter, verbose=True) ed.diagonalize(p.H) # -- Diagonalize H gf_struct = [['0', [0, 1]]] # -- Single-particle Green's functions p.G_iw = ed.G_iw(gf_struct, p.beta, n_iw=p.nwf_gf)['0'] # -- Particle-particle two-particle Matsubara frequency Green's function opt = dict(beta=p.beta, gf_struct=gf_struct, blocks=set([("0", "0")]), n_iw=p.nw, n_inu=p.nwf) p.G2_iw_ph = ed.G2_iw_inu_inup(channel='PH', **opt)[('0', '0')] # ------------------------------------------------------------------ # -- Generalized susceptibility in magnetic PH channel p.chi_m = Gf(mesh=p.G2_iw_ph.mesh, target_shape=[1, 1, 1, 1]) p.chi_m[0, 0, 0, 0] = p.G2_iw_ph[0, 0, 0, 0] - p.G2_iw_ph[0, 0, 1, 1] p.chi0_m = chi0_from_gg2_PH(p.G_iw, p.chi_m) p.label = r'Pomerol' # ------------------------------------------------------------------ # -- Generalized susceptibility in PH channel p.chi = chi_from_gg2_PH(p.G_iw, p.G2_iw_ph) p.chi0 = chi0_from_gg2_PH(p.G_iw, p.G2_iw_ph) p.gamma = inverse_PH(p.chi0) - inverse_PH(p.chi) # ------------------------------------------------------------------ # -- Store to hdf5 filename = 'data_pomerol.h5' with HDFArchive(filename, 'w') as res: res['p'] = p