-
Notifications
You must be signed in to change notification settings - Fork 2
/
Fig2f2.hoc
263 lines (229 loc) · 7.96 KB
/
Fig2f2.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
/* Driver Program for Midbrain Dopaminergic Neuron model */
/*Different from dist.hoc by Ih current hd, #of synapses, AMPA,NMDA formulation for all dend 0-37, inserting mechanisms in "forsec distDend"
Prox or Distdend sections not in each dendrite, number of segments (inside each compartemnt) formulation nseg, read i.c. from different files,
print less dend data, writ i.c. in diferent file
*/
/* 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. */
load_file("dopaminergic.hoc")
timecon = 0
back= 0 /*1*/ /* 1 switch for running in the background */
sakmann=0
load_file("fixnseg.hoc")
if(!back)load_file("nrngui.hoc")
verbose= 0 /*0*/
v_init = -62.6
vcseries = 0
clamp = 0 /* switch for voltage clamp*/
restart = 0 /*1*/ /* switch for initializing from state.old */
tstart = 0
if(vcseries) tstop = 800 else tstop = 5000 /*time in msec*/
if(clamp && !vcseries) tstop= 600
if(timecon) tstop = 800
nsyn = 45 /* The number of synapses */
Dtmax = 1.0
Dt = 1.00
if(timecon) Dtmax = 1.0
dt = 5e-1 /*5e-4*/
if(timecon) dt = 0.01
nainit= 4.075
vsolder=v_init
vsold=v_init
/*PARAMETERS*/
na_cond = 0.0e-6
kdr_cond = 665.0e-6
ca_cond = 11.196e-6
kca_cond = 59.0e-6
a_cond_s = 570.0e-6
a_cond_p = 285.0e-6
a_cond_d = 266.0e-6
/*stronger gA *1.28 = 729.6, 364.8, 340.48*/
iapl = 0 /*in nA, -0.180nA=-180pA*/
global_ra = 40
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 stim,synn[nsyn],syna[nsyn]
objectvar vc
objref cvode
cvode = new CVode(1) /* 0 for clamp*/
x= cvode.active(1)
proc init_cell() {
/* First set all of the dimensions and insert the channels into each
* section. */
forsec "soma"{
{insert nabalan}
{insert hh3 gnabar_hh3 = na_cond gkhhbar_hh3 = kdr_cond gkabar_hh3 = a_cond_s
qs_hh3 = 56.0 qv_hh3 = 8.0}
{insert pump}
{insert leak}
{insert cabalan}
{insert cachan gcalbar_cachan = ca_cond gkbar_cachan = 0.0}
{insert kca gkbar_kca = kca_cond}
// {insert capump}
}
soma {
stim = new MyIClamp(.5)
{stim.delay = 4000 stim.dur = 1000.0 stim.amp = 0.00 /*in nA, -0.180nA=-180pA*/
stim.amp2 = iapl}
}
forsec proxDend {
{insert nabalan}
{insert hh3 gnabar_hh3 = na_cond gkhhbar_hh3 = kdr_cond gkabar_hh3 = a_cond_p
qv_hh3 = 60.0 qs_hh3 = 5.0}
{insert pump}
{insert leak}
{insert cabalan}
{insert cachan gcalbar_cachan = ca_cond gkbar_cachan = 0.0 }
{insert kca gkbar_kca = kca_cond}
}
forsec distDend {
{insert nabalan}
{insert hh3 gnabar_hh3 = na_cond gkhhbar_hh3 = kdr_cond gkabar_hh3 = a_cond_d
qv_hh3 = 60.0 qs_hh3 = 5.0}
{insert pump}
{insert leak}
{insert cabalan}
{insert cachan gcalbar_cachan = ca_cond gkbar_cachan = 0.0 }
{insert kca gkbar_kca = kca_cond}
}
/* for i = 0,37 dend[i] {
synn[i] = new NMDA(.5)
synn[i].synstim = 2000.0 synn[i].Pbar = 0.10e-6 synn[i].isi = 20.0 synn[i].N = 50 synn[i].gmax = 0.005
syna[i] = new AMPA(0.5)
syna[i].synstim = 2000.0 syna[i].gmax = 0.0 syna[i].isi = 20.0 syna[i].N = 50
}
dend[26] {
synn[38] = new NMDA(0.8)
synn[38].synstim = 2000.0 synn[38].Pbar = 0.10e-6 synn[38].isi = 20.0 synn[38].N = 50 synn[38].gmax = 0.005
syna[38] = new AMPA(0.8)
syna[38].synstim = 2000.0 syna[38].gmax = 0.0 syna[38].isi = 20.0 syna[38].N = 50
synn[39] = new NMDA(0.2)
synn[39].synstim = 2000.0 synn[39].Pbar = 0.10e-6 synn[39].isi = 20.0 synn[39].N = 50 synn[39].gmax = 0.005
syna[39] =new AMPA(0.2)
syna[39].synstim = 2000.0 syna[39].gmax = 0.0 syna[39].isi = 20.0 syna[39].N = 50
}
dend[36] {
synn[40] = new NMDA(0.8)
synn[40].synstim = 2000.0 synn[40].Pbar = 0.10e-6 synn[40].isi = 20.0 synn[40].N = 50 synn[40].gmax = 0.005
syna[40] =new AMPA(0.8)
syna[40].synstim = 2000.0 syna[40].gmax = 0.0 syna[40].isi = 20.0 syna[40].N = 50
synn[41] = new NMDA(0.2)
synn[41].synstim = 2000.0 synn[41].Pbar = 0.10e-6 synn[41].isi = 20.0 synn[41].N = 50 synn[41].gmax = 0.005
syna[41] =new AMPA(0.2)
syna[41].synstim = 2000.0 syna[41].gmax = 0.0 syna[41].isi = 20.0 syna[41].N = 50
}
dend[35] {
synn[42] = new NMDA(0.8)
synn[42].synstim = 2000.0 synn[42].Pbar = 0.10e-6 synn[42].isi = 20.0 synn[42].N = 50 synn[42].gmax = 0.005
syna[42] =new AMPA(0.8)
syna[42].synstim = 2000.0 syna[42].gmax = 0.0 syna[42].isi = 20.0 syna[42].N = 50
synn[43] = new NMDA(0.2)
synn[43].synstim = 2000.0 synn[43].Pbar = 0.10e-6 synn[43].isi = 20.0 synn[43].N = 50 synn[43].gmax = 0.005
syna[43] =new AMPA(0.2)
syna[43].synstim = 2000.0 syna[43].gmax = 0.0 syna[43].isi = 20.0 syna[43].N = 50
}
dend[30] {
synn[44] = new NMDA(0.8)
synn[44].synstim = 2000.0 synn[44].Pbar = 0.10e-6 synn[44].isi = 20.0 synn[44].N = 50 synn[44].gmax = 0.005
syna[44] =new AMPA(0.8)
syna[44].synstim = 2000.0 syna[44].gmax = 0.0 syna[44].isi = 20.0 syna[44].N = 50
}
*/
forall cm = global_cm
forall Ra = global_ra
g_celsius = 35
}
tot=0
forall {tot=tot+nseg}
print "segments before ", tot
nseg=1
// Increase number of segments
geom_nseg()
tot=0
forall {tot=tot+nseg}
print "segments after ", tot
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
access soma
if(!restart){
finitialize(v_init)
fcurrent()
}
if(restart){
f1.ropen("state.old")
ss.fread(f1)
f1.close
finitialize(v_init)
ss.restore()
t=tstart
if(cvode.active()){
cvode.re_init()
} else {
fcurrent()
}
frecord_init()
}
t = tstart
}
init()
if(back){
if(!clamp ||verbose) {print t/1000,soma[1].v(0.5),soma[1].nai(0.5),soma[1].cai(0.5),dend[3].v(0.5),dend[3].cai(0.5),dend[17].v(0.5),dend[17].cai(0.5)}
if(clamp && !vcseries && !verbose) print t/1000,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){
vsolder=vsold
vsold=soma.v(0.5)
fadvance()
if(!clamp||verbose){
if((vsolder<vsold &&soma.v(0.5) <vsold)||(vsolder>vsold && soma.v(0.5)>vsold)) {
vsolder=soma.v(0.5)
print t/1000,soma[1].v(0.5),soma[1].nai(0.5),soma[1].cai(0.5),dend[3].v(0.5),dend[3].cai(0.5),dend[17].v(0.5),dend[17].cai(0.5)
next = t + Dt
flag2=1
hold=dt
soma.v(0.5)=vsolder
}
}
if(t>=next){
Dt = 100*dt
if(Dt>Dtmax) Dt = Dtmax
if (Dt<.1) Dt = .1
next = t + Dt
if(!clamp||verbose) {print t/1000,soma[1].v(0.5),soma[1].nai(0.5),soma[1].cai(0.5),dend[3].v(0.5),dend[3].cai(0.5),dend[17].v(0.5),dend[17].cai(0.5)}
if(clamp && !vcseries && !verbose) print t/1000,vc.i,soma.cai(0.5),soma.v(0.5)
}
}
print t/1000,soma[1].v(0.5),soma[1].nai(0.5),soma[1].cai(0.5),dend[3].v(0.5),dend[3].cai(0.5),dend[17].v(0.5),dend[17].cai(0.5)
if(vcseries) print vc.amp1,vc.i
f2.wopen("state.new")
ss.save()
ss.fwrite(f2)
f2.close
} else {
forall Ra = global_ra
forall cm = global_cm
celsius = g_celsius
}
//load_file("damodel.ses")
//