tpt-science
RustRust simulation & modeling substrate for science verticals: ODE/DAE, structured-grid PDE, multi-scale orchestration, probabilistic programming (NUTS), rigid-body physics, quantum state-vector sim, 2-D CT imaging, astrodynamics, and reaction-network DSL. Dual-licensed MIT OR Apache-2.0.
Languages
tpt-science
Simulation and modeling substrate for the TPT Solutions science verticals: differential equations, structured-grid PDE, multi-scale simulation orchestration, probabilistic programming, rigid-body physics, quantum simulation, tomographic imaging, and astrodynamics.
Dual-licensed under MIT or Apache-2.0.
Partially published to crates.io. The 18 simulation crates are on crates.io at
0.1.0. The umbrellatpt-sci,tpt-sci-units, and the tooling/binding crates (tpt-sci-cli,tpt-sci-wasm,tpt-sci-py) are not yet published and are consumed as git or path dependencies. There is nov0.1.0git tag yet. APIs are unstable until the first tagged release.
Status
This repo is scaffolded from tpt-rust-map/template/. Build order and crate
scope follow todo.md and spec.txt. Per tpt-rust-map/TODO.md, each crate's
own flagged-needs-audit / flagged-deferred status is resolved before that
crate is implemented — Phase 1 (scaffolding) does not require those audits.
| Crate | Domain | Status | Wrap / build | Notes |
|---|---|---|---|---|
tpt-sci-ode | differential-equations | implemented | build from scratch | from-scratch ODE/DAE engine (Tsit45, TR-BDF2, ESDIRK34, variable-order BDF); dense + sparse LU; forward sensitivities; f32/f64; optional Cranelift JIT (cranelift-jit); diffsol is a dev-only oracle |
tpt-sci-grid | pde | implemented | build from scratch | 1-D/2-D/3-D finite-difference grids; dense and sparse (CSR) Laplacians; depends on tpt-math-linalg |
tpt-sci-sim-core | simulation | implemented | build from scratch | multi-scale orchestration, ODE and diffusion sub-models, cross-scale coupling, checkpoints; depends on tpt-sci-ode, tpt-sci-grid |
tpt-sci-ppl | probabilistic-programming | implemented | build from scratch (NUTS) | consolidates tpt-augur; nuts-rs wrap dropped; R-hat, ESS, divergence-rate diagnostics via Trace |
tpt-sci-image | imaging | implemented | build from scratch | 2-D parallel-beam CT, 3-D volume CT, and cone-beam FDK; depends on tpt-math-signal-fft, tpt-math-linalg |
tpt-sci-physics-rigid | physics | implemented | build from scratch | rigid bodies with quaternion orientation, Coulomb friction, sweep-and-prune broad phase; rapier disqualified (ADR 0007) |
tpt-sci-quantum | quantum | implemented | build from scratch | state-vector (≤20 qubits) and density-matrix paths with Kraus noise channels; QuantRS2 disqualified (ADR 0007) |
tpt-sci-astro | astrodynamics | implemented | build from scratch | Keplerian two-body; J2/J4 secular rates; atmospheric drag; third-body (Kozai-Lidov); solar radiation pressure |
tpt-sci-reaction-network | systems-biology | implemented | build from scratch | Catalyst.jl-style DSL → mass-action ODE; exact SSA, tau-leaping/CLE, minimal SBML reader, conservation laws; SDE/jump out of scope |
tpt-sci-md | molecular-dynamics | implemented | build from scratch | Lennard-Jones and EAM; direct-sum Ewald; SHAKE/RATTLE constraints; cell lists; RDF; depends on tpt-math-linalg |
tpt-sci-dft-classical | materials | implemented | wrap feos (feos-dft) | PC-SAFT classical/soft-matter DFT via feos; from-scratch square-gradient solver in 1-D and 3-D; MIT OR Apache-2.0 |
tpt-sci-kinetics | chemical-kinetics | implemented | build from scratch | depends on tpt-sci-reaction-network; Arrhenius, Langmuir–Hinshelwood (multi-site), Eley–Rideal, coverage-dependent activation |
tpt-sci-chemoinformatics | cheminformatics / QSPR | implemented (v0.1, unpublished) | build from scratch | SMILES parser, molecular descriptors, Morgan fingerprints, ridge + Tanimoto-kNN QSPR; TRPA1/TRPV1 model needs user-supplied curated data (demo set is illustrative only) |
tpt-sci-cfd-core | fluid-dynamics | implemented | build from scratch | depends on tpt-math-linalg; incompressible Navier–Stokes with explicit and SIMPLE schemes, k-ε/k-ω SST, unstructured FVM/FEM |
tpt-sci-hemodynamics | biomechanics | implemented | build from scratch | depends on tpt-sci-cfd-core, tpt-sci-ode; 1-D compliant vessel network, Womersley flow, Windkessel 0-D/1-D/3-D coupling |
tpt-sci-electrophys | biomechanics | implemented | build from scratch | depends on tpt-sci-ode, tpt-sci-grid; Hodgkin–Huxley and Ten Tusscher ionic models, anisotropic tensor diffusion, bidomain |
tpt-sci-climate | earth-science | implemented | build from scratch | depends on tpt-sci-ode, tpt-math-linalg; 0-D EBM, multi-band and correlated-k radiative transfer, 3-D tracer transport, primitive-equation GCM |
tpt-sci-ocean | earth-science | implemented | build from scratch | depends on tpt-sci-cfd-core; 2-D shallow water, 3-D z-level ocean with non-hydrostatic projection, nudging, EnKF, 3D-Var-lite |
tpt-sci-dft-electronic | materials | implemented | build from scratch | Kohn–Sham in 1-D and 3-D real space; LDA and PBE; norm-conserving local pseudopotentials; periodic k-point band structure (1-D) |
tpt-sci | umbrella | implemented | re-export | one dependency; every domain crate behind a feature (default: ode, grid, sim-core; full: all) |
tpt-sci-units | shared | implemented | build from scratch | typed SI quantities and physical constants (gas constant, Stefan–Boltzmann, Earth's μ) used by kinetics, climate and astro |
tpt-sci-cli | tooling | implemented | build from scratch | tpt-sci command: runs reaction-network JSON specs and writes CSV |
tpt-sci-wasm | bindings | implemented | wasm-bindgen | WebAssembly exports (run_spec, EBM, CT, lid-driven cavity) plus a browser playground |
tpt-sci-py | bindings | implemented | PyO3 / maturin | Python bindings; excluded from the Cargo workspace so CI does not link libpython |
Choose your crate
Start from the question you are trying to answer, then follow the crate.
| If you want to… | Start with | Then |
|---|---|---|
| Solve an ODE / DAE system | tpt-sci-ode | tpt-sci-reaction-network if the system is a chemical or compartmental network |
| Model a reaction network (mass-action, SSA, tau-leaping, SBML) | tpt-sci-reaction-network | tpt-sci-ode for deterministic runs |
| Solve a PDE on a regular grid | tpt-sci-grid | tpt-sci-sim-core to couple it to ODE sub-models |
| Run several models at different scales together | tpt-sci-sim-core | tpt-sci-ode, tpt-sci-grid |
| Fit parameters to data (Bayesian, NUTS) | tpt-sci-ppl | tpt-sci-ode for ODE-based likelihoods |
| Reconstruct images from projections (CT) | tpt-sci-image | tpt-sci-grid for the underlying geometry |
| Simulate rigid bodies and collisions | tpt-sci-physics-rigid | tpt-sci-astro for orbital motion |
| Simulate qubits or noisy quantum circuits | tpt-sci-quantum | — |
| Orbital mechanics and perturbations | tpt-sci-astro | tpt-sci-ode for custom force models |
| Molecular dynamics of a particle system | tpt-sci-md | tpt-sci-dft-classical for interfacial density profiles |
| Classical / soft-matter DFT (adsorption, surface tension) | tpt-sci-dft-classical | tpt-sci-kinetics for surface reactions |
| Surface or reactor kinetics | tpt-sci-kinetics | tpt-sci-reaction-network for the underlying CRN |
| Incompressible flow | tpt-sci-cfd-core | tpt-sci-ocean for geophysical flows |
| Blood flow in vessel networks | tpt-sci-hemodynamics | tpt-sci-cfd-core for 3-D coupling |
| Cardiac / neural excitation | tpt-sci-electrophys | tpt-sci-hemodynamics for coupled physiology |
| Climate or atmospheric chemistry | tpt-sci-climate | tpt-sci-ocean for coupled ocean–atmosphere work |
| Ocean circulation or data assimilation | tpt-sci-ocean | tpt-sci-cfd-core for the solver substrate |
| Electronic structure (Kohn–Sham) | tpt-sci-dft-electronic | tpt-sci-md for classical atomistic work |
Suggested tutorial path
- Foundations:
tpt-sci-ode(van_der_pol) →tpt-sci-grid(diffusion). - Coupling:
tpt-sci-reaction-network(sir) →tpt-sci-sim-core(multi_scale_cookbook). - Inference:
tpt-sci-ppl(posterior). - Applied domains: pick one of
tpt-sci-image,tpt-sci-astro, ortpt-sci-cfd-core; each crate's README lists its own scope and limits.
The per-crate examples/ directories are the runnable reference; the
Examples table below lists them.
no_std posture
All crates in this pillar are std-only by design. The tpt-math dense
linear-algebra substrate and tpt-sci-ode (which implements its own ODE engine
from scratch) are themselves std crates, so every simulation/physics/quantum
crate transitively requires std. None currently target no_std.
Per ADR 0001, no_std is opted into per-crate, never forced workspace-wide: the
CI no_std job is an intentional no-op until a crate is explicitly confirmed
no_std and built with -p <crate> against thumbv6m-none-eabi. See
CHANGELOG.md for the per-crate audit table.
Depending on the crates
The 18 simulation crates are on crates.io at 0.1.0, so add them directly:
[dependencies]
tpt-sci-ode = "0.1"
tpt-sci-grid = "0.1"
The umbrella crate tpt-sci is not on crates.io yet. Depend on it through git,
pinned to a commit (no release tag exists yet):
[dependencies]
tpt-sci = { git = "https://github.com/tpt-solutions/tpt-science", rev = "<commit>", features = ["full"] }
Once v0.1.0 is cut from master (steps in RELEASE.md), tag = "v0.1.0"
can replace rev. The tpt-math-* substrate is resolved from crates.io, so no
sibling checkout is needed.
Building
This workspace depends on the tpt-math
substrate (tpt-math-numeric, tpt-math-linalg, tpt-math-signal-fft),
resolved as regular versioned dependencies from crates.io — no sibling checkout needed:
git clone https://github.com/tpt-solutions/tpt-science.git
cd tpt-science
cargo build --workspace
cargo test --workspace
- Edition:
2024. - MSRV:
1.85(pinned viarust-versionin[workspace.package]). - Toolchain: fixed by
rust-toolchain.tomlviarustup.
Quickstart
use tpt_sci_ode::{OdeProblem, Method};
// dy/dt = -y -> y(t) = y0 * exp(-t)
let prob = OdeProblem::new(|_t, y, dydt| dydt[0] = -y[0], vec![1.0], 0.0).unwrap();
let y = prob.solve(Method::Bdf, 1.0).unwrap();
assert!((y[0] - std::f64::consts::E.recip()).abs() < 1e-6);
See the crate READMEs for the full API:
tpt-sci-ode,
tpt-sci-grid,
tpt-sci-sim-core,
tpt-sci-ppl,
tpt-sci-image,
tpt-sci-physics-rigid,
tpt-sci-quantum,
tpt-sci-astro,
tpt-sci-reaction-network,
tpt-sci-md,
tpt-sci-dft-classical,
tpt-sci-kinetics,
tpt-sci-cfd-core,
tpt-sci-hemodynamics,
tpt-sci-electrophys,
tpt-sci-climate,
tpt-sci-ocean,
tpt-sci-dft-electronic.
Examples
Every simulation crate ships a runnable examples/ program that is meatier than
the README snippet — a good first place to see the API in action:
| Crate | Example | Demonstrates |
|---|---|---|
tpt-sci-ode | van_der_pol | Van der Pol limit cycle + dense trajectory (solve_dense) |
tpt-sci-quantum | bell_ghz | Bell/GHZ states + measurement statistics |
tpt-sci-reaction-network | sir | Full SIR run, peak-infected tracking |
tpt-sci-grid | diffusion | 1-D diffusion of a Gaussian bump on a uniform grid |
tpt-sci-sim-core | multi_scale_cookbook | SIR → diffusion cross-scale coupling (composes reaction-network + grid) |
tpt-sci-ppl | posterior | NUTS posterior + R-hat / ESS / divergence diagnostics |
tpt-sci-image | reconstruction | Parallel-beam CT of a phantom (FBP) |
tpt-sci-physics-rigid | collision | Spheres under gravity + walls, elastic collisions |
tpt-sci-astro | propagation | LEO propagation + J2 RAAN regression |
tpt-sci-md | lennard_jones | LJ fluid: velocity-Verlet trajectory + RDF |
tpt-sci-dft-classical | adsorption | PC-SAFT density-profile solve (wrapped feos) |
tpt-sci-kinetics | reactor | Arrhenius + Langmuir–Hinshelwood, ODE via tpt-sci-ode |
tpt-sci-cfd-core | cavity | Lid-driven cavity, divergence-free projection |
tpt-sci-hemodynamics | arterial_segment | Compliant vessel area/flow over a cardiac cycle |
tpt-sci-electrophys | ap_wave | Action-potential propagation across a tissue sheet |
tpt-sci-climate | warming | 0-D EBM CO₂-doubling equilibrium warming |
tpt-sci-ocean | shallow_water | Shallow-water gravity-wave propagation |
tpt-sci-dft-electronic | harmonic_atom | 1-D Kohn–Sham solve of a two-electron well |
sim-core also ships decay_coupled (ODE↔diffusion coupling + checkpoint).
Run any of them with, e.g.:
cargo run --example van_der_pol -p tpt-sci-ode
Benchmarking & coverage
- Benchmarks.
criterionbenches live incrates/*/benches/:tpt-sci-ode(solve),tpt-sci-grid(laplacian),tpt-sci-quantum(apply_gate), andtpt-sci-image(radon) — each of the 18 simulation crates ships a representative Criterion suite. Run a single crate withcargo bench -p <crate>, or the whole workspace withcargo bench --workspace. The CIbenchesjob runs a shortened measurement so the suite stays fast:cargo bench --workspace --benches -- --warm-up-time 0.5 --measurement-time 1 --sample-size 10. - Coverage. The CI
coveragejob produces an lcov report viacargo-llvm-covand uploads it as a build artifact. - Docs. The CI
docjob builds docs withRUSTDOCFLAGS=-D warnings, catching rustdoc warnings and broken intra-doc links (doctests are exercised bycargo test).
See RELEASE.md for the (currently dormant) publish/versioning process.
Changelogs
Each crate keeps its own CHANGELOG.md (initial v0.1.0 entry plus an
[Unreleased] section): see e.g.
crates/tpt-sci-ode/CHANGELOG.md. The
workspace-level CHANGELOG.md tracks cross-cutting changes.
License
Licensed under either of MIT or Apache-2.0 at your option.
Copyright (c) 2026 TPT Solutions.