/* bjt.f -- translated by f2c (version of 3 February 1990  3:36:42).
   You must link the resulting object file with the libraries:
	-lF77 -lI77 -lm -lc   (in that order)
*/

#include "f2c.h"

/* Common Block Declarations */

struct {
    integer ielmnt, isbckt, nsbckt, iunsat, nunsat, itemps, numtem, isens, 
	    nsens, ifour, nfour, ifield, icode, idelim, icolum, insize, 
	    junode, lsbkpt, numbkp, iorder, jmnode, iur, iuc, ilc, ilr, 
	    numoff, isr, nmoffc, iseq, iseq1, neqn, nodevs, ndiag, iswap, 
	    iequa, macins, lvnim1, lx0, lvn, lynl, lyu, lyl, lx1, lx2, lx3, 
	    lx4, lx5, lx6, lx7, ld0, ld1, ltd, imynl, imvn, lcvn, nsnod, 
	    nsmat, nsval, icnod, icmat, icval, loutpt, lpol, lzer, irswpf, 
	    irswpr, icswpf, icswpr, irpt, jcpt, irowno, jcolno, nttbr, nttar, 
	    lvntmp;
} tabinf_;

#define tabinf_1 tabinf_

struct {
    integer locate[50], jelcnt[50], nunods, ncnods, numnod, nstop, nut, nlt, 
	    nxtrm, ndist, ntlin, ibr, numvs, numalt, numcyc;
} cirdat_;

#define cirdat_1 cirdat_

struct {
    doublereal omega, time, delta, delold[7], ag[7], vt, xni, egfet, xmu, 
	    sfactr;
    integer mode, modedc, icalc, initf, method, iord, maxord, noncon, iterno, 
	    itemno, nosolv, modac, ipiv, ivmflg, ipostp, iscrch, iofile;
} status_;

#define status_1 status_

struct {
    doublereal twopi, xlog2, xlog10, root2, rad, boltz, charge, ctok, gmin, 
	    reltol, abstol, vntol, trtol, chgtol, eps0, epssil, epsox, pivtol,
	     pivrel;
} knstnt_;

#define knstnt_1 knstnt_

struct {
    doublereal value[200000];
} blank_;

#define blank_1 blank_

/*<       subroutine bjt >*/
/* Subroutine */ int bjt_()
{
    /* System generated locals */
    integer i_1;
    doublereal d_1, d_2, d_3;

    /* Builtin functions */
    double exp(), sqrt(), tan(), log();

    /* Local variables */
    static doublereal cbcn, cben;
#define cqbc ((doublereal *)&blank_1 + 11)
    static doublereal area;
#define cqbe ((doublereal *)&blank_1 + 9)
    static doublereal gben, gbcn, fcpe, gccs, evbc, evbe, cdis;
    static integer ioff;
    static doublereal czbe, czbc;
#define vbco ((doublereal *)&blank_1 + 1)
#define vbeo ((doublereal *)&blank_1)
#define cqcs ((doublereal *)&blank_1 + 13)
#define gpio ((doublereal *)&blank_1 + 4)
#define cqbx ((doublereal *)&blank_1 + 15)
#define gmuo ((doublereal *)&blank_1 + 5)
    static integer locv, locm, loct;
    static doublereal csat, type, rbpr, rbpi, gcpr, gepr, oikr, xjrb, ctot, 
	    czbx, czcs, ovtf, xjtf, temp;
    static integer ichk1;
    static doublereal sarg, fcpc;
    static integer locy, node1, node2, node3, node4, node5, node6, node7;
    static doublereal capbc, capbe, ceqbc, ceqbe, geqcb;
#define cexbc ((doublereal *)&blank_1 + 17)
    static doublereal cchat, cbhat, capcs, ceqcs, evben, evbcn, ceqbx, denom, 
	    xfact, geqbx, argtf, capbx, sqarg, c2, c4, vcrit, q1, q2, f1, f2, 
	    f3, czbef2, czbcf2, czbxf2, cb, cc;
    extern /* Subroutine */ int intgr8_();
    static doublereal qb, gm, pe;
    static integer icheck;
    static doublereal go, td, tf, pc, delvbc;
#define geqcbo ((doublereal *)&blank_1 + 18)
    static doublereal delvbe, gx, dqbdve, dqbdvc, tr;
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)
    extern /* Subroutine */ int pnjlim_();
    static doublereal cbc, ps, cbe, gbc, gbe;
#define cbo ((doublereal *)&blank_1 + 3)
#define cco ((doublereal *)&blank_1 + 2)
#define qbc ((doublereal *)&blank_1 + 10)
#define qbe ((doublereal *)&blank_1 + 8)
    static doublereal bfm, vbc, arg;
    static integer loc;
    static doublereal vbe, brm;
#define gmo ((doublereal *)&blank_1 + 6)
#define goo ((doublereal *)&blank_1 + 7)
    static doublereal ova;
#define qcs ((doublereal *)&blank_1 + 12)
    static doublereal ovb, oik;
#define qbx ((doublereal *)&blank_1 + 14)
    static doublereal vce, vtc;
#define gxo ((doublereal *)&blank_1 + 16)
    static doublereal vte, vbx, vcs, tol, gpi, gmu, vtn, cex, gex, xme, xmc, 
	    xms, xtf, geq, ceq, arg1, arg2, arg3;

/*<       implicit double precision (a-h,o-z) >*/

/*     this routine processes bjts for dc and transient analyses. */

/* spice version 2g.6  sccsid=tabinf 3/15/83 */
/*<       common /tabinf/ ielmnt,isbckt,nsbckt,iunsat,nunsat,itemps,numtem, >*/
/*<      1   isens,nsens,ifour,nfour,ifield,icode,idelim,icolum,insize, >*/
/*<      2   junode,lsbkpt,numbkp,iorder,jmnode,iur,iuc,ilc,ilr,numoff,isr, >*/
/*<      3   nmoffc,iseq,iseq1,neqn,nodevs,ndiag,iswap,iequa,macins,lvnim1, >*/
/*<      4   lx0,lvn,lynl,lyu,lyl,lx1,lx2,lx3,lx4,lx5,lx6,lx7,ld0,ld1,ltd, >*/
/*<      5   imynl,imvn,lcvn,nsnod,nsmat,nsval,icnod,icmat,icval, >*/
/*<      6   loutpt,lpol,lzer,irswpf,irswpr,icswpf,icswpr,irpt,jcpt, >*/
/*<      7   irowno,jcolno,nttbr,nttar,lvntmp >*/
/* spice version 2g.6  sccsid=cirdat 3/15/83 */
/*<       common /cirdat/ locate(50),jelcnt(50),nunods,ncnods,numnod,nstop, >*/
/*<      1   nut,nlt,nxtrm,ndist,ntlin,ibr,numvs,numalt,numcyc >*/
/* spice version 2g.6  sccsid=status 3/15/83 */
/*<       common /status/ omega,time,delta,delold(7),ag(7),vt,xni,egfet, >*/
/*<      1   xmu,sfactr,mode,modedc,icalc,initf,method,iord,maxord,noncon, >*/
/*<      2   iterno,itemno,nosolv,modac,ipiv,ivmflg,ipostp,iscrch,iofile >*/
/* spice version 2g.6  sccsid=knstnt 3/15/83 */
/*<       common /knstnt/ twopi,xlog2,xlog10,root2,rad,boltz,charge,ctok, >*/
/*<      1   gmin,reltol,abstol,vntol,trtol,chgtol,eps0,epssil,epsox, >*/
/*<      2   pivtol,pivrel >*/
/* spice version 2g.6  sccsid=blank 3/15/83 */
/*<       common /blank/ value(200000) >*/
/*<       integer nodplc(64) >*/
/*<       complex cvalue(32) >*/
/*<       equivalence (value(1),nodplc(1),cvalue(1)) >*/


