Guide · 09 of 15
Atoms and the periodic table
An orbitals is the orbital box diagram of an element or an ion ("Fe3+"), filled by the aufbau order and Hund, with the configuration, the unpaired electrons and the magnetic moment available to labels. A ptable is the periodic table or a slice of it, with the group names the book uses, and a hotspot can target its cells. A configuration exercise has the student fill those boxes by tapping, checked against the same logic. All of them draw in a scene plane that says aspect: equal. A tube is a test tube for what the book has you observe (it also needs axes: false): press a button to add a reagent and watch a precipitate form, a gas bubble off, a liquid change colour or a strip of paper turn.
orbitals#
The orbital box diagram the way the book draws it: one square per orbital, an arrow per electron. <species> is an element symbol with an optional charge ("Fe", "Fe3+", "Mn7+", "Cu+", "O2-"), from H to Kr. The compiler fills the boxes by the aufbau order with the two exceptions in that range, Cr (4s1 3d5) and Cu (4s1 3d10), Hund inside a subshell (a single up arrow in every box from the left, then the pairs from the left), and a cation loses its outermost shell first, so 4s goes before 3d (Fe3+ is 3d5, Cu+ is 3d10, Mn7+ is empty). An unknown symbol, a charge that takes more electrons than there are, or an element past Kr is a compile error at the column. shells lists the subshells drawn, left to right in filling order (default 4s 3d for K to Kr, plus 4p when it holds electrons, and the outer shell below that, like 2s 2p); a subshell in shells is drawn even when empty. core (on by default, core: false turns it off) writes the noble gas core before the boxes ([Ar]) when the shells under the drawn ones are full, and labels (on by default, labels: false turns it off) writes each subshell and its count under its boxes (4s^2, 3d^6). boxes: "4s:2 3d:22000" draws a pattern you give instead of the ground state, one character per box (0 empty, 1 an up arrow, 2 a pair, d a down arrow), so a lesson can show a Hund violation on purpose; the count must match the subshell (s 1, p 3, d 5). fill is how many of the drawn electrons are shown, counted in filling order, and remove how many are taken away, in ionization order (the outer shell first, and the last electron to go in a subshell goes first); both take any expression, so a slider, a stepper or a timeline step builds an atom or turns Fe into Fe2+ and Fe3+ one electron at a time. They cannot be used with boxes. With either of them the subshell labels count live (3d^6 becomes 3d^5 as an electron leaves). The common show: <expr> reveals or hides the whole diagram. The scene must say aspect: equal. at is the middle of the drawing (default (0, 0)), size the side of one box in scene units (default 1). The drawing is ordinary objects: <id> names the whole diagram in indicate, focus, surround and morph, <id>_3d and <id>_4s a subshell, <id>_3d_1 to <id>_3d_5 one box (the s box is <id>_4s_1), <id>_unpaired every box holding a single electron in the species, and <id>_core the core. Labels read the species, filled in at compile time from an orbitals declared above: {config(<id>)} is the configuration in the book's form ([Ar] 4s² 3d⁶, and \mathrm{[Ar],\ 4s^2,\ 3d^6} in a tex label), {unpaired(<id>)} the number of unpaired electrons and {moment(<id>)} the magnetic moment \sqrt{n(n+2)} in BM to two decimals. They read the whole species, so shells does not change them, but with fill or remove they follow it as it moves (a subshell that reaches no electrons drops out of the configuration, so Mn7+ reads [Ar]). With fill or remove the diagram also names its numbers for the rest of the slide, in prose ${unpaired_<id>}, ${fixed(moment_<id>, 2)} and ${n_<id>_3d} (the electrons in one subshell), and in a goal (when: unpaired_fe == 5). To check a typed moment, expect: moment("Fe3+") on a numeric works it out as a number (unpaired("Fe3+") is the count).
orbitals <id> = "" { [at: (x, y)], [size: <n>], [shells: "4s 3d"], [boxes: "" ], [fill: <expr>], [remove: <expr>], [core], [labels], [props] }
| prop | type | description |
|---|---|---|
| at | (x, y) | where the middle of the drawing sits (default (0, 0)) |
| size | number | scene units per box side (default 1) |
| shells | string | the subshells drawn, like "4s 3d" (default the valence ones) |
| boxes | string | a pattern instead of the ground state, like "4s:2 3d:22000" |
| fill | expr | how many electrons are drawn, in filling order |
| remove | expr | how many electrons are taken away, in ionization order |
| core | flag | the noble gas core as text before the boxes (default on) |
| labels | flag | the subshell name and count under each group (default on) |
Example
ptable#
The periodic table, or a slice of it, one square per element with its symbol, in a plane scene with aspect: equal. A column is a group (1 to 18) and a row a period (1 to 7), laid out as the book draws it: He at the far right of period 1, the d block in the middle (La and Ac sit at group 3 as the first of their series), the f block left out unless f is on. rows: [4, 5] and cols: [3, 12] keep only those periods and groups, inclusive. Say axes: false on the scene. A full table is about 20px a cell on a phone, too small to tap, so draw a slice or use a wide scene. size is the side of a cell in scene units (default 1, symbols grow with it), at the middle of the drawing. blocks tints s, p, d and f, z writes the atomic number in each cell (slices only), groups writes the book's group names above the columns (IA, IIA, IIIB to IIB, IIIA to VIIA, 0, with VIII once over its three columns), and f adds the lanthanides and actinides as two rows below, starting under group 3. Parts: <id> the whole table, <id>_Fe a cell, <id>_period4 a row, <id>_group8 a column (<id>_groupVIII is 8, 9 and 10), <id>_d a block (_s, _p, _f), <id>_series1 to _series4 the transition series, <id>_lanthanides and <id>_actinides. A hotspot works on cells: target part <id>_Fe (or a row, column, block or series) becomes the rectangle to tap, with no coordinates.
ptable <id> { [at: (x, y)], [size: <n>], [rows: [first, last]], [cols: [first, last]], [blocks], [z], [groups], [f], [props] }
| prop | type | description |
|---|---|---|
| at | (x, y) | where the middle of the drawing sits (default (0, 0)) |
| size | number | scene units per cell side, symbols grow with it (default 1) |
| rows | list | the periods drawn, [first, last] from 1 to 7 (default all) |
| cols | list | the groups drawn, [first, last] from 1 to 18 (default all) |
| blocks | flag | tint the s, p, d and f blocks |
| z | flag | the atomic number in each cell |
| groups | flag | the group names above the columns, VIII once over three |
| f | flag | the lanthanides and actinides under the table |
Example
configuration#
The student fills the orbital boxes of an atom or ion by tapping. A box cycles empty, one up arrow, a pair, empty, so a tap is one step of the picture the book draws. species and shells mean what they do in the orbitals drawing: the compiler works the right answer out from the species (aufbau, Hund, the Cr and Cu exceptions, a cation losing its outer shell first), shows the noble gas core as [Ar] before the boxes when the shells under them are full, and checks the boxes against it, so the answer cannot be mistyped. The answer is the pattern exactly the way the book draws it: singles go in from the left and the pairs fill from the left, so a Hund violation (two arrows in one box while another sits empty) is wrong, and so is a pair put in a different box of the same subshell. A subshell that should be empty is drawn and starts empty, so Mn7+ is right as it stands. wrong "<pattern>" "why" names a classic mistake in the same pattern syntax as boxes: on orbitals (4s:2 3d:11100 is Fe3+ with the 3d electrons taken before the 4s ones), and a pattern may name only the subshells it changes, the rest are taken from the right answer. Its "why" shows when a student gives exactly that pattern, and -> "detour-id" sends them to a scaffold made for it (see onwrong). A wrong pattern that is the right answer, or is written twice, is a compile error. A box is 44px square, so it is a comfortable tap on a phone. Everything else an exercise takes works: hint, !, skill:, onwrong:, a worked ladder.
configuration { ask "..." species: "" [shells: "4s 3d"] [wrong "" "why" [-> "detour-id" [retry]]] }
| prop | type | description |
|---|---|---|
| species* | string | the element symbol and charge, like "Fe3+" (H to Kr) |
| shells | string | the subshells to fill, like "4s 3d" (default the valence ones) |
Example
tube#
A test tube for what the book has you observe: add this reagent, see that. It needs aspect: equal and axes: false on a scene plane. (x, y) is the middle of the bottom of the tube, size its height in scene units (default 4), and a rack of three or four tubes fits a scene 10 units wide. Every number and every bool is an expression, so a button, a toggle or a stepper drives the change and the student presses "add" and watches it happen: mix, amount, fumes and stripMix fade over under half a second, and nothing moves on its own otherwise. liquid fills the tube to level (0 to 1, default 0.6) and turn is the colour it changes to as mix goes from 0 to 1. solid is a precipitate: amount says how much (default 1), cloudy through the liquid while settled is off (the default) and a layer at the bottom once it is on. bubbles is effervescence, vapour is a coloured gas above the liquid that fumes (0 to 1, default 1) fades in, ring is a band at the middle of the liquid that ringed (default on) shows, heat is a small flame under the tube, strip is a paper strip hanging in the mouth that changes to stripTurn as stripMix goes from 0 to 1, to bends a delivery tube from this tube's stopper down into another tube (declared above or below), and dropper shows a dropper over the mouth with a drop that falls when it turns true. label is the text above (the reagent) and under the text below (what it is): plain text, or one $...$ formula such as "$\mathrm{AgNO_3}$". A colour is one of what you can see: colourless, white, milky, paleyellow, yellow, orange, green, palegreen, yellowbrown, reddishbrown, brown, black, violet, purple, blue, pink. Anything else is a compile error with the nearest name. indicate, focus, surround and hotspot target part take T (the whole tube) or T_liquid, T_solid, T_vapour, T_ring, T_strip for the parts the tube has.
tube <id> = (x, y) { [size: <n>], [liquid: <colour>], [level: <expr>], [turn: <colour>], [mix: <expr>], [solid: <colour>], [amount: <expr>], [settled: <expr>], [bubbles: <expr>], [vapour: <colour>], [fumes: <expr>], [ring: <colour>], [ringed: <expr>], [heat: <expr>], [strip: <colour>], [stripTurn: <colour>], [stripMix: <expr>], [to: <tube>], [dropper: <expr>], [label: "..."], [under: "..."], [props] }
| prop | type | description |
|---|---|---|
| size | number | the height of the tube in scene units (default 4) |
| liquid | color | the colour of what is in the tube (default empty) |
| level | expr | how full, 0 to 1 (default 0.6) |
| turn | color | the colour the liquid changes to, needs mix |
| mix | expr | 0 keeps the liquid colour, 1 is the turn colour |
| solid | color | the colour of a precipitate |
| amount | expr | how much precipitate, 0 to 1 (default 1) |
| settled | flag | on: the precipitate lies at the bottom, off: it clouds the liquid |
| bubbles | flag | on while the tube effervesces |
| vapour | color | the colour of a gas above the liquid |
| fumes | expr | how much of the gas, 0 to 1 (default 1) |
| ring | color | the colour of a band at the middle of the liquid |
| ringed | flag | whether the band shows (default on) |
| heat | flag | on: a small flame under the tube |
| strip | color | the colour of a paper strip hanging in the mouth |
| stripTurn | color | the colour the strip changes to, needs stripMix |
| stripMix | expr | 0 keeps the strip colour, 1 is the stripTurn colour |
| to | id | another tube this one delivers its gas into, through a bent tube from a stopper |
| dropper | flag | a dropper over the mouth, a drop falls when this turns true |
| label | string | the text above the tube, usually the reagent |
| under | string | the text below the tube, usually what it is |
Example