-
Notifications
You must be signed in to change notification settings - Fork 1
/
fig4b2.hoc
338 lines (314 loc) · 9.52 KB
/
fig4b2.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
/* Reproduces Fig.4B2 */
/* Driver Program for Midbrain Dopaminergic Neuron model */
/* The following command loads the standard run library functions into
* the simulator. These library functions are used to initialize the
* simulator, begin and end simulations, and plot variables during a
* simulation. */
timecon = 0
back= 0 /* 1 switch for running in the background */
sakmann=0
if(!back)load_file("nrngui.hoc")
verbose=0
v_init = -58.954775
vcseries = 0
clamp = 0 /* switch for voltage clamp*/
restart = 0 /* switch for initializing from state.old */
tstart = 0
if(vcseries) tstop = 800 else tstop = 5000
if(clamp && !vcseries) tstop= 600
if(timecon) tstop = 800
nsyn = 1 /* The number of synapses */
soma_len= 25.0
soma_diam= 15.0
ndend=4
nbranch=2
dend_diam= 1.5 /* 1.5 need to make dendrite taper */
prox_diam= 3.0 /* 3.0 need to make dendrite taper */
taper = 1.0
dend_len = 500.0
prox_len = 150.0
Dtmax = 1.0
Dt = 1.00
if(timecon) Dtmax = 1.0
dt = 5e-4
if(timecon) dt = 0.01
nainit= 4.000
vsolder=v_init
vdolder=v_init
vsold=v_init
vdold=v_init
ourgampa=0.0
ourPnmda=0.0
create dummy,soma, prox[ndend], dend[nbranch*ndend] /* Create all of the cell's sections */
global_ra = 400
forall Ra = global_ra
global_cm = 1.0
forall cm = global_cm
g_celsius = 35
celsius = g_celsius
forall ion_style("na_ion", 2,2,0,0,0)
access soma /* All default references are to soma */
objectvar syn[nsyn] /* Declare the object variables for
* the three synapses */
objectvar stim
objectvar vc
objref cvode
objref ff
objref vec1,vec2
cvode = new CVode(1) /* 0 for clamp*/
x= cvode.active(1)
ff = new File()
vec1 = new Vector(900001)
ff.ropen("fig4bAMPA.dat")
n = vec1.scanf(ff, 900000)
ff.close()
ff = new File()
vec2 = new Vector(900001)
ff.ropen("fig4bNMDA.dat")
n = vec2.scanf(ff, 900000)
ff.close()
samplestep = 0.1
objref tvec1,tvec2
tvec1 = vec1.c.indgen(samplestep)
tvec2 = vec2.c.indgen(samplestep)
vec1.play(&ourgampa,tvec1,1)
vec2.play(&ourPnmda,tvec2,1)
proc init_cell() {
/* First set all of the dimensions and insert the channels into each
* section. */
dummy{
L=1
d=1
}
soma {
nseg = 1 /* # of compartments */
diam = soma_diam /* Set the diameter of the soma (in um) */
L = soma_len /* Set the length of the soma (in um) */
{insert nabalan nainit_nabalan = 4.6438247 f_nabalan = 4.0}
{insert hh3 gkabar_hh3 = 100.0e-6
miv_hh3 = 44.6 hiv_hh3 = 66.8 htv1_hh3 = 39.0 htv2_hh3 = 59.0}
{insert pump ipumpmax_pump = 0.0036}
{insert leak gcabar_leak = 0.6e-6 ggabaa_leak = 500.0e-6 /*when changing
change the corresponding parameter in dend and prox with ratio g_prox=g_dend=g_soma/10 */}
{insert cabalan cainit_cabalan = 0.00018452707 }
{insert cachan}
{insert kca gkbar_kca = 800.0e-6}
{insert capump}
if (!clamp) {
istim = 0.0
stim = new MyIClamp(.5)
{stim.del = 0 stim.dur = 200000 stim.amp = 0.0 /*in nA, -0.180nA=-180pA*/
stim.amp2 = 0}
if(timecon) stim.dur = 600 /*(ms)*/
if (sakmann) stim.amp2 = -0.050
if(timecon) stim.amp2 = -0.020
if(timecon) stim.del = 100
} else {
vc = new SEClamp(.5)
if(!vcseries) vc.amp1 = -60.0 else vc.amp1 = -130
vc.dur1 = 50
vc.amp2 = -30.0
vc.dur2 = 350
vc.amp3 = -60.0
vc.dur3 = 201
}
pt3dclear()
pt3dadd(0,0,0,soma_diam)
pt3dadd(soma_len,0,0,soma_diam)
}
for i = 0, ndend-1 prox[i] {
nseg = 1 /* # of compartments */
L = prox_len /* Set the length of the dendrite (in um) */
{insert nabalan nainit_nabalan = 5.3180447 f_nabalan = 1.0}
{insert hh3 gkabar_hh3 = 300.0e-6
miv_hh3 = 34.6 hiv_hh3 = 56.8 htv1_hh3 = 29.0 htv2_hh3 = 49.0}
{insert pump ipumpmax_pump = 0.0072}
{insert leak gcabar_leak = 0.0e-6 ggabaa_leak = 50.0e-6 }
{insert nmda}
{insert ampa ratio_ampa = 2}
forall cm = global_cm
forall Ra = global_ra
g_celsius = 35
}
for i = 0, ndend-1 prox[i] {
prox[i] for (x,0) {
setpointer caisoma_nmda(x), soma.cai(0.5)
setpointer nmdasyn_nmda(x), ourPnmda
setpointer ampasyn_ampa(x), ourgampa
}
}
for i = 0, nbranch*ndend - 1 dend[i] {
nseg = 1 /* # of compartments */
L = dend_len - prox_len /* Set the length of the dendrite (in um) */
{insert nabalan nainit_nabalan = 4.9119551 f_nabalan = 1.0}
{insert hh3 gkabar_hh3 = 1000.0e-6
miv_hh3 = 26.6 hiv_hh3 = 48.8 htv1_hh3 = 21 htv2_hh3 = 41.0}
{insert pump ipumpmax_pump = 0.009}
{insert leak gcabar_leak = 0.0e-6 ggabaa_leak = 50.0e-6 }
{insert nmda}
{insert ampa ratio_ampa = 2}
forall cm = global_cm
forall Ra = global_ra
g_celsius = 35
}
for i = 0, nbranch*ndend - 1 dend[i] {
dend[i] for (x,0) {
setpointer caisoma_nmda(x), soma.cai(0.5)
setpointer nmdasyn_nmda(x), ourPnmda
setpointer ampasyn_ampa(x), ourgampa
}
}
/* Next we construct the topology by connecting each of the sections together. */
connect soma(0),dummy(1)
connect prox[0](0),soma(0)
connect prox[1](0), soma(1)
connect prox[2](0), soma(0.5)
connect prox[3](0), soma(0.5)
for j = 0, ndend-1 {
for i = 0, nbranch-1 {
connect dend[j+i*ndend](0), prox[j](1)}}
dummy{
pt3dclear()
pt3dadd(0.5*soma_len,0,1,1)
pt3dadd(0.5*soma_len,0,0,1)
}
prox[0]{
pt3dclear()
pt3dadd(0,0,0,prox_diam)
pt3dadd(-prox_len,0,0,prox_diam)
}
dend[0]{
pt3dclear()
pt3dadd(-prox_len,0,0,dend_diam)
pt3dadd(-dend_len,0,0,dend_diam/taper)
}
if(nbranch==2) dend[4]{
pt3dclear()
pt3dadd(-prox_len,0,0,dend_diam)
pt3dadd(-prox_len,dend_len-prox_len,0,dend_diam/taper)
}
prox[1]{
pt3dclear()
pt3dadd(soma_len,0,0,prox_diam)
pt3dadd(soma_len+prox_len,0,0,prox_diam)
}
dend[1]{
pt3dclear()
pt3dadd(soma_len+prox_len,0,0,dend_diam)
pt3dadd(soma_len+dend_len,0,0,dend_diam/taper)
}
if(nbranch==2) dend[5]{
pt3dclear()
pt3dadd(soma_len+prox_len,0,0,dend_diam)
pt3dadd(soma_len+prox_len,prox_len-dend_len,0,dend_diam/taper)
}
prox[2]{
pt3dclear()
pt3dadd(0,soma_diam/2,0,prox_diam)
pt3dadd(0,(soma_diam/2 + prox_len),0,prox_diam)
}
dend[2]{
pt3dclear()
pt3dadd(0,(soma_diam/2 + prox_len),0,dend_diam)
pt3dadd(0,soma_diam/2 + dend_len,0,dend_diam/taper)
}
if(nbranch==2) dend[6]{
pt3dclear()
pt3dadd(0,(soma_diam/2 + prox_len),0,dend_diam)
pt3dadd(dend_len-prox_len,soma_diam/2 + prox_len,0,dend_diam/taper)
}
prox[3]{
pt3dclear()
pt3dadd(0,-soma_diam/2,0,prox_diam)
pt3dadd(0,(-soma_diam/2 - prox_len),0,prox_diam)
}
dend[3]{
pt3dclear()
pt3dadd(0,-soma_diam/2 - prox_len,0,dend_diam)
pt3dadd(0,-soma_diam/2 - dend_len,0,dend_diam/taper)
}
if(nbranch==2) dend[7]{
pt3dclear()
pt3dadd(0,-soma_diam/2 - prox_len,0,dend_diam)
pt3dadd(prox_len-dend_len,-soma_diam/2 - prox_len,0,dend_diam/taper)
}
}
topology()
init_cell() /* Call the function to initialize our
* cell. */
objref ss,f1,f2
ss = new SaveState()
f1 = new File()
f2 = new File()
proc init() {local i
if(!restart){
finitialize(v_init)
fcurrent()
}
if(restart){
f1.ropen("state4b2.old")
ss.fread(f1)
f1.close
finitialize(v_init)
ss.restore(1)
t=tstart
if(cvode.active()){
cvode.re_init()
} else {
fcurrent()
}
frecord_init()
}
t = tstart
}
init()
if(back){
if(!clamp ||verbose) {print t,soma.v(0.5),soma.nai(0.5),prox.nai(0.5),dend.nai(0.5),soma.cai(0.5)}
if(clamp && !vcseries && !verbose) print t,vc.i,soma.cai(0.5),soma.v(0.5)
if(vcseries) j= 10 else j = 0
for i = 0, j { if (vcseries) vc.amp1 = vc.amp1 + 10}
if(vcseries) init()
next = t + Dt
flag1=0
flag2=0
hold = 0
while (t<=tstop-dt){
vsolder=vsold
vdolder=vdold
vsold=soma.v(0.5)
vdold=dend[1].v(0.99)
fadvance()
if(!clamp||verbose){
if((vsolder<vsold &&soma.v(0.5) <vsold)||(vsolder>vsold && soma.v(0.5)>vsold)||(vdolder<vdold &&dend[1].v(0.99) <vdold)|| (vdolder>vdold && dend[1].v(0.99)>vdold)) {
vsolder=soma.v(0.5)
vdolder=dend[1].v(0.99)
print t,soma.v(0.5),soma.nai(0.5),prox.nai(0.5),dend.nai(0.5),soma.cai(0.5)
next = t + Dt
flag2=1
hold=dt
soma.v(0.5)=vsolder
dend[1].v(0.99)=vdolder
}
}
if(t>=next){
Dt = 100*dt
if(Dt>Dtmax) Dt = Dtmax
if (Dt<.1) Dt = .1
next = t + Dt
if(!clamp||verbose) print t,soma.v(0.5),soma.nai(0.5),prox.nai(0.5),dend.nai(0.5),soma.cai(0.5)
if(clamp && !vcseries && !verbose) print t,vc.i,soma.cai(0.5),soma.v(0.5)
}
}
print t,soma.v(0.5),soma.nai(0.5),prox.nai(0.5),dend.nai(0.5),soma.cai(0.5)
if(vcseries) print vc.amp1,vc.i
f2.wopen("state4b2.new")
ss.save()
ss.fwrite(f2)
f2.close
} else{ if(clamp) {xopen("clamp.ses")} else {xopen("fig4b2.ses")}
forall Ra = global_ra
forall cm = global_cm
prox{ forall cm = global_cm}
dend{ forall cm = global_cm}
celsius = g_celsius
}