/*<       dimension vbeo(1),vbco(1),cco(1),cbo(1),gpio(1),gmuo(1),gmo(1), >*/
/*<      1   goo(1),qbe(1),cqbe(1),qbc(1),cqbc(1),qcs(1),cqcs(1),qbx(1), >*/
/*<      2   cqbx(1),gxo(1),cexbc(1),geqcbo(1) >*/
/*<       equivalence (vbeo(1),value(1)),(vbco(1),value(2)), >*/
/*<      1   (cco(1),value(3)),(cbo(1),value(4)),(gpio(1),value(5)), >*/
/*<      2   (gmuo(1),value(6)),(gmo(1),value(7)),(goo(1),value(8)), >*/
/*<      3   (qbe(1),value(9)),(cqbe(1),value(10)),(qbc(1),value(11)), >*/
/*<      4   (cqbc(1),value(12)),(qcs(1),value(13)),(cqcs(1),value(14)), >*/
/*<      5   (qbx(1),value(15)),(cqbx(1),value(16)),(gxo(1),value(17)), >*/
/*<      6   (cexbc(1),value(18)),(geqcbo(1),value(19)) >*/


/*<       loc=locate(12) >*/
    loc = cirdat_1.locate[11];
/*<    10 if ((loc.eq.0).or.(nodplc(loc+36).ne.0)) return >*/
L10:
    if (loc == 0 || nodplc[loc + 35] != 0) {
	return 0;
    }
/*<       locv=nodplc(loc+1) >*/
    locv = nodplc[loc];
/*<       node1=nodplc(loc+2) >*/
    node1 = nodplc[loc + 1];
/*<       node2=nodplc(loc+3) >*/
    node2 = nodplc[loc + 2];
/*<       node3=nodplc(loc+4) >*/
    node3 = nodplc[loc + 3];
/*<       node4=nodplc(loc+5) >*/
    node4 = nodplc[loc + 4];
/*<       node5=nodplc(loc+6) >*/
    node5 = nodplc[loc + 5];
/*<       node6=nodplc(loc+7) >*/
    node6 = nodplc[loc + 6];
/*<       node7=nodplc(loc+30) >*/
    node7 = nodplc[loc + 29];
/*<       locm=nodplc(loc+8) >*/
    locm = nodplc[loc + 7];
/*<       ioff=nodplc(loc+9) >*/
    ioff = nodplc[loc + 8];
/*<       type=nodplc(locm+2) >*/
    type = (doublereal) nodplc[locm + 1];
/*<       locm=nodplc(locm+1) >*/
    locm = nodplc[locm];
/*<       loct=nodplc(loc+22) >*/
    loct = nodplc[loc + 21];
/*<       gccs=0.0d0 >*/
    gccs = 0.;
/*<       ceqcs=0.0d0 >*/
    ceqcs = 0.;
/*<       geqbx=0.0d0 >*/
    geqbx = 0.;
/*<       ceqbx=0.0d0 >*/
    ceqbx = 0.;
/*<       geqcb=0.0d0 >*/
    geqcb = 0.;

/*  dc model paramters */

/*<       area=value(locv+1) >*/
    area = blank_1.value[locv];
/*<       bfm=value(locm+2) >*/
    bfm = blank_1.value[locm + 1];
/*<       brm=value(locm+8) >*/
    brm = blank_1.value[locm + 7];
/*<       csat=value(locm+1)*area >*/
    csat = blank_1.value[locm] * area;
/*<       rbpr=value(locm+18)/area >*/
    rbpr = blank_1.value[locm + 17] / area;
/*<       rbpi=value(locm+16)/area-rbpr >*/
    rbpi = blank_1.value[locm + 15] / area - rbpr;
/*<       gcpr=value(locm+20)*area >*/
    gcpr = blank_1.value[locm + 19] * area;
/*<       gepr=value(locm+19)*area >*/
    gepr = blank_1.value[locm + 18] * area;
/*<       ova=value(locm+4) >*/
    ova = blank_1.value[locm + 3];
/*<       ovb=value(locm+10) >*/
    ovb = blank_1.value[locm + 9];
/*<       oik=value(locm+5)/area >*/
    oik = blank_1.value[locm + 4] / area;
/*<       c2=value(locm+6)*area >*/
    c2 = blank_1.value[locm + 5] * area;
/*<       vte=value(locm+7)*vt >*/
    vte = blank_1.value[locm + 6] * status_1.vt;
/*<       oikr=value(locm+11)/area >*/
    oikr = blank_1.value[locm + 10] / area;
/*<       c4=value(locm+12)*area >*/
    c4 = blank_1.value[locm + 11] * area;
/*<       vtc=value(locm+13)*vt >*/
    vtc = blank_1.value[locm + 12] * status_1.vt;
/*<       vcrit=value(locm+54) >*/
    vcrit = blank_1.value[locm + 53];
/*<       td=value(locm+28) >*/
    td = blank_1.value[locm + 27];
/*<       xjrb=value(locm+17)*area >*/
    xjrb = blank_1.value[locm + 16] * area;

/*  initialization */

/*<       icheck=1 >*/
    icheck = 1;
/*<       go to (100,20,30,50,60,70),initf >*/
    switch (status_1.initf) {
	case 1:  goto L100;
	case 2:  goto L20;
	case 3:  goto L30;
	case 4:  goto L50;
	case 5:  goto L60;
	case 6:  goto L70;
    }
/*<    20 if(mode.ne.1.or.modedc.ne.2.or.nosolv.eq.0) go to 25 >*/
L20:
    if (status_1.mode != 1 || status_1.modedc != 2 || status_1.nosolv == 0) {
	goto L25;
    }
/*<       vbe=type*value(locv+2) >*/
    vbe = type * blank_1.value[locv + 1];
/*<       vce=type*value(locv+3) >*/
    vce = type * blank_1.value[locv + 2];
/*<       vbc=vbe-vce >*/
    vbc = vbe - vce;
/*<       vbx=vbc >*/
    vbx = vbc;
/*<       vcs=0.0d0 >*/
    vcs = 0.;
/*<       go to 300 >*/
    goto L300;
/*<    25 if(ioff.ne.0) go to 40 >*/
L25:
    if (ioff != 0) {
	goto L40;
    }
/*<       vbe=vcrit >*/
    vbe = vcrit;
/*<       vbc=0.0d0 >*/
    vbc = 0.;
/*<       go to 300 >*/
    goto L300;
/*<    30 if (ioff.eq.0) go to 100 >*/
L30:
    if (ioff == 0) {
	goto L100;
    }
/*<    40 vbe=0.0d0 >*/
L40:
    vbe = 0.;
/*<       vbc=0.0d0 >*/
    vbc = 0.;
/*<       go to 300 >*/
    goto L300;
/*<    50 vbe=vbeo(lx0+loct) >*/
L50:
    vbe = vbeo[tabinf_1.lx0 + loct - 1];
/*<       vbc=vbco(lx0+loct) >*/
    vbc = vbco[tabinf_1.lx0 + loct - 1];
/*<       vbx=type*(value(lvnim1+node2)-value(lvnim1+node4)) >*/
    vbx = type * (blank_1.value[tabinf_1.lvnim1 + node2 - 1] - blank_1.value[
	    tabinf_1.lvnim1 + node4 - 1]);
/*<       vcs=type*(value(lvnim1+node7)-value(lvnim1+node4)) >*/
    vcs = type * (blank_1.value[tabinf_1.lvnim1 + node7 - 1] - blank_1.value[
	    tabinf_1.lvnim1 + node4 - 1]);
/*<       go to 300 >*/
    goto L300;
/*<    60 vbe=vbeo(lx1+loct) >*/
L60:
    vbe = vbeo[tabinf_1.lx1 + loct - 1];
