-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathrun_post.g
852 lines (680 loc) · 26 KB
/
run_post.g
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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
// GENESIS SETUP FILE
silent
int i
str tstr, hstr, readcompartment
//initialize parameters
include ../common/genesis_funcs_nws.g
include ../common/GP1_defaults_nws_syn.g
//include ../common/simdefaults.g
//include ../common/simdefaults_NaF_art.g
include ../common/simdefaults_synBack.g
/* COMMENT
ALL intrinsic model params have now been initialized and set.
They can be safely overwritten any time between now and the calling of
the make_GP_library file. Once the library has been created, parameter values
are set and cannot be changed except with explicit calls to setfield.
*/
int i
str tstr, hstr, readcompartment
//PARAMETERS:
float stimType = //set from parameter file
// 1, 2, 3, 4, or 5 for CIP, uniform EXC synaptic, uniform INH synaptic, weighted EXC synaptic, weighted INH synaptic
float stimMag = //set from parameter file
// in pA if CIP or pS if synaptic
float stimInterval = //set from parameter file
float stimDur = //set from parameter file
// unneccessary if stimType is synaptic
float stimComptsIdx = //set from parameter file
// a number reflecting a list of compartments receiving the stimulus
// (either soma, or a subset of dendritic compts)
//float modelType = {getarg {arglist {parrow}} -arg 6}
float modelType = 3
// 1 or 2 for nonspiking or spiking
float currentComptsIdx = //set from parameter file
// a number reflecting the grouping of compartment conductances to be saved
// 1 for FULL, 2 for THIRDS, 3 for SUB, etc.
float voltageComptsIdx = //set from parameter file
// a number reflecting the group of compartment voltages to be saved
float HVA_PRC_scalefac = //set from parameter file
float SK_PRC_scalefac = //set from parameter file
//float KV4F_PRC_scalefac = {getarg {arglist {parrow}} -arg 11}
float KV4F_PRC_scalefac = 1
//float KV4S_PRC_scalefac = {getarg {arglist {parrow}} -arg 12}
float KV4S_PRC_scalefac = 1
float store_mode = //set from parameter file
store_mode = 2
STN_rate = //set from parameter file
striatum_rate = //set from parameter file
// 0 is asynchronous and 1 is synchronous
//float synBack_synch = {getarg {arglist {parrow}} -arg 14}
float synBack_synch = 0
float spikeIdx = //set from parameter file
//spikeIdx = ({spikeIdx}+25)
float syngain = //set from parameter file
float NaF_base = //set from parameter file
float NaP_base = //set from parameter file
float KV2_base = //set from parameter file
//float KV3_base = {KV2_base}
float KV3_base = //set from parameter file
//KV3_base = ({KV2_base}*10)
float KV4_base = //set from parameter file
// Start with 75
float HVA_base = //set from parameter file
float SK_base = //set from parameter file
float KCNQ_base = //set from parameter file
float spiCurDist = //set from parameter file
//float spiCurDist = 11.11111
spiCurDist = ({spiCurDist}/100)
float dendSpiCurMult = //set from parameter file
float NaPdendmult = //set from parameter file
//float NaISMult = {getarg {arglist {parrow}} -arg 25}
float NaISMult = 57
//float KdrISMult = {getarg {arglist {parrow}} -arg 26}
float KdrISMult = 40
float SKsomaMult = //set from parameter file
float SKdendMult = //set from parameter file
//float NaF_dq10_m = {getarg {arglist {parrow}} -arg 22}
float NaF_dq10_m = .25
float dq10_NaF_m = {NaF_dq10_m}
//float NaF_dq10_h1 = {getarg {arglist {parrow}} -arg 23}
float NaF_dq10_h1 = .6667
float dq10_NaF_h1 = {NaF_dq10_h1}
//float NaF_dq10_h2 = {getarg {arglist {parrow}} -arg 24}
float NaF_dq10_h2 = 1
float dq10_NaF_h2 = {NaF_dq10_h2}
//float KV2_taunDiv = {getarg {arglist {parrow}} -arg 26}
float KV2_taunDiv = 1
//float KV3_taunDiv = {getarg {arglist {parrow}} -arg 27}
float KV3_taunDiv = 1
//float KV4_taunDiv = {getarg {arglist {parrow}} -arg 28}
float KV4_taunDiv = 1
//float Eshift = {getarg {arglist {parrow}} -arg 28}
//float Eshift = 0
float Eshift = {getarg {arglist {parrow}} -arg 28}
echo
echo Eshift is {Eshift} mV
echo
Eshift = {Eshift}/1000
//float constcurr_loc = {getarg {arglist {parrow}} -arg 28}
float constcurr_loc = 1
//float NaPdendmult = {getarg {arglist {parrow}} -arg 27}
E_AMPA = 0+{Eshift}
E_NMDA = 0+{Eshift}
E_GABA = -0.080+{Eshift}
float GsynMult = 0
float Esyn = -0.06
float Rmembr = {RM_sd}
float Gcomb = ({GsynMult}+1)*(1/{Rmembr})
float Ecomb = ({ELEAK_sd}+{GsynMult}*{Esyn})/({GsynMult}+1)
RM_sd = 1/{Gcomb}
//RM_ax = 1/{Gcomb}
ELEAK_sd = {Ecomb}
//ELEAK_ax = {Ecomb}
echo
echo spikeidx {spikeIdx}
echo syngain {syngain}
echo
include ../common/calc_syn_integ.g
float unitary_gSTN = {calc_syn_integ 250 .001 .003}
echo unitary_gSTN is {unitary_gSTN}
float unitary_gSTR = {calc_syn_integ 250 .0005 .00491}
echo unitary_gSTR is {unitary_gSTR}
//quit
float snapgate = 0
if ({snapgate}==1)
str out_dir = "/data/snapshots/simData_synGrid_alldata/"
str spktime_dest_dir = "/data/snapshots/spiketimes_synGrid_alldata/"
mkdir {spktime_dest_dir}
mkdir {out_dir}
else
str out_dir = "/data/simData_synGrid_alldata/"
str spktime_dest_dir = "/data/spiketimes_synGrid_alldata/"
mkdir {spktime_dest_dir}
mkdir {out_dir}
end
if ({store_mode}==1)
str strStoreMode = "currents_"
end
if ({store_mode}==2)
str strStoreMode = "conductances_"
end
// use conductance scalefacs from par file to set multipliers
include ../common/g_mult_PRC2
// Nonspiking or spiking model? Include appropriate passive or active parameters:
if ({modelType}==1)
include ../common/paspars.g
str strModel = "_nonspiking_"
end
if ({modelType}==2)
include ../common/actpars.g
str strModel = "_spiking_"
end
if ({modelType}==3)
// include ../common/varpars_newGP_dendNaP.g
include ../common/varpars_GPbase_synback.g
str strModel = "_GPbase_"
end
// stimComptsNum reflects the number of compartments receiving a stimulus
float stimComptsNum
if ({stimComptsIdx}==1)
include ../common/stimComptsIdxs1toTen
else
include ../common/stimComptsIdxs11toSeventeen
end
if ({stimType}==1)
str strStim = "_cipStim_"
end
if ({stimType}==2)
str strStim = "_EXCsynStim_"
end
if ({stimType}==3)
str strStim = "_INHsynStim_"
end
// include list of control spike times for calculation of stimTimes:
//include ../common/dendComptGroups/control_spikeTimes_PRC
//include ../common/dendComptGroups/control_spikeTimes_dendComptGroups
//include ../common/control_spikeTimes_GPbase_synback_oscillator
//include ../common/control_spikeTimes_GPbase_synback_Eshift
//include ../common/control_spikeTimes_synback_Eshift_CNS09_paper2
include ../common/control_spikeTimes_synback_synGrid
// if CIP stimulus:
if ({stimType}==1)
float cip = {stimMag}
cip = {cip}/{stimComptsNum}
float cipTime = {{spike1time}+{{({stimInterval}-1)}*{({spike2time}-{spike1time})}/72}}
echo
echo Stimulus time is {cipTime}
float cipDur = {stimDur}
echo The current injected into each compartment of {strStimLoc} is {cip} pA
echo
else
//if synaptic stimulation:
float Gmax_PRC = {stimMag}
Gmax_PRC = {Gmax_PRC}/((1e12)*{stimComptsNum})
float synTime = {spike1time} + {{({stimInterval}-1)}*{({spike2time}-{spike1time})}/72}
end
// Now that all params have been established, create library objects.
// Intrinsic params should be left alone from this point forward.
echo
echo cci is {currentComptsIdx}
echo
include ../common/make_GP_library_NaF_art.g
//filename based on variable parameters (don't include path!)
if ({stimType}==1)
if ({stimMag}==0)
str basefilename = {stimMag} @ "_pA_" @ {strStimLoc} @ {spikeIdx} @ "_spikeIdx_" @ {syngain} @ "_syngain_" @ {STN_rate} @ "_STNrate_" @ {striatum_rate} @ "_STRIATUMrate_" @ {spiCurDist} @ "_dist_" @ {Eshift} @ "_Eshift_" @ {dendSpiCurMult} @ "_dendIspikeMult_" @ {NaPdendmult} @ "_NaPdendmult_" @ {SKsomaMult} @ "_SKsomaX_" @ {SKdendMult} @ "_SKdendX_" @ {stimType} @ {strStim} @ "GPbase_baseModels_SynBackControl_"
else
str basefilename = {pad_num_gen {stimInterval} 3} @ "_stimInt_" @ {stimMag} @ "_pA_" @ {cipTime} @ "_msTime_" @ {cipDur} @ "_msDur" @ {strStimLoc} @ {spikeIdx} @ "_spikeIdx_" @ {syngain} @ "_syngain_" @ {STN_rate} @ "_STNrate_" @ {striatum_rate} @ "_STRIATUMrate_" @ {spiCurDist} @ "_dist_" @ {Eshift} @ "_Eshift_" @ {dendSpiCurMult} @ "_dendIspikeMult_" @ {NaPdendmult} @ "_NaPdendmult_" @ {SKsomaMult} @ "_SKsomaX_" @ {SKdendMult} @ "_SKdendX_" @ {stimType} @ {strStim} @ "GPbase_baseModels_SynBack_"
end
end
if (! ({stimType}==1))
if ({stimMag}==0)
str basefilename = {stimMag} @ "_pS_" @ {strStimLoc} @ {spikeIdx} @ "_spikeIdx_" @ {syngain} @ "_syngain_" @ {STN_rate} @ "_STNrate_" @ {striatum_rate} @ "_STRIATUMrate_" @ {spiCurDist} @ "_dist_" @ {Eshift} @ "_Eshift_" @ {dendSpiCurMult} @ "_dendIspikeMult_" @ {NaPdendmult} @ "_NaPdendmult_" @ {SKsomaMult} @ "_SKsomaX_" @ {SKdendMult} @ "_SKdendX_" @ {stimType} @ {strStim} @ "GPbase_baseModels_SynBackControl_"
else
str basefilename = {pad_num_gen {stimInterval} 3} @ "_stimInt_" @ {stimMag} @ "_pS_" @ {synTime} @ "_msTime_" @ {stimDur} @ "_msDur" @ {strStimLoc} @ {spikeIdx} @ "_spikeIdx_" @ {syngain} @ "_syngain_" @ {STN_rate} @ "_STNrate_" @ {striatum_rate} @ "_STRIATUMrate_" @ {spiCurDist} @ "_dist_" @ {Eshift} @ "_Eshift_" @ {dendSpiCurMult} @ "_dendIspikeMult_" @ {NaPdendmult} @ "_NaPdendmult_" @ {SKsomaMult} @ "_SKsomaX_" @ {SKdendMult} @ "_SKdendX_" @ {stimType} @ {strStim} @ "GPbase_baseModels_SynBack_"
end
end
if ({currentComptsIdx}==4)
str strCurrentsLoc = {currentComptsIdx} @ "_dend1" @ {strStoreMode}
str strCaLoc = {currentComptsIdx} @ "_dend1calcium_"
end
if ({currentComptsIdx}==5)
str strCurrentsLoc = {currentComptsIdx} @ "_dend2" @ {strStoreMode}
str strCaLoc = {currentComptsIdx} @ "_dend2calcium_"
end
if ({currentComptsIdx}==6)
str strCurrentsLoc = {currentComptsIdx} @ "_dend3" @ {strStoreMode}
str strCaLoc = {currentComptsIdx} @ "_dend3calcium_"
end
if ({voltageComptsIdx}==1)
str strVoltagesLoc = {voltageComptsIdx} @ "_somaVm_"
end
if ({voltageComptsIdx}==2)
str strVoltagesLoc = {voltageComptsIdx} @ "_stimlocVms_"
end
if ({voltageComptsIdx}==3)
str strVoltagesLoc = {voltageComptsIdx} @ "_dend1voltages_"
end
if ({voltageComptsIdx}==4)
str strVoltagesLoc = {voltageComptsIdx} @ "_dend2voltages_"
end
if ({voltageComptsIdx}==5)
str strVoltagesLoc = {voltageComptsIdx} @ "_dend3voltages_"
end
echo {basefilename}
str filename_v = {basefilename} @ {strVoltagesLoc} @ "v.bin"
str filename_gtot = {basefilename} @ {strCurrentsLoc} @ "itot.bin"
str filename_ca = {basefilename} @ {strCaLoc} @ "ca.bin"
str filename_gsyns = {basefilename} @ "_gsyns.bin"
str filename_mhhnn = {basefilename} @ "mhhnn.bin"
dt = 2e-5
if ({snapgate}==1)
dt = 1e-5
echo
echo This should not be happening except for snapshot simulations!!!!!!!
echo
end
//set up clocks
setclock 0 {dt} // simulation
//output set to 1e-4 under normal circumstances
setclock 1 {1e-4} // output
//rundur = 13.5 // simulation length
//rundur = {({spike6time}/1000)+(.05)}
rundur=1
if ({snapgate}==1)
rundur = 10
end
if (({snapgate}==0) & ({stimMag}==0))
rundur = 2
end
//load compartments with ion channels
//if ({currentComptsIdx}==1)
// readcell ../common/GP1/GP1_FULLdendsort.p {cellpath} -hsolve
//end
//if ({currentComptsIdx}==2)
// readcell ../common/GP1/GP1_THIRDSdendsort.p {cellpath} -hsolve
//end
//if ({currentComptsIdx}==3)
// readcell ../common/GP1/GP1_SUBdendsort.p {cellpath} -hsolve
//end
if (({currentComptsIdx}>=4) & ({currentComptsIdx}<=6))
readcell ../common/GP1_dendComptGroups.p {cellpath} -hsolve
end
//add synapses to appropriate compartments
include ../common/read_STN_nocluster_ratescaled_nws_Kopell
/*
if ({currentComptsIdx}==1)
include ../common/read_clusters_FULLdendsort
end
if ({currentComptsIdx}==2)
include ../common/read_clusters_THIRDSdendsort
end
if ({currentComptsIdx}==3)
include ../common/read_clusters_SUBdendsort
end
if (({currentComptsIdx}>=4) & ({currentComptsIdx}<=6))
include ../common/read_clusters_dendComptGroups
end
*/
include ../common/read_striatum_syns_ratescaled_nws_Kopell
include ../common/add_pallidum_syns
create pulsegen /constantcurrent
setfield /constantcurrent \
level1 {0e-12} \
width1 11 \
delay1 0 \
delay2 50 \
baselevel 0 \
trig_mode 0
str readcompartment
if ({constcurr_loc}==1)
str constcurr_filename = "../common/comptlists/constcurr_soma.txt"
end
if ({constcurr_loc}==2)
str constcurr_filename = "../common/comptlists/constcurr_axIS.txt"
end
openfile {constcurr_filename} r
readcompartment = {readfile {constcurr_filename}}
while (! {eof {constcurr_filename}})
addmsg /constantcurrent {cellpath}/{readcompartment} INJECT output
readcompartment = {readfile {constcurr_filename}}
end
closefile {constcurr_filename}
//set up current injection
if ({stimType}==1)
create pulsegen /pulse
setfield /pulse \
level1 {{cip}*1e-12} \
width1 {{cipDur}*1e-3} \
delay1 {{cipTime}*1e-3} \
delay2 50 \
baselevel 0 \
trig_mode 0
// NWS: add msg with while loop to distribute CIP
str readcompartment
if ({stimComptsIdx}==1)
str CIPfilename = "../common/comptlists/nws_soma_only.txt"
end
if ({stimComptsIdx}==2)
str CIPfilename = "../common/comptlists/nws_proximal_FULLdendcompts.txt"
end
if ({stimComptsIdx}==3)
str CIPfilename = "../common/comptlists/nws_mid_FULLdendcompts.txt"
end
if ({stimComptsIdx}==4)
str CIPfilename = "../common/comptlists/nws_distal_FULLdendcompts.txt"
end
if ({stimComptsIdx}==5)
str CIPfilename = "../common/comptlists/nws_proximal_THIRDSdendcompts.txt"
end
if ({stimComptsIdx}==6)
str CIPfilename = "../common/comptlists/nws_mid_THIRDSdendcompts.txt"
end
if ({stimComptsIdx}==7)
str CIPfilename = "../common/comptlists/nws_distal_THIRDSdendcompts.txt"
end
if ({stimComptsIdx}==8)
str CIPfilename = "../common/comptlists/nws_proximal_SUBdendcompts.txt"
end
if ({stimComptsIdx}==9)
str CIPfilename = "../common/comptlists/nws_mid_SUBdendcompts.txt"
end
if ({stimComptsIdx}==10)
str CIPfilename = "../common/comptlists/nws_distal_SUBdendcompts.txt"
end
if ({stimComptsIdx}==11)
str CIPfilename = "../common/comptlists/dend1_proximal25compts.txt"
end
if ({stimComptsIdx}==12)
str CIPfilename = "../common/comptlists/dend1_distal25compts.txt"
end
if ({stimComptsIdx}==13)
str CIPfilename = "../common/comptlists/dend2_proximal25compts.txt"
end
if ({stimComptsIdx}==14)
str CIPfilename = "../common/comptlists/dend2_distal25compts.txt"
end
if ({stimComptsIdx}==15)
str CIPfilename = "../common/comptlists/dend3_proximal25compts.txt"
end
if ({stimComptsIdx}==16)
str CIPfilename = "../common/comptlists/dend3_mid25compts.txt"
end
if ({stimComptsIdx}==17)
str CIPfilename = "../common/comptlists/dend3_distal25compts.txt"
end
openfile {CIPfilename} r
readcompartment = {readfile {CIPfilename}}
while (! {eof {CIPfilename}})
addmsg /pulse {cellpath}/{readcompartment} INJECT output
readcompartment = {readfile {CIPfilename}}
end
closefile {CIPfilename}
end
//default valence (not used with CIP)
if ({stimType}==1)
str valence = "AMPA"
end
if ({stimType}==2 || {stimType}==4)
str valence = "AMPA"
end
if ({stimType}==3 || {stimType}==5)
str valence = "GABA"
end
if ({stimType}==1)
include ../common/PRCsynDend_CIP
else
include ../common/PRCsynDend
end
silent -1
//set up hines solver
setfield {cellpath} \
path {cellpath}/##[][TYPE=compartment] \
comptmode 1 \
chanmode 4 \
calcmode 0 \
outclock 1 \
storemode {store_mode}
call {cellpath} SETUP
setmethod 11
//set up outputs
create disk_out /out_v
useclock /out_v 1
setfield /out_v filename {{out_dir} @ {filename_v}} flush 0 append 0 leave_open 1
create disk_out /out_gsyns
useclock /out_gsyns 1
setfield /out_gsyns filename {{out_dir} @ {filename_gsyns}} flush 0 append 0 leave_open 1
// NWS for simulations with tiny timestep when itot isn't needed, comment out:
create disk_out /out_gtot
useclock /out_gtot 1
setfield /out_gtot filename {{out_dir} @ {filename_gtot}} flush 0 append 0 leave_open 1
create disk_out /out_ca
useclock /out_ca 1
setfield /out_ca filename {{out_dir} @ {filename_ca}} flush 0 append 0 leave_open 1
/*
//save Vm of selected compartments to file: soma, axon, dends
int n
openfile {outputcompsfname} r
readcompartment = {readfile {outputcompsfname}}
while (! {eof {outputcompsfname}})
hstr={findsolvefield {cellpath} {cellpath}/{readcompartment} Vm}
addmsg {cellpath} /out_v SAVE {hstr}
readcompartment = {readfile {outputcompsfname}}
end
closefile {outputcompsfname}
*/
// Save Vm for a sample of compartments
if ({voltageComptsIdx}==1)
str voltageCompts = "../common/comptlists/nws_soma_only.txt"
str calciumCompts = "../common/comptlists/nws_soma_only.txt"
end
if ({voltageComptsIdx}==2)
str voltageCompts = "../common/comptlists/nws_stimloc_subset.txt"
str calciumCompts = "../common/comptlists/nws_noCaConc_in_ax.txt"
end
if ({voltageComptsIdx}==3)
str voltageCompts = "../common/comptlists/save_dend1voltageCompts.txt"
str calciumCompts = "../common/comptlists/save_dend1calciumCompts.txt"
end
if ({voltageComptsIdx}==4)
str voltageCompts = "../common/comptlists/save_dend2voltageCompts.txt"
str calciumCompts = "../common/comptlists/save_dend2calciumCompts.txt"
end
if ({voltageComptsIdx}==5)
str voltageCompts = "../common/comptlists/save_dend3voltageCompts.txt"
str calciumCompts = "../common/comptlists/save_dend3calciumCompts.txt"
end
openfile {voltageCompts} r
readcompartment = {readfile {voltageCompts}}
while(! {eof {voltageCompts}})
// Vm
hstr={findsolvefield {cellpath} {cellpath}/{readcompartment} Vm}
addmsg {cellpath} /out_v SAVE {hstr}
// Gsyn
//hstr={findsolvefield {cellpath} {cellpath}/{readcompartment}/AMPA Gk}
//addmsg {cellpath} /out_gsyns SAVE {hstr}
// Get next compt name
readcompartment = {readfile {voltageCompts}}
end
/*
USED THIS FOR POST-KOPELL WORKSHOP
create disk_out /out_mhhnn
useclock /out_mhhnn 1
setfield /out_mhhnn filename {{out_dir} @ {filename_mhhnn}} flush 0 append 0 leave_open 1
hstr = {findsolvefield {cellpath} {cellpath}/soma Vm}
addmsg {cellpath} /out_mhhnn SAVE {hstr}
//echo {showfield {cellpath}/soma *}
//echo {le {cellpath}/soma/ *}
//echo {showfield {cellpath}/soma/Na_fast_GP_somahill *}
hstr = {findsolvefield {cellpath} {cellpath}/soma/Na_fast_GP_somahill X}
addmsg {cellpath} /out_mhhnn SAVE {hstr}
hstr = {findsolvefield {cellpath} {cellpath}/soma/Na_fast_GP_somahill Y}
addmsg {cellpath} /out_mhhnn SAVE {hstr}
hstr = {findsolvefield {cellpath} {cellpath}/soma/Na_fast_GP_somahill Z}
addmsg {cellpath} /out_mhhnn SAVE {hstr}
hstr = {findsolvefield {cellpath} {cellpath}/soma/Kv3_GP_somahill X}
addmsg {cellpath} /out_mhhnn SAVE {hstr}
hstr = {findsolvefield {cellpath} {cellpath}/soma/Kv2_GP_somahill X}
addmsg {cellpath} /out_mhhnn SAVE {hstr}
*/
create neutral /PRCspiketimes
create spikegen /PRCspiketimes/soma_spikegen
setfield /PRCspiketimes/soma_spikegen \
output_amp 1 thresh 0 abs_refract .002
hstr={findsolvefield {cellpath} {cellpath}/soma Vm}
addmsg {cellpath} /PRCspiketimes/soma_spikegen INPUT {hstr}
create spikehistory /PRCspiketimes/soma_spikehistory
setfield /PRCspiketimes/soma_spikehistory \
filename {{spktime_dest_dir} @ {basefilename} @ "spikehistory.asci"} \
initialize 1 leave_open 1 flush 1 ident_toggle 1
addmsg /PRCspiketimes/soma_spikegen /PRCspiketimes/soma_spikehistory SPIKESAVE
call /PRCspiketimes/soma_spikehistory RESET
echo {showfield /PRCspiketimes/soma_spikehistory *}
//IF WE DO THE 'ENTRAINMENT TO PERIODIC STN INPUT EXPERIMENT', THIS WILL GET USED
// Save Gsyn AND Vm for every STN synapse to file
openfile {STNfilename} r
readcompartment = {readfile {STNfilename}}
while(! {eof {STNfilename}})
// Vm
hstr={findsolvefield {cellpath} {cellpath}/{readcompartment} Vm}
addmsg {cellpath} /out_v SAVE {hstr}
// Gsyn
hstr={findsolvefield {cellpath} {cellpath}/{readcompartment}/AMPA Gk}
addmsg {cellpath} /out_gsyns SAVE {hstr}
// Get next compt name
readcompartment = {readfile {STNfilename}}
end
// save the selected total conductances or currents into filename_g
// commented out when not saving itot
/*
if ({currentComptsIdx}==4)
// stimulus to dendrite 1
for(i=0; i<=0; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
for(i=71; i<=92; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
for(i=106; i<=117; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
end
if ({currentComptsIdx}==5)
//stimulus to dendrite 2
for(i=0; i<=0; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
for(i=49; i<=70; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
for(i=106; i<=117; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
end
if ({currentComptsIdx}==6)
// stimulus to dendrite 3
for(i=0; i<=0; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
for(i=14; i<=48; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
for(i=106; i<=117; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
end
*/
//for all currents (throughout dendrite) from dendComptGroups:
for(i=0; i<=117; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
/*
//This block of channels to save in itot works for dend3_distal (prior to dendComptGroups)
for(i=0; i<=0; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
for(i=14; i<=48; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
for(i=62; i<=73; i=i+1)
addmsg {cellpath} /out_gtot SAVE itotal[{i}]
end
*/
openfile {calciumCompts} r
readcompartment = {readfile {calciumCompts}}
while(! {eof {calciumCompts}})
// Ca++
hstr={findsolvefield {cellpath} {cellpath}/{readcompartment}/Ca_GP_conc Ca}
addmsg {cellpath} /out_ca SAVE {hstr}
// Get next compt name
readcompartment = {readfile {calciumCompts}}
end
if ({modelType}==1)
if ({currentComptsIdx}==1)
str snapshotname = "../common/snapshots/nonspiking_FULLdendsort_snapshot.save"
end
if ({currentComptsIdx}==2)
str snapshotname = "../common/snapshots/nonspiking_THIRDSdendsort_snapshot.save"
end
if ({currentComptsIdx}==3)
str snapshotname = "../common/snapshots/nonspiking_SUBdendsort_snapshot.save"
end
if (({currentComptsIdx}>=4) & ({currentComptsIdx}<=6))
str snapshotname = "../common/snapshots/dendComptGroups/synBack/Kopell/Kopell_nonspiking" @ {strStimLoc} @ {HVA_PRC_scalefac} @ "_xHVA_" @ {SK_PRC_scalefac} @ "_xSK_" @ {STN_rate} @ "_HzSTN_" @ {striatum_rate} @ "_HzSTR_" @ {synBack_synch} @ "_synch_snapshot.save"
end
end
if ({modelType}==2)
if ({currentComptsIdx}==1)
str snapshotname = "../common/snapshots/spiking_FULLdendsort_snapshot.save"
end
if ({currentComptsIdx}==2)
str snapshotname = "../common/snapshots/spiking_THIRDSdendsort_snapshot.save"
end
if ({currentComptsIdx}==3)
str snapshotname = "../common/snapshots/spiking_SUBdendsort_snapshot.save"
end
if (({currentComptsIdx}>=4) & ({currentComptsIdx}<=6))
str snapshotname = "../common/snapshots/dendComptGroups/synBack/spiking" @ {strStimLoc} @ {HVA_PRC_scalefac} @ "_xHVA_" @ {SK_PRC_scalefac} @ "_xSK_" @ {STN_rate} @ "_HzSTN_" @ {striatum_rate} @ "_HzSTR_" @ {synBack_synch} @ "_synch_" @ "snapshot.save"
end
end
if ({modelType}==3)
if (({currentComptsIdx}>=4) & ({currentComptsIdx}<=6))
str snapshotname = "../common/snapshots/GP" @ {strStimLoc} @ {syngain} @ "_syngain_" @ {STN_rate} @ "_STNrate_" @ {striatum_rate} @ "_STRIATUMrate_" @ {spiCurDist} @ "_dist_" @ {Eshift} @ "_Eshift_" @ {dendSpiCurMult} @ "_dendIspikeMult_" @ {NaPdendmult} @ "_NaPdendmult_" @ {SKsomaMult} @ "_SKsomaX_" @ {SKdendMult} @ "_SKdendX" @ {strStim} @ "synback_baseModels_snapshot.save"
end
end
echo
echo Snapshot to be made or used by this simulation is
echo {snapshotname}
echo
include ../common/snapshotGP_nws
/* for getting axial resistance of each compt:
str thiscompt
foreach thiscompt ({el {cellpath}/##[][OBJECT=compartment]})
echo {thiscompt} {getfield {thiscompt} Ra}
end
quit
*/
/* for getting surface areas of each compt:
str thiscompt
foreach thiscompt ({el {cellpath}/##[][OBJECT=compartment]})
echo {thiscompt} {({getfield {thiscompt} len})*({getfield {thiscompt} dia})*3.141592653589793}
end
quit
*/
include ../common/spiCurDist_echoDist.g
/*
echo somaNaFGbar {getfield /GP/soma/Na_fast_GP_somahill Gbar}
echo somaNaSGbar {getfield /GP/soma/Na_slow_GP_somahill Gbar}
echo somaKV3Gbar {getfield /GP/soma/Kv3_GP_somahill Gbar}
echo somaKV2Gbar {getfield /GP/soma/Kv2_GP_somahill Gbar}
echo somaRM {getfield /GP/soma Rm}
echo somaCM {getfield /GP/soma Cm}
*/
if ({snapgate}==1)
reset
step {rundur} -time
take_snapshot
//compress data files
// str filename_v_c = {compress_data_file {{out_dir} @ {filename_v}}}
// str filename_gtot_c = {compress_data_file {{out_dir} @ {filename_gtot}}}
// str filename_ca_c = {compress_data_file {{out_dir} @ {filename_ca}}}
// Copy file from temporary location (on nodes) to desired location (on /scratch)
// mv {filename_v_c} {dest_dir}
// mv {filename_gtot_c} {dest_dir}&
// mv {filename_ca_c} {dest_dir}&
quit
else
//run the simulation
reset
restore_snapshot
step {rundur} -time
//compress data files
// str filename_v_c = {compress_data_file {{out_dir} @ {filename_v}}}
// str filename_gtot_c = {compress_data_file {{out_dir} @ {filename_gtot}}}
// str filename_ca_c = {compress_data_file {{out_dir} @ {filename_ca}}}
// Copy file from temporary location (on nodes) to desired location (on /scratch)
// mv {filename_v_c} {dest_dir}
// mv {filename_gtot_c} {dest_dir}&
// mv {filename_ca_c} {dest_dir}&
quit
end