-
Notifications
You must be signed in to change notification settings - Fork 0
/
vsource.mod
68 lines (57 loc) · 1.07 KB
/
vsource.mod
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
TITLE vsource.mod
COMMENT
Patterned after svclmp.mod, a single electrode Voltage clamp mechanism.
Unlike svclmp.mod, this has one level--amp--and it delivers current i
for t<=toff (even t<0).
Clamp is on at time 0, and off after time toff.
When clamp is off the injected current is 0.
i is the injected current, vc measures the control voltage.
For other comments and important implementational details,
especially "why SOLVE icur METHOD after_cvode ???",
see the comments in svclmp.mod
ENDCOMMENT
NEURON {
POINT_PROCESS Vsource
ELECTRODE_CURRENT i
RANGE toff, amp, rs, vc, i
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(uS) = (microsiemens)
}
PARAMETER {
rs = 1 (megohm) <1e-9, 1e9>
toff (ms) amp (mV)
}
ASSIGNED {
v (mV) : automatically v + vext when extracellular is present
i (nA)
vc (mV)
on
}
INITIAL {
on = 1
}
BREAKPOINT {
SOLVE icur METHOD after_cvode
vstim()
}
PROCEDURE icur() {
if (on) {
i = (vc - v)/rs
}else{
i = 0
}
}
PROCEDURE vstim() {
on = 1
if (toff) {at_time(toff)}
if (t < toff) {
vc = amp
}else {
vc = 0
on = 0
}
icur()
}