A programmable SPICE engine for C++, Python, and your browser.
Open Circuit Lab · Documentation · Roadmap
neospice is an open-source C++20 circuit simulator based on Berkeley SPICE3 and ngspice. Build circuits through simple APIs, run parallel studies, and use the results in your design tools.
It runs about 2× faster than ngspice 47 on our 34-workload paired benchmark (2.03× geometric mean; faster on all 34 in the release run), with every timed result checked against ngspice's output. Benchmark details.
Try Circuit Lab to draw and simulate circuits locally in your browser without installation.
Make circuit simulation easy to embed, automate, and extend. The long-term goal is one unified simulator for analog, digital, and mixed-signal circuits, with shared APIs and circuit data.
The SPICE engine provides the foundation for additional simulation methods, device models, and interactive design tools.
- Analyses: DC operating point and sweeps, transient, AC, noise, transfer function, sensitivity, pole-zero, Fourier/THD, and measurements.
- Devices: passives, sources, switches, transmission lines, diodes, BJTs, JFETs, MES/HFET models, MOS1/2/3/9, BSIM, HiSIM, and VDMOS DC models.
- Netlists: parameters, expressions, functions, subcircuits, model libraries,
waveforms,
.step,.measure, and SPICE raw output. - Automation: parallel sweeps, seeded Monte Carlo, DC adjoint gradients, linear AC gradients, and incremental DC/AC simulation.
- Circuit Lab: schematic editing, nine example circuits, waveform plots, voltage/current probes, parameter controls, saved projects, and CSV export.
See the capabilities guide for model and API details.
neospice combines typed APIs, parallel studies, and browser simulation in one project.
| Area | neospice | ngspice |
|---|---|---|
| C++ and Python | Typed circuit objects, NumPy results, and gradient APIs | Shared-library API with callbacks and wrappers such as PySpice |
| Parallel studies | Built-in sweeps and seeded Monte Carlo through one API | Multiple library instances managed by a host application |
| Interactive design | Circuit Lab runs locally in your browser | CLI and control scripts, plus external GUIs such as KiCad |
| Device extensions | Modular C++20 device interface | Compiled Verilog-A models through OSDI |
| Recorded benchmark | About 2× faster (2.03× geometric mean across 34 workloads) | ngspice 47 reference timing |
neospice is about 2× faster than ngspice 47. The October 15, 2026 release benchmark (30 paired samples per workload) measured a 2.03× geometric-mean speedup across 34 workloads, and neospice had the lower median time in all 34 cases. Every timed run must match ngspice's output within the documented error thresholds. Speedups range from 1.01× on a mid-size AC grid to 13.9× on the largest DC mesh.
See benchmark results and methods for the recorded code, timings, and test conditions.
Our verification harness compares neospice with ngspice 47 at several levels:
- Devices and circuits: DC, sweeps, AC, transient waveforms, and noise.
- Model libraries: 34,908 generated KiCad cases, with results and diagnostics for each case.
- Browser: Circuit Lab examples at their default settings and current probes.
- Performance: numerical checks for every measured pair.
Analytical tests provide independent checks. Regression tests preserve reproduced failures and check fixes. See the harness guide and support matrix.
In the recorded sanitizer run, all reported leaks came from ngspice library paths. The report attributed none to neospice.
python -m pip install neospiceimport neospice as ns
circuit = ns.Circuit()
circuit.V("V1", "in", "0", 10.0)
circuit.R("R1", "in", "out", 1000.0)
circuit.R("R2", "out", "0", 1000.0)
result = ns.Simulator().run_dc(circuit)
print(result.voltage("out")) # 5.0The APIs also accept SPICE netlists. See the API guide or the C++ and CLI build guide.
Near-term work expands model coverage, improves speed, and develops the APIs and Circuit Lab. The path toward a unified simulator adds piecewise-linear simulation, digital events, mixed-signal coordination, and Verilog-A models. Further plans include streaming results, GPU support, and learned convergence hints. See the roadmap.
Read the documentation and contribution guide. Contributions to models, APIs, tests, examples, and documentation are welcome. Include a minimal netlist and reproduction steps with bug reports.
Original contributions use the MIT license. Derived code retains its upstream notices and terms. Credits include Berkeley SPICE3, ngspice, Sparse 1.3, SuiteSparse, OpenBLAS, and SLEEF. See CREDITS.md and NOTICE.