Computing impedance after running define_shape

Managing anatomically complex model cells with the CellBuilder. Importing morphometric data with NEURON's Import3D tool or Robert Cannon's CVAPP. Where to find detailed morphometric data.
Post Reply
neuromau
Posts: 94
Joined: Mon Apr 20, 2009 7:02 pm

Computing impedance after running define_shape

Post by neuromau » Fri Sep 19, 2014 4:57 pm

I want to run the compute function of the impedance mechanism after running define_shape(). However, it leads to the following error:
Fatal Complex arithmetic error. Attempted division by zero.
If I use the compute function prior to running define_shape(), it works just fine. I'm not sure why it doesn't work after?

Here is my code:

Code: Select all

{load_file("nrngui.hoc")}

create soma[1], dend1[1], dend2[1], axon[1]

connect dend1(0), soma(1)
connect dend2(0), soma(0)
connect axon(0), soma(1)

soma {  L = 20  diam = 10  }
dend1 {  L = 250  diam = 3  }
dend2 {  L = 250  diam = 3  }
axon {  L = 150  diam = 1.5  }

objref all
all = new SectionList()	
soma all.append()
dend1 all.append()
dend2 all.append()
axon all.append()

forsec all { nseg = int((L/(0.1*lambda_f(100))+.9)/2)*2 + 1  }

define_shape() 	// Running define_shape causes the following error when computing
				//  the impedance of the soma:
				//  Fatal Complex arithmetic error. Attempted division by zero.

print "diameter info: "
forsec all {
	print "*** ", secname(), ": L: ", L, ", diam: ", diam
	z = n3d()
	for y=0,z-1 {
		print "x: ", x3d(y), ", y: ", y3d(y), ", z: ", z3d(y), ", diam: ", diam3d(y)
	}
}

objref zz
zz = new Impedance()
soma[0] zz.loc(0.5)
zz.compute(0)

quit()

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

Re: Computing impedance after running define_shape

Post by ted » Fri Sep 19, 2014 11:59 pm

I don't get an error message with v. 7.3 ansi (1119:b3f8ab0f8203) 2014-07-18 under Linux. What version and OS are you using?

Two comments:
1. For the model example you provide, input impedance at 0 Hz should be infinite (there is no membrane conductance anywhere); NEURON calculates somatic input z in the range of 1e14 meghoms (close enough to infinite "for government use"). With your particular version of NEURON, does the error message go away if you insert pas into at least one section?
2. For any model that involves voltage- and/or ligand-gated conductances, it is essential to initialize the model before computing impedance. Otherwise there is no guarantee that those conductances have values that are consistent with local membrane potential or ligand concentration.

neuromau
Posts: 94
Joined: Mon Apr 20, 2009 7:02 pm

Re: Computing impedance after running define_shape

Post by neuromau » Sun Sep 21, 2014 7:22 pm

I'm on Windows 8 using:
NEURON -- VERSION 7.3 ansi (1078:2b0c984183df) 2014-04-04
For this code example:
1. Yes, the error goes away when I insert pas into a section.
2. Good call, in my regular code I remembered to initialize, but I had inadvertently removed it from this code.

My full code (with all desired subcellular mechanisms inserted and stdinit called) still has the error, so I am not sure what else I am doing wrong. I will try to make a different minimal (non)working example and email that to you.

Post Reply