Skip to content

Object matching

For an atom to move from one state to the next, Molkit has to know which atom in the next state it becomes. So when an animation plays, Molkit pairs each atom, bond, and annotation in one state with its counterpart in the next. Matched objects move between their two positions; unmatched objects enter or leave instead. Most pairings are right without help. When one is not, the Match Editor shows every pairing and lets you correct it.

Molkit matches objects between each pair of neighboring states in several passes, in order:

  1. Copy history. Objects created by Duplicate, or copied and pasted from one state frame into another, remember their source object and pair with it with full confidence. This is the most reliable signal.
  2. Curved arrows. When nothing carries copy history and the first state has electron-flow arrows, Molkit applies the arrows to its bonds (as Next Step does) and looks for the drawn next state with exactly those bonds, atom for atom. If it finds it, every atom pairs with the same atom in the next state, however the next state is drawn or turned, and the passes below are skipped. Among equivalent atoms, such as the hydrogens of a methyl group, the nearest is used. If the arrows cannot be read or the next state is not what they make, the passes below run as usual.
  3. Custom labels. A label that appears exactly once in each state matches even if the element changed (for example, a generic “Nu” drawn as carbon in one state and nitrogen in the next). Repeated labels match within their label group by proximity.
  4. Connectivity. Unlabeled atoms match through their bonded neighbors, working outward from atoms already matched. Bond angles and solid or hashed wedges break ties.
  5. Displayed label, then element and proximity. Remaining atoms match by what is visibly drawn, and otherwise pair with the nearest atom of the same element.

Bonds match through their atoms: when both end atoms match, the bond between them matches too. Text annotations match when their text is identical. Shapes, images, and LaTeX match by type and proximity; types that carry content must also have identical content. A bracket matches only a bracket around the same ion, meaning an atom it encloses in one state is paired with an atom it encloses in the next, and an ion’s charge sign goes with its bracket. When a reaction swaps ions, as in an SN2 step, the old bracket fades out and the new one fades in instead of flying across the molecule. When the ion’s atoms move, the old bracket and its charge sign fade out in the first fifth of the transition, before the atoms travel far, and the new ones fade in during the last 15 percent, once the atoms are in place. A bracket around an ion that stays put fades with the other annotations.

An object that exists only in the first state fades out during the transition. If it is bonded to a matched atom, it slides into that neighbor instead. An object that exists only in the second state appears early in the transition, or slides out from a matched neighbor it is bonded to.

When an atom slides into a neighbor that carries a label (for example, CH3 and O in one state drawn as the single label CH3O in the next), the bond that led to the absorbed atom is paired with the bond to the new label. It slides to the label instead of fading out and back in.

Whole molecules that exist in only one state drift out or in as they fade. See Reaction choreography.

Each pair of states gets a rating, shown as the tint of its duration chip in the state strip, and as a label in the Animation panel when the transition is selected:

Tint Rating Meaning
Green Smooth morph Every object is matched one to one with a confident pairing.
Amber Partial morph Some objects fade in or out, or some pairings are uncertain.
Red Mostly cross-fade Most objects are unmatched.

Amber is expected when atoms enter or leave on purpose. When you expected every object to carry over, an amber or red chip means you should check the pairings in the Match Editor.

Matching is most reliable when it can use copy history. Redrawing a molecule in the next state, instead of duplicating the state or copying and pasting between frames, loses that history. Matching then falls back on structure and position, which can mispair symmetric atoms such as the three hydrogens of a methyl group.

Adding or deleting atoms in either state clears the stored matches for that pair, and matching runs again. Check the Match Editor after structural edits.

A text annotation whose text differs between states has no copy history to pair by, so it crossfades. To make it move, wire it by hand.

To open the Match Editor, click Match in the animation toolbar (available when the animation has at least two states), or click Edit matches… in the Animation panel when a transition is selected.

The editor shows both states, with a numbered badge on every object. The same number on both sides marks a matched pair; gray dash badges mark unmatched objects. Pairs whose elements differ are highlighted as a warning.

The Match Editor on a two-state SN2 animation: its bar under the animation toolbar, and numbered badges on the atoms of both states, the same number on each matched pair.
The Match Editor: the same number on both states marks a matched pair.
Control Key What it does
Inspect The default mode: click badges to select them. Shift+click selects several.
Wire W Click an object in one state, then its partner in the other. The new pair is pinned, replaces any conflicting match, and is kept when you run Auto again.
Renumber Double-click a badge, type a pair number, and press Enter.
Break a match Delete or Backspace Excludes the selected objects, so Auto does not pair them again; they animate as unmatched. Wiring an excluded object pairs it again.
Auto A Runs automatic matching again, keeping your pinned pairs and exclusions.
Carry forward Records an electron transfer for your own reference: click an object in the first state, then one in the second. Playback does not use these links.
Pin static Marks a matched annotation pair as static for your own reference: click its badge to mark it, and again to clear the mark. Pairs with identical content start out static. Playback does not use the mark.
Clear C Unpairs everything for the current pair of states, and drops its broken matches.
Reset R Discards your wires and broken matches and runs matching from the start.
Fit F Fits both states in view.
Previous and next pair [, ] Steps between pairs of states.
Undo, redo Ctrl+Z, Ctrl+Y (or Ctrl+Shift+Z) Undoes or redoes within the editor session.
Done M or Esc Closes the editor. In another mode, the key first returns to Inspect; press it again to close.

Suppose you drew state 2 of a bromomethane SN2 from scratch instead of duplicating state 1. In the preview, two hydrogens on the carbon cross paths as the molecule inverts, because matching paired each with the wrong partner.

  1. Click the chip between the two states, then click Edit matches… in the Animation panel. The Match Editor opens on that pair.
  2. Find the two hydrogens whose numbers cross: the number on the upper hydrogen in state 1 appears on the lower hydrogen in state 2.
  3. Press W for Wire mode, click the upper hydrogen in state 1, then click the hydrogen you want it to become in state 2. Wire the other hydrogen the same way.
  4. Click Done and preview again. The wired pairs are pinned, so Auto keeps them.