from imports import * from plotting import * from nhqm.bases import mom_space as mom from nhqm.problems import He5 from nhqm.calculations import QM as calc problem = He5.problem order = 100 l = 1 j = 1.5 problem.V0 = -47. peak_x = 0.17 peak_y = 0.05 k_max = 2.5 contour = mom.gen_simple_contour(peak_x, peak_y, k_max, order) args = (problem, l, j) H = calc.contour_hamiltonian(mom.H_element_contour, contour, args) eigvals, eigvecs = calc.energies(H) print "Berggren lowest energy:", eigvals[0] basis_function = mom.gen_basis_function(args) wavefunction = calc.gen_wavefunction(eigvecs[:,0], basis_function, contour) r = sp.linspace(0, 10) plt.figure(0) plt.plot(r, r**2 * calc.absq(wavefunction(r))) plt.figure(1) plot_poles(eigvals, problem.mass) plt.figure(2) plot_wavefunctions(contour, eigvecs) plt.show()
import nhqm.calculations.QM as calc problem = He5.problem problem.V0 = -52.3 k_max = 4 order = 20 step_size = k_max / order l = 1 j = 1.5 def absq(x): return x*sp.conjugate(x) H = calc.hamiltonian(mom.H_element, args=(problem, step_size, l, j), order=order) energy, eigvecs = calc.energies(H) basis_function = mom.gen_basis_function(problem, step_size, l=l, j=j) wavefunction = calc.gen_wavefunction(eigvecs[:,0], basis_function) wavefunction = calc.normalize(wavefunction, 0, 10, weight= lambda r: r**2) r = sp.linspace(1e-1, 10, 200) plt.title("Potential, ground energy (and wavefunction, not to scale) \n $l = {0}, j = {1}, V_0 = {2}$MeV") plt.plot(r, l*(l + 1)/ r**2 + problem.potential(r, l, j)) plt.plot(r, .1*r**2 * absq(wavefunction(r)) + energy[0]) plt.plot(r, sp.zeros(len(r)) + energy[0]) plt.axis([0, 10, -0.01, 0.04]) plt.ylabel(r'$r^2|\Psi(r)|^2$') plt.xlabel(r'$r$ / fm') plt.show()