/*<       vbc=vbco(lx1+loct) >*/
    vbc = vbco[tabinf_1.lx1 + loct - 1];
/*<       vbx=type*(value(lvnim1+node2)-value(lvnim1+node4)) >*/
    vbx = type * (blank_1.value[tabinf_1.lvnim1 + node2 - 1] - blank_1.value[
	    tabinf_1.lvnim1 + node4 - 1]);
/*<       vcs=type*(value(lvnim1+node7)-value(lvnim1+node4)) >*/
    vcs = type * (blank_1.value[tabinf_1.lvnim1 + node7 - 1] - blank_1.value[
	    tabinf_1.lvnim1 + node4 - 1]);
/*<       if(mode.ne.2.or.nosolv.eq.0) go to 300 >*/
    if (status_1.mode != 2 || status_1.nosolv == 0) {
	goto L300;
    }
/*<       vbx=type*(value(locv+2)-value(locv+3)) >*/
    vbx = type * (blank_1.value[locv + 1] - blank_1.value[locv + 2]);
/*<       vcs=0.0d0 >*/
    vcs = 0.;
/*<       go to 300 >*/
    goto L300;
/*<    70 xfact=delta/delold(2) >*/
L70:
    xfact = status_1.delta / status_1.delold[1];
/*<       vbeo(lx0+loct)=vbeo(lx1+loct) >*/
    vbeo[tabinf_1.lx0 + loct - 1] = vbeo[tabinf_1.lx1 + loct - 1];
/*<       vbe=(1.0d0+xfact)*vbeo(lx1+loct)-xfact*vbeo(lx2+loct) >*/
    vbe = (xfact + 1.) * vbeo[tabinf_1.lx1 + loct - 1] - xfact * vbeo[
	    tabinf_1.lx2 + loct - 1];
/*<       vbco(lx0+loct)=vbco(lx1+loct) >*/
    vbco[tabinf_1.lx0 + loct - 1] = vbco[tabinf_1.lx1 + loct - 1];
/*<       vbc=(1.0d0+xfact)*vbco(lx1+loct)-xfact*vbco(lx2+loct) >*/
    vbc = (xfact + 1.) * vbco[tabinf_1.lx1 + loct - 1] - xfact * vbco[
	    tabinf_1.lx2 + loct - 1];
/*<       cco(lx0+loct)=cco(lx1+loct) >*/
    cco[tabinf_1.lx0 + loct - 1] = cco[tabinf_1.lx1 + loct - 1];
/*<       cbo(lx0+loct)=cbo(lx1+loct) >*/
    cbo[tabinf_1.lx0 + loct - 1] = cbo[tabinf_1.lx1 + loct - 1];
/*<       gpio(lx0+loct)=gpio(lx1+loct) >*/
    gpio[tabinf_1.lx0 + loct - 1] = gpio[tabinf_1.lx1 + loct - 1];
/*<       gmuo(lx0+loct)=gmuo(lx1+loct) >*/
    gmuo[tabinf_1.lx0 + loct - 1] = gmuo[tabinf_1.lx1 + loct - 1];
/*<       gmo(lx0+loct)=gmo(lx1+loct) >*/
    gmo[tabinf_1.lx0 + loct - 1] = gmo[tabinf_1.lx1 + loct - 1];
/*<       goo(lx0+loct)=goo(lx1+loct) >*/
    goo[tabinf_1.lx0 + loct - 1] = goo[tabinf_1.lx1 + loct - 1];
/*<       gxo(lx0+loct)=gxo(lx1+loct) >*/
    gxo[tabinf_1.lx0 + loct - 1] = gxo[tabinf_1.lx1 + loct - 1];
/*<       go to 110 >*/
    goto L110;

/*  compute new nonlinear branch voltages */

/*<   100 vbe=type*(value(lvnim1+node5)-value(lvnim1+node6)) >*/
L100:
    vbe = type * (blank_1.value[tabinf_1.lvnim1 + node5 - 1] - blank_1.value[
	    tabinf_1.lvnim1 + node6 - 1]);
/*<       vbc=type*(value(lvnim1+node5)-value(lvnim1+node4)) >*/
    vbc = type * (blank_1.value[tabinf_1.lvnim1 + node5 - 1] - blank_1.value[
	    tabinf_1.lvnim1 + node4 - 1]);
/*<   110 delvbe=vbe-vbeo(lx0+loct) >*/
L110:
    delvbe = vbe - vbeo[tabinf_1.lx0 + loct - 1];
/*<       delvbc=vbc-vbco(lx0+loct) >*/
    delvbc = vbc - vbco[tabinf_1.lx0 + loct - 1];
/*<       vbx=type*(value(lvnim1+node2)-value(lvnim1+node4)) >*/
    vbx = type * (blank_1.value[tabinf_1.lvnim1 + node2 - 1] - blank_1.value[
	    tabinf_1.lvnim1 + node4 - 1]);
/*<       vcs=type*(value(lvnim1+node7)-value(lvnim1+node4)) >*/
    vcs = type * (blank_1.value[tabinf_1.lvnim1 + node7 - 1] - blank_1.value[
	    tabinf_1.lvnim1 + node4 - 1]);
/*<       cchat=cco(lx0+loct)+(gmo(lx0+loct)+goo(lx0+loct))*delvbe >*/
/*<      1   -(goo(lx0+loct)+gmuo(lx0+loct))*delvbc >*/
    cchat = cco[tabinf_1.lx0 + loct - 1] + (gmo[tabinf_1.lx0 + loct - 1] + 
	    goo[tabinf_1.lx0 + loct - 1]) * delvbe - (goo[tabinf_1.lx0 + loct 
	    - 1] + gmuo[tabinf_1.lx0 + loct - 1]) * delvbc;
/*<       cbhat=cbo(lx0+loct)+gpio(lx0+loct)*delvbe+gmuo(lx0+loct)*delvbc >*/
    cbhat = cbo[tabinf_1.lx0 + loct - 1] + gpio[tabinf_1.lx0 + loct - 1] * 
	    delvbe + gmuo[tabinf_1.lx0 + loct - 1] * delvbc;

/*   bypass if solution has not changed */

/*<       if (initf.eq.6) go to 200 >*/
    if (status_1.initf == 6) {
	goto L200;
    }
/*<       tol=reltol*dmax1(dabs(vbe),dabs(vbeo(lx0+loct)))+vntol >*/
/* Computing MAX */
    d_2 = abs(vbe), d_3 = (d_1 = vbeo[tabinf_1.lx0 + loct - 1], abs(d_1));
    tol = knstnt_1.reltol * max(d_3,d_2) + knstnt_1.vntol;
/*<       if (dabs(delvbe).ge.tol) go to 200 >*/
    if (abs(delvbe) >= tol) {
	goto L200;
    }
/*<       tol=reltol*dmax1(dabs(vbc),dabs(vbco(lx0+loct)))+vntol >*/
/* Computing MAX */
    d_2 = abs(vbc), d_3 = (d_1 = vbco[tabinf_1.lx0 + loct - 1], abs(d_1));
    tol = knstnt_1.reltol * max(d_3,d_2) + knstnt_1.vntol;
/*<       if (dabs(delvbc).ge.tol) go to 200 >*/
    if (abs(delvbc) >= tol) {
	goto L200;
    }
/*<       tol=reltol*dmax1(dabs(cchat),dabs(cco(lx0+loct)))+abstol >*/
/* Computing MAX */
    d_2 = abs(cchat), d_3 = (d_1 = cco[tabinf_1.lx0 + loct - 1], abs(d_1));
    tol = knstnt_1.reltol * max(d_3,d_2) + knstnt_1.abstol;
/*<       if (dabs(cchat-cco(lx0+loct)).ge.tol) go to 200 >*/
    if ((d_1 = cchat - cco[tabinf_1.lx0 + loct - 1], abs(d_1)) >= tol) {
	goto L200;
    }
