---
name: ferret-physics-atomic
description: Use for atoms in Ferret: electrons on orbits of fixed energy, photons that lift an electron or are given off with the colour of their wavelength, ionisation, fission of a nucleus, bonds with tabled length and angle (H2, water), one energy account.
---

# Atoms

## When to use
A model of an atom, an ion or a molecule that must behave: an electron that stays on its orbit, a photon that lifts it or passes, an excited atom that gives off light, a nucleus that splits, a molecule made by docking.

## The model
`atomic()` is a capability (`PhysicsHost`, phase `field`). Atoms are planetary (Bohr rule): fixed-energy orbits, the energy `-Ry Z^2 / n^2` for one electron, screened for several. Everything is true SI inside, drawn at `drawn` scene metres per true metre. Photons fly at a slowed speed and meet atoms; a transition happens when the photon's energy matches a line within `tolerance`. Falling is by the Einstein rate from the hydrogen wave functions. A nucleus takes a neutron by the tabled cross sections; fission releases the rest mass lost. Docked atoms make a bond of the tabled length and energy and stand at the tabled angle.

## Steps
1. `host.register(atomic({ seed, drawn }))` (or the `capabilities` option) and `host.enable('atomic')`.
2. `cap.addAtom(name, { nuclide: 'H-1', position })` (or `Z`, `electrons`); a bare nucleus has `electrons: 0`.
3. Drive it: `cap.excite(atom, i, n)`, `cap.firePhoton({ toward, nm })`, `cap.fireNeutron({ toward, mev, outcome? })`, `cap.dock(a, b)`, `cap.heat(molecule, joules)`; or the `atomic.*` commands from a program, or `atomicForms(bridge, cap, host)` for `(fire-photon atom nm)` and the rest.
4. Draw from `cap.electronPosition(atom, i)`, `cap.photons`, `cap.atoms` each frame; listen to `atomic:*` events.
5. Set `orbitClock`, `decayClock`, `photonSpeed`, `tolerance` per scene with `host.config('atomic').set('world', key, value)`.
6. Without a scene: `sampleOrbital` / `sommerfeldOrbit` for orbital shapes; `kleinNishina`, `fillVacancy`, `sampleBremsstrahlung` for X-rays; `new NucleiPopulation(...)` for the decay of many nuclei (counts, daughters, energy); `new ChainReaction(...)` for a ball of fissile material (`kTheory`, critical radius, neutron count by fate). See the "Orbitals, X-rays" section of the guide.

## Check afterwards
`atomic.energy`: `total - external` does not change through any event. The Balmer alpha line is 656.47 nm (`atomic.lines`). An electron's orbit radius and energy stay constant while nothing happens. Water stands at 104.45 degrees.

## What usually goes wrong
- A 656 nm photon does nothing to a ground-state hydrogen: it has no such line; excite it to n = 2 first.
- An excited electron falls before the photon arrives: lower `decayClock` while photons fly, raise it to watch the fall.
- `no mass is tabled for nuclide "X"`: only the tabled nuclides (`knownNuclides()`) have masses.
- `no bond data for A-B` or `no valence left`: the pair is not tabled, or the atom is full.
- The photon is gone at once: `range` is the distance it flies on past the atom it was aimed at.
- Many-electron atoms are screened-hydrogenic: their levels are not measured ionisation energies.

## Files

- `reference/atomic.md` — Atoms as planetary models held by physics alone — electrons on orbits of fixed energy, photons that lift and are given off, ionisation, nuclei that fission, bonds with their lengths and angles.
- `reference/api-physics-atomic.md` — every export of `@ferret/physics-atomic` with signature and doc comment
- `reference/commands.md` — 12 commands of these packages with their arguments
