1 /**********
2 Copyright 1990 Regents of the University of California.  All rights reserved.
3 Author: 1985 Thomas L. Quarles
4 Modified: September 2003 Paolo Nenzi
5 **********/
6 /*
7  */
8 
9 #include "ngspice/ngspice.h"
10 #include "ngspice/cktdefs.h"
11 #include "ngspice/complex.h"
12 #include "ngspice/sperror.h"
13 #include "capdefs.h"
14 #include "ngspice/suffix.h"
15 
16 
17 /* ARGSUSED */
18 int
CAPpzLoad(GENmodel * inModel,CKTcircuit * ckt,SPcomplex * s)19 CAPpzLoad(GENmodel *inModel, CKTcircuit *ckt, SPcomplex *s)
20 
21 {
22     CAPmodel *model = (CAPmodel*)inModel;
23     double val;
24     double m;
25     CAPinstance *here;
26 
27     NG_IGNORE(ckt);
28 
29     for( ; model != NULL; model = CAPnextModel(model)) {
30         for( here = CAPinstances(model);here != NULL;
31                 here = CAPnextInstance(here)) {
32 
33             val = here->CAPcapac;
34             m = here->CAPm;
35 
36 	    *(here->CAPposPosPtr ) +=   m * val * s->real;
37             *(here->CAPposPosPtr +1) += m * val * s->imag;
38             *(here->CAPnegNegPtr ) +=   m * val * s->real;
39             *(here->CAPnegNegPtr +1) += m * val * s->imag;
40             *(here->CAPposNegPtr ) -=   m * val * s->real;
41             *(here->CAPposNegPtr +1) -= m * val * s->imag;
42             *(here->CAPnegPosPtr ) -=   m * val * s->real;
43             *(here->CAPnegPosPtr +1) -= m * val * s->imag;
44         }
45     }
46     return(OK);
47 
48 }
49