From ca0cb1322af8e6f250aec75eb0253a58b2396cb3 Mon Sep 17 00:00:00 2001 From: Tim Edwards Date: Fri, 17 Mar 2023 20:47:08 -0400 Subject: [PATCH] A couple of corrections to the last commit, where the equation for computing the amount of fringe shielding was wrong. This fixes one of my example cases, but not the other one, so I still need to pin down a condition that can result in negative capacitance. --- commands/CmdE.c | 4 ++-- extract/ExtCouple.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/CmdE.c b/commands/CmdE.c index 6f9f7912..0054fdf7 100644 --- a/commands/CmdE.c +++ b/commands/CmdE.c @@ -1085,9 +1085,9 @@ CmdExtract(w, cmd) /* argv[2] is a halo distance */ dist = cmdParseCoord(w, argv[2], TRUE, TRUE); - if (dist <= 0) + if (dist < 0) { - TxError("Bad halo distance. Halo must be strictly positive."); + TxError("Bad halo distance. Halo must be non-negative."); return; } else diff --git a/extract/ExtCouple.c b/extract/ExtCouple.c index c4c433c1..f883d88e 100644 --- a/extract/ExtCouple.c +++ b/extract/ExtCouple.c @@ -1180,7 +1180,7 @@ extSideOverlapHalo(tp, esws) } if (rtp != rbp) { - efflength = (cfrac * (double)length) * (1.0 - sov.so_coupfrac); + efflength = (cfrac - sov.so_coupfrac) * (double)length; cap += e->ec_cap * efflength; subfrac += sov.so_subfrac; /* Just add the shielded fraction */ @@ -1209,7 +1209,7 @@ extSideOverlapHalo(tp, esws) if (DBIsContact(outtype)) outtype = DBPlaneToResidue(outtype, esws->plane_of_boundary); - efflength = (sfrac * (double)length) * (1.0 - subfrac); + efflength = (sfrac - subfrac) * (double)length; subcap = ExtCurStyle->exts_perimCap[ta][0] * efflength; rbp->nreg_cap -= subcap; /* Ignore residual error at ~zero zeptoFarads. Probably */