Page 1 of 1
Using setpointer() and RXD concentrations
Posted: Mon Aug 26, 2019 6:16 pm
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?
Re: Using setpointer() and RXD concentrations
Posted: Tue Aug 27, 2019 11:48 am
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
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
Re: Using setpointer() and RXD concentrations
Posted: Tue Mar 01, 2022 5:44 pm
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?
Re: Using setpointer() and RXD concentrations
Posted: Mon Mar 07, 2022 11:40 am
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