A hydrogen atom is a relatively simple system, having a single proton and a single electron bound to the proton. Even in quantum mechanics, this two-body problem has an analytic solution without requiring the construction of atomic orbital basis sets. Indeed, the hydrogen atomic orbitals may be used as a basis, though it is not often done in practice for computational reasons.
The wavefunction of the bound electron in a hydrogen atom may be obtained by separation of variables in a spherical polar coordinate system, like so:
More specifically, for the energy and angular momentum quantum numbers $n$, $l$ and $m$, the wavefunction has the form:
where the normalization factor equals:
The next term equals the generalized Laguerre polynomial:
And the final term equals the spherical harmonic equation:
Finally, the term in the spherical harmonic equation represents the associated Legendre polynomial:
While these equations seem messy, they are directly computable, given a few simple data structures for handling polynomial expressions.
The screensaver randomly generates a set of valid quantum numbers, and then calculates slices of the wavefunction probability density and phase. I also actually implemented an octree-based representation of the wavefunction that could be used in a marching cubes algorithm for displaying contours, but the slices were so pretty, I didn’t finish it. :)
Of course, this page would be pretty useless without source code and final product, right?