-
Notifications
You must be signed in to change notification settings - Fork 1
/
main-i6sBKSK-tnew.hoc
1229 lines (1143 loc) · 37.4 KB
/
main-i6sBKSK-tnew.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
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
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
// Initialize
create soma, iseg, axon[1], myelin[1], node[1], iseg, nodes[1], nodec[1], myelinc[1], term
//================================================================================
func var_defined(){
if( name_declared( $s1 ) == 5 ) return 1
return 0
}
//-------------------------------------------------------------------------------
objref synL, synNL // list of synapses (and their section Names)
ifn=5
proc do_cell(){ local i localobj syn //, str
forall delete_section()
//
if (ifn==1) {
load_file( 1, "Zone1s.hoc" )
nodes[0] {diam(0:1)=3.67:1.216 L=1 nseg=1}
nodes[1] {diam(0:1)=3.67:1.216 L=1 nseg=1}
forsec "nodec" {diam=1.216 L=1 nseg=1}
forsec "myelinc" {diam=1.216 L=125 nseg=3}
term {diam=1.216 L=200 nseg=5}
myelinc[0].L=50
aXm_cm=0.02
aXm_Rm=60000
soma_cm=0.05
soma_Rm=24000
}
if (ifn==2) {
load_file( 1, "Zone2s.hoc" )
nodes[0] {diam=4.326 L=1 nseg=1}
nodes[1] {diam(0:1)=4.326:1.85 L=1 nseg=1}
myelin[1] {diam=2.15 L=215 nseg=3}
node[1] {diam=2.15 L=1 nseg=1}
forsec "nodec" {diam=1.85 L=1 nseg=1}
forsec "myelinc" {diam=1.85 L=200 nseg=3}
term {diam=1.85 L=200 nseg=5}
myelinc[0].L=150
aXm_cm=0.01
aXm_Rm=120000
soma_cm=0.04
soma_Rm=30000
}
if (ifn==5) {
load_file( 1, "Zone5s.hoc" )
nodes[0] {diam=1.23 L=1 nseg=1}
nodes[1] {diam=1.23 L=1 nseg=1}
forsec "nodec" {diam=1.1 L=1 nseg=1}
forsec "myelinc" {diam=1.1 L=110 nseg=3}
term {diam=1.1 L=200 nseg=5}
myelinc[0].L=20
aXm_cm=0.02
aXm_Rm=60000
soma_cm=0.05
soma_Rm=24000
}
//
if (ifn==72) {
load_file( 1, "Zone4_72.hoc" )
nodes[0] {diam(0:1)=2.5:1.512 L=1 nseg=1}
nodes[1] {diam(0:1)=2.0:1.7 L=1 nseg=1}
forsec "nodec" {diam=1.7 L=1 nseg=1}
forsec "myelinc" {diam=1.7 L=170 nseg=3}
term {diam=1.8 L=200 nseg=5}
myelinc[0].L=90
aXm_cm=0.01
aXm_Rm=120000
soma_cm=0.04
soma_Rm=30000
}
access axon[0] // axon[0] is just before the first branch point
distance()
forall {
insert pas
}
forsec "bouton" {
if( var_defined( "Gbar_Nav16_b")) insert Nav16
if( var_defined( "Gbar_Kv31_b")) insert Kv31
if( var_defined( "Gbar_Kv3s_b")) insert Kv3s
if( var_defined( "Gbar_Kv12_b")) insert Kv12
if( var_defined( "Gbar_Kv43A_b")) insert Kv43A
if( var_defined( "Gbar_Kv7M_b")) insert Kv7M
if( var_defined( "Gbar_H_HCNl_b")) insert H_HCNl
if( var_defined( "Gbar_ab4BK2_b")) insert ab4BK2
if( var_defined( "Pbar_caL_b")) insert caL
if( var_defined( "Gbar_ab4BK2_b")) insert cdp
if( var_defined( "Gbar_SK_b")) insert SK
}
forsec "soma" {
if( var_defined( "Gbar_Nav16_s")) insert Nav16
if( var_defined( "Gbar_Kv31_s")) insert Kv31
if( var_defined( "Gbar_Kv3s_s")) insert Kv3s
if( var_defined( "Gbar_Kv12_s")) insert Kv12
if( var_defined( "Gbar_Kv43A_s")) insert Kv43A
if( var_defined( "Gbar_Kv7M_s")) insert Kv7M
if( var_defined( "Gbar_H_HCNl_s")) insert H_HCNl
if( var_defined( "Gbar_ab4BK2_s")) insert ab4BK2
if( var_defined( "Pbar_caL_s")) insert caL
if( var_defined( "Gbar_ab4BK2_s")) insert cdp13
if( var_defined( "Gbar_SK_s")) insert SK
}
forsec "axon" {
if( var_defined( "Gbar_Nav16_a")) insert Nav16
if( var_defined( "Gbar_Kv31_a")) insert Kv31
if( var_defined( "Gbar_Kv3s_a")) insert Kv3s
if( var_defined( "Gbar_Kv12_a")) insert Kv12
if( var_defined( "Gbar_Kv43A_a")) insert Kv43A
if( var_defined( "Gbar_Kv7M_a")) insert Kv7M
if( var_defined( "Gbar_H_HCNl_a")) insert H_HCNl
if( var_defined( "Gbar_ab4BK2_a")) insert ab4BK2
if( var_defined( "Pbar_caL_a")) insert caL
if( var_defined( "Gbar_ab4BK2_a")) insert cdp
if( var_defined( "Gbar_SK_a")) insert SK
}
forsec "iseg" {
if( var_defined( "Gbar_Nav16_i")) insert Nav16
if( var_defined( "Gbar_Kv31_i")) insert Kv31
if( var_defined( "Gbar_Kv3s_i")) insert Kv3s
if( var_defined( "Gbar_Kv12_i")) insert Kv12
if( var_defined( "Gbar_Kv43A_i")) insert Kv43A
if( var_defined( "Gbar_Kv7M_i")) insert Kv7M
if( var_defined( "Gbar_H_HCNl_i")) insert H_HCNl
if( var_defined( "Gbar_ab4BK2_i")) insert ab4BK2
if( var_defined( "Pbar_caL_i")) insert caL
if( var_defined( "Gbar_ab4BK2_i")) insert cdp
if( var_defined( "Gbar_SK_i")) insert SK
}
forsec "myelin" {
if( var_defined( "Gbar_Nav16_m")) insert Nav16
if( var_defined( "Gbar_Kv31_m")) insert Kv31
if( var_defined( "Gbar_Kv3s_m")) insert Kv3s
if( var_defined( "Gbar_Kv12_m")) insert Kv12
if( var_defined( "Gbar_Kv43A_m")) insert Kv43A
if( var_defined( "Gbar_Kv7M_m")) insert Kv7M
if( var_defined( "Gbar_H_HCNl_m")) insert H_HCNl
if( var_defined( "Gbar_ab4BK2_m")) insert ab4BK2
if( var_defined( "Pbar_caL_m")) insert caL
if( var_defined( "Gbar_ab4BK2_m")) insert cdp
if( var_defined( "Gbar_SK_m")) insert SK
}
forsec "node" {
if( var_defined( "Gbar_Nav16_n")) insert Nav16
if( var_defined( "Gbar_Kv31_n")) insert Kv31
if( var_defined( "Gbar_Kv3s_n")) insert Kv3s
if( var_defined( "Gbar_Kv12_n")) insert Kv12
if( var_defined( "Gbar_Kv43A_n")) insert Kv43A
if( var_defined( "Gbar_Kv7M_n")) insert Kv7M
if( var_defined( "Gbar_H_HCNl_n")) insert H_HCNl
if( var_defined( "Gbar_ab4BK2_n")) insert ab4BK2
if( var_defined( "Pbar_caL_n")) insert caL
if( var_defined( "Gbar_ab4BK2_n")) insert cdp
if( var_defined( "Gbar_SK_n")) insert SK
}
forsec "term" {
if( var_defined( "Gbar_Nav16_t")) insert Nav16
if( var_defined( "Gbar_Kv31_t")) insert Kv31
if( var_defined( "Gbar_Kv3s_t")) insert Kv3s
if( var_defined( "Gbar_Kv12_t")) insert Kv12
if( var_defined( "Gbar_Kv43A_t")) insert Kv43A
if( var_defined( "Gbar_Kv7M_t")) insert Kv7M
if( var_defined( "Gbar_H_HCNl_t")) insert H_HCNl
if( var_defined( "Gbar_ab4BK2_t")) insert ab4BK2
if( var_defined( "Pbar_caL_t")) insert caL
if( var_defined( "Gbar_ab4BK2_t")) insert cdp
if( var_defined( "Gbar_SK_t")) insert SK
}
synL = new List() // synapse List
// synNL = new List()
forsec "bouton" {
// str = new str_obj()
// synNL.append( str.sPrint( "%s", secname() ))
syn = new ribbon1( 0.5 ) // create synapse
syn.xp = x3d(0.5) syn.yp= y3d(0.5) syn.zp= z3d(0.5)
syn.dist=distance(0.5)
syn.sw=swdef
syn.tau=taudef
synL.append( syn )
}
showsynL()
}
proc showsynL(){ local i
for i=0, synL.count-1 {
ribbon1[i].get_loc()
printf( "synapse %3d at %12s at %4d %4d %4d %8.3f %8.3f\n", \
i, secname(), synL.o(i).xp, synL.o(i).yp, synL.o(i).zp, synL.o(i).dist, synL.o(i).sw )
pop_section()
}
}
//================================================================================
proc init_cell(){
// v_init = G_e_pas
forall {
e_pas = G_e_pas
g_pas = 1 / G_Rm
Ra = G_Ra
cm = G_cm
if( var_defined( "G_ena")) ena = G_ena
if( var_defined( "G_ek")) ek = G_ek
}
forsec "myelin" {
cm = aXm_cm
g_pas = 1/aXm_Rm
}
forsec "nodes" { // not actual nodes. bracket soma. assumed myelinated
cm = aXm_cm
g_pas = 1/aXm_Rm
}
forsec "soma" {
cm = soma_cm
g_pas =1/soma_Rm
}
forsec "soma" {
if( var_defined( "Gbar_Nav16_s")) gbar_Nav16 = Gbar_Nav16_s
if( var_defined( "Gbar_Kv12_s")) gbar_Kv12 = Gbar_Kv12_s
if( var_defined( "Gbar_Kv31_s")) gbar_Kv31 = Gbar_Kv31_s
if( var_defined( "Gbar_Kv3s_s")) gbar_Kv3s = Gbar_Kv3s_s
if( var_defined( "Gbar_Kv43A_s")) gbar_Kv43A = Gbar_Kv43A_s
if( var_defined( "Gbar_Kv7M_s")) gbar_Kv7M = Gbar_Kv7M_s
if( var_defined( "Gbar_H_HCNl_s")) gbar_H_HCNl = Gbar_H_HCNl_s
if( var_defined( "Gbar_ab4BK2_s")) gbar_ab4BK2 = Gbar_ab4BK2_s
if( var_defined( "Pbar_caL_s")) pbar_caL = Pbar_caL_s
if( var_defined( "Gbar_SK_s")) gbar_SK = Gbar_SK_s
}
forsec "iseg" {
if( var_defined( "Gbar_Nav16_i")) gbar_Nav16 = Gbar_Nav16_i
if( var_defined( "Gbar_Kv12_i")) gbar_Kv12 = Gbar_Kv12_i
if( var_defined( "Gbar_Kv31_i")) gbar_Kv31 = Gbar_Kv31_i
if( var_defined( "Gbar_Kv3s_i")) gbar_Kv3s = Gbar_Kv3s_i
if( var_defined( "Gbar_Kv43A_i")) gbar_Kv43A = Gbar_Kv43A_i
if( var_defined( "Gbar_Kv7M_i")) gbar_Kv7M = Gbar_Kv7M_i
if( var_defined( "Gbar_H_HCNl_i")) gbar_H_HCNl = Gbar_H_HCNl_i
if( var_defined( "Gbar_ab4BK2_i")) gbar_ab4BK2 = Gbar_ab4BK2_i
if( var_defined( "Pbar_caL_i")) pbar_caL = Pbar_caL_i
if( var_defined( "Gbar_SK_i")) gbar_SK = Gbar_SK_i
}
forsec "myelin" {
if( var_defined( "Gbar_Nav16_m")) gbar_Nav16 = Gbar_Nav16_m
if( var_defined( "Gbar_Kv12_m")) gbar_Kv12 = Gbar_Kv12_m
if( var_defined( "Gbar_Kv31_m")) gbar_Kv31 = Gbar_Kv31_m
if( var_defined( "Gbar_Kv3s_m")) gbar_Kv3s = Gbar_Kv3s_m
if( var_defined( "Gbar_Kv43A_m")) gbar_Kv43A = Gbar_Kv43A_m
if( var_defined( "Gbar_Kv7M_m")) gbar_Kv7M = Gbar_Kv7M_m
if( var_defined( "Gbar_H_HCNl_m")) gbar_H_HCNl = Gbar_H_HCNl_m
if( var_defined( "Gbar_ab4BK2_m")) gbar_ab4BK2 = Gbar_ab4BK2_m
if( var_defined( "Pbar_caL_m")) pbar_caL = Pbar_caL_m
if( var_defined( "Gbar_SK_m")) gbar_SK = Gbar_SK_m
}
forsec "bout" {
if( var_defined( "Gbar_Nav16_b")) gbar_Nav16 = Gbar_Nav16_b
if( var_defined( "Gbar_Kv12_b")) gbar_Kv12 = Gbar_Kv12_b
if( var_defined( "Gbar_Kv31_b")) gbar_Kv31 = Gbar_Kv31_b
if( var_defined( "Gbar_Kv3s_b")) gbar_Kv3s = Gbar_Kv3s_b
if( var_defined( "Gbar_Kv43A_b")) gbar_Kv43A = Gbar_Kv43A_b
if( var_defined( "Gbar_Kv7M_b")) gbar_Kv7M = Gbar_Kv7M_b
if( var_defined( "Gbar_H_HCNl_b")) gbar_H_HCNl = Gbar_H_HCNl_b
if( var_defined( "Gbar_ab4BK2_b")) gbar_ab4BK2 = Gbar_ab4BK2_b
if( var_defined( "Pbar_caL_b")) pbar_caL = Pbar_caL_b
if( var_defined( "Gbar_SK_b")) gbar_SK = Gbar_SK_b
}
forsec "axon" {
if( var_defined( "Gbar_Nav16_a")) gbar_Nav16 = Gbar_Nav16_a
if( var_defined( "Gbar_Kv12_a")) gbar_Kv12 = Gbar_Kv12_a
if( var_defined( "Gbar_Kv31_a")) gbar_Kv31 = Gbar_Kv31_a
if( var_defined( "Gbar_Kv3s_a")) gbar_Kv3s = Gbar_Kv3s_a
if( var_defined( "Gbar_Kv43A_a")) gbar_Kv43A = Gbar_Kv43A_a
if( var_defined( "Gbar_Kv7M_a")) gbar_Kv7M = Gbar_Kv7M_a
if( var_defined( "Gbar_H_HCNl_a")) gbar_H_HCNl = Gbar_H_HCNl_a
if( var_defined( "Gbar_ab4BK2_a")) gbar_ab4BK2 = Gbar_ab4BK2_a
if( var_defined( "Pbar_caL_a")) pbar_caL = Pbar_caL_a
if( var_defined( "Gbar_SK_a")) gbar_SK = Gbar_SK_a
}
forsec "axon[0]" {
if( var_defined( "Gbar_Nav16_a1")) gbar_Nav16 = Gbar_Nav16_a1
if( var_defined( "Gbar_Kv12_a1")) gbar_Kv12 = Gbar_Kv12_a1
if( var_defined( "Gbar_Kv31_a1")) gbar_Kv31 = Gbar_Kv31_a1
if( var_defined( "Gbar_Kv3s_a1")) gbar_Kv3s = Gbar_Kv3s_a1
if( var_defined( "Gbar_Kv43A_a1")) gbar_Kv43A = Gbar_Kv43A_a1
if( var_defined( "Gbar_Kv7M_a1")) gbar_Kv7M = Gbar_Kv7M_a1
if( var_defined( "Gbar_H_HCNl_a1")) gbar_H_HCNl = Gbar_H_HCNl_a1
if( var_defined( "Gbar_ab4BK2_a1")) gbar_ab4BK2 = Gbar_ab4BK2_a1
if( var_defined( "Pbar_caL_a1")) pbar_caL = Pbar_caL_a1
if( var_defined( "Gbar_SK_a1")) gbar_SK = Gbar_SK_a1
}
forsec "node" {
if( var_defined( "Gbar_Nav16_n")) gbar_Nav16 = Gbar_Nav16_n
if( var_defined( "Gbar_Kv12_n")) gbar_Kv12 = Gbar_Kv12_n
if( var_defined( "Gbar_Kv31_n")) gbar_Kv31 = Gbar_Kv31_n
if( var_defined( "Gbar_Kv3s_n")) gbar_Kv3s = Gbar_Kv3s_n
if( var_defined( "Gbar_Kv43A_n")) gbar_Kv43A = Gbar_Kv43A_n
if( var_defined( "Gbar_Kv7M_n")) gbar_Kv7M = Gbar_Kv7M_n
if( var_defined( "Gbar_H_HCNl_n")) gbar_H_HCNl = Gbar_H_HCNl_n
if( var_defined( "Gbar_ab4BK2_n")) gbar_ab4BK2 = Gbar_ab4BK2_n
if( var_defined( "Pbar_caL_n")) pbar_caL = Pbar_caL_n
if( var_defined( "Gbar_SK_n")) gbar_SK = Gbar_SK_n
}
forsec "nodes" {
if( var_defined( "Gbar_Nav16_ns")) gbar_Nav16 = Gbar_Nav16_ns
if( var_defined( "Gbar_Kv12_ns")) gbar_Kv12 = Gbar_Kv12_ns
if( var_defined( "Gbar_Kv31_ns")) gbar_Kv31 = Gbar_Kv31_ns
if( var_defined( "Gbar_Kv3s_ns")) gbar_Kv3s = Gbar_Kv3s_ns
if( var_defined( "Gbar_Kv43A_ns")) gbar_Kv43A = Gbar_Kv43A_ns
if( var_defined( "Gbar_Kv7M_ns")) gbar_Kv7M = Gbar_Kv7M_ns
if( var_defined( "Gbar_H_HCNl_ns")) gbar_H_HCNl = Gbar_H_HCNl_ns
if( var_defined( "Gbar_ab4BK2_ns")) gbar_ab4BK2 = Gbar_ab4BK2_ns
if( var_defined( "Pbar_caL_ns")) pbar_caL = Pbar_caL_ns
if( var_defined( "Gbar_SK_ns")) gbar_SK = Gbar_SK_ns
}
forsec "nodec" {
if( var_defined( "Gbar_Nav16_nc")) gbar_Nav16 = Gbar_Nav16_nc
if( var_defined( "Gbar_Kv12_nc")) gbar_Kv12 = Gbar_Kv12_nc
if( var_defined( "Gbar_Kv31_nc")) gbar_Kv31 = Gbar_Kv31_nc
if( var_defined( "Gbar_Kv3s_nc")) gbar_Kv3s = Gbar_Kv3s_nc
if( var_defined( "Gbar_Kv43A_nc")) gbar_Kv43A = Gbar_Kv43A_nc
if( var_defined( "Gbar_Kv7M_nc")) gbar_Kv7M = Gbar_Kv7M_nc
if( var_defined( "Gbar_H_HCNl_nc")) gbar_H_HCNl = Gbar_H_HCNl_nc
if( var_defined( "Gbar_ab4BK2_nc")) gbar_ab4BK2 = Gbar_ab4BK2_nc
if( var_defined( "Pbar_caL_nc")) pbar_caL = Pbar_caL_nc
if( var_defined( "Gbar_SK_nc")) gbar_SK = Gbar_SK_nc
}
forsec "term" {
if( var_defined( "Gbar_Nav16_t")) gbar_Nav16 = Gbar_Nav16_t
if( var_defined( "Gbar_Kv12_t")) gbar_Kv12 = Gbar_Kv12_t
if( var_defined( "Gbar_Kv31_t")) gbar_Kv31 = Gbar_Kv31_t
if( var_defined( "Gbar_Kv3s_t")) gbar_Kv3s = Gbar_Kv3s_t
if( var_defined( "Gbar_Kv43A_t")) gbar_Kv43A = Gbar_Kv43A_t
if( var_defined( "Gbar_Kv7M_t")) gbar_Kv7M = Gbar_Kv7M_t
if( var_defined( "Gbar_H_HCNl_t")) gbar_H_HCNl = Gbar_H_HCNl_t
if( var_defined( "Gbar_ab4BK2_t")) gbar_ab4BK2 = Gbar_ab4BK2_t
if( var_defined( "Pbar_caL_t")) pbar_caL = Pbar_caL_t
if( var_defined( "Gbar_SK_t")) gbar_SK = Gbar_SK_t
}
set_nseg( lambda_f_d )
ad=0
ib=0
forsec "bou" {
ad = ad+diam
ib=ib+1
}
ad=ad/ib
ad1=1.6
print "ave bou diam ", ad, " ", ib, "cdiam= ", ad1
}
proc set_nseg(){
nseg_tot = 0
// soma area( 0.5 )
forall {
if( lambda_f_d <= 0 ) nseg = 1
if( lambda_f_d > 0 ) nseg = int((L/($1 *lambda_f(100))+.9)/2)*2 + 1
nseg_tot += nseg
}
forsec "bou" {
nseg=3
nseg_tot=nseg_tot+2
}
forsec "iseg" {
if (nseg=1) {
nseg=3
nseg_tot=nseg_tot+2
}
}
forsec "soma" {
if (nseg=1) {
nseg=3
nseg_tot=nseg_tot+2
}
}
forsec "axon" {
if (nseg=1) {
nseg=3
nseg_tot=nseg_tot+2
}
}
forsec "myel" {
if (nseg=1) {
nseg=3
nseg_tot=nseg_tot+2
}
}
printf( "lambda-d %g nseg_tot %d\n", $1, nseg_tot )
}
proc getg() {local rmm
forall {
rmm = 1/((g_Nav16(0.5) + g_Kv31(0.5)+g_Kv12(0.5)+g_Kv43A(0.5)+g_Kv3s(0.5)+g_Kv7M(0.5)+g_H_HCNl(0.5))*1e-4 + g_pas(0.5))
print secname(), " ", rmm, " ", g_pas(0.5)*1e4, " ", g_Nav16(0.5), " ", g_Kv31(0.5), " ", g_H_HCNl(0.5)
}
}
proc els() { local rmm, lam, el, lamp, elp
forall {
rmm = 1/((g_Nav16(0.5) + g_Kv31(0.5)+g_Kv12(0.5)+g_Kv43A(0.5)+g_Kv3s(0.5)+g_Kv7M(0.5)+g_H_HCNl(0.5)+g_SK(0.5)+g_ab4BK2(0.5))*1e-4 + g_pas(0.5))
lam = sqrt ((rmm*diam*1e-4)/(Ra*4))
el = L*1e-4/lam
lamp = sqrt ((1/g_pas(0.5)*diam*1e-4)/(Ra*4))
elp = L*1e-4/lamp
printf ("%-11s %8.4f %8.4f %8.4f %8.4f\n", secname(), lam, lamp, el, elp )
}
}
proc els_file() { local rmm,lam,el,lamp,elp localobj dF
strdef strs3
strs3=$s1
dF= new File()
dF.wopen(strs3)
forall {
rmm = 1/((g_Nav16(0.5) + g_Kv31(0.5)+g_Kv12(0.5)+g_Kv43A(0.5)+g_Kv3s(0.5)+g_Kv7M(0.5)+g_H_HCNl(0.5))*1e-4 + g_pas(0.5))
lam = sqrt ((rmm*diam*1e-4)/(Ra*4))
el = L*1e-4/lam
lamp = sqrt ((1/g_pas(0.5)*diam*1e-4)/(Ra*4))
elp = L*1e-4/lamp
dF.printf ("%-11s %10.2f %8.4f %8.4f %8.4f %8.4f\n", secname(), rmm, lam, lamp, el, elp)
}
}
proc rate() { local ataun // enter as rate per second, convert to wait time
ataun=$1
if (ataun > 0) {
atau_ribbon1=1e3/ataun
} else{
atau_ribbon1=0
}
}
proc weig() {local neww
neww=$1
for i=0,synL.count-1 synL.o(i).sw=neww
print " new synaptic weights = ", neww
}
proc nsyntau() { local newt
newt=$1
for i=0,synL.count-1 synL.o(i).tau=newt
}
proc sw_by_cdiam() { local i
for i=0,synL.count-1 {
ribbon1[i].get_loc()
synL.o(i).sw=synL.o(i).sw*diam/ad1
printf("%-12s %8.3f\n", secname(), synL.o(i).sw)
pop_section()
}
}
proc sw_by_diam() { local i
for i=0,synL.count-1 {
ribbon1[i].get_loc()
synL.o(i).sw=synL.o(i).sw*diam/ad
printf("%-12s %8.3f\n", secname(), synL.o(i).sw)
pop_section()
}
}
proc init() { local dtsav, temp, t2, t1, t0, dt2, dt1, dt0, it0, it1, it2
init_cell()
finitialize (v_init)
// added this
t2 = 3e9
t1 = 100
t0 = 30
dt2 = 1e8
dt1 = 0.1
dt0 = 0.1
it0 = -1*t0
it1 = -1*(t0 + t1)
it2 = -1*(t0 + t1 + t2)
t = it2
dtsav = dt
dt = dt2
// to here (also added local variables)
// t = -1e10 remove 3 lines
// dtsav = dt
// dt=1e9
// if cvode is on, turn it off to do large fixed step
temp = cvode.active()
if (temp != 0) {cvode.active(0) }
while (t < it1) {
// while (t<-1e9) { change while
fadvance()
}
// add this
dt=dt1
cvode.active(1)
cvode.atol(1e-4)
while ( t<it0) {
fadvance()
}
cvode.active(0)
dt = dt0
t = it0
while(t<0) {
fadvance()
}
// to here
// restore cvode if necessary
if (temp != 0) { cvode.active(1) }
dt = dtsav
t=0
if (cvode.active()) {
cvode.re_init()
} else {
fcurrent()
}
frecord_init()
}
//===============================================================================
proc plot_one(){ local i, atau, ts
i=$1
atau = atau_ribbon1
ts = tstop
atau_ribbon1 = 0
tstop = 40
synL.o(i).del=10 run() synL.o(i).del=-1
atau_ribbon1 = atau
tstop = ts
}
proc plot_syns(){ local i, atau, ts
atau = atau_ribbon1
ts = tstop
atau_ribbon1 = 0
tstop = 40
for i=0, synL.count-1 { synL.o(i).del=10 run() synL.o(i).del=-1 }
atau_ribbon1 = atau
tstop = ts
}
proc printm() {
forsec "mye" print secname(), " ", diam, " ", L
}
//===============================================================================
proc arun1() {local i, n, y, th, avg, avgm1, sd, SS, cv, rate, spikes, freq localobj nc, nil, vec_v, vec_t, sT2
vec_v = new Vector()
vec_t = new Vector()
sT2 = new Vector()
soma nc = new NetCon(&v(.5),nil)
nc.threshold=-20
nc.record(sT2)
run()
n=0
sd=0
cv=0
avg=0
y=sT2.x[0]
// for i=0,sT2.size-1 print sT2.size
// print sT2.size
print sT2.x[0],y,n,avg,sd,cv
for i=1,sT2.size-1 {
y=sT2.x[i]-sT2.x[i-1]
n+=1
if(n==1) {
avg = y
SS=0
print sT2.x[1], y, n, avg, sd, cv
} else {
avgm1=avg
avg = avgm1 + (y - avgm1)/n
SS = SS + (y-avgm1)*(y - avg)
if (n>1) sd = sqrt(SS/(n-1))
if (avg!=0.0) cv = sd/avg
print sT2.x[i], y, n, avg, sd, cv
}
}
if (n>1) sd = sqrt(SS/(n-1))
if (avg!=0.0) cv = sd/avg
if (atau_ribbon1 > 0) {
rate=1e3/atau_ribbon1
} else { rate = 0}
spikes = sT2.size
freq = spikes*1e3/tstop
printf( "tstop %9g HCrate %8g spikes %6g freq %8g Hz avgISI %8g sd %8g cv %8g\n", tstop, rate, spikes, freq, avg, sd, cv)
}
proc moreBKSK () {
forsec "iseg" {
TotalPump_cdp = 3e-11
TotalBuffer_cdp = 0.03
Pbar_caL_i = 7.5e-4
Gbar_SK_i = 20
Gbar_ab4BK2_i = 300
}
forsec "soma" {
insert caL
insert SK
insert ab4BK2
Pbar_caL_s = 7.5e-7
Gbar_SK_s = 0.02
Gbar_ab4BK2_s = 0.3
insert cdp13
TotalPump_cdp13 = 3e-13
TotalBuffer_cdp13 = .03
}
forsec "node" {
insert caL
insert SK
insert ab4BK2
Pbar_caL_n = 5e-4
Gbar_SK_n = 13.3
Gbar_ab4BK2_n = 200
Pbar_caL_nc = 5e-4
Gbar_SK_nc = 13.3
Gbar_ab4BK2_nc = 200
insert cdp
TotalPump_cdp = 2e-11
TotalBuffer_cdp = .03
}
forsec "nodes" {
insert caL
insert SK
insert ab4BK2
Pbar_caL_ns = 7.5e-7
Gbar_SK_ns = 0.02
Gbar_ab4BK2_ns = .3
insert cdp
TotalPump_cdp = 3e-13
TotalBuffer_cdp = .03
}
}
proc remove_M() {
Gbar_Kv7M_a=0
Gbar_Kv7M_a1=0
Gbar_Kv7M_i=0
Gbar_Kv7M_m=0
Gbar_Kv7M_n=0
Gbar_Kv7M_t=0
Gbar_Kv7M_b=0
Gbar_Kv7M_s=0
Gbar_Kv7M_ns=0
Gbar_Kv7M_nc=0
}
proc remove_D() {
Gbar_Kv12_a=0
Gbar_Kv12_a1=0
Gbar_Kv12_i=0
Gbar_Kv12_m=0
Gbar_Kv12_n=0
Gbar_Kv12_t=0
Gbar_Kv12_b=0
Gbar_Kv12_s=0
Gbar_Kv12_ns=0
Gbar_Kv12_nc=0
}
proc remove_Ks() {
Gbar_Kv3s_a=0
Gbar_Kv3s_a1=0
Gbar_Kv3s_i=0
Gbar_Kv3s_m=0
Gbar_Kv3s_n=0
Gbar_Kv3s_t=0
Gbar_Kv3s_b=0
Gbar_Kv3s_s=0
Gbar_Kv3s_ns=0
Gbar_Kv3s_nc=0
}
proc remove_Kv31() {
Gbar_Kv3s_a=0
Gbar_Kv3s_a1=0
Gbar_Kv3s_i=0
Gbar_Kv3s_m=0
Gbar_Kv3s_n=0
Gbar_Kv3s_t=0
Gbar_Kv3s_b=0
Gbar_Kv3s_s=0
Gbar_Kv3s_ns=0
Gbar_Kv3s_nc=0
}
proc change_K31() { local fac31
fac31=$1
Gbar_Kv31_a = Gbar_Kv31_a*fac31
Gbar_Kv31_a1 = Gbar_Kv31_a1*fac31
Gbar_Kv31_i = Gbar_Kv31_i*fac31
Gbar_Kv31_m = Gbar_Kv31_m*fac31
Gbar_Kv31_n = Gbar_Kv31_n*fac31
Gbar_Kv31_t = Gbar_Kv31_t*fac31
Gbar_Kv31_b = Gbar_Kv31_b*fac31
Gbar_Kv31_s = Gbar_Kv31_s*fac31
Gbar_Kv31_ns = Gbar_Kv31_ns*fac31
Gbar_Kv31_nc = Gbar_Kv31_nc*fac31
}
proc restore_K31() {
Gbar_Kv31_a=34
Gbar_Kv31_a1=34
Gbar_Kv31_i=1020
Gbar_Kv31_m=1.02
Gbar_Kv31_n=680
Gbar_Kv31_t=100
Gbar_Kv31_b=34
Gbar_Kv31_s=1.02
Gbar_Kv31_ns=1.02
Gbar_Kv31_nc=680
}
proc change_caL() { local facal
facal=$1
// Pbar_caL_a = Pbar_caL_a*facal
// Pbar_caL_a1 = Pbar_caL_a1*facal
Pbar_caL_i = Pbar_caL_i*facal
// Pbar_caL_m = Pbar_caL_m*facal
Pbar_caL_n = Pbar_caL_n*facal
// Pbar_caL_t = Pbar_caL_t*facal
// Pbar_caL_b = Pbar_caL_b*facal
Pbar_caL_s = Pbar_caL_s*facal
Pbar_caL_ns = Pbar_caL_ns*facal
Pbar_caL_nc = Pbar_caL_nc*facal
}
proc change_H() { local fach
fach=$1
Gbar_H_HCNl_a = Gbar_H_HCNl_a*fach
Gbar_H_HCNl_a1 = Gbar_H_HCNl_a1*fach
Gbar_H_HCNl_i = Gbar_H_HCNl_i*fach
Gbar_H_HCNl_m = Gbar_H_HCNl_m*fach
Gbar_H_HCNl_n = Gbar_H_HCNl_n*fach
Gbar_H_HCNl_t = Gbar_H_HCNl_t*fach
Gbar_H_HCNl_b = Gbar_H_HCNl_b*fach
Gbar_H_HCNl_s = Gbar_H_HCNl_s*fach
Gbar_H_HCNl_ns = Gbar_H_HCNl_ns*fach
Gbar_H_HCNl_nc = Gbar_H_HCNl_nc*fach
}
proc change_D() { local facd
facd=$1
Gbar_Kv12_a = Gbar_Kv12_a*facd
Gbar_Kv12_a1 = Gbar_Kv12_a1*facd
Gbar_Kv12_i = Gbar_Kv12_i*facd
Gbar_Kv12_m = Gbar_Kv12_m*facd
Gbar_Kv12_n = Gbar_Kv12_n*facd
Gbar_Kv12_t = Gbar_Kv12_t*facd
Gbar_Kv12_b = Gbar_Kv12_b*facd
Gbar_Kv12_s = Gbar_Kv12_s*facd
Gbar_Kv12_ns = Gbar_Kv12_ns*facd
Gbar_Kv12_nc = Gbar_Kv12_nc*facd
}
proc change_M() { local facm
facm=$1
Gbar_Kv7M_a = Gbar_Kv7M_a*facm
Gbar_Kv7M_a1 = Gbar_Kv7M_a1*facm
Gbar_Kv7M_i = Gbar_Kv7M_i*facm
Gbar_Kv7M_m = Gbar_Kv7M_m*facm
Gbar_Kv7M_n = Gbar_Kv7M_n*facm
Gbar_Kv7M_t = Gbar_Kv7M_t*facm
Gbar_Kv7M_b = Gbar_Kv7M_b*facm
Gbar_Kv7M_s = Gbar_Kv7M_s*facm
Gbar_Kv7M_ns = Gbar_Kv7M_ns*facm
Gbar_Kv7M_nc = Gbar_Kv7M_nc*facm
}
proc change_SK() { local facsk
facsk=$1
// Gbar_SK_a = Gbar_SK_a*facsk
// Gbar_SK_a1 = Gbar_SK_a1*facsk
Gbar_SK_i = Gbar_SK_i*facsk
// Gbar_SK_m = Gbar_SK_m*facsk
Gbar_SK_n = Gbar_SK_n*facsk
// Gbar_SK_t = Gbar_SK_t*facsk
// Gbar_SK_b = Gbar_SK_b*facsk
Gbar_SK_s = Gbar_SK_s*facsk
Gbar_SK_ns = Gbar_SK_ns*facsk
Gbar_SK_nc = Gbar_SK_nc*facsk
}
proc change_BK() { local facbk
facbk=$1
// Gbar_ab4BK2_a = Gbar_ab4BK2_a*facbk
// Gbar_ab4BK2_a1 = Gbar_ab4BK2_a1*facbk
Gbar_ab4BK2_i = Gbar_ab4BK2_i*facbk
// Gbar_ab4BK2_m = Gbar_ab4BK2_m*facbk
Gbar_ab4BK2_n = Gbar_ab4BK2_n*facbk
// Gbar_ab4BK2_t = Gbar_ab4BK2_t*facbk
// Gbar_ab4BK2_b = Gbar_ab4BK2_b*facbk
Gbar_ab4BK2_s = Gbar_ab4BK2_s*facbk
Gbar_ab4BK2_ns = Gbar_ab4BK2_ns*facbk
Gbar_ab4BK2_nc = Gbar_ab4BK2_nc*facbk
}
proc restore_M() {
Gbar_Kv7M_a=4
Gbar_Kv7M_a1=4
Gbar_Kv7M_i=120
Gbar_Kv7M_m=0.12
Gbar_Kv7M_n=80
Gbar_Kv7M_t=12
Gbar_Kv7M_b=4
Gbar_Kv7M_s=0.12
Gbar_Kv7M_ns=0.12
Gbar_Kv7M_nc=80
}
proc restore_D() {
Gbar_Kv12_a=10
Gbar_Kv12_a1=10
Gbar_Kv12_i=300
Gbar_Kv12_m=0.3
Gbar_Kv12_n=200
Gbar_Kv12_t=30
Gbar_Kv12_b=10
Gbar_Kv12_s=0.3
Gbar_Kv12_ns=0.3
Gbar_Kv12_nc=200
}
proc restore_Ks() {
Gbar_Kv3s_a=6
Gbar_Kv3s_a1=6
Gbar_Kv3s_i=180
Gbar_Kv3s_m=0.18
Gbar_Kv3s_n=120
Gbar_Kv3s_t=18
Gbar_Kv3s_b=6
Gbar_Kv3s_s=0.18
Gbar_Kv3s_ns=0.18
Gbar_Kv3s_nc=120
}
proc change_Kv31_slope() { local slk
slk=$1
slope_n_Kv31=slk
}
proc change_Nav16_vh() { local vh
vh =$1
vhalf_n_Nav16=vh
}
proc change_Rm() { local rm
rm=$1
G_Rm=rm
}
//=======================================================================
proc set_params() {
v_init = -60
G_e_pas = -60
G_Ra = 50
G_cm = 1
aXm_cm = 0.04
aXm_Rm = 30000
soma_cm = 0.1
soma_Rm = 12000
atau_ribbon1 = 0
G_Rm = 2000
Gbar_Nav16_a1 = 160
Gbar_Kv31_a1 = 34
Gbar_Kv3s_a1 = 6
Gbar_Kv12_a1 = 10
Gbar_Kv7M_a1 = 4
Gbar_Kv43A_a1 = 14
Gbar_H_HCNl_a1 = 11.233 * fac
// Gbar_ab4BK2_a1 = 5
// Pbar_caL_a1 = 5e-5
// Gbar_SK_a1 = 5
Gbar_Nav16_a = 160
Gbar_Kv31_a = 34
Gbar_Kv3s_a = 6
Gbar_Kv12_a = 10
Gbar_Kv7M_a = 4
Gbar_Kv43A_a = 14
Gbar_H_HCNl_a = 11.233 * fac
// Gbar_ab4BK2_a = 5
// Pbar_caL_a = 5e-5
// Gbar_SK_a = 5
Gbar_Nav16_m = 4.8
Gbar_Kv31_m = 1.02
Gbar_Kv3s_m = 0.18
Gbar_Kv12_m = 0.3
Gbar_Kv7M_m = 0.12
Gbar_Kv43A_m = 0.42
Gbar_H_HCNl_m = 0.337 * fac
// Gbar_ab4BK2_m = 5
// Pbar_caL_m = 5e-5
// Gbar_SK_m = 5
Gbar_Nav16_i = 4800
Gbar_Kv31_i = 1020
Gbar_Kv3s_i = 180
Gbar_Kv12_i = 300
Gbar_Kv7M_i = 120
Gbar_Kv43A_i = 420
Gbar_H_HCNl_i = 337 * fac
Gbar_ab4BK2_i = 300
Pbar_caL_i = 0.00075
Gbar_SK_i = 20
Gbar_Nav16_ns = 4.8
Gbar_Kv31_ns = 1.02
Gbar_Kv3s_ns = 0.18
Gbar_Kv12_ns = 0.3
Gbar_Kv7M_ns = 0.12
Gbar_Kv43A_ns = 0.42
Gbar_H_HCNl_ns = 0.337 * fac
// Gbar_ab4BK2_ns = 5
// Pbar_caL_ns = 5e-5
// Gbar_SK_ns = 5
Gbar_Nav16_nc = 3200
Gbar_Kv31_nc = 680
Gbar_Kv3s_nc = 120
Gbar_Kv12_nc = 200
Gbar_Kv7M_nc = 80
Gbar_Kv43A_nc = 280
Gbar_H_HCNl_nc = 224.67 * fac
// Gbar_ab4BK2_nc = 5
// Pbar_caL_nc = 5e-5
// Gbar_SK_nc = 5
Gbar_Nav16_n = 3200
Gbar_Kv31_n = 680
Gbar_Kv3s_n = 120
Gbar_Kv12_n = 200
Gbar_Kv7M_n = 80
Gbar_Kv43A_n = 280
Gbar_H_HCNl_n = 224.67 * fac
// Gbar_ab4BK2_n = 5
// Pbar_caL_n = 5e-5
// Gbar_SK_n = 5
Gbar_Nav16_b = 160
Gbar_Kv31_b = 34
Gbar_Kv3s_b = 6
Gbar_Kv12_b = 10
Gbar_Kv7M_b = 4
Gbar_Kv43A_b = 14
Gbar_H_HCNl_b = 11.233 * fac
// Gbar_ab4BK2_b = 5
// Pbar_caL_b = 5e-5
// Gbar_SK_b = 5
Gbar_Nav16_s = 4.8
Gbar_Kv31_s = 1.02
Gbar_Kv3s_s = 0.18
Gbar_Kv12_s = 0.3
Gbar_Kv7M_s = 0.12
Gbar_Kv43A_s = 0.42
Gbar_H_HCNl_s = 0.337 * fac
// Gbar_ab4BK2_s = 5
// Pbar_caL_s = 5e-5
// Gbar_SK_s = 5
Gbar_Nav16_t = 480
Gbar_Kv31_t = 102
Gbar_Kv3s_t = 18
Gbar_Kv12_t = 30
Gbar_Kv7M_t = 12
Gbar_Kv43A_t = 42
Gbar_H_HCNl_t = 33.7*fac
// Gbar_ab4BK2_t = 5
// Pbar_caL_t = 5e-5
// Gbar_SK_t = 5
vhalf_n_Nav16 = -40
slope_n_Nav16 = -4.5
gates_n_Nav16 = 3
tau0_n_Nav16 = 0.04
tauA_n_Nav16 = 0.2
tauG_n_Nav16 = 0.75
tauF_n_Nav16 = 0
tauDv_n_Nav16 = 0
vhalf_h_Nav16 = -65
slope_h_Nav16 = 8
tau0_h_Nav16 = 0.0
tauA_h_Nav16 = 8
tauG_h_Nav16 = 0.5
tauF_h_Nav16 = 0
tauDv_h_Nav16 = 0
gates_n_Kv31 = 4
vhalf_n_Kv31 = -15
slope_n_Kv31 = -15.6
tau0_n_Kv31 = 1
tauA_n_Kv31 = 3
tauG_n_Kv31 = 0.25
tauF_n_Kv31 = 0
tauDv_n_Kv31 = 0