Issues with na_ion

Moderator: wwlytton

Post Reply
neilthawani

Issues with na_ion

Post by neilthawani »

Hi,

I'm trying to run an 8-cell network model and am getting the following error:

Code: Select all

na_ion mechanism not inserted in section PyramidCellA[0].apical[0]
nrniv: 
 in LAPcells.hoc near line 6
 LAPcell[0] = new PyramidCellA()
                                ^
PyramidCellA[0].init(        )
xopen("LAPcells.hoc"      )
execute1("{xopen("LAPcells.hoc")}"    )
load_file("LAPcells.hoc"  )
        0 
nrniv: Segmentation violation
 in LAPcells.hoc near line 7
 LAPcell[1] = new PyramidCellA()
I do not know why this is happening since in my template file, I have the following:

Code: Select all

begintemplate PyramidCellA
...
for i=0,NumApical-1 apical[i] {
			insert na3 sh_na3=nash ar_na3=1	gbar_na3=gna
	...
}
Lines 6 and 7 of LAPcells.hoc are:

Code: Select all

LAPcell[0] = new PyramidCellA()
LAPcell[1] = new PyramidCellA()
Any ideas? Thanks in advance.
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Issues with na_ion

Post by ted »

First, make sure that the directory that contains your hoc code also has a mod file or ChannelBuilder ses file that defines the properties of the na3 mechanism. If na3 is defined by a mod file, have you compiled it with mknrndll or nrnivmodl?
neilthawani

Re: Issues with na_ion

Post by neilthawani »

ted wrote:First, make sure that the directory that contains your hoc code also has a mod file or ChannelBuilder ses file that defines the properties of the na3 mechanism. If na3 is defined by a mod file, have you compiled it with mknrndll or nrnivmodl?
Hi Ted.

Yes, the na3.mod file is from Migliore 1997. The code is at the bottom of my post.

In addition, I have also run mknrndll on the directory and it created the .o files that correspond to each .mod.

I was told that it might be an unclosed bracket/parentheses error error in the template file with the Type A, B and C pyramidal cells, but everything is closed appropriately. Do you know if indentation matters?

Here is the na3.mod code:

Code: Select all

TITLE na3
: Na current 
: from Jeff M.
:  ---------- modified -------M.Migliore may97

NEURON {
	SUFFIX na3
	USEION na READ ena WRITE ina
	RANGE  gbar, ar2
	GLOBAL minf, hinf, mtau, htau, sinf, taus,qinf, thinf
}

PARAMETER {
	
	gbar = 0.010   	(mho/cm2)	
								
	tha  =  -30	(mV)		: v 1/2 for act	
	qa   = 7.2	(mV)		: act slope (4.5)		
	Ra   = 0.4	(/ms)		: open (v)		
	Rb   = 0.124 	(/ms)		: close (v)		

	thi1  = -45	(mV)		: v 1/2 for inact 	
	thi2  = -45 	(mV)		: v 1/2 for inact 	
	qd   = 1.5	(mV)	        : inact tau slope
	qg   = 1.5      (mV)
	mmin=0.02	
	hmin=0.5			
	q10=2
	Rg   = 0.01 	(/ms)		: inact recov (v) 	
	Rd   = .03 	(/ms)		: inact (v)	
	qq   = 10        (mV)
	tq   = -55      (mV)

	thinf  = -50 	(mV)		: inact inf slope	
	qinf  = 4 	(mV)		: inact inf slope 

        vhalfs=-60	(mV)		: slow inact.
        a0s=0.0003	(ms)		: a0s=b0s
        zetas=12	(1)
        gms=0.2		(1)
        smax=10		(ms)
        vvh=-58		(mV) 
        vvs=2		(mV)
        ar2=1		(1)		: 1=no inact., 0=max inact.
	ena		(mV)            : must be explicitly def. in hoc
	celsius
	v 		(mV)
}


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

ASSIGNED {
	ina 		(mA/cm2)
	thegna		(mho/cm2)
	minf 		hinf 		
	mtau (ms)	htau (ms) 	
	sinf (ms)	taus (ms)
	tha1	
}
 

STATE { m h s}