/*<       tol=reltol*dmax1(dabs(cbhat),dabs(cbo(lx0+loct)))+abstol >*/
/* Computing MAX */
    d_2 = abs(cbhat), d_3 = (d_1 = cbo[tabinf_1.lx0 + loct - 1], abs(d_1));
    tol = knstnt_1.reltol * max(d_3,d_2) + knstnt_1.abstol;
/*<       if (dabs(cbhat-cbo(lx0+loct)).ge.tol) go to 200 >*/
    if ((d_1 = cbhat - cbo[tabinf_1.lx0 + loct - 1], abs(d_1)) >= tol) {
	goto L200;
    }
/*<       vbe=vbeo(lx0+loct) >*/
    vbe = vbeo[tabinf_1.lx0 + loct - 1];
/*<       vbc=vbco(lx0+loct) >*/
    vbc = vbco[tabinf_1.lx0 + loct - 1];
/*<       cc=cco(lx0+loct) >*/
    cc = cco[tabinf_1.lx0 + loct - 1];
/*<       cb=cbo(lx0+loct) >*/
    cb = cbo[tabinf_1.lx0 + loct - 1];
/*<       gpi=gpio(lx0+loct) >*/
    gpi = gpio[tabinf_1.lx0 + loct - 1];
/*<       gmu=gmuo(lx0+loct) >*/
    gmu = gmuo[tabinf_1.lx0 + loct - 1];
/*<       gm=gmo(lx0+loct) >*/
    gm = gmo[tabinf_1.lx0 + loct - 1];
/*<       go=goo(lx0+loct) >*/
    go = goo[tabinf_1.lx0 + loct - 1];
/*<       gx=gxo(lx0+loct) >*/
    gx = gxo[tabinf_1.lx0 + loct - 1];
/*<       geqcb=geqcbo(lx0+loct) >*/
    geqcb = geqcbo[tabinf_1.lx0 + loct - 1];
/*<       if (mode.ne.1) go to 800 >*/
    if (status_1.mode != 1) {
	goto L800;
    }
/*<       go to 900 >*/
    goto L900;

/*  limit nonlinear branch voltages */

/*<   200 ichk1=1 >*/
L200:
    ichk1 = 1;
/*<       call pnjlim(vbe,vbeo(lx0+loct),vt,vcrit,icheck) >*/
    pnjlim_(&vbe, &vbeo[tabinf_1.lx0 + loct - 1], &status_1.vt, &vcrit, &
	    icheck);
/*<       call pnjlim(vbc,vbco(lx0+loct),vt,vcrit,ichk1) >*/
    pnjlim_(&vbc, &vbco[tabinf_1.lx0 + loct - 1], &status_1.vt, &vcrit, &
	    ichk1);
/*<       if (ichk1.eq.1) icheck=1 >*/
    if (ichk1 == 1) {
	icheck = 1;
    }

/*  determine dc current and derivitives */

/*<   300 vtn=vt*value(locm+3) >*/
L300:
    vtn = status_1.vt * blank_1.value[locm + 2];
/*<       if(vbe.le.-5.0d0*vtn) go to 320 >*/
    if (vbe <= vtn * -5.) {
	goto L320;
    }
/*<       evbe=dexp(vbe/vtn) >*/
    evbe = exp(vbe / vtn);
/*<       cbe=csat*(evbe-1.0d0)+gmin*vbe >*/
    cbe = csat * (evbe - 1.) + knstnt_1.gmin * vbe;
/*<       gbe=csat*evbe/vtn+gmin >*/
    gbe = csat * evbe / vtn + knstnt_1.gmin;
/*<       if (c2.ne.0.0d0) go to 310 >*/
    if (c2 != 0.) {
	goto L310;
    }
/*<       cben=0.0d0 >*/
    cben = 0.;
/*<       gben=0.0d0 >*/
    gben = 0.;
/*<       go to 350 >*/
    goto L350;
/*<   310 evben=dexp(vbe/vte) >*/
L310:
    evben = exp(vbe / vte);
/*<       cben=c2*(evben-1.0d0) >*/
    cben = c2 * (evben - 1.);
/*<       gben=c2*evben/vte >*/
    gben = c2 * evben / vte;
/*<       go to 350 >*/
    goto L350;
/*<   320 gbe=-csat/vbe+gmin >*/
L320:
    gbe = -csat / vbe + knstnt_1.gmin;
/*<       cbe=gbe*vbe >*/
    cbe = gbe * vbe;
/*<       gben=-c2/vbe >*/
    gben = -c2 / vbe;
/*<       cben=gben*vbe >*/
    cben = gben * vbe;
/*<   350 vtn=vt*value(locm+9) >*/
L350:
    vtn = status_1.vt * blank_1.value[locm + 8];
/*<       if(vbc.le.-5.0d0*vtn) go to 370 >*/
    if (vbc <= vtn * -5.) {
	goto L370;
    }
/*<       evbc=dexp(vbc/vtn) >*/
    evbc = exp(vbc / vtn);
/*<       cbc=csat*(evbc-1.0d0)+gmin*vbc >*/
    cbc = csat * (evbc - 1.) + knstnt_1.gmin * vbc;
/*<       gbc=csat*evbc/vtn+gmin >*/
    gbc = csat * evbc / vtn + knstnt_1.gmin;
/*<       if (c4.ne.0.0d0) go to 360 >*/
    if (c4 != 0.) {
	goto L360;
    }
/*<       cbcn=0.0d0 >*/
    cbcn = 0.;
/*<       gbcn=0.0d0 >*/
    gbcn = 0.;
/*<       go to 400 >*/
    goto L400;
/*<   360 evbcn=dexp(vbc/vtc) >*/
L360:
    evbcn = exp(vbc / vtc);
/*<       cbcn=c4*(evbcn-1.0d0) >*/
    cbcn = c4 * (evbcn - 1.);
/*<       gbcn=c4*evbcn/vtc >*/
    gbcn = c4 * evbcn / vtc;
/*<       go to 400 >*/
    goto L400;
/*<   370 gbc=-csat/vbc+gmin >*/
L370:
    gbc = -csat / vbc + knstnt_1.gmin;
/*<       cbc=gbc*vbc >*/
    cbc = gbc * vbc;
/*<       gbcn=-c4/vbc >*/
    gbcn = -c4 / vbc;
/*<       cbcn=gbcn*vbc >*/
    cbcn = gbcn * vbc;

/*  determine base charge terms */

/*<   400 q1=1.0d0/(1.0d0-ova*vbc-ovb*vbe) >*/
L400:
    q1 = 1. / (1. - ova * vbc - ovb * vbe);
/*<       if (oik.ne.0.0d0) go to 405 >*/
    if (oik != 0.) {
	goto L405;
    }
/*<       if (oikr.ne.0.0d0) go to 405 >*/
    if (oikr != 0.) {
	goto L405;
    }
/*<       qb=q1 >*/
    qb = q1;
/*<       dqbdve=q1*qb*ovb >*/
    dqbdve = q1 * qb * ovb;
/*<       dqbdvc=q1*qb*ova >*/
    dqbdvc = q1 * qb * ova;
/*<       go to 410 >*/
    goto L410;
/*<   405 q2=oik*cbe+oikr*cbc >*/
L405:
    q2 = oik * cbe + oikr * cbc;
/*<       arg=dmax1(0.0d0,1.0d0+4.0d0*q2) >*/
/* Computing MAX */
    d_1 = 0., d_2 = q2 * 4. + 1.;
    arg = max(d_2,d_1);
/*<       sqarg=1.0d0 >*/
    sqarg = 1.;
