I am running a multi compartment model with a stochastic input current and eventually getting the following segmentation violation:
I tried the code with Neuron 6 and Neuron 7.1 on two different linux computers (Suse and Debian). Didn't help.exp(1689.77) out of range, returning exp(700)
A math function was called that returned an out of range value
0 errno=34 at t=24457.6 during call to mechanism hh_Cs_scaled
/usr/nld/nrn-6.0/x86_64/bin/nrniv: errno set during calculation of states
in mylibs/runme_new.hoc near line 79
}
^
/usr/nld/nrn-6.0/x86_64/bin/nrniv: Segmentation violation
in mylibs/runme_new.hoc near line 79
^
fadvance()
advance()
step()
continuerun(41100)
and others
The error is also not really reproducible in the sense that neuron crashes at different running times. Could this be due to the stochasticity of the input current?
According to the neuron output, the math function exp() was called with an argument that is to large. However, this should be only the case if the voltage gets unreasonably large. I tried to monitor this by setting a voltage threshold dependent output, telling when the voltage exceeds +70mV (using NetCon). This value would be far below the problematic value, however, even this threshold is not exceeded. This leads me to two conclusions:
1. I didn't check all compartments with this methods but only at soma(0.5) where the stochastic current is injected. Might it be that a voltage overshoot happens in another compartment? But I wouldn't know why this should be the case.
2. Some memory overwriting happens that leads to exp(1689.77).
The following is the part of the mechanism where exp() reaches the unreasonable high value. exp() is called one time in the procedure explicitly and many times via the function vtrap implicitly.
Does anybody have an idea about what I could further test and probably isolate the error? I would be very, very thankful!PROCEDURE rates(v(mV)) { :Computes rate and other constants at current v.
:Call once from HOC to initialize inf at resting v.
LOCAL alpha, beta, sum
TABLE minf, mtau, hinf, htau, ninf, ntau DEPEND celsius FROM -100 TO 100 WITH 200
UNITSOFF
q10 = 3^((celsius - 23)/10)
:"m" sodium activation system
alpha = -.182 * vtrap(-(v+40),6)
beta = -.124 * vtrap((v+40),6)
sum = alpha + beta
mtau = 0.2/(q10*sum)
minf = alpha/sum
:"h" sodium inactivation system
alpha = -0.015 * vtrap((v+66),6)
beta = -0.015 * vtrap(-(v+66),6)
sum = alpha + beta
htau = 1/(q10*sum)
hinf = alpha/sum
:"n" potassium activation system
alpha = .01*vtrap(-(v+55),10)
beta = .125*exp(-(v+65)/80)
sum = alpha + beta
ntau = 1/(q10*sum)
ninf = alpha/sum
}
FUNCTION vtrap(x,y) { :Traps for 0 in denominator of rate eqns.
if (fabs(x/y) < 1e-6) {
vtrap = -y*(1 - x/y/2)
}else{
vtrap = x/(1 - exp(x/y))
}
}
UNITSON
David