BREAKPOINT {
        SOLVE states METHOD cnexp
        thegna = gbar*m*m*m*h*s
	ina = thegna * (v - ena)
} 

INITIAL {
	trates(v,ar2)
	m=minf  
	h=hinf
	s=sinf
}


FUNCTION alpv(v(mV)) {
         alpv = 1/(1+exp((v-vvh)/vvs))
}
        
FUNCTION alps(v(mV)) {  
  alps = exp(1.e-3*zetas*(v-vhalfs)*9.648e4/(8.315*(273.16+celsius)))
}

FUNCTION bets(v(mV)) {
  bets = exp(1.e-3*zetas*gms*(v-vhalfs)*9.648e4/(8.315*(273.16+celsius)))
}

LOCAL mexp, hexp, sexp

DERIVATIVE states {   
        trates(v,ar2)      
        m' = (minf-m)/mtau
        h' = (hinf-h)/htau
        s' = (sinf - s)/taus
}

PROCEDURE trates(vm,a2) {  
        LOCAL  a, b, c, qt
        qt=q10^((celsius-24)/10)
		tha1 = tha 
	a = trap0(vm,tha1,Ra,qa)
	b = trap0(-vm,-tha1,Rb,qa)
	mtau = 1/(a+b)/qt
        if (mtau<mmin) {mtau=mmin}
	minf = a/(a+b)

	a = trap0(vm,thi1,Rd,qd)
	b = trap0(-vm,-thi2,Rg,qg)
	htau =  1/(a+b)/qt
        if (htau<hmin) {htau=hmin}
	hinf = 1/(1+exp((vm-thinf)/qinf))
	c=alpv(vm)
        sinf = c+a2*(1-c)
        taus = bets(vm)/(a0s*(1+alps(vm)))
        if (taus<smax) {taus=smax}
}

FUNCTION trap0(v,th,a,q) {
	if (fabs(v-th) > 1e-6) {
	        trap0 = a * (v - th) / (1 - exp(-(v - th)/q))
	} else {
	        trap0 = a * q
 	}
}	
ted
Site Admin
Posts: 6300
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

Re: Issues with na_ion

Post by ted »

I have also run mknrndll on the directory and it created the .o files that correspond to each .mod.
The .o files are merely intermediate results and can be deleted. The file that matters is the dll.
I was told that it might be an unclosed bracket/parentheses error error in the template file
That would cause a syntax error at the time the code is parsed. This is not what is happening to you.
Do you know if indentation matters?
Only for readability by humans.

When NEURON starts, it prints a few lines to a terminal window. The first three lines tell the version of NEURON and point to a "credits" page on the web. The next couple of lines report whether compiled mechanisms have been loaded, and will look like this:

Code: Select all

loading membrane mechanisms from . . . << name of some file >>
Additional mechanisms from files
  << list of mod files that were compiled >>
Exactly what do you see in the first few lines of output when you use NEURON to launch your program?
neilthawani

Re: Issues with na_ion

Post by neilthawani »

ted wrote:
I have also run mknrndll on the directory and it created the .o files that correspond to each .mod.
The .o files are merely intermediate results and can be deleted. The file that matters is the dll.
I was told that it might be an unclosed bracket/parentheses error error in the template file
That would cause a syntax error at the time the code is parsed. This is not what is happening to you.
Do you know if indentation matters?
Only for readability by humans.

When NEURON starts, it prints a few lines to a terminal window. The first three lines tell the version of NEURON and point to a "credits" page on the web. The next couple of lines report whether compiled mechanisms have been loaded, and will look like this:

Code: Select all

loading membrane mechanisms from . . . << name of some file >>
Additional mechanisms from files
  << list of mod files that were compiled >>
Exactly what do you see in the first few lines of output when you use NEURON to launch your program?
I did not know that about the .o files. That's good. The dll compiled successfully.

I reviewed the bracket completions in the template file, and found that it was not the case last night. Thanks for the confirmation.

Here is what you asked for:

Code: Select all

Additional mechanisms from files
 bg2inter.mod bg2pyr.mod bg2pyr2.mod cadyn.mod cal2.mod capool.mod currentclamp.mod h.mod ic.mod im.mod inter2inter.mod inter2pyr.mod kadist.mod kaprox.mod kdrca1.mod kdrinter.mod kdtx.mod leak.mod na3.mod na3DA.mod na3s.mod nainter.mod nax.mod pyr2inter.mod pyr2pyr.mod sahp.mod shock2inter.mod shock2pyr.mod tone2inter.mod tone2pyr.mod
        1 
        1 
        1 
na_ion mechanism not inserted in section PyramidCellA[0].apical[0]
nrniv: 
 in LAPcells.hoc near line 6
 LAPcell[0] = new PyramidCellA()
                                ^
PyramidCellA[0].init(        )
xopen("LAPcells.hoc"      )
execute1("{xopen("LAPcells.hoc")}"    )
load_file("LAPcells.hoc"  )
        0 
nrniv: Segmentation violation
 in LAPcells.hoc near line 7
 LAPcell[1] = new PyramidCellA()
                                ^
Something interesting I noticed, as well. In my template file, I have:

Code: Select all

for i=0,NumApical-1 apical[i] {
			insert leak el_leak=Vpas glbar_leak = ((1/Rm) * SpineScale)  Ra=RaAll  cm=Cm*SpineScale
			insert hd ghdbar_hd=ghd
			insert na3 sh_na3=nash ar_na3=1	gbar_na3=gna
...
}
and below that loop, I have:

Code: Select all

//	apical[0] {glbar_leak = (1/Rm)*1.3 cm=Cm *1.3}  // adjust primary apical for fewer spines
This code was commented out by someone else in my lab, and when I uncommented it, I got this error:

Code: Select all

Additional mechanisms from files
 bg2inter.mod bg2pyr.mod bg2pyr2.mod cadyn.mod cal2.mod capool.mod currentclamp.mod h.mod ic.mod im.mod inter2inter.mod inter2pyr.mod kadist.mod kaprox.mod kdrca1.mod kdrinter.mod kdtx.mod leak.mod na3.mod na3DA.mod na3s.mod nainter.mod nax.mod pyr2inter.mod pyr2pyr.mod sahp.mod shock2inter.mod shock2pyr.mod tone2inter.mod tone2pyr.mod
        1 
        1 
        1 
leak mechanism not inserted in section PyramidCellA[0].apical[0]
nrniv: 
 in LAPcells.hoc near line 6
 LAPcell[0] = new PyramidCellA()
                                ^
PyramidCellA[0].init(        )
xopen("LAPcells.hoc"      )
execute1("{xopen("LAPcells.hoc")}"    )
load_file("LAPcells.hoc"  )
        0 
nrniv: Segmentation violation
 in LAPcells.hoc near line 7
 LAPcell[1] = new PyramidCellA()
                                ^
It seems like the two errors are related, but I don't understand how. Right now I'm re-writing new templates based on the original single-cell model. It's strange because we made a small-compartment network model before this one and that seems to work just fine with just three compartments per cell. Any ideas?

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

Re: Issues with na_ion

Post by ted »

I'm re-writing new templates based on the original single-cell model. It's strange because we made a small-compartment network model before this one and that seems to work just fine with just three compartments per cell. Any ideas?
Yes. Your template(s) aren't properly written. Writing a template involves many details and errors are easy to make. One easy trap to fall into is to put statements in a template but outside of any procedure in that template, and expect that they will be executed every time a new instance is created. Only variable type declarations and scope specifications (e.g. create soma, public soma) should be outside of a procedure or function. Any statement that is not in proc init, or in a proc or func called by proc init, will not be executed when a new instance is created. You can try this for yourself--insert this
print "outside"
in your template but outside of any proc or func, and insert this
print "inside"
in proc init(). You'll see that NEURON prints
outside
when it first reads the template, but not thereafter, and that it prints
inside
whenever you create a new instance of the class.

The best way to avoid a lot of headaches with broken templates is to construct model cell specifications with the CellBuilder (or with the Network Builder suite's NetReadyCell tool), then export a class definition (template) from the CellBuilder (or from the Network Builder).
Post Reply