It seems to run very slowly. Is this simply due to the watch statement?
I've never dealt with a breakpoint statement that isn't a ODE in some form. Is how I've done this fine?
Finally, why does this behave strangely when gain is between 0.001 and 10 ? I would have thought setting the gain very high could cause oscillations, but how does having it too low do it?
Code: Select all
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
}
NEURON {
POINT_PROCESS Hybrid_Clamp
NONSPECIFIC_CURRENT i
RANGE vc, gain, dur
}
PARAMETER {
thresh = 2 (mV)
dur = 10 (ms)
delay = 1 (ms)
gain = 1000
vc = -75 (mV)
}
ASSIGNED {
on
i (nA)
v (mV)
}
BREAKPOINT {
if (on) {
i = (vc - v)*gain
}else{
i = 0
}
}
INITIAL {
net_send(0, 3)
on=0
}
NET_RECEIVE (dummy) {
if (flag==2) { : a spike has occurred
net_send(delay, 4)
} else if (flag==4) {
if (on == 0) { : voltage clamp is off, so turn it on
on = 1
net_send(dur, 1) : to turn it off
} else if (on == 1) { : if VS is already on, delay the recovery time
net_move(t + dur)
}
} else if (flag==1) { : time to VC off
on = 0
} else if (flag==3) {
WATCH (v > thresh) 2 : detect spike
}
}