def test_psi_nlm(): r = S('r') phi = S('phi') theta = S('theta') assert (Psi_nlm(1, 0, 0, r, phi, theta) == exp(-r) / sqrt(pi)) assert (Psi_nlm(2, 1, -1, r, phi, theta)) == S.Half * exp(-r / (2)) * r \ * (sin(theta) * exp(-I * phi) / (4 * sqrt(pi))) assert (Psi_nlm(3, 2, 1, r, phi, theta, 2) == -sqrt(2) * sin(theta) \ * exp(I * phi) * cos(theta) / (4 * sqrt(pi)) * S(2) / 81 \ * sqrt(2 * 2 ** 3) * exp(-2 * r / (3)) * (r * 2) ** 2)
def test_psi_nlm(): r = S("r") phi = S("phi") theta = S("theta") assert Psi_nlm(1, 0, 0, r, phi, theta) == exp(-r) / sqrt(pi) assert (Psi_nlm( 2, 1, -1, r, phi, theta)) == S.Half * exp(-r / (2)) * r * (sin(theta) * exp(-I * phi) / (4 * sqrt(pi))) assert (Psi_nlm(3, 2, 1, r, phi, theta, 2) == -sqrt(2) * sin(theta) * exp(I * phi) * cos(theta) / (4 * sqrt(pi)) * S(2) / 81 * sqrt(2 * 2**3) * exp(-2 * r / (3)) * (r * 2)**2)
theta = Symbol("theta", real=True) Z = Symbol("Z", positive=True, integer=True, nonzero=True) """ # Psi_nlm(n, l, m, r, phi, theta, Z) n, l, m quantum numbers ‘n’, ‘l’ and ‘m’ r radial coordinate phi azimuthal angle theta polar angle Z atomic number (1 for Hydrogen, 2 for Helium, …) """ n = argv.get("n", 3) l = argv.get("l", 1) m = argv.get("m", 0) density = argv.get("density", 1.0) f = Psi_nlm(n, l, m, r, phi, theta, 1) print("psi(r, phi, theta) =", f) vmin = -15. * n vmax = 15. * n N = 32 delta = (vmax - vmin) / N vals = list(numpy.arange(vmin, vmax, delta)) nx = ny = nz = len(vals) data = [] for x in vals: for y in vals: for z in vals: if abs(x) < 1e-6: