openmaterials.ai / codes / ngspice
The open-source successor of Berkeley Spice3f5, merged with the XSPICE code models and the CIDER device simulator, that solves DC, AC and transient analyses of a netlist.
ngspice solves analog nodes iteratively from Kirchhoff's laws with a sparse matrix at each time point. Digital nodes propagate events in the same executable, a native mixed-mode simulator (ngspice manual 47).
DC operating point and sweep (.op, .dc), AC small-signal (.ac), transient (.tran), pole-zero, small-signal distortion, sensitivity and noise (ngspice manual 47).
Gummel-Poon bipolar models including VBIC, diodes, JFET and JFET2, the six original MOSFET levels, BSIM3, BSIM4, BSIMSOI, plus Verilog-A via OpenVAF (ngspice manual 47).
Code model instances start with A and take a .MODEL card (ngspice manual 47). Over 60 functional blocks and a 12-state digital type (ngspice XSPICE page).
Sparse 1.3 is the default and is required for noise and CIDER. option klu selects KLU for large MOS circuits with thousands of transistors (ngspice manual 47).
Built as .so or .dll, ngspice takes a netlist from a host program, runs in its own thread and calls back at each time point. KiCad uses it (ngspice shared page).
Title line, element cards (R, C, M, X), .model cards, analysis lines such as .op or .tran.
osdi model.osdi for OpenVAF-compiled Verilog-A. spinit loads the .cm code model libraries.
ngspice netlist.cir, or with -b for batch mode, or from a host via the shared library.
print, plot and wrdata write the vectors. option numdgt sets the significant digits.