Dune
SPICE, reborn in Rust. Dune is a faithful rewrite of Berkeley's SPICE3f5 circuit simulator: the same netlists, the same defaults, the same numbers — validated circuit by circuit against ngspice — with a clean engine you can call from Python, R, JavaScript or C.
Site: milkway.github.io/dune · Examples gallery — every corpus circuit, simulated · Known differences
What's inside
- Every SPICE3f5 device and analysis: R C L K, V/I sources, E F G H,
diode, BJT (Gummel–Poon), MOS levels 1–6, BSIM1/2, JFET, MESFET,
switches, ideal and lossy (LTRA) transmission lines,
.subckt— and.OP .DC .AC .TRAN .PZ .NOISE .DISTO .TF .SENS. Plus BSIM3v3 and S-parameter analysis (.sp) from modern ngspice. - Oracle-tested: nothing ships until every corpus circuit matches
pinned ngspice-47 goldens point by point, at SPICE's own tolerances
(
reltol/abstol/vntol). Deliberate divergences are documented incorpus/KNOWN_DIFFS.md, each behind a measured gate. - Schematics in, waveforms out: Dune reads figures written in
rpic's pic language and extracts runnable decks
(
dune pic figure.pic); the same engine powers the Simulate panel in rpic Studio, all client-side WebAssembly. - Rawfiles in SPICE3's own binary and ASCII formats, so existing viewers read them unchanged.
- Opt-in robust transient (
.options method=trbdf2): an L-stable TR-BDF2 integrator for decks the classic trapezoidal rule rings on. The faithful behavior stays byte-identical by default.
Install
# Python — PyPI (polars DataFrames, zero-copy numpy; module `import spice`)
# JavaScript / WebAssembly — npm (runs in the browser)
# R — tidy tibbles (CRAN submission planned)
# Rust library — crates.io (dune-netlist, dune-raw, dune-core, dune-pic)
# CLI — from source (Rust 1.88+)
&& &&
The Rust crates are 0.x: the public API of dune-core may change
between minor versions.
=
# polars DataFrame: time, v(in), v(out)…
Repository layout
| Path | What |
|---|---|
crates/dune-core |
The engine: devices, analyses, solver |
crates/dune-netlist |
SPICE3f5-faithful netlist parser |
crates/dune-raw |
Rawfile reader/writer |
crates/dune-pic |
Netlist extraction from pic figures |
crates/dune-cli |
The dune command |
crates/dune-wasm |
WebAssembly bindings (@strategicprojects/dune-sim) |
crates/dune-ffi |
C ABI |
python/, r/ |
The spice3 (PyPI) and spice (R) packages |
corpus/ |
SPICE3f5 sources (the reference), test decks, ngspice goldens |
site/ |
The website and examples gallery |
License
BSD-3-Clause — © 2026 André Leite; portions derived from SPICE3f5, © 1985–1991 The Regents of the University of California. See LICENSE.