Page 1 of 1

Spine Template

Posted: Wed May 11, 2011 12:30 pm
by stil
Hello,

I am trying to build a "Spine" model that i could instantiate multiple times...
Thus i thought using a template (shouldn't I ?) that currently has the form :

Code: Select all

begintemplate Spine

public spine, neck

create spine, neck

objref all
all = new SectionList()
neck all.append()
spine all.append()

external lambda_f

proc init() {
	// topology
	connect spine(1), neck(0)
	// geometry
	neck{
		L = 0.7 //um
		diam = 0.1 //um
	}
	spine{
		L = 0.2 //um
		diam = 0.2 //um
	}
	//nseg
	forsec all { nseg = int((L/(0.1*lambda_f(100))+.9)/2)*2 + 1  }
}

endtemplate Spine
But, when i am trying to instantiate it,

Code: Select all

load_file("Spine.hoc")
objref syn[1] // same with objectvar
syn[0] = new Spine()
i cannot get rid of this message :

Code: Select all

x86_64/bin/nrniv: nil object is not a SectionList
What haven't I understood here ? Would you mind guiding me please ?

Re: My first template : nil object is not a SectionList

Posted: Wed May 11, 2011 1:09 pm
by stil
ok, i've found out :

the all sectionList is not visible from the inside of init() procedure.
Hence i replaced the templte definition by the following :

Code: Select all

begintemplate Spine
	external lambda_f
	public spine, neck
	public init
	create spine, neck

	proc init() {
		// topology
		connect spine(1), neck(0)
		// geometry
		neck{
			L = 0.7 //um
			diam = 0.1 //um
			nseg = int((L/(0.1*lambda_f(100))+.9)/2)*2 + 1
			}
		spine{
			L = 0.2 //um
			diam = 0.2 //um
			nseg = int((L/(0.1*lambda_f(100))+.9)/2)*2 + 1
			}
		}

endtemplate Spine

Re: My first template : nil object is not a SectionList

Posted: Wed May 11, 2011 6:02 pm
by ted
Interesting, but not quite something that anyone would like to steal (not yet anyway), so I moved it from "NEURON hacks" to the "Anatomically detailed models" area where it will probably get more attention.
Also probably needs a new title, now that you've fixed the "nil object is not a SectionList" problem. How about "spine template"?

Re: Spine Template

Posted: Wed Jun 22, 2011 10:08 am
by stil
Sure,

is it ok like this ?