/* mosfet.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 vto, beta, gamma, phi, phib, cox, xnsub, xnfs, xd, xj, xld, 
	    xlamda, uo, uexp, vbp, utra, vmax, xneff, xl, xw, vbi, von, vdsat,
	     qspof, beta0, beta1, cdrain, xqco, xqc, fnarrw, fshort;
    integer lev;
} mosarg_;

#define mosarg_1 mosarg_

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 {
    integer idebug[20];
} debug_;

#define debug_1 debug_

struct {
    doublereal value[200000];
} blank_;

#define blank_1 blank_

/* Table of constant values */

static doublereal c_b73 = 0.;

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

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

    /* Local variables */
    static doublereal cggb, gcgb, gcgd;
#define cbdo ((doublereal *)&blank_1 + 6)
#define cqbd ((doublereal *)&blank_1 + 25)
#define cgbo ((doublereal *)&blank_1 + 18)
#define gbdo ((doublereal *)&blank_1 + 10)
#define cgdo ((doublereal *)&blank_1 + 19)
#define cqgd ((doublereal *)&blank_1 + 15)
#define cqgb ((doublereal *)&blank_1 + 17)
    static doublereal cgsb;
    static integer ioff;
    static doublereal cbsb;
#define cbso ((doublereal *)&blank_1 + 5)
#define cqbs ((doublereal *)&blank_1 + 27)
    static doublereal gmbs;
#define vbdo ((doublereal *)&blank_1)
#define gdso ((doublereal *)&blank_1 + 8)
#define gbso ((doublereal *)&blank_1 + 11)
#define cgso ((doublereal *)&blank_1 + 20)
#define cqgs ((doublereal *)&blank_1 + 13)
#define vbso ((doublereal *)&blank_1 + 1)
#define vgso ((doublereal *)&blank_1 + 2)
#define vdso ((doublereal *)&blank_1 + 3)
#define vono ((doublereal *)&blank_1 + 21)
    static integer locv, locm;
    static doublereal type;
    static integer loct;
    static doublereal gdpr, gspr, vgdo, evbs, evbd, czbd, czbs, twop, fcpb;
    static integer node1, node2, node3, node4, node5, node6;
    static doublereal fcpb2, czdf2, sarg, gcgs, qdrn, qsrc, xnrm, xrev;
    static integer locy;
    static doublereal czsf2, gcbdb, gcddb, gcbgb, gcgdb, gcdgb;
#define cbdbo ((doublereal *)&blank_1 + 22)
    static doublereal capbd;
#define cbgbo ((doublereal *)&blank_1 + 21)
    static doublereal gcggb;
#define cgdbo ((doublereal *)&blank_1 + 19)
    static doublereal ceqbd, gcbsb;
#define cggbo ((doublereal *)&blank_1 + 18)
    static doublereal cdhat, cbhat;
#define cbsbo ((doublereal *)&blank_1 + 23)
#define cgsbo ((doublereal *)&blank_1 + 20)
    static doublereal cdsat, qgate, qchan, capbs, xfact;
#define gmbso ((doublereal *)&blank_1 + 9)
    static doublereal ceqgs, ceqgd, cssat, qbulk, ceqgb, gcgsb, vinit, vcrit, 
	    xmjsw, f1, f2, f3, gcdsb, gcsgb, gcsdb, gcssb, ceqqg, ceqqb, 
	    ceqqd, cgate, cqdrn, ceqbs, cdreq, czdwf2, vdsat1, ad, cd;
    extern /* Subroutine */ int moseq1_(), moseq2_(), moseq3_(), intgr8_();
    static doublereal czswf2;
#define qb ((doublereal *)&blank_1 + 12)
    static doublereal as;
#define qd ((doublereal *)&blank_1 + 16)
    static doublereal pd;
    static integer icheck;
#define qg ((doublereal *)&blank_1 + 14)
    static doublereal gm, delvbd;
#define nodplc ((integer *)&blank_1)
#define cvalue ((complex *)&blank_1)
#define vdsato ((doublereal *)&blank_1 + 22)
    static doublereal devmod, ps, covlgs, covlgd, covlgb;
    static integer ibypas;
    static doublereal delvbs, delvgs, delvds, delvgd;
#define cdo ((doublereal *)&blank_1 + 4)
#define cqb ((doublereal *)&blank_1 + 13)
#define cqd ((doublereal *)&blank_1 + 17)
#define cqg ((doublereal *)&blank_1 + 15)
#define qbd ((doublereal *)&blank_1 + 24)
#define qgd ((doublereal *)&blank_1 + 14)
#define qgb ((doublereal *)&blank_1 + 16)
    static integer loc;
#define gmo ((doublereal *)&blank_1 + 7)
#define qbs ((doublereal *)&blank_1 + 26)
#define qgs ((doublereal *)&blank_1 + 12)
    static doublereal vds, vgs, vbs, vbd, vgd, tol, vgb, cbs, cbd, gds, gbd, 
	    gbs, cgb, cgd, cgs;
    extern /* Subroutine */ int fetlim_(), limvds_(), pnjlim_();
    static doublereal czbdsw, czbssw, xmj, arg, sargsw, vgb1, geq, vgd1, ceq;
    extern /* Subroutine */ int cmeyer_();
    static doublereal cgs1, cgd1, cgb1;
    extern /* Subroutine */ int moscap_();
    static doublereal cqbulk, vgs1, von1, cbdb, cbgb, cgdb;

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

/*     this routine processes mosfets 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=mosarg 3/15/83 */
/*<       common /mosarg/ vto,beta,gamma,phi,phib,cox,xnsub,xnfs,xd,xj,xld, >*/
/*<      1   xlamda,uo,uexp,vbp,utra,vmax,xneff,xl,xw,vbi,von,vdsat,qspof, >*/
/*<      2   beta0,beta1,cdrain,xqco,xqc,fnarrw,fshort,lev >*/
/* 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=debug 3/15/83 */
/*<       common/debug/ idebug(20) >*/
/* 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 vbdo(1),vbso(1),vgso(1),vdso(1),cdo(1),cbso(1),cbdo(1), >*/
/*<      1   gmo(1),gdso(1),gmbso(1),gbdo(1),gbso(1), >*/
/*<      2   qb(1),cqb(1),qg(1),cqg(1),qd(1),cqd(1), >*/
/*<      3   cggbo(1),cgdbo(1),cgsbo(1),cbgbo(1),cbdbo(1),cbsbo(1), >*/
/*<      4   cgbo(1),cgdo(1),cgso(1),vono(1),vdsato(1) >*/
/*<       dimension qbd(1),cqbd(1),qbs(1),cqbs(1), >*/
/*<      1          qgs(1),cqgs(1),qgd(1),cqgd(1),qgb(1),cqgb(1) >*/
/*<       equivalence (vbdo (1),value( 1)),(vbso (1),value( 2)), >*/
/*<      1            (vgso (1),value( 3)),(vdso (1),value( 4)), >*/
/*<      2            (cdo  (1),value( 5)),(cbso (1),value( 6)), >*/
/*<      3            (cbdo (1),value( 7)),(gmo  (1),value( 8)), >*/
/*<      4            (gdso (1),value( 9)),(gmbso(1),value(10)), >*/
/*<      5            (gbdo (1),value(11)),(gbso (1),value(12)), >*/
/*<      6            (qb   (1),qgs  ( 1), value(13)), >*/
/*<      7            (cqb  (1),cqgs ( 1), value(14)), >*/
/*<      8            (qg   (1),qgd  ( 1), value(15)), >*/
/*<      9            (cqg  (1),cqgd ( 1), value(16)), >*/
/*<      a            (qd   (1),qgb  ( 1), value(17)), >*/
/*<      b            (cqd  (1),cqgb ( 1), value(18)), >*/
/*<      c            (cggbo(1),cgbo  (1), value(19)), >*/
/*<      d            (cgdbo(1),cgdo  (1), value(20)), >*/
/*<      e            (cgsbo(1),cgso  (1), value(21)), >*/
/*<      f            (cbgbo(1),vono  (1), value(22)), >*/
/*<      g            (cbdbo(1),vdsato(1), value(23)), >*/
/*<      h            (cbsbo(1),           value(24)) >*/
/*<       equivalence (qbd  (1),value(25)),(cqbd (1),value(26)), >*/
/*<      1            (qbs  (1),value(27)),(cqbs (1),value(28)) >*/


/*<       loc=locate(14) >*/
    loc = cirdat_1.locate[13];
/*<    10 if ((loc.eq.0).or.(nodplc(loc+33).ne.0)) return >*/
L10:
    if (loc == 0 || nodplc[loc + 32] != 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];
/*<       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+26) >*/
    loct = nodplc[loc + 25];

/*  dc model parameters */

/*<       xj=value(locm+27) >*/
    mosarg_1.xj = blank_1.value[locm + 26];
/*<       xld=value(locm+28) >*/
    mosarg_1.xld = blank_1.value[locm + 27];
/*<       xl=value(locv+1)-2.0d0*xld >*/
    mosarg_1.xl = blank_1.value[locv] - mosarg_1.xld * 2.;
/*<       xw=value(locv+2) >*/
    mosarg_1.xw = blank_1.value[locv + 1];
/*<       devmod=value(locv+8) >*/
    devmod = blank_1.value[locv + 7];
/*<       vto=type*value(locm+2) >*/
    mosarg_1.vto = type * blank_1.value[locm + 1];
/*<       vdsat=type*value(locv+10) >*/
    mosarg_1.vdsat = type * blank_1.value[locv + 9];
/*<       vinit=value(locm+43) >*/
    vinit = blank_1.value[locm + 42];
/*<       ad=value(locv+3) >*/
    ad = blank_1.value[locv + 2];
/*<       as=value(locv+4) >*/
    as = blank_1.value[locv + 3];
/*<       pd=value(locv+11) >*/
    pd = blank_1.value[locv + 10];
/*<       ps=value(locv+12) >*/
    ps = blank_1.value[locv + 11];
/*<       if (value(locm+21).eq.0.0d0. >*/
/*<      1   or.ad.eq.0.0d0.or.as.eq.0.0d0) go to 12 >*/
    if (blank_1.value[locm + 20] == 0. || ad == 0. || as == 0.) {
	goto L12;
    }
/*<       cdsat=value(locm+21)*ad >*/
    cdsat = blank_1.value[locm + 20] * ad;
/*<       cssat=value(locm+21)*as >*/
    cssat = blank_1.value[locm + 20] * as;
/*<       go to 15 >*/
    goto L15;
/*<    12 cdsat=value(locm+11) >*/
L12:
    cdsat = blank_1.value[locm + 10];
/*<       cssat=value(locm+11) >*/
    cssat = blank_1.value[locm + 10];
/*<    15 if ((value(locm+7).le.0.0d0).and. >*/
/*<      1              (value(locm+8).le.0.0d0)) go to 17 >*/
L15:
    if (blank_1.value[locm + 6] <= 0. && blank_1.value[locm + 7] <= 0.) {
	goto L17;
    }
/*<       gdpr=value(locm+7) >*/
    gdpr = blank_1.value[locm + 6];
/*<       gspr=value(locm+8) >*/
    gspr = blank_1.value[locm + 7];
/*<       go to 19 >*/
    goto L19;
/*<    17 gdpr=value(locm+16)/value(locv+13) >*/
L17:
    gdpr = blank_1.value[locm + 15] / blank_1.value[locv + 12];
/*<       gspr=value(locm+16)/value(locv+14) >*/
    gspr = blank_1.value[locm + 15] / blank_1.value[locv + 13];
/*<    19 covlgs=value(locm+13)*xw >*/
L19:
    covlgs = blank_1.value[locm + 12] * mosarg_1.xw;
/*<       covlgd=value(locm+14)*xw >*/
    covlgd = blank_1.value[locm + 13] * mosarg_1.xw;
/*<       covlgb=value(locm+15)*xl >*/
    covlgb = blank_1.value[locm + 14] * mosarg_1.xl;
/*<       lev=value(locm+1) >*/
    mosarg_1.lev = (integer) blank_1.value[locm];

/*     mos1, mos2 and mos3 model parameters */

/*<       beta=value(locm+3)*xw/xl >*/
    mosarg_1.beta = blank_1.value[locm + 2] * mosarg_1.xw / mosarg_1.xl;
/*<       gamma=value(locm+4) >*/
    mosarg_1.gamma = blank_1.value[locm + 3];
/*<       phi=value(locm+5) >*/
    mosarg_1.phi = blank_1.value[locm + 4];
/*<       xlamda=value(locm+6) >*/
    mosarg_1.xlamda = blank_1.value[locm + 5];
/*<       phib=value(locm+12) >*/
    mosarg_1.phib = blank_1.value[locm + 11];
/*<       cox=value(locm+22)*xw*xl >*/
    mosarg_1.cox = blank_1.value[locm + 21] * mosarg_1.xw * mosarg_1.xl;
/*<       xnsub=value(locm+23) >*/
    mosarg_1.xnsub = blank_1.value[locm + 22];
/*<       xnfs=value(locm+25) >*/
    mosarg_1.xnfs = blank_1.value[locm + 24];
/*<       uo=value(locm+29) >*/
    mosarg_1.uo = blank_1.value[locm + 28];
/*<       vbp=value(locm+30) >*/
    mosarg_1.vbp = blank_1.value[locm + 29];
/*<       uexp=value(locm+31) >*/
    mosarg_1.uexp = blank_1.value[locm + 30];
/*<       utra=value(locm+32) >*/
    mosarg_1.utra = blank_1.value[locm + 31];
/*<       vbi=type*value(locm+44) >*/
    mosarg_1.vbi = type * blank_1.value[locm + 43];
/*<       xd=value(locm+45) >*/
    mosarg_1.xd = blank_1.value[locm + 44];
/*<       vmax=value(locm+33) >*/
    mosarg_1.vmax = blank_1.value[locm + 32];
/*<       xneff=value(locm+34) >*/
    mosarg_1.xneff = blank_1.value[locm + 33];
/*<       xqco=value(locm+35) >*/
    mosarg_1.xqco = blank_1.value[locm + 34];
/*<       fnarrw=value(locm+39) >*/
    mosarg_1.fnarrw = blank_1.value[locm + 38];
/*<       if (lev.eq.3) fnarrw=fnarrw/xw >*/
    if (mosarg_1.lev == 3) {
	mosarg_1.fnarrw /= mosarg_1.xw;
    }

/*     initialization */

/*<       icheck=1 >*/
    icheck = 1;
/*<       ibypas=0 >*/
    ibypas = 0;
/*<       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 (ioff.ne.0) go to 40 >*/
L20:
    if (ioff != 0) {
	goto L40;
    }
/*<       vds=type*value(locv+5) >*/
    vds = type * blank_1.value[locv + 4];
/*<       vgs=type*value(locv+6) >*/
    vgs = type * blank_1.value[locv + 5];
/*<       vbs=type*value(locv+7) >*/
    vbs = type * blank_1.value[locv + 6];
/*<       if (vds.ne.0.0d0) go to 300 >*/
    if (vds != 0.) {
	goto L300;
    }
/*<       if (vgs.ne.0.0d0) go to 300 >*/
    if (vgs != 0.) {
	goto L300;
    }
/*<       if (vbs.ne.0.0d0) go to 300 >*/
    if (vbs != 0.) {
	goto L300;
    }
/*<       if ((mode.eq.1).and.(modedc.eq.2).and.(nosolv.ne.0)) go to 300 >*/
    if (status_1.mode == 1 && status_1.modedc == 2 && status_1.nosolv != 0) {
	goto L300;
    }
/*<       vbs=vinit >*/
    vbs = vinit;
/*<       vgs=vto >*/
    vgs = mosarg_1.vto;
/*<       vds=0.0d0 >*/
    vds = 0.;
/*<       go to 300 >*/
    goto L300;
/*<    30 if (ioff.eq.0) go to 100 >*/
L30:
    if (ioff == 0) {
	goto L100;
    }
/*<    40 vbs=0.0d0 >*/
L40:
    vbs = 0.;
/*<       vgs=0.0d0 >*/
    vgs = 0.;
/*<       vds=0.0d0 >*/
    vds = 0.;
/*<       go to 300 >*/
    goto L300;
/*<    50 vbs=vbso(lx0+loct) >*/
L50:
    vbs = vbso[tabinf_1.lx0 + loct - 1];
/*<       vgs=vgso(lx0+loct) >*/
    vgs = vgso[tabinf_1.lx0 + loct - 1];
/*<       vds=vdso(lx0+loct) >*/
    vds = vdso[tabinf_1.lx0 + loct - 1];
/*<       go to 300 >*/
    goto L300;
/*<    60 vbs=vbso(lx1+loct) >*/
L60:
    vbs = vbso[tabinf_1.lx1 + loct - 1];
/*<       vgs=vgso(lx1+loct) >*/
    vgs = vgso[tabinf_1.lx1 + loct - 1];
/*<       vds=vdso(lx1+loct) >*/
    vds = vdso[tabinf_1.lx1 + loct - 1];
/*<       go to 300 >*/
    goto L300;
/*<    70 xfact=delta/delold(2) >*/
L70:
    xfact = status_1.delta / status_1.delold[1];
/*<       vbso(lx0+loct)=vbso(lx1+loct) >*/
    vbso[tabinf_1.lx0 + loct - 1] = vbso[tabinf_1.lx1 + loct - 1];
/*<       vbs=(1.0d0+xfact)*vbso(lx1+loct)-xfact*vbso(lx2+loct) >*/
    vbs = (xfact + 1.) * vbso[tabinf_1.lx1 + loct - 1] - xfact * vbso[
	    tabinf_1.lx2 + loct - 1];
/*<       vgso(lx0+loct)=vgso(lx1+loct) >*/
    vgso[tabinf_1.lx0 + loct - 1] = vgso[tabinf_1.lx1 + loct - 1];
/*<       vgs=(1.0d0+xfact)*vgso(lx1+loct)-xfact*vgso(lx2+loct) >*/
    vgs = (xfact + 1.) * vgso[tabinf_1.lx1 + loct - 1] - xfact * vgso[
	    tabinf_1.lx2 + loct - 1];
/*<       vdso(lx0+loct)=vdso(lx1+loct) >*/
    vdso[tabinf_1.lx0 + loct - 1] = vdso[tabinf_1.lx1 + loct - 1];
/*<       vds=(1.0d0+xfact)*vdso(lx1+loct)-xfact*vdso(lx2+loct) >*/
    vds = (xfact + 1.) * vdso[tabinf_1.lx1 + loct - 1] - xfact * vdso[
	    tabinf_1.lx2 + loct - 1];
/*<       vbdo(lx0+loct)=vbso(lx0+loct)-vdso(lx0+loct) >*/
    vbdo[tabinf_1.lx0 + loct - 1] = vbso[tabinf_1.lx0 + loct - 1] - vdso[
	    tabinf_1.lx0 + loct - 1];
/*<       cdo(lx0+loct)=cdo(lx1+loct) >*/
    cdo[tabinf_1.lx0 + loct - 1] = cdo[tabinf_1.lx1 + loct - 1];
/*<       cbso(lx0+loct)=cbso(lx1+loct) >*/
    cbso[tabinf_1.lx0 + loct - 1] = cbso[tabinf_1.lx1 + loct - 1];
/*<       cbdo(lx0+loct)=cbdo(lx1+loct) >*/
    cbdo[tabinf_1.lx0 + loct - 1] = cbdo[tabinf_1.lx1 + loct - 1];
/*<       gmo(lx0+loct)=gmo(lx1+loct) >*/
    gmo[tabinf_1.lx0 + loct - 1] = gmo[tabinf_1.lx1 + loct - 1];
/*<       gdso(lx0+loct)=gdso(lx1+loct) >*/
    gdso[tabinf_1.lx0 + loct - 1] = gdso[tabinf_1.lx1 + loct - 1];
/*<       gmbso(lx0+loct)=gmbso(lx1+loct) >*/
    gmbso[tabinf_1.lx0 + loct - 1] = gmbso[tabinf_1.lx1 + loct - 1];
/*<       gbdo(lx0+loct)=gbdo(lx1+loct) >*/
    gbdo[tabinf_1.lx0 + loct - 1] = gbdo[tabinf_1.lx1 + loct - 1];
/*<       gbso(lx0+loct)=gbso(lx1+loct) >*/
    gbso[tabinf_1.lx0 + loct - 1] = gbso[tabinf_1.lx1 + loct - 1];
/*<       cggbo(lx0+loct)=cggbo(lx1+loct) >*/
    cggbo[tabinf_1.lx0 + loct - 1] = cggbo[tabinf_1.lx1 + loct - 1];
/*<       cgdbo(lx0+loct)=cgdbo(lx1+loct) >*/
    cgdbo[tabinf_1.lx0 + loct - 1] = cgdbo[tabinf_1.lx1 + loct - 1];
/*<       cgsbo(lx0+loct)=cgsbo(lx1+loct) >*/
    cgsbo[tabinf_1.lx0 + loct - 1] = cgsbo[tabinf_1.lx1 + loct - 1];
/*<       cbgbo(lx0+loct)=cbgbo(lx1+loct) >*/
    cbgbo[tabinf_1.lx0 + loct - 1] = cbgbo[tabinf_1.lx1 + loct - 1];
/*<       cbdbo(lx0+loct)=cbdbo(lx1+loct) >*/
    cbdbo[tabinf_1.lx0 + loct - 1] = cbdbo[tabinf_1.lx1 + loct - 1];
/*<       cbsbo(lx0+loct)=cbsbo(lx1+loct) >*/
    cbsbo[tabinf_1.lx0 + loct - 1] = cbsbo[tabinf_1.lx1 + loct - 1];
/*<       go to 110 >*/
    goto L110;

/*  compute new nonlinear branch voltages */

/*<   100 vbs=type*(value(lvnim1+node4)-value(lvnim1+node6)) >*/
L100:
    vbs = type * (blank_1.value[tabinf_1.lvnim1 + node4 - 1] - blank_1.value[
	    tabinf_1.lvnim1 + node6 - 1]);
/*<       vgs=type*(value(lvnim1+node2)-value(lvnim1+node6)) >*/
    vgs = type * (blank_1.value[tabinf_1.lvnim1 + node2 - 1] - blank_1.value[
	    tabinf_1.lvnim1 + node6 - 1]);
