# Diagonalize H ed.diagonalize(H) # Compute reference values of <n('up', 0)> and <n('dn', 0)> w = np.array([ 1.0, np.exp(beta * (mu + h_field)), np.exp(beta * (mu - h_field)), np.exp(-beta * (-2 * mu + U)) ]) Z = np.sum(w) w /= Z n_up_ref, n_dn_ref = complex(w[1] + w[3]), complex(w[2] + w[3]) n_up = ed.ensemble_average(('up', 0), ('up', 0), beta) n_dn = ed.ensemble_average(('dn', 0), ('dn', 0), beta) S_p = ed.ensemble_average(('up', 0), ('dn', 0), beta) S_m = ed.ensemble_average(('dn', 0), ('up', 0), beta) assert abs(n_up - n_up_ref) < 1e-10 assert abs(n_dn - n_dn_ref) < 1e-10 assert abs(S_p) < 1e-10 assert abs(S_m) < 1e-10 # Compute 3 susceptibilities # < n_up ; n_up > # < n_up ; n_dn > # < S_+ ; S_- > # Number of Matsubara frequencies for susceptibility calculation
for sn, o in product(spin_names, orb_names)) # Hybridization Hamiltonian H_hyb = sum(V[o1, o2] * c_dag("B_" + sn, o1) * c(sn, o2) + np.conj(V[o2, o1]) * c_dag(sn, o1) * c("B_" + sn, o2) for sn, o1, o2 in product(spin_names, orb_names, orb_names)) # Complete Hamiltonian H = H_loc + H_hyb + H_bath # Diagonalize H ed.diagonalize(H) # Compute occupations occ = [ ed.ensemble_average(i, i, beta).real for i in product(spin_names, orb_names) ] # 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) # Compute \chi(\tau) = <n_{up,0}(\tau) n_{dn,0}(0)> chi_tau = ed.chi_tau(('up', 0), ('up', 0), ('dn', 0), ('dn', 0), beta, n_tau)
# Hybridization Hamiltonian H_hyb = Operator() for k, v in enumerate(V): H_hyb += sum(v * c_dag("B%i_%s" % (k, sn), 0) * c(sn, 0) + np.conj(v) * c_dag(sn, 0) * c("B%i_%s" % (k, sn), 0) for sn in spin_names) # Complete Hamiltonian H = H_loc + H_hyb + H_bath # Diagonalize H ed.diagonalize(H) # Compute occupations occ = [ed.ensemble_average((s, 0), (s, 0), beta).real for s in spin_names] # 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) # Compute \chi(\tau) = <n_{up}(\tau) n_{dn}(0)> chi_tau = ed.chi_tau(('up', 0), ('up', 0), ('dn', 0), ('dn', 0), beta, n_tau) # Compute \chi(i\nu) chi_inu = ed.chi_inu(('up', 0), ('up', 0), ('dn', 0), ('dn', 0), beta, n_iw)