int rtestsetup (SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
     /* load the rtest device structure with those pointers needed later 
      * for fast matrix loading 
      */
{
  register rtestmodel *model = (rtestmodel*)inModel;
  register rtestinstance *here;
  
  /*  loop through all the rtest device models */
  for ( ;model != NULL ;model = model->rtestnextModel )
  {
    if(model->d_Given == FALSE) model->d=1;
    if(model->R1_Given == FALSE) model->R1=10000;
    for ( here = model->rtestinstances ;here != NULL ; here = here->rtestnextInstance )
    {
      /* set states */
      /* set Sparse Matrix Pointers */
      here->PTR_J_top_top_required=0;
      here->PTR_J_top_low_required=0;
      here->PTR_J_low_top_required=0;
      here->PTR_J_low_low_required=0;

      rtestguesstopology(matrix,ckt,model,here);

      /* Internal Nodes */
      {
        int error;
        CKTnode *tmp;
      }
        if(here->PTR_J_top_top_required==1)
        {
          here->PTR_J_top_top=SMPmakeElt(matrix,here->topNode,here->topNode);
        }
        if(here->PTR_J_top_low_required==1)
        {
          here->PTR_J_top_low=SMPmakeElt(matrix,here->topNode,here->lowNode);
        }
        if(here->PTR_J_low_top_required==1)
        {
          here->PTR_J_low_top=SMPmakeElt(matrix,here->lowNode,here->topNode);
        }
        if(here->PTR_J_low_low_required==1)
        {
          here->PTR_J_low_low=SMPmakeElt(matrix,here->lowNode,here->lowNode);
        }

    }
  }
  return(OK);
}
Exemple #2
0
int
CKTic(CKTcircuit *ckt)
{
    int error;
    int size;
    int i;
    CKTnode *node;

    size = SMPmatSize(ckt->CKTmatrix);
    for (i=0;i<=size;i++) {
        *(ckt->CKTrhs+i)=0;
    }

    for(node = ckt->CKTnodes;node != NULL; node = node->next) {
        if(node->nsGiven) {
            node->ptr = SMPmakeElt(ckt->CKTmatrix,node->number,node->number);
            if(node->ptr == (double *)NULL) return(E_NOMEM);
            ckt->CKThadNodeset = 1;
            *(ckt->CKTrhs+node->number) = node->nodeset;
        }
        if(node->icGiven) {
            if(! ( node->ptr)) {
                node->ptr = SMPmakeElt(ckt->CKTmatrix,node->number,
                        node->number);
                if(node->ptr == (double *)NULL) return(E_NOMEM);
            }
            *(ckt->CKTrhs+node->number) = node->ic;
        }
    }

    if(ckt->CKTmode & MODEUIC) {
        for (i=0;i<DEVmaxnum;i++) {
            if( DEVices[i] && ((*DEVices[i]).DEVsetic != NULL) && (ckt->CKThead[i] != NULL) ){
                error = (*((*DEVices[i]).DEVsetic))(ckt->CKThead[i],ckt);
                if(error) return(error);
            }
        }
    }

    return(OK);
}
Exemple #3
0
int
CKTic(CKTcircuit *ckt)
{
    int error;
    int size;
    int i;
    CKTnode *node;

    size = SMPmatSize(ckt->CKTmatrix);
    for (i=0;i<=size;i++) {
        ckt->CKTrhs[i]=0;
    }

    for(node = ckt->CKTnodes;node != NULL; node = node->next) {
        if(node->nsGiven) {
            node->ptr = SMPmakeElt(ckt->CKTmatrix,node->number,node->number);
            if(node->ptr == NULL) return(E_NOMEM);
            ckt->CKThadNodeset = 1;
            ckt->CKTrhs[node->number] = node->nodeset;
        }
        if(node->icGiven) {
            if(! ( node->ptr)) {
                node->ptr = SMPmakeElt(ckt->CKTmatrix,node->number,
                        node->number);
                if(node->ptr == NULL) return(E_NOMEM);
            }
            ckt->CKTrhs[node->number] = node->ic;
        }
    }

    if(ckt->CKTmode & MODEUIC) {
        for (i=0;i<DEVmaxnum;i++) {
            if( DEVices[i] && DEVices[i]->DEVsetic && ckt->CKThead[i] ) {
                error = DEVices[i]->DEVsetic (ckt->CKThead[i], ckt);
                if(error) return(error);
            }
        }
    }

    return(OK);
}
Exemple #4
0
int
CKTpzSetup(CKTcircuit *ckt, int type)
{
  extern SPICEdev **DEVices;
    PZAN *pzan = (PZAN *) ckt->CKTcurJob;
    SMPmatrix *matrix;
    int error;
    int i, temp, solution_col, balance_col;
    int input_pos, input_neg, output_pos, output_neg;

    NIdestroy(ckt);
    error = NIinit(ckt);
    if (error)
	return(error);
    matrix = ckt->CKTmatrix;

    /* Really awful . . . */
    ckt->CKTnumStates = 0;

    for (i = 0; i < DEVmaxnum; i++) {
        if (DEVices[i] && DEVices[i]->DEVpzSetup != NULL && ckt->CKThead[i] != NULL) {
            error = (*DEVices[i]->DEVpzSetup)(matrix, ckt->CKThead[i],
		ckt, &ckt->CKTnumStates);
            if (error != OK)
	        return(error);
        }
    }

    solution_col = 0;
    balance_col = 0;

    input_pos = pzan->PZin_pos;
    input_neg = pzan->PZin_neg;

    if (type == PZ_DO_ZEROS) {
	/* Vo/Ii in Y */
	output_pos = pzan->PZout_pos;
	output_neg = pzan->PZout_neg;
    } else if (pzan->PZinput_type == PZ_IN_VOL) {
	/* Vi/Ii in Y */
	output_pos = pzan->PZin_pos;
	output_neg = pzan->PZin_neg;
    } else {
	/* Denominator */
	output_pos = 0;
	output_neg = 0;
	input_pos = 0;
	input_neg = 0;
    }

    if (output_pos) {
	solution_col = output_pos;
	if (output_neg)
	    balance_col = output_neg;
    } else {
	solution_col = output_neg;
	temp = input_pos;
	input_pos = input_neg;
	input_neg = temp;
    }

    if (input_pos)
	pzan->PZdrive_pptr = SMPmakeElt(matrix, input_pos, solution_col);
    else
	pzan->PZdrive_pptr = NULL;

    if (input_neg)
	pzan->PZdrive_nptr = SMPmakeElt(matrix, input_neg, solution_col);
    else
	pzan->PZdrive_nptr = NULL;

    pzan->PZsolution_col = solution_col;
    pzan->PZbalance_col = balance_col;

    pzan->PZnumswaps = 1;

    error = NIreinit(ckt);
    if (error)
	return(error);

    return OK;
}
int hicum0setup (SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
     /* load the hicum0 device structure with those pointers needed later 
      * for fast matrix loading 
      */
{
  register hicum0model *model = (hicum0model*)inModel;
  register hicum0instance *here;
  
  /*  loop through all the hicum0 device models */
  for ( ;model != NULL ;model = model->hicum0nextModel )
  {
    if(model->is_Given == FALSE) model->is=1.0e-16;
    if(model->mcf_Given == FALSE) model->mcf=1.00;
    if(model->mcr_Given == FALSE) model->mcr=1.00;
    if(model->vef_Given == FALSE) model->vef=1.0e6;
    if(model->iqf_Given == FALSE) model->iqf=1.0e6;
    if(model->iqr_Given == FALSE) model->iqr=1.0e6;
    if(model->iqfh_Given == FALSE) model->iqfh=1.0e6;
    if(model->tfh_Given == FALSE) model->tfh=0.0;
    if(model->ibes_Given == FALSE) model->ibes=1e-18;
    if(model->mbe_Given == FALSE) model->mbe=1.0;
    if(model->ires_Given == FALSE) model->ires=0.0;
    if(model->mre_Given == FALSE) model->mre=2.0;
    if(model->ibcs_Given == FALSE) model->ibcs=0.0;
    if(model->mbc_Given == FALSE) model->mbc=1.0;
    if(model->cje0_Given == FALSE) model->cje0=1.0e-20;
    if(model->vde_Given == FALSE) model->vde=0.9;
    if(model->ze_Given == FALSE) model->ze=0.5;
    if(model->aje_Given == FALSE) model->aje=2.5;
    if(model->t0_Given == FALSE) model->t0=0.0;
    if(model->dt0h_Given == FALSE) model->dt0h=0.0;
    if(model->tbvl_Given == FALSE) model->tbvl=0.0;
    if(model->tef0_Given == FALSE) model->tef0=0.0;
    if(model->gte_Given == FALSE) model->gte=1.0;
    if(model->thcs_Given == FALSE) model->thcs=0.0;
    if(model->ahc_Given == FALSE) model->ahc=0.1;
    if(model->tr_Given == FALSE) model->tr=0.0;
    if(model->rci0_Given == FALSE) model->rci0=150;
    if(model->vlim_Given == FALSE) model->vlim=0.5;
    if(model->vpt_Given == FALSE) model->vpt=100;
    if(model->vces_Given == FALSE) model->vces=0.1;
    if(model->cjci0_Given == FALSE) model->cjci0=1.0e-20;
    if(model->vdci_Given == FALSE) model->vdci=0.7;
    if(model->zci_Given == FALSE) model->zci=0.333;
    if(model->vptci_Given == FALSE) model->vptci=100;
    if(model->cjcx0_Given == FALSE) model->cjcx0=1.0e-20;
    if(model->vdcx_Given == FALSE) model->vdcx=0.7;
    if(model->zcx_Given == FALSE) model->zcx=0.333;
    if(model->vptcx_Given == FALSE) model->vptcx=100;
    if(model->fbc_Given == FALSE) model->fbc=1.0;
    if(model->rbi0_Given == FALSE) model->rbi0=0.0;
    if(model->vr0e_Given == FALSE) model->vr0e=2.5;
    if(model->vr0c_Given == FALSE) model->vr0c=1.0e6;
    if(model->fgeo_Given == FALSE) model->fgeo=0.656;
    if(model->rbx_Given == FALSE) model->rbx=0.0;
    if(model->rcx_Given == FALSE) model->rcx=0.0;
    if(model->re_Given == FALSE) model->re=0.0;
    if(model->itss_Given == FALSE) model->itss=0.0;
    if(model->msf_Given == FALSE) model->msf=1.0;
    if(model->iscs_Given == FALSE) model->iscs=0.0;
    if(model->msc_Given == FALSE) model->msc=1.0;
    if(model->cjs0_Given == FALSE) model->cjs0=1.0e-20;
    if(model->vds_Given == FALSE) model->vds=0.3;
    if(model->zs_Given == FALSE) model->zs=0.3;
    if(model->vpts_Given == FALSE) model->vpts=100;
    if(model->cbcpar_Given == FALSE) model->cbcpar=0.0;
    if(model->cbepar_Given == FALSE) model->cbepar=0.0;
    if(model->eavl_Given == FALSE) model->eavl=0.0;
    if(model->kavl_Given == FALSE) model->kavl=0.0;
    if(model->kf_Given == FALSE) model->kf=0.0;
    if(model->af_Given == FALSE) model->af=2.0;
    if(model->vgb_Given == FALSE) model->vgb=1.2;
    if(model->vge_Given == FALSE) model->vge=1.17;
    if(model->vgc_Given == FALSE) model->vgc=1.17;
    if(model->vgs_Given == FALSE) model->vgs=1.17;
    if(model->f1vg_Given == FALSE) model->f1vg=(-1.02377e-4);
    if(model->f2vg_Given == FALSE) model->f2vg=4.3215e-4;
    if(model->alt0_Given == FALSE) model->alt0=0.0;
    if(model->kt0_Given == FALSE) model->kt0=0.0;
    if(model->zetact_Given == FALSE) model->zetact=3.0;
    if(model->zetabet_Given == FALSE) model->zetabet=3.5;
    if(model->zetaci_Given == FALSE) model->zetaci=0.0;
    if(model->alvs_Given == FALSE) model->alvs=0.0;
    if(model->alces_Given == FALSE) model->alces=0.0;
    if(model->zetarbi_Given == FALSE) model->zetarbi=0.0;
    if(model->zetarbx_Given == FALSE) model->zetarbx=0.0;
    if(model->zetarcx_Given == FALSE) model->zetarcx=0.0;
    if(model->zetare_Given == FALSE) model->zetare=0.0;
    if(model->alkav_Given == FALSE) model->alkav=0.0;
    if(model->aleav_Given == FALSE) model->aleav=0.0;
    if(model->flsh_Given == FALSE) model->flsh=0;
    if(model->rth_Given == FALSE) model->rth=0.0;
    if(model->cth_Given == FALSE) model->cth=0.0;
    if(model->npn_Given == FALSE) model->npn=1;
    if(model->pnp_Given == FALSE) model->pnp=0;
    if(model->tnom_Given == FALSE) model->tnom=27;
    for ( here = model->hicum0instances ;here != NULL ; here = here->hicum0nextInstance )
    {
    if(here->dt_Given == FALSE) here->dt=0.0;
      /* Internal Nodes */
      {
        here->ciNode = -1;
        here->biNode = -1;
        here->eiNode = -1;
      }
      /* set states */
      here->state_tnode_GND = *states; *states += 2;
      here->state_b_e = *states; *states += 2;
      here->state_b_ci = *states; *states += 2;
      here->state_s_ci = *states; *states += 2;
      here->state_bi_ci = *states; *states += 2;
      here->state_bi_ei = *states; *states += 2;
      /* set Sparse Matrix Pointers */
      here->PTR_J_bi_bi_required=0;
      here->PTR_J_bi_ei_required=0;
      here->PTR_J_ei_bi_required=0;
      here->PTR_J_ei_ei_required=0;
      here->PTR_J_bi_ci_required=0;
      here->PTR_J_ci_bi_required=0;
      here->PTR_J_ci_ci_required=0;
      here->PTR_J_b_s_required=0;
      here->PTR_J_b_ci_required=0;
      here->PTR_J_s_s_required=0;
      here->PTR_J_s_ci_required=0;
      here->PTR_J_b_b_required=0;
      here->PTR_J_s_b_required=0;
      here->PTR_J_b_tnode_required=0;
      here->PTR_J_s_tnode_required=0;
      here->PTR_J_s_bi_required=0;
      here->PTR_J_s_ei_required=0;
      here->PTR_J_ci_ei_required=0;
      here->PTR_J_ci_s_required=0;
      here->PTR_J_ci_tnode_required=0;
      here->PTR_J_ci_b_required=0;
      here->PTR_J_b_bi_required=0;
      here->PTR_J_b_e_required=0;
      here->PTR_J_e_b_required=0;
      here->PTR_J_e_e_required=0;
      here->PTR_J_ei_tnode_required=0;
      here->PTR_J_e_tnode_required=0;
      here->PTR_J_ei_e_required=0;
      here->PTR_J_e_ei_required=0;
      here->PTR_J_c_tnode_required=0;
      here->PTR_J_ci_c_required=0;
      here->PTR_J_c_ci_required=0;
      here->PTR_J_c_c_required=0;
      here->PTR_J_b_ei_required=0;
      here->PTR_J_bi_b_required=0;
      here->PTR_J_bi_tnode_required=0;
      here->PTR_J_ei_ci_required=0;
      here->PTR_J_ei_b_required=0;
      here->PTR_J_tnode_tnode_required=0;
      here->PTR_J_tnode_ci_required=0;
      here->PTR_J_tnode_ei_required=0;
      here->PTR_J_tnode_b_required=0;
      here->PTR_J_tnode_bi_required=0;
      here->PTR_J_tnode_s_required=0;
      here->PTR_J_tnode_e_required=0;
      here->PTR_J_tnode_c_required=0;

      hicum0guesstopology(matrix,ckt,model,here);

      /* Internal Nodes */
      {
        int error;
        CKTnode *tmp;
        if(here->ciNode == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum0name,"internal collector node");
          if(error) return(error);
          here->ciNode = tmp->number;
        }
        if(here->biNode == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum0name,"internal base node");
          if(error) return(error);
          here->biNode = tmp->number;
        }
        if(here->eiNode == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum0name,"internal emitter node");
          if(error) return(error);
          here->eiNode = tmp->number;
        }
      }
        if(here->PTR_J_bi_bi_required==1)
        {
          here->PTR_J_bi_bi=SMPmakeElt(matrix,here->biNode,here->biNode);
        }
        if(here->PTR_J_bi_ei_required==1)
        {
          here->PTR_J_bi_ei=SMPmakeElt(matrix,here->biNode,here->eiNode);
        }
        if(here->PTR_J_ei_bi_required==1)
        {
          here->PTR_J_ei_bi=SMPmakeElt(matrix,here->eiNode,here->biNode);
        }
        if(here->PTR_J_ei_ei_required==1)
        {
          here->PTR_J_ei_ei=SMPmakeElt(matrix,here->eiNode,here->eiNode);
        }
        if(here->PTR_J_bi_ci_required==1)
        {
          here->PTR_J_bi_ci=SMPmakeElt(matrix,here->biNode,here->ciNode);
        }
        if(here->PTR_J_ci_bi_required==1)
        {
          here->PTR_J_ci_bi=SMPmakeElt(matrix,here->ciNode,here->biNode);
        }
        if(here->PTR_J_ci_ci_required==1)
        {
          here->PTR_J_ci_ci=SMPmakeElt(matrix,here->ciNode,here->ciNode);
        }
        if(here->PTR_J_b_s_required==1)
        {
          here->PTR_J_b_s=SMPmakeElt(matrix,here->bNode,here->sNode);
        }
        if(here->PTR_J_b_ci_required==1)
        {
          here->PTR_J_b_ci=SMPmakeElt(matrix,here->bNode,here->ciNode);
        }
        if(here->PTR_J_s_s_required==1)
        {
          here->PTR_J_s_s=SMPmakeElt(matrix,here->sNode,here->sNode);
        }
        if(here->PTR_J_s_ci_required==1)
        {
          here->PTR_J_s_ci=SMPmakeElt(matrix,here->sNode,here->ciNode);
        }
        if(here->PTR_J_b_b_required==1)
        {
          here->PTR_J_b_b=SMPmakeElt(matrix,here->bNode,here->bNode);
        }
        if(here->PTR_J_s_b_required==1)
        {
          here->PTR_J_s_b=SMPmakeElt(matrix,here->sNode,here->bNode);
        }
        if(here->PTR_J_b_tnode_required==1)
        {
          here->PTR_J_b_tnode=SMPmakeElt(matrix,here->bNode,here->tnodeNode);
        }
        if(here->PTR_J_s_tnode_required==1)
        {
          here->PTR_J_s_tnode=SMPmakeElt(matrix,here->sNode,here->tnodeNode);
        }
        if(here->PTR_J_s_bi_required==1)
        {
          here->PTR_J_s_bi=SMPmakeElt(matrix,here->sNode,here->biNode);
        }
        if(here->PTR_J_s_ei_required==1)
        {
          here->PTR_J_s_ei=SMPmakeElt(matrix,here->sNode,here->eiNode);
        }
        if(here->PTR_J_ci_ei_required==1)
        {
          here->PTR_J_ci_ei=SMPmakeElt(matrix,here->ciNode,here->eiNode);
        }
        if(here->PTR_J_ci_s_required==1)
        {
          here->PTR_J_ci_s=SMPmakeElt(matrix,here->ciNode,here->sNode);
        }
        if(here->PTR_J_ci_tnode_required==1)
        {
          here->PTR_J_ci_tnode=SMPmakeElt(matrix,here->ciNode,here->tnodeNode);
        }
        if(here->PTR_J_ci_b_required==1)
        {
          here->PTR_J_ci_b=SMPmakeElt(matrix,here->ciNode,here->bNode);
        }
        if(here->PTR_J_b_bi_required==1)
        {
          here->PTR_J_b_bi=SMPmakeElt(matrix,here->bNode,here->biNode);
        }
        if(here->PTR_J_b_e_required==1)
        {
          here->PTR_J_b_e=SMPmakeElt(matrix,here->bNode,here->eNode);
        }
        if(here->PTR_J_e_b_required==1)
        {
          here->PTR_J_e_b=SMPmakeElt(matrix,here->eNode,here->bNode);
        }
        if(here->PTR_J_e_e_required==1)
        {
          here->PTR_J_e_e=SMPmakeElt(matrix,here->eNode,here->eNode);
        }
        if(here->PTR_J_ei_tnode_required==1)
        {
          here->PTR_J_ei_tnode=SMPmakeElt(matrix,here->eiNode,here->tnodeNode);
        }
        if(here->PTR_J_e_tnode_required==1)
        {
          here->PTR_J_e_tnode=SMPmakeElt(matrix,here->eNode,here->tnodeNode);
        }
        if(here->PTR_J_ei_e_required==1)
        {
          here->PTR_J_ei_e=SMPmakeElt(matrix,here->eiNode,here->eNode);
        }
        if(here->PTR_J_e_ei_required==1)
        {
          here->PTR_J_e_ei=SMPmakeElt(matrix,here->eNode,here->eiNode);
        }
        if(here->PTR_J_c_tnode_required==1)
        {
          here->PTR_J_c_tnode=SMPmakeElt(matrix,here->cNode,here->tnodeNode);
        }
        if(here->PTR_J_ci_c_required==1)
        {
          here->PTR_J_ci_c=SMPmakeElt(matrix,here->ciNode,here->cNode);
        }
        if(here->PTR_J_c_ci_required==1)
        {
          here->PTR_J_c_ci=SMPmakeElt(matrix,here->cNode,here->ciNode);
        }
        if(here->PTR_J_c_c_required==1)
        {
          here->PTR_J_c_c=SMPmakeElt(matrix,here->cNode,here->cNode);
        }
        if(here->PTR_J_b_ei_required==1)
        {
          here->PTR_J_b_ei=SMPmakeElt(matrix,here->bNode,here->eiNode);
        }
        if(here->PTR_J_bi_b_required==1)
        {
          here->PTR_J_bi_b=SMPmakeElt(matrix,here->biNode,here->bNode);
        }
        if(here->PTR_J_bi_tnode_required==1)
        {
          here->PTR_J_bi_tnode=SMPmakeElt(matrix,here->biNode,here->tnodeNode);
        }
        if(here->PTR_J_ei_ci_required==1)
        {
          here->PTR_J_ei_ci=SMPmakeElt(matrix,here->eiNode,here->ciNode);
        }
        if(here->PTR_J_ei_b_required==1)
        {
          here->PTR_J_ei_b=SMPmakeElt(matrix,here->eiNode,here->bNode);
        }
        if(here->PTR_J_tnode_tnode_required==1)
        {
          here->PTR_J_tnode_tnode=SMPmakeElt(matrix,here->tnodeNode,here->tnodeNode);
        }
        if(here->PTR_J_tnode_ci_required==1)
        {
          here->PTR_J_tnode_ci=SMPmakeElt(matrix,here->tnodeNode,here->ciNode);
        }
        if(here->PTR_J_tnode_ei_required==1)
        {
          here->PTR_J_tnode_ei=SMPmakeElt(matrix,here->tnodeNode,here->eiNode);
        }
        if(here->PTR_J_tnode_b_required==1)
        {
          here->PTR_J_tnode_b=SMPmakeElt(matrix,here->tnodeNode,here->bNode);
        }
        if(here->PTR_J_tnode_bi_required==1)
        {
          here->PTR_J_tnode_bi=SMPmakeElt(matrix,here->tnodeNode,here->biNode);
        }
        if(here->PTR_J_tnode_s_required==1)
        {
          here->PTR_J_tnode_s=SMPmakeElt(matrix,here->tnodeNode,here->sNode);
        }
        if(here->PTR_J_tnode_e_required==1)
        {
          here->PTR_J_tnode_e=SMPmakeElt(matrix,here->tnodeNode,here->eNode);
        }
        if(here->PTR_J_tnode_c_required==1)
        {
          here->PTR_J_tnode_c=SMPmakeElt(matrix,here->tnodeNode,here->cNode);
        }

    }
  }
  return(OK);
}
int hicum2setup (SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
     /* load the hicum2 device structure with those pointers needed later 
      * for fast matrix loading 
      */
{
  register hicum2model *model = (hicum2model*)inModel;
  register hicum2instance *here;
  
  /*  loop through all the hicum2 device models */
  for ( ;model != NULL ;model = model->hicum2nextModel )
  {
    if(model->pnp_Given == FALSE) model->pnp=0;
    if(model->npn_Given == FALSE) model->npn=1;
    if(model->c10_Given == FALSE) model->c10=2.0E-30;
    if(model->qp0_Given == FALSE) model->qp0=2.0E-14;
    if(model->ich_Given == FALSE) model->ich=0.0;
    if(model->hfe_Given == FALSE) model->hfe=1.0;
    if(model->hfc_Given == FALSE) model->hfc=1.0;
    if(model->hjei_Given == FALSE) model->hjei=1.0;
    if(model->hjci_Given == FALSE) model->hjci=1.0;
    if(model->ibeis_Given == FALSE) model->ibeis=1.0E-18;
    if(model->mbei_Given == FALSE) model->mbei=1.0;
    if(model->ireis_Given == FALSE) model->ireis=0.0;
    if(model->mrei_Given == FALSE) model->mrei=2.0;
    if(model->ibeps_Given == FALSE) model->ibeps=0.0;
    if(model->mbep_Given == FALSE) model->mbep=1.0;
    if(model->ireps_Given == FALSE) model->ireps=0.0;
    if(model->mrep_Given == FALSE) model->mrep=2.0;
    if(model->mcf_Given == FALSE) model->mcf=1.0;
    if(model->tbhrec_Given == FALSE) model->tbhrec=0.0;
    if(model->ibcis_Given == FALSE) model->ibcis=1.0E-16;
    if(model->mbci_Given == FALSE) model->mbci=1.0;
    if(model->ibcxs_Given == FALSE) model->ibcxs=0.0;
    if(model->mbcx_Given == FALSE) model->mbcx=1.0;
    if(model->ibets_Given == FALSE) model->ibets=0.0;
    if(model->abet_Given == FALSE) model->abet=40;
    if(model->tunode_Given == FALSE) model->tunode=1;
    if(model->favl_Given == FALSE) model->favl=0.0;
    if(model->qavl_Given == FALSE) model->qavl=0.0;
    if(model->alfav_Given == FALSE) model->alfav=0.0;
    if(model->alqav_Given == FALSE) model->alqav=0.0;
    if(model->rbi0_Given == FALSE) model->rbi0=0.0;
    if(model->rbx_Given == FALSE) model->rbx=0.0;
    if(model->fgeo_Given == FALSE) model->fgeo=0.6557;
    if(model->fdqr0_Given == FALSE) model->fdqr0=0.0;
    if(model->fcrbi_Given == FALSE) model->fcrbi=0.0;
    if(model->fqi_Given == FALSE) model->fqi=1.0;
    if(model->re_Given == FALSE) model->re=0.0;
    if(model->rcx_Given == FALSE) model->rcx=0.0;
    if(model->itss_Given == FALSE) model->itss=0.0;
    if(model->msf_Given == FALSE) model->msf=1.0;
    if(model->iscs_Given == FALSE) model->iscs=0.0;
    if(model->msc_Given == FALSE) model->msc=1.0;
    if(model->tsf_Given == FALSE) model->tsf=0.0;
    if(model->rsu_Given == FALSE) model->rsu=0.0;
    if(model->csu_Given == FALSE) model->csu=0.0;
    if(model->cjei0_Given == FALSE) model->cjei0=1.0E-20;
    if(model->vdei_Given == FALSE) model->vdei=0.9;
    if(model->zei_Given == FALSE) model->zei=0.5;
    if(model->ajei_Given == FALSE) model->ajei=2.5;
    if(model->cjep0_Given == FALSE) model->cjep0=1.0E-20;
    if(model->vdep_Given == FALSE) model->vdep=0.9;
    if(model->zep_Given == FALSE) model->zep=0.5;
    if(model->ajep_Given == FALSE) model->ajep=2.5;
    if(model->cjci0_Given == FALSE) model->cjci0=1.0E-20;
    if(model->vdci_Given == FALSE) model->vdci=0.7;
    if(model->zci_Given == FALSE) model->zci=0.4;
    if(model->vptci_Given == FALSE) model->vptci=100;
    if(model->cjcx0_Given == FALSE) model->cjcx0=1.0E-20;
    if(model->vdcx_Given == FALSE) model->vdcx=0.7;
    if(model->zcx_Given == FALSE) model->zcx=0.4;
    if(model->vptcx_Given == FALSE) model->vptcx=100;
    if(model->fbcpar_Given == FALSE) model->fbcpar=0.0;
    if(model->fbepar_Given == FALSE) model->fbepar=1.0;
    if(model->cjs0_Given == FALSE) model->cjs0=0.0;
    if(model->vds_Given == FALSE) model->vds=0.6;
    if(model->zs_Given == FALSE) model->zs=0.5;
    if(model->vpts_Given == FALSE) model->vpts=100;
    if(model->t0_Given == FALSE) model->t0=0.0;
    if(model->dt0h_Given == FALSE) model->dt0h=0.0;
    if(model->tbvl_Given == FALSE) model->tbvl=0.0;
    if(model->tef0_Given == FALSE) model->tef0=0.0;
    if(model->gtfe_Given == FALSE) model->gtfe=1.0;
    if(model->thcs_Given == FALSE) model->thcs=0.0;
    if(model->ahc_Given == FALSE) model->ahc=0.1;
    if(model->fthc_Given == FALSE) model->fthc=0.0;
    if(model->rci0_Given == FALSE) model->rci0=150;
    if(model->vlim_Given == FALSE) model->vlim=0.5;
    if(model->vces_Given == FALSE) model->vces=0.1;
    if(model->vpt_Given == FALSE) model->vpt=0.0;
    if(model->tr_Given == FALSE) model->tr=0.0;
    if(model->cbepar_Given == FALSE) model->cbepar=0.0;
    if(model->cbcpar_Given == FALSE) model->cbcpar=0.0;
    if(model->alqf_Given == FALSE) model->alqf=0.0;
    if(model->alit_Given == FALSE) model->alit=0.0;
    if(model->flnqs_Given == FALSE) model->flnqs=0;
    if(model->kf_Given == FALSE) model->kf=0.0;
    if(model->af_Given == FALSE) model->af=2.0;
    if(model->cfbe_Given == FALSE) model->cfbe=(-1);
    if(model->latb_Given == FALSE) model->latb=0.0;
    if(model->latl_Given == FALSE) model->latl=0.0;
    if(model->vgb_Given == FALSE) model->vgb=1.17;
    if(model->alt0_Given == FALSE) model->alt0=0.0;
    if(model->kt0_Given == FALSE) model->kt0=0.0;
    if(model->zetaci_Given == FALSE) model->zetaci=0.0;
    if(model->alvs_Given == FALSE) model->alvs=0.0;
    if(model->alces_Given == FALSE) model->alces=0.0;
    if(model->zetarbi_Given == FALSE) model->zetarbi=0.0;
    if(model->zetarbx_Given == FALSE) model->zetarbx=0.0;
    if(model->zetarcx_Given == FALSE) model->zetarcx=0.0;
    if(model->zetare_Given == FALSE) model->zetare=0.0;
    if(model->zetacx_Given == FALSE) model->zetacx=1.0;
    if(model->vge_Given == FALSE) model->vge=1.17;
    if(model->vgc_Given == FALSE) model->vgc=1.17;
    if(model->vgs_Given == FALSE) model->vgs=1.17;
    if(model->f1vg_Given == FALSE) model->f1vg=(-1.02377e-4);
    if(model->f2vg_Given == FALSE) model->f2vg=4.3215e-4;
    if(model->zetact_Given == FALSE) model->zetact=3.0;
    if(model->zetabet_Given == FALSE) model->zetabet=3.5;
    if(model->alb_Given == FALSE) model->alb=0.0;
    if(model->flsh_Given == FALSE) model->flsh=0;
    if(model->rth_Given == FALSE) model->rth=0.0;
    if(model->cth_Given == FALSE) model->cth=0.0;
    if(model->flcomp_Given == FALSE) model->flcomp=0.0;
    if(model->tnom_Given == FALSE) model->tnom=27.0;
    if(model->dt_Given == FALSE) model->dt=0.0;
    for ( here = model->hicum2instances ;here != NULL ; here = here->hicum2nextInstance )
    {
      /* Internal Nodes */
      {
        here->ciNode = -1;
        here->eiNode = -1;
        here->bpNode = -1;
        here->biNode = -1;
        here->siNode = -1;
        here->xf1Node = -1;
        here->xf2Node = -1;
        here->xf3Node = -1;
        here->xf4Node = -1;
        here->n1Node = -1;
        here->n2Node = -1;
      }
      /* set states */
      here->state_xf4_GND = *states; *states += 2;
      here->state_xf3_GND = *states; *states += 2;
      here->state_xf2_GND = *states; *states += 2;
      here->state_xf1_GND = *states; *states += 2;
      here->state_tnode_GND = *states; *states += 2;
      here->state_si_s = *states; *states += 2;
      here->state_si_ci = *states; *states += 2;
      here->state_bp_e = *states; *states += 2;
      here->state_b_e = *states; *states += 2;
      here->state_bp_ei = *states; *states += 2;
      here->state_bp_bi = *states; *states += 2;
      here->state_bp_ci = *states; *states += 2;
      here->state_b_ci = *states; *states += 2;
      here->state_bi_ci = *states; *states += 2;
      here->state_bi_ei = *states; *states += 2;
      /* set Sparse Matrix Pointers */
      here->PTR_J_bi_bi_required=0;
      here->PTR_J_bi_ei_required=0;
      here->PTR_J_ei_bi_required=0;
      here->PTR_J_ei_ei_required=0;
      here->PTR_J_bi_ci_required=0;
      here->PTR_J_ci_bi_required=0;
      here->PTR_J_ci_ci_required=0;
      here->PTR_J_b_bi_required=0;
      here->PTR_J_b_ci_required=0;
      here->PTR_J_b_tnode_required=0;
      here->PTR_J_ci_tnode_required=0;
      here->PTR_J_b_bp_required=0;
      here->PTR_J_ci_bp_required=0;
      here->PTR_J_b_b_required=0;
      here->PTR_J_ci_b_required=0;
      here->PTR_J_b_ei_required=0;
      here->PTR_J_ci_ei_required=0;
      here->PTR_J_bp_bp_required=0;
      here->PTR_J_bp_ci_required=0;
      here->PTR_J_bp_tnode_required=0;
      here->PTR_J_bp_b_required=0;
      here->PTR_J_bp_ei_required=0;
      here->PTR_J_bp_bi_required=0;
      here->PTR_J_bi_tnode_required=0;
      here->PTR_J_bi_bp_required=0;
      here->PTR_J_ei_tnode_required=0;
      here->PTR_J_ei_bp_required=0;
      here->PTR_J_ei_ci_required=0;
      here->PTR_J_bi_xf4_required=0;
      here->PTR_J_ei_xf4_required=0;
      here->PTR_J_bp_si_required=0;
      here->PTR_J_si_si_required=0;
      here->PTR_J_si_ci_required=0;
      here->PTR_J_si_bp_required=0;
      here->PTR_J_si_tnode_required=0;
      here->PTR_J_b_e_required=0;
      here->PTR_J_e_b_required=0;
      here->PTR_J_e_e_required=0;
      here->PTR_J_bp_e_required=0;
      here->PTR_J_e_bp_required=0;
      here->PTR_J_si_bi_required=0;
      here->PTR_J_si_ei_required=0;
      here->PTR_J_ci_si_required=0;
      here->PTR_J_si_b_required=0;
      here->PTR_J_ci_xf2_required=0;
      here->PTR_J_ei_xf2_required=0;
      here->PTR_J_c_tnode_required=0;
      here->PTR_J_ci_c_required=0;
      here->PTR_J_c_ci_required=0;
      here->PTR_J_c_c_required=0;
      here->PTR_J_e_tnode_required=0;
      here->PTR_J_ei_e_required=0;
      here->PTR_J_e_ei_required=0;
      here->PTR_J_si_s_required=0;
      here->PTR_J_s_si_required=0;
      here->PTR_J_s_s_required=0;
      here->PTR_J_tnode_tnode_required=0;
      here->PTR_J_tnode_bi_required=0;
      here->PTR_J_tnode_ci_required=0;
      here->PTR_J_tnode_ei_required=0;
      here->PTR_J_tnode_si_required=0;
      here->PTR_J_tnode_bp_required=0;
      here->PTR_J_tnode_e_required=0;
      here->PTR_J_tnode_c_required=0;
      here->PTR_J_tnode_b_required=0;
      here->PTR_J_xf1_bi_required=0;
      here->PTR_J_xf1_ci_required=0;
      here->PTR_J_xf1_ei_required=0;
      here->PTR_J_xf1_tnode_required=0;
      here->PTR_J_xf1_xf2_required=0;
      here->PTR_J_xf1_xf1_required=0;
      here->PTR_J_xf2_bi_required=0;
      here->PTR_J_xf2_ci_required=0;
      here->PTR_J_xf2_tnode_required=0;
      here->PTR_J_xf2_ei_required=0;
      here->PTR_J_xf2_xf1_required=0;
      here->PTR_J_xf2_xf2_required=0;
      here->PTR_J_xf3_bi_required=0;
      here->PTR_J_xf3_ei_required=0;
      here->PTR_J_xf3_ci_required=0;
      here->PTR_J_xf3_tnode_required=0;
      here->PTR_J_xf3_xf4_required=0;
      here->PTR_J_xf3_xf3_required=0;
      here->PTR_J_xf4_bi_required=0;
      here->PTR_J_xf4_ci_required=0;
      here->PTR_J_xf4_tnode_required=0;
      here->PTR_J_xf4_ei_required=0;
      here->PTR_J_xf4_xf3_required=0;
      here->PTR_J_xf4_xf4_required=0;
      here->PTR_J_s_tnode_required=0;

      hicum2guesstopology(matrix,ckt,model,here);

      /* Internal Nodes */
      {
        int error;
        CKTnode *tmp;
        if(here->ciNode == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum2name,"no info");
          if(error) return(error);
          here->ciNode = tmp->number;
        }
        if(here->eiNode == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum2name,"no info");
          if(error) return(error);
          here->eiNode = tmp->number;
        }
        if(here->bpNode == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum2name,"no info");
          if(error) return(error);
          here->bpNode = tmp->number;
        }
        if(here->biNode == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum2name,"no info");
          if(error) return(error);
          here->biNode = tmp->number;
        }
        if(here->siNode == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum2name,"no info");
          if(error) return(error);
          here->siNode = tmp->number;
        }
        if(here->xf1Node == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum2name,"no info");
          if(error) return(error);
          here->xf1Node = tmp->number;
        }
        if(here->xf2Node == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum2name,"no info");
          if(error) return(error);
          here->xf2Node = tmp->number;
        }
        if(here->xf3Node == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum2name,"no info");
          if(error) return(error);
          here->xf3Node = tmp->number;
        }
        if(here->xf4Node == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum2name,"no info");
          if(error) return(error);
          here->xf4Node = tmp->number;
        }
        if(here->n1Node == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum2name,"no info");
          if(error) return(error);
          here->n1Node = tmp->number;
        }
        if(here->n2Node == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->hicum2name,"no info");
          if(error) return(error);
          here->n2Node = tmp->number;
        }
      }
        if(here->PTR_J_bi_bi_required==1)
        {
          here->PTR_J_bi_bi=SMPmakeElt(matrix,here->biNode,here->biNode);
        }
        if(here->PTR_J_bi_ei_required==1)
        {
          here->PTR_J_bi_ei=SMPmakeElt(matrix,here->biNode,here->eiNode);
        }
        if(here->PTR_J_ei_bi_required==1)
        {
          here->PTR_J_ei_bi=SMPmakeElt(matrix,here->eiNode,here->biNode);
        }
        if(here->PTR_J_ei_ei_required==1)
        {
          here->PTR_J_ei_ei=SMPmakeElt(matrix,here->eiNode,here->eiNode);
        }
        if(here->PTR_J_bi_ci_required==1)
        {
          here->PTR_J_bi_ci=SMPmakeElt(matrix,here->biNode,here->ciNode);
        }
        if(here->PTR_J_ci_bi_required==1)
        {
          here->PTR_J_ci_bi=SMPmakeElt(matrix,here->ciNode,here->biNode);
        }
        if(here->PTR_J_ci_ci_required==1)
        {
          here->PTR_J_ci_ci=SMPmakeElt(matrix,here->ciNode,here->ciNode);
        }
        if(here->PTR_J_b_bi_required==1)
        {
          here->PTR_J_b_bi=SMPmakeElt(matrix,here->bNode,here->biNode);
        }
        if(here->PTR_J_b_ci_required==1)
        {
          here->PTR_J_b_ci=SMPmakeElt(matrix,here->bNode,here->ciNode);
        }
        if(here->PTR_J_b_tnode_required==1)
        {
          here->PTR_J_b_tnode=SMPmakeElt(matrix,here->bNode,here->tnodeNode);
        }
        if(here->PTR_J_ci_tnode_required==1)
        {
          here->PTR_J_ci_tnode=SMPmakeElt(matrix,here->ciNode,here->tnodeNode);
        }
        if(here->PTR_J_b_bp_required==1)
        {
          here->PTR_J_b_bp=SMPmakeElt(matrix,here->bNode,here->bpNode);
        }
        if(here->PTR_J_ci_bp_required==1)
        {
          here->PTR_J_ci_bp=SMPmakeElt(matrix,here->ciNode,here->bpNode);
        }
        if(here->PTR_J_b_b_required==1)
        {
          here->PTR_J_b_b=SMPmakeElt(matrix,here->bNode,here->bNode);
        }
        if(here->PTR_J_ci_b_required==1)
        {
          here->PTR_J_ci_b=SMPmakeElt(matrix,here->ciNode,here->bNode);
        }
        if(here->PTR_J_b_ei_required==1)
        {
          here->PTR_J_b_ei=SMPmakeElt(matrix,here->bNode,here->eiNode);
        }
        if(here->PTR_J_ci_ei_required==1)
        {
          here->PTR_J_ci_ei=SMPmakeElt(matrix,here->ciNode,here->eiNode);
        }
        if(here->PTR_J_bp_bp_required==1)
        {
          here->PTR_J_bp_bp=SMPmakeElt(matrix,here->bpNode,here->bpNode);
        }
        if(here->PTR_J_bp_ci_required==1)
        {
          here->PTR_J_bp_ci=SMPmakeElt(matrix,here->bpNode,here->ciNode);
        }
        if(here->PTR_J_bp_tnode_required==1)
        {
          here->PTR_J_bp_tnode=SMPmakeElt(matrix,here->bpNode,here->tnodeNode);
        }
        if(here->PTR_J_bp_b_required==1)
        {
          here->PTR_J_bp_b=SMPmakeElt(matrix,here->bpNode,here->bNode);
        }
        if(here->PTR_J_bp_ei_required==1)
        {
          here->PTR_J_bp_ei=SMPmakeElt(matrix,here->bpNode,here->eiNode);
        }
        if(here->PTR_J_bp_bi_required==1)
        {
          here->PTR_J_bp_bi=SMPmakeElt(matrix,here->bpNode,here->biNode);
        }
        if(here->PTR_J_bi_tnode_required==1)
        {
          here->PTR_J_bi_tnode=SMPmakeElt(matrix,here->biNode,here->tnodeNode);
        }
        if(here->PTR_J_bi_bp_required==1)
        {
          here->PTR_J_bi_bp=SMPmakeElt(matrix,here->biNode,here->bpNode);
        }
        if(here->PTR_J_ei_tnode_required==1)
        {
          here->PTR_J_ei_tnode=SMPmakeElt(matrix,here->eiNode,here->tnodeNode);
        }
        if(here->PTR_J_ei_bp_required==1)
        {
          here->PTR_J_ei_bp=SMPmakeElt(matrix,here->eiNode,here->bpNode);
        }
        if(here->PTR_J_ei_ci_required==1)
        {
          here->PTR_J_ei_ci=SMPmakeElt(matrix,here->eiNode,here->ciNode);
        }
        if(here->PTR_J_bi_xf4_required==1)
        {
          here->PTR_J_bi_xf4=SMPmakeElt(matrix,here->biNode,here->xf4Node);
        }
        if(here->PTR_J_ei_xf4_required==1)
        {
          here->PTR_J_ei_xf4=SMPmakeElt(matrix,here->eiNode,here->xf4Node);
        }
        if(here->PTR_J_bp_si_required==1)
        {
          here->PTR_J_bp_si=SMPmakeElt(matrix,here->bpNode,here->siNode);
        }
        if(here->PTR_J_si_si_required==1)
        {
          here->PTR_J_si_si=SMPmakeElt(matrix,here->siNode,here->siNode);
        }
        if(here->PTR_J_si_ci_required==1)
        {
          here->PTR_J_si_ci=SMPmakeElt(matrix,here->siNode,here->ciNode);
        }
        if(here->PTR_J_si_bp_required==1)
        {
          here->PTR_J_si_bp=SMPmakeElt(matrix,here->siNode,here->bpNode);
        }
        if(here->PTR_J_si_tnode_required==1)
        {
          here->PTR_J_si_tnode=SMPmakeElt(matrix,here->siNode,here->tnodeNode);
        }
        if(here->PTR_J_b_e_required==1)
        {
          here->PTR_J_b_e=SMPmakeElt(matrix,here->bNode,here->eNode);
        }
        if(here->PTR_J_e_b_required==1)
        {
          here->PTR_J_e_b=SMPmakeElt(matrix,here->eNode,here->bNode);
        }
        if(here->PTR_J_e_e_required==1)
        {
          here->PTR_J_e_e=SMPmakeElt(matrix,here->eNode,here->eNode);
        }
        if(here->PTR_J_bp_e_required==1)
        {
          here->PTR_J_bp_e=SMPmakeElt(matrix,here->bpNode,here->eNode);
        }
        if(here->PTR_J_e_bp_required==1)
        {
          here->PTR_J_e_bp=SMPmakeElt(matrix,here->eNode,here->bpNode);
        }
        if(here->PTR_J_si_bi_required==1)
        {
          here->PTR_J_si_bi=SMPmakeElt(matrix,here->siNode,here->biNode);
        }
        if(here->PTR_J_si_ei_required==1)
        {
          here->PTR_J_si_ei=SMPmakeElt(matrix,here->siNode,here->eiNode);
        }
        if(here->PTR_J_ci_si_required==1)
        {
          here->PTR_J_ci_si=SMPmakeElt(matrix,here->ciNode,here->siNode);
        }
        if(here->PTR_J_si_b_required==1)
        {
          here->PTR_J_si_b=SMPmakeElt(matrix,here->siNode,here->bNode);
        }
        if(here->PTR_J_ci_xf2_required==1)
        {
          here->PTR_J_ci_xf2=SMPmakeElt(matrix,here->ciNode,here->xf2Node);
        }
        if(here->PTR_J_ei_xf2_required==1)
        {
          here->PTR_J_ei_xf2=SMPmakeElt(matrix,here->eiNode,here->xf2Node);
        }
        if(here->PTR_J_c_tnode_required==1)
        {
          here->PTR_J_c_tnode=SMPmakeElt(matrix,here->cNode,here->tnodeNode);
        }
        if(here->PTR_J_ci_c_required==1)
        {
          here->PTR_J_ci_c=SMPmakeElt(matrix,here->ciNode,here->cNode);
        }
        if(here->PTR_J_c_ci_required==1)
        {
          here->PTR_J_c_ci=SMPmakeElt(matrix,here->cNode,here->ciNode);
        }
        if(here->PTR_J_c_c_required==1)
        {
          here->PTR_J_c_c=SMPmakeElt(matrix,here->cNode,here->cNode);
        }
        if(here->PTR_J_e_tnode_required==1)
        {
          here->PTR_J_e_tnode=SMPmakeElt(matrix,here->eNode,here->tnodeNode);
        }
        if(here->PTR_J_ei_e_required==1)
        {
          here->PTR_J_ei_e=SMPmakeElt(matrix,here->eiNode,here->eNode);
        }
        if(here->PTR_J_e_ei_required==1)
        {
          here->PTR_J_e_ei=SMPmakeElt(matrix,here->eNode,here->eiNode);
        }
        if(here->PTR_J_si_s_required==1)
        {
          here->PTR_J_si_s=SMPmakeElt(matrix,here->siNode,here->sNode);
        }
        if(here->PTR_J_s_si_required==1)
        {
          here->PTR_J_s_si=SMPmakeElt(matrix,here->sNode,here->siNode);
        }
        if(here->PTR_J_s_s_required==1)
        {
          here->PTR_J_s_s=SMPmakeElt(matrix,here->sNode,here->sNode);
        }
        if(here->PTR_J_tnode_tnode_required==1)
        {
          here->PTR_J_tnode_tnode=SMPmakeElt(matrix,here->tnodeNode,here->tnodeNode);
        }
        if(here->PTR_J_tnode_bi_required==1)
        {
          here->PTR_J_tnode_bi=SMPmakeElt(matrix,here->tnodeNode,here->biNode);
        }
        if(here->PTR_J_tnode_ci_required==1)
        {
          here->PTR_J_tnode_ci=SMPmakeElt(matrix,here->tnodeNode,here->ciNode);
        }
        if(here->PTR_J_tnode_ei_required==1)
        {
          here->PTR_J_tnode_ei=SMPmakeElt(matrix,here->tnodeNode,here->eiNode);
        }
        if(here->PTR_J_tnode_si_required==1)
        {
          here->PTR_J_tnode_si=SMPmakeElt(matrix,here->tnodeNode,here->siNode);
        }
        if(here->PTR_J_tnode_bp_required==1)
        {
          here->PTR_J_tnode_bp=SMPmakeElt(matrix,here->tnodeNode,here->bpNode);
        }
        if(here->PTR_J_tnode_e_required==1)
        {
          here->PTR_J_tnode_e=SMPmakeElt(matrix,here->tnodeNode,here->eNode);
        }
        if(here->PTR_J_tnode_c_required==1)
        {
          here->PTR_J_tnode_c=SMPmakeElt(matrix,here->tnodeNode,here->cNode);
        }
        if(here->PTR_J_tnode_b_required==1)
        {
          here->PTR_J_tnode_b=SMPmakeElt(matrix,here->tnodeNode,here->bNode);
        }
        if(here->PTR_J_xf1_bi_required==1)
        {
          here->PTR_J_xf1_bi=SMPmakeElt(matrix,here->xf1Node,here->biNode);
        }
        if(here->PTR_J_xf1_ci_required==1)
        {
          here->PTR_J_xf1_ci=SMPmakeElt(matrix,here->xf1Node,here->ciNode);
        }
        if(here->PTR_J_xf1_ei_required==1)
        {
          here->PTR_J_xf1_ei=SMPmakeElt(matrix,here->xf1Node,here->eiNode);
        }
        if(here->PTR_J_xf1_tnode_required==1)
        {
          here->PTR_J_xf1_tnode=SMPmakeElt(matrix,here->xf1Node,here->tnodeNode);
        }
        if(here->PTR_J_xf1_xf2_required==1)
        {
          here->PTR_J_xf1_xf2=SMPmakeElt(matrix,here->xf1Node,here->xf2Node);
        }
        if(here->PTR_J_xf1_xf1_required==1)
        {
          here->PTR_J_xf1_xf1=SMPmakeElt(matrix,here->xf1Node,here->xf1Node);
        }
        if(here->PTR_J_xf2_bi_required==1)
        {
          here->PTR_J_xf2_bi=SMPmakeElt(matrix,here->xf2Node,here->biNode);
        }
        if(here->PTR_J_xf2_ci_required==1)
        {
          here->PTR_J_xf2_ci=SMPmakeElt(matrix,here->xf2Node,here->ciNode);
        }
        if(here->PTR_J_xf2_tnode_required==1)
        {
          here->PTR_J_xf2_tnode=SMPmakeElt(matrix,here->xf2Node,here->tnodeNode);
        }
        if(here->PTR_J_xf2_ei_required==1)
        {
          here->PTR_J_xf2_ei=SMPmakeElt(matrix,here->xf2Node,here->eiNode);
        }
        if(here->PTR_J_xf2_xf1_required==1)
        {
          here->PTR_J_xf2_xf1=SMPmakeElt(matrix,here->xf2Node,here->xf1Node);
        }
        if(here->PTR_J_xf2_xf2_required==1)
        {
          here->PTR_J_xf2_xf2=SMPmakeElt(matrix,here->xf2Node,here->xf2Node);
        }
        if(here->PTR_J_xf3_bi_required==1)
        {
          here->PTR_J_xf3_bi=SMPmakeElt(matrix,here->xf3Node,here->biNode);
        }
        if(here->PTR_J_xf3_ei_required==1)
        {
          here->PTR_J_xf3_ei=SMPmakeElt(matrix,here->xf3Node,here->eiNode);
        }
        if(here->PTR_J_xf3_ci_required==1)
        {
          here->PTR_J_xf3_ci=SMPmakeElt(matrix,here->xf3Node,here->ciNode);
        }
        if(here->PTR_J_xf3_tnode_required==1)
        {
          here->PTR_J_xf3_tnode=SMPmakeElt(matrix,here->xf3Node,here->tnodeNode);
        }
        if(here->PTR_J_xf3_xf4_required==1)
        {
          here->PTR_J_xf3_xf4=SMPmakeElt(matrix,here->xf3Node,here->xf4Node);
        }
        if(here->PTR_J_xf3_xf3_required==1)
        {
          here->PTR_J_xf3_xf3=SMPmakeElt(matrix,here->xf3Node,here->xf3Node);
        }
        if(here->PTR_J_xf4_bi_required==1)
        {
          here->PTR_J_xf4_bi=SMPmakeElt(matrix,here->xf4Node,here->biNode);
        }
        if(here->PTR_J_xf4_ci_required==1)
        {
          here->PTR_J_xf4_ci=SMPmakeElt(matrix,here->xf4Node,here->ciNode);
        }
        if(here->PTR_J_xf4_tnode_required==1)
        {
          here->PTR_J_xf4_tnode=SMPmakeElt(matrix,here->xf4Node,here->tnodeNode);
        }
        if(here->PTR_J_xf4_ei_required==1)
        {
          here->PTR_J_xf4_ei=SMPmakeElt(matrix,here->xf4Node,here->eiNode);
        }
        if(here->PTR_J_xf4_xf3_required==1)
        {
          here->PTR_J_xf4_xf3=SMPmakeElt(matrix,here->xf4Node,here->xf3Node);
        }
        if(here->PTR_J_xf4_xf4_required==1)
        {
          here->PTR_J_xf4_xf4=SMPmakeElt(matrix,here->xf4Node,here->xf4Node);
        }
        if(here->PTR_J_s_tnode_required==1)
        {
          here->PTR_J_s_tnode=SMPmakeElt(matrix,here->sNode,here->tnodeNode);
        }

    }
  }
  return(OK);
}
int psp102setup (SMPmatrix *matrix, GENmodel *inModel, CKTcircuit *ckt, int *states)
     /* load the psp102 device structure with those pointers needed later 
      * for fast matrix loading 
      */
{
  register psp102model *model = (psp102model*)inModel;
  register psp102instance *here;
  
  /*  loop through all the psp102 device models */
  for ( ;model != NULL ;model = model->psp102nextModel )
  {
    if(model->pmos_Given == FALSE) model->pmos=1;
    if(model->nmos_Given == FALSE) model->nmos=1;
    if(model->LEVEL_Given == FALSE) model->LEVEL=1020;
    if(model->TYPE_Given == FALSE) model->TYPE=1.0;
    if(model->TR_Given == FALSE) model->TR=21.0;
    if(model->SWIGATE_Given == FALSE) model->SWIGATE=0.0;
    if(model->SWIMPACT_Given == FALSE) model->SWIMPACT=0.0;
    if(model->SWGIDL_Given == FALSE) model->SWGIDL=0.0;
    if(model->SWJUNCAP_Given == FALSE) model->SWJUNCAP=0.0;
    if(model->QMC_Given == FALSE) model->QMC=1.0;
    if(model->LVARO_Given == FALSE) model->LVARO=0.0;
    if(model->LVARL_Given == FALSE) model->LVARL=0.0;
    if(model->LVARW_Given == FALSE) model->LVARW=0.0;
    if(model->LAP_Given == FALSE) model->LAP=0.0;
    if(model->WVARO_Given == FALSE) model->WVARO=0.0;
    if(model->WVARL_Given == FALSE) model->WVARL=0.0;
    if(model->WVARW_Given == FALSE) model->WVARW=0.0;
    if(model->WOT_Given == FALSE) model->WOT=0.0;
    if(model->DLQ_Given == FALSE) model->DLQ=0.0;
    if(model->DWQ_Given == FALSE) model->DWQ=0.0;
    if(model->VFBO_Given == FALSE) model->VFBO=(-1.0);
    if(model->VFBL_Given == FALSE) model->VFBL=0.0;
    if(model->VFBW_Given == FALSE) model->VFBW=0.0;
    if(model->VFBLW_Given == FALSE) model->VFBLW=0.0;
    if(model->STVFBO_Given == FALSE) model->STVFBO=5e-4;
    if(model->STVFBL_Given == FALSE) model->STVFBL=0.0;
    if(model->STVFBW_Given == FALSE) model->STVFBW=0.0;
    if(model->STVFBLW_Given == FALSE) model->STVFBLW=0.0;
    if(model->TOXO_Given == FALSE) model->TOXO=2e-9;
    if(model->NSUBO_Given == FALSE) model->NSUBO=3e23;
    if(model->NSUBW_Given == FALSE) model->NSUBW=0.0;
    if(model->WSEG_Given == FALSE) model->WSEG=1e-8;
    if(model->NPCK_Given == FALSE) model->NPCK=1e24;
    if(model->NPCKW_Given == FALSE) model->NPCKW=0.0;
    if(model->WSEGP_Given == FALSE) model->WSEGP=1e-8;
    if(model->LPCK_Given == FALSE) model->LPCK=1e-8;
    if(model->LPCKW_Given == FALSE) model->LPCKW=0.0;
    if(model->FOL1_Given == FALSE) model->FOL1=0.0;
    if(model->FOL2_Given == FALSE) model->FOL2=0.0;
    if(model->VNSUBO_Given == FALSE) model->VNSUBO=0.0;
    if(model->NSLPO_Given == FALSE) model->NSLPO=0.05;
    if(model->DNSUBO_Given == FALSE) model->DNSUBO=0.0;
    if(model->DPHIBO_Given == FALSE) model->DPHIBO=0.0;
    if(model->DPHIBL_Given == FALSE) model->DPHIBL=0.0;
    if(model->DPHIBLEXP_Given == FALSE) model->DPHIBLEXP=1.0;
    if(model->DPHIBW_Given == FALSE) model->DPHIBW=0.0;
    if(model->DPHIBLW_Given == FALSE) model->DPHIBLW=0.0;
    if(model->NPO_Given == FALSE) model->NPO=1e26;
    if(model->NPL_Given == FALSE) model->NPL=0.0;
    if(model->CTO_Given == FALSE) model->CTO=0.0;
    if(model->CTL_Given == FALSE) model->CTL=0.0;
    if(model->CTLEXP_Given == FALSE) model->CTLEXP=1.0;
    if(model->CTW_Given == FALSE) model->CTW=0.0;
    if(model->CTLW_Given == FALSE) model->CTLW=0.0;
    if(model->TOXOVO_Given == FALSE) model->TOXOVO=2e-9;
    if(model->LOV_Given == FALSE) model->LOV=0;
    if(model->NOVO_Given == FALSE) model->NOVO=5e25;
    if(model->CFL_Given == FALSE) model->CFL=0.0;
    if(model->CFLEXP_Given == FALSE) model->CFLEXP=2.0;
    if(model->CFW_Given == FALSE) model->CFW=0.0;
    if(model->CFBO_Given == FALSE) model->CFBO=0.0;
    if(model->UO_Given == FALSE) model->UO=5e-2;
    if(model->FBET1_Given == FALSE) model->FBET1=0.0;
    if(model->FBET1W_Given == FALSE) model->FBET1W=0.0;
    if(model->LP1_Given == FALSE) model->LP1=1e-8;
    if(model->LP1W_Given == FALSE) model->LP1W=0.0;
    if(model->FBET2_Given == FALSE) model->FBET2=0.0;
    if(model->LP2_Given == FALSE) model->LP2=1e-8;
    if(model->BETW1_Given == FALSE) model->BETW1=0.0;
    if(model->BETW2_Given == FALSE) model->BETW2=0.0;
    if(model->WBET_Given == FALSE) model->WBET=1e-9;
    if(model->STBETO_Given == FALSE) model->STBETO=1.0;
    if(model->STBETL_Given == FALSE) model->STBETL=0.0;
    if(model->STBETW_Given == FALSE) model->STBETW=0.0;
    if(model->STBETLW_Given == FALSE) model->STBETLW=0.0;
    if(model->MUEO_Given == FALSE) model->MUEO=0.5;
    if(model->MUEW_Given == FALSE) model->MUEW=0.0;
    if(model->STMUEO_Given == FALSE) model->STMUEO=0.0;
    if(model->THEMUO_Given == FALSE) model->THEMUO=1.5;
    if(model->STTHEMUO_Given == FALSE) model->STTHEMUO=1.5;
    if(model->CSO_Given == FALSE) model->CSO=0.0;
    if(model->CSL_Given == FALSE) model->CSL=0.0;
    if(model->CSLEXP_Given == FALSE) model->CSLEXP=0.0;
    if(model->CSW_Given == FALSE) model->CSW=0.0;
    if(model->CSLW_Given == FALSE) model->CSLW=0.0;
    if(model->STCSO_Given == FALSE) model->STCSO=0.0;
    if(model->XCORO_Given == FALSE) model->XCORO=0.0;
    if(model->XCORL_Given == FALSE) model->XCORL=0.0;
    if(model->XCORW_Given == FALSE) model->XCORW=0.0;
    if(model->XCORLW_Given == FALSE) model->XCORLW=0.0;
    if(model->STXCORO_Given == FALSE) model->STXCORO=0.0;
    if(model->FETAO_Given == FALSE) model->FETAO=1.0;
    if(model->RSW1_Given == FALSE) model->RSW1=2.5e3;
    if(model->RSW2_Given == FALSE) model->RSW2=0.0;
    if(model->STRSO_Given == FALSE) model->STRSO=1.0;
    if(model->RSBO_Given == FALSE) model->RSBO=0.0;
    if(model->RSGO_Given == FALSE) model->RSGO=0.0;
    if(model->THESATO_Given == FALSE) model->THESATO=0.0;
    if(model->THESATL_Given == FALSE) model->THESATL=0.05;
    if(model->THESATLEXP_Given == FALSE) model->THESATLEXP=1.0;
    if(model->THESATW_Given == FALSE) model->THESATW=0.0;
    if(model->THESATLW_Given == FALSE) model->THESATLW=0.0;
    if(model->STTHESATO_Given == FALSE) model->STTHESATO=1.0;
    if(model->STTHESATL_Given == FALSE) model->STTHESATL=0.0;
    if(model->STTHESATW_Given == FALSE) model->STTHESATW=0.0;
    if(model->STTHESATLW_Given == FALSE) model->STTHESATLW=0.0;
    if(model->THESATBO_Given == FALSE) model->THESATBO=0.0;
    if(model->THESATGO_Given == FALSE) model->THESATGO=0.0;
    if(model->AXO_Given == FALSE) model->AXO=18;
    if(model->AXL_Given == FALSE) model->AXL=0.4;
    if(model->ALPL_Given == FALSE) model->ALPL=5e-4;
    if(model->ALPLEXP_Given == FALSE) model->ALPLEXP=1.0;
    if(model->ALPW_Given == FALSE) model->ALPW=0.0;
    if(model->ALP1L1_Given == FALSE) model->ALP1L1=0.0;
    if(model->ALP1LEXP_Given == FALSE) model->ALP1LEXP=0.5;
    if(model->ALP1L2_Given == FALSE) model->ALP1L2=0.0;
    if(model->ALP1W_Given == FALSE) model->ALP1W=0.0;
    if(model->ALP2L1_Given == FALSE) model->ALP2L1=0.0;
    if(model->ALP2LEXP_Given == FALSE) model->ALP2LEXP=0.5;
    if(model->ALP2L2_Given == FALSE) model->ALP2L2=0.0;
    if(model->ALP2W_Given == FALSE) model->ALP2W=0.0;
    if(model->VPO_Given == FALSE) model->VPO=0.05;
    if(model->A1O_Given == FALSE) model->A1O=1.0;
    if(model->A1L_Given == FALSE) model->A1L=0.0;
    if(model->A1W_Given == FALSE) model->A1W=0.0;
    if(model->A2O_Given == FALSE) model->A2O=10;
    if(model->STA2O_Given == FALSE) model->STA2O=0.0;
    if(model->A3O_Given == FALSE) model->A3O=1.0;
    if(model->A3L_Given == FALSE) model->A3L=0.0;
    if(model->A3W_Given == FALSE) model->A3W=0.0;
    if(model->A4O_Given == FALSE) model->A4O=0.0;
    if(model->A4L_Given == FALSE) model->A4L=0.0;
    if(model->A4W_Given == FALSE) model->A4W=0.0;
    if(model->GCOO_Given == FALSE) model->GCOO=0.0;
    if(model->IGINVLW_Given == FALSE) model->IGINVLW=0.0;
    if(model->IGOVW_Given == FALSE) model->IGOVW=0.0;
    if(model->STIGO_Given == FALSE) model->STIGO=2.0;
    if(model->GC2O_Given == FALSE) model->GC2O=0.375;
    if(model->GC3O_Given == FALSE) model->GC3O=0.063;
    if(model->CHIBO_Given == FALSE) model->CHIBO=3.1;
    if(model->AGIDLW_Given == FALSE) model->AGIDLW=0.0;
    if(model->BGIDLO_Given == FALSE) model->BGIDLO=41;
    if(model->STBGIDLO_Given == FALSE) model->STBGIDLO=0.0;
    if(model->CGIDLO_Given == FALSE) model->CGIDLO=0.0;
    if(model->CGBOVL_Given == FALSE) model->CGBOVL=0.0;
    if(model->CFRW_Given == FALSE) model->CFRW=0.0;
    if(model->FNTO_Given == FALSE) model->FNTO=1.0;
    if(model->NFALW_Given == FALSE) model->NFALW=8e22;
    if(model->NFBLW_Given == FALSE) model->NFBLW=3e7;
    if(model->NFCLW_Given == FALSE) model->NFCLW=0.0;
    if(model->DTA_Given == FALSE) model->DTA=0;
    if(model->SAREF_Given == FALSE) model->SAREF=1.0e-6;
    if(model->SBREF_Given == FALSE) model->SBREF=1.0e-6;
    if(model->WLOD_Given == FALSE) model->WLOD=0;
    if(model->KUO_Given == FALSE) model->KUO=0;
    if(model->KVSAT_Given == FALSE) model->KVSAT=0;
    if(model->TKUO_Given == FALSE) model->TKUO=0;
    if(model->LKUO_Given == FALSE) model->LKUO=0;
    if(model->WKUO_Given == FALSE) model->WKUO=0;
    if(model->PKUO_Given == FALSE) model->PKUO=0;
    if(model->LLODKUO_Given == FALSE) model->LLODKUO=0;
    if(model->WLODKUO_Given == FALSE) model->WLODKUO=0;
    if(model->KVTHO_Given == FALSE) model->KVTHO=0;
    if(model->LKVTHO_Given == FALSE) model->LKVTHO=0;
    if(model->WKVTHO_Given == FALSE) model->WKVTHO=0;
    if(model->PKVTHO_Given == FALSE) model->PKVTHO=0;
    if(model->LLODVTH_Given == FALSE) model->LLODVTH=0;
    if(model->WLODVTH_Given == FALSE) model->WLODVTH=0;
    if(model->STETAO_Given == FALSE) model->STETAO=0;
    if(model->LODETAO_Given == FALSE) model->LODETAO=1.0;
    if(model->TRJ_Given == FALSE) model->TRJ=21;
    if(model->IMAX_Given == FALSE) model->IMAX=1000;
    if(model->CJORBOT_Given == FALSE) model->CJORBOT=1E-3;
    if(model->CJORSTI_Given == FALSE) model->CJORSTI=1E-9;
    if(model->CJORGAT_Given == FALSE) model->CJORGAT=1E-9;
    if(model->VBIRBOT_Given == FALSE) model->VBIRBOT=1;
    if(model->VBIRSTI_Given == FALSE) model->VBIRSTI=1;
    if(model->VBIRGAT_Given == FALSE) model->VBIRGAT=1;
    if(model->PBOT_Given == FALSE) model->PBOT=0.5;
    if(model->PSTI_Given == FALSE) model->PSTI=0.5;
    if(model->PGAT_Given == FALSE) model->PGAT=0.5;
    if(model->PHIGBOT_Given == FALSE) model->PHIGBOT=1.16;
    if(model->PHIGSTI_Given == FALSE) model->PHIGSTI=1.16;
    if(model->PHIGGAT_Given == FALSE) model->PHIGGAT=1.16;
    if(model->IDSATRBOT_Given == FALSE) model->IDSATRBOT=1E-12;
    if(model->IDSATRSTI_Given == FALSE) model->IDSATRSTI=1E-18;
    if(model->IDSATRGAT_Given == FALSE) model->IDSATRGAT=1E-18;
    if(model->CSRHBOT_Given == FALSE) model->CSRHBOT=1E2;
    if(model->CSRHSTI_Given == FALSE) model->CSRHSTI=1E-4;
    if(model->CSRHGAT_Given == FALSE) model->CSRHGAT=1E-4;
    if(model->XJUNSTI_Given == FALSE) model->XJUNSTI=100E-9;
    if(model->XJUNGAT_Given == FALSE) model->XJUNGAT=100E-9;
    if(model->CTATBOT_Given == FALSE) model->CTATBOT=1E2;
    if(model->CTATSTI_Given == FALSE) model->CTATSTI=1E-4;
    if(model->CTATGAT_Given == FALSE) model->CTATGAT=1E-4;
    if(model->MEFFTATBOT_Given == FALSE) model->MEFFTATBOT=0.25;
    if(model->MEFFTATSTI_Given == FALSE) model->MEFFTATSTI=0.25;
    if(model->MEFFTATGAT_Given == FALSE) model->MEFFTATGAT=0.25;
    if(model->CBBTBOT_Given == FALSE) model->CBBTBOT=1E-12;
    if(model->CBBTSTI_Given == FALSE) model->CBBTSTI=1E-18;
    if(model->CBBTGAT_Given == FALSE) model->CBBTGAT=1E-18;
    if(model->FBBTRBOT_Given == FALSE) model->FBBTRBOT=1E9;
    if(model->FBBTRSTI_Given == FALSE) model->FBBTRSTI=1E9;
    if(model->FBBTRGAT_Given == FALSE) model->FBBTRGAT=1E9;
    if(model->STFBBTBOT_Given == FALSE) model->STFBBTBOT=(-1E-3);
    if(model->STFBBTSTI_Given == FALSE) model->STFBBTSTI=(-1E-3);
    if(model->STFBBTGAT_Given == FALSE) model->STFBBTGAT=(-1E-3);
    if(model->VBRBOT_Given == FALSE) model->VBRBOT=10;
    if(model->VBRSTI_Given == FALSE) model->VBRSTI=10;
    if(model->VBRGAT_Given == FALSE) model->VBRGAT=10;
    if(model->PBRBOT_Given == FALSE) model->PBRBOT=4;
    if(model->PBRSTI_Given == FALSE) model->PBRSTI=4;
    if(model->PBRGAT_Given == FALSE) model->PBRGAT=4;
    for ( here = model->psp102instances ;here != NULL ; here = here->psp102nextInstance )
    {
    if(here->L_Given == FALSE) here->L=10e-6;
    if(here->W_Given == FALSE) here->W=10e-6;
    if(here->SA_Given == FALSE) here->SA=0.0;
    if(here->SB_Given == FALSE) here->SB=0.0;
    if(here->ABSOURCE_Given == FALSE) here->ABSOURCE=1E-12;
    if(here->LSSOURCE_Given == FALSE) here->LSSOURCE=1E-6;
    if(here->LGSOURCE_Given == FALSE) here->LGSOURCE=1E-6;
    if(here->ABDRAIN_Given == FALSE) here->ABDRAIN=1E-12;
    if(here->LSDRAIN_Given == FALSE) here->LSDRAIN=1E-6;
    if(here->LGDRAIN_Given == FALSE) here->LGDRAIN=1E-6;
    if(here->AS_Given == FALSE) here->AS=1E-12;
    if(here->PS_Given == FALSE) here->PS=1E-6;
    if(here->AD_Given == FALSE) here->AD=1E-12;
    if(here->PD_Given == FALSE) here->PD=1E-6;
    if(here->MULT_Given == FALSE) here->MULT=1.0;
      /* Internal Nodes */
      {
        here->NOINode = -1;
        here->NOI2Node = -1;
      }
      /* set states */
      here->state_NOI_GND = *states; *states += 2;
      here->state_B_D = *states; *states += 2;
      here->state_B_S = *states; *states += 2;
      here->state_G_B = *states; *states += 2;
      here->state_G_D = *states; *states += 2;
      here->state_G_S = *states; *states += 2;
      here->state_D_S = *states; *states += 2;
      /* set Sparse Matrix Pointers */
      here->PTR_J_D_S_required=0;
      here->PTR_J_D_B_required=0;
      here->PTR_J_B_S_required=0;
      here->PTR_J_B_B_required=0;
      here->PTR_J_D_D_required=0;
      here->PTR_J_B_D_required=0;
      here->PTR_J_D_G_required=0;
      here->PTR_J_B_G_required=0;
      here->PTR_J_S_S_required=0;
      here->PTR_J_S_B_required=0;
      here->PTR_J_S_D_required=0;
      here->PTR_J_S_G_required=0;
      here->PTR_J_G_S_required=0;
      here->PTR_J_G_B_required=0;
      here->PTR_J_G_D_required=0;
      here->PTR_J_G_G_required=0;
      here->PTR_J_NOI2_NOI2_required=0;
      here->PTR_J_NOI2_S_required=0;
      here->PTR_J_NOI2_B_required=0;
      here->PTR_J_NOI2_G_required=0;
      here->PTR_J_NOI2_D_required=0;
      here->PTR_J_NOI_S_required=0;
      here->PTR_J_NOI_B_required=0;
      here->PTR_J_NOI_G_required=0;
      here->PTR_J_NOI_D_required=0;
      here->PTR_J_NOI_NOI2_required=0;
      here->PTR_J_NOI_NOI_required=0;
      here->PTR_J_D_NOI2_required=0;
      here->PTR_J_S_NOI2_required=0;
      here->PTR_J_G_NOI_required=0;
      here->PTR_J_S_NOI_required=0;
      here->PTR_J_D_NOI_required=0;

      psp102guesstopology(matrix,ckt,model,here);

      /* Internal Nodes */
      {
        int error;
        CKTnode *tmp;
        if(here->NOINode == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->psp102name,"no info");
          if(error) return(error);
          here->NOINode = tmp->number;
        }
        if(here->NOI2Node == -1)
        {
          error=CKTmkVolt(ckt,&tmp,here->psp102name,"no info");
          if(error) return(error);
          here->NOI2Node = tmp->number;
        }
      }
        if(here->PTR_J_D_S_required==1)
        {
          here->PTR_J_D_S=SMPmakeElt(matrix,here->DNode,here->SNode);
        }
        if(here->PTR_J_D_B_required==1)
        {
          here->PTR_J_D_B=SMPmakeElt(matrix,here->DNode,here->BNode);
        }
        if(here->PTR_J_B_S_required==1)
        {
          here->PTR_J_B_S=SMPmakeElt(matrix,here->BNode,here->SNode);
        }
        if(here->PTR_J_B_B_required==1)
        {
          here->PTR_J_B_B=SMPmakeElt(matrix,here->BNode,here->BNode);
        }
        if(here->PTR_J_D_D_required==1)
        {
          here->PTR_J_D_D=SMPmakeElt(matrix,here->DNode,here->DNode);
        }
        if(here->PTR_J_B_D_required==1)
        {
          here->PTR_J_B_D=SMPmakeElt(matrix,here->BNode,here->DNode);
        }
        if(here->PTR_J_D_G_required==1)
        {
          here->PTR_J_D_G=SMPmakeElt(matrix,here->DNode,here->GNode);
        }
        if(here->PTR_J_B_G_required==1)
        {
          here->PTR_J_B_G=SMPmakeElt(matrix,here->BNode,here->GNode);
        }
        if(here->PTR_J_S_S_required==1)
        {
          here->PTR_J_S_S=SMPmakeElt(matrix,here->SNode,here->SNode);
        }
        if(here->PTR_J_S_B_required==1)
        {
          here->PTR_J_S_B=SMPmakeElt(matrix,here->SNode,here->BNode);
        }
        if(here->PTR_J_S_D_required==1)
        {
          here->PTR_J_S_D=SMPmakeElt(matrix,here->SNode,here->DNode);
        }
        if(here->PTR_J_S_G_required==1)
        {
          here->PTR_J_S_G=SMPmakeElt(matrix,here->SNode,here->GNode);
        }
        if(here->PTR_J_G_S_required==1)
        {
          here->PTR_J_G_S=SMPmakeElt(matrix,here->GNode,here->SNode);
        }
        if(here->PTR_J_G_B_required==1)
        {
          here->PTR_J_G_B=SMPmakeElt(matrix,here->GNode,here->BNode);
        }
        if(here->PTR_J_G_D_required==1)
        {
          here->PTR_J_G_D=SMPmakeElt(matrix,here->GNode,here->DNode);
        }
        if(here->PTR_J_G_G_required==1)
        {
          here->PTR_J_G_G=SMPmakeElt(matrix,here->GNode,here->GNode);
        }
        if(here->PTR_J_NOI2_NOI2_required==1)
        {
          here->PTR_J_NOI2_NOI2=SMPmakeElt(matrix,here->NOI2Node,here->NOI2Node);
        }
        if(here->PTR_J_NOI2_S_required==1)
        {
          here->PTR_J_NOI2_S=SMPmakeElt(matrix,here->NOI2Node,here->SNode);
        }
        if(here->PTR_J_NOI2_B_required==1)
        {
          here->PTR_J_NOI2_B=SMPmakeElt(matrix,here->NOI2Node,here->BNode);
        }
        if(here->PTR_J_NOI2_G_required==1)
        {
          here->PTR_J_NOI2_G=SMPmakeElt(matrix,here->NOI2Node,here->GNode);
        }
        if(here->PTR_J_NOI2_D_required==1)
        {
          here->PTR_J_NOI2_D=SMPmakeElt(matrix,here->NOI2Node,here->DNode);
        }
        if(here->PTR_J_NOI_S_required==1)
        {
          here->PTR_J_NOI_S=SMPmakeElt(matrix,here->NOINode,here->SNode);
        }
        if(here->PTR_J_NOI_B_required==1)
        {
          here->PTR_J_NOI_B=SMPmakeElt(matrix,here->NOINode,here->BNode);
        }
        if(here->PTR_J_NOI_G_required==1)
        {
          here->PTR_J_NOI_G=SMPmakeElt(matrix,here->NOINode,here->GNode);
        }
        if(here->PTR_J_NOI_D_required==1)
        {
          here->PTR_J_NOI_D=SMPmakeElt(matrix,here->NOINode,here->DNode);
        }
        if(here->PTR_J_NOI_NOI2_required==1)
        {
          here->PTR_J_NOI_NOI2=SMPmakeElt(matrix,here->NOINode,here->NOI2Node);
        }
        if(here->PTR_J_NOI_NOI_required==1)
        {
          here->PTR_J_NOI_NOI=SMPmakeElt(matrix,here->NOINode,here->NOINode);
        }
        if(here->PTR_J_D_NOI2_required==1)
        {
          here->PTR_J_D_NOI2=SMPmakeElt(matrix,here->DNode,here->NOI2Node);
        }
        if(here->PTR_J_S_NOI2_required==1)
        {
          here->PTR_J_S_NOI2=SMPmakeElt(matrix,here->SNode,here->NOI2Node);
        }
        if(here->PTR_J_G_NOI_required==1)
        {
          here->PTR_J_G_NOI=SMPmakeElt(matrix,here->GNode,here->NOINode);
        }
        if(here->PTR_J_S_NOI_required==1)
        {
          here->PTR_J_S_NOI=SMPmakeElt(matrix,here->SNode,here->NOINode);
        }
        if(here->PTR_J_D_NOI_required==1)
        {
          here->PTR_J_D_NOI=SMPmakeElt(matrix,here->DNode,here->NOINode);
        }

    }
  }
  return(OK);
}