## specifying nseg and channel density

The basics of how to develop, test, and use models.
chen_xiang

### specifying nseg and channel density

Hello,

I'm a very new user of NEURON. I guess my question is very simple for you. However, I confused a little by looking at NEURON book and some available online codes

do we have to define number of segments before inserting any type of channel density or after that?
ted
Posts: 5819
Joined: Wed May 18, 2005 4:50 pm
Location: Yale University School of Medicine
Contact:

### Re: specifying nseg and channel density

As a rule, it's good to get in the habit of specifying nseg first, and specifying channel density second.

If you want channel density to be uniform, it doesn't matter which you do first.
Example: try this

Code: Select all

``````create dend
access dend
insert pas
nseg = 3
g_pas = 1
for (x,0) print x, g_pas``````
then try again but this time set g_pas before setting nseg

Code: Select all

`````` . . .
g_pas = 1
nseg = 3
for (x,0) print x, g_pas
``````
and you'll see that the final result is the same.

If you want nonuniform channel density, every time you specify a new value of nseg you should follow that by applying the rule that governs channel density.
Example: try this

Code: Select all

``````create dend
access dend
insert pas
nseg = 3
// suppose you want g_pas to be a linear function of position in dend
for (x,0) g_pas(x) = 0.1*x
for (x,0) print x, g_pas(x) // three segments, so three different values of g_pas
print " "
// suppose you want g_pas to vary more smoothly along the length of dend
nseg *= 3 // make nseg 3 times larger
for (x,0) print x, g_pas(x) // 9 segments but only 3 different values of g_pas!
// no improvement of smoothness!
print " "
// you need to specify g_pas as a function of x again
for (x,0) g_pas(x) = 0.1*x
for (x,0) print x, g_pas(x) // much smoother``````
chen_xiang

### Re: specifying nseg and channel density

Hi Ted,

Thanks a lot for your prompt response. I really appreciate it.
ted