Cvode corrector convergence failed repeatedly

Anything that doesn't fit elsewhere.
Post Reply
jaambros
Posts: 29
Joined: Tue Oct 04, 2005 3:29 pm
Location: Ohio University

Cvode corrector convergence failed repeatedly

Post by jaambros » Thu Nov 02, 2006 9:37 pm

Hi,

I'm getting this error numerous times in my paralle search runs.
I was able to isolate it so that it can be reproduced with the following files.

Any help in finding out what causes this error would be appreciated.

Thanks,
Jose Ambros-Ingerson

Code: Select all

create soma
access soma
//----------------------------------------------------------------------
objref stim
proc do_cell(){
  cell_rad = 26
  soma { 
    L     = 2/3 * cell_rad
    diam  = 2 * 3 * cell_rad
    stim	= new IClamp(0.5)
  }
  forall { 
    insert pas
    insert h_in
  }
}

//================================================================================
do_cell()
finitialize( -59.1024 )  

tau0_n_h_in = 0.001
tau0_h_h_in = 1
g_pas = 1/(19.33688275 * 1000 )
cm = 1.669295262
Ra = 481.6798106
e_pas = -59.10239122
gbar_h_in = 133.5283527
e_h_in = -63.63217588
gates_n_h_in = 5.671912439
vhalf_n_h_in = -72.75908914
slope_n_h_in = 10.11954921
tauA_n_h_in = 3107.066218
tauF_n_h_in = -0.02730965693
tauG_n_h_in = 0.05981368157
tauDv_n_h_in = -29.26259799
gates_h_h_in = 4.124487321
vhalfD_h_h_in = 78.24216152
slope_h_h_in = -9.398674247
tauA_h_h_in = 16808.40883
tauF_h_h_in = 1.978964722
tauG_h_h_in = 0.7649019228
tauDv_h_h_in = 3.94314898

cvode.active(1) 
cvode.atol(1.e-3)

tstop = 500
stim.dur=250
stim.del=50

stim.amp = 0.2
printf( "Run amp=%g\n\n", stim.amp )
run()

stim.amp=-1.0
printf( "Run amp=%g\n\n", stim.amp )
run()
The mod file is

Code: Select all

TITLE h channel
: Jose Ambros-Ingerson jose@kiubo.net 2006

NEURON {
  SUFFIX 		h_in	: h channel with inactivation
  NONSPECIFIC_CURRENT 	i
  RANGE			gbar, g, i

  GLOBAL 		inf_n, tau_n, inf_h, tau_h
}

PARAMETER {
  e 		= -30	(mV)
  gbar		= 1 	(pS/um2)

  : inf_n parameters
  gates_n	= 1
  vhalf_n	= -80	(mV)	
  slope_n	= 10	(mV)

  : tau_n parameters
  tauA_n	= 100 	(ms)
  tauDv_n	= 0	(mV)	: Delta to vhalf_n
  tauG_n	= 0.5		: Left-right bias. range is (0,1)
  tauF_n	= 0		: Up-Down bias. range is ~ -3.5(cup-shape), -3(flat), 0(from k), 1(sharper)
  tau0_n	= 1	(ms)	: minimum tau

  : inf_h parameters
  gates_h	= 1
  vhalfD_h	= 40   (mV)	:  vhalf_h = vhalf_n + vhalfD_h; 
  slope_h	= -10	(mV)

  : tau_h parameters
  tauA_h	= 20 	(ms)
  tauDv_h	= 0	(mV)	: Delta to vhalf_h
  tauG_h	= 0.5		: Left-right bias. range is (0,1)
  tauF_h	= 0		: Up-Down bias. range is ~ -3.5(cup-shape), -3(flat), 0(from k), 1(sharper)
  tau0_h	= 0.01	(ms)	: minimum tau

}

STATE {
  n
  h
}

ASSIGNED {
  v		(mV)
  celsius	(degC)
  g		(pS/um2)
  i		(mA/cm2)
  inf_n
  tau_n		(ms)
  inf_h
  tau_h		(ms)
}

BREAKPOINT {
  SOLVE states METHOD cnexp
  g 	= gbar * n^gates_n * h^gates_h
  i	= g * ( v - e ) * (1e-4)
}

INITIAL {
  rates( v )
  n = inf_n
  h = inf_h
}

UNITS {
  (mA)	= (milliamp)
  (mV)	= (millivolt)
  (pS)	= (picosiemens)
  (um)	= (micrometer)
}

DERIVATIVE states {     : exact when v held constant; integrates over dt step
  rates( v )
  n' = ( inf_n - n )/ tau_n
  h' = ( inf_h - h )/ tau_h
}

PROCEDURE rates( v (mV)){

  inf_n = Boltzmann( v, vhalf_n, slope_n )
  tau_n = BorgMod_tau( v, vhalf_n, slope_n, tau0_n, tauA_n, tauG_n, tauF_n, tauDv_n )

  inf_h = Boltzmann( v, vhalf_n + vhalfD_h, slope_h )
  tau_h = BorgMod_tau( v, vhalf_n + vhalfD_h, slope_h, tau0_h, tauA_h, tauG_h, tauF_h, tauDv_h )
}

FUNCTION Boltzmann( v (mV), v5 (mV), s (mV) ){
  Boltzmann = 1 / (1 + exp_trap( (v - v5) / s ))
}