/*<       vds=type*(value(lvnim1+node5)-value(lvnim1+node6)) >*/
    vds = type * (blank_1.value[tabinf_1.lvnim1 + node5 - 1] - blank_1.value[
	    tabinf_1.lvnim1 + node6 - 1]);
/*<   110 vbd=vbs-vds >*/
L110:
    vbd = vbs - vds;
/*<       vgd=vgs-vds >*/
    vgd = vgs - vds;
/*<       vgdo=vgso(lx0+loct)-vdso(lx0+loct) >*/
    vgdo = vgso[tabinf_1.lx0 + loct - 1] - vdso[tabinf_1.lx0 + loct - 1];
/*<       delvbs=vbs-vbso(lx0+loct) >*/
    delvbs = vbs - vbso[tabinf_1.lx0 + loct - 1];
/*<       delvbd=vbd-vbdo(lx0+loct) >*/
    delvbd = vbd - vbdo[tabinf_1.lx0 + loct - 1];
/*<       delvgs=vgs-vgso(lx0+loct) >*/
    delvgs = vgs - vgso[tabinf_1.lx0 + loct - 1];
/*<       delvds=vds-vdso(lx0+loct) >*/
    delvds = vds - vdso[tabinf_1.lx0 + loct - 1];
/*<       delvgd=vgd-vgdo >*/
    delvgd = vgd - vgdo;
/*<       if (devmod.lt.0.0d0) go to 120 >*/
    if (devmod < 0.) {
	goto L120;
    }
/*<       cdhat=cdo(lx0+loct)-gbdo(lx0+loct)*delvbd+gmbso(lx0+loct)*delvbs >*/
/*<      1   +gmo(lx0+loct)*delvgs+gdso(lx0+loct)*delvds >*/
    cdhat = cdo[tabinf_1.lx0 + loct - 1] - gbdo[tabinf_1.lx0 + loct - 1] * 
	    delvbd + gmbso[tabinf_1.lx0 + loct - 1] * delvbs + gmo[
	    tabinf_1.lx0 + loct - 1] * delvgs + gdso[tabinf_1.lx0 + loct - 1] 
	    * delvds;
/*<       go to 130 >*/
    goto L130;
/*<   120 cdhat=cdo(lx0+loct)-(gbdo(lx0+loct)-gmbso(lx0+loct))*delvbd >*/
/*<      1   -gmo(lx0+loct)*delvgd+gdso(lx0+loct)*delvds >*/
L120:
    cdhat = cdo[tabinf_1.lx0 + loct - 1] - (gbdo[tabinf_1.lx0 + loct - 1] - 
	    gmbso[tabinf_1.lx0 + loct - 1]) * delvbd - gmo[tabinf_1.lx0 + 
	    loct - 1] * delvgd + gdso[tabinf_1.lx0 + loct - 1] * delvds;
/*<   130 cbhat=cbso(lx0+loct)+cbdo(lx0+loct)+gbdo(lx0+loct)*delvbd >*/
/*<      1   +gbso(lx0+loct)*delvbs >*/
L130:
    cbhat = cbso[tabinf_1.lx0 + loct - 1] + cbdo[tabinf_1.lx0 + loct - 1] + 
	    gbdo[tabinf_1.lx0 + loct - 1] * delvbd + gbso[tabinf_1.lx0 + loct 
	    - 1] * delvbs;

/*  bypass if solution has not changed */

/*<       if (initf.eq.6) go to 200 >*/
    if (status_1.initf == 6) {
	goto L200;
    }
/*<       tol=reltol*dmax1(dabs(vbs),dabs(vbso(lx0+loct)))+vntol >*/
/* Computing MAX */
    d_2 = abs(vbs), d_3 = (d_1 = vbso[tabinf_1.lx0 + loct - 1], abs(d_1));
    tol = knstnt_1.reltol * max(d_3,d_2) + knstnt_1.vntol;
/*<       if (dabs(delvbs).ge.tol) go to 200 >*/
    if (abs(delvbs) >= tol) {
	goto L200;
    }
/*<       tol=reltol*dmax1(dabs(vbd),dabs(vbdo(lx0+loct)))+vntol >*/
/* Computing MAX */
    d_2 = abs(vbd), d_3 = (d_1 = vbdo[tabinf_1.lx0 + loct - 1], abs(d_1));
    tol = knstnt_1.reltol * max(d_3,d_2) + knstnt_1.vntol;
/*<       if (dabs(delvbd).ge.tol) go to 200 >*/
    if (abs(delvbd) >= tol) {
	goto L200;
    }
/*<       tol=reltol*dmax1(dabs(vgs),dabs(vgso(lx0+loct)))+vntol >*/
/* Computing MAX */
    d_2 = abs(vgs), d_3 = (d_1 = vgso[tabinf_1.lx0 + loct - 1], abs(d_1));
    tol = knstnt_1.reltol * max(d_3,d_2) + knstnt_1.vntol;
/*<       if (dabs(delvgs).ge.tol) go to 200 >*/
    if (abs(delvgs) >= tol) {
	goto L200;
    }
/*<       tol=reltol*dmax1(dabs(vds),dabs(vdso(lx0+loct)))+vntol >*/
/* Computing MAX */
    d_2 = abs(vds), d_3 = (d_1 = vdso[tabinf_1.lx0 + loct - 1], abs(d_1));
    tol = knstnt_1.reltol * max(d_3,d_2) + knstnt_1.vntol;
/*<       if (dabs(delvds).ge.tol) go to 200 >*/
    if (abs(delvds) >= tol) {
	goto L200;
    }
/*<       tol=reltol*dmax1(dabs(cdhat),dabs(cdo(lx0+loct)))+abstol >*/
/* Computing MAX */
    d_2 = abs(cdhat), d_3 = (d_1 = cdo[tabinf_1.lx0 + loct - 1], abs(d_1));
    tol = knstnt_1.reltol * max(d_3,d_2) + knstnt_1.abstol;
/*<       if (dabs(cdhat-cdo(lx0+loct)).ge.tol) go to 200 >*/
    if ((d_1 = cdhat - cdo[tabinf_1.lx0 + loct - 1], abs(d_1)) >= tol) {
	goto L200;
    }
/*<       tol=reltol*dmax1(dabs(cbhat),dabs(cbso(lx0+loct)+cbdo(lx0+loct))) >*/
/*<      1   +abstol >*/
/* Computing MAX */
    d_2 = abs(cbhat), d_3 = (d_1 = cbso[tabinf_1.lx0 + loct - 1] + cbdo[
	    tabinf_1.lx0 + loct - 1], abs(d_1));
    tol = knstnt_1.reltol * max(d_3,d_2) + knstnt_1.abstol;
/*<       if (dabs(cbhat-(cbso(lx0+loct)+cbdo(lx0+loct))).ge.tol) go to 200 >*/
    if ((d_1 = cbhat - (cbso[tabinf_1.lx0 + loct - 1] + cbdo[tabinf_1.lx0 + 
	    loct - 1]), abs(d_1)) >= tol) {
	goto L200;
    }
/*<       vbs=vbso(lx0+loct) >*/
    vbs = vbso[tabinf_1.lx0 + loct - 1];
/*<       vbd=vbdo(lx0+loct) >*/
    vbd = vbdo[tabinf_1.lx0 + loct - 1];
/*<       vgs=vgso(lx0+loct) >*/
    vgs = vgso[tabinf_1.lx0 + loct - 1];
/*<       vds=vdso(lx0+loct) >*/
    vds = vdso[tabinf_1.lx0 + loct - 1];
/*<       vgd=vgs-vds >*/
    vgd = vgs - vds;
/*<       vgb=vgs-vbs >*/
    vgb = vgs - vbs;
/*<       cd=cdo(lx0+loct) >*/
    cd = cdo[tabinf_1.lx0 + loct - 1];
/*<       cbs=cbso(lx0+loct) >*/
    cbs = cbso[tabinf_1.lx0 + loct - 1];
/*<       cbd=cbdo(lx0+loct) >*/
    cbd = cbdo[tabinf_1.lx0 + loct - 1];
/*<       cdrain=devmod*(cd+cbd) >*/
    mosarg_1.cdrain = devmod * (cd + cbd);
/*<       gm=gmo(lx0+loct) >*/
    gm = gmo[tabinf_1.lx0 + loct - 1];
/*<       gds=gdso(lx0+loct) >*/
    gds = gdso[tabinf_1.lx0 + loct - 1];
/*<       gmbs=gmbso(lx0+loct) >*/
    gmbs = gmbso[tabinf_1.lx0 + loct - 1];
/*<       gbd=gbdo(lx0+loct) >*/
    gbd = gbdo[tabinf_1.lx0 + loct - 1];
/*<       gbs=gbso(lx0+loct) >*/
    gbs = gbso[tabinf_1.lx0 + loct - 1];
/*<       devmod=value(locv+8) >*/
    devmod = blank_1.value[locv + 7];
/*<       if (mode.ne.1) go to 135 >*/
    if (status_1.mode != 1) {
	goto L135;
    }
/*<       if ((modedc.eq.2).and.(nosolv.ne.0)) go to 135 >*/
    if (status_1.modedc == 2 && status_1.nosolv != 0) {
	goto L135;
    }
/*<       if (xqco.gt.0.5d0) go to 742 >*/
    if (mosarg_1.xqco > .5) {
	goto L742;
    }
/*<       go to 850 >*/
    goto L850;
/*<   135 if (xqco.le.0.5d0) go to 140 >*/
L135:
    if (mosarg_1.xqco <= .5) {
	goto L140;
    }
/*<       cgb=cgbo(lx0+loct) >*/
    cgb = cgbo[tabinf_1.lx0 + loct - 1];
/*<       cgd=cgdo(lx0+loct) >*/
    cgd = cgdo[tabinf_1.lx0 + loct - 1];
/*<       cgs=cgso(lx0+loct) >*/
    cgs = cgso[tabinf_1.lx0 + loct - 1];
/*<       vgs1=vgso(lx1+loct) >*/
    vgs1 = vgso[tabinf_1.lx1 + loct - 1];
/*<       vgb1=vgs1-vbso(lx1+loct) >*/
    vgb1 = vgs1 - vbso[tabinf_1.lx1 + loct - 1];
/*<       vgd1=vgs1-vdso(lx1+loct) >*/
    vgd1 = vgs1 - vdso[tabinf_1.lx1 + loct - 1];
/*<       go to 735 >*/
    goto L735;
/*<   140 cggb=cggbo(lx0+loct) >*/
L140:
    cggb = cggbo[tabinf_1.lx0 + loct - 1];
/*<       cgdb=cgdbo(lx0+loct) >*/
    cgdb = cgdbo[tabinf_1.lx0 + loct - 1];
/*<       cgsb=cgsbo(lx0+loct) >*/
    cgsb = cgsbo[tabinf_1.lx0 + loct - 1];
/*<       cbgb=cbgbo(lx0+loct) >*/
    cbgb = cbgbo[tabinf_1.lx0 + loct - 1];
/*<       cbdb=cbdbo(lx0+loct) >*/
    cbdb = cbdbo[tabinf_1.lx0 + loct - 1];
/*<       cbsb=cbsbo(lx0+loct) >*/
    cbsb = cbsbo[tabinf_1.lx0 + loct - 1];
/*<       xqc=value(locv+15) >*/
    mosarg_1.xqc = blank_1.value[locv + 14];
