tpt-science

Rust

Rust 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.

0 stars0 forks0 watchers1 open issuesApache License 2.0
astrodynamicsclimate-modelingcomputational-biologycomputational-fluid-dynamicscomputational-physicsdensity-functional-theorydifferential-equationselectrophysiologyhemodynamicsmolecular-dynamicsnumerical-methodspdeprobabilistic-programmingquantum-simulationrustscientific-computingsimulationtomography

Languages

Rust100.0%
README

tpt-science

CI license: MIT OR Apache-2.0

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.

Not yet published to crates.io. These crates are consumed as workspace/path dependencies (publish = false); there is no v0.1.0 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.

CrateDomainStatusWrap / buildNotes
tpt-sci-odedifferential-equationsimplementedbuild from scratchfrom-scratch ODE engine (diffsol is dev-only oracle); depends on tpt-math-numeric
tpt-sci-gridpdeimplementedbuild from scratchdepends on tpt-math-linalg
tpt-sci-sim-coresimulationimplementedbuild from scratchdepends on tpt-sci-ode, tpt-sci-grid
tpt-sci-pplprobabilistic-programmingimplementedbuild from scratch (NUTS)consolidates tpt-augur; nuts-rs wrap dropped
tpt-sci-imageimagingimplementedbuild from scratchdepends on tpt-math-signal-fft, tpt-math-linalg; 2-D CT only
tpt-sci-physics-rigidphysicsimplementedbuild from scratchrapier disqualified (ADR 0007)
tpt-sci-quantumquantumimplementedbuild from scratchQuantRS2 disqualified (ADR 0007); ≤20 qubits; tensor-product (Kronecker) circuit formulation via Circuit
tpt-sci-astroastrodynamicsimplementedbuild from scratchtwo-body / Keplerian only
tpt-sci-reaction-networksystems-biologyimplementedbuild from scratchCatalyst.jl-style species/rate/stoichiometry DSL → mass-action ODE; depends on tpt-sci-ode; DSL + custom rate laws; SSA/SBML out of v1
tpt-sci-mdmolecular-dynamicsimplementedbuild from scratchdepends on tpt-math-linalg; LJ / Verlet / RDF
tpt-sci-dft-classicalmaterialsimplementedwrap feos (feos-dft)classical/soft-matter DFT (PC-SAFT), MIT OR Apache-2.0
tpt-sci-kineticschemical-kineticsimplementedbuild from scratchdepends on tpt-sci-reaction-network; Arrhenius + Langmuir–Hinshelwood
tpt-sci-cfd-corefluid-dynamicsimplementedbuild from scratchdepends on tpt-math-linalg; 2-D incompressible Navier–Stokes
tpt-sci-hemodynamicsbiomechanicsimplementedbuild from scratchdepends on tpt-sci-cfd-core, tpt-sci-ode; 1-D compliant vessels
tpt-sci-electrophysbiomechanicsimplementedbuild from scratchdepends on tpt-sci-ode, tpt-sci-grid; Hodgkin–Huxley + bidomain
tpt-sci-climateearth-scienceimplementedbuild from scratchdepends on tpt-sci-ode, tpt-math-linalg; 0-D EBM
tpt-sci-oceanearth-scienceimplementedbuild from scratchdepends on tpt-sci-cfd-core; 2-D shallow-water
tpt-sci-dft-electronicmaterialsimplementedbuild from scratch1-D Kohn–Sham LDA; scoped per spec2.txt audit

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.

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 via rust-version in [workspace.package]).
  • Toolchain: fixed by rust-toolchain.toml via rustup.

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 crate ships a runnable examples/ program that is meatier than the README snippet — a good first place to see the API in action:

CrateExampleDemonstrates
tpt-sci-odevan_der_polVan der Pol limit cycle + dense trajectory (solve_dense)
tpt-sci-quantumbell_ghzBell/GHZ states + measurement statistics
tpt-sci-reaction-networksirFull SIR run, peak-infected tracking
tpt-sci-griddiffusion1-D diffusion of a Gaussian bump on a uniform grid
tpt-sci-sim-coremulti_scale_cookbookSIR → diffusion cross-scale coupling (composes reaction-network + grid)
tpt-sci-pplposteriorNUTS posterior + R-hat / ESS / divergence diagnostics
tpt-sci-imagereconstructionParallel-beam CT of a phantom (FBP)
tpt-sci-physics-rigidcollisionSpheres under gravity + walls, elastic collisions
tpt-sci-astropropagationLEO propagation + J2 RAAN regression
tpt-sci-mdlennard_jonesLJ fluid: velocity-Verlet trajectory + RDF
tpt-sci-dft-classicaladsorptionPC-SAFT density-profile solve (wrapped feos)
tpt-sci-kineticsreactorArrhenius + Langmuir–Hinshelwood, ODE via tpt-sci-ode
tpt-sci-cfd-corecavityLid-driven cavity, divergence-free projection
tpt-sci-hemodynamicsarterial_segmentCompliant vessel area/flow over a cardiac cycle
tpt-sci-electrophysap_waveAction-potential propagation across a tissue sheet
tpt-sci-climatewarming0-D EBM CO₂-doubling equilibrium warming
tpt-sci-oceanshallow_waterShallow-water gravity-wave propagation
tpt-sci-dft-electronicharmonic_atom1-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. criterion benches live in crates/*/benches/: tpt-sci-ode (solve), tpt-sci-grid (laplacian), tpt-sci-quantum (apply_gate), and tpt-sci-image (radon) — every crate now ships a representative Criterion suite. Run a single crate with cargo bench -p <crate>, or the whole workspace with cargo bench --workspace. The CI benches job 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 coverage job produces an lcov report via cargo-llvm-cov and uploads it as a build artifact.
  • Docs. The CI doc job builds docs with RUSTDOCFLAGS=-D warnings, catching rustdoc warnings and broken intra-doc links (doctests are exercised by cargo 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.