BlueBrain / nmodl

Code Generation Framework For NEURON MODeling Language
https://bluebrain.github.io/nmodl/
Apache License 2.0
48 stars 15 forks source link

Prevent same name for RANGE and FUNCTION. #1316

Closed 1uc closed 3 weeks ago

1uc commented 3 weeks ago

The following MOD file:

: Example of MOD file using sparse solver

NEURON {
    SUFFIX glia
    RANGE alfa, beta
    RANGE Aalfa, Valfa, Abeta, Vbeta
}

PARAMETER {
    Aalfa = 353.91 ( /ms)
    Valfa = 13.99 ( /mV)
    Abeta = 1.272  ( /ms)
    Vbeta = 13.99 ( /mV)
    n1 = 5.422
    n4 = 0.738
}

STATE {
    C1
    C2
}

BREAKPOINT {
    SOLVE kstates METHOD sparse
}

FUNCTION alfa(v(mV)) {
    alfa = Aalfa*exp(v/Valfa)
}

FUNCTION beta(v(mV)) {
    beta = Abeta*exp(-v/Vbeta)
}

KINETIC kstates {
    ~ C1 <-> C2 (n1*alfa(v),n4*beta(v))
}

Uses alfa both as a RANGE variable and as a function, nocmodl rejects the file, but nmodl will happily generate code for.