/*<       ibypas=1 >*/
    ibypas = 1;
/*<       go to 755 >*/
    goto L755;

/*  limit nonlinear branch voltages */

/*<   200 von=type*value(locv+9) >*/
L200:
    mosarg_1.von = type * blank_1.value[locv + 8];
/*<       if (vdso(lx0+loct).lt.0.0d0) go to 205 >*/
    if (vdso[tabinf_1.lx0 + loct - 1] < 0.) {
	goto L205;
    }
/*<       call fetlim(vgs,vgso(lx0+loct),von) >*/
    fetlim_(&vgs, &vgso[tabinf_1.lx0 + loct - 1], &mosarg_1.von);
/*<       vds=vgs-vgd >*/
    vds = vgs - vgd;
/*<       call limvds(vds,vdso(lx0+loct)) >*/
    limvds_(&vds, &vdso[tabinf_1.lx0 + loct - 1]);
/*<       vgd=vgs-vds >*/
    vgd = vgs - vds;
/*<       go to 210 >*/
    goto L210;
/*<   205 call fetlim(vgd,vgdo,von) >*/
L205:
    fetlim_(&vgd, &vgdo, &mosarg_1.von);
/*<       vds=vgs-vgd >*/
    vds = vgs - vgd;
/*<       call limvds(-vds,-vdso(lx0+loct)) >*/
    d_1 = -vds;
    d_2 = -vdso[tabinf_1.lx0 + loct - 1];
    limvds_(&d_1, &d_2);
/*<       vgs=vgd+vds >*/
    vgs = vgd + vds;
/*<   210 if (vds.lt.0.0d0) go to 220 >*/
L210:
    if (vds < 0.) {
	goto L220;
    }
/*<       vcrit=vt*dlog(vt/(root2*cssat)) >*/
    vcrit = status_1.vt * log(status_1.vt / (knstnt_1.root2 * cssat));
/*<       call pnjlim(vbs,vbso(lx0+loct),vt,vcrit,icheck) >*/
    pnjlim_(&vbs, &vbso[tabinf_1.lx0 + loct - 1], &status_1.vt, &vcrit, &
	    icheck);
/*<       vbd=vbs-vds >*/
    vbd = vbs - vds;
/*<       go to 300 >*/
    goto L300;
/*<   220 vcrit=vt*dlog(vt/(root2*cdsat)) >*/
L220:
    vcrit = status_1.vt * log(status_1.vt / (knstnt_1.root2 * cdsat));
/*<       call pnjlim(vbd,vbdo(lx0+loct),vt,vcrit,icheck) >*/
    pnjlim_(&vbd, &vbdo[tabinf_1.lx0 + loct - 1], &status_1.vt, &vcrit, &
	    icheck);
/*<       vbs=vbd+vds >*/
    vbs = vbd + vds;

/*  determine dc current and derivatives */

/*<   300 vbd=vbs-vds >*/
L300:
    vbd = vbs - vds;
/*<       vgd=vgs-vds >*/
    vgd = vgs - vds;
/*<       vgb=vgs-vbs >*/
    vgb = vgs - vbs;
/*<       if (vbs.gt.0.0d0) go to 310 >*/
    if (vbs > 0.) {
	goto L310;
    }
/*<       gbs=cssat/vt >*/
    gbs = cssat / status_1.vt;
/*<       cbs=gbs*vbs >*/
    cbs = gbs * vbs;
/*<       gbs=gbs+gmin >*/
    gbs += knstnt_1.gmin;
/*<       go to 320 >*/
    goto L320;
/*<   310 evbs=dexp(vbs/vt) >*/
L310:
    evbs = exp(vbs / status_1.vt);
/*<       gbs=cssat*evbs/vt+gmin >*/
    gbs = cssat * evbs / status_1.vt + knstnt_1.gmin;
/*<       cbs=cssat*(evbs-1.0d0) >*/
    cbs = cssat * (evbs - 1.);
/*<   320 if (vbd.gt.0.0d0) go to 330 >*/
L320:
    if (vbd > 0.) {
	goto L330;
    }
/*<       gbd=cdsat/vt >*/
    gbd = cdsat / status_1.vt;
/*<       cbd=gbd*vbd >*/
    cbd = gbd * vbd;
/*<       gbd=gbd+gmin >*/
    gbd += knstnt_1.gmin;
/*<       go to 400 >*/
    goto L400;
/*<   330 evbd=dexp(vbd/vt) >*/
L330:
    evbd = exp(vbd / status_1.vt);
/*<       gbd=cdsat*evbd/vt+gmin >*/
    gbd = cdsat * evbd / status_1.vt + knstnt_1.gmin;
/*<       cbd=cdsat*(evbd-1.0d0) >*/
    cbd = cdsat * (evbd - 1.);

/*  compute drain current and derivatives */

/*<   400 if (vds.lt.0.0d0) go to 450 >*/
L400:
    if (vds < 0.) {
	goto L450;
    }

/*  normal mode */

/*<       devmod=1.0d0 >*/
    devmod = 1.;
/*<       value(locv+8)=devmod >*/
    blank_1.value[locv + 7] = devmod;
/*<       go to (405,410,415), lev >*/
    switch (mosarg_1.lev) {
	case 1:  goto L405;
	case 2:  goto L410;
	case 3:  goto L415;
    }
/*<   405 call moseq1(vds,vbs,vgs,gm,gds,gmbs) >*/
L405:
    moseq1_(&vds, &vbs, &vgs, &gm, &gds, &gmbs);
/*<       go to 460 >*/
    goto L460;
/*<   410 call moseq2(vds,vbs,vgs,gm,gds,gmbs, >*/
/*<      1   qgate,qchan,qbulk,cggb,cgdb,cgsb,cbgb,cbdb,cbsb) >*/
L410:
    moseq2_(&vds, &vbs, &vgs, &gm, &gds, &gmbs, &qgate, &qchan, &qbulk, &cggb,
	     &cgdb, &cgsb, &cbgb, &cbdb, &cbsb);
/*<       go to 460 >*/
    goto L460;
/*<   415 call moseq3(vds,vbs,vgs,gm,gds,gmbs, >*/
/*<      1   qgate,qchan,qbulk,cggb,cgdb,cgsb,cbgb,cbdb,cbsb) >*/
L415:
    moseq3_(&vds, &vbs, &vgs, &gm, &gds, &gmbs, &qgate, &qchan, &qbulk, &cggb,
	     &cgdb, &cgsb, &cbgb, &cbdb, &cbsb);
/*<       go to 460 >*/
    goto L460;

/*  inverse mode */

/*<   450 devmod=-1.0d0 >*/
L450:
    devmod = -1.;
/*<       value(locv+8)=devmod >*/
    blank_1.value[locv + 7] = devmod;
/*<       go to (452,453,454), lev >*/
    switch (mosarg_1.lev) {
	case 1:  goto L452;
	case 2:  goto L453;
	case 3:  goto L454;
    }
/*<   452 call moseq1(-vds,vbd,vgd,gm,gds,gmbs) >*/
L452:
    d_1 = -vds;
    moseq1_(&d_1, &vbd, &vgd, &gm, &gds, &gmbs);
/*<       go to 460 >*/
    goto L460;
/*<   453 call moseq2(-vds,vbd,vgd,gm,gds,gmbs, >*/
/*<      1   qgate,qchan,qbulk,cggb,cgsb,cgdb,cbgb,cbsb,cbdb) >*/
L453:
    d_1 = -vds;
    moseq2_(&d_1, &vbd, &vgd, &gm, &gds, &gmbs, &qgate, &qchan, &qbulk, &cggb,
	     &cgsb, &cgdb, &cbgb, &cbsb, &cbdb);
/*<       go to 460 >*/
    goto L460;
/*<   454 call moseq3(-vds,vbd,vgd,gm,gds,gmbs, >*/
/*<      1   qgate,qchan,qbulk,cggb,cgsb,cgdb,cbgb,cbsb,cbdb) >*/
L454:
    d_1 = -vds;
    moseq3_(&d_1, &vbd, &vgd, &gm, &gds, &gmbs, &qgate, &qchan, &qbulk, &cggb,
	     &cgsb, &cgdb, &cbgb, &cbsb, &cbdb);
/*<   460 value(locv+9)=type*von >*/
L460:
    blank_1.value[locv + 8] = type * mosarg_1.von;
/*<       value(locv+10)=type*vdsat >*/
    blank_1.value[locv + 9] = type * mosarg_1.vdsat;
/*<       if (xqco.le.0.5d0) value(locv+15)=xqc >*/
    if (mosarg_1.xqco <= .5) {
	blank_1.value[locv + 14] = mosarg_1.xqc;
    }

/*  compute equivalent drain current source */

/*<   490 cd=devmod*cdrain-cbd >*/
/* L490: */
    cd = devmod * mosarg_1.cdrain - cbd;
/*<       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 650 >*/
    goto L650;

/*  charge storage elements */

/* .. bulk-drain and bulk-source depletion capacitances */

/*<   500 czbd=0.0d0 >*/
L500:
    czbd = 0.;
/*<       czbs=0.0d0 >*/
    czbs = 0.;
/*<       czbdsw=0.0d0 >*/
    czbdsw = 0.;
/*<       czbssw=0.0d0 >*/
    czbssw = 0.;
/*<       if ((value(locm+9).eq.0.0d0).or.(value(locm+10).eq.0.0d0)) >*/
/*<      1   go to 505 >*/
    if (blank_1.value[locm + 8] == 0. || blank_1.value[locm + 9] == 0.) {
	goto L505;
    }
/*<       czbd=value(locm+9) >*/
    czbd = blank_1.value[locm + 8];
/*<       czbs=value(locm+10) >*/
    czbs = blank_1.value[locm + 9];
/*<       go to 510 >*/
    goto L510;
/*<   505 if (value(locm+17).eq.0.0d0) go to 510 >*/
L505:
    if (blank_1.value[locm + 16] == 0.) {
	goto L510;
    }
/*<       czbd=value(locm+17)*ad >*/
    czbd = blank_1.value[locm + 16] * ad;
/*<       czbs=value(locm+17)*as >*/
    czbs = blank_1.value[locm + 16] * as;
/*<   510 if (value(locm+19).eq.0.0d0) go to 515 >*/
L510:
    if (blank_1.value[locm + 18] == 0.) {
	goto L515;
    }
/*<       czbdsw=value(locm+19)*pd >*/
    czbdsw = blank_1.value[locm + 18] * pd;
/*<       czbssw=value(locm+19)*ps >*/
    czbssw = blank_1.value[locm + 18] * ps;
/*<   515 phib=value(locm+12) >*/
L515:
    mosarg_1.phib = blank_1.value[locm + 11];
/*<       xmj=value(locm+18) >*/
    xmj = blank_1.value[locm + 17];
/*<       xmjsw=value(locm+20) >*/
    xmjsw = blank_1.value[locm + 19];
/*<       twop=phib+phib >*/
    twop = mosarg_1.phib + mosarg_1.phib;
/*<       fcpb=value(locm+38) >*/
    fcpb = blank_1.value[locm + 37];
/*<       fcpb2=fcpb*fcpb >*/
    fcpb2 = fcpb * fcpb;
/*<       f1=value(locm+40) >*/
    f1 = blank_1.value[locm + 39];
/*<       f2=value(locm+41) >*/
    f2 = blank_1.value[locm + 40];
