INNER CODE UNIT · Python
theta
ssebastianmag/hydrogen-wavefunctions · hydrogen_wavefunction.py:162
theta = np.arccos(np.clip(cos_theta, -1.0, 1.0))
phi = np.where(Xg >= 0.0, 0.0, np.pi) if phi_mode == "plane" else np.full_like(r, float(phi_value))
# Compute psi_{n,l,m}(r,theta,phi) = R_{n,l}(r) · Y_{l,m}(theta,phi)
R = radial_wavefunction_Rnl(n, l, r, Z=Z, use_reduced_mass=use_reduced_mass, M=M)
Y = spherical_harmonic_Ylm(l, m, theta, phi)
psi = R * Y
return Xg, Zg, psi, a_mu
def compute_probability_density(psi: np.ndarray):
""" Retrieve probability density |psi|^2.
Parameters:
psi (np.ndarray): Complex-valued coordinate-space wavefunction samples psi(x,z) on y=0.
Returns: