Assertion failed: file init.c, line 823

NMODL and the Channel Builder.
Post Reply
Keivan
Posts: 127
Joined: Sat Apr 22, 2006 4:28 am

Assertion failed: file init.c, line 823

Post by Keivan »

I have these two new mechanisms (mod files). They compile fine, but when I try to use them, I see this assertion failed bug. Would you please help me understand what is going wrong.

Code: Select all

TITLE cana Current
NEURON {
	SUFFIX iCaNa
	USEION na READ nai, nao 
	USEION ca READ cai WRITE ica
	RANGE  ibarna, ica ,cai , nai ,nao
	GLOBAL dss, fss, tf , td ,fcabj
}
UNITS {
	(mA) = (milliamp)
	(mV) = (millivolt)
    (mM) = (milli/liter)   
	(S)  = (siemens)
}
PARAMETER {
    FoRT =  3597.59 	(1/mV)
    Frdy = 96485        (coulomb)
    pna	 =     7.5e-09	(cm/sec)
}
STATE {
	fcabs
	fcabj
	f
	d
}
ASSIGNED {
	v 		(mV)
	celsius (degC) : 37
	ica		(mA/cm2)
	ibarna	(mA/cm2)
	fss
	dss
	tf 	   (ms)
    td 	   (ms)
    nai    (mM)	
	nao    (mM)
	cai    (mM)
	fcaca  
}
INITIAL {
	rates(v)
	fcabj= 1e-3  : fcabj
	d=dss
	f=fss
}
BREAKPOINT {
	SOLVE states METHOD euler :derivimplicit : cnexp
    fcaca= 0.1/(1+(0.01 (mM)/cai))
	UNITSOFF
	ibarna=  pna*(v*Frdy*FoRT)*(0.75*nai* exp(v*FoRT)-0.75*nao)/(exp(v*FoRT)-1)
	UNITSON
	ica =(ibarna*d*f*((1-fcabj)+fcaca))*0.45*1
}
DERIVATIVE states {
	rates(v)
	d' = (dss-d)/td
	f' = (fss-f)/tf
	UNITSOFF
	fcabj' = 1.7 * cai * (1-fcabj) - (11.9e-3) * fcabj
	UNITSON
}
PROCEDURE rates(v (mV)) {
     UNITSOFF
     dss=1.0/(1.0+exp((-(v+5.0))/6.0))
     td=dss*(1-exp(-(v+5)/6.0))/(0.035*(v+5))
     fss= 1/(1+exp((v+35)/9))+0.6/(1+exp((50-v)/20))
     tf=1/(0.0197*exp( -(0.0337*(v+14.5))^2 )+0.02)
     UNITSON
}

Code: Select all

TITLE concentration

NEURON {
 SUFFIX conc
 USEION k  WRITE ki , ko , ek
 USEION ca WRITE cao, cai, eca
 USEION na WRITE nao, nai, ena
 USEION cl WRITE cli, clo, ecl VALENCE -1
}
UNITS {
    (mA) = (milliamp)
    (mV) = (millivolt)
    (mM) = (milli/liter)
    (S)  = (siemens)
}
ASSIGNED {
    cao     (mM)
    cai     (mM)
    eca     (mV)
    ki      (mM)
    ko      (mM)
    ek      (mV)
    nao     (mM)
    nai     (mM)
    ena     (mV)
    ecl     (mV)
    clo     (mM)
    cli     (mM)
}
INITIAL {
   cao =   1.8      
   cai =   8.5974e-05  
   eca = 129.5228
   ki  = 120    
   ko  =   5.4     
   nao = 140     
   nai =   9.06    
   clo =  15     
   cli = 150
   ena =  72.8589
   ek  = -82.8374
   ecl = -61.5074
}
BREAKPOINT {
   cao =   1.8      
   cai =   8.5974e-05  
   eca = 129.5228
   ki  = 120    
   ko  =   5.4     
   nao = 140     
   nai =   9.06    
   clo =  15     
   cli = 150
   ena =  72.8589
   ek  = -82.8374
   ecl = -61.5074
}
loading membrane mechanisms from x86_64/.libs/libnrnmech.so
Additional mechanisms from files
iCaNa.mod ionHomeostastis.mod
Assertion failed: file init.c, line 823
Thanks
ted
Site Admin
Posts: 6289
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Assertion failed: file init.c, line 823

Post by ted »

cana's fcabj is declared to be a STATE and a GLOBAL. This is not allowed. A GLOBAL must be either an ASSIGNED or a PARAMETER. Your clue would have been this warning issued by nrnivmodl (or mknrndll) near the top of its messages about cana. Since fcabj is defined by an ODE in the DERIVATIVE block, it has to be a STATE, so remove it from the
GLOBAL . . . fcabj
statement in the NEURON block.

Other comments about cana:

fcabs is unused, so you might as well get rid of it.

The SOLVE statement should specify derivimplicit, because the derivative of fcabj depends on cai, which will be a STATE variable if some other mechanism that WRITEs cai is present, or if the appropriate ion_style is specified.

NEVER use Euler. See Integration methods for SOLVE statements
viewtopic.php?f=28&t=592
Post Reply