Hello everyone,
I am building a new cell type with fine nanoscale processes (diameter approximately 0.05–0.5 µm). The main compartments, including the soma and dendrites, have cadifus inserted through a biophysics JSON loader, which sets the resting intracellular calcium concentration to cai0 = 5e-5 mM (50 nM).
The nano sections initially had insert cad hardcoded in their initBiophysics() procedure, while cadifus was subsequently inserted into the same sections by the loader.
The nano sections displayed an anomalously high resting intracellular calcium concentration of approximately 100 nM instead of 50 nM before any stimulus, and their calcium dynamics were clearly incorrect during the simulation.
After investigating, I found that both cad and cadifus write to cai. When they are inserted into the same section, cai appears to be initialised by whichever mechanism executes its INITIAL block last. In this case, cad sets cai = cainf = 1e-4 mM, silently overriding the cai0 = 5e-5 mM defined by cadifus. During the simulation, both mechanisms then attempt to update the same ion concentration.
Is the recommended BrainCell approach to ensure that only one calcium-handling mechanism writing to cai is inserted in each section? Should the biophysics loader detect and prevent conflicting calcium mechanisms, or is there an existing way within BrainCell to specify which mechanism controls cai ?
Unexpected [Ca²⁺]ᵢ initialisation when both cad and cadifus are inserted in the same section
-
chrysa_tbr
- Posts: 1
- Joined: Thu Mar 20, 2025 2:11 pm
-
Neuro-Admin
- Site Admin
- Posts: 17
- Joined: Sun Jan 14, 2024 1:09 pm
Re: Unexpected [Ca²⁺]ᵢ initialisation when both cad and cadifus are inserted in the same section
This isn't in my memory of our past conversations, so let me answer based on general BrainCell/NEURON principles.
Yes this is a "two mechanisms WRITE the same ion" conflict, and the fix is exclusion, not arbitration.
**Root cause:** with both `cad` and `cadifus` inserted in the same section, NEURON runs each mechanism's INITIAL block in insertion order, and whichever runs last wins the `cai` value at t=0. That's why you're getting `cad`'s `cainf` (100 nM) instead of `cadifus`'s `cai0` (50 nM) — it's not a BrainCell bug, it's standard NEURON behavior for any section with two ion-writing mechanisms sharing a `WRITE cai`.
**Recommended fix:** exactly one calcium-handling mechanism per section, full stop. For nano sections meant to use `cadifus`, the hardcoded `insert cad` in `initBiophysics()` needs to go — that's leftover from before the JSON loader existed and is now actively conflicting with it. Two mechanisms writing the same ion in the same section is never valid, even if their steady states happened to match; the transient dynamics would still fight each other during simulation.
**On BioManager enforcement:** yes, this is worth adding as a validation step. A cheap check in the loader — before inserting a new cai-writing mechanism, scan the section's already-inserted mechanisms for another `WRITE cai` and raise/warn on conflict — would catch this class of bug at load time instead of producing a silently wrong resting concentration. I wouldn't try to build "controller mechanism" arbitration logic (e.g., letting the loader pick which one "wins"); that adds complexity and hides the real problem. Cleaner to enforce one-mechanism-per-ion-per-section as an invariant and fail loudly if violated.
**Immediate action for your case:** remove `insert cad` from the nano-section `initBiophysics()` and let the JSON loader's `cadifus` insertion be the sole calcium handler there, then re-verify resting `cai` and transient response.
Yes this is a "two mechanisms WRITE the same ion" conflict, and the fix is exclusion, not arbitration.
**Root cause:** with both `cad` and `cadifus` inserted in the same section, NEURON runs each mechanism's INITIAL block in insertion order, and whichever runs last wins the `cai` value at t=0. That's why you're getting `cad`'s `cainf` (100 nM) instead of `cadifus`'s `cai0` (50 nM) — it's not a BrainCell bug, it's standard NEURON behavior for any section with two ion-writing mechanisms sharing a `WRITE cai`.
**Recommended fix:** exactly one calcium-handling mechanism per section, full stop. For nano sections meant to use `cadifus`, the hardcoded `insert cad` in `initBiophysics()` needs to go — that's leftover from before the JSON loader existed and is now actively conflicting with it. Two mechanisms writing the same ion in the same section is never valid, even if their steady states happened to match; the transient dynamics would still fight each other during simulation.
**On BioManager enforcement:** yes, this is worth adding as a validation step. A cheap check in the loader — before inserting a new cai-writing mechanism, scan the section's already-inserted mechanisms for another `WRITE cai` and raise/warn on conflict — would catch this class of bug at load time instead of producing a silently wrong resting concentration. I wouldn't try to build "controller mechanism" arbitration logic (e.g., letting the loader pick which one "wins"); that adds complexity and hides the real problem. Cleaner to enforce one-mechanism-per-ion-per-section as an invariant and fail loudly if violated.
**Immediate action for your case:** remove `insert cad` from the nano-section `initBiophysics()` and let the JSON loader's `cadifus` insertion be the sole calcium handler there, then re-verify resting `cai` and transient response.