/*<       f3=value(locm+42) >*/
    f3 = blank_1.value[locm + 41];
/*<       czsf2=czbs/f2 >*/
    czsf2 = czbs / f2;
/*<       czswf2=czbssw/f2 >*/
    czswf2 = czbssw / f2;
/*<       czdf2=czbd/f2 >*/
    czdf2 = czbd / f2;
/*<       czdwf2=czbdsw/f2 >*/
    czdwf2 = czbdsw / f2;
/*<       if (vbs.ge.fcpb) go to 520 >*/
    if (vbs >= fcpb) {
	goto L520;
    }
/*<       arg=1.0d0-vbs/phib >*/
    arg = 1. - vbs / mosarg_1.phib;
/*<       sarg=dexp(-xmj*dlog(arg)) >*/
    sarg = exp(-xmj * log(arg));
/*<       sargsw=dexp(-xmjsw*dlog(arg)) >*/
    sargsw = exp(-xmjsw * log(arg));
/*<       qbs(lx0+loct)=phib*(czbs*(1.0d0-arg*sarg)/(1.0d0-xmj) >*/
/*<      1                +czbssw*(1.0d0-arg*sargsw)/(1.0d0-xmjsw)) >*/
    qbs[tabinf_1.lx0 + loct - 1] = mosarg_1.phib * (czbs * (1. - arg * sarg) /
	     (1. - xmj) + czbssw * (1. - arg * sargsw) / (1. - xmjsw));
/*<       capbs=czbs*sarg+czbssw*sargsw >*/
    capbs = czbs * sarg + czbssw * sargsw;
/*<       go to 525 >*/
    goto L525;
/*<   520 qbs(lx0+loct)=f1*(czbs+czbssw)+f3*(vbs-fcpb)*(czsf2+czswf2) >*/
/*<      1    +(vbs*vbs-fcpb*fcpb)*(czsf2*xmj+czswf2*xmjsw) >*/
L520:
    qbs[tabinf_1.lx0 + loct - 1] = f1 * (czbs + czbssw) + f3 * (vbs - fcpb) * 
	    (czsf2 + czswf2) + (vbs * vbs - fcpb * fcpb) * (czsf2 * xmj + 
	    czswf2 * xmjsw);
/*<       capbs=f3*(czsf2+czswf2)+vbs/phib*(czsf2*xmj+czswf2*xmjsw) >*/
    capbs = f3 * (czsf2 + czswf2) + vbs / mosarg_1.phib * (czsf2 * xmj + 
	    czswf2 * xmjsw);
/*<   525 if (vbd.ge.fcpb) go to 530 >*/
L525:
    if (vbd >= fcpb) {
	goto L530;
    }
/*<       arg=1.0d0-vbd/phib >*/
    arg = 1. - vbd / mosarg_1.phib;
/*<       sarg=dexp(-xmj*dlog(arg)) >*/
    sarg = exp(-xmj * log(arg));
/*<       sargsw=dexp(-xmjsw*dlog(arg)) >*/
    sargsw = exp(-xmjsw * log(arg));
/*<       qbd(lx0+loct)=phib*(czbd*(1.0d0-arg*sarg)/(1.0d0-xmj) >*/
/*<      1              +czbdsw*(1.0d0-arg*sargsw)/(1.0d0-xmjsw)) >*/
    qbd[tabinf_1.lx0 + loct - 1] = mosarg_1.phib * (czbd * (1. - arg * sarg) /
	     (1. - xmj) + czbdsw * (1. - arg * sargsw) / (1. - xmjsw));
/*<       capbd=czbd*sarg+czbdsw*sargsw >*/
    capbd = czbd * sarg + czbdsw * sargsw;
/*<       go to 560 >*/
    goto L560;
/*<   530 qbd(lx0+loct)=f1*(czbd+czbdsw)+f3*(vbd-fcpb)*(czdf2+czdwf2) >*/
/*<      1    +(vbd*vbd-fcpb*fcpb)*(czdf2*xmj+czdwf2*xmjsw) >*/
L530:
    qbd[tabinf_1.lx0 + loct - 1] = f1 * (czbd + czbdsw) + f3 * (vbd - fcpb) * 
	    (czdf2 + czdwf2) + (vbd * vbd - fcpb * fcpb) * (czdf2 * xmj + 
	    czdwf2 * xmjsw);
/*<       capbd=f3*(czdf2+czdwf2)+vbd/phib*(czdf2*xmj+czdwf2*xmjsw) >*/
    capbd = f3 * (czdf2 + czdwf2) + vbd / mosarg_1.phib * (czdf2 * xmj + 
	    czdwf2 * xmjsw);

/*<   560 if (xqco.le.0.5d0) go to 650 >*/
L560:
    if (mosarg_1.xqco <= .5) {
	goto L650;
    }
/*<       if ((mode.eq.1).and.(modedc.eq.2).and.(nosolv.ne.0)) go to 650 >*/
    if (status_1.mode == 1 && status_1.modedc == 2 && status_1.nosolv != 0) {
	goto L650;
    }
/*<       if (initf.ne.4) go to 600 >*/
    if (status_1.initf != 4) {
	goto L600;
    }
/*<       go to 705 >*/
    goto L705;

/* c    calculate equivalent conductances and currents for */
/* c    depletion capacitors */

/*<   600 if (initf.ne.5) go to 610 >*/
L600:
    if (status_1.initf != 5) {
	goto L610;
    }
/*<       qbd(lx1+loct)=qbd(lx0+loct) >*/
    qbd[tabinf_1.lx1 + loct - 1] = qbd[tabinf_1.lx0 + loct - 1];
/*<       qbs(lx1+loct)=qbs(lx0+loct) >*/
    qbs[tabinf_1.lx1 + loct - 1] = qbs[tabinf_1.lx0 + loct - 1];
/*<   610 call intgr8(geq,ceq,capbd,loct+24) >*/
L610:
    i_1 = loct + 24;
    intgr8_(&geq, &ceq, &capbd, &i_1);
/*<       gbd=gbd+geq >*/
    gbd += geq;
/*<       cbd=cbd+cqbd(lx0+loct) >*/
    cbd += cqbd[tabinf_1.lx0 + loct - 1];
/*<       cd=cd-cqbd(lx0+loct) >*/
    cd -= cqbd[tabinf_1.lx0 + loct - 1];
/*<       call intgr8(geq,ceq,capbs,loct+26) >*/
    i_1 = loct + 26;
    intgr8_(&geq, &ceq, &capbs, &i_1);
/*<       gbs=gbs+geq >*/
    gbs += geq;
/*<       cbs=cbs+cqbs(lx0+loct) >*/
    cbs += cqbs[tabinf_1.lx0 + loct - 1];
/*<       if (initf.ne.5) go to 650 >*/
    if (status_1.initf != 5) {
	goto L650;
    }
/*<       cqbd(lx1+loct)=cqbd(lx0+loct) >*/
    cqbd[tabinf_1.lx1 + loct - 1] = cqbd[tabinf_1.lx0 + loct - 1];
/*<       cqbs(lx1+loct)=cqbs(lx0+loct) >*/
    cqbs[tabinf_1.lx1 + loct - 1] = cqbs[tabinf_1.lx0 + loct - 1];

/*  check convergence */

/*<   650 if (initf.ne.3) go to 660 >*/
L650:
    if (status_1.initf != 3) {
	goto L660;
    }
/*<       if (ioff.ne.0) go to 680 >*/
    if (ioff != 0) {
	goto L680;
    }
/*<   660 if (icheck.eq.1) go to 670 >*/
L660:
    if (icheck == 1) {
	goto L670;
    }
/*<       tol=reltol*dmax1(dabs(cdhat),dabs(cd))+abstol >*/
/* Computing MAX */
    d_1 = abs(cdhat), d_2 = abs(cd);
    tol = knstnt_1.reltol * max(d_2,d_1) + knstnt_1.abstol;
/*<       if (dabs(cdhat-cd).ge.tol) go to 670 >*/
    if ((d_1 = cdhat - cd, abs(d_1)) >= tol) {
	goto L670;
    }
/*<       tol=reltol*dmax1(dabs(cbhat),dabs(cbs+cbd))+abstol >*/
/* Computing MAX */
    d_2 = abs(cbhat), d_3 = (d_1 = cbs + cbd, abs(d_1));
    tol = knstnt_1.reltol * max(d_3,d_2) + knstnt_1.abstol;
/*<       if (dabs(cbhat-(cbs+cbd)).le.tol) go to 680 >*/
    if ((d_1 = cbhat - (cbs + cbd), abs(d_1)) <= tol) {
	goto L680;
    }
/*<   670 noncon=noncon+1 >*/
L670:
    ++status_1.noncon;
/*<   680 vbso(lx0+loct)=vbs >*/
L680:
    vbso[tabinf_1.lx0 + loct - 1] = vbs;
/*<       vbdo(lx0+loct)=vbd >*/
    vbdo[tabinf_1.lx0 + loct - 1] = vbd;
/*<       vgso(lx0+loct)=vgs >*/
    vgso[tabinf_1.lx0 + loct - 1] = vgs;
/*<       vdso(lx0+loct)=vds >*/
    vdso[tabinf_1.lx0 + loct - 1] = vds;
/*<       cdo(lx0+loct)=cd >*/
    cdo[tabinf_1.lx0 + loct - 1] = cd;
/*<       cbso(lx0+loct)=cbs >*/
    cbso[tabinf_1.lx0 + loct - 1] = cbs;
/*<       cbdo(lx0+loct)=cbd >*/
    cbdo[tabinf_1.lx0 + loct - 1] = cbd;
/*<       gmo(lx0+loct)=gm >*/
    gmo[tabinf_1.lx0 + loct - 1] = gm;
/*<       gdso(lx0+loct)=gds >*/
    gdso[tabinf_1.lx0 + loct - 1] = gds;
/*<       gmbso(lx0+loct)=gmbs >*/
    gmbso[tabinf_1.lx0 + loct - 1] = gmbs;
/*<       gbdo(lx0+loct)=gbd >*/
    gbdo[tabinf_1.lx0 + loct - 1] = gbd;
/*<       gbso(lx0+loct)=gbs >*/
    gbso[tabinf_1.lx0 + loct - 1] = gbs;
/*<       if (xqco.le.0.5d0) go to 690 >*/
    if (mosarg_1.xqco <= .5) {
	goto L690;
    }
/*<       vono(lx0+loct)=von >*/
    vono[tabinf_1.lx0 + loct - 1] = mosarg_1.von;
/*<       vdsato(lx0+loct)=vdsat >*/
    vdsato[tabinf_1.lx0 + loct - 1] = mosarg_1.vdsat;
/*<       go to 700 >*/
    goto L700;
/*<   690 cggbo(lx0+loct)=cggb >*/
L690:
    cggbo[tabinf_1.lx0 + loct - 1] = cggb;
/*<       cgdbo(lx0+loct)=cgdb >*/
    cgdbo[tabinf_1.lx0 + loct - 1] = cgdb;
/*<       cgsbo(lx0+loct)=cgsb >*/
    cgsbo[tabinf_1.lx0 + loct - 1] = cgsb;
/*<       cbgbo(lx0+loct)=cbgb >*/
    cbgbo[tabinf_1.lx0 + loct - 1] = cbgb;
