## Calculate current flowing from one compartment to another

Anything that doesn't fit elsewhere.
pranit
Posts: 7
Joined: Mon Nov 22, 2010 4:23 pm

### Calculate current flowing from one compartment to another

Hi,
I am working on a multi-compartment model and need to find out the magnitude of current flowing from one compartment to another. I am having nseg = 1 for now for all compartments. I am using the formula ((Vsoma(0.5)-Vdend[0](0.5))/((2Rasoma*Lsoma/(pi * Dsoma^2))+(2Radend*Ldend/(pi * Ddend^2))) to plot the current. Is there an easier way to calculate this in neuron. I need to do that for all the compartments and so wanted to know if neuron has some default function/parameter which does this..

Thanks
--Pranit
ted
Posts: 5797
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### Re: Calculate current flowing from one compartment to anothe

NEURON calculates the time course of membrane potential at points in space that are called nodes. Each section has a node at its 0 and 1 ends, and at nseg evenly spaced internal locations that range from 0.5/nseg to (nseg-1+0.5)/nseg, where nseg is the section's discretization parameter.

NEURON has a function called ri() that is useful for what you want. ri(x) returns the resistance between the node at x and its parent. This procedure iterates over all nodes in the currently accessed section to report the axial current between each adjacent pair of nodes in the section.

Code: Select all

``````// for each node in current section that has x>0
//   report axial current that enters this node from its parent
proc seciax() { local vp, vthis
print secname()
for (x) {
if (x==0) {
vp = v(x)
} else {
vthis = v(x)
print x, (vp-vthis)/ri(x)
vp = vthis // prepare to deal with next node
}
}
}``````
All you have to do is iterate over all sections in your model cell and execute seciax() each time. This one-liner will do it:

Code: Select all

``forall seciax()``
pranit
Posts: 7
Joined: Mon Nov 22, 2010 4:23 pm

### Re: Calculate current flowing from one compartment to anothe

Thanks Ted. This was exactly what i was looking for.