That's the whole point of range variables, isn't it? If section foo has a density mechanism
called mech that has a range variable fap, you can write a simple assignment statement
foo fap_mech(x) = whatever
where 0<=x<=1 and whatever is . . . whatever. The value of fap in the segment that
contains x will then be equal to whatever.
Actually you will probably be doing something more like
forsec subset for (x,0) { rangevar_suffix(x) = f(p(x)) }
where subset is a SectionList (essentially a set of sections),
p is some measure of the position of the current segment in space (e.g. distance from
the segment's midpoint to some point or plane),
and f is a function that tells how rangevar_suffix should vary with position in space.
Of course, if you then change nseg, you should again assert
forsec subset for (x,0) { rangevar_suffix(x) = f(p(x)) }
to ensure that the inhomogeneous range variable samples f at the proper locations in
space.
In recent versions of NEURON, the CellBuilder can take care of setting up nonuniform
biophysical properties very efficiently and flexibly--and it even automatically reasserts
forsec subset for (x,0) { rangevar_suffix(x) = f(p(x)) }
if you do anything in the CellBuilder that changes nseg. See the latest CellBuilder tutorial
http://www.neuron.yale.edu/neuron/stati ... /main.html