From a86356980a873852b4f930a2ce95174e17b0f69e Mon Sep 17 00:00:00 2001 From: Holger Vogt Date: Fri, 3 Jul 2026 14:11:02 +0200 Subject: [PATCH] enable removal of dangling nodes also when MODETRANOP is set. Removes singular nodes when op before tran is run. --- src/spicelib/devices/cap/capload.c | 31 +++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/spicelib/devices/cap/capload.c b/src/spicelib/devices/cap/capload.c index e0dcecb7a..0079d3ecc 100644 --- a/src/spicelib/devices/cap/capload.c +++ b/src/spicelib/devices/cap/capload.c @@ -49,20 +49,25 @@ CAPload(GENmodel *inModel, CKTcircuit *ckt) vcap = *(ckt->CKTrhsOld+here->CAPposNode) - *(ckt->CKTrhsOld+here->CAPnegNode) ; } + + if (here->CAPdangling) { + /* Topology reduction: this cap hangs on a + * floating (degree-1) node. Remove it from the system: + * pin the floating node(s) with a unit diagonal so the + * matrix stays nonsingular, and contribute no charge or + * current. This eliminates the spurious LTE pressure + * that otherwise drives "Timestep too small" at the + * dangling node (set in CKTtopologyReduce()). */ + if (here->CAPdangling & 1) + *(here->CAPposPosPtr) += 1.0; + if (here->CAPdangling & 2) + *(here->CAPnegNegPtr) += 1.0; + *(ckt->CKTstate0+here->CAPqcap) = 0.0; + continue; + } + if(ckt->CKTmode & (MODETRAN | MODEAC)) { - if (here->CAPdangling) { - /* Topology reduction: this cap hangs on a - * floating (degree-1) node. Remove it from the system: - * pin the floating node(s) with a unit diagonal so the - * matrix stays nonsingular, and contribute no charge or - * current. This eliminates the spurious LTE pressure - * that otherwise drives "Timestep too small" at the - * dangling node (set in CKTtopologyReduce()). */ - if (here->CAPdangling & 1) *(here->CAPposPosPtr) += 1.0; - if (here->CAPdangling & 2) *(here->CAPnegNegPtr) += 1.0; - *(ckt->CKTstate0+here->CAPqcap) = 0.0; - continue; - } + #ifndef PREDICTOR if(ckt->CKTmode & MODEINITPRED) { *(ckt->CKTstate0+here->CAPqcap) =