The physics behind every element's electron cloud: what the atomSFE radial tables actually contain, how ground-state electron configuration and Hund's rule drive the cloud's shape, and how effective nuclear charge fills the gap for elements beyond Z = 92.
This document covers the physics models the atom pipeline rests on — what u(r) means, why full shells are isotropic, why Hund's rule applies to partial shells, and how Slater's effective-nuclear-charge substitution works for Z > 92. The step-by-step computation (which code runs, in what order) is in Tables to Point Clouds; how the blobs are built and flashed is in Tables to BIN; the technical status and validation numbers live in ATOMS.md.
pc/hfs_atomsfe.py · data/hfs_tables.bin — one row per occupied (n, ℓ) subshell, Z = 1..92
Given — the N-electron problem
The exact many-body Hamiltonian couples all N electrons together via the 1/rij repulsion. It is not separable — no analytic solution exists for Z > 1. All units are Hartree atomic units (ℏ = me = e = 1).
1 · Kohn–Sham mean-field reduction
Kohn–Sham DFT replaces the interacting N-electron problem with N independent single-particle equations in a self-consistent effective potential Veff. The equations must be solved iteratively (SCF loop) because Veff depends on the density ρ, which depends on the orbitals φi. SPARC-atomSFE converges this loop using spectral finite elements with LDA_SVWN exchange-correlation.
pc/_atomsfe_vendor / pc/hfs_atomsfe.py2 · The effective potential — three contributions
Vnuc is exact and analytic. VH is computed self-consistently on the radial grid (Poisson equation). Vxc is the only approximation: LDA_SVWN treats the exchange-correlation energy density as that of a uniform electron gas at the local density ρ(r) — accurate for core shells, slightly over-delocalizing for valence orbitals (the standard LDA self-interaction error, which is why the LDA valence radii are larger than Hartree-Fock Clementi-Raimondi values).
LDA_SVWN — local density approximation3 · Spherical symmetry — radial reduction and u(r)
The angular factor Yℓm separates exactly for a spherical Veff(r). The substitution u = r·R eliminates the first-derivative term from the radial equation, turning it into a standard 1D Schrödinger form — the same shape as a particle in a potential, easy to solve numerically with finite elements or Numerov integration. The ℓ(ℓ+1)/(2r²) term is the centrifugal barrier: it pushes electrons with higher angular momentum away from the nucleus (p and d orbitals have no probability at r = 0).
1D Schrödinger form — basis of SPARC-atomSFE4 · Why u(r)² is the probability we integrate
u(r)² already folds in the r² Jacobian of spherical coordinates — the same reason the hydrogen tables use [r·R(r)]² as their radial weight. The table row for a given (Z, n, ℓ) is therefore directly proportional to the probability of finding that subshell's electron at radius r; integrating it gives the inverse-CDF used for sampling. No extra r² factor is needed at draw time.
radial probability density — same as [r·R(r)]² in the hydrogen pipeline5 · The log-uniform radial grid
A log-uniform grid has a constant ratio between consecutive steps — Δr/r is constant — instead of a constant absolute step Δr. This is essential: the wavefunction oscillates on a scale of ~10⁻³ Bohr near a heavy nucleus (where u(r) rises sharply from zero), and decays exponentially over tens of Bohr in the valence region. A linear grid would either miss the core or waste 99% of its points on the tail. At 128 device points, the log-spacing keeps the mode radius accurate to better than 0.1% (measured against the 2001-point reference).
log-uniform spacing — r_min = 1e-6, r_max = 100 BohrDeliverable — hfs_tables.bin rows
The table is indexed by Z (element offset + count) and then by subshell (n, ℓ). To get R(r), divide each row element by the corresponding r: R(r) = u(r)/r. The angular part Yℓm is not in the table — it is shared across all Z and n, and is handled by the compile-time angular library (see Coefficients to Tables and the atom pipeline's step 2).
data/hfs_tables.bin · micropython/hfs_tables.binmicropython/atom_cloud.py · src/physics/atom_cloud.cpp · slater.py — runs once per Z, not per frame
Given — tables for this Z
atom_size_calib_gen.py1 · Ground-state electron configuration
Madelung's rule gives the right filling order for most elements — it is a consequence of orbital energies being set more by n+ℓ than by n alone, due to electron-electron repulsion pushing inner shells inward. Known exceptions (Cr: [Ar]3d⁵4s¹, Cu: [Ar]3d¹⁰4s¹, and ~20 others for lanthanides and actinides) are substituted from a hard-coded table. Each subshell holds at most 2(2ℓ+1) electrons.
electronConfiguration() / _CONFIG_EXCEPTIONS2 · Unsöld's theorem → full shells are isotropic
Unsöld's theorem (1927) is an exact result of spherical harmonics: when all 2ℓ+1 magnetic quantum numbers are equally occupied (as in a full subshell), the total angular density is a constant. The neon 2p⁶ shell is exactly spherical; the nitrogen 2p³ half-shell (one electron per m ∈ {−1, 0, +1}) is also spherical by the same argument — the three real spherical harmonics px, py, pz together cover all three spatial directions equally. Carbon's 2p² is not spherical and must use Hund's rule instead.
sampleIsotropicPoint() / Unsöld 19273 · Hund's rule for partial subshells
Hund's first rule (maximum multiplicity) says electrons in a partially filled subshell prefer parallel spins, which forces them onto different orbitals. In practice this means each occupied m gets its own angular density profile — px, py, pz for p², p³; dz², dxz, dyz… for d³, etc. Each such orbital is sampled by the standard orbital sampler with the (ℓ, m)'s angular tables, not a uniform sphere. Without this, carbon's 2p² would incorrectly render as a sphere.
hundFillM() / drawingGroups()4 · Split the total point budget
N (kAtomNumPoints) is the total point budget for this element. Each drawing group's weight is its electron count — a doubly-occupied full 2p subshell (weight 6) gets three times as many points as a singly-occupied 2s (weight 2). The largest-remainder method prevents the sum from drifting off by one or two points due to floor truncation.
splitCounts()5 · Pick each group's radial source
Table path — Z ≤ 92
Fallback — Z > 92
The table path uses the all-electron Kohn-Sham wavefunction; the fallback uses the hydrogen analytic formula with a rescaled nuclear charge. Both produce an R(r) — the rest of the pipeline is identical from this point.
hfsFindU() / hfsRLookup() / slaterZEff()6 · Build the radial inverse-CDF
Isotropic group (full subshell)
Oriented group (Hund's rule)
Both branches integrate the same physical density u(r)². The oriented branch resamples on a linear grid first because the hydrogen angular sampler (which it shares) expects a linear-grid radial CDF — an asymmetry kept deliberately from the Python model. The isotropic branch stays on the log-grid and integrates directly for higher accuracy near r = 0.
buildHfsRadialSamplerIsotropic() / buildHfsRadialSamplerOriented()7 · Sample this group's N_g points
Isotropic group
Oriented group (m fixed)
The choice between isotropic and oriented was made back in step 3; both arrive here with a radial CDF and convert the same way to Cartesian. Every draw is three uniform randoms + three O(1) table lookups — no rejection loop, no per-point search, deterministic cost.
sampleIsotropicPoint() / sampleOrientedPoint() / XorShift328 · Identify the valence subshell
The P90 radius of each subshell's sampled points is a robust proxy for its spatial extent. The outermost subshell by this metric is used as the valence: it drives screen scaling (step 9) and gets the brighter color (step below). Note that for transition metals, 3d lies interior to 4s (Fe: 3d mode ≈ 43 pm, 4s mode ≈ 240 pm) — the P90 correctly identifies 4s as valence even though 3d has higher ℓ.
outerSubshellRRef()9 · Color by shell, emphasize valence
Points are emitted in contiguous per-subshell runs (AtomSubshellRange), so the lerp is applied once per subshell, not per point. Without the dim/brighten split, the valence subshell — often a small fraction of the total point budget — would be nearly invisible against the much larger core shells.
kAtomShellRgb[] / colorizeAtomSubshells()10 · Scale calibration and screen fit
The κZ factor corrects the LDA over-delocalization: it is the ratio of the Clementi-Raimondi literature valence radius to the LDA table's valence mode radius, computed once offline by atom_size_calib_gen.py. The subsequent divide by rrefouter then normalises all elements to the same on-screen target radius — like the orbital pipeline's P90 auto-zoom — so lithium and uranium are both legible on the 240 px display, at the cost of hiding the real size trend between elements.
kAtomSizeCalibFactor[] / scaleForAtom()micropython/slater.py · micropython/slater_cr_zeff.py — also used for --model hydrogenic
Given — the hydrogen radial wavefunction
The exact analytic solution for Z = 1, N = 1. For Z > 1 it can still be reused by substituting an effective nuclear charge Zeff < Z in place of 1 — which compresses the wavefunction by a factor of Zeff, moving rmax to ≈ n²/Zeff a₀. The rest of the pipeline (CDF build, point sampling) is unchanged.
orbitals.py / orbitals.h — the validated hydrogen engine1 · Clementi–Raimondi table (Z ≤ 54, primary source)
Clementi-Raimondi Zeff values are obtained by fitting the hydrogen-like wavefunction to the actual Hartree-Fock SCF orbital — they are therefore the best possible nuclear charge to use with the analytic hydrogen formula. Their advantage over Slater's rules is significant for the p-block (error drops from ~5% to <3% for period 2 p states). They cover all occupied subshells of elements 1 to 54. Beyond that, no published 3-parameter fit exists in this project's scope, so Slater's rules take over.
slater_cr_zeff.py / z_eff_cr()2 · Slater's shielding rules (Z > 54)
Slater's rules (1930) capture the dominant physics of shielding: inner-core electrons (two or more groups below) screen the nuclear charge nearly completely, while electrons in the same subshell only partially screen each other (0.35, not 1.00), because they occupy the same spatial region rather than surrounding the nucleus. The d/f rule (1.00 for one group below) is a Slater-specific choice that slightly overestimates shielding for d electrons compared to the Clementi-Raimondi fit, but is simple and close enough for the fallback regime.
slater.z_eff() / shielding constants 0.30 / 0.35 / 0.85 / 1.003 · The n* correction for outer shells (n ≥ 4)
The hydrogen radial wavefunction's mode radius scales as n² / Z. But Slater's Zeff was derived assuming the hydrogenic n is the real principal quantum number. For valence electrons in period 4 and beyond, the wavefunction must be orthogonal to the filled inner shells — this pushes the outer lobe inward. Slater introduced an "effective quantum number" n* < n to account for this: replacing n with n* in the mode-radius formula gives a smaller (more physical) radius. The code applies this as a Zeff rescaling (equivalent to n → n*) to keep the radial engine unchanged.
slater.n_star() / z_eff_radial()4 · The variable substitution r → Z_eff · r
The substitution contracts all distances by a factor of Zeff — the orbital shape (number of radial nodes, angular lobes) is unchanged, only the scale shrinks. In code this means passing z_eff as a multiplicative factor into init_orbital_sampler() or buildRadialSamplerRuntime(), which applies it when evaluating R(r) — the function orbitals.py itself is never modified and remains the single validated source of the hydrogenic math. One Zeff per subshell (not per individual electron) is the standard Slater mean-field approximation.
init_orbital_sampler(z_eff=…) / buildRadialSamplerRuntime(zEff)Deliverable — R(r; Z_eff) for the fallback pipeline
The fallback degrades gracefully: on a board where uploadfs was never run (no hfs_tables.bin on SPIFFS), hfsFindU() returns nullptr and the entire cloud is drawn with hydrogenic Zeff radii — visually reasonable, physically less accurate, never a crash. For Z > 92 the fallback is also the only path available regardless of model choice.
hfsFindU() returning nullptr → hydrogenic fallbackatomSFE (Z ≤ 92) — default
Raw LDA valence peak radii land within ~0.8–1.2× of Hartree–Fock. Corrected by κZ against the Clementi–Raimondi literature radius at render time — the internal wavefunction shape is NIST-accurate, only the displayed scale is recalibrated.
Hydrogenic Z_eff (Z > 92 or --model hydrogenic)
The hydrogenic functional form cannot capture the inner-node structure that compresses valence orbitals in heavy atoms. Clementi–Raimondi (Z ≤ 54) is significantly better than Slater; the n* correction recovers part of the gap for n ≥ 4, but residual error grows with Z. See ATOMS.md §4.2 for the per-element table.
Neither model includes relativistic effects (Dirac equation). Relevant for Z ≳ 55 — the contracted 6s orbital of gold responsible for its color and Au–Au bond strength cannot be reproduced without a relativistic treatment. Noted as a known limit; not planned for this project's scope.