// zapstimu.hoc, based on zapstim.hoc
/* The stimulus is generated by an instance of the Fzap class 
(a point process that produces a sine wave of user-specified duration and
amplitude, that sweeps over a range of frequencies at a constant rate).
For each section that has the xtra mechanism, this waveform 
is used to drive is_xtra.
The transfer resistance rx_xtra takes care of the 
amplitude and sign of the local extracellular field.
*/

// default values
DEL = 2000  // ms
DUR = 4000  // ms
F0 = 50  // Hz
F1 = 50 // Hz
// AMP = 1  // nA
AMP = 500  // V/m


objref fz
fz = new Fzap(0.5)
// setpointer fz.x, is_xtra(0.5)
// setpointer fz.x, is_xtra
setpointer fz.x, E_xtrau

proc setstim() {
  fz.del = $1
  fz.dur = $2
  fz.f0 = $3
  fz.f1 = $4
  fz.amp = $5
}

setstim(DEL, DUR, F0, F1, AMP)

print "Use setstim(DEL, DUR, F0, F1, AMP) to change latency (ms), duration (ms),"
print "start and end frequency (Hz), and amplitude (V/m) of applied electrical field."
/*
xpanel("Applied Electrical Field", 0)
  xvalue("del (ms)", "DEL", 1, "setstim(DEL,DUR,F0,F1,AMP)", 0, 1)
  xvalue("dur (ms)", "DUR", 1, "setstim(DEL,DUR,F0,F1,AMP)", 0, 1)
  xvalue("start f (Hz)", "F0", 1, "setstim(DEL,DUR,F0,F1,AMP)", 0, 1)
  xvalue("end f (Hz)", "F1", 1, "setstim(DEL,DUR,F0,F1,AMP)", 0, 1)
  xvalue("amp (V/m)", "AMP", 1, "setstim(DEL,DUR,F0,F1,AMP)", 0, 1)
xpanel(73,497)
*/