/*<       cbdbo(lx0+loct)=cbdb >*/
    cbdbo[tabinf_1.lx0 + loct - 1] = cbdb;
/*<       cbsbo(lx0+loct)=cbsb >*/
    cbsbo[tabinf_1.lx0 + loct - 1] = cbsb;
/*<       go to 750 >*/
    goto L750;

/*     xqco > 0.5d0 use meyer"s capacitor model */

/*<   700 if (mode.ne.1) go to 705 >*/
L700:
    if (status_1.mode != 1) {
	goto L705;
    }
/*<       if ((modedc.eq.2).and.(nosolv.ne.0)) go to 705 >*/
    if (status_1.modedc == 2 && status_1.nosolv != 0) {
	goto L705;
    }
/*<       if (initf.eq.4) go to 705 >*/
    if (status_1.initf == 4) {
	goto L705;
    }
/*<       go to 742 >*/
    goto L742;

/*     calculate meyer's capacitors */

/*<   705 von1=von >*/
L705:
    von1 = mosarg_1.von;
/*<       vgs1=vgs >*/
    vgs1 = vgs;
/*<       vgd1=vgd >*/
    vgd1 = vgd;
/*<       vgb1=vgs-vbs >*/
    vgb1 = vgs - vbs;
/*<       vdsat1=vdsat >*/
    vdsat1 = mosarg_1.vdsat;
/*<       if ((mode.ne.2).or.(initf.eq.5)) go to 710 >*/
    if (status_1.mode != 2 || status_1.initf == 5) {
	goto L710;
    }
/*<       von1=vono(lx1+loct) >*/
    von1 = vono[tabinf_1.lx1 + loct - 1];
/*<       vgs1=vgso(lx1+loct) >*/
    vgs1 = vgso[tabinf_1.lx1 + loct - 1];
/*<       vgd1=vgs1-vdso(lx1+loct) >*/
    vgd1 = vgs1 - vdso[tabinf_1.lx1 + loct - 1];
/*<       vgb1=vgs1-vbso(lx1+loct) >*/
    vgb1 = vgs1 - vbso[tabinf_1.lx1 + loct - 1];
/*<       vdsat1=vdsato(lx1+loct) >*/
    vdsat1 = vdsato[tabinf_1.lx1 + loct - 1];
/*<   710 if (devmod.lt.0.0d0) go to 715 >*/
L710:
    if (devmod < 0.) {
	goto L715;
    }
/*<       call cmeyer (vgs1,vgd1,vgb1,von1,vdsat1,vgs,vgd,vgb, >*/
/*<      1   covlgs,covlgd,covlgb,cgs1,cgd1,cgb1,cgs,cgd,cgb) >*/
    cmeyer_(&vgs1, &vgd1, &vgb1, &von1, &vdsat1, &vgs, &vgd, &vgb, &covlgs, &
	    covlgd, &covlgb, &cgs1, &cgd1, &cgb1, &cgs, &cgd, &cgb);
/*<       go to 720 >*/
    goto L720;
/*<   715 call cmeyer (vgd1,vgs1,vgb1,von1,vdsat1,vgd,vgs,vgb, >*/
/*<      1   covlgd,covlgs,covlgb,cgd1,cgs1,cgb1,cgd,cgs,cgb) >*/
L715:
    cmeyer_(&vgd1, &vgs1, &vgb1, &von1, &vdsat1, &vgd, &vgs, &vgb, &covlgd, &
	    covlgs, &covlgb, &cgd1, &cgs1, &cgb1, &cgd, &cgs, &cgb);
/*<   720 cgs=0.5d0*(cgs+cgs1) >*/
L720:
    cgs = (cgs + cgs1) * .5;
/*<       cgd=0.5d0*(cgd+cgd1) >*/
    cgd = (cgd + cgd1) * .5;
/*<       cgb=0.5d0*(cgb+cgb1) >*/
    cgb = (cgb + cgb1) * .5;

/*     store small-signal parameters (for meyer"s model) */

/*<       if (mode.ne.1) go to 730 >*/
    if (status_1.mode != 1) {
	goto L730;
    }
/*<       if (initf.ne.4) go to 730 >*/
    if (status_1.initf != 4) {
	goto L730;
    }
/*<       value(lx0+loct+24)=capbd >*/
    blank_1.value[tabinf_1.lx0 + loct + 23] = capbd;
/*<       value(lx0+loct+26)=capbs >*/
    blank_1.value[tabinf_1.lx0 + loct + 25] = capbs;
/*<       value(lx0+loct+12)=cgs-covlgs >*/
    blank_1.value[tabinf_1.lx0 + loct + 11] = cgs - covlgs;
/*<       value(lx0+loct+14)=cgd-covlgd >*/
    blank_1.value[tabinf_1.lx0 + loct + 13] = cgd - covlgd;
/*<       value(lx0+loct+16)=cgb-covlgb >*/
    blank_1.value[tabinf_1.lx0 + loct + 15] = cgb - covlgb;
/*<       go to 1000 >*/
    goto L1000;
/* c */
/*<   730 if (initf.ne.6) go to 735 >*/
L730:
    if (status_1.initf != 6) {
	goto L735;
    }
/*<       qgs(lx0+loct)=(1.0d0+xfact)*qgs(lx1+loct)-xfact*qgs(lx2+loct) >*/
    qgs[tabinf_1.lx0 + loct - 1] = (xfact + 1.) * qgs[tabinf_1.lx1 + loct - 1]
	     - xfact * qgs[tabinf_1.lx2 + loct - 1];
/*<       qgd(lx0+loct)=(1.0d0+xfact)*qgd(lx1+loct)-xfact*qgd(lx2+loct) >*/
    qgd[tabinf_1.lx0 + loct - 1] = (xfact + 1.) * qgd[tabinf_1.lx1 + loct - 1]
	     - xfact * qgd[tabinf_1.lx2 + loct - 1];
/*<       qgb(lx0+loct)=(1.0d0+xfact)*qgb(lx1+loct)-xfact*qgb(lx2+loct) >*/
    qgb[tabinf_1.lx0 + loct - 1] = (xfact + 1.) * qgb[tabinf_1.lx1 + loct - 1]
	     - xfact * qgb[tabinf_1.lx2 + loct - 1];
/*<       go to 745 >*/
    goto L745;
/*<   735 qgs(lx0+loct)=(vgs-vgs1)*cgs >*/
L735:
    qgs[tabinf_1.lx0 + loct - 1] = (vgs - vgs1) * cgs;
/*<       qgd(lx0+loct)=(vgd-vgd1)*cgd >*/
    qgd[tabinf_1.lx0 + loct - 1] = (vgd - vgd1) * cgd;
/*<       qgb(lx0+loct)=(vgb-vgb1)*cgb >*/
    qgb[tabinf_1.lx0 + loct - 1] = (vgb - vgb1) * cgb;
/*<       if((mode.ne.2).or.(initf.eq.5))go to 740 >*/
    if (status_1.mode != 2 || status_1.initf == 5) {
	goto L740;
    }
/*<       qgs(lx0+loct)=qgs(lx0+loct)+qgs(lx1+loct) >*/
    qgs[tabinf_1.lx0 + loct - 1] += qgs[tabinf_1.lx1 + loct - 1];
/*<       qgd(lx0+loct)=qgd(lx0+loct)+qgd(lx1+loct) >*/
    qgd[tabinf_1.lx0 + loct - 1] += qgd[tabinf_1.lx1 + loct - 1];
/*<       qgb(lx0+loct)=qgb(lx0+loct)+qgb(lx1+loct) >*/
    qgb[tabinf_1.lx0 + loct - 1] += qgb[tabinf_1.lx1 + loct - 1];
/*<   740 if((mode.eq.1).and.(modedc.eq.2).and.(nosolv.ne.0)) go to 742 >*/
L740:
    if (status_1.mode == 1 && status_1.modedc == 2 && status_1.nosolv != 0) {
	goto L742;
    }
/*<       if (initf.ne.5) go to 745 >*/
    if (status_1.initf != 5) {
	goto L745;
    }
/*<       qgs(lx0+loct)=cgs*vgs >*/
    qgs[tabinf_1.lx0 + loct - 1] = cgs * vgs;
/*<       qgd(lx0+loct)=cgd*vgd >*/
    qgd[tabinf_1.lx0 + loct - 1] = cgd * vgd;
/*<       qgb(lx0+loct)=cgb*vgb >*/
    qgb[tabinf_1.lx0 + loct - 1] = cgb * vgb;
/*<       qgs(lx1+loct)=qgs(lx0+loct) >*/
    qgs[tabinf_1.lx1 + loct - 1] = qgs[tabinf_1.lx0 + loct - 1];
/*<       qgd(lx1+loct)=qgd(lx0+loct) >*/
    qgd[tabinf_1.lx1 + loct - 1] = qgd[tabinf_1.lx0 + loct - 1];
/*<       qgb(lx1+loct)=qgb(lx0+loct) >*/
    qgb[tabinf_1.lx1 + loct - 1] = qgb[tabinf_1.lx0 + loct - 1];

/*     initialize to zero charge conductances and current */

/*<   742 gcgs=0.0d0 >*/
L742:
    gcgs = 0.;
/*<       ceqgs=0.0d0 >*/
    ceqgs = 0.;
/*<       gcgd=0.0d0 >*/
    gcgd = 0.;
/*<       ceqgd=0.0d0 >*/
    ceqgd = 0.;
/*<       gcgb=0.0d0 >*/
    gcgb = 0.;
/*<       ceqgb=0.0d0 >*/
    ceqgb = 0.;
/*<       go to  870 >*/
    goto L870;
/* c */
/*<  745  if(cgs.eq.0.0d0) value(lx0+loct+13)=0.0d0 >*/
L745:
    if (cgs == 0.) {
	blank_1.value[tabinf_1.lx0 + loct + 12] = 0.;
    }
/*<       if(cgd.eq.0.0d0) value(lx0+loct+15)=0.0d0 >*/
    if (cgd == 0.) {
	blank_1.value[tabinf_1.lx0 + loct + 14] = 0.;
    }
/*<       if(cgb.eq.0.0d0) value(lx0+loct+17)=0.0d0 >*/
    if (cgb == 0.) {
	blank_1.value[tabinf_1.lx0 + loct + 16] = 0.;
    }
/* c */
/* c    calculate equivalent conductances and currents for */
/* c    meyer"s capacitors */
/* c */
/*<       call intgr8(gcgs,ceqgs,cgs,loct+12) >*/
    i_1 = loct + 12;
    intgr8_(&gcgs, &ceqgs, &cgs, &i_1);
/*<       call intgr8(gcgd,ceqgd,cgd,loct+14) >*/
    i_1 = loct + 14;
    intgr8_(&gcgd, &ceqgd, &cgd, &i_1);
/*<       call intgr8(gcgb,ceqgb,cgb,loct+16) >*/
    i_1 = loct + 16;
    intgr8_(&gcgb, &ceqgb, &cgb, &i_1);
/*<       ceqgs=ceqgs-gcgs*vgs+ag(1)*qgs(lx0+loct) >*/
    ceqgs = ceqgs - gcgs * vgs + status_1.ag[0] * qgs[tabinf_1.lx0 + loct - 1]
	    ;
