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

Neuron supports maximum of 64 ions when density mechanisms writing to concentrations are present #2947

Open
Hjorthmedh opened this issue Jun 27, 2024 · 1 comment
Labels

Comments

@Hjorthmedh
Copy link

Context

There is a limit of 64 species in eion.cpp, see comment in the code:

    /* an embarassing hack */
    /* up to 32 possible ions */
    /* continuously compute a bitmap that allows determination
        of which models WRITE which ion concentrations */

https://github.com/neuronsimulator/nrn/blob/8ffa1fa3acfbb4f91d070312617d83d64634adfb/src/nrnoc/eion.cpp#L406C1-L409C58

failing on line:

assert(k < sizeof(long) * 8);

Overview of the issue

Unable to have more than 64 species in eion.cpp

assert(k < sizeof(long) * 8);

Expected result/behavior

Should be able to have more than 64 species.

NEURON setup

Minimal working example - MWE

import neuron
from neuron import h
import neuron.crxd as rxd

soma = h.Section(name="soma")
soma.L = soma.diam = 10

species_list = []

print("Creating regions")
region = rxd.Region(soma, nrn_region="i")

print("Creating species")
for idx in range(0,200):
    species_name = f"species{idx}"
    spec = rxd.Species(region,
                       d=0,
                       initial=1,
                       charge=0,
                       name=species_name)
    species_list.append(spec)

print("Inserting channels")
soma.insert("caldyn_ms")


print("Init")
h.finitialize()
neuron.run(100)

caldyn_ms.mod

TITLE Calcium dynamics for L and T calcium pool

NEURON {
    SUFFIX caldyn_ms
    USEION cal READ ical, cali WRITE cali VALENCE 2
    RANGE pump, cainf, taur, drive, depth
}

UNITS {
    (molar) = (1/liter) 
    (mM) = (millimolar)
    (um) = (micron)
    (mA) = (milliamp)
    (msM) = (ms mM)
    FARADAY = (faraday) (coulomb)
}

PARAMETER {
    drive = 10000 (1)
    depth = 0.2  (um)
    cainf = 70e-6 (mM)
    taur = 43 (ms)
    kt = 1e-4 (mM/ms)
    kd = 1e-4 (mM)
    pump = 0.02
}

STATE { cali (mM) }

INITIAL { cali = cainf }

ASSIGNED {
    ical (mA/cm2)
    drive_channel (mM/ms)
    drive_pump (mM/ms)
}
    
BREAKPOINT {
    SOLVE state METHOD cnexp
}


DERIVATIVE state { 
    
    : force concentration to stay above cainf by only pumping if larger
    drive_channel = -drive*ical/(2*FARADAY*depth)
    drive_pump    = -kt*(cali-cainf)/(cali+kd)
    
    if (drive_channel <= 0.) { drive_channel = 0. }
    
    cali' = drive_channel + pump*drive_pump + (cainf-cali)/taur
}

COMMENT

Original NEURON model by Wolf (2005) and Destexhe (1992).  Adaptation by
Alexander Kozlov <[email protected]>. Updated by Robert Lindroos <[email protected]>.

Updates by RL:
-cainf changed from 10 to 70 nM (sabatini et al., 2002 The Life Cycle of Ca 2+ Ions in Dendritic Spines)
-pump updated to only be active if cai > cainf (neutralized by adding reversed entity) 

[1] Wolf JA, Moyer JT, Lazarewicz MT, Contreras D, Benoit-Marand M,
O'Donnell P, Finkel LH (2005) NMDA/AMPA ratio impacts state transitions
and entrainment to oscillations in a computational model of the nucleus
accumbens medium spiny projection neuron. J Neurosci 25(40):9080-95.

ENDCOMMENT

Logs

Creating regions
Creating species
Inserting channels
Assertion failed: file /root/nrn/src/nrnoc/eion.cpp, line 437
NEURON: k < sizeof(long) * 8
 near line 0
 objref hoc_obj_[2]
                   ^
@Hjorthmedh Hjorthmedh added the bug label Jun 27, 2024
@Hjorthmedh Hjorthmedh changed the title Neuron supports maximum of 64 ion when density mechanisms writing to concentrations are present Neuron supports maximum of 64 ions when density mechanisms writing to concentrations are present Jun 27, 2024
@Hjorthmedh
Copy link
Author

Is it only the check that is limited to 64 ions, and the underlying code can handle any number of species? If so it might be an option to disable the test...?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant