forked from nrnhines/nrntraub
-
Notifications
You must be signed in to change notification settings - Fork 0
/
vcompclamp.hoc
79 lines (68 loc) · 1.8 KB
/
vcompclamp.hoc
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
70
71
72
73
74
75
76
objref vmat, fvmat, voutlist, vinlist, fvoutlist, tout, tin
proc vcompclamp() { local i, j, numcomp localobj vv, f, s, clist, c, rsav, cdvdt
s = new String()
voutlist = new List()
vinlist = new List()
fvoutlist = new List()
clist = new List()
f = new File()
numcomp=0 forsec cell.all numcomp += 1
vmat = new Matrix(100*100-1, numcomp+1)
classname(cell, s.s)
sprint(s.s, "../p2c/state/v_%s.dat", s.s)
f.ropen(s.s)
vmat.scanf(f, vmat.nrow, vmat.ncol)
fvmat = new Matrix(100*100-1, numcomp+1)
classname(cell, s.s)
sprint(s.s, "../p2c/state/fv_%s.dat", s.s)
f.ropen(s.s)
fvmat.scanf(f, vmat.nrow, vmat.ncol)
i = 1
tout = new Vector()
cell.comp[1] {tout.record(&t)}
tin = vmat.getcol(0)
rsav = new Vector()
for i=1, vmat.ncol-1 cell.comp[i] {
rsav.append(Ra)
Ra = 1e9
c = new SEClamp(.5)
c.dur1 = 1e9
c.rs = .01
clist.append(c)
vv = new Vector()
vv.record(&c.i)
fvoutlist.append(vv)
vv = new Vector()
vv.record(&v(.5))
voutlist.append(vv)
vv = vmat.getcol(i)
vv.play(&c.amp1, tin, 1)
vinlist.append(vv)
}
stdinit()
continuerun(100)
for i=1, vmat.ncol-1 cell.comp[i] {
cdvdt = voutlist.object(i-1).c.deriv(dt,2)
fvoutlist.object(i-1).div(cm*area(.5)/100).add(cdvdt)
}
for i=1, vmat.ncol-1 cell.comp[i] {
Ra = rsav.x[i-1] // but no longer is traub_exact
}
seefv(2)
}
proc seefv() {localobj s
s = new String()
gg.erase_all()
seewhich = $1
if (seewhich > fvoutlist.count) {seewhich = fvoutlist.count}
if (seewhich < 1) { seewhich = 1 }
cell.comp[seewhich] { sprint(s.s,"%s(.5) clamp current", secname()) }
gg.label(.5,.8,s.s,2,1,0,0,1)
fvmat.getcol(seewhich).line(gg, tin, 2, 1)
fvoutlist.object(seewhich-1).line(gg, tout)
}
proc mkseefv() {
xpanel("compare compartment currents")
xvalue("which", "seewhich", 1, "seefv(seewhich)")
xpanel()
}