atomic Devlog #2: exact hydrogen engine + systems registry
I had two goals in my mind in this session. One was to build the exact hydrogen-like physics engine and the other is to add a systems registry plus the element tables. Here is what and how I implemented this stuff and the challenges i faced:
Change/Problem 1:
Before I even got started on the new stuff i wanted to add, i faced a big problem. The moment i wired the new physics into last session’s spine, 4 tests instantly failed. My Field type (the container every array result travels in) demanded its grid be strictly increasing, but wavefunction sampling evaluates on scattered, unsorted points, so every single evaluation got rejected with a ValueError.
The fix:
It is important to know what a Field actually is here. It’s not a mesh — it’s just samples of a function on a set of points, plus the provenance saying how they were computed. Sorted-ness is a quadrature concern and belongs to the mesh module, not the container. So i dropped just the ordering rule and kept the finite/shape guards, then added a regression test pinning the decision so nobody re-adds it later and silently breaks everything again.
Change 2: hydrogen engine implementation
I implemented the exact closed-form hydrogen-like solutions, all in Hartree atomic units. The energy is E_n = −mu_ratio · Z² / (2n²), and the trick that makes it powerful is the reduced-mass ratio mu/m_e sitting right in the formula — deuterium, tritium, muonic hydrogen and positronium all fall out of the same code just by changing that one number. The radial functions use the normalized generalized-Laguerre form R_nl = N · exp(−ρ/2) · ρ^l · L(ρ) with ρ = 2Zμ′r/n, and mean radii come from = (3n² − l(l+1)) / (2Zμ′). I checked the 1s case by hand: = 1.5 bohr, exactly like the textbooks say.
Change 3: angular bases + systems + proof
I implemented both angular bases as first-class outputs: complex spherical harmonics (with the Condon-Shortley phase, so Y_1^1 has a negative real part at phi=0) and real chemistry orbitals (p_x, p_y, d_xy and friends with proper orientation). On top of that sits the systems registry — H, D, T, muonic hydrogen, positronium, He+, plus a generic hydrogen_like(Z) — each carrying CODATA-cited reduced masses and honest nuclear radii (positronium gets None instead of a fake zero, because its “nucleus” is a point positron).
The last batch of work was the proof: 139 tests green. Normalization, orthogonality, node counts coming out as exactly n−l−1 every time, angular orthonormality up to l=3 in both bases. Nothing’s shipped anywhere yet though — next is Phase 2, the numerical solver, validated against these exact answers. That’s the first real solver-vs-truth showdown.
Comments 0
No comments yet. Be the first!
Sign in to join the conversation.