FUNCTION BorgMod_tau( v (mV), v5 (mV), s (mV), tau0 (ms), tauA (ms), tauG, tauF, tauDv (mV) ) (ms) {
  LOCAL kc, kr, Dv, wr, tau0m

  kr = 1000
  wr = 1000
  Dv = (v - ( v5 + tauDv )) * 1(1/mV)
  kc = kr * 10^tauF / s * 1(mV)

  tau0m = tauA * 1e-4	: kludge to try to avoid CVode crash

  BorgMod_tau = tau0m + tau0 + tauA * 2 * sqrt( tauG * (1-tauG))
		* ( exp_trap( - Dv *tauG/wr/kc ) + exp_trap( Dv *(1-tauG)/wr/kc ))
 	        / ( exp_trap( - Dv *(1-tauG)*kc/kr ) + exp_trap( Dv *kc*tauG/kr ))
}

FUNCTION exp_trap( v ){
  if( v > 700 ){ v = 700 }
  exp_trap = exp( v )
}
When I run the above code I get:

Code: Select all

$ nrngui ~/Projects/ParSims/Runs_pDE/pNVmes/K06/CVode-err.hoc
NEURON -- Version 5.8 2005-10-7 13:46:29 Main (85)
by John W. Moore, Michael Hines, and Ted Carnevale
Duke and Yale University -- Copyright 1984-2005

loading membrane mechanisms from /axon/d1/Users/jose/cNeuro/lib/nrn/NMOD/ca1n1-mod/powerpc/.libs/libnrnmech.so
Additional mechanisms from files
 KA_i0.mod KA_n1.mod KDR_b0.mod KDR_b1.mod KDR_i0.mod KDR_mig.mod Ktf_p1.mod Naf_b1.mod Naf_i0.mod Nap_i0.mod fK_DR_n1.mod fNa_n1.mod h2_i0.mod h_2t.mod h_i0.mod h_in.mod h_n1.mod morpho.mod pNa_n1.mod
        1 
        1 
        0.001 
Run amp=0.2

        13 
Run amp=-1

        12 
Changed dt
CVode-- At t = 89.7554 and h = 8.7714e-06, the corrector
convergence failed repeatedly or with |h| = hmin.

CVode 11255b8 soma advance_tn failed, err=-7.
err=-7
/axon/d1/Users/jose/Software/src/Neuron/nrn-5.8.85/nrn/powerpc/bin/nrniv: variable step integrator error
 in /axon/d1/Users/jose/Projects/ParSims/Runs_pDE/pNVmes/K06/CVode-err.hoc near line 58
 run()
      ^
        fadvance()
      advance()
    step()
  continuerun(500)
and others
oc>
Note that it runs fine with amp=0.2 (and amp=-0.2 not shown) but fails with amp=-1.0

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

Post by ted » Fri Nov 03, 2006 11:13 am

The following comments have nothing to do with the error message, but hopefully they will
shed some light on default initialization of membrane potential in NEURON's standard run
system.

run() calls stdinit(), which in turn calls init(). Here is init():

Code: Select all

proc init() {
  finitialize(v_init)
  fcurrent()
}
The default value of v_init is -65 (mV); the value of v_init is displayed in the numeric field
next to the Init button in the RunControl panel.

So
finitialize( -59.1024 )
(which appears near the top of your hoc code) will have no effect on what happens when
run() is called. To change the initial membrane potential, change the value of v_init before
calling run. A simple assignment statement will do the job, e.g.
v_init = -59.1024

For much more information about the standard run system and initialization, see chapters
7 and 8 of The NEURON Book.

hines
Site Admin
Posts: 1580
Joined: Wed May 18, 2005 3:32 pm

Post by hines » Fri Nov 03, 2006 1:13 pm

Code: Select all

g    = gbar * n^gates_n * h^gates_h 
The problem is that cvode set h to a slightly negative value during its investigations and that is an out of domain error for the pow function.

jaambros
Posts: 29
Joined: Tue Oct 04, 2005 3:29 pm
Location: Ohio University

Post by jaambros » Fri Nov 03, 2006 3:41 pm

Making sure that h (and n) are not negative solved the problem.

I wasn't aware that the 'h' in the message related to a variable in the mod file. My impression (wrongly) was that it referred to some cvode internal variable.

Thanks very much for your help

hines
Site Admin
Posts: 1580
Joined: Wed May 18, 2005 3:32 pm

Post by hines » Fri Nov 03, 2006 4:27 pm

I wasn't aware that the 'h' in the message related to a variable in the mod file. My impression (wrongly) was that it referred to some cvode internal variable.
Your first impression was correct. The h in the error message referred to the time step. It just happened to be the same name as the offending state variable.

Feanor
Posts: 17
Joined: Fri Nov 28, 2014 3:03 pm

Re:

Post by Feanor » Tue May 12, 2015 3:16 pm

hines wrote: The problem is that cvode set h to a slightly negative value during its investigations and that is an out of domain error for the pow function.
Hello to all,

which pow function does this refer to? Is it the exponentiation function exp used in the end of the mod file?

Best regards

hines
Site Admin
Posts: 1580
Joined: Wed May 18, 2005 3:32 pm

Re: Cvode corrector convergence failed repeatedly

Post by hines » Wed May 13, 2015 10:01 am

Code: Select all

g    = gbar * n^gates_n * h^gates_h
Nmodl tranlages a^b to pow(a, b)

Feanor
Posts: 17
Joined: Fri Nov 28, 2014 3:03 pm

Re: Cvode corrector convergence failed repeatedly

Post by Feanor » Tue May 26, 2015 9:10 am

Thank you.

Post Reply