Skip to content

Reaction mechanisms

A mechanism captures a multi-step reaction pathway with optional spectator ions.

mechanism{
label: reaction
label: reaction
spectator: ion1 ion2 ...
}

Each line is a key: value pair. Keys other than spectator are step labels (e.g. step1, step2).

Source Rendered
mechanism{ step1: OH- + CH3Br -> CH3OH + Br- spectator: Na+ }
Install the asciichem gem to see this rendered.
Source Rendered
mechanism{ step1: A + B -> C step2: C -> D + E spectator: Na+ K+ }
Install the asciichem gem to see this rendered.

A step value may carry the electron-flow arrows drawn for it: | flow: SOURCE > TARGET clauses, semicolon-separated. The marker names what the arrow starts at (a bond or species) and where it points — verbatim names, because atom-level binding needs references the mechanism text does not yet carry.

Source Rendered
mechanism{ step1: OH^- + CH_3-Br -> CH_3-OH + Br^- | flow: OH^- > C; C-Br > Br^- spectator: Na^+ }
Install the asciichem gem to see this rendered.

Flows are model data (Mechanism::Flow), carried by the step graph and the wire form, and re-emitted in canonical text. An unknown clause kind or a malformed arrow raises ParseError — never a silent drop.

Each entry must have a : separator. Malformed entries raise ParseError at parse time with the offending line number.

Emits as <reaction> with <mechanism> child:

<reaction>
<mechanism title="mechanism{...}" convention="asciichem:text"/>
</reaction>

Future enhancement: structural <reactionStepList> with per-step reaction elements.

Play