The substantive portions of stim.mod looks like:
... NEURON { POINT_PROCESS IClamp RANGE del, dur, amp, i ELECTRODE_CURRENT i } ... BREAKPOINT { at_time(del) at_time(del+dur) if (t < del + dur && t > del) { i = amp }else{ i = 0 } }2) Edit stim1.mod and change its POINT_PROCESS name to BadPulse and also comment out the two at_time call in the BREAKPOINT block. Before the closing brace of the BREAKPOINT block it will also be helpful to print t, v, and i.
3) Do a "Lipid Bilayer" style simulation with the BadPulse with
del = 1, dur = 1, amp = 0.1when CVode is used as the integration method. Notice that the pulse is completely missed since it lies entirely within one of the large integration intervals used by CVode.
4) Change the duration of the BadPulse to a very large number and rerun with CVode. Notice the inefficient search for the location of the discontinuities.
5) Uncomment the at_time calls (but leave in the printf statement) By notifying NEURON when the discontinuities occur, CVode stops just before them and restarts just after. To print the return value of at_time I use a BREAKPOINT block of:
BREAKPOINT { LOCAL adel, adur adel = at_time(del) adur = at_time(del+dur) if (t < del + dur && t > del) { i = amp }else{ i = 0 } printf("adel=%g adur=%g ", adel, adur) printf("t=%g t-del=%g v=%g i=%g\n", t, t-del, v, i) }