## The increment in variable less than machine roundoff error

NMODL and the Channel Builder.
MarcoRacer
Posts: 1
Joined: Mon Dec 07, 2009 8:11 am

### The increment in variable less than machine roundoff error

Somebody can help me?
I´m trying to adding some specifics modeling channels in neuron,
but when i run my .hoc, neuron return this erro:

Code: Select all

``````loading membrane mechanisms from nrnmech.dll
k_mfv_s.mod na_mfv_s.mod soma_k_s.mod soma_na_s.mod
1
oc>at line 31 in file k_mfv_s.mod:
SOLVE states
Error at section location soma(0.5)
The increment in the independent variable is less than machine roundoff error
nrniv: scopmath library error
near line 37
{run()}
^
step(    )
continuerun(300  )
and others
``````

Code: Select all

``````TITLE MVF potassium current to soma MN

NEURON {
SUFFIX soma_k_s
USEION k READ ek WRITE ik
RANGE kgmax, gk, ik
}

UNITS {
(S)  = (siemens)
(mV) = (millivolt)
(mA) = (milliamp)
}

PARAMETER {
kgmax  = 35 (milisiemens/cm2)
}

ASSIGNED {
v (mV)
ek (mV)
ik (mA/cm2)
}

STATE { n }

BREAKPOINT {
SOLVE states
ik  = kgmax*n*n*n*n*(v-ek)
}

INITIAL {
: Assume v has been constant for a long time
n = alpha_n(v)/( alpha_n(v) + beta_n(v) )
}

DERIVATIVE states {
: Computes state variable n at present v & t
n' = ((alpha_n(v)*(1-n)) - (beta_n(v)*n))
}

FUNCTION alpha_n(Vm (mV)) (/ms) {
UNITSOFF
alpha_n = (0.1+(-0.1*Vm))/(exp((Vm-10)/-10) -1)
UNITSON
}

FUNCTION beta_n(Vm (mV)) (/ms) {
UNITSOFF
beta_n = 0.2/( exp((Vm - 35)/70) - 0.04 )
UNITSON
}
``````
ted
Posts: 5810
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### Re: The increment in variable less than machine roundoff error

This mechanism has several problems, some of which are easy to fix, but two of which are fatal.

Two of the fixable problems are detected by modlunit (you should always test mod files with modlunit before using them).

1. The parameter declaration
kgmax = 35 (milisiemens/cm2)
is invalid because "milisiemens" is not a recognized unit. The statement should be
kgmax = 35 (millisiemens/cm2)
or
kgmax = 35 (mS/cm2)
since the UNITS block defines (S).

2. The statement
ik = kgmax*n*n*n*n*(v-ek)
contains a big units inconsistency. ik is in mA/cm2 and (v-ek) is in mV, but kgmax is in mS/cm2.
Consequently the right hand side units are microA/cm2, and the assignment makes ik 1000 times too big.
The fix (which modlunit suggests, and which works) is to insert a scale factor, which changes the statement to
ik = (0.001)*kgmax*n*n*n*n*(v-ek)

Finally we get to the problems that are most likely to cause the error message you received.

The following serious problem is not detected by modlunit, but should generate an error message that would be reported by nrnivmodl (or mknrndll if you're using MSWin or OS X)--
The SOLVE statement
SOLVE states
refers to the DERIVATIVE block "states" but does not specify the method for solving the differential equation in "states". I suspect that this may be what is causing the error message you got.

The two fatal problems are that alpha_n and beta_n both blow up for membrane potentials that lie within the normal operating range of a neuron. Both are specified by formulas that have a denominator that becomes zero--alpha_n blows up as v approaches 10 mV, and beta_n blows up as v approaches 0.5+ln(0.04) ~ -2.72 mV. These problems may not be responsible for the error message you saw, but they will totally wreck your simulations. The only way to fix them is to change the constants in these formulas.