Using setpointer() and RXD concentrations

Extending NEURON to handle reaction-diffusion problems.

Moderators: hines, wwlytton, ramcdougal

Post Reply
amerg
Posts: 5
Joined: Wed Jul 31, 2019 5:14 pm

Using setpointer() and RXD concentrations

Post by amerg »

I'm having an issue using setpointer() to connect a species concentration to a density mechanism. If I use a normal reference variable such as h._ref_t, then I don't get errors. However, if I use a line like

Code: Select all

h.setpointer(my_species.nodes(my_sec(0.5))[0]._ref_concentration, 'my_ptr', sec(0.5).mech_name)
I get these errors when the simulation tries to evaluate the line h.cvode.active(1)

Code: Select all

corrupted size vs. prev_size
Process finished with exit code 134 (interrupted by signal 6: SIGABRT)
I reformatted the mechanism to be a Point Process, but got the same error. Is there a mistake in how I'm trying to set the pointer?

Also, if I use a density mechanism, would I need to step through all of the segments and set each pointer to the concentrations of the appropriate nodes or are density mechanisms+pointers not supported/advised?
adamjhn
Posts: 54
Joined: Tue Apr 18, 2017 10:05 am

Re: Using setpointer() and RXD concentrations

Post by adamjhn »

The rxd Species, State and Parameter can be accessed in density mechanisms by their name. For example in the extracellular diffusion example;
The species has name='k', charge=1 which is accessed in steady_k.mod with

Code: Select all

USEION k WRITE ik CHARGE 1
Note the names have to match and the charge must equal the CHARGE (sometimes called VALENCE in nmodl).
Importantly, for intracellular regions, the region must be tagged with nrn_region='i' as the cyt region is in the varying initial concentrations and parameters example.

With a point process you will need to set the pointer, here is an mGluR example;
The Species Glu is linked to a pointer ‘G’ in a point process that increases the concentration in response to stimulation.

Code: Select all

h.setpointer(Glu.nodes[0]._ref_concentration, 'G', syn)
As of 7.7.2 you can also set the pointer using;

Code: Select all

syn._ref_G = Glu.nodes[0]._ref_concentration
duytanph
Posts: 16
Joined: Wed Jul 10, 2019 5:03 pm

Re: Using setpointer() and RXD concentrations

Post by duytanph »

Code: Select all

h.setpointer(Glu.nodes[0]._ref_concentration, 'G', syn)
Could you elaborate on what the indexing on the nodes represents? What would the difference between using Glu.nodes[0] versus Glu.nodes[1] be, for example?
ramcdougal
Posts: 267
Joined: Fri Nov 28, 2008 3:38 pm
Location: Yale School of Public Health

Re: Using setpointer() and RXD concentrations

Post by ramcdougal »

Glu.nodes is a list of all Glu nodes. If there is only one, then it is unambiguously safe to use Glu.nodes[0]. Otherwise, you'll want to filter down to a specific node by specifying e.g. segment, possibly region if there are multiple by using () for the filtering...

So something like Glu.nodes(soma(0.5)) or Glu.nodes(soma(0.5))(cyt) where soma is a Section and cyt is an rxd.Region of interest (e.g. the cytosol or the ER or...)

You can be sure there's exactly one node after filtering with e.g.

Code: Select all

assert(len(Glu.nodes(soma(0.5))) == 1)
To reiterate Adam's suggestion, unless you need your code to work in an old version of NEURON, avoid using setpointer and simply do an assignment:

Code: Select all

syn._ref_G = Glu.nodes(apical(0.5))[0]._ref_concentration
Post Reply