INNER CODE UNIT · Python
axis
ssebastianmag/hydrogen-wavefunctions · hydrogen_wavefunction.py:154
axis = np.linspace(-r_max, r_max, grid_points)
Zg, Xg = np.meshgrid(axis, axis, indexing="ij")
r = np.hypot(Xg, Zg)
cos_theta = np.empty_like(r)
np.divide(Zg, r, out=cos_theta, where=(r > 0))
cos_theta[r == 0] = 1.0
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