Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add description of arbor and NEURON's nernst application rules to the docs. #1638

Merged
merged 6 commits into from
Oct 27, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions doc/cpp/cable_cell.rst
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,8 @@ assign them to the :cpp:expr:`default_parameters` field of the global properties
object returned in the recipe.


.. _cppcablecell-revpot:

Reversal potential dynamics
---------------------------

Expand Down
52 changes: 50 additions & 2 deletions doc/fileformat/nmodl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Ions
they need to be passed as arguments.
* If ``Xi`` or ``Xo`` (internal and external concentrations) are written in the
NMODL mechanism they need to be declared as ``STATE`` variables and their initial
values have to be set in the mechanism.
values have to be set in the ``INITIAL`` block in the mechanism.

Special variables
-----------------
Expand Down Expand Up @@ -113,4 +113,52 @@ Arbor-specific features
* Arbor allows a gap-junction mechanism to access the membrane potential at the peer site
of a gap-junction connection as well as the local site. The peer membrane potential is
made available through the ``v_peer`` variable while the local membrane potential
is available through ``v``, as usual.
is available through ``v``, as usual.

Nernst
------
Many mechanisms make use of the reversal potential of an ion (``eX`` for ion ``X``).
A popular equation for determining the reversal potential during the simulation is
the `Nernst equation <https://en.wikipedia.org/wiki/Nernst_equation>`_.
Both Arbor and NEURON make use of ``nernst``. Arbor implements it as a mechanism and
NEURON implements it as a built-in method. However, the conditions for using the
``nernst`` equation to change the reversal potential of an ion differ between the
two simulators.

1. In Arbor, the reversal potential of an ion remains equal to its initial value (which
has to be set by the user) over the entire course of the simulation, unless another
mechanism which alters that reversal potential (such as ``nernst``) is explicitly selected
for the entire cell. (see :ref:`cppcablecell-revpot` for details).

.. NOTE:
This means that a user cannot indicate to use ``nernst`` to calculate the reversal
potential on some regions of the cell, while other regions of the cell have a constant
reversal potential. It's either applied on the entire cell or not at all. This differs
from NEURON's policy.

2. In NEURON, there is a rule which is evaluated (under the hood) per section of a given
cell to determine whether or not the reversal potential of an ion remains constant or is
calculated using ``nernst``. The rule is documented
`here <https://neuron.yale.edu/neuron/static/new_doc/modelspec/programmatic/ions.html>`_
and can be summarized as follows:

Examining all mechansims on a given section, if the internal or external concentration of
an ion is **written**, and its reversal potential is **read but not written**, then the
nernst equation is used **continuously** during the simulation to update the reversal
potential of the ion.
And if the internal or external concentration of an ion is **read**, and its reversal
potential is **read but not written**, then the nernst equation is used **once** at the
beginning of the simulation to caluclate the reversal potential of the ion, and then
remains constant.
Otherwise, the reversal potential is set by the user and remains constant.

Copy link
Contributor

@thorstenhater thorstenhater Sep 1, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is one unclarity in the quoted NEURON docs, which I would love to do away with:
As written, it's unclear whether the rule applies to the local NMODL file only or the global
view is considered.

Example

Assume a mechanism A that reads eX and writes to Xi is added. By the rules above, nernst is used. Now we add mechanism B that writes to eX.

I assume this results in nernst not being used, but is that correct?

Also, where is this rule applied by NEURON? Is having one CV overlap between A and B enough to change global behaviours? Or just for the overlap? (Does it matter?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The global view is considered. So for a given ion, you need to look at all the mechanisms that use/write it and reason about the effect. In the above example, A reads the eX value that is written by B and if B reads Xi, it reads the value written by A. I will make this clearer.
As for whether A and B need to be on the same section for it to apply; I think yes. The docs indicate that this behavior is evaluated per section. Though I would need to check to be certain.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, tweaking the decomposition of the morphology into sections in NEURON potentially changes the treatment
of a globally used ion species? Or is that just for the overlapping CVs?

Sorry for asking so many questions on NEURON, but I expect to have to deal with them for quite some time in the
future.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So in Neuron, you can only add mechanisms on sections, not segments (CVs). I will run some examples to see what exactly happens in Neuron and get back to this question.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay so based on my experiments:
NEURON's rules for using nernst for the calculation of the reversal potential of an ion as stated above in this PR are applied per section (similar to arbor which can control the reversal potential of an ion at the granularity of a region). Since mechanisms can only be inserted on a section (not part of it) and since a NEURON segment (CV) can only belong to one section, there is no possibility for segment (CV) overlap that could cause confusion.
However, the rules do not consider a single mechanism in isolation on a section. All of the mechanisms on a section are considered when the rule is applied for that section.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy from private discussion:

Arbor and Neuron treat this fundamently diffent. In Neuron's model, Nernst can be used on a per-section basis in alternation with fixed reversal potentials. For Arbor, it is used globally, per ion species.

@halfflat on the motivation for not allowing it per region in Arbor,

  • CVs could be partially covered by the Nernst and const methods for the same ion
  • This cannot happen in Neuron, as each CV belongs to exactly one Section

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's add a comment about this final difference ARB ./. NRN ie

In Arbor, nernst is applied globally at the level of ion species, while in Neuron different parts of the morphology may use different mechanisms for the revpot. This is the result of the difference in the models of discretisation (in Arbor regions may partially cover CVs).

and then I am happy :D

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any updates here? I could also add the comment above and proceed this way, if you like

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I missed your last comment! I'll make the change.

One of the main consequences of this difference in behavior is that in Arbor, a mechanism
modifying the reversal potential (for example ``nernst``) can only be applied (for a given ion)
at a global level on a given cell. While in Neuron, different mechanisms can be used for
calculating the reversal potential of an ion on different parts of the morphology.
This is due to the different methods Arbor and NEURON use for discretising the morphology.
(A ``region`` in Arbor may include part of a CV, where as in NEURON, a ``section``can only
contain full ``segments``).

Modelers are encouraged to verify the expected behavior of the reversal potentials of ions
as it can lead to vastly different model behavior.