/*<       if(arg.ne.0.0d0) sqarg=dsqrt(arg) >*/
    if (arg != 0.) {
	sqarg = sqrt(arg);
    }
/*<       qb=q1*(1.0d0+sqarg)/2.0d0 >*/
    qb = q1 * (sqarg + 1.) / 2.;
/*<       dqbdve=q1*(qb*ovb+oik*gbe/sqarg) >*/
    dqbdve = q1 * (qb * ovb + oik * gbe / sqarg);
/*<       dqbdvc=q1*(qb*ova+oikr*gbc/sqarg) >*/
    dqbdvc = q1 * (qb * ova + oikr * gbc / sqarg);

/*  weil's approx. for excess phase applied with backward- */
/*  euler integration */

/*<   410 cc=0.0d0 >*/
L410:
    cc = 0.;
/*<       cex=cbe >*/
    cex = cbe;
/*<       gex=gbe >*/
    gex = gbe;
/*<       if(mode.eq.1) go to 420 >*/
    if (status_1.mode == 1) {
	goto L420;
    }
/*<       if(td.eq.0.0d0) go to 420 >*/
    if (td == 0.) {
	goto L420;
    }
/*<       arg1=delta/td >*/
    arg1 = status_1.delta / td;
/*<       arg2=3.0d0*arg1 >*/
    arg2 = arg1 * 3.;
/*<       arg1=arg2*arg1 >*/
    arg1 = arg2 * arg1;
/*<       denom=1.0d0+arg1+arg2 >*/
    denom = arg1 + 1. + arg2;
/*<       arg3=arg1/denom >*/
    arg3 = arg1 / denom;
/*<       if(initf.ne.5) go to 411 >*/
    if (status_1.initf != 5) {
	goto L411;
    }
/*<       cexbc(lx1+loct)=cbe/qb >*/
    cexbc[tabinf_1.lx1 + loct - 1] = cbe / qb;
/*<       cexbc(lx2+loct)=cexbc(lx1+loct) >*/
    cexbc[tabinf_1.lx2 + loct - 1] = cexbc[tabinf_1.lx1 + loct - 1];
/*<   411 cc=(cexbc(lx1+loct)*(1.0d0+delta/delold(2)+arg2) >*/
/*<      1  -cexbc(lx2+loct)*delta/delold(2))/denom >*/
L411:
    cc = (cexbc[tabinf_1.lx1 + loct - 1] * (status_1.delta / status_1.delold[
	    1] + 1. + arg2) - cexbc[tabinf_1.lx2 + loct - 1] * status_1.delta 
	    / status_1.delold[1]) / denom;
/*<       cex=cbe*arg3 >*/
    cex = cbe * arg3;
/*<       gex=gbe*arg3 >*/
    gex = gbe * arg3;
/*<       cexbc(lx0+loct)=cc+cex/qb >*/
    cexbc[tabinf_1.lx0 + loct - 1] = cc + cex / qb;

/*  determine dc incremental conductances */

/*<   420 cc=cc+(cex-cbc)/qb-cbc/brm-cbcn >*/
L420:
    cc = cc + (cex - cbc) / qb - cbc / brm - cbcn;
/*<       cb=cbe/bfm+cben+cbc/brm+cbcn >*/
    cb = cbe / bfm + cben + cbc / brm + cbcn;
/*<       gx=rbpr+rbpi/qb >*/
    gx = rbpr + rbpi / qb;
/*<       if(xjrb.eq.0.0d0) go to 430 >*/
    if (xjrb == 0.) {
	goto L430;
    }
/*<       arg1=dmax1(cb/xjrb,1.0d-9) >*/
/* Computing MAX */
    d_1 = cb / xjrb;
    arg1 = max(1e-9,d_1);
/*<       arg2=(-1.0d0+dsqrt(1.0d0+14.59025d0*arg1))/2.4317d0/dsqrt(arg1) >*/
    arg2 = (sqrt(arg1 * 14.59025 + 1.) - 1.) / 2.4317 / sqrt(arg1);
/*<       arg1=dtan(arg2) >*/
    arg1 = tan(arg2);
/*<       gx=rbpr+3.0d0*rbpi*(arg1-arg2)/arg2/arg1/arg1 >*/
    gx = rbpr + rbpi * 3. * (arg1 - arg2) / arg2 / arg1 / arg1;
/*<   430 if(gx.ne.0.0d0) gx=1.0d0/gx >*/
L430:
    if (gx != 0.) {
	gx = 1. / gx;
    }
/*<       gpi=gbe/bfm+gben >*/
    gpi = gbe / bfm + gben;
/*<       gmu=gbc/brm+gbcn >*/
    gmu = gbc / brm + gbcn;
/*<       go=(gbc+(cex-cbc)*dqbdvc/qb)/qb >*/
    go = (gbc + (cex - cbc) * dqbdvc / qb) / qb;
/*<       gm=(gex-(cex-cbc)*dqbdve/qb)/qb-go >*/
    gm = (gex - (cex - cbc) * dqbdve / qb) / qb - go;
/*<       if (mode.ne.1) go to 500 >*/
    if (status_1.mode != 1) {
	goto L500;
    }
/*<       if ((modedc.eq.2).and.(nosolv.ne.0)) go to 500 >*/
    if (status_1.modedc == 2 && status_1.nosolv != 0) {
	goto L500;
    }
/*<       if (initf.eq.4) go to 500 >*/
    if (status_1.initf == 4) {
	goto L500;
    }
/*<       go to 700 >*/
    goto L700;

/*  charge storage elements */

/*<   500 tf=value(locm+24) >*/
L500:
    tf = blank_1.value[locm + 23];
/*<       tr=value(locm+33) >*/
    tr = blank_1.value[locm + 32];
/*<       czbe=value(locm+21)*area >*/
    czbe = blank_1.value[locm + 20] * area;
/*<       pe=value(locm+22) >*/
    pe = blank_1.value[locm + 21];
/*<       xme=value(locm+23) >*/
    xme = blank_1.value[locm + 22];
/*<       cdis=value(locm+32) >*/
    cdis = blank_1.value[locm + 31];
/*<       ctot=value(locm+29)*area >*/
    ctot = blank_1.value[locm + 28] * area;
/*<       czbc=ctot*cdis >*/
    czbc = ctot * cdis;
/*<       czbx=ctot-czbc >*/
    czbx = ctot - czbc;
/*<       pc=value(locm+30) >*/
    pc = blank_1.value[locm + 29];
/*<       xmc=value(locm+31) >*/
    xmc = blank_1.value[locm + 30];
/*<       fcpe=value(locm+46) >*/
    fcpe = blank_1.value[locm + 45];
/*<       czcs=value(locm+38)*area >*/
    czcs = blank_1.value[locm + 37] * area;
/*<       ps=value(locm+39) >*/
    ps = blank_1.value[locm + 38];
/*<       xms=value(locm+40) >*/
    xms = blank_1.value[locm + 39];
/*<       xtf=value(locm+25) >*/
    xtf = blank_1.value[locm + 24];
/*<       ovtf=value(locm+26) >*/
    ovtf = blank_1.value[locm + 25];
/*<       xjtf=value(locm+27)*area >*/
    xjtf = blank_1.value[locm + 26] * area;
/*<       if(tf.eq.0.0d0) go to 505 >*/
    if (tf == 0.) {
	goto L505;
    }
/*<       if(vbe.le.0.0d0) go to 505 >*/
    if (vbe <= 0.) {
	goto L505;
    }
/*<       argtf=0.0d0 >*/
    argtf = 0.;
/*<       arg2=0.0d0 >*/
    arg2 = 0.;
/*<       arg3=0.0d0 >*/
    arg3 = 0.;
/*<       if(xtf.eq.0.0d0) go to 504 >*/
    if (xtf == 0.) {
	goto L504;
    }
/*<       argtf=xtf >*/
    argtf = xtf;
