# Compartmental neuron with\`Ri\` as state variable

**URL:** <https://brian.discourse.group/t/compartmental-neuron-with-ri-as-state-variable/641>\
**Category:** Support\
**Tags:** equations, multicompartment\
**Created:** [22 March 2022 10:09 UTC](https://brian.discourse.group/t/compartmental-neuron-with-ri-as-state-variable/641 "2022-03-22T10:09:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![arashgmn](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/arashgmn/32/313_2.png) [@arashgmn](https://brian.discourse.group/u/arashgmn)\
**Post date:** [22 March 2022 10:09 UTC](https://brian.discourse.group/t/compartmental-neuron-with-ri-as-state-variable/641/1 "2022-03-22T10:09:38Z")

</div>

# Description of problem

Myelinated axons cannot be defined as uniform cables. It is desirable to construct them as a series of nodal compartments connected to the internodal ones, with each compartment having its own set of equations. For instance, for the following axon composed of two nodes and three internodal myelinated compartments

`... =====+=====+====== ...`

one needs specify a set of `eqs_nodal` on the unmyelinated nodes and a different set `eqs_internodal` on the myelinated parts. My question is: **what is the best way to implement such a structure on brian?**

The current implementation of `SpatialNeuron` raises two challenges:

1. Specifying different equations at each segment (against the shared equations `model`)
2. Specifying compartment-dependent axial resistant (against the shared variable `Ri`)

In the problem I’m dealing with the nodal part are governed by a variation of Hodgkin-Huxley dynamics whereas the internodal parts are passive. I can circumvent 1 by specifying a general active set of equations (resembling the nodal dynamics) and simply turning off the irrelevant conductances on the internodal segments (as they are state variables). But, I’m not sure how to resolve 2. One idea is to utilize the fact the `Cm` is actually a state variable, and solve `Cm` for each compartment (with constant `Ri`) such that effective axial impedances match. But it won’t work if the axial elements are only resistive.

Thanks in advance for ideas/thoughs!  
Arash

---

<div class="post-metadata">

**Author:** ![mstimberg](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/mstimberg/32/11_2.png) [@mstimberg](https://brian.discourse.group/u/mstimberg)\
**Post date:** [22 March 2022 15:25 UTC](https://brian.discourse.group/t/compartmental-neuron-with-ri-as-state-variable/641/2 "2022-03-22T15:25:51Z")

</div>

Hi @arashgmn,  
your observations and conclusions are exactly on point, unfortunately you are running into limitations of the current multi-compartmental neuron support. Regarding your point 1: currently, you can only have one set of equations for all compartments of a `SpatialNeuron`. As you mentioned, having e.g. `g_na : siemens (constant)` as part of the equations and setting it to 0 for the myelinated parts is the way to get around this restriction. Regarding `Ri`, you are again right that this is currently a single value for the whole neuron. I don’t see any workaround for this at the moment. I am not 100% sure (@romainbrette is the expert on these topics), but I think myelinated axons are typically modeled with an increased `Cm` (myelin ≈ thick membrane), without any change in `Ri`.  
All that said, I think we could support a compartment-specific `Ri` in the code without too much effort. If this is important to you and if you are willing to help with testing (e.g. coming up with an analytical solution we can compare against), I could give it a try.

Best,  
Marcel

---

<div class="post-metadata">

**Author:** ![arashgmn](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/arashgmn/32/313_2.png) [@arashgmn](https://brian.discourse.group/u/arashgmn)\
**Post date:** [22 March 2022 17:09 UTC](https://brian.discourse.group/t/compartmental-neuron-with-ri-as-state-variable/641/3 "2022-03-22T17:09:41Z")

</div>

Hi @mstimberg  
Thanks for the clarification.  
Your suggestion regarding increasing capacitors to account for thicker myelin lamella layers is worth trying. That said, I still fancy compartment-specific `Ri` and would be happy to test new functionalities or write new test units.

Arash

---

<div class="post-metadata">

**Author:** ![arashgmn](https://yyz2.discourse-cdn.com/free1/user_avatar/brian.discourse.group/arashgmn/32/313_2.png) [@arashgmn](https://brian.discourse.group/u/arashgmn)\
**Post date:** [24 March 2022 11:50 UTC](https://brian.discourse.group/t/compartmental-neuron-with-ri-as-state-variable/641/4 "2022-03-24T11:50:21Z")

</div>

Just an update.

Based on the current state of literature, it seems more realistic to partition a myelinated axon alongside its axis into juxtaparanodes, paranodes, and the nodes (look at Fig.2 of [this article](https://elifesciences.org/articles/50403#fig5s2), for instance). This is in favor of having compartment-specific `Ri`.
