Initialization/nseg problem
Posted: Fri Jul 14, 2006 11:41 pm
I have a custom init routine that uses the d-lambda rule to set nseg (taking care to always use odd values) and the example in the Neuron book using large dt to find the steady state (see below)
The problem is that repeated executions do not yield the same results.
Eg, in the call sequence init(0.1), init(0.5), init(0.1), the first init(0.1) diverges while the second converges.
It appears that nseg changes can be quite disruptive.
Any suggestions on where I went wrong?
Thanks in advance,
Jose Ambros-Ingerson
Output was
The problem is that repeated executions do not yield the same results.
Eg, in the call sequence init(0.1), init(0.5), init(0.1), the first init(0.1) diverges while the second converges.
It appears that nseg changes can be quite disruptive.
Any suggestions on where I went wrong?
Thanks in advance,
Jose Ambros-Ingerson
Code: Select all
proc init() {
mulfit_cell_init( $1 )
init_steady_state()
}
proc mulfit_cell_init() {
forall { // set for lambda_f call
Ra = G_Ra
cm = G_cm
}
nseg_tot = 0
forall {
nseg = int((L/($1 *lambda_f(100))+.9)/2)*2 + 1
nseg_tot += nseg
}
printf( "lambda-d %g nseg_tot %d\n", $1, nseg_tot )
forall {
e_pas = G_e_pas
g_pas = 1 / ( G_Rm * 1000 )
gbar_Naf_i0 = Gbar_Naf
gbar_Nap_i0 = Gbar_Nap
gbar_KDR_i0 = Gbar_KDR
gbar_h_i0 = Gbar_h_soma
gbar_KA_i0 = Gbar_KA_soma
}
}
proc init_steady_state(){ local dtsav, was_active
dtsav = dt // record dt and cvode state
was_active = cvode.active()
cvode.active( 0 )
finitialize( -82.34 )
fcurrent()
t = -3e9
dt = 1e8
while( t < 0 ) {
if( iss_idebug ) printf( "s1 %g %g\n", t, v )
fadvance()
}
cvode.active( was_active ) // restore cvode and dt state
dt = dtsav
t = 0
if( cvode.active() ) {
cvode.re_init()
} else {
fcurrent()
}
frecord_init()
}
... load cell and set parameter values (G_Ra, G_cm, etc)...
init( 0.1 )
init( 0.5 )
init( 0.1 )
Code: Select all
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
1
1
nrn_load_dll /axon/d2/cNeuro/lib/nrn/NMOD/ca1n1-mod/powerpc/.libs/libnrnmech.so
80
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 h_i0.mod h_n1.mod morpho.mod pNa_n1.mod
loading membrane mechanisms from /axon/d2/cNeuro/lib/nrn/NMOD/ca1n1-mod/powerpc/.libs/libnrnmech.so
1
1
1
1
0.001
nfeval 34681
13
nrniv: unable to open font "*Arial*bold*--12*", using "fixed"
1
lambda-d 0.1 nseg_tot 717
s1 -3e+09 -82.34
s1 -2.9e+09 -76.194
s1 -2.8e+09 -73.2505
s1 -2.7e+09 -70.2672
s1 -2.6e+09 -65.9441
s1 -2.5e+09 -56.5226
s1 -2.4e+09 -22.7331
s1 -2.3e+09 -71.4005
s1 -2.2e+09 -60.302
s1 -2.1e+09 -38.9746
s1 -2e+09 -35.0278
s1 -1.9e+09 -50.1262
s1 -1.8e+09 -17.6355
s1 -1.7e+09 -74.357
s1 -1.6e+09 -43.5605
s1 -1.5e+09 -17.8408
s1 -1.4e+09 -74.9825
s1 -1.3e+09 -40.4702
s1 -1.2e+09 -30.904
s1 -1.1e+09 -56.6353
s1 -1e+09 -33.6248
s1 -9e+08 -49.1995
s1 -8e+08 -19.2721
s1 -7e+08 -70.9034
s1 -6e+08 -42.8433
s1 -5e+08 -19.5439
s1 -4e+08 -73.8706
s1 -3e+08 -51.5855
s1 -2e+08 -9.08034
s1 -1e+08 -82.9557
lambda-d 0.5 nseg_tot 251
s1 -3e+09 -82.34
s1 -2.9e+09 -81.2169
s1 -2.8e+09 -81.0766
s1 -2.7e+09 -81.0331
s1 -2.6e+09 -81.0187
s1 -2.5e+09 -81.0134
s1 -2.4e+09 -81.0115
s1 -2.3e+09 -81.0107
s1 -2.2e+09 -81.0104
s1 -2.1e+09 -81.0103
s1 -2e+09 -81.0102
s1 -1.9e+09 -81.0102
s1 -1.8e+09 -81.0102
s1 -1.7e+09 -81.0102
s1 -1.6e+09 -81.0102
s1 -1.5e+09 -81.0102
s1 -1.4e+09 -81.0102
s1 -1.3e+09 -81.0102
s1 -1.2e+09 -81.0102
s1 -1.1e+09 -81.0102
s1 -1e+09 -81.0102
s1 -9e+08 -81.0102
s1 -8e+08 -81.0102
s1 -7e+08 -81.0102
s1 -6e+08 -81.0102
s1 -5e+08 -81.0102
s1 -4e+08 -81.0102
s1 -3e+08 -81.0102
s1 -2e+08 -81.0102
s1 -1e+08 -81.0102
lambda-d 0.1 nseg_tot 717
s1 -3e+09 -82.34
s1 -2.9e+09 -81.1348
s1 -2.8e+09 -80.9879
s1 -2.7e+09 -80.9433
s1 -2.6e+09 -80.9291
s1 -2.5e+09 -80.9242
s1 -2.4e+09 -80.9225
s1 -2.3e+09 -80.9218
s1 -2.2e+09 -80.9216
s1 -2.1e+09 -80.9215
s1 -2e+09 -80.9215
s1 -1.9e+09 -80.9215
s1 -1.8e+09 -80.9215
s1 -1.7e+09 -80.9215
s1 -1.6e+09 -80.9215
s1 -1.5e+09 -80.9215
s1 -1.4e+09 -80.9215
s1 -1.3e+09 -80.9215
s1 -1.2e+09 -80.9215
s1 -1.1e+09 -80.9215
s1 -1e+09 -80.9215
s1 -9e+08 -80.9215
s1 -8e+08 -80.9215
s1 -7e+08 -80.9215
s1 -6e+08 -80.9215
s1 -5e+08 -80.9215
s1 -4e+08 -80.9215
s1 -3e+08 -80.9215
s1 -2e+08 -80.9215
s1 -1e+08 -80.9215