bngsim¶
Embeddable simulation engine for BioNetGen reaction networks.
bngsim is a high-performance C++ simulation kernel with Python bindings that
replaces BioNetGen’s subprocess-based run_network driver. It loads .net,
Antimony, and SBML models, runs ODE (CVODE) and stochastic (Gillespie/PSA)
simulations in-process, and returns results as NumPy arrays — no file I/O, no
subprocess spawning, no Perl dependency.
import bngsim
model = bngsim.Model.from_net_file("model.net")
sim = bngsim.Simulator(model, method="ode")
result = sim.run(t_end=100.0, n_steps=1000)
print(result.times) # (1001,) NumPy array
print(result["A"]) # trajectory of observable "A"
New here? Start with Installation and the Quickstart.
Getting started
User guide
- Loading models
- Running simulations
- Network-free simulation (NFsim & RuleMonkey)
- Working with results
- Events
- Table functions (TFUN)
- Solver configuration
- Code-generated ODE RHS
- Sensitivity analysis & gradients
- Steady-state solver
- Conservation laws & parameter scans
- Format conversion & interchange (SBML · SED-ML · OMEX)
- Use with PyBNF
Reference
About & development