As discussed in #883, here are the other issues the AC/DC check found, as one patch series against pre-master-48 (f127e96).
The check is simple: at low frequency, a circuit's AC transfer should equal the derivative of its DC solution, so I compare the two (central differences at two step sizes) and trace any disagreement to the model code. The patches, in the order they apply:
Each commit message gives the symptom, the cause and the fix. Each patch also adds its own test to make check, with its .out file: tests/xspice/analog for the code models (its spinit now loads analog.cm as well) and tests/regression/model for the built-in devices.
The #883 fix comes first, so it's attached again. Patch 13 touches the Visual Studio project files, which keep CRLF line endings, so please apply with --keep-cr:
git am --keep-cr 0001-Fix-switch-AC-current-Jacobians-v2.patch
git am --keep-cr ngspice-ac-dc-series.mbox
How I checked it: on fresh clones of pre-master-48, applying the series one patch at a time, each new test fails before its patch and passes after it. With everything applied, make check passes all 72 tests (the existing 58, which include switch-ac, plus the 14 new ones). I also built the result with Visual Studio 2022 (vngspice.sln, console_release, x64; I don't have libsndfile here, so I built with the sound libraries switched off) and ran the new tests with that binary. They all pass.
The same 14 test circuits are in the attached archive, so you can try any of them on your current build before applying anything, for example ngspice -n -b reproducers/jacobian-mult-zero.cir. Each prints whether it passed and exits 0 or 1.
If any change doesn't fit how a model is meant to work, I'm happy to rework it.
The checker is here: https://github.com/Copprlab/spice-jacobian-check
Attachments: