46 #ifndef Xyce_N_DEV_Neuron_h
47 #define Xyce_N_DEV_Neuron_h
71 static const char *
name() {
return "Neuron";}
99 static std::vector< std::vector<int> >
jacStamp;
115 void registerLIDs(
const std::vector<int> & intLIDVecRef,
116 const std::vector<int> & extLIDVecRef );
121 const std::vector< std::vector<int> > &
jacobianStamp()
const;
122 void registerJacLIDs(
const std::vector< std::vector<int> > & jacLIDVec );
132 void varTypes( std::vector<char> & varTypeVec );
162 template <
typename ScalarT>
163 static ScalarT
alphaN(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
165 ScalarT vDiff = 1000.0 * (Vn1 - Vn2 - Vrest);
168 if ((vDiff > 9.99) && (vDiff < 10.01) )
170 r = 1.0/(10.0 * ( std::exp( (10.0 - vDiff)/10.0 )));
175 (100.0 * ( std::exp( (10.0 - vDiff)/10.0 ) - 1.0 ));
181 template <
typename ScalarT>
182 static ScalarT
betaN(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
184 ScalarT vDiff = 1000.0 * (Vn1 - Vn2 - Vrest);
185 ScalarT r = 0.125 * std::exp( -vDiff/80.0 );
191 template <
typename ScalarT>
192 static ScalarT
alphaM(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
194 ScalarT vDiff = 1000.0 * (Vn1 - Vn2 - Vrest);
196 if ((vDiff > 24.99) && (vDiff < 25.01) )
199 (( std::exp( (25.0 - vDiff)/10.0 )));
204 (10.0 * ( std::exp( (25.0 - vDiff)/10.0 ) - 1.0 ));
210 template <
typename ScalarT>
211 static ScalarT
betaM(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
213 ScalarT vDiff = 1000.0 * (Vn1 - Vn2 - Vrest);
214 ScalarT r = 4.0 * std::exp( -vDiff/18.0 );
220 template <
typename ScalarT>
221 static ScalarT
alphaH(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
223 ScalarT vDiff = 1000.0 * (Vn1 - Vn2 - Vrest);
224 ScalarT r = 0.07 * std::exp( -vDiff/20.0 );
229 template <
typename ScalarT>
230 static ScalarT
betaH(
const ScalarT & Vn1,
const ScalarT & Vn2,
const ScalarT & Vrest)
232 ScalarT vDiff = 1000.0 * (Vn1 - Vn2 - Vrest);
233 ScalarT r = 1.0 / ( std::exp( (30.0 - vDiff)/10.0 ) + 1.0 );
240 template <
typename ScalarT>
241 static ScalarT
kcl1EquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& n,
const ScalarT& m,
const ScalarT& h,
242 const ScalarT& memG,
const ScalarT& leakE,
const ScalarT& Kg,
const ScalarT& Ke,
const ScalarT& NaG,
const ScalarT& NaE )
244 ScalarT powN = n * n * n * n;
245 ScalarT powM = m * m * m;
246 ScalarT r = memG * (Vn1 - Vn2 - leakE) + Kg * powN * (Vn1 - Vn2 - Ke ) + NaG * powM * h * (Vn1 - Vn2 - NaE );
250 template <
typename ScalarT>
251 static ScalarT
kcl1EquQ(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& memC )
253 ScalarT r = memC * (Vn1 - Vn2);
258 template <
typename ScalarT>
259 static ScalarT
kcl2EquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& n,
const ScalarT& m,
const ScalarT& h,
260 const ScalarT& memG,
const ScalarT& leakE,
const ScalarT& Kg,
const ScalarT& Ke,
const ScalarT& NaG,
const ScalarT& NaE )
262 ScalarT powN = n * n * n * n;
263 ScalarT powM = m * m * m;
264 ScalarT r = -1.0*(memG * (Vn1 - Vn2 - leakE) + Kg * powN * (Vn1 - Vn2 - Ke ) + NaG * powM * h * (Vn1 - Vn2 - NaE ));
268 template <
typename ScalarT>
269 static ScalarT
kcl2EquQ(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& memC )
271 ScalarT r = -1.0 * memC * (Vn1 - Vn2);
276 template <
typename ScalarT>
277 static ScalarT
nEquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& n,
const ScalarT& Vrest )
279 ScalarT r = alphaN<ScalarT>( Vn1, Vn2, Vrest ) * (1.0 - n ) - betaN<ScalarT>( Vn1, Vn2, Vrest ) * n;
283 template <
typename ScalarT>
284 static ScalarT
nEquQ(
const ScalarT& n )
291 template <
typename ScalarT>
292 static ScalarT
mEquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& m,
const ScalarT& Vrest )
294 ScalarT r = alphaM<ScalarT>( Vn1, Vn2, Vrest ) * (1.0 - m ) - betaM<ScalarT>( Vn1, Vn2, Vrest ) * m;
298 template <
typename ScalarT>
299 static ScalarT
mEquQ(
const ScalarT& m )
306 template <
typename ScalarT>
307 static ScalarT
hEquF(
const ScalarT& Vn1,
const ScalarT& Vn2,
const ScalarT& h,
const ScalarT& Vrest )
309 ScalarT r = alphaH<ScalarT>( Vn1, Vn2, Vrest ) * (1.0 - h ) - betaH<ScalarT>( Vn1, Vn2, Vrest ) * h;
313 template <
typename ScalarT>
314 static ScalarT
hEquQ(
const ScalarT& h )
488 virtual bool updateState (
double * solVec,
double * staVec,
double * stoVec);