/*<       if(ovtf.ne.0.0d0) argtf=argtf*dexp(vbc*ovtf) >*/
    if (ovtf != 0.) {
	argtf *= exp(vbc * ovtf);
    }
/*<       arg2=argtf >*/
    arg2 = argtf;
/*<       if(xjtf.eq.0.0d0) go to 503 >*/
    if (xjtf == 0.) {
	goto L503;
    }
/*<       temp=cbe/(cbe+xjtf) >*/
    temp = cbe / (cbe + xjtf);
/*<       argtf=argtf*temp*temp >*/
    argtf = argtf * temp * temp;
/*<       arg2=argtf*(3.0d0-temp-temp) >*/
    arg2 = argtf * (3. - temp - temp);
/*<   503 arg3=cbe*argtf*ovtf >*/
L503:
    arg3 = cbe * argtf * ovtf;
/*<   504 cbe=cbe*(1.0d0+argtf)/qb >*/
L504:
    cbe = cbe * (argtf + 1.) / qb;
/*<       gbe=(gbe*(1.0d0+arg2)-cbe*dqbdve)/qb >*/
    gbe = (gbe * (arg2 + 1.) - cbe * dqbdve) / qb;
/*<       geqcb=tf*(arg3-cbe*dqbdvc)/qb >*/
    geqcb = tf * (arg3 - cbe * dqbdvc) / qb;
/*<   505 if (vbe.ge.fcpe) go to 510 >*/
L505:
    if (vbe >= fcpe) {
	goto L510;
    }
/*<       arg=1.0d0-vbe/pe >*/
    arg = 1. - vbe / pe;
/*<       sarg=dexp(-xme*dlog(arg)) >*/
    sarg = exp(-xme * log(arg));
/*<       qbe(lx0+loct)=tf*cbe+pe*czbe*(1.0d0-arg*sarg)/(1.0d0-xme) >*/
    qbe[tabinf_1.lx0 + loct - 1] = tf * cbe + pe * czbe * (1. - arg * sarg) / 
	    (1. - xme);
/*<       capbe=tf*gbe+czbe*sarg >*/
    capbe = tf * gbe + czbe * sarg;
/*<       go to 520 >*/
    goto L520;
/*<   510 f1=value(locm+47) >*/
L510:
    f1 = blank_1.value[locm + 46];
/*<       f2=value(locm+48) >*/
    f2 = blank_1.value[locm + 47];
/*<       f3=value(locm+49) >*/
    f3 = blank_1.value[locm + 48];
/*<       czbef2=czbe/f2 >*/
    czbef2 = czbe / f2;
/*<       qbe(lx0+loct)=tf*cbe+czbe*f1+czbef2*(f3*(vbe-fcpe) >*/
/*<      1   +(xme/(pe+pe))*(vbe*vbe-fcpe*fcpe)) >*/
    qbe[tabinf_1.lx0 + loct - 1] = tf * cbe + czbe * f1 + czbef2 * (f3 * (vbe 
	    - fcpe) + xme / (pe + pe) * (vbe * vbe - fcpe * fcpe));
/*<       capbe=tf*gbe+czbef2*(f3+xme*vbe/pe) >*/
    capbe = tf * gbe + czbef2 * (f3 + xme * vbe / pe);
/*<   520 fcpc=value(locm+50) >*/
L520:
    fcpc = blank_1.value[locm + 49];
/*<       f1=value(locm+51) >*/
    f1 = blank_1.value[locm + 50];
/*<       f2=value(locm+52) >*/
    f2 = blank_1.value[locm + 51];
/*<       f3=value(locm+53) >*/
    f3 = blank_1.value[locm + 52];
/*<       if (vbc.ge.fcpc) go to 530 >*/
    if (vbc >= fcpc) {
	goto L530;
    }
/*<       arg=1.0d0-vbc/pc >*/
    arg = 1. - vbc / pc;
/*<       sarg=dexp(-xmc*dlog(arg)) >*/
    sarg = exp(-xmc * log(arg));
/*<       qbc(lx0+loct)=tr*cbc+pc*czbc*(1.0d0-arg*sarg)/(1.0d0-xmc) >*/
    qbc[tabinf_1.lx0 + loct - 1] = tr * cbc + pc * czbc * (1. - arg * sarg) / 
	    (1. - xmc);
/*<       capbc=tr*gbc+czbc*sarg >*/
    capbc = tr * gbc + czbc * sarg;
/*<       go to 540 >*/
    goto L540;
/*<   530 czbcf2=czbc/f2 >*/
L530:
    czbcf2 = czbc / f2;
/*<       qbc(lx0+loct)=tr*cbc+czbc*f1+czbcf2*(f3*(vbc-fcpc) >*/
/*<      1   +(xmc/(pc+pc))*(vbc*vbc-fcpc*fcpc)) >*/
    qbc[tabinf_1.lx0 + loct - 1] = tr * cbc + czbc * f1 + czbcf2 * (f3 * (vbc 
	    - fcpc) + xmc / (pc + pc) * (vbc * vbc - fcpc * fcpc));
/*<       capbc=tr*gbc+czbcf2*(f3+xmc*vbc/pc) >*/
    capbc = tr * gbc + czbcf2 * (f3 + xmc * vbc / pc);
/*<   540 if(vbx.ge.fcpc) go to 550 >*/
L540:
    if (vbx >= fcpc) {
	goto L550;
    }
/*<       arg=1.0d0-vbx/pc >*/
    arg = 1. - vbx / pc;
/*<       sarg=dexp(-xmc*dlog(arg)) >*/
    sarg = exp(-xmc * log(arg));
/*<       qbx(lx0+loct)=pc*czbx*(1.0d0-arg*sarg)/(1.0d0-xmc) >*/
    qbx[tabinf_1.lx0 + loct - 1] = pc * czbx * (1. - arg * sarg) / (1. - xmc);

/*<       capbx=czbx*sarg >*/
    capbx = czbx * sarg;
/*<       go to 560 >*/
    goto L560;
/*<   550 czbxf2=czbx/f2 >*/
L550:
    czbxf2 = czbx / f2;
/*<       qbx(lx0+loct)=czbx*f1+czbxf2*(f3*(vbx-fcpc)+(xmc/(pc+pc))* >*/
/*<      1   (vbx*vbx-fcpc*fcpc)) >*/
    qbx[tabinf_1.lx0 + loct - 1] = czbx * f1 + czbxf2 * (f3 * (vbx - fcpc) + 
	    xmc / (pc + pc) * (vbx * vbx - fcpc * fcpc));
/*<       capbx=czbxf2*(f3+xmc*vbx/pc) >*/
    capbx = czbxf2 * (f3 + xmc * vbx / pc);
/*<   560 if(vcs.ge.0.0d0) go to 570 >*/
L560:
    if (vcs >= 0.) {
	goto L570;
    }
/*<       arg=1.0d0-vcs/ps >*/
    arg = 1. - vcs / ps;
/*<       sarg=dexp(-xms*dlog(arg)) >*/
    sarg = exp(-xms * log(arg));
/*<       qcs(lx0+loct)=ps*czcs*(1.0d0-arg*sarg)/(1.0d0-xms) >*/
    qcs[tabinf_1.lx0 + loct - 1] = ps * czcs * (1. - arg * sarg) / (1. - xms);

/*<       capcs=czcs*sarg >*/
    capcs = czcs * sarg;
/*<       go to 580 >*/
    goto L580;
/*<   570 qcs(lx0+loct)=vcs*czcs*(1.0d0+xms*vcs/(2.0d0*ps)) >*/
L570:
    qcs[tabinf_1.lx0 + loct - 1] = vcs * czcs * (xms * vcs / (ps * 2.) + 1.);
