FATAL COMPUTATION ERROR...

Anything that doesn't fit elsewhere.
Post Reply
OJAG
Posts: 34
Joined: Wed Nov 14, 2007 4:46 am
Location: Bogota

FATAL COMPUTATION ERROR...

Post by OJAG »

Dear Ted or Hines,


I would ask anyone of you if you can give me any advise or idea to solve the generator problem of this error message:

Code: Select all

exp(735.833) out of range, returning exp(700)
exp(735.833) out of range, returning exp(700)
exp(735.833) out of range, returning exp(700)
exp(735.833) out of range, returning exp(700)
No more errno warnings during this execution
CVode-- At t = 2343.46, too much accuracy requested.

CVode d1abb0 Pyramidal[37].soma advance_tn failed, err=-5.
err=-5
nrniv: variable step integrator error
 near line 165
 layerFS0.o(int(n_FS)-1).soma cvode.record(&v(0.5),TimeSeriesHandler[4].yvec,TimeSeriesHandler[4].tvec)
                                                                                                       ^
fadvance(        )
advance(      )
step(    )
continuerun(3800  )
and others
errno set 206631 times on last execution
I know that one of my MOD mechanisms is failing and I already put some flags in all of them to try to identify the problem but this method was not useful enough.


I am currently using two of the more stable versions of NEURON 5.8 and 5.9 and I got the same output message with both of them

In the second place, in some cases I just changed constant values of my simulation in such a way that I wrote 0.050001 instead of just 0.5 and the simulation runs longer and in some cases till tstop...

So, is there any special circumstance that generates this kind of output?, which? where? why?

Thanks a lot for your advice

OJAG
ted
Site Admin
Posts: 5810
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: FATAL COMPUTATION ERROR...

Post by ted »

Suggestions:
1. On general principles alone, use the latest standard distribution of NEURON. A great deal of effort is devoted to ensuring that new versions produce the same numerical results as previous versions. Rarely is there any reason to continue using old versions.
2. If the problem persists, make a single compartment model that contains your cell's biophysical mechanisms, and see if you can reproduce the error with that. Debugging is generally much easier with small models.
3. Examine your mod files for expressions of the form f(v)/g(v) where f and g become 0 at some value of v. Rewrite those so that, when |f(v)|<1e-6, the expression that is evaluated is f'(v)/g'(v) (i.e. use L'hospital's rule in the vicinity of the singularity). Examine hh.mod (in nrn/src/nrnoc) for an example.
OJAG
Posts: 34
Joined: Wed Nov 14, 2007 4:46 am
Location: Bogota

Re: FATAL COMPUTATION ERROR...

Post by OJAG »

Dear Ted,

1.Additional to the stability of versions 5.8 and 5.9 in my particular case, I am still working with them because Raj wrote scripts for both, direct compilation of mod files and running of NEURON hoc from the editor PSPad. The former by mean of a little bash script that runs under cygwin and the later by adequately associate NEURON to hoc, ses and tmp as external application as well as sh to bash.exe in cygwin.

2. After implementing L'Hopital's rule in the two files where I though my problem arises from, I ran the simulation and after some trials I checked that in the begining it show the same message after t=4200 ms

Code: Select all

oc>exp(749.522) out of range, returning exp(700)
exp(749.522) out of range, returning exp(700)
exp(749.522) out of range, returning exp(700)
exp(749.522) out of range, returning exp(700)
No more errno warnings during this execution
and it continued running till tstop.

Nevertheless
After changing some conditions the simulation gave me the same error message in the console

Code: Select all

oc>exp(749.522) out of range, returning exp(700)
exp(749.522) out of range, returning exp(700)
exp(749.522) out of range, returning exp(700)
exp(749.522) out of range, returning exp(700)
No more errno warnings during this execution
and around 4000ms later i.e. around t=8200, the simulation crashed and showed the next lines in console

Code: Select all

CVode-- At t = 8258.43, too much accuracy requested.

CVode 24d17a8 Pyramidal[69].soma advance_tn failed, err=-5.
err=-5
nrniv: variable step integrator error
 near line 160
 layerFS0.o(int(n_FS)-1).soma cvode.record(&v(0.5),TimeSeriesHandler[4].yvec,TimeSeriesHandler[4].tvec)
                                                                                                   ^
fadvance(        )
advance(      )
step(    )
continuerun(40000  )
and others
errno set 5640986 times on last execution
So, I would like to know if it could be better to post here the code of the possible failing files or to send you via email my simulation for your consideration.

Many thanks in advance again
ted
Site Admin
Posts: 5810
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: FATAL COMPUTATION ERROR...

Post by ted »

It's probably best to just zip or tar up the files (no rar or other proprietary MSWin file archive formats, please) and email them to me
ted dot carnevale at yale dot edu
Just the mod, hoc, and ses files. No .o, .c, or .dlls please.

--Ted
ChrisR
Posts: 21
Joined: Mon Mar 17, 2008 9:08 am
Location: Munich

Re: FATAL COMPUTATION ERROR...

Post by ChrisR »

Hello Ted!

I am getting a quite similar error:

Code: Select all