/*<       ceqgd=ceqgd-gcgd*vgd+ag(1)*qgd(lx0+loct) >*/
    ceqgd = ceqgd - gcgd * vgd + status_1.ag[0] * qgd[tabinf_1.lx0 + loct - 1]
	    ;
/*<       ceqgb=ceqgb-gcgb*vgb+ag(1)*qgb(lx0+loct) >*/
    ceqgb = ceqgb - gcgb * vgb + status_1.ag[0] * qgb[tabinf_1.lx0 + loct - 1]
	    ;
/*<       if (initf.ne.5) go to 870 >*/
    if (status_1.initf != 5) {
	goto L870;
    }
/*<       cqgs(lx1+loct)=cqgs(lx0+loct) >*/
    cqgs[tabinf_1.lx1 + loct - 1] = cqgs[tabinf_1.lx0 + loct - 1];
/*<       cqgd(lx1+loct)=cqgd(lx0+loct) >*/
    cqgd[tabinf_1.lx1 + loct - 1] = cqgd[tabinf_1.lx0 + loct - 1];
/*<       cqgb(lx1+loct)=cqgb(lx0+loct) >*/
    cqgb[tabinf_1.lx1 + loct - 1] = cqgb[tabinf_1.lx0 + loct - 1];
/*<       go to 870 >*/
    goto L870;

/* .. bulk and channel charge (plus overlaps) */

/*<   750 if (mode.ne.1) go to 755 >*/
L750:
    if (status_1.mode != 1) {
	goto L755;
    }
/*<       if ((modedc.eq.2).and.(nosolv.ne.0)) go to 755 >*/
    if (status_1.modedc == 2 && status_1.nosolv != 0) {
	goto L755;
    }
/*<       if (initf.eq.4) go to 755 >*/
    if (status_1.initf == 4) {
	goto L755;
    }
/*<       go to 850 >*/
    goto L850;
/*<   755 if (devmod.eq.-1.0d0) go to 760 >*/
L755:
    if (devmod == -1.) {
	goto L760;
    }
/*<       call moscap(vgd,vgs,vgb,covlgd,covlgs,covlgb, >*/
/*<      1   capbd,capbs,cggb,cgdb,cgsb,cbgb,cbdb,cbsb, >*/
/*<      2   gcggb,gcgdb,gcgsb,gcbgb,gcbdb,gcbsb, >*/
/*<      3   gcdgb,gcddb,gcdsb,gcsgb,gcsdb,gcssb, >*/
/*<      4   qgate,qchan,qbulk,qdrn,qsrc) >*/
    moscap_(&vgd, &vgs, &vgb, &covlgd, &covlgs, &covlgb, &capbd, &capbs, &
	    cggb, &cgdb, &cgsb, &cbgb, &cbdb, &cbsb, &gcggb, &gcgdb, &gcgsb, &
	    gcbgb, &gcbdb, &gcbsb, &gcdgb, &gcddb, &gcdsb, &gcsgb, &gcsdb, &
	    gcssb, &qgate, &qchan, &qbulk, &qdrn, &qsrc);
/*<       go to 780 >*/
    goto L780;
/*<   760 call moscap(vgs,vgd,vgb,covlgs,covlgd,covlgb, >*/
/*<      1   capbs,capbd,cggb,cgsb,cgdb,cbgb,cbsb,cbdb, >*/
/*<      2   gcggb,gcgsb,gcgdb,gcbgb,gcbsb,gcbdb, >*/
/*<      3   gcsgb,gcssb,gcsdb,gcdgb,gcdsb,gcddb, >*/
/*<      4   qgate,qchan,qbulk,qsrc,qdrn) >*/
L760:
    moscap_(&vgs, &vgd, &vgb, &covlgs, &covlgd, &covlgb, &capbs, &capbd, &
	    cggb, &cgsb, &cgdb, &cbgb, &cbsb, &cbdb, &gcggb, &gcgsb, &gcgdb, &
	    gcbgb, &gcbsb, &gcbdb, &gcsgb, &gcssb, &gcsdb, &gcdgb, &gcdsb, &
	    gcddb, &qgate, &qchan, &qbulk, &qsrc, &qdrn);
/*<   780 if (ibypas.eq.1) go to 860 >*/
L780:
    if (ibypas == 1) {
	goto L860;
    }
/*<       qg(lx0+loct)=qgate >*/
    qg[tabinf_1.lx0 + loct - 1] = qgate;
/*<       qd(lx0+loct)=qdrn-qbd(lx0+loct) >*/
    qd[tabinf_1.lx0 + loct - 1] = qdrn - qbd[tabinf_1.lx0 + loct - 1];
/*<       qb(lx0+loct)=qbulk+qbd(lx0+loct)+qbs(lx0+loct) >*/
    qb[tabinf_1.lx0 + loct - 1] = qbulk + qbd[tabinf_1.lx0 + loct - 1] + qbs[
	    tabinf_1.lx0 + loct - 1];

/*  store small-signal parameters */

/*<   790 if ((mode.eq.1).and.(modedc.eq.2).and.(nosolv.ne.0)) go to 850 >*/
/* L790: */
    if (status_1.mode == 1 && status_1.modedc == 2 && status_1.nosolv != 0) {
	goto L850;
    }
/*<       if (initf.ne.4) go to 800 >*/
    if (status_1.initf != 4) {
	goto L800;
    }
/*<       value(lx0+loct+18)=cggb >*/
    blank_1.value[tabinf_1.lx0 + loct + 17] = cggb;
/*<       value(lx0+loct+19)=cgdb >*/
    blank_1.value[tabinf_1.lx0 + loct + 18] = cgdb;
/*<       value(lx0+loct+20)=cgsb >*/
    blank_1.value[tabinf_1.lx0 + loct + 19] = cgsb;
/*<       value(lx0+loct+21)=cbgb >*/
    blank_1.value[tabinf_1.lx0 + loct + 20] = cbgb;
/*<       value(lx0+loct+22)=cbdb >*/
    blank_1.value[tabinf_1.lx0 + loct + 21] = cbdb;
/*<       value(lx0+loct+23)=cbsb >*/
    blank_1.value[tabinf_1.lx0 + loct + 22] = cbsb;
/*<       value(lx0+loct+24)=capbd >*/
    blank_1.value[tabinf_1.lx0 + loct + 23] = capbd;
/*<       value(lx0+loct+26)=capbs >*/
    blank_1.value[tabinf_1.lx0 + loct + 25] = capbs;
/*<       go to 1000 >*/
    goto L1000;

/*  transient analysis */

/*<   800 if (initf.ne.5) go to 810 >*/
L800:
    if (status_1.initf != 5) {
	goto L810;
    }
/*<       qb(lx1+loct)=qb(lx0+loct) >*/
    qb[tabinf_1.lx1 + loct - 1] = qb[tabinf_1.lx0 + loct - 1];
/*<       qg(lx1+loct)=qg(lx0+loct) >*/
    qg[tabinf_1.lx1 + loct - 1] = qg[tabinf_1.lx0 + loct - 1];
/*<       qd(lx1+loct)=qd(lx0+loct) >*/
    qd[tabinf_1.lx1 + loct - 1] = qd[tabinf_1.lx0 + loct - 1];
/* .. integrate qb */
/*<   810 call intgr8(geq,ceq,0.0d0,loct+12) >*/
L810:
    i_1 = loct + 12;
    intgr8_(&geq, &ceq, &c_b73, &i_1);
/* .. integrate qg */
/*<       call intgr8(geq,ceq,0.0d0,loct+14) >*/
    i_1 = loct + 14;
    intgr8_(&geq, &ceq, &c_b73, &i_1);
/* .. integrate qd */
/*<       call intgr8(geq,ceq,0.0d0,loct+16) >*/
    i_1 = loct + 16;
    intgr8_(&geq, &ceq, &c_b73, &i_1);
/*<       go to 860 >*/
    goto L860;

/*     initialize to zero charge conductances and current */

/*<   850 ceqqg=0.0d0 >*/
L850:
    ceqqg = 0.;
/*<       ceqqb=0.0d0 >*/
    ceqqb = 0.;
/*<       ceqqd=0.0d0 >*/
    ceqqd = 0.;
/*<       gcdgb=0.0d0 >*/
    gcdgb = 0.;
/*<       gcddb=0.0d0 >*/
    gcddb = 0.;
/*<       gcdsb=0.0d0 >*/
    gcdsb = 0.;
/*<       gcsgb=0.0d0 >*/
    gcsgb = 0.;
/*<       gcsdb=0.0d0 >*/
    gcsdb = 0.;
/*<       gcssb=0.0d0 >*/
    gcssb = 0.;
/*<       gcggb=0.0d0 >*/
    gcggb = 0.;
/*<       gcgdb=0.0d0 >*/
    gcgdb = 0.;
/*<       gcgsb=0.0d0 >*/
    gcgsb = 0.;
/*<       gcbgb=0.0d0 >*/
    gcbgb = 0.;
/*<       gcbdb=0.0d0 >*/
    gcbdb = 0.;
/*<       gcbsb=0.0d0 >*/
    gcbsb = 0.;
/*<       go to 900 >*/
    goto L900;

/*     evaluate equivalent charge currents */

/*<   860 cgate=cqg(lx0+loct) >*/
L860:
    cgate = cqg[tabinf_1.lx0 + loct - 1];
/*<       cqbulk=cqb(lx0+loct) >*/
    cqbulk = cqb[tabinf_1.lx0 + loct - 1];
/*<       cqdrn=cqd(lx0+loct) >*/
    cqdrn = cqd[tabinf_1.lx0 + loct - 1];
/*<       ceqqg=cgate-gcggb*vgb+gcgdb*vbd+gcgsb*vbs >*/
    ceqqg = cgate - gcggb * vgb + gcgdb * vbd + gcgsb * vbs;
/*<       ceqqb=cqbulk-gcbgb*vgb+gcbdb*vbd+gcbsb*vbs >*/
    ceqqb = cqbulk - gcbgb * vgb + gcbdb * vbd + gcbsb * vbs;
/*<       ceqqd=cqdrn-gcdgb*vgb+gcddb*vbd+gcdsb*vbs >*/
    ceqqd = cqdrn - gcdgb * vgb + gcddb * vbd + gcdsb * vbs;
/*<       if (initf.ne.5) go to 900 >*/
    if (status_1.initf != 5) {
	goto L900;
    }
/*<       cqb(lx1+loct)=cqb(lx0+loct) >*/
    cqb[tabinf_1.lx1 + loct - 1] = cqb[tabinf_1.lx0 + loct - 1];
/*<       cqg(lx1+loct)=cqg(lx0+loct) >*/
    cqg[tabinf_1.lx1 + loct - 1] = cqg[tabinf_1.lx0 + loct - 1];
/*<       cqd(lx1+loct)=cqd(lx0+loct) >*/
    cqd[tabinf_1.lx1 + loct - 1] = cqd[tabinf_1.lx0 + loct - 1];
/*<       go to 900 >*/
    goto L900;

/* c   do the mapping from meyer"s capacitor model into the charge */
/* c   oriented model */
/* c */
/*<   870 ceqqg=ceqgs+ceqgb+ceqgd >*/
L870:
    ceqqg = ceqgs + ceqgb + ceqgd;
/*<       ceqqb=-ceqgb >*/
    ceqqb = -ceqgb;
/*<       ceqqd=-ceqgd >*/
    ceqqd = -ceqgd;
