"and a ${3} \\times\\,{3}$ matrix" .format("", l, j, order)) for (i, problem) in enumerate(problems): print problem.name plt.subplot(1, 2, i+1) plt.title(problem.name) plt.ylabel(r'$r^2|\Psi|^2$') plt.xlabel(r'$r$') plt.show(block=False) for (i, basis) in enumerate(bases): if basis is osc: omega = osc.optimal_osc_freq(problem, l, j) H = calc.hamiltonian(osc.H_element, args=(problem, omega, l, j), order=order) basis_function = basis.gen_basis_function(problem, omega, l=l, j=j) else: H = calc.hamiltonian(basis.H_element, args=(step_size, problem, l, j), order=order) basis_function = basis.gen_basis_function(step_size, problem, l=l, j=j) energy, eigvecs = calc.energies(H) lowest_energy = energy[0] * problem.eV_factor print basis.name, "lowest energy:", lowest_energy, "eV" wavefunction = calc.gen_wavefunction(eigvecs[:, 0], basis_function) wavefunction = calc.normalize(wavefunction, 0, 10, weight=lambda r: r**2) plt.plot(r, r**2 * absq(wavefunction(r)), label = basis.name) plt.legend() plt.draw() plt.show() # pause when done
from __future__ import division from imports import * import nhqm.bases.mom_space as mom from nhqm.problems import He5 import nhqm.calculations.QM as calc problem = He5.problem problem.V0 = -70 k_max = 2.5 steps = 20 lowest_energy = sp.empty(steps) orders = sp.arange(steps) + 1 l = 0 j = .5 for (i, order) in enumerate(orders): step = k_max / order H = calc.hamiltonian(mom.H_element, \ args=(step, problem, l, j), order=order) energy, eigvecs = calc.energies(H) lowest_energy[i] = energy[0] # MeV print order print lowest_energy[-1] plt.plot(orders, lowest_energy) plt.title(r"He5, $l = {0}$, $j = {1}$, $V_0 = {2}$MeV".format(l, j, problem.V0)) plt.xlabel(r"Matrix dimension N ($N \times N$)") plt.ylabel(r"Lowest energy / MeV") plt.show()
from __future__ import division from imports import * import nhqm.bases.mom_space as mom from nhqm.problems import He5 import nhqm.calculations.QM as calc problem = He5.problem steps = 50 lowest_energy = sp.empty(steps) V0s = sp.linspace(-70, 0, steps) l = 0 j = .5 k_max = 4 order = 20 step_size = k_max / order plt.title(r"He5, $l = {0}$, $j = {1}$".format(l, j)) plt.xlabel(r"Potential well depth V0 / MeV") plt.ylabel(r"Ground state energy E / MeV") for (i, V0) in enumerate(V0s): problem.V0 = V0 H = calc.hamiltonian(mom.H_element, args=(problem, step_size, l, j), order=order) energy, eigvecs = calc.energies(H) lowest_energy[i] = energy[0] print V0 plt.plot(V0s, lowest_energy) plt.show()