Real-time numerical visualiser of hydrogenic bound-state probability densities. It computes
- p5.js 2.2.3
- Web Worker (density-grid computation kernel)
- Tweakpane 4.x (parameter interface)
- Lanczos log-gamma approximation
-
Normalised radial functions via associated Laguerre recurrence and log-gamma normalisation.
-
Complex spherical harmonics via associated Legendre recurrence.
-
Stationary-state wavefunction evaluated on
$x-z$ ,$x-y$ , or$y-z$ slice planes. -
Probability density with tone-mapped LUT rendering and exposure gamma correction.
-
Bisection-refined node detection for radial, polar, and azimuthal nodal surfaces.
-
Reduced-mass Bohr radius and electron–nucleus reduced mass for arbitrary nuclear charge
$Z$ .
- Psi.js — p5.js lifecycle and configuration
- core/AppCore.js — State management, worker dispatch, and parameter validation
- worker/PsiWorker.js — Density-grid computation kernel (wavefunctions, special functions)
- render/Renderer.js — LUT rendering, overlays, legend, and node visualisation
- analysis/Analyser.js — Density statistics, radial probability moments, and node detection
- ui/GUI.js — Tweakpane interface (4 tabs: Sim, Render, Statistics, Media)
- ui/InputHandler.js — Keyboard, mouse, and touch input
- media/Media.js — Parameter/statistics import and export, image/media capture
Psi/
├─ index.html
├─ Psi.js
├─ core/
│ └─ AppCore.js
├─ render/
│ └─ Renderer.js
├─ ui/
│ ├─ GUI.js
│ └─ InputHandler.js
├─ analysis/
│ └─ Analyser.js
├─ media/
│ └─ Media.js
└─ worker/
└─ PsiWorker.js
- Quantum Mechanics and the Hydrogen Atom
- The Hydrogenic Wavefunction
- Radial Component
- Angular Component
- Probability Density and Slice Planes
- Reduced-Mass Correction
- Model Assumptions
- Model Parameters
The hydrogen atom — one proton and one electron bound by the Coulomb potential — is the simplest atomic system whose Schrödinger equation admits an exact analytical solution. The stationary states are labelled by three quantum numbers:
- Principal quantum number
$n$ $(1 \leq n)$ : determines the energy level and the characteristic size of the orbital. - Azimuthal quantum number
$\ell$ $(0 \leq \ell \leq n{-}1)$ : determines the orbital shape and angular momentum magnitude. - Magnetic quantum number
$m$ $(-\ell \leq m \leq \ell)$ : determines the orbital orientation and the angular momentum component along the quantisation axis.
The spin quantum number
The solutions generalise to hydrogenic ions with nuclear charge
The time-independent Schrödinger equation in spherical coordinates
The probability density, which is the probability per unit volume of finding the electron at a given point, is the square modulus:
The normalised radial function is:
where
To avoid numerical overflow at high
The log-gamma function uses a Lanczos approximation with 8 coefficients, extended to
for
The radial wavefunction has
The angular part is the complex spherical harmonic with the Condon–Shortley phase:
for
The angular wavefunction has
Note
The complex spherical harmonics
The 3D density field is sampled onto a 2D slice through the atom. Three orthogonal planes are supported:
| Plane | Coordinates | Fixed axis |
|---|---|---|
For each pixel, the Cartesian coordinates are converted to spherical:
The wavefunction is then evaluated and the density
To account for the finite nuclear mass
where
For hydrogenic ions with
- Non-relativistic, point-nucleus, Schrödinger Hamiltonian with Coulomb potential.
- No spin–orbit, fine-structure, hyperfine, or external-field corrections.
-
$R_{n\ell}$ is real-valued;$Y_\ell^m$ and$\psi$ are complex. -
$R$ and$\psi$ carry units of$\text{m}^{-3/2}$ ;$Y_\ell^m$ and$Z$ are dimensionless. - Cartesian coordinates and
$r$ are in metres; masses in kilograms. - Densities
$|\psi|^2$ are in$\text{m}^{-3}$ .
| Parameter | Symbol | Default | Range | Description |
|---|---|---|---|---|
| Principal | 4 | 1–12 | Energy level | |
| Azimuthal | 1 | 0–( |
Angular momentum / orbital shape | |
| Magnetic | 0 | Orbital orientation | ||
| Nuclear charge | 1 | 1–20 | Proton count |
| Parameter | Default | Description |
|---|---|---|
| Reduced mass | on | Use electron–nucleus reduced mass |
| Nucleus mass |
|
Adjustable on log₁₀ scale ( |
| Parameter | Default | Range | Description |
|---|---|---|---|
| Resolution | 256 | 64–512 | Grid resolution (pixels) |
| Exposure | 0.75 | 0–2 | Gamma exponent for tone mapping |
| Colour map | rocket | All loaded LUTs | Colour lookup table |
| Smoothing | on | Toggle | p5.js antialiasing |
| View radius | 45 |
1–256 |
Spatial extent of the view |
| Slice plane |
|
Viewing plane through the atom | |
| Slice offset | 0 | ±1024 | Fixed-axis offset |
| Overlay | Key | Description |
|---|---|---|
| Statistics | O |
Quantum numbers, density values, FPS, view parameters |
| Node visualisation | N |
Radial nodes (blue circles), angular nodes (red curves/lines) |
| Legend | L |
Colour bar with probability density axis labels in |
All wavefunction computation runs in a dedicated Web Worker. The main thread posts a render request containing quantum numbers, view parameters, and an ArrayBuffer; the worker evaluates the density at each grid point and returns the buffer with ownership:
---
title: Main-Worker Render Process
---
flowchart LR
Main["Main"]
Worker["Worker"]
Call["render(n,l,m,Z,…,buf)"]
Loop["for each pixel"]
Coord["(x,y,z) → (r,θ,φ)"]
Compute["R_nl(r) · Y_lm(θ,φ) → |ψ|²"]
Peak["track peak density"]
Return["result(buf, peak, a_μ)"]
Main --> Call
Call --> Worker
Worker --> Loop
Loop --> Coord
Coord --> Compute
Compute --> Peak
Peak --> Return
Return --> Main
The worker caches normalisation constants by a hash of
The Analyser detects three types of nodal surfaces:
| Type | Count | Method |
|---|---|---|
| Radial | Bisection on |
|
| Polar | Bisection on |
|
| Azimuthal | Analytic: |
The total node count is
Detected nodes are rendered on the slice plane as:
- Radial nodes: blue circles (projected for off-plane slices).
- Polar nodes: red curves (hyperbolas or circles depending on slice plane).
- Azimuthal nodes: red diametral lines through the origin.
| Metric | Unit | Description |
|---|---|---|
| Density | Current peak |
|
| Mean | Average density across the grid | |
| Std dev | Standard deviation of density | |
| Entropy | — | Shannon entropy of the normalised density distribution |
| Concentration | — | Rényi entropy of order 2 ( |
| Radial peak | Mode of the radial probability distribution |
|
| Radial spread | Standard deviation in radial space | |
| Node estimate | — | Total detected nodal surfaces |
The GUI additionally displays spectroscopic notation derived from the quantum numbers:
Format: $n\ell_m$, e.g.
| Key | Action |
|---|---|
W / S
|
|
D / A
|
|
E / Q
|
|
R / T
|
|
P |
Toggle reduced mass |
G / B
|
log₁₀( |
Note
Quantum numbers are always automatically clamped to their valid ranges after each adjustment:
| Key | Action |
|---|---|
← / →
|
Slice offset ±0.5 |
↑ / ↓
|
Zoom (view radius ×0.98 / ×1.02) |
Shift+←/→/↑/↓ |
Pan in-plane |
1 / 2 / 3
|
Switch slice plane ( |
Z |
Reset view radius |
X |
Reset view centre |
Space |
Reset slice offset |
| Key | Action |
|---|---|
C |
Cycle colour map |
[ / ] |
Exposure ±0.01 |
+ / - |
Resolution ±2 |
M |
Toggle smoothing |
O / N / L |
Toggle overlays (statistics / nodes / legend) |
| Key | Action |
|---|---|
F |
Export image |
V |
Start / stop recording |
Shift+I |
Import parameters (JSON) |
Shift+P |
Export parameters (JSON) |
Shift+S |
Export statistics (JSON) |
Shift+C |
Export statistics (CSV) |
H |
Toggle GUI panel |
# |
Toggle keymap reference overlay |
- Griffiths, D.J. (2018) Introduction to Quantum Mechanics. 3rd edn. Cambridge: Cambridge University Press.
- Atkins, P.W. and Friedman, R.S. (2011) Molecular Quantum Mechanics. 5th edn. Oxford: Oxford University Press.
- Bransden, B.H. and Joachain, C.J. (2003) Quantum Mechanics. 2nd edn. Harlow: Pearson Education.
- Zettili, N. (2009) Quantum Mechanics: Concepts and Applications. 2nd edn. Chichester: John Wiley & Sons.
- Bethe, H.A. and Salpeter, E.E. (1957) Quantum Mechanics of One- and Two-Electron Atoms. Berlin: Springer.
cd library/Psi
python3 -m http.server 8080Open http://localhost:8080.