Invntr
Source

All instruments

reaction_network

Mass-action kinetics of a reaction network written as text ('A + B → C; k = 0.5', 'A ≤> B; kf = 2; kr = 0.5', sources '0 → A', sinks 'A → 0'), integrated by 3-stage Radau IIA (order 5, L-stable) with an exact Jacobian and step-doubling error control.

Gives concentration histories, final state, half-lives, times and heights of maxima, the conserved totals (left null space of the stoichiometric matrix) and their drift, and an atom balance from formulas or a given composition.

Rate of a reaction = k times the product of reactant concentrations raised to their coefficients; k is in (mol/L)^(1-order)/s.

Field
Chemistry
Version
0.1.0
Runs as
Compiled (Rust)
Typical run
0.1 s

Compiled from source: run sh packs/install.sh once before admitting it.

Known answers it must pass

Admission replayreaction_network 0.1.0 · files e5d9b39e7eba…790e
  1. r0001first order A → B, k = 0.3 /s, A₀ = 1 M: [A](10 s) = exp(-3), [B] = 1 - exp(-3), half-life ln2/k (closed form, rel 10⁻⁶)passed

    final_mol_per_L.A= 0.049787, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    final_mol_per_L.B= 0.950213, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    half_life_s.A= 2.310491, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    mass_balance_drift_rel≤ 10⁻⁹6.66134 × 10⁻¹⁶lockedinside the range
  2. r0002consecutive A → B → C, k₁ = 2, k₂ = 1 /s (Bateman): B peaks at ln(k₁/k₂)/(k₁-k₂) = ln 2 s at A₀ (k₂/k₁)^(k₂/(k₁-k₂)) = 0.5 M; [B](5 s) = 2(exp(-5) - exp(-10)) M (closed form, rel 10⁻⁶)passed

    peak_time_s.B= 0.693147, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    peak_mol_per_L.B= 0.5, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    peak_kind.B= interiormisseddiffers
    final_mol_per_L.B= 0.013385, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
  3. r0003reversible A ≤> B, kf = 2, kr = 0.5 /s: equilibrium [B]/[A] = kf/kr = 4 so [A] = 0.2, [B] = 0.8 M; [A] falls to half at ln(8/3)/(kf+kr) s (closed form, rel 10⁻⁶)passed

    final_mol_per_L.A= 0.2, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    final_mol_per_L.B= 0.8, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    half_life_s.A= 0.392332, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    steady= truetruelockedexact match
  4. r0004second order 2A → B, rate k[A]² per reaction, k = 0.5 L/(mol s): 1/[A] = 1/A₀ + 2kt gives [A](9 s) = 0.1 M, half-life 1/(2 k A₀) = 1 s; [A] + 2[B] conserved (closed form, rel 10⁻⁶)passed

    final_mol_per_L.A= 0.1, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    final_mol_per_L.B= 0.45, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    half_life_s.A= 1, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    conserved.0.name= [A] + 2 [B]misseddiffers
    conserved.0.final_mol_per_L= 1, within 1.000000 × 10⁻⁹ relativereading not recorded on this page
  5. r0005N₂O₄ ≤> 2 NO₂, kf = 4, kr = 1 (Kc = 4 M): (2x)²/(1-x) = 4 gives x = (sqrt5-1)/2, [NO₂] = sqrt5 - 1, [N₂O₄] = (3 - sqrt5)/2 M; N and O atom totals exact (closed form, rel 10⁻⁶; drift 10⁻⁹)passed

    final_mol_per_L.NO2= 1.236068, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    final_mol_per_L.N2O4= 0.381966, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    atoms_balanced= truetruelockedexact match
    atoms.N.final_mol_per_L= 2, within 1.000000 × 10⁻⁹ relativereading not recorded on this page
    atoms.O.final_mol_per_L= 4, within 1.000000 × 10⁻⁹ relativereading not recorded on this page
    mass_balance_drift_rel≤ 10⁻⁹4.44089 × 10⁻¹⁶lockedinside the range
  6. r0006stiff A → B → C, k₁ = 10⁴, k₂ = 1 /s (Bateman, stiffness ratio 10⁴): peak at ln(10⁴)/9999 s, [B](5 s) = (10⁴/9999)(exp(-5) - exp(-5 × 10⁴)) M (closed form, rel 10⁻⁶)passed

    peak_time_s.B= 9.211261 × 10⁻⁴, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    peak_mol_per_L.B= 0.999079, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    final_mol_per_L.B= 0.006739, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    stiffness_index≥ 1000050005lockedinside the range
  7. r0007source and sink 0 → A (k = 1 M/s), A → 0 (k = 2 /s) from A₀ = 0: [A] = (1 - exp(-2t))/2, [A](10 s) = 0.5(1 - exp(-20)) M (closed form, rel 10⁻⁶)passed

    final_mol_per_L.A= 0.5, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    mass_balance_drift_rel= lockedexact match
  8. r0008Robertson (1966) stiff test A → B (0.04), 2B → C + B (3 × 10⁷), B + C → A + C (10⁴) at t = 40 s: y₁ = 0.7158270687, y₂ = 9.185534765 × 10⁻⁶, y₃ = 0.2841637457, from an independent fixed-grid 3-stage Radau IIA integration in plain Python that agrees to 13 digits at three step sizes (packs/science2/refs/reaction_network_robertson.py) and matches the 7 digits usually quoted for this benchmark; rel 10⁻⁶ covers the adaptive integrator's accumulated errorpassed

    final_mol_per_L.A= 0.715827, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    final_mol_per_L.B= 9.185535 × 10⁻⁶, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    final_mol_per_L.C= 0.284164, within 1.000000 × 10⁻⁶ relativereading not recorded on this page
    conserved.0.drift_relat most 1.000000 × 10⁻⁹reading not recorded on this page
8 of 8 cases passed · sandbox macos-seatbeltrecorded from the kernel in a fresh lab

Each line is one reading the kernel checked. The bright band is the tolerance; the needle is the value the instrument actually returned when it was admitted. A needle near the centre line used little of its tolerance.

Inputs

NameUnitDefaultMeaning
networkA -> B; k = 2 B -> C; k = 1Reactions and their rate constants, separated by ';' or new lines. One way: 'A + B → C; k = 0.5'. Both ways: 'N₂O₄ ≤> 2 NO₂; kf = 4; kr = 1'. Source '0 → A', sink 'A → 0'. Whole coefficients 1 to 6; at most 40 species and 200 one-way steps; '#' starts a comment. k is in (mol/L)^(1-order)/s, order = sum of the reactant coefficients.
initial{"A": 1.0}Starting concentration of each species in mol/L (0 to 10⁶); species left out start at 0.
t_end_ss10.0Length of the run.
n_out1201Rows of the history written to out/concentrations.csv (equal intervals, end points included).
rel_tol11e-09Relative error allowed per step.
abs_tol_mol_per_Lmol/L1e-12Concentrations below this are not resolved.
formulasfalseRead species names as plain formulas (H₂O, N₂O₄, CH₃OH; no brackets or charges) and check that every reaction balances its atoms and that the atom totals stay put.
compositionAtoms of each species, for an atom balance with names that are not formulas: {"E": {"X": 1}, "ES": {"X": 1, "S": 1}}. Overrides formulas.

Readings

NameUnitMeaning
ok1No negative concentration beyond the tolerance, no conserved total drifting by more than both 10⁻⁸ of its size and abs_tol times its coefficient sum, every reaction balances its atoms.
warnings1
species1
n_species1
n_reactions1One-way steps; a reversible reaction counts twice.
reactionsk is in (mol/L)^(1-order)/s.
t_end_ss
initial_mol_per_L
final_mol_per_L
final_rate_mol_per_L_per_s
half_life_sFirst time a species falls to half its starting concentration; null if it never does or starts at 0.
peak_time_sTime of the largest concentration: an interior maximum, the start, or the end.
peak_mol_per_L
peak_kind1
maxima_sEvery interior maximum of each species.
species_table
conservedInteger combinations of concentrations no reaction changes (computed from the stoichiometric matrix).
mass_balance_drift_rel1Largest drift of a conserved total or atom total over the run, relative to its size; null if there is none to check.
mass_balance_drift_mol_per_Lmol/LLargest absolute drift of a conserved total or atom total over the run.
atoms
atoms_balanced1
steady1The largest net rate times t_end is below 10⁻⁶ of the total concentration.
residual_rate_per_s1/s
stiffness_index1Largest row sum of |Jacobian| times t_end over the output grid: above ~10³ an explicit method would struggle.
most_negative_mol_per_Lmol/L
n_steps1
n_rejected1
files1out/concentrations.csv (t_s and one column per species, mol/L), out/species.csv (one row per species).

Try the call

Change a value and the command updates. Nothing runs here; paste it into your terminal or give it to your agent.

Terminal
MCP call