/*<       capcs=czcs*(1.0d0+xms*vcs/ps) >*/
    capcs = czcs * (xms * vcs / ps + 1.);

/*  store small-signal parameters */

/*<   580 if ((mode.eq.1).and.(modedc.eq.2).and.(nosolv.ne.0)) go to 700 >*/
L580:
    if (status_1.mode == 1 && status_1.modedc == 2 && status_1.nosolv != 0) {
	goto L700;
    }
/*<       if (initf.ne.4) go to 600 >*/
    if (status_1.initf != 4) {
	goto L600;
    }
/*<       value(lx0+loct+9)=capbe >*/
    blank_1.value[tabinf_1.lx0 + loct + 8] = capbe;
/*<       value(lx0+loct+11)=capbc >*/
    blank_1.value[tabinf_1.lx0 + loct + 10] = capbc;
/*<       value(lx0+loct+13)=capcs >*/
    blank_1.value[tabinf_1.lx0 + loct + 12] = capcs;
/*<       value(lx0+loct+15)=capbx >*/
    blank_1.value[tabinf_1.lx0 + loct + 14] = capbx;
/*<       value(lx0+loct+17)=geqcb >*/
    blank_1.value[tabinf_1.lx0 + loct + 16] = geqcb;
/*<       go to 1000 >*/
    goto L1000;

/*  transient analysis */

/*<   600 if (initf.ne.5) go to 610 >*/
L600:
    if (status_1.initf != 5) {
	goto L610;
    }
/*<       qbe(lx1+loct)=qbe(lx0+loct) >*/
    qbe[tabinf_1.lx1 + loct - 1] = qbe[tabinf_1.lx0 + loct - 1];
/*<       qbc(lx1+loct)=qbc(lx0+loct) >*/
    qbc[tabinf_1.lx1 + loct - 1] = qbc[tabinf_1.lx0 + loct - 1];
/*<       qbx(lx1+loct)=qbx(lx0+loct) >*/
    qbx[tabinf_1.lx1 + loct - 1] = qbx[tabinf_1.lx0 + loct - 1];
/*<       qcs(lx1+loct)=qcs(lx0+loct) >*/
    qcs[tabinf_1.lx1 + loct - 1] = qcs[tabinf_1.lx0 + loct - 1];
/*<   610 call intgr8(geq,ceq,capbe,loct+8) >*/
L610:
    i_1 = loct + 8;
    intgr8_(&geq, &ceq, &capbe, &i_1);
/*<       geqcb=geqcb*ag(1) >*/
    geqcb *= status_1.ag[0];
/*<       gpi=gpi+geq >*/
    gpi += geq;
/*<       cb=cb+cqbe(lx0+loct) >*/
    cb += cqbe[tabinf_1.lx0 + loct - 1];
/*<       call intgr8(geq,ceq,capbc,loct+10) >*/
    i_1 = loct + 10;
    intgr8_(&geq, &ceq, &capbc, &i_1);
/*<       gmu=gmu+geq >*/
    gmu += geq;
/*<       cb=cb+cqbc(lx0+loct) >*/
    cb += cqbc[tabinf_1.lx0 + loct - 1];
/*<       cc=cc-cqbc(lx0+loct) >*/
    cc -= cqbc[tabinf_1.lx0 + loct - 1];
/*<       if (initf.ne.5) go to 700 >*/
    if (status_1.initf != 5) {
	goto L700;
    }
/*<       cqbe(lx1+loct)=cqbe(lx0+loct) >*/
    cqbe[tabinf_1.lx1 + loct - 1] = cqbe[tabinf_1.lx0 + loct - 1];
/*<       cqbc(lx1+loct)=cqbc(lx0+loct) >*/
    cqbc[tabinf_1.lx1 + loct - 1] = cqbc[tabinf_1.lx0 + loct - 1];

/*  check convergence */

/*<   700 if (initf.ne.3) go to 710 >*/
L700:
    if (status_1.initf != 3) {
	goto L710;
    }
/*<       if (ioff.eq.0) go to 710 >*/
    if (ioff == 0) {
	goto L710;
    }
/*<       go to 750 >*/
    goto L750;
/*<   710 if (icheck.eq.1) go to 720 >*/
L710:
    if (icheck == 1) {
	goto L720;
    }
/*<       tol=reltol*dmax1(dabs(cchat),dabs(cc))+abstol >*/
/* Computing MAX */
    d_1 = abs(cchat), d_2 = abs(cc);
    tol = knstnt_1.reltol * max(d_2,d_1) + knstnt_1.abstol;
/*<       if (dabs(cchat-cc).gt.tol) go to 720 >*/
    if ((d_1 = cchat - cc, abs(d_1)) > tol) {
	goto L720;
    }
/*<       tol=reltol*dmax1(dabs(cbhat),dabs(cb))+abstol >*/
/* Computing MAX */
    d_1 = abs(cbhat), d_2 = abs(cb);
    tol = knstnt_1.reltol * max(d_2,d_1) + knstnt_1.abstol;
/*<       if (dabs(cbhat-cb).le.tol) go to 750 >*/
    if ((d_1 = cbhat - cb, abs(d_1)) <= tol) {
	goto L750;
    }
/*<   720 noncon=noncon+1 >*/
L720:
    ++status_1.noncon;
/*<   750 vbeo(lx0+loct)=vbe >*/
L750:
    vbeo[tabinf_1.lx0 + loct - 1] = vbe;
/*<       vbco(lx0+loct)=vbc >*/
    vbco[tabinf_1.lx0 + loct - 1] = vbc;
/*<       cco(lx0+loct)=cc >*/
    cco[tabinf_1.lx0 + loct - 1] = cc;
/*<       cbo(lx0+loct)=cb >*/
    cbo[tabinf_1.lx0 + loct - 1] = cb;
/*<       gpio(lx0+loct)=gpi >*/
    gpio[tabinf_1.lx0 + loct - 1] = gpi;
/*<       gmuo(lx0+loct)=gmu >*/
    gmuo[tabinf_1.lx0 + loct - 1] = gmu;
/*<       gmo(lx0+loct)=gm >*/
    gmo[tabinf_1.lx0 + loct - 1] = gm;
/*<       goo(lx0+loct)=go >*/
    goo[tabinf_1.lx0 + loct - 1] = go;
/*<       gxo(lx0+loct)=gx >*/
    gxo[tabinf_1.lx0 + loct - 1] = gx;
/*<       geqcbo(lx0+loct)=geqcb >*/
    geqcbo[tabinf_1.lx0 + loct - 1] = geqcb;
/*<       if (mode.eq.1) go to 900 >*/
    if (status_1.mode == 1) {
	goto L900;
    }

/*     charge storage for c-s and b-x junctions */

/*<   800 call intgr8(gccs,ceq,capcs,loct+12) >*/
L800:
    i_1 = loct + 12;
    intgr8_(&gccs, &ceq, &capcs, &i_1);
/*<       ceqcs=type*(cqcs(lx0+loct)-vcs*gccs) >*/
    ceqcs = type * (cqcs[tabinf_1.lx0 + loct - 1] - vcs * gccs);
/*<       call intgr8(geqbx,ceq,capbx,loct+14) >*/
    i_1 = loct + 14;
    intgr8_(&geqbx, &ceq, &capbx, &i_1);
/*<       ceqbx=type*(cqbx(lx0+loct)-vbx*geqbx) >*/
    ceqbx = type * (cqbx[tabinf_1.lx0 + loct - 1] - vbx * geqbx);
/*<       if (initf.ne.5) go to 900 >*/
    if (status_1.initf != 5) {
	goto L900;
    }
/*<       cqbx(lx1+loct)=cqbx(lx0+loct) >*/
    cqbx[tabinf_1.lx1 + loct - 1] = cqbx[tabinf_1.lx0 + loct - 1];
