# @ferret/physics-atomic: API

atoms with orbits of fixed energy, photons that lift and are given off, ionisation, fission, bonds, one energy account.

104 exports. Generated from the source (`packages/physics-atomic/src`), so it matches the code.

## Classes

### ChainReaction

*class* · `packages/physics-atomic/src/chain.ts:40`

```ts
class ChainReaction
```

- `readonly visible: number`
- `readonly pos: Float32Array` — positions of the visible nuclei in a ball of radius 1 (x, y, z)
- `readonly comp: Uint8Array` — the component of each nucleus
- `readonly spent: Uint8Array` — a spent nucleus: fissioned or captured
- `time: number` — seconds since the start
- `fissions: number`
- `captures: number`
- `leaks: number`
- `neutronsMade: number`
- `energy: number` — joules released by the fissions
- `constructor(private o: ChainOptions)`
- `get optical(): number` — the optical radius of the ball now (Sigma R), with the spent nuclei taken out
- `get nucleiLeft(): number`
- `get neutronsFlying(): number`
- `static kTheory(components: FuelComponent[], numberDensity: number, radius: number): number` — The multiplication factor of the ball by the model (the chance that a neutron born in it meets a nucleus before the surface, times nu sigma_f / sigma_abs), for the optical radius `tau` = Sigma R and the shares given. The chance of leaving is the mean of exp(-tau s / R) over birth points of the ball and directions.
- `get k(): number` — `kTheory` for this ball with all nuclei present
- `inject(n: number): void` — `n` neutrons start from the middle in random directions
- `advance(dt: number): ChainEvent[]` — run `dt` seconds on; the events in the order they happen (a neutron's flight is not an event: its end is)

### NucleiPopulation

*class* · `packages/physics-atomic/src/decay.ts:22`

```ts
class NucleiPopulation
```

- `time: number` — seconds since the start
- `energy: number` — joules released by all the decays so far
- `decays: number`
- `constructor(kinds: DecayKind[], capacity: number, seed = 1)`
- `get size(): number`
- `kindOf(i: number): string` — the kind of nucleus `i`
- `count(id: string): number`
- `counts(): Record<string, number>`
- `add(id: string, count: number): number` — put `count` new nuclei of the kind in; returns the index of the first
- `advance(dt: number): DecayEvent[]` — run `dt` seconds on; the decays in the order they happen (each nucleus that decays becomes its daughter, which may decay inside the same step)

## Functions

### atomic

*function* · `packages/physics-atomic/src/atomic.ts:104`

```ts
function atomic(o: { seed?: number; drawn?: number } = {}): AtomicCapability
```

### atomicDocks

*function* · `packages/physics-atomic/src/forms.ts:41`

```ts
function atomicDocks(cap: AtomicCapability)
```

The atoms as a backend of the docks of `.fmdl` models: two atoms of this capability that are docked are
bonded by it (the bond's length, angle and energy from the tables, the atoms placed in the molecule's shape) and the places it gives are the actors' new ones.
Structural: nothing here imports the levels package.

### atomicForms

*function* · `packages/physics-atomic/src/forms.ts:17`

```ts
function atomicForms(bridge: MotionBridge, cap: AtomicCapability, host: PhysicsHost): void
```

The forms of the motion language that the atoms add (they are functions of the bridge, so a program uses them like `wait`):
  (fire-photon atom nm)       a photon of wavelength nm flies at the atom; the program waits until it has been taken ("absorbed") or has flown past ("passed")
  (fire-neutron atom mev)     a neutron of that kinetic energy (MeV) flies at the nucleus; waits for "fission" or "capture"
  (excite atom n)             put the atom's first electron on level n now
  (dock a b)                  is a word of `@ferret/levels` (`installDockForms`): two atoms docked are bonded by `atomicDocks`
  (wait-emission atom)        lasts until that atom has given off a photon; the value is its wavelength in nm
  (line n m)                  the wavelength in nm of hydrogen's line between levels n and m
Events to wait on with `(wait-event "atomic:transition")` and the others listed with the capability.

### atomOfModel

*function* · `packages/physics-atomic/src/models.ts:21`

```ts
function atomOfModel(resolved: { model: { physics?: { modules?: Record<string, Record<string, unknown> | null> } } } | undefined): AtomModuleData | undefined
```

the atom a model stands for, or undefined when it is not an atom

### bindAtomModels

*function* · `packages/physics-atomic/src/models.ts:32`

```ts
function bindAtomModels(events: AtomEventsLike, stage: AtomStageLike, cap: AtomicCapability): void
```

make and take away the atoms of the models that appear and vanish; returns the unsubscribe-less binding (the events live as long as the bus)

### bindingEnergyMeV

*function* · `packages/physics-atomic/src/nuclides.ts:39`

```ts
function bindingEnergyMeV: (n: Nuclide) => number
```

The binding energy of a nucleus (MeV): the mass the nucleons lose in joining.

### bondAngle

*function* · `packages/physics-atomic/src/bonds.ts:34`

```ts
function bondAngle(center: string, count: number): number | null
```

The angle between two bonds (radians) of a central atom that has `count` ligands: water 104.45 degrees, ammonia 107.8, methane the tetrahedral 109.47.

### bondData

*function* · `packages/physics-atomic/src/bonds.ts:26`

```ts
function bondData(a: string, b: string): BondData & { order: number }
```

The bond between elements `a` and `b`; throws for a pair that has no data.

### bondEnergyEV

*function* · `packages/physics-atomic/src/bonds.ts:31`

```ts
function bondEnergyEV: (a: string, b: string) => number
```

### comptonElectronEnergy

*function* · `packages/physics-atomic/src/xray.ts:38`

```ts
function comptonElectronEnergy: (E: number, theta: number) => number
```

the electron kicked out by a Compton scattering carries what the photon lost, eV

### comptonEnergy

*function* · `packages/physics-atomic/src/xray.ts:12`

```ts
function comptonEnergy: (E: number, theta: number) => number
```

the energy of a photon of `E` eV after it scatters by `theta` on a free electron at rest (Compton)

### comptonShiftNm

*function* · `packages/physics-atomic/src/xray.ts:14`

```ts
function comptonShiftNm: (theta: number) => number
```

the change of wavelength, nm: (h / m c) (1 - cos theta), the Compton wavelength 2.42631e-3 nm

### coulombEnergy

*function* · `packages/physics-atomic/src/coulomb.ts:13`

```ts
function coulombEnergy: (q1: number, q2: number, r: number) => number
```

The potential energy of two charges at distance r (J).

### coulombForce

*function* · `packages/physics-atomic/src/coulomb.ts:11`

```ts
function coulombForce: (q1: number, q2: number, r: number) => number
```

The force on charge 2 from charge 1 at distance r along the line (N): positive repels (like charges).

### coulombForces

*function* · `packages/physics-atomic/src/coulomb.ts:20`

```ts
function coulombForces(ps: readonly Charged[], cutoff: number, soft = 0): { f: Float64Array; energy: number; pairs: number }
```

The force on each particle (N) from all the others within `cutoff` (m), and the potential energy of those pairs (J). `soft` (m) keeps two particles
that meet from a force that blows up: r^2 -> r^2 + soft^2 in the force and the energy. The grid has cells of `cutoff`; the result does not depend on it
but the cost does: a particle looks at 27 cells, not at all the others. Out: `f` is 3 numbers per particle.

### decayRates

*function* · `packages/physics-atomic/src/hydrogenic.ts:127`

```ts
function decayRates(n: number, Z = 1, M = Infinity): { total: number; to: number[] }
```

The total rate of leaving level n by spontaneous emission (1/s), and the rate of each channel (to the lower levels).

### duaneHuntNm

*function* · `packages/physics-atomic/src/xray.ts:58`

```ts
function duaneHuntNm: (kV: number) => number
```

the shortest wavelength (nm) of a tube at `kV`: Duane-Hunt, hc / eV

### effectiveCharge

*function* · `packages/physics-atomic/src/hydrogenic.ts:66`

```ts
function effectiveCharge(n: number, Z: number, shells: readonly number[]): number
```

The charge an electron of shell n feels (Slater): Z less 0.30 (0.35 above the first shell) for each other electron of its shell, 0.85 for each of the shell below, 1 for deeper ones.

### einsteinA

*function* · `packages/physics-atomic/src/hydrogenic.ts:113`

```ts
function einsteinA(n: number, m: number, Z = 1, M = Infinity): number
```

The rate (1/s) at which an electron of level n, its sublevels equally occupied, falls to the lower level m: from the radial integrals of the hydrogen
wave functions, A = (4 alpha omega^3 / 3 c^2) (l_> / (2l+1)) R^2 summed over the angular momenta (the 2p -> 1s rate, Lyman alpha, is 6.265e8 per second).
For a nucleus of charge Z the lengths shrink by Z and omega grows by Z^2: the rate goes as Z^4. `M` is the nucleus's mass, kg.

### energyOfNm

*function* · `packages/physics-atomic/src/hydrogenic.ts:32`

```ts
function energyOfNm: (nm: number) => number
```

The energy of a photon of vacuum wavelength `nm` nanometres (J).

### fillVacancy

*function* · `packages/physics-atomic/src/xray.ts:49`

```ts
function fillVacancy(Z: number, bVacancy: number, bFrom: number, bEjected: number, rand: () => number, yieldK = fluorescenceYieldK(Z)): VacancyDecay
```

what a vacancy in a shell bound by `bVacancy` does when an electron falls into it from a shell bound by `bFrom`: the photon takes the whole difference, or the Auger electron
takes it less the binding `bEjected` of the electron that carries it away (the three levels are the caller's, from the table)

### fluorescenceYieldK

*function* · `packages/physics-atomic/src/xray.ts:44`

```ts
function fluorescenceYieldK: (Z: number) => number
```

the K-shell fluorescence yield by Burhop's form Z^4 / (a + Z^4), a = 1.12e6: the share of K vacancies that give off a photon, the rest give an Auger electron

### groundShells

*function* · `packages/physics-atomic/src/hydrogenic.ts:59`

```ts
function groundShells(count: number): number[]
```

The shell each of `count` electrons goes to in the ground state: shell n holds 2 n^2 (the planetary filling).

### hydrogenicRadial

*function* · `packages/physics-atomic/src/orbitals.ts:23`

```ts
function hydrogenicRadial(n: number, l: number, Z: number, r: number): number
```

the normalised radial function R_nl(r) of a hydrogen-like atom, r in a0 (the integral of R^2 r^2 over r is 1), in a0^(-3/2)

### kleinNishina

*function* · `packages/physics-atomic/src/xray.ts:17`

```ts
function kleinNishina(E: number, theta: number): number
```

the Klein-Nishina cross section per solid angle, m^2/sr, for a photon of `E` eV scattered by `theta`

### kleinNishinaTotal

*function* · `packages/physics-atomic/src/xray.ts:22`

```ts
function kleinNishinaTotal(E: number): number
```

the total Klein-Nishina cross section, m^2 (the analytic integral); 6.652e-29 m^2 (Thomson) for E -> 0

### knownNuclides

*function* · `packages/physics-atomic/src/nuclides.ts:33`

```ts
function knownNuclides: () => string[]
```

### kramersNumber

*function* · `packages/physics-atomic/src/xray.ts:60`

```ts
function kramersNumber: (E: number, kV: number) => number
```

Kramers' spectrum, the number of photons per unit energy at `E` eV for a tube of `kV` (arbitrary scale): (E0 - E) / E for E < E0

### laguerre

*function* · `packages/physics-atomic/src/orbitals.ts:14`

```ts
function laguerre(k: number, alpha: number, x: number): number
```

the associated Laguerre polynomial L_k^alpha(x) by the three-term recurrence

### levelEnergy

*function* · `packages/physics-atomic/src/hydrogenic.ts:15`

```ts
function levelEnergy(n: number, Z: number, M = Infinity): number
```

The energy of level n (J, negative: the ionisation limit is 0) for an electron that feels the charge Z. `M` is the nucleus's mass (kg; default infinite).

### ligandPositions

*function* · `packages/physics-atomic/src/bonds.ts:44`

```ts
function ligandPositions(center: string, lengths: number[]): [number, number, number][] | null
```

Where the ligands of a central atom sit round it, in the molecule's own frame, metres: one ligand on +x; two in the x-y plane at the bond angle; three
(a pyramid) and four (a tetrahedron) spread evenly round -z. Returns null for a count the table has no angle for.

### meanRadius

*function* · `packages/physics-atomic/src/orbitals.ts:31`

```ts
function meanRadius: (n: number, l: number, Z: number) => number
```

the mean radius <r> of a hydrogen-like orbital, a0: a0 (3 n^2 - l (l + 1)) / (2 Z)

### mulberry

*function* · `packages/physics-atomic/src/orbitals.ts:60`

```ts
function mulberry(seed: number): () => number
```

a deterministic generator of numbers in [0, 1): the points of a cloud are the same on every run for the same seed

### nuclearMass

*function* · `packages/physics-atomic/src/nuclides.ts:36`

```ts
function nuclearMass: (n: Nuclide) => number
```

The mass of the bare nucleus (kg): the atom less its Z electrons (their binding, eV, is left out).

### nuclide

*function* · `packages/physics-atomic/src/nuclides.ts:26`

```ts
function nuclide(name: string): Nuclide
```

The nuclide of that name (`U-235`); throws, listing the known ones, for one that is not tabled.

### nuclideName

*function* · `packages/physics-atomic/src/nuclides.ts:23`

```ts
function nuclideName: (Z: number, A: number) => string
```

### orbitPoint

*function* · `packages/physics-atomic/src/orbitals.ts:109`

```ts
function orbitPoint(o: Orbit, M: number): [number, number, number]
```

the point of the orbit at the mean anomaly `M` (radians, 0 at the nearest point): Kepler's equation solved by Newton, the nucleus in the focus; the plane is x-y

### orbitRadius

*function* · `packages/physics-atomic/src/hydrogenic.ts:18`

```ts
function orbitRadius(n: number, Z: number, M = Infinity): number
```

The radius of the orbit of level n (m).

### orbitSpeed

*function* · `packages/physics-atomic/src/hydrogenic.ts:21`

```ts
function orbitSpeed(n: number, Z: number, M = Infinity): number
```

The angular speed of an electron on level n (rad/s): the Bohr rule L = n hbar gives omega = n hbar / (mu r^2).

### photoelectronEnergy

*function* · `packages/physics-atomic/src/xray.ts:41`

```ts
function photoelectronEnergy: (E: number, binding: number) => number | undefined
```

the photoelectron's energy, eV, from a photon of `E` that can reach a level bound by `binding`; undefined when it cannot

### photonColour

*function* · `packages/physics-atomic/src/hydrogenic.ts:41`

```ts
function photonColour(nm: number): { rgb: [number, number, number]; visible: boolean }
```

The colour a photon of wavelength `nm` is drawn in: [r, g, b] in 0..1 and whether the eye sees it. Infrared is a dim red, ultraviolet a dim violet (so a
photon is never invisible in a picture), marked `visible: false`.

### reactionQ

*function* · `packages/physics-atomic/src/nuclides.ts:55`

```ts
function reactionQ(from: string, products: string[], neutrons: number): number
```

The energy released (J) when `from` takes a neutron and becomes `products` and `neutrons` free neutrons: the rest mass lost, c^2 times it. Negative when it costs energy.

### realHarmonic

*function* · `packages/physics-atomic/src/orbitals.ts:34`

```ts
function realHarmonic(l: number, m: number, theta: number, phi: number): number
```

the real spherical harmonic Y_lm (m from -l to l: m < 0 is the sine form, m > 0 the cosine form), for l up to 3; the integral of Y^2 over the sphere is 1

### reducedMass

*function* · `packages/physics-atomic/src/hydrogenic.ts:11`

```ts
function reducedMass: (M: number) => number
```

The reduced mass of an electron and a nucleus of mass M (kg).

### restEnergy

*function* · `packages/physics-atomic/src/nuclides.ts:42`

```ts
function restEnergy: (kg: number) => number
```

The energy (J) a mass difference is worth: m c^2.

### sampleBremsstrahlung

*function* · `packages/physics-atomic/src/xray.ts:62`

```ts
function sampleBremsstrahlung(kV: number, rand: () => number, Emin = 1000): number
```

a photon energy from the continuous spectrum above `Emin` (a window or filter keeps nothing below it), eV

### sampleComptonAngle

*function* · `packages/physics-atomic/src/xray.ts:29`

```ts
function sampleComptonAngle(E: number, rand: () => number): number
```

a scattering angle drawn from the Klein-Nishina law by rejection (the envelope is the forward value, the largest)

### sampleOrbital

*function* · `packages/physics-atomic/src/orbitals.ts:69`

```ts
function sampleOrbital(n: number, l: number, m: number, Z: number, count: number, seed = 1): [number, number, number][]
```

`count` points (a0, [x, y, z]) distributed as the density of the orbital (n, l, m) of a hydrogen-like atom of charge Z: the radius from the radial distribution
r^2 R^2 by its cumulative table, the direction by rejection from |Y_lm|^2.

### seriesName

*function* · `packages/physics-atomic/src/hydrogenic.ts:35`

```ts
function seriesName(to: number): string
```

The named series of hydrogen by the level the electron goes to: Lyman (1), Balmer (2), Paschen (3), Brackett (4), Pfund (5).

### sommerfeldOrbit

*function* · `packages/physics-atomic/src/orbitals.ts:102`

```ts
function sommerfeldOrbit(n: number, l: number, Z: number): Orbit
```

the ellipse of the electron (n, l) round a charge Z: the semi-minor axis b = a (l + 1/2) / n (l = 0 is a thin ellipse through the nucleus, not a line)

### stream

*function* · `packages/physics-atomic/src/atomic.ts:98`

```ts
function stream(seed: number): () => number
```

A deterministic stream of numbers in [0, 1) from a seed (mulberry32).

### transitionEnergy

*function* · `packages/physics-atomic/src/hydrogenic.ts:27`

```ts
function transitionEnergy: (n: number, m: number, Z: number, M?: number) => number
```

The energy a photon must carry to lift an electron from level n to m (J); negative going down (m < n): the energy it gives off.

### tubeEfficiency

*function* · `packages/physics-atomic/src/xray.ts:73`

```ts
function tubeEfficiency: (Z: number, kV: number) => number
```

the efficiency of the tube, the share of the electron's power that comes out as X-rays: about 1e-9 Z V (V in volts), Kramers

### wavelengthOf

*function* · `packages/physics-atomic/src/hydrogenic.ts:30`

```ts
function wavelengthOf: (E: number) => number
```

The vacuum wavelength of a photon of energy E (m).

## Interfaces

### AddAtom

*interface* · `packages/physics-atomic/src/atomic.ts:53`

```ts
interface AddAtom
```

- `Z?: number`
- `A?: number`
- `nuclide?: string`
- `electrons?: number`
- `position?: Vec3`
- `entity?: Entity`
- `seed?: number`
- `shells?: number[]`

### AtomEventsLike

*interface* · `packages/physics-atomic/src/models.ts:16`

```ts
interface AtomEventsLike
```

- `on(name: string, fn: (p: any) => void): unknown`

### AtomicCapability

*interface* · `packages/physics-atomic/src/atomic.ts:55`

```ts
interface AtomicCapability extends Capability
```

- `readonly atoms: Map<string, AtomState>`
- `readonly photons: Map<number, PhotonState>`
- `readonly molecules: Map<string, Molecule>`
- `readonly freeCharges: Map<number, FreeCharge>`
- `readonly neutrons: Map<number, FreeNeutron>`
- `drawn: number` — scene metres per true metre
- `addAtom(name: string, o: AddAtom): AtomState`
- `electronPosition(atom: string, i: number): Vec3` — where an electron is now, scene metres
- `electronEnergy(atom: string, i: number): number` — the energy of an electron's level, J (negative; 0 is free)
- `screened(atom: string, i: number): number` — the charge an electron feels on its shell
- `excite(atom: string, i: number, n: number): void` — put an electron on level n, the energy for it coming from outside (booked as `external`)
- `firePhoton(o: { toward?: string; at?: Vec3; dir?: Vec3; nm?: number; energy?: number }): PhotonState` — send a photon of vacuum wavelength `nm` (or an energy in J) at an atom, or along a direction from a point
- `fireNeutron(o: { toward: string; mev?: number; at?: Vec3; speed?: number; outcome?: 'fission' | 'capture' }): FreeNeutron` — send a neutron of kinetic energy `mev` at a nucleus. `outcome` forces fission or capture; otherwise the tabled shares decide, by the seed.
- `dock(a: string, b: string): Molecule` — dock two atoms: a bond of the tabled length and energy, the atoms placed in the molecule's shape
- `undock(a: string, b: string): void` — pull a bond apart: the energy it holds must come from outside (booked as `external`)
- `heat(molecule: string, joules: number): void` — give a molecule heat, J, from outside: a bond that gets what it holds breaks, the rest stays as heat
- `energy(): { total: number; external: number; terms: Record<string, number> }` — the account: every kind of energy (J) and the total; `external` is what was put in from outside, so total - external is constant
- `nuclideOf(atom: string): string` — the name of an atom's nuclide (`H-1`), when it has a tabled one

### AtomModuleData

*interface* · `packages/physics-atomic/src/models.ts:18`

```ts
interface AtomModuleData
```

- `nuclide?: string`
- `Z?: number`
- `A?: number`
- `electrons?: number`

### AtomStageLike

*interface* · `packages/physics-atomic/src/models.ts:13`

```ts
interface AtomStageLike
```

what the binding needs of a stage and of the event bus: structural, so this package does not depend on `@ferret/levels`

- `actor(name: string): { root: { getAbsolutePosition(): { x: number; y: number; z: number } }; resolved?: { model: { physics?: { modules?: Record<string, Record<string, unknown> | null> } } } }`

### AtomState

*interface* · `packages/physics-atomic/src/atomic.ts:36`

```ts
interface AtomState
```

- `name: string`
- `Z: number`
- `A: number`
- `nuclide?: Nuclide`
- `mass: number` — the mass of the bare nucleus, kg
- `position: Vec3`
- `velocity: Vec3`
- `electrons: ElectronState[]`
- `entity?: Entity`
- `molecule?: string`
- `fragment?: boolean` — a bare nucleus flying on after a fission: it is not tracked by the orbits

### BondData

*interface* · `packages/physics-atomic/src/bonds.ts:11`

```ts
interface BondData
```

- `length: number`
- `energy: number`

### BondState

*interface* · `packages/physics-atomic/src/atomic.ts:50`

```ts
interface BondState
```

- `a: string`
- `b: string`
- `length: number`
- `energy: number`
- `order: number`

### ChainOptions

*interface* · `packages/physics-atomic/src/chain.ts:23`

```ts
interface ChainOptions
```

- `components: FuelComponent[]`
- `numberDensity: number` — atoms per m3 of the mixture
- `radius: number` — the radius of the real ball, metres
- `visible?: number` — how many nuclei are drawn (default 2000)
- `speed?: number` — m/s (default 2200, thermal)
- `seed?: number`

### Charged

*interface* · `packages/physics-atomic/src/coulomb.ts:8`

```ts
interface Charged
```

- `x: number`
- `y: number`
- `z: number`
- `q: number`

### DecayEvent

*interface* · `packages/physics-atomic/src/decay.ts:17`

```ts
interface DecayEvent
```

- `t: number`
- `index: number`
- `from: string`
- `to: string`
- `emits?: string`
- `Q: number`

### DecayKind

*interface* · `packages/physics-atomic/src/decay.ts:10`

```ts
interface DecayKind
```

Many decaying nuclei. A population of nuclei of the kinds it is given, each with its own random moment of decay drawn from the exponential law of its
kind's half-life, so the numbers left follow N0 2^(-t / T) within the statistical error of N0 and the nuclei themselves decay one by one, in order. A decay is an event: the
nucleus becomes its daughter (a kind of the table, whose clock starts then) or, where the table ends, a nucleus of "beyond the table" that does not decay here. The energy of the
decays is added up (`energy`, joules). Time is the caller's, in seconds: a slider that speeds it up changes what `advance` is given, nothing else.

- `id: string`
- `halfLife: number` — seconds; Infinity for a stable kind
- `daughter?: string` — the id of the kind the nucleus becomes; absent: it becomes a nucleus beyond the table
- `emits?: string` — what flies out (`alpha`, `electron` ...), as the caller names it
- `Q?: number` — MeV released by one decay

### ElectronState

*interface* · `packages/physics-atomic/src/atomic.ts:35`

```ts
interface ElectronState
```

- `n: number`
- `phase: number`
- `axis: Vec3`

### FreeCharge

*interface* · `packages/physics-atomic/src/atomic.ts:48`

```ts
interface FreeCharge
```

- `id: number`
- `kind: 'electron'`
- `q: number`
- `mass: number`
- `x: Vec3`
- `v: Vec3`

### FreeNeutron

*interface* · `packages/physics-atomic/src/atomic.ts:49`

```ts
interface FreeNeutron
```

- `id: number`
- `position: Vec3`
- `passedFrom?: Vec3`
- `velocity: Vec3`
- `target?: string`
- `kinetic: number`
- `speed?: number`
- `want?: 'fission' | 'capture'`
- `outcome?: 'fission' | 'capture' | 'gone'`

### FuelComponent

*interface* · `packages/physics-atomic/src/chain.ts:17`

```ts
interface FuelComponent
```

A chain reaction among nuclei: a ball of material in which neutrons fly, are taken up and make fissions that make more neutrons.

The material is a mixture of components (a fissile nuclide, a diluent that only captures ...), each with its share of the atoms and its neutron cross-sections. A neutron of one
speed goes straight until it meets a nucleus; the way is drawn from exp(-Sigma s), Sigma the macroscopic cross-section of the mixture as it now is (spent nuclei no longer count). It leaks
if it reaches the surface of the ball first. At the nucleus it meets (of a component drawn by sigma x share, the nearest living nucleus of it) it fissions, with the chance sigma_f /
(sigma_f + sigma_c), making nu neutrons (the integer part, and one more with the chance of the fraction) from there in all directions, or it is captured. A nucleus is used up by either.

What is drawn is a ball of `visible` nuclei, not the 1e25 of a real one: the visible ball keeps the optical radius Sigma R of the real one (the one number the physics of a bare ball
is about), so the paths in it, the leak and k are those of the real ball; the cross-sections are conditionally larger in the same proportion for all, the way a picture's atoms are drawn
larger than they are. One visible nucleus is one nucleus: its fission releases one fission's energy (`energyMeV`), nothing is scaled up in the account.
A component with no cross-section (a moderator, the bulk of a dilute fuel) only dilutes: it is not drawn. Neutrons are all of one speed with no scattering and no moderator: this is the model of slow neutrons in a bare ball of the fuel, approximate; `kTheory` is its multiplication factor.

- `id: string`
- `share: number` — the share of the atoms, any positive weight (they are normalised)
- `sigmaF: number` — barn
- `sigmaC: number`
- `nu: number` — neutrons per fission
- `energyMeV: number`

### Molecule

*interface* · `packages/physics-atomic/src/atomic.ts:51`

```ts
interface Molecule
```

- `id: string`
- `atoms: string[]`
- `bonds: BondState[]`
- `internal: number`

### NeutronChannel

*interface* · `packages/physics-atomic/src/nuclides.ts:45`

```ts
interface NeutronChannel
```

What a neutron does to a nucleus: the products, how many neutrons come out, and the share of the captures that end this way (cross sections of thermal neutrons).

- `kind: 'fission' | 'capture'`
- `products: string[]`
- `neutrons: number`
- `probability: number`

### Nuclide

*interface* · `packages/physics-atomic/src/nuclides.ts:21`

```ts
interface Nuclide
```

- `name: string`
- `symbol: string`
- `Z: number`
- `A: number`
- `N: number`
- `atomicMass: number`

### Orbit

*interface* · `packages/physics-atomic/src/orbitals.ts:97`

```ts
interface Orbit
```

- `a: number` — semi-major axis, a0
- `b: number`
- `e: number`
- `period: number` — the period of the Kepler motion in the unit of the ground orbit of hydrogen: n^3 / Z^2

### PhotonState

*interface* · `packages/physics-atomic/src/atomic.ts:47`

```ts
interface PhotonState
```

- `id: number`
- `position: Vec3`
- `start: Vec3`
- `limit: number`
- `passed?: Vec3`
- `dir: Vec3`
- `energy: number`
- `nm: number`
- `rgb: [number, number, number]`
- `visible: boolean`
- `age: number`
- `tested: Set<string>`
- `outcome?: 'absorbed' | 'passed' | 'gone'`

### VacancyDecay

*interface* · `packages/physics-atomic/src/xray.ts:46`

```ts
interface VacancyDecay
```

- `kind: 'fluorescence' | 'auger'`
- `energy: number`

## Types

### ChainEvent

*type* · `packages/physics-atomic/src/chain.ts:32`

```ts
type ChainEvent = | { kind: 'fission'; t0: number; from: [number, number, number]; t: number; nucleus: number; component: string; pos: [number, number, number]; neutrons: number; energyMeV: number } | { kind: 'capture'; t0: number; from: [number, number, number]; t: number; nucleus: number; component: string; pos: [number, number, number] } | { kind: 'leak'; t0: number; from: [number, number, number]; t: number; pos: [number, number, number] }
```

every event ends the flight of a neutron: it left `from` at `t0` and arrived at `pos` at `t`

## Constants

### ALPHA

*const* · `packages/physics-atomic/src/constants.ts:9`

```ts
const ALPHA: 0.0072973525693
```

### ATOMIC_DEFAULTS

*const* · `packages/physics-atomic/src/atomic.ts:33`

```ts
const ATOMIC_DEFAULTS: { orbitClock: number; decayClock: number; photonSpeed: number; tolerance: number; captureMargin: number; cutoff: number; range: number; }
```

### AVOGADRO

*const* · `packages/physics-atomic/src/constants.ts:19`

```ts
const AVOGADRO: 6.02214076e+23
```

### BEYOND_TABLE

*const* · `packages/physics-atomic/src/decay.ts:19`

```ts
const BEYOND_TABLE: "(beyond the table)"
```

### BOHR_RADIUS

*const* · `packages/physics-atomic/src/constants.ts:14`

```ts
const BOHR_RADIUS: 5.29177210903e-11
```

### C_LIGHT

*const* · `packages/physics-atomic/src/constants.ts:6`

```ts
const C_LIGHT: 299792458
```

### E_CHARGE

*const* · `packages/physics-atomic/src/constants.ts:3`

```ts
const E_CHARGE: 1.602176634e-19
```

Physical constants, SI (CODATA 2018).

### ELECTRON_REST_EV

*const* · `packages/physics-atomic/src/xray.ts:7`

```ts
const ELECTRON_REST_EV: 510998.95
```

Processes of X-rays with an atom, general and without any game: Compton scattering by the Klein-Nishina law, the photoelectric effect,
the fate of a vacancy in an inner shell (a fluorescence photon or an Auger electron), and the continuous spectrum of an X-ray tube (Kramers, with the Duane-Hunt limit).
Energies are in eV unless a name says keV. The random numbers come from the caller's stream so a run repeats.

### EPS0

*const* · `packages/physics-atomic/src/constants.ts:7`

```ts
const EPS0: 8.8541878128e-12
```

### EV

*const* · `packages/physics-atomic/src/constants.ts:16`

```ts
const EV: 1.602176634e-19
```

### H_PLANCK

*const* · `packages/physics-atomic/src/constants.ts:4`

```ts
const H_PLANCK: 6.62607015e-34
```

### HBAR

*const* · `packages/physics-atomic/src/constants.ts:5`

```ts
const HBAR: number
```

### HC_EV_NM

*const* · `packages/physics-atomic/src/xray.ts:8`

```ts
const HC_EV_NM: 1239.841984
```

### K_COULOMB

*const* · `packages/physics-atomic/src/constants.ts:8`

```ts
const K_COULOMB: number
```

### M_ELECTRON

*const* · `packages/physics-atomic/src/constants.ts:10`

```ts
const M_ELECTRON: 9.1093837015e-31
```

### M_NEUTRON

*const* · `packages/physics-atomic/src/constants.ts:12`

```ts
const M_NEUTRON: 1.67492749804e-27
```

### M_PROTON

*const* · `packages/physics-atomic/src/constants.ts:11`

```ts
const M_PROTON: 1.67262192369e-27
```

### MASS_U

*const* · `packages/physics-atomic/src/nuclides.ts:12`

```ts
const MASS_U: { H1: number; neutron: number; }
```

The atomic mass unit values of the particles, u.

### MEV

*const* · `packages/physics-atomic/src/constants.ts:17`

```ts
const MEV: number
```

### NEUTRON_CHANNELS

*const* · `packages/physics-atomic/src/nuclides.ts:47`

```ts
const NEUTRON_CHANNELS: Record<string, NeutronChannel[]>
```

U-235 with a thermal neutron: fission 585.1 b and radiative capture 98.7 b (the fission shares 0.8557 of the absorptions). Fission is the one tabled pair, Ba-141 + Kr-92 + 3 n.

### RYDBERG_ENERGY

*const* · `packages/physics-atomic/src/constants.ts:15`

```ts
const RYDBERG_ENERGY: number
```

### SYMBOLS

*const* · `packages/physics-atomic/src/nuclides.ts:9`

```ts
const SYMBOLS: string[]
```

### U_KG

*const* · `packages/physics-atomic/src/constants.ts:13`

```ts
const U_KG: 1.6605390666e-27
```

### U_MEV

*const* · `packages/physics-atomic/src/constants.ts:18`

```ts
const U_MEV: 931.49410242
```

### VALENCE

*const* · `packages/physics-atomic/src/bonds.ts:20`

```ts
const VALENCE: Record<string, number>
```

