-
Notifications
You must be signed in to change notification settings - Fork 0
/
dcdt.mod
executable file
·69 lines (59 loc) · 1.25 KB
/
dcdt.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
69
: Provides an example of how to manage variable capacitance using
: the relation q = c*v so that i = (c*dv/dt) + (dc/dt * v)
: The capacitance is assumed to be c(t)
: The effect of changing capacitance on the (c*dv/dt) term is accomplished
: via a POINTER to the compartment cm (set up in hoc) where the c pointer
: is assigned a value in the BEFORE BREAKPOINT block. The effect of
: the (dc/dt * v) term is accomplished in the BREAKPOINT block.
UNITS {
(mA) = (milliamp)
(mV) = (millivolt)
(uF) = (microfarad)
PI = (pi) (1)
}
NEURON {
SUFFIX dcdt
THREADSAFE
RANGE c1, c2, w, tbegin, tdur, dc
POINTER c
NONSPECIFIC_CURRENT i
}
PARAMETER {
c1 = 1 (uF/cm2)
c2 = 0 (uF/cm2)
w = 0 (/ms)
tbegin = 1e9 (ms)
tdur = 0 (ms)
dc (uF/cm2-ms)
}
ASSIGNED {
c (uF/cm2)
i (mA/cm2)
v (mV)
}
FUNCTION cm(t(ms)) (uF/cm2) {
if (t >= tbegin && t <= (tbegin + tdur)) {
cm = c1 + c2*sin(2*PI*w*(t - tbegin))
}else{
cm = c1
}
}
FUNCTION dcmdt(t(ms))(uF/cm2-ms) {
if (t >= tbegin && t <= (tbegin + tdur)) {
dcmdt = c2*2*PI*w*cos(2*PI*w*(t - tbegin))
}else{
dcmdt = 0
}
}
INITIAL {
dc = 0
}
BEFORE BREAKPOINT {
c = cm(t)
dc = dcmdt(t)
}
BREAKPOINT {
at_time(tbegin)
at_time(tbegin + tdur)
i = dc*v*(0.001)
}