def plot_A_ev_utp(beta, urange, mu, tprange): w = np.linspace(-2, 2, 1500) + 1j * 5e-3 for u_int, tp in zip(urange, tprange): h_at, oper = dimer.hamiltonian(u_int, mu, tp) eig_e, eig_v = op.diagonalize(h_at.todense()) gf = op.gf_lehmann(eig_e, eig_v, oper[0].T, beta, w) plt.plot(w.real, u_int + gf.imag / gf.imag.min(), 'k-')
def test_hamiltonian_eigen_energies(u_int, mu, tp): """Test local basis and diagonal basis isolated dimer Hamiltonians have same energy spectrum""" h_loc, _ = dimer.hamiltonian(u_int, mu, tp) h_dia, _ = dimer.hamiltonian_diag(u_int, mu, tp) eig_e_loc, _ = op.diagonalize(h_loc.todense()) eig_e_dia, _ = op.diagonalize(h_dia.todense()) assert np.allclose(eig_e_loc, eig_e_dia)
def plot_A_ev_ru(beta, urange, mu, tp): w = np.linspace(0, 2, 500) + 1j * 5e-3 for u_int in urange: h_at, oper = dimer.hamiltonian(u_int, mu, tp) eig_e, eig_v = op.diagonalize(h_at.todense()) gf = op.gf_lehmann(eig_e, eig_v, oper[0].T, beta, w) plt.plot(w.real, u_int + gf.imag / gf.imag.min()) plt.plot(0.5 * np.sqrt(urange**2 + 16 * tp**2) - tp, urange, '*:', label=r'$|GS\rangle \rightarrow \pm t_\perp + 1/2(U^2+16t^2_\perp)^{1/2}$') plt.plot(0.5 * np.sqrt(urange**2 + 16 * tp**2) + tp, urange, '*:') plt.plot(urange / 2 - tp, urange, 'x:', label=r'$|T\rangle \rightarrow \pm t_\perp + U/2$') plt.plot(urange / 2 + tp, urange, 'x:') plt.xlim([min(w.real), max(w.real)])
def plot_eigen_spectra(U, mu, tp): h_at, oper = dimer.hamiltonian(U, mu, tp) eig_e = [] eig_e.append(LA.eigvalsh(h_at[1:5, 1:5].todense())) eig_e.append(LA.eigvalsh(h_at[5:11, 5:11].todense())) eig_e.append(LA.eigvalsh(h_at[11:15, 11:15].todense())) plt.figure() plt.title('Many particle Energy Spectra U={} $t_\perp={}$'.format(U, tp)) plt.plot(np.concatenate(eig_e), "o-") plt.ylabel('Energy') plt.xlabel('Eigenstate by N particle block') plt.axvline(x=3.5) plt.axvline(x=9.5)
def plot_A_ev_rtp(beta, u_int, mu, tprange): w = np.linspace(-4, 4, 5500) + 1j * 5e-3 for tp in tprange: h_at, oper = dimer.hamiltonian(u_int, mu, tp) eig_e, eig_v = op.diagonalize(h_at.todense()) gfd = op.gf_lehmann(eig_e, eig_v, oper[0].T, beta, w) gfo = op.gf_lehmann(eig_e, eig_v, oper[0].T, beta, w, oper[1]) gf = gfd + gfo plt.plot(w.real, tp + gf.imag / gf.imag.min()) plt.title('Molecule exitation spectral function') plt.xlabel(r'$\omega$') plt.plot(0.5 * np.sqrt(u_int**2 + 16 * tprange**2) - tprange, tprange, '*:', label=r'$|GS\rangle \rightarrow \pm t_\perp + 1/2(U^2+16t^2_\perp)^{1/2}$') plt.plot(0.5 * np.sqrt(u_int**2 + 16 * tprange**2) + tprange, tprange, '*:') plt.plot(u_int / 2 - tprange, tprange, 'x:', label=r'$|T\rangle \rightarrow \pm t_\perp + U/2$') plt.plot(u_int / 2 + tprange, tprange, 'x:') plt.xlim([min(w.real), max(w.real)])
def molecule_sigma(omega, U, mu, tp, beta): """Return molecule self-energy in the given frequency axis""" h_at, oper = dimer.hamiltonian(U, mu, tp) oper_pair = [[oper[0], oper[0]], [oper[0], oper[1]]] eig_e, eig_v = op.diagonalize(h_at.todense()) gfsU = np.array([ op.gf_lehmann(eig_e, eig_v, c.T, beta, omega, d) for c, d in oper_pair ]) invg = dimer.mat_inv(gfsU[0], gfsU[1]) plt.plot(omega.real, -gfsU[0].imag, label='Interacting') plt.plot(omega.real, -dimer.mat_inv(omega, -tp)[0].imag, label='Free') plt.xlabel(r'$\omega$') plt.ylabel(r'$A(\omega)$') plt.title(r'Isolated dimer $U={}$, $t_\perp={}$, $\beta={}$'.format( U, tp, beta)) plt.legend(loc=0) return [omega - invg[0], -tp - invg[1]]
def test_dimer_energies(u_int, mu, tp, beta=100): h_loc, (a_up, b_up, a_dw, b_dw) = dimer.hamiltonian(u_int, mu, tp) e_imp = (tp * (a_up.T * b_up + a_dw.T * b_dw + b_up.T * a_up + b_dw.T * a_dw)).todense() eig_e, eig_v = op.diagonalize(h_loc.todense()) w_n = gf.matsubara_freq(beta, 2**8) # n=2**7=256 gf_di = op.gf_lehmann(eig_e, eig_v, a_up.T, beta, 1j * w_n) gf_of = op.gf_lehmann(eig_e, eig_v, a_up.T, beta, 1j * w_n, b_up) ekin_gf = dimer.ekin(gf_di, gf_of, w_n, tp, beta, 0) ekin_ed = op.expected_value(e_imp, eig_e, eig_v, beta) assert abs(ekin_ed - ekin_gf) < 5e-4 epot_gf = dimer.epot(gf_di, w_n, beta, u_int**2 / 4 + tp**2, ekin_gf, u_int) docc = (a_up.T * a_up * a_dw.T * a_dw + b_up.T * b_up * b_dw.T * b_dw).todense() epot_ed = op.expected_value(docc, eig_e, eig_v, beta) * u_int assert abs(epot_ed - epot_gf) < 1e-3