I am quite new to NEURON. I am trying to implement a custom mechanism (mod file) that outputs a synaptic current.
Are you quite sure that is necessary? There isn't something that already exists which, except for parameter values, would do exactly what you want? If there isn't, then have you tried looking for something that exists and is close to what you want to implement?
When looking at the mod file for Exp2Syn, I thought the only significant part that would have the section "recognize" the current is to declare it as a NONSPECIFIC_CURRENT.
"Programming by example" is a useful strategy, but as you found out, there are still many pitfalls. NMODL is very different from C, hoc, or Python. Have you taken a look at the enhanced preprint of
Hines, M.L. and Carnevale, N.T. Expanding NEURON's Repertoire of Mechanisms with NMODL. Neural Computation 12:995-1007, 2000
which is available as
https://neuron.yale.edu/neuron/static/p ... odl400.pdf
(also note the errata
https://neuron.yale.edu/neuron/static/p ... rrata.html)
?
how do I get the section to "see" the current of my custom mechanism?
Use a custom mechanism that actually generates a current. Your NMODL code needs a BREAKPOINT block that assigns a value to the current variable.
What is to be done to your NMODL file to fix that and some other problems you haven't bumped into yet?
If you have a mechanism that is supposed to generate a current, the mechanism must have a BREAKPOINT block which contains a statement that assigns a value to that current. Absent such a statement, your mechanism won't affect the model's charge balance equations.
where amp is the name of an intermediate variable whose value will be set to some initial value upon model initialization, and incremented by some amount every time the mechanism receives an event.
Of course, amp must be declared in the ASSIGNED block
Instead of hard wiring magic numbers like -70 and 10 (which happen to be very poor choices, by the way) into your code, you'll want to parameterize your model. amp0 and delta are nice and mnemonic.
Code: Select all
PARAMETER {
amp0 = 0 (nA)
delta = -0.01 (nA) : < 0 depolarizes. after all, this is a synaptic mechanism, not an electrode
}
A synaptic mechanism is likely to be used more than once in a model, and you might want each instance to have its own parameters, so declare them to be RANGE in the NEURON block.
Code: Select all
NEURON {
POINT_PROCESS netcontest
RANGE amp0, delta, i
NONSPECIFIC_CURRENT i
}
To ensure that amp is reset to its initial value when the model is initialized, the NMODL file's INITIAL block should be changed to
and to use delta to increment amp when an event arrives, the NET_RECEIVE block should become
Code: Select all
NET_RECEIVE(weight (uS)) {
amp = amp + delta
}
What remains to be done? If you use modlunit to check the NMODL file for consistency of units, modlunit will complain that it doesn't know about uS, so the UNITS block should be
Code: Select all
UNITS {
(nA) = (nanoamp)
(uS) = (microsiemens)
}