Microkinetic networks
solve-microkinetic-network, solve-microkinetic-steady-state and extract-kinetics-diagnostics integrate a mass-action network built from HTST rates.
flowchart LR
A[Species + elementary steps] --> B[HTST forward/reverse rates]
B --> C[Mass-action derivatives]
C --> D[Adaptive RK4]
D --> E[Trace frames]
E --> F[Diagnostics]
E --> G[Steady-state check]
Network configuration
The --network option accepts inline JSON or a file path:
{
"species": ["A", "B"],
"steps": [
{
"step_id": "A->B",
"activation_free_energy_ev": 0.5,
"reaction_free_energy_ev": -0.1,
"prefactor_s_inv": null
}
],
"stoichiometry": [[[0, -1.0], [1, 1.0]]],
"initial_populations": [1.0, 0.0],
"total_time_s": 0.001,
"n_frames": 20,
"state": {"temperature_k": 298.15, "pressure_bar": 1.0}
}Stoichiometry is one list of (species_index, coefficient) pairs per step: negative for reactants, positive for products. Populations are normalized units; times are in seconds. When --network is omitted, the built-in demo A ⇌ B network is used. Species names must be non-empty and unique; the phase-portrait chart and diagnostics resolve species by ID.
On the CLI, Python and WASM surfaces, --n-steps/n_steps is the requested frame count and overrides the network document's n_frames; the direct Rust API honours n_frames from the config. extract-kinetics-diagnostics on the CLI uses 20 frames.
Integration
For each step
with HTST rates from transition-state theory. The solver uses adaptive RK4 with step control from the largest Jacobian diagonal, rejects negative populations and fails if the network is too stiff or exceeds the step limit.
Diagnostics
extract-kinetics-diagnostics reports:
| Field | Meaning |
|---|---|
is_steady_state | max_rate_of_change < 1e-10 (strict built-in threshold) |
max_rate_of_change | max |Δpopulation/Δt| between the last two frames (s⁻¹) |
max_population | largest final population |
total_population | final population sum |
mass_conservation_error | relative change of the total population |
For the built-in demo the output is
{
"is_steady_state": false,
"mass_conservation_error": 2.220446049250313e-16,
"max_population": 0.9800069400037741,
"max_rate_of_change": 7.94623340044654e-6,
"total_population": 1.0000000000000002
}Steady state
solve-microkinetic-steady-state --n-steps N --tol T propagates exactly N frames and reports converged = residual <= T. N must be at least 2 and T must be finite and strictly positive; the Python/WASM wrappers now reject N=0/1 and T=0/negative/NaN/Inf instead of silently clamping the frame count or ignoring the tolerance. The --n-steps option is not ignored; increasing it (or using a network with a longer total_time_s) reduces the residual. diagnostics.is_steady_state keeps its separate 1e-10 s⁻¹ threshold.
Example with --n-steps 200 --tol 1e-5:
{
"n_steps": 200,
"n_steps_requested": 200,
"converged": true,
"residual": 4.337207037963371e-6,
"tol": 1e-5,
"final_populations": ["..."],
"diagnostics": {"...": "..."}
}Validation and limits
- F87b: microkinetic traces match
scipy.solve_ivp. - F87c: the steady state of
A ⇌ Bhonours the equilibrium constant. - Mass-action kinetics with unit activity coefficients; no activity models, no spatial transport, no pressure-dependent rates beyond the supplied thermodynamic state, and no automatic mechanism generation.
- The network must be closed and non-negative; the integrator reports stiffness or step-limit failures instead of returning NaNs.
n_stepsmust be a finite integer>= 2on every surface. Negative, fractional,NaNor infinite counts are rejected; they are not clamped to two and cannot abort the WASM module.- Absolute populations are normalized; multiply by the physical concentration scale outside the solver if needed.
Surfaces
| Surface | Entry point |
|---|---|
| CLI | solve-microkinetic-network, solve-microkinetic-steady-state, extract-kinetics-diagnostics |
| Rust | kinetics::solve_microkinetic_network, solve_microkinetic_steady_state, extract_kinetics_diagnostics |
| Python | extract_kinetics_diagnostics, solve_microkinetic_network, solve_microkinetic_steady_state |
| WASM | extract_kinetics_diagnostics (+ _wasm alias), solve_microkinetic_network, solve_microkinetic_steady_state |