Page 1 of 1

Node.d (Diffusion) for Node3D objects

Posted: Sat Oct 26, 2019 8:20 am
by RBJ
Hi there,
is this my understanding or an issue..
If I create my mode in 1D, my species.nodes have a diffusion value node.d that I can either read or write to...
...but if I do the same with 3D models, I find that node.d is unread or writable? Well it seems to be a string not a float value anyway.
I get to it with

Code: Select all

for node in tfact.nodes:
Python version 3.7
Neuron Version 7.7.2
Any suggestions?
p.., probably that is a silly approach anywhere, but to stop species diffusing through certain regions I thought an easy way was to switch diffusion to 0 when it entered said region. This seemed to work fine in my previous versions of NEURON (7.7.1?).
I suppose I am simply looking to define a region within the cell where diffusible factors cannot enter?

[A couple of other observations with the fine new version:
(i) It used to speed up (not 3D) with Crxd; now with 3D it is much faster with rxd. i.e., 3D seemed to run with cxrd but that was slower.
(ii) setting nthreads to 12 for example, massively slows down execution on my new-ish iMac? - is that expected?
(iii) if I change a reaction rate during a run, it used to be fine; now I need to re-run finalize(). Again is that right? It obviously takes quite a bit of time. Works well though!]

Re: Node.d (Diffusion) for Node3D objects

Posted: Tue Oct 29, 2019 9:41 am
by ramcdougal
It looks like when going from 7.6.x to 7.7.x we lost the ability to have non-uniform diffusion constants in 3D. Sorry about that; we're working on a fix.

I'm not sure I fully understand your other observations; could you explain more?

With 7.7.x, crxd and rxd are now the same thing... that is, rxd gained all the speed enhancements that crxd had (and kept its 3D support, except for the above issue, apparently).

The threaded rxd should only affect extracellular and 3D intracellular, and it's supposed to make it run faster not slower :)... can you share an example where you're seeing it run slower?

As far as changing reaction rates: the easiest way to do this is to use an rxd.Parameter and then you should be able to change it at any time (if you're using variable step you might have to do an h.CVode().re_init(), not sure). For an example of using rxd.Parameter, see ... parameters.

(The syntax on that page is for NEURON 7.7.x; if you end up having to temporarily revert to 7.6.x, you'll ned to use .initial instead of .value for setting the parameter's value. You'd also need to split the vector recording into two lines.)

Re: Node.d (Diffusion) for Node3D objects

Posted: Sat Nov 30, 2019 9:29 am
by RBJ
Sorry for the delay in my reply to your reply!
Firstly, the nthreads thing; I am just wrong. There seems to be an optimal number of threads. Might work out to be the cores or something I don't know, but I was wrong to say it slowed it down of course. Must of been changing several things at the same time. h.nthreads(16) works well.

Mid run changes of rates:
As for changing rates mid-run, I wonder if I had been doing it all wrong or whether this is a version change thing.
So I was switching on the production of tfactor mid run (after a few seconds) like this ("production" is a previously defined parameter).

Code: Select all

reaction = rxd.Reaction(tfactprod > tfact, production * 0.001)
That failed unless I included EACH TIME I changed it.

Code: Select all

h.CVode().re_init() did not help. Now however now I have it working without any need for re-initialising anything.

Code: Select all

reaction.f_rate=production * 0.001
Thanks that is sorted now.