001    package cnslab.cnsnetwork;
002    
003    import java.util.*;
004    
005    /***********************************************************************
006    * VSICLIFNeuron parameters.
007    *  
008    * @version
009    *   $Date: 2012-08-04 13:43:22 -0500 (Sat, 04 Aug 2012) $
010    *   $Rev: 104 $
011    *   $Author: croft $
012    * @author
013    *   Yi Dong
014    * @author
015    *   David Wallace Croft, M.Sc.
016    * @author
017    *   Jeremy Cohen
018    ***********************************************************************/
019    public final class  VSICLIFNeuronPara
020      implements Para
021    ////////////////////////////////////////////////////////////////////////
022    ////////////////////////////////////////////////////////////////////////
023    {
024
025    /** constant for membrane voltage */
026    public double CON_v;
027    
028    /** constant for membrane voltage - threshold */
029    public double CON;
030
031    /** capacitance of the neuron farad */
032    public double CAP = 3E-11;
033    
034    /** leak conductance siemens */
035    public double GL = 1.5E-9;
036    
037    @Deprecated
038    /** inverse of the time constant */
039    public int TIMECON =  (int)(GL/CAP);
040
041    /** reset potential V */
042    public double VRESET = -0.07;
043    
044    /** resting potential V */
045    public double VREST = -0.07 ;  
046
047    /** threshold potential V (theta infinity in the paper) */
048    public double THRESHOLD = -0.05;
049    
050    /** refractory current */
051    public double REFCURR = 0E-10;
052
053    public double THRESHOLDADD=0.0;
054    
055    public double RRESET=-.06;
056    
057    public double A=0.0;
058
059    public double K;
060    
061    public double B=10;
062
063    /** must put 0, NG-term, NB-term, followed by NJs in same order as curr
064    with highest exponent last! */
065    public int[] expts;
066    
067    public int[] orderOfExpts;
068
069    /** the decay for excitation 5 ms */
070    public double [] DECAY = {1/0.005,1/0.025};
071    
072    public double [] IADD= {0,0};
073    
074    public double[] IRATIO= {1.0,1.0};
075    
076    public double [] ini_curr = {0.0,0.0};
077
078    /** external constant current */
079    public double IEXT = 0 ;
080
081    /** some constants to boost up the computation */
082    public double [] GLCAPDECAY;
083    
084    /** some constants to boost up the computation */
085    public double [] BCAPDECAY;
086    
087    /** some constants to boost up the computation */
088    public double [] ABDECAY;
089    
090    /** some constants to boost up the computation */
091    public double ABGLCAP;
092
093    /** all state variables' decays */
094    public double [] allDecays;
095
096    /** absolute refractory period */
097    public double ABSREF = 0.002;
098
099    @Deprecated
100    /** minimum rising time for neuron to fire */
101    public double MINRISETIME = 1e-4;
102
103    public double ini_mem = -0.07;
104    
105    public double ini_memVar = 0.005;
106    
107    public double ini_threshold = -0.05;
108
109    ////////////////////////////////////////////////////////////////////////
110    ////////////////////////////////////////////////////////////////////////
111
112    @Override
113    public String  getModel ( )
114    ////////////////////////////////////////////////////////////////////////
115    {
116      return "VSICLIFNeuron";
117    }
118
119    @Deprecated
120    public void assignExp()
121    ////////////////////////////////////////////////////////////////////////
122    {
123      TIMECON =  (int)(GL/CAP);
124      
125      int currLen = DECAY.length;
126      
127      if ( currLen != IADD.length
128        || currLen != IRATIO.length
129        || currLen != ini_curr.length )
130      {
131        throw new RuntimeException ( "current length doesn't match "
132          + "decay.length:"     + DECAY.length
133          + " iadd.length:"     + IADD.length
134          + " iratio.length:"   + IRATIO.length
135          + " ini_curr.length:" + ini_curr.length );
136      }
137      
138      expts = new int[currLen+3];
139      
140      orderOfExpts = new int[currLen+3];
141      
142      int [] gcdArray = new int[currLen+2];
143      
144      gcdArray[0]=TIMECON;
145      
146      gcdArray[1]=(int)B;
147
148      for(int i=2; i < gcdArray.length ; i++)
149      {
150        gcdArray[i] = (int)DECAY[i-2];
151      }
152
153      //computes the greatest common divisor
154      
155      K = FunUtil.gcd(gcdArray);
156
157      expts[0]=0;
158      
159      expts[1]=TIMECON/(int)K;
160      
161      expts[2]=((int)B)/(int)K;
162      
163      for(int i=3; i < expts.length; i++)
164      {
165        expts[i] =  ((int)DECAY[i-3])/(int)K;
166      }
167
168      System.arraycopy(expts, 0, orderOfExpts, 0, orderOfExpts.length);
169      
170      Arrays.sort(orderOfExpts);
171
172      GLCAPDECAY = new double [currLen];
173      
174      for(int a=0; a <currLen; a++)
175      {
176        GLCAPDECAY[a]=(GL-CAP*DECAY[a]);
177      }
178
179      BCAPDECAY = new double [currLen];
180      
181      for(int a=0; a <currLen; a++)
182      {
183        BCAPDECAY[a]=(B*CAP-CAP*DECAY[a]);
184      }
185      
186      ABGLCAP = A/(B-GL/CAP);
187
188      ABDECAY = new double [currLen];
189      
190      for(int a=0; a <currLen; a++)
191      {
192        ABDECAY[a]= A/(B-DECAY[a]);
193      }
194    }
195
196    public void calConstants()
197    ////////////////////////////////////////////////////////////////////////
198    {
199      TIMECON =  (int)(GL/CAP);
200      
201      int currLen = DECAY.length;
202      
203      if ( currLen != IADD.length
204        || currLen != IRATIO.length
205        || currLen != ini_curr.length )
206      {
207        throw new RuntimeException ( "current length doesn't match "
208          + "decay.length:"     + DECAY.length
209          + " iadd.length:"     + IADD.length
210          + " iratio.length:"   + IRATIO.length
211          + " ini_curr.length:" + ini_curr.length );
212      }
213
214      GLCAPDECAY = new double [currLen];
215      
216      for(int a=0; a <currLen; a++)
217      {
218        GLCAPDECAY[a]=(GL-CAP*DECAY[a]);
219      }
220
221      BCAPDECAY = new double [currLen];
222      
223      for(int a=0; a <currLen; a++)
224      {
225        BCAPDECAY[a]=(B*CAP-CAP*DECAY[a]);
226      }
227      
228      ABGLCAP = A/(B-GL/CAP);
229
230      ABDECAY = new double [currLen];
231      
232      for(int a=0; a <currLen; a++)
233      {
234        ABDECAY[a]= A/(B-DECAY[a]);
235      }
236
237      allDecays = new double[currLen+2];
238      
239      allDecays[0]=GL/CAP;
240      
241      allDecays[1]=B;
242      
243      for(int i=2; i < allDecays.length ; i++)
244      {
245        allDecays[i] = DECAY[i-2];
246      }
247    }
248
249    ////////////////////////////////////////////////////////////////////////
250    ////////////////////////////////////////////////////////////////////////
251    }