/*<       gcbdb=0.0d0 >*/
    gcbdb = 0.;
/*<       gcbsb=0.0d0 >*/
    gcbsb = 0.;
/*<       gcdsb=0.0d0 >*/
    gcdsb = 0.;
/*<       gcsdb=0.0d0 >*/
    gcsdb = 0.;
/*<       gcgdb=-gcgd >*/
    gcgdb = -gcgd;
/*<       gcgsb=-gcgs >*/
    gcgsb = -gcgs;
/*<       gcbgb=-gcgb >*/
    gcbgb = -gcgb;
/*<       gcdgb=-gcgd >*/
    gcdgb = -gcgd;
/*<       gcsgb=-gcgs >*/
    gcsgb = -gcgs;
/*<       gcssb=gcgs >*/
    gcssb = gcgs;
/*<       gcddb=gcgd >*/
    gcddb = gcgd;
/*<       gcggb=gcgd+gcgs+gcgb >*/
    gcggb = gcgd + gcgs + gcgb;

/*     store charge storage info for meyer's cap in lx table */

/*<       cgbo(lx0+loct)=cgb >*/
    cgbo[tabinf_1.lx0 + loct - 1] = cgb;
/*<       cgso(lx0+loct)=cgs >*/
    cgso[tabinf_1.lx0 + loct - 1] = cgs;
/*<       cgdo(lx0+loct)=cgd >*/
    cgdo[tabinf_1.lx0 + loct - 1] = cgd;

/*  load current vector */

/*<   900 ceqbs=type*(cbs-(gbs-gmin)*vbs) >*/
L900:
    ceqbs = type * (cbs - (gbs - knstnt_1.gmin) * vbs);
/*<       ceqbd=type*(cbd-(gbd-gmin)*vbd) >*/
    ceqbd = type * (cbd - (gbd - knstnt_1.gmin) * vbd);
/*<       ceqqg=type*ceqqg >*/
    ceqqg = type * ceqqg;
/*<       ceqqb=type*ceqqb >*/
    ceqqb = type * ceqqb;
/*<       ceqqd=type*ceqqd >*/
    ceqqd = type * ceqqd;
/*<       xnrm=1.0d0 >*/
    xnrm = 1.;
/*<       xrev=0.0d0 >*/
    xrev = 0.;
/*<       if (devmod.lt.0.0d0) go to 910 >*/
    if (devmod < 0.) {
	goto L910;
    }
/*<       cdreq=type*(cdrain-gds*vds-gm*vgs-gmbs*vbs) >*/
    cdreq = type * (mosarg_1.cdrain - gds * vds - gm * vgs - gmbs * vbs);
/*<       go to 920 >*/
    goto L920;
/*<   910 xnrm=0.0d0 >*/
L910:
    xnrm = 0.;
/*<       xrev=1.0d0 >*/
    xrev = 1.;
/*<       cdreq=-type*(cdrain-gds*(-vds)-gm*vgd-gmbs*vbd) >*/
    cdreq = -type * (mosarg_1.cdrain - gds * (-vds) - gm * vgd - gmbs * vbd);
/*<   920 value(lvn+node2)=value(lvn+node2)-ceqqg >*/
L920:
    blank_1.value[tabinf_1.lvn + node2 - 1] -= ceqqg;
/*<       value(lvn+node4)=value(lvn+node4)-ceqbs-ceqbd-ceqqb >*/
    blank_1.value[tabinf_1.lvn + node4 - 1] = blank_1.value[tabinf_1.lvn + 
	    node4 - 1] - ceqbs - ceqbd - ceqqb;
/*<       value(lvn+node5)=value(lvn+node5)-cdreq+ceqbd-ceqqd >*/
    blank_1.value[tabinf_1.lvn + node5 - 1] = blank_1.value[tabinf_1.lvn + 
	    node5 - 1] - cdreq + ceqbd - ceqqd;
/*<       value(lvn+node6)=value(lvn+node6)+cdreq+ceqbs >*/
/*<      1   +ceqqg+ceqqb+ceqqd >*/
    blank_1.value[tabinf_1.lvn + node6 - 1] = blank_1.value[tabinf_1.lvn + 
	    node6 - 1] + cdreq + ceqbs + ceqqg + ceqqb + ceqqd;

/*  load y matrix */

/*<       locy=lvn+nodplc(loc+27) >*/
    locy = tabinf_1.lvn + nodplc[loc + 26];
/*<       value(locy)=value(locy)+gdpr >*/
    blank_1.value[locy - 1] += gdpr;
/*<       locy=lvn+nodplc(loc+28) >*/
    locy = tabinf_1.lvn + nodplc[loc + 27];
/*<       value(locy)=value(locy)+gcggb >*/
    blank_1.value[locy - 1] += gcggb;
/*<       locy=lvn+nodplc(loc+29) >*/
    locy = tabinf_1.lvn + nodplc[loc + 28];
/*<       value(locy)=value(locy)+gspr >*/
    blank_1.value[locy - 1] += gspr;
/*<       locy=lvn+nodplc(loc+30) >*/
    locy = tabinf_1.lvn + nodplc[loc + 29];
/*<       value(locy)=value(locy)+gbd+gbs-gcbgb-gcbdb-gcbsb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] + gbd + gbs - gcbgb - 
	    gcbdb - gcbsb;
/*<       locy=lvn+nodplc(loc+31) >*/
    locy = tabinf_1.lvn + nodplc[loc + 30];
/*<       value(locy)=value(locy)+gdpr+gds+gbd+xrev*(gm+gmbs)+gcddb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] + gdpr + gds + gbd + 
	    xrev * (gm + gmbs) + gcddb;
/*<       locy=lvn+nodplc(loc+32) >*/
    locy = tabinf_1.lvn + nodplc[loc + 31];
/*<       value(locy)=value(locy)+gspr+gds+gbs+xnrm*(gm+gmbs)+gcssb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] + gspr + gds + gbs + 
	    xnrm * (gm + gmbs) + gcssb;
/*<       locy=lvn+nodplc(loc+10) >*/
    locy = tabinf_1.lvn + nodplc[loc + 9];
/*<       value(locy)=value(locy)-gdpr >*/
    blank_1.value[locy - 1] -= gdpr;
/*<       locy=lvn+nodplc(loc+11) >*/
    locy = tabinf_1.lvn + nodplc[loc + 10];
/*<       value(locy)=value(locy)-gcggb-gcgdb-gcgsb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - gcggb - gcgdb - gcgsb;

/*<       locy=lvn+nodplc(loc+12) >*/
    locy = tabinf_1.lvn + nodplc[loc + 11];
/*<       value(locy)=value(locy)+gcgdb >*/
    blank_1.value[locy - 1] += gcgdb;
/*<       locy=lvn+nodplc(loc+13) >*/
    locy = tabinf_1.lvn + nodplc[loc + 12];
/*<       value(locy)=value(locy)+gcgsb >*/
    blank_1.value[locy - 1] += gcgsb;
/*<       locy=lvn+nodplc(loc+14) >*/
    locy = tabinf_1.lvn + nodplc[loc + 13];
/*<       value(locy)=value(locy)-gspr >*/
    blank_1.value[locy - 1] -= gspr;
/*<       locy=lvn+nodplc(loc+15) >*/
    locy = tabinf_1.lvn + nodplc[loc + 14];
/*<       value(locy)=value(locy)+gcbgb >*/
    blank_1.value[locy - 1] += gcbgb;
/*<       locy=lvn+nodplc(loc+16) >*/
    locy = tabinf_1.lvn + nodplc[loc + 15];
/*<       value(locy)=value(locy)-gbd+gcbdb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - gbd + gcbdb;
/*<       locy=lvn+nodplc(loc+17) >*/
    locy = tabinf_1.lvn + nodplc[loc + 16];
/*<       value(locy)=value(locy)-gbs+gcbsb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - gbs + gcbsb;
/*<       locy=lvn+nodplc(loc+18) >*/
    locy = tabinf_1.lvn + nodplc[loc + 17];
/*<       value(locy)=value(locy)-gdpr >*/
    blank_1.value[locy - 1] -= gdpr;
/*<       locy=lvn+nodplc(loc+19) >*/
    locy = tabinf_1.lvn + nodplc[loc + 18];
/*<       value(locy)=value(locy)+(xnrm-xrev)*gm+gcdgb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] + (xnrm - xrev) * gm + 
	    gcdgb;
/*<       locy=lvn+nodplc(loc+20) >*/
    locy = tabinf_1.lvn + nodplc[loc + 19];
/*<       value(locy)=value(locy)-gbd+(xnrm-xrev)*gmbs- >*/
/*<      1   gcdgb-gcddb-gcdsb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - gbd + (xnrm - xrev) * 
	    gmbs - gcdgb - gcddb - gcdsb;
/*<       locy=lvn+nodplc(loc+21) >*/
    locy = tabinf_1.lvn + nodplc[loc + 20];
/*<       value(locy)=value(locy)-gds-xnrm*(gm+gmbs)+gcdsb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - gds - xnrm * (gm + 
	    gmbs) + gcdsb;
/*<       locy=lvn+nodplc(loc+22) >*/
    locy = tabinf_1.lvn + nodplc[loc + 21];
/*<       value(locy)=value(locy)-(xnrm-xrev)*gm+gcsgb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - (xnrm - xrev) * gm + 
	    gcsgb;
/*<       locy=lvn+nodplc(loc+23) >*/
    locy = tabinf_1.lvn + nodplc[loc + 22];
/*<       value(locy)=value(locy)-gspr >*/
    blank_1.value[locy - 1] -= gspr;
/*<       locy=lvn+nodplc(loc+24) >*/
    locy = tabinf_1.lvn + nodplc[loc + 23];
/*<       value(locy)=value(locy)-gbs-(xnrm-xrev)*gmbs- >*/
/*<      1   gcsgb-gcsdb-gcssb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - gbs - (xnrm - xrev) * 
	    gmbs - gcsgb - gcsdb - gcssb;
/*<       locy=lvn+nodplc(loc+25) >*/
    locy = tabinf_1.lvn + nodplc[loc + 24];
/*<       value(locy)=value(locy)-gds-xrev*(gm+gmbs)+gcsdb >*/
    blank_1.value[locy - 1] = blank_1.value[locy - 1] - gds - xrev * (gm + 
	    gmbs) + gcsdb;
/*<  1000 loc=nodplc(loc) >*/
L1000:
    loc = nodplc[loc - 1];
/*<       go to 10 >*/
    goto L10;
/*<       end >*/
} /* mosfet_ */

#undef qgs
#undef qbs
#undef gmo
#undef qgb
#undef qgd
#undef qbd
#undef cqg
#undef cqd
#undef cqb
#undef cdo
#undef vdsato
#undef cvalue
#undef nodplc
#undef qg
#undef qd
#undef qb
#undef gmbso
#undef cgsbo
#undef cbsbo
#undef cggbo
#undef cgdbo
#undef cbgbo
#undef cbdbo
#undef vono
#undef vdso
#undef vgso
#undef vbso
#undef cqgs
#undef cgso
#undef gbso
#undef gdso
#undef vbdo
#undef cqbs
#undef cbso
#undef cqgb
#undef cqgd
#undef cgdo
#undef gbdo
#undef cgbo
#undef cqbd
#undef cbdo