exp(822.449) out of range, returning exp(700)
exp(822.449) out of range, returning exp(700)
exp(822.449) out of range, returning exp(700)
exp(822.449) out of range, returning exp(700)
No more errno warnings during this execution
Convergence not achieved in maximum number of iterations
/usr/local/nrn/x86_64/bin/nrniv: scopmath library error
 near line 11
 {run()}
        ^
        fadvance()
      advance()
    step()
  continuerun(500)
and others
errno set 640 times on last execution
I have created a number of simple cells, and gave these cells different g_bar for all channels using a random process around a mean value (e.g. gNa) to simulate a neuron population.

Code: Select all

create soma[nn]

objref r
r = new Random()

forsec "soma" {

nseg=1 diam=100 L=100 

insert hh
gnabar_hh = r.normal(gNa, gNa*0.00002)  
  
... other channels ...

insert kca
gbar_kca = r.normal(gKCa, gKCa*fvar)
}
The error occurs after 1-2 spikes whenever I try to stimulate the cells.
It does not occur when the channel conductances are the same for all cells and not randomly selected.
And it only occurs when there are more than 15 cells (nn=15).
Removing the Calcium activated K channel "kca" (gKCa=0), you can see the function below, also prevents the error.
But there is no ciritical fraction in the kca function, so I am wondering why this error occurs using this rather simple channel mechanism.
Maybe the way I try to create different neurons with Random() is not a good choice?

Code: Select all

COMMENT

	Calcium activated K channel from Av-Ron and Vidal, 1999
	Implemented by C. Weaver, 2003

        MODIFIED

ENDCOMMENT

UNITS {
	(molar) = (1/liter)
}

UNITS {
	(mV) =	(millivolt)
	(mA) =	(milliamp)
	(mM) =	(millimolar)
}


NEURON {
	SUFFIX kca
	USEION ca READ cai
	USEION k READ ek WRITE ik
	RANGE gbar,gkca
	RANGE tot
}

PARAMETER {
	celsius		(degC)
	v           (mV)
	gbar=.001	(mho/cm2)	: Maximum Permeability
	Kd=0.5		(mM)
}

ASSIGNED {
	ik		(mA/cm2)
	tot     (mA/cm2)
    gkca    (mho/cm2)
	ek		(mV)
	cai		(mM)
}

INITIAL {
	gkca = gbar*cai/(Kd+cai)
}

BREAKPOINT {
	gkca = gbar*cai/(Kd+cai)
	tot = gkca*(v - ek)
	ik = gkca*(v - ek)
}
Thanks!
Chris
ted
Site Admin
Posts: 5810
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: FATAL COMPUTATION ERROR...

Post by ted »

The cause might indeed be related to the way model params are assigned, but other causes are possible (you're sure none of your mod files contain denominators that become 0 for some value of v?). Have you examined parameter values for models that produce the error msg? Your code doesn't guard against nonsense (0 or negative or extremely large positive) conductance densities--remember that some distributions, e.g. normal, have "infinitely wide" tails in one or both directions.
ChrisR
Posts: 21
Joined: Mon Mar 17, 2008 9:08 am
Location: Munich

Re: FATAL COMPUTATION ERROR...

Post by ChrisR »

Ted,
you were right, some values became negative.

I tried to write a parameter generator function that draws again if the values are bad, but I always get the following error:

Code: Select all

/usr/local/nrn/x86_64/bin/nrniv: syntax error
 in cell_net.hoc near line 8
     r = new Random()
           ^
        xopen("cell_net.hoc")
      execute1("{xopen("cell_net.hoc")}")
    load_file("cell_net.hoc")
	0 
/usr/local/nrn/x86_64/bin/nrniv: syntax error
 in cell_net.hoc near line 9
     v=r.normal($1, ($2)^2)
        ^
Here is the function, with $1 being the mean value and $2 the std:

Code: Select all

func nnormal() { 
    objref r
    r = new Random()
    v=r.normal($1, ($2)^2)

    if(v <= 0) {
    v = nnormal($1,$2)
    } else if(v < $1-(3*$2)) {
    v = nnormal($1,$2)
    } else if(v > $1+(3*$2)) {
    v = nnormal($1,$2)
    }
    return v
} 
Can you tell me whats wrong here?
Thanks a lot!
Chris
ChrisR
Posts: 21
Joined: Mon Mar 17, 2008 9:08 am
Location: Munich

Re: FATAL COMPUTATION ERROR...

Post by ChrisR »

Ok, I fixed it!

However creating Random() inside the function, using declaration localobj r, gave same random values for each cell. Is the seed the same for each creation of Random()?

Code: Select all

objref r
r = new Random()

func nnormal() { local v
    
    v=r.normal($1, ($2)^2)

    if( ($1 < 0 && v > 0) || ($1 > 0 && v < 0) || ($1 != 0 && v == 0) ) {   // make sure no parameter overshoots 0
    v = nnormal($1,$2)

    } else if(v < $1-(2*$2)) {
    v = nnormal($1,$2)

    } else if(v > $1+(2*$2)) {
    v = nnormal($1,$2)

    }
    return v
} 
ted
Site Admin
Posts: 5810
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: FATAL COMPUTATION ERROR...

Post by ted »

Is the seed the same for each creation of Random()?
To quote from the Programmer's Reference documentation of the Random class http://www.neuron.yale.edu/neuron/stati ... andom.html
Note that multiple instances of the Random class will produce different streams of random numbers only if their seeds are different.
Post Reply