Exemplo n.º 1
0
# We generate basis objects to use later

contour = gauss_contour([0, k_max], basis_state_count)
mom = MomentumBasis(contour)
osc = HarmOscBasis(basis_state_count, problem.mass, problem.HO_omega)
bases = [osc, mom]

# For plotting

r = sp.linspace(0, 10, 100)

# For each basis, we solve the problem, print the ground state energy
# and plot the probability distribution.

for basis in bases:
    states = solve(problem, quantum_numbers, basis)
    ground_state = states[0]

    print basis.name
    print "Ground state energy:", ground_state.energy, problem.energy_units

    plt.plot(r, absq(ground_state.wavefunction(r) * r), label=basis.name)

# Analytical "correct" answer

print "Analytical"
print "Ground state energy:", -0.5, "Hartrees"


def analytical_ground_state_wavefunction(r):
    return 2 * sp.exp(-r)
Exemplo n.º 2
0
'''

# Parameters
l = 1
j = 1.5
x_peak = 0.17
y_peak = -0.07
basis_state_count = 30
k_max = 30

problem = Helium5()
quantum_numbers = QuantumNumbers(l, j)

# Bases and contours
mom_contour = gauss_contour([0, k_max], basis_state_count)
berg_contour = triangle_contour(x_peak, y_peak, k_max, basis_state_count, 5)
mom = MomentumBasis(mom_contour)
berg = MomentumBasis(berg_contour)
bas = [mom, berg]

#  Solve, print and plot for each basis
r = sp.linspace(0, 30, 100)
for basis in bas:
    states = solve(problem, quantum_numbers, basis)
    ground_state = states[0]
    print basis.name
    print "Ground state energy", ground_state.energy, problem.energy_units
    plt.plot(r, absq(ground_state.wavefunction(r) * r), label=basis.name)
# plot(ground_state.wavefunction) #pseudo-code
plt.show()
Exemplo n.º 3
0
def positive_if_imaginary(k):
    """
    Hack to fix rounding errors that make bound states appear
    on the negative imaginary axis.
    """
    if sp.real(k) < 1e-4 and abs(sp.imag(k)) > 0.02:
        return 1j*abs(k)
    else:
        return k

# Solve the problem and save the momentum (k) values for 
# every resonance state

for (i, V0) in enumerate(progress(V0s)):
    problem = Helium5(V0 = V0) 
    states = solve(problem, quantum_numbers, momentum_basis)
    resonance = find_resonance_state(states)
    k = sp.sqrt(2 * problem.mass * resonance.energy)
    ks[i] = positive_if_imaginary(k)

# Plot the resonance ks together with the contour

plot_contour(contour)
plt.plot(sp.real(ks), sp.imag(ks), 'ro', label="Resonance")
plt.legend()
plt.title("Movement of the resonance pole as the potential depth decreases")
plt.xlabel("Re $k$")
plt.ylabel("Im $k$")
plt.show()