FERRETGame engine over Babylon.js
Ferret

Atoms and matter: a teaching lab

The example examples/education is four modes, in tabs along the top, that show what matter is made of. M switches the spoken commentary on and off. It is built on the atomic physics and runs in the browser, on a phone and in a VR headset.

The lab, running in this page (about 20 MB, loaded only when you press the button). Pick a mode in the tabs; M switches the voice. In Irradiation, Space fires.

The four modes#

  • Atom. Any of the 118 elements, with its shells taken from the electron configuration, drawn as Rutherford's orbits or Bohr's clouds, the jumps between levels, the spectrum and a photon of any energy to send at it. Electrons are green, protons red, neutrons white, photons yellow.
  • Matter. Thirteen substances (water, salt, iron, copper, carbon, helium, hydrogen, oxygen, nitrogen, carbon dioxide, ethanol, sulphuric acid, hydrochloric acid). Set a volume, a pressure and a temperature and a crystal, a liquid or a gas builds itself from the phase diagram: ice is lighter than water because its lattice is open, carbon at 10 GPa is diamond. The readout gives density, mass, molecules and the mean speed. Bonds are coloured by kind (covalent, ionic, hydrogen) and each kind has a switch.
  • Irradiation. Photons, X-rays and electrons sent at one atom or at a block of matter: excitation, ionisation, characteristic lines, bremsstrahlung, Compton scatter. The cross sections follow the empirical photoelectric law and Klein-Nishina; an electron's range is the Katz-Penfold one; the energy that went in is the energy deposited plus the energy that escaped.
  • Decay. Every nucleus in view has its own random moment of decay (U-235, U-238, Pu-239, C-14, H-3, Th-234), with the half-life slider, the graph of what is left and the daughters. The sixth choice is a chain reaction in a bare ball of U-235: a ball smaller than the critical radius dies out, a larger one runs away. R starts again; Space sends a neutron (a tap is one, a hold is a stream).

Everything is solid to the camera, so it cannot fly through a ball or a stick. Orbits and bonds are half transparent and have switches.

The voice#

Seventy-four short comments ("the crystal lattice of table salt has this structure ...", "when ice melts, these bonds break ...") were recorded once, in English, by text to speech and are played from files, each when its situation first comes up. A test checks that every comment has its file and no file is left without one. The texts are in src/lab/commentary.ts.

An agent plays it#

Every control has a command (edu.open, edu.atom.pick, edu.matter.pick, edu.matter.set, edu.irradiation.fire, edu.decay.pick, edu.decay.advance and the rest, edu.state for what is on the screen), so an agent plays all four modes as a player does.

In a headset#

The menu is a panel in the world (Y or the menu button): the four modes and, for the open one, the same choices as its panel. The left stick flies, the right stick turns by 30 degrees and lifts. A legend line follows the head: B restarts, the trigger sends a neutron, A switches the voice. The target rate is the headset's own; what a headset cannot hold is simplified, not slowed.

Models and data#

The lab's models are 200 .fmdl packages in the asset library, rubric education/atoms-and-matter: the abstract atom, the 118 elements, molecules, crystal unit cells and the samples of each substance in each state (type fmdl, see the model format). The code of the lab is the library module atoms-and-matter. The tables carry their sources (IUPAC masses, AME2020, NIST, CRC); what is not known with confidence is marked approx in the data, never written on the screen.

Files and rebuild#

examples/education/README.md has the layout and the commands: node tools/build.mjs education builds the page into dist/web/education, the models are generated into examples/education/models.