/*<       cqcs(lx1+loct)=cqcs(lx0+loct) >*/
    cqcs[tabinf_1.lx1 + loct - 1] = cqcs[tabinf_1.lx0 + loct - 1];

/*  load current excitation vector */

/*<   900 ceqbe=type*(cc+cb-vbe*(gm+go+gpi)+vbc*(go-geqcb)) >*/
L900:
    ceqbe = type * (cc + cb - vbe * (gm + go + gpi) + vbc * (go - geqcb));
/*<       ceqbc=type*(-cc+vbe*(gm+go)-vbc*(gmu+go)) >*/
    ceqbc = type * (-cc + vbe * (gm + go) - vbc * (gmu + go));
/*<       value(lvn+node2)=value(lvn+node2)-ceqbx >*/
    blank_1.value[tabinf_1.lvn + node2 - 1] -= ceqbx;
/*<       value(lvn+node4)=value(lvn+node4)+ceqcs+ceqbx+ceqbc >*/
    blank_1.value[tabinf_1.lvn + node4 - 1] = blank_1.value[tabinf_1.lvn + 
	    node4 - 1] + ceqcs + ceqbx + ceqbc;
/*<       value(lvn+node5)=value(lvn+node5)-ceqbe-ceqbc >*/
    blank_1.value[tabinf_1.lvn + node5 - 1] = blank_1.value[tabinf_1.lvn + 
	    node5 - 1] - ceqbe - ceqbc;
/*<       value(lvn+node6)=value(lvn+node6)+ceqbe >*/
    blank_1.value[tabinf_1.lvn + node6 - 1] += ceqbe;
/*<       value(lvn+node7)=value(lvn+node7)-ceqcs >*/
    blank_1.value[tabinf_1.lvn + node7 - 1] -= ceqcs;

/*  load y matrix */

/*<       locy=lvn+nodplc(loc+24) >*/
    locy = tabinf_1.lvn + nodplc[loc + 23];
/*<       value(locy)=value(locy)+gcpr >*/
    blank_1.value[locy - 1] += gcpr;
/*<       locy=lvn+nodplc(loc+25) >*/
    locy = tabinf_1.lvn + nodplc[loc + 24];
/*<       value(locy)=value(locy)+gx+geqbx >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] + gx + geqbx;
/*<       locy=lvn+nodplc(loc+26) >*/
    locy = tabinf_1.lvn + nodplc[loc + 25];
/*<       value(locy)=value(locy)+gepr >*/
    blank_1.value[locy - 1] += gepr;
/*<       locy=lvn+nodplc(loc+27) >*/
    locy = tabinf_1.lvn + nodplc[loc + 26];
/*<       value(locy)=value(locy)+gmu+go+gcpr+gccs+geqbx >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] + gmu + go + gcpr + 
	    gccs + geqbx;
/*<       locy=lvn+nodplc(loc+28) >*/
    locy = tabinf_1.lvn + nodplc[loc + 27];
/*<       value(locy)=value(locy)+gx  +gpi+gmu+geqcb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] + gx + gpi + gmu + 
	    geqcb;
/*<       locy=lvn+nodplc(loc+29) >*/
    locy = tabinf_1.lvn + nodplc[loc + 28];
/*<       value(locy)=value(locy)+gpi+gepr+gm+go >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] + gpi + gepr + gm + go;
/*<       locy=lvn+nodplc(loc+10) >*/
    locy = tabinf_1.lvn + nodplc[loc + 9];
/*<       value(locy)=value(locy)-gcpr >*/
    blank_1.value[locy - 1] -= gcpr;
/*<       locy=lvn+nodplc(loc+11) >*/
    locy = tabinf_1.lvn + nodplc[loc + 10];
/*<       value(locy)=value(locy)-gx >*/
    blank_1.value[locy - 1] -= gx;
/*<       locy=lvn+nodplc(loc+12) >*/
    locy = tabinf_1.lvn + nodplc[loc + 11];
/*<       value(locy)=value(locy)-gepr >*/
    blank_1.value[locy - 1] -= gepr;
/*<       locy=lvn+nodplc(loc+13) >*/
    locy = tabinf_1.lvn + nodplc[loc + 12];
/*<       value(locy)=value(locy)-gcpr >*/
    blank_1.value[locy - 1] -= gcpr;
/*<       locy=lvn+nodplc(loc+14) >*/
    locy = tabinf_1.lvn + nodplc[loc + 13];
/*<       value(locy)=value(locy)-gmu+gm >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - gmu + gm;
/*<       locy=lvn+nodplc(loc+15) >*/
    locy = tabinf_1.lvn + nodplc[loc + 14];
/*<       value(locy)=value(locy)-gm-go >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - gm - go;
/*<       locy=lvn+nodplc(loc+16) >*/
    locy = tabinf_1.lvn + nodplc[loc + 15];
/*<       value(locy)=value(locy)-gx >*/
    blank_1.value[locy - 1] -= gx;
/*<       locy=lvn+nodplc(loc+17) >*/
    locy = tabinf_1.lvn + nodplc[loc + 16];
/*<       value(locy)=value(locy)-gmu-geqcb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - gmu - geqcb;
/*<       locy=lvn+nodplc(loc+18) >*/
    locy = tabinf_1.lvn + nodplc[loc + 17];
/*<       value(locy)=value(locy)-gpi >*/
    blank_1.value[locy - 1] -= gpi;
/*<       locy=lvn+nodplc(loc+19) >*/
    locy = tabinf_1.lvn + nodplc[loc + 18];
/*<       value(locy)=value(locy)-gepr >*/
    blank_1.value[locy - 1] -= gepr;
/*<       locy=lvn+nodplc(loc+20) >*/
    locy = tabinf_1.lvn + nodplc[loc + 19];
/*<       value(locy)=value(locy)-go+geqcb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - go + geqcb;
/*<       locy=lvn+nodplc(loc+21) >*/
    locy = tabinf_1.lvn + nodplc[loc + 20];
/*<       value(locy)=value(locy)-gpi-gm-geqcb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - gpi - gm - geqcb;
/*<       locy=lvn+nodplc(loc+31) >*/
    locy = tabinf_1.lvn + nodplc[loc + 30];
/*<       value(locy)=value(locy)+gccs >*/
    blank_1.value[locy - 1] += gccs;
/*<       locy=lvn+nodplc(loc+32) >*/
    locy = tabinf_1.lvn + nodplc[loc + 31];
/*<       value(locy)=value(locy)-gccs >*/
    blank_1.value[locy - 1] -= gccs;
/*<       locy=lvn+nodplc(loc+33) >*/
    locy = tabinf_1.lvn + nodplc[loc + 32];
/*<       value(locy)=value(locy)-gccs >*/
    blank_1.value[locy - 1] -= gccs;
/*<       locy=lvn+nodplc(loc+34) >*/
    locy = tabinf_1.lvn + nodplc[loc + 33];
/*<       value(locy)=value(locy)-geqbx >*/
    blank_1.value[locy - 1] -= geqbx;
/*<       locy=lvn+nodplc(loc+35) >*/
    locy = tabinf_1.lvn + nodplc[loc + 34];
/*<       value(locy)=value(locy)-geqbx >*/
    blank_1.value[locy - 1] -= geqbx;
/*<  1000 loc=nodplc(loc) >*/
L1000:
    loc = nodplc[loc - 1];
/*<       go to 10 >*/
    goto L10;
/*<       end >*/
} /* bjt_ */

#undef gxo
#undef qbx
#undef qcs
#undef goo
#undef gmo
#undef qbe
#undef qbc
#undef cco
#undef cbo
#undef cvalue
#undef nodplc
#undef geqcbo
#undef cexbc
#undef gmuo
#undef cqbx
#undef gpio
#undef cqcs
#undef vbeo
#undef vbco
#undef cqbe
#undef cqbc


