Open 1uc opened 2 months ago
One of the principle differences between the original MODL design and NMODL was that the former used a MOD file to describe the entire simulation model. NMODL extended this in two directions. Multiple instances of a single description and combining multiple descriptions. The first involves an instance per spatial compartment and (for POINT_PROCESSES) the possibility of many instances within a compartment. The second involves many descriptions within a single compartment.
So, when one sees data translated into static double
it is occasionally a clue that the translation implementation dates back to MODL and was never examined with regard to whether it was reasonable to extend to NMODL. Also it suggests that the feature was never used in a multicompartment context.
In the case of DISCRETE, it is clearly straight forward to extend to multiple instances by making the internal __a[4]
analogous to a RANGE variable (and deciding whether it is a good or bad idea to expose those values to the interpreter).
It is hard to get excited about DISCRETE since it was never used, the naive implementation is dt dependent, and it can't work with CVODE.
It seems to me that the simplest alternatives are to 1: raise a new NMODL error if DISCRETE is used, or, 2: translate the array __a[4]
into a container array variable (private) so that each instance has its own array. I guess I would choose alternative 2.
The following MOD file:
Slightly modified from: https://github.com/neuronsimulator/nrn/blob/e462814e58383100d43785e84af9380b91d5e98e/docs/nmodl/mod/disc.mod
Generates the following code when using
nocmodl
:There's the following comment in the documentation:
https://nrn.readthedocs.io/en/8.2.6/hoc/modelspec/programmatic/mechanisms/nmodl.html#initial
I couldn't find any uses on Model DB.
Some question are:
nmodl
codegenerator?@n
withn>1
, e.g. by refusing to generate code from NOCMODL?