This document provides a complete derivation of the physics behind the hydrogen orbital visualization in Atoms_Rust.
- The Hydrogen Atom
- Quantum Numbers
- Wave Function Derivation
- Radial Component
- Angular Component
- Probability Density
- Sampling Algorithm
- Probability Current
- Energy Levels
- Orbital Shapes
The hydrogen atom consists of a single proton (nucleus) and one electron. It is the simplest atomic system and the only one with an exact analytical solution to the Schrödinger equation.
Where the Hamiltonian in spherical coordinates is:
The Laplacian in spherical coordinates:
The solution is characterized by three quantum numbers:
graph TB
subgraph "Quantum Numbers"
N[n<br/>Principal<br/>Energy Level]
L[l<br/>Angular Momentum<br/>Orbital Shape]
M[m<br/>Magnetic<br/>Orientation]
end
N --> |"l < n"| L
L --> |"|m| ≤ l"| M
style N fill:#e1f5fe
style L fill:#fff3e0
style M fill:#e8f5e9
| Symbol | Name | Range | Physical Meaning |
|---|---|---|---|
| Principal | Energy level, shell | ||
| Angular momentum | Orbital shape | ||
| Magnetic | Orbital orientation |
The number of states for a given
The wave function separates into radial and angular parts:
Where:
-
$R_{nl}(r)$ is the radial wave function -
$Y_l^m(\theta,\phi)$ is the spherical harmonic
Where
The associated Laguerre polynomial
In our code (physics/polynomials.rs), we compute this iteratively:
pub fn laguerre(n: i32, l: i32, rho: f64) -> f64 {
let k = n - l - 1; // Polynomial degree
let alpha = 2 * l + 1; // Superscript
// Base cases
if k == 0 { return 1.0; }
if k == 1 { return 1.0 + alpha as f64 - rho; }
// Recurrence relation
let mut l_m1 = 1.0 + alpha as f64 - rho;
let mut l_m2 = 1.0;
// ... iterate
}Where
Since
The probability of finding the electron between
The
The probability of finding the electron between
The azimuthal angle
We sample particle positions from the probability distribution using Cumulative Distribution Function (CDF) inversion.
flowchart TD
START[Start: n, l, m] --> BUILD_R[Build radial CDF<br/>N = 4096 points]
BUILD_R --> BUILD_THETA[Build angular CDF<br/>N = 2048 points]
BUILD_THETA --> SAMPLE[Enter sampling loop]
SAMPLE --> R[1. Sample r from CDF<br/>r = CDF⁻¹U<0,1]
R --> THETA[2. Sample θ from CDF<br/>θ = CDF⁻¹U<0,1]
THETA --> PHI[3. Sample φ uniformly<br/>φ = 2π × U<0,1]
PHI --> CART[4. Convert to Cartesian<br/>x = r sin θ cos φ<br/>y = r cos θ<br/>z = r sin θ sin φ]
CART --> COLOR[5. Calculate intensity<br/>I = |R|² × |P|²]
COLOR --> MAP[6. Map to inferno color]
MAP --> RENDER[7. Render particle]
RENDER --> MORE{More particles?}
MORE -->|Yes| R
MORE -->|No| DONE[Complete]
fn build_r_cdf(n: i32, l: i32) {
let r_max = 10.0 * n * n * a0; // Covers 99.9% of probability
for i in 0..4096 {
let r = i * dr;
let rho = 2.0 * r / (n * a0);
// Evaluate radial wave function
let L = laguerre(n, l, rho);
let R = sqrt(norm) * exp(-rho/2) * rho^l * L;
// PDF = r² × |R|²
let pdf = r * r * R * R;
cdf[i] = cdf[i-1] + pdf;
}
// Normalize to [0, 1]
for v in &mut cdf { *v /= cdf_last; }
}Given a uniform random number
In practice, we use binary search to find the index where
For states with
- Particles circulate around the z-axis
- Direction depends on sign of
$m$ - Magnitude increases with
$|m|$ - Visualized as rotating motion in our simulation
Where
graph TB
subgraph "Energy Levels eV"
N4["n=4<br/>E = -0.85 eV"]
N3["n=3<br/>E = -1.51 eV"]
N2["n=2<br/>E = -3.4 eV"]
N1["n=1<br/>E = -13.6 eV<br/>Ground State"]
ION["E = 0<br/>Ionization"]
end
N4 -.->|λ = 1875 nm| N3
N4 -.->|λ = 1282 nm| N2
N4 -.->|λ = 97.3 nm| N1
N3 -.->|λ = 656 nm<br/>Balmer-α| N2
N3 -.->|λ = 103 nm| N1
N2 -.->|λ = 122 nm<br/>Lyman-α| N1
N1 --> ION
| n | Energy (eV) | Name |
|---|---|---|
| 1 | -13.6 | Ground state |
| 2 | -3.4 | First excited |
| 3 | -1.51 | Second excited |
| 4 | -0.85 | Third excited |
| ∞ | 0 | Ionization limit |
For a transition from
Number of radial nodes:
Number of angular nodes:
Total nodes:
graph LR
subgraph "s orbitals l=0"
S1[1s: No nodes]
S2[2s: 1 radial node]
S3[3s: 2 radial nodes]
end
subgraph "p orbitals l=1"
P1[2p: 1 angular node]
P2[3p: 1 radial + 1 angular]
end
subgraph "d orbitals l=2"
D1[3d: 2 angular nodes]
D2[4d: 1 radial + 2 angular]
end
- Shape: Spherically symmetric
- Angular nodes: 0
- Radial nodes: n-1
- Examples: 1s (no nodes), 2s (1 radial node), 3s (2 radial nodes)
- Shape: Dumbbell, oriented along one axis
- Angular nodes: 1 (a plane)
- Radial nodes: n-2
- Examples: 2p₀ (along z), 2p₊₁/2p₋₁ (toroidal + dumbbell)
- Shape: Cloverleaf or double dumbbell
- Angular nodes: 2
- Radial nodes: n-3
- Examples: 3dxy, 3dxz, 3dyz, 3dx²-y², 3dz²
- Shape: Complex multi-lobed patterns
- Angular nodes: 3
- Radial nodes: n-4
- Example: 4f orbitals
The hydrogen orbital visualization in Atoms_Rust is based on:
- Exact quantum mechanics: The Schrödinger equation solution for hydrogen
- Correct mathematics: Laguerre and Legendre polynomials computed via recurrence
- Proper probability sampling: CDF inversion from the correct probability densities
- Physical accuracy: Probability current flow for m ≠ 0 states
The result is a scientifically accurate visualization that correctly represents:
- Orbital shapes and symmetries
- Radial and angular node structure
- Probability density distributions
- Quantum mechanical flow patterns