I am writing a mod file for a custom synapse that requires updating the derivative of a STATE variable whenever the synapse is turned on and off. The code looks something like this (abstracted). This code works in the case where I am not updating the derivative during a synaptic event, but rather just an ASSIGNED variable. It seems like I might be missing something with how NMODL works because I tried different methods of achieving this and get the same results each time (like computing dA in the breakpoint according to the state of "on"). Any help is appreciated!
Code: Select all
NEURON {
POINT_PROCESS syn
RANGE g, e, i, ud, ur
NONSPECIFIC_CURRENT i
}
PARAMETER {
g (uS) e (mV)
ud (ms) ur (ms)
dur = 3.0 (ms)
}
ASSIGNED {
i (nA) v (mV) dA(/ms) on ()
}
STATE {
A ()
}
INITIAL {
dA = A_off()
A = 0
}
BREAKPOINT {
SOLVE states METHOD derivimplicit
i = g*(v-e)*y(A)
}
DERIVATIVE states {
A' = dA
}
FUNCTION y(a) () {
some function that depends on A
}
FUNCTION dA_on() (/ms) {
dA_on = -A / ud
}
FUNCTION dA_off() (/ms) {
dA_off= (1-A) / ud
}
NET_RECEIVE (weight, on) { : assume on is passed in as 0
if (flag == 0) {
: presynaptic spike began
if (!on) {
on = 1 : turn the synapse on
net_send(dur, 1) : offset after dur with flag=1
} else {
net_move(t + dur) : already on, so postpone offset time
}
dA = dA_on()
}
if (flag == 1) {
: presynaptic spike ended
on = 0 : turn the synapse off
dA = dA_off()
}
}