-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMotAct7MDB2.c
2748 lines (2624 loc) · 94.4 KB
/
MotAct7MDB2.c
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
/************************************************************/
/* */
/* */
/* */
/* MotLAct7MDB.c */
/* */
/* */
/* */
/* */
/* 2022/05/19 */
/************************************************************/
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <signal.h>
#define M_PI 3.1415926535
#define N_assm 8 // the number of cell assemblies
#define N_T 19 // the number of cell units
#define N_P 19 //
#define DT 1e-4 // discrete time
#define delay 500 // delay between networks
#define cmPY 500e-12 // capacitance for PY
#define cmSB 243e-12 // for SB
#define cmLB 115e-12 // for LB
#define cmG 30e-12 // for G
#define cmM 224e-12 // for M
#define gmPY 25.0e-9 // conductance for PY
#define gmSB 9.7e-9 // for SB
#define gmLB 8.2e-9 // for LB
#define gmG 90.0e-9 // for G
#define gmM 16.0e-9 // for M
#define gGap 20.0e-9 // 20 nS */
#define gAMPA 0.5e-9 // maximal conductance for AMPA-receptors
#define gGABA 0.7e-9 // for GABA-receptors
#define gGABAb 1e-9 // for GABAb receptor
#define K1 9e4 //
#define K2 1.2 //
#define K3 180 //
#define K4 34 //
#define Kd 100 //
#define nBS 4 // binding sites
#define UPYact -0.01 // action potential of PYC
#define UPYres -0.065 // reset membrane pot. of PYC
#define USBact -0.01 // for SB
#define USBres -0.07 // for SB
#define ULBact -0.01 // for LB
#define ULBres -0.07 // for LB
#define UGres -0.07 // for G
#define UMact -0.01 // for M
#define UMres -0.057 // for M
#define u_AMPA 0.0 // reversal potential for AMPA
#define u_GABA -0.08 // for GABA
#define u_GABAb -0.095 // for GABAb
#define steep_PY 220.0 // steepness of sigmoid for PY
#define thres_PY -0.03 // threshold of sigmoid for PY
#define steep_PY2 280.0 // for PY2
#define thres_PY2 -0.033 // for PY2
#define steep_SB 260.0 // for SB
#define thres_SB -0.033 // for SB
#define steep_SB2 260.0 // for SB2
#define thres_SB2 -0.033 // for SB2
#define steep_LB 300.0 // for LB
#define thres_LB -0.031 // for LB
#define steep_LB2 300.0 // for LB2
#define thres_LB2 -0.031 // for LB2
#define steep_M 300.0 // for M
#define thres_M -0.014 // for M
#define alph_AMPA 1.1e6 // open AMPA-channels
#define beta_AMPA 190.0 //
#define alph_GABA 5.0e6 // open GABA-channels
#define beta_GABA 180.0 //
#define Glut_c 0.001 // glutamate conc.
#define GABA_cS 0.001 // GABA conc.
#define GABA_cL1 0.001 // GABA conc. in V1
#define GABA_cL2 0.001 // GABA conc. in V2
// GABA transporter
double m_G=4e9; // trans. coef.
#define uG_trn -0.07 // rev. pot.
// feature
#define theta_inp0 0
#define theta_inp1 1
#define theta_inp2 2
#define theta_inp3 3
#define theta_inp4 4
#define theta_inp5 5
#define theta_inp6 6
#define theta_inp7 7
#define theta_inp8 8
#define int_inp0_0 0e-12
#define int_inp0_1 int_inp0_0
#define int_inp0_2 int_inp0_0
#define int_inp0_3 700e-12
#define int_inp0_4 int_inp0_0
#define int_inp0_5 int_inp0_0
#define int_inp0_6 int_inp0_0
#define int_inp0_7 int_inp0_0
#define inp_prob 1.0 // input probability [0,1]
// amount of extrasyn. recepts.
double delta_T=8e2; // V1
double delta_T2=8e2; // V2
#define tau_area 1.0 // input broadness
#define COLUMN 3 // recorded curnent in cell assemly
#define NEURON 1 // recorded curnent in cell unit
int t; // time development
#define OUT 5000 // output time
#define PAT "ON" // display activity pattern
#define INTV 99 // display interval
#define PERIOD OUT+30000 // time period
#define onset_0 10000 // stim. onset
#define period_0 20000 // stim. period
#define wLPPV1 0.8 // weight in V1
#define wLPPV2 0.8 // weight in V2
#define wMM 10.0 // weight in M
#define w_M_P 2.8 // P-to-M connection
// GABA conc.
void dfsGABA_ext(void);
double I_GABA[N_assm+2][N_T+2];
double GABA_ext[N_assm+2][N_T+2];
double GABA_extw[N_assm+2][N_T+2];
double gamma=10.0;
double GABA_c0=8E-07;
double GABAamb_max=4E-06;
double GABAamb_min=0E-07;
double GABA_V2=10E-07;
// fraction of open channels for extrasyn. GABA recepts.
double rEXT[N_assm+2][N_T+2];
double difrEXT(int,int);
double rEXT2[N_assm+2][N_T+2];
double difrEXT2(int,int);
//V1 cells
double I_MGB1[N_assm+2]; // input to tonic cell
double I_MGBN1[N_assm+2];
double I_SB[N_assm+2];
double uPY1[N_assm+2][N_T+2]; // membrane pot.
double uSB1[N_assm+2][N_T+2];
double uLB1[N_assm+2][N_T+2];
double uG[N_assm+2][N_T+2];
double vPY1[N_assm+2][N_T+2][PERIOD+2]; // action potential
double vSB1[N_assm+2][N_T+2][PERIOD+2];
double vLB1[N_assm+2][N_T+2][PERIOD+2];
double rPY1[N_assm+2][N_T+2]; // fraction of open channels for AMPA-receptors
double rPY1d[N_assm+2][N_T+2][PERIOD+2]; // delay
double rSB1[N_assm+2][N_T+2];
double sF[N_assm+2][N_T+2];
double rLB1[N_assm+2][N_T+2];
double GlutPY_c1[N_assm+2][N_T+2]; // glutamate conc.
double GlutSB_c1[N_assm+2][N_T+2];
double GlutLB_c1[N_assm+2][N_T+2];
double duPY_leak1[N_assm+2][N_T+2]; // leak current
double duPY_rec_1[N_assm+2][N_T+2]; // recurrent excitatory current
double duPY_fed_1[N_assm+2][N_T+2]; // feedback inhibitory current
double duPY_lat_1[N_assm+2][N_T+2]; // lateral inhibitory current
double duPY_topdown[N_assm+2][N_T+2];// V2(P) to V1(Ib) current
double duPY_ext_1[N_assm+2][N_T+2]; // inhibitory current (am. GABA)
double duPY_MGB1[N_assm+2]; // excitatory current
double I_leak1; // leak current
double I_rec_1; // recurrent excitatory current
double I_fed_1; // feedback inhibitory current
double I_lat_1; // lateral inhibitory current
double I_topdown; // V2(P) to V1(Ib) current
double I_ext_1; // inhibitory current (am. GABA)
double I_MG1; // excitatory current
double duSB_leak1[N_assm+2][N_T+2];
double duSB_1[N_assm+2][N_T+2];
double duSB_topdown[N_assm+2][N_T+2];
double duSB_ext_1;
double I_leakSB1;
double I_fed_SB1;
double I_ext_SB1;
double duSB_inp;
double duLB_leak1[N_assm+2][N_T+2];
double duLB1[N_assm+2][N_T+2];
double duLB1_topdown[N_assm+2][N_T+2];
double duLB_ext1;
double I_leakLB1;
double I_fed_LB1;
double I_ext_LB1;
double duG_leak[N_assm+2][N_T+2];
double duG_P[N_assm+2][N_T+2];
double duG_Ia[N_assm+2][N_T+2];
double duG_topdown[N_assm+2][N_T+2];
double duG_G[N_assm+2][N_T+2];
double drPY1[N_assm+2][N_T+2];
double drSB1[N_assm+2][N_T+2];
double dsF[N_assm+2][N_T+2];;
double drLB1[N_assm+2][N_T+2];
double AMPA_c1[N_assm+2][N_T+2];
double GABASB_c1[N_assm+2][N_T+2][PERIOD+2];
double GABALB_c1[N_assm+2][N_T+2][PERIOD+2];
// weights
double w_rec_1[N_assm+2][N_T+2][N_assm+2][N_T+2];
double w_rec_10[N_assm+2][N_T+2][N_assm+2][N_T+2];
double w_fed_1[N_assm+2][N_T+2];
double w_lat_1[N_assm+2][N_T+2][N_T+2];
double w_v1Ia_v2[N_assm+2][N_T+2][N_assm+2][N_T+2];
double w_v1Ib_v2[N_assm+2][N_T+2][N_assm+2][N_T+2];
double w_v1P_v2[N_assm+2][N_T+2][N_assm+2][N_T+2];
double w_v1G_v2[N_assm+2][N_T+2][N_assm+2][N_T+2];
double wSB_PY1[N_assm+2][N_T+2];
double wLB_PY1[N_assm+2][N_assm+2][N_T+2];
double wG_P[N_assm+2];
double wG_Ia[N_assm+2];
// difference
double difuPY1(int,int);
double difuSB1(int,int);
double difuLB1(int,int);
double difrPY1(int,int);
double difrSB1(int,int);
double difsF(int,int);
double difrLB1(int,int);
//V2 cells
double I_V2[N_assm+2];
double uPY2[N_assm+2][N_T+2];
double uSB2[N_assm+2][N_T+2];
double uLB2[N_assm+2][N_T+2];
double uM[N_assm+2][N_T+2];
double vPY2[N_assm+2][N_T+2][PERIOD+2];
double vSB2[N_assm+2][N_T+2][PERIOD+2];
double vLB2[N_assm+2][N_T+2][PERIOD+2];
double vM[N_assm+2][N_T+2][PERIOD+2];
double rPY2[N_assm+2][N_T+2];
double rPY2d[N_assm+2][N_T+2][PERIOD+2];
double rSB2[N_assm+2][N_T+2];
double rLB2[N_assm+2][N_T+2];
double rM[N_assm+2][N_T+2];
double rMd[N_assm+2][N_T+2][PERIOD+2];
double GlutPY_c2[N_assm+2][N_T+2];
double GlutSB_c2[N_assm+2][N_T+2];
double GlutLB_c2[N_assm+2][N_T+2];
double GlutM[N_assm+2][N_T+2];
double duPY_leak2[N_assm+2][N_T+2];
double duPY_rec_2[N_assm+2][N_T+2];
double duPY_fed_2[N_assm+2][N_T+2];
double duPY_lat_2[N_assm+2][N_T+2];
double duPY_ext_2[N_assm+2][N_T+2];
double duPY_MGB2[N_assm+2];
double duM_leak[N_assm+2][N_T+2];
double duM_rec[N_assm+2][N_T+2];
double duM_fed[N_assm+2][N_T+2];
double duM_lat[N_assm+2][N_T+2];
double duM_ext[N_assm+2][N_T+2];
double I_leak2;
double I_rec_2;
double I_fed_2;
double I_lat_2;
double I_ext_2;
double duPY_inp;
double duSB_leak2[N_assm+2][N_T+2];
double duSB_2[N_assm+2][N_T+2];
double duSB_ext_2;
double I_leakSB2;
double I_fed_SB2;
double I_ext_SB2;
double duLB_leak2[N_assm+2][N_T+2];
double duLB2[N_assm+2][N_T+2];
double duLB2_bottom_up[N_assm+2][N_T+2];
double duLB_ext2;
double I_leakLB2;
double I_fed_LB2;
double I_ext_LB2;
double drPY2[N_assm+2][N_T+2];
double drSB2[N_assm+2][N_T+2];
double drLB2[N_assm+2][N_T+2];
double drM[N_assm+2][N_T+2];
double AMPA_c2[N_assm+2][N_T+2];
double GABASB_c2[N_assm+2][N_T+2][PERIOD+2];
double GABALB_c2[N_assm+2][N_T+2][PERIOD+2];
double w_rec_2[N_assm+2][N_T+2][N_assm+2][N_T+2];
double w_fed_2[N_assm+2][N_T+2];
double w_lat_2[N_assm+2][N_T+2][N_T+2];
double w_v2_v1[N_assm+2][N_T+2][N_assm+2][N_T+2] ;
double wSB_PY2[N_assm+2][N_T+2];
double wLB_PY2[N_assm+2][N_assm+2][N_T+2];
double difuPY2(int,int);
double difuSB2(int,int);
double difuLB2(int,int);
double difuM(int,int);
double difrPY2(int,int);
double difrSB2(int,int);
double difrLB2(int,int);
double difrM(int,int);
double sigmoidPY(double); // sigmoid for PY in V1
double sigmoidPY2(double); // sigmoid for PY in V2
double sigmoidSB(double);
double sigmoidSB2(double);
double sigmoidLB(double);
double sigmoidLB2(double);
double sigmoidM(double);
double OFSWCA=0.01;
double OFSBCA=0.12;
int xi[N_assm+2][N_assm+2][N_T+2];
double rand01(long int *); // radom number [0, 1.0]
void display(void);
void init(void); // initialization
long int SEEDMP=7000; // a seed for random number generation
//V1 cells
FILE *uPY0_01,*uPY0_11,*uPY0_21,*uPY0_31,*uPY0_41,*uPY0_51,*uPY0_61,*uPY0_71,*uPY0_81,*uPY0_91;
FILE *uPY1_01,*uPY1_11,*uPY1_21,*uPY1_31,*uPY1_41,*uPY1_51,*uPY1_61,*uPY1_71,*uPY1_81,*uPY1_91;
FILE *uPY2_01,*uPY2_11,*uPY2_21,*uPY2_31,*uPY2_41,*uPY2_51,*uPY2_61,*uPY2_71,*uPY2_81,*uPY2_91;
FILE *uPY3_01,*uPY3_11,*uPY3_21,*uPY3_31,*uPY3_41,*uPY3_51,*uPY3_61,*uPY3_71,*uPY3_81,*uPY3_91;
FILE *uPY4_01,*uPY4_11,*uPY4_21,*uPY4_31,*uPY4_41,*uPY4_51,*uPY4_61,*uPY4_71,*uPY4_81,*uPY4_91;
FILE *uPY5_01,*uPY5_11,*uPY5_21,*uPY5_31,*uPY5_41,*uPY5_51,*uPY5_61,*uPY5_71,*uPY5_81,*uPY5_91;
FILE *uPY6_01,*uPY6_11,*uPY6_21,*uPY6_31,*uPY6_41,*uPY6_51,*uPY6_61,*uPY6_71,*uPY6_81,*uPY6_91;
FILE *uPY7_01,*uPY7_11,*uPY7_21,*uPY7_31,*uPY7_41,*uPY7_51,*uPY7_61,*uPY7_71,*uPY7_81,*uPY7_91;
FILE *leak1,*rec1,*fed1,*lat1,*ext1,*topdown,*MG1;
FILE *extSB1,*extLB1;
FILE *vPY0_01,*vPY0_11,*vPY0_21,*vPY0_31,*vPY0_41,*vPY0_51,*vPY0_61,*vPY0_71,*vPY0_81,*vPY0_91;
FILE *vPY1_01,*vPY1_11,*vPY1_21,*vPY1_31,*vPY1_41,*vPY1_51,*vPY1_61,*vPY1_71,*vPY1_81,*vPY1_91;
FILE *vPY2_01,*vPY2_11,*vPY2_21,*vPY2_31,*vPY2_41,*vPY2_51,*vPY2_61,*vPY2_71,*vPY2_81,*vPY2_91;
FILE *vPY3_01,*vPY3_11,*vPY3_21,*vPY3_31,*vPY3_41,*vPY3_51,*vPY3_61,*vPY3_71,*vPY3_81,*vPY3_91;
FILE *vPY4_01,*vPY4_11,*vPY4_21,*vPY4_31,*vPY4_41,*vPY4_51,*vPY4_61,*vPY4_71,*vPY4_81,*vPY4_91;
FILE *vPY5_01,*vPY5_11,*vPY5_21,*vPY5_31,*vPY5_41,*vPY5_51,*vPY5_61,*vPY5_71,*vPY5_81,*vPY5_91;
FILE *vPY6_01,*vPY6_11,*vPY6_21,*vPY6_31,*vPY6_41,*vPY6_51,*vPY6_61,*vPY6_71,*vPY6_81,*vPY6_91;
FILE *vPY7_01,*vPY7_11,*vPY7_21,*vPY7_31,*vPY7_41,*vPY7_51,*vPY7_61,*vPY7_71,*vPY7_81,*vPY7_91;
FILE *uSB0_01,*uSB1_01,*uSB2_01,*uSB3_01,*uSB4_01,*uSB5_01,*uSB6_01,*uSB7_01;
FILE *vSB0_01,*vSB0_11,*vSB0_21,*vSB0_31,*vSB0_41,*vSB0_51,*vSB0_61,*vSB0_71,*vSB0_81,*vSB0_91;
FILE *vSB1_01,*vSB1_11,*vSB1_21,*vSB1_31,*vSB1_41,*vSB1_51,*vSB1_61,*vSB1_71,*vSB1_81,*vSB1_91;
FILE *vSB2_01,*vSB2_11,*vSB2_21,*vSB2_31,*vSB2_41,*vSB2_51,*vSB2_61,*vSB2_71,*vSB2_81,*vSB2_91;
FILE *vSB3_01,*vSB3_11,*vSB3_21,*vSB3_31,*vSB3_41,*vSB3_51,*vSB3_61,*vSB3_71,*vSB3_81,*vSB3_91;
FILE *vSB4_01,*vSB4_11,*vSB4_21,*vSB4_31,*vSB4_41,*vSB4_51,*vSB4_61,*vSB4_71,*vSB4_81,*vSB4_91;
FILE *vSB5_01,*vSB5_11,*vSB5_21,*vSB5_31,*vSB5_41,*vSB5_51,*vSB5_61,*vSB5_71,*vSB5_81,*vSB5_91;
FILE *vSB6_01,*vSB6_11,*vSB6_21,*vSB6_31,*vSB6_41,*vSB6_51,*vSB6_61,*vSB6_71,*vSB6_81,*vSB6_91;
FILE *vSB7_01,*vSB7_11,*vSB7_21,*vSB7_31,*vSB7_41,*vSB7_51,*vSB7_61,*vSB7_71,*vSB7_81,*vSB7_91;
FILE *uLB0_01,*uLB1_01,*uLB2_01,*uLB3_01,*uLB4_01,*uLB5_01,*uLB6_01,*uLB7_01;
FILE *vLB0_01,*vLB0_11,*vLB0_21,*vLB0_31,*vLB0_41,*vLB0_51,*vLB0_61,*vLB0_71,*vLB0_81,*vLB0_91;
FILE *vLB1_01,*vLB1_11,*vLB1_21,*vLB1_31,*vLB1_41,*vLB1_51,*vLB1_61,*vLB1_71,*vLB1_81,*vLB1_91;
FILE *vLB2_01,*vLB2_11,*vLB2_21,*vLB2_31,*vLB2_41,*vLB2_51,*vLB2_61,*vLB2_71,*vLB2_81,*vLB2_91;
FILE *vLB3_01,*vLB3_11,*vLB3_21,*vLB3_31,*vLB3_41,*vLB3_51,*vLB3_61,*vLB3_71,*vLB3_81,*vLB3_91;
FILE *vLB4_01,*vLB4_11,*vLB4_21,*vLB4_31,*vLB4_41,*vLB4_51,*vLB4_61,*vLB4_71,*vLB4_81,*vLB4_91;
FILE *vLB5_01,*vLB5_11,*vLB5_21,*vLB5_31,*vLB5_41,*vLB5_51,*vLB5_61,*vLB5_71,*vLB5_81,*vLB5_91;
FILE *vLB6_01,*vLB6_11,*vLB6_21,*vLB6_31,*vLB6_41,*vLB6_51,*vLB6_61,*vLB6_71,*vLB6_81,*vLB6_91;
FILE *vLB7_01,*vLB7_11,*vLB7_21,*vLB7_31,*vLB7_41,*vLB7_51,*vLB7_61,*vLB7_71,*vLB7_81,*vLB7_91;
//V2 cells
FILE *uPY0_02,*uPY0_12,*uPY0_22,*uPY0_32,*uPY0_42,*uPY0_52,*uPY0_62,*uPY0_72,*uPY0_82,*uPY0_92;
FILE *uPY1_02,*uPY1_12,*uPY1_22,*uPY1_32,*uPY1_42,*uPY1_52,*uPY1_62,*uPY1_72,*uPY1_82,*uPY1_92;
FILE *uPY2_02,*uPY2_12,*uPY2_22,*uPY2_32,*uPY2_42,*uPY2_52,*uPY2_62,*uPY2_72,*uPY2_82,*uPY2_92;
FILE *uPY3_02,*uPY3_12,*uPY3_22,*uPY3_32,*uPY3_42,*uPY3_52,*uPY3_62,*uPY3_72,*uPY3_82,*uPY3_92;
FILE *uPY4_02,*uPY4_12,*uPY4_22,*uPY4_32,*uPY4_42,*uPY4_52,*uPY4_62,*uPY4_72,*uPY4_82,*uPY4_92;
FILE *uPY5_02,*uPY5_12,*uPY5_22,*uPY5_32,*uPY5_42,*uPY5_52,*uPY5_62,*uPY5_72,*uPY5_82,*uPY5_92;
FILE *uPY6_02,*uPY6_12,*uPY6_22,*uPY6_32,*uPY6_42,*uPY6_52,*uPY6_62,*uPY6_72,*uPY6_82,*uPY6_92;
FILE *uPY7_02,*uPY7_12,*uPY7_22,*uPY7_32,*uPY7_42,*uPY7_52,*uPY7_62,*uPY7_72,*uPY7_82,*uPY7_92;
FILE *leak2,*rec2,*fed2,*lat2,*ext2;
FILE *extSB2,*extLB2;
FILE *vPY0_02,*vPY0_12,*vPY0_22,*vPY0_32,*vPY0_42,*vPY0_52,*vPY0_62,*vPY0_72,*vPY0_82,*vPY0_92;
FILE *vPY1_02,*vPY1_12,*vPY1_22,*vPY1_32,*vPY1_42,*vPY1_52,*vPY1_62,*vPY1_72,*vPY1_82,*vPY1_92;
FILE *vPY2_02,*vPY2_12,*vPY2_22,*vPY2_32,*vPY2_42,*vPY2_52,*vPY2_62,*vPY2_72,*vPY2_82,*vPY2_92;
FILE *vPY3_02,*vPY3_12,*vPY3_22,*vPY3_32,*vPY3_42,*vPY3_52,*vPY3_62,*vPY3_72,*vPY3_82,*vPY3_92;
FILE *vPY4_02,*vPY4_12,*vPY4_22,*vPY4_32,*vPY4_42,*vPY4_52,*vPY4_62,*vPY4_72,*vPY4_82,*vPY4_92;
FILE *vPY5_02,*vPY5_12,*vPY5_22,*vPY5_32,*vPY5_42,*vPY5_52,*vPY5_62,*vPY5_72,*vPY5_82,*vPY5_92;
FILE *vPY6_02,*vPY6_12,*vPY6_22,*vPY6_32,*vPY6_42,*vPY6_52,*vPY6_62,*vPY6_72,*vPY6_82,*vPY6_92;
FILE *vPY7_02,*vPY7_12,*vPY7_22,*vPY7_32,*vPY7_42,*vPY7_52,*vPY7_62,*vPY7_72,*vPY7_82,*vPY7_92;
FILE *uLB0_02,*uLB1_02,*uLB2_02,*uLB3_02,*uLB4_02,*uLB5_02,*uLB6_02,*uLB7_02;
FILE *vLB0_02,*vLB0_12,*vLB0_22,*vLB0_32,*vLB0_42,*vLB0_52,*vLB0_62,*vLB0_72,*vLB0_82,*vLB0_92;
FILE *vLB1_02,*vLB1_12,*vLB1_22,*vLB1_32,*vLB1_42,*vLB1_52,*vLB1_62,*vLB1_72,*vLB1_82,*vLB1_92;
FILE *vLB2_02,*vLB2_12,*vLB2_22,*vLB2_32,*vLB2_42,*vLB2_52,*vLB2_62,*vLB2_72,*vLB2_82,*vLB2_92;
FILE *vLB3_02,*vLB3_12,*vLB3_22,*vLB3_32,*vLB3_42,*vLB3_52,*vLB3_62,*vLB3_72,*vLB3_82,*vLB3_92;
FILE *vLB4_02,*vLB4_12,*vLB4_22,*vLB4_32,*vLB4_42,*vLB4_52,*vLB4_62,*vLB4_72,*vLB4_82,*vLB4_92;
FILE *vLB5_02,*vLB5_12,*vLB5_22,*vLB5_32,*vLB5_42,*vLB5_52,*vLB5_62,*vLB5_72,*vLB5_82,*vLB5_92;
FILE *vLB6_02,*vLB6_12,*vLB6_22,*vLB6_32,*vLB6_42,*vLB6_52,*vLB6_62,*vLB6_72,*vLB6_82,*vLB6_92;
FILE *vLB7_02,*vLB7_12,*vLB7_22,*vLB7_32,*vLB7_42,*vLB7_52,*vLB7_62,*vLB7_72,*vLB7_82,*vLB7_92;
FILE *uM0_02,*uM0_12,*uM0_22,*uM0_32,*uM0_42,*uM0_52,*uM0_62,*uM0_72,*uM0_82,*uM0_92;
FILE *uM1_02,*uM1_12,*uM1_22,*uM1_32,*uM1_42,*uM1_52,*uM1_62,*uM1_72,*uM1_82,*uM1_92;
FILE *uM2_02,*uM2_12,*uM2_22,*uM2_32,*uM2_42,*uM2_52,*uM2_62,*uM2_72,*uM2_82,*uM2_92;
FILE *uM3_02,*uM3_12,*uM3_22,*uM3_32,*uM3_42,*uM3_52,*uM3_62,*uM3_72,*uM3_82,*uM3_92;
FILE *uM4_02,*uM4_12,*uM4_22,*uM4_32,*uM4_42,*uM4_52,*uM4_62,*uM4_72,*uM4_82,*uM4_92;
FILE *uM5_02,*uM5_12,*uM5_22,*uM5_32,*uM5_42,*uM5_52,*uM5_62,*uM5_72,*uM5_82,*uM5_92;
FILE *uM6_02,*uM6_12,*uM6_22,*uM6_32,*uM6_42,*uM6_52,*uM6_62,*uM6_72,*uM6_82,*uM6_92;
FILE *uM7_02,*uM7_12,*uM7_22,*uM7_32,*uM7_42,*uM7_52,*uM7_62,*uM7_72,*uM7_82,*uM7_92;
FILE *vM0_02,*vM0_12,*vM0_22,*vM0_32,*vM0_42,*vM0_52,*vM0_62,*vM0_72,*vM0_82,*vM0_92;
FILE *vM1_02,*vM1_12,*vM1_22,*vM1_32,*vM1_42,*vM1_52,*vM1_62,*vM1_72,*vM1_82,*vM1_92;
FILE *vM2_02,*vM2_12,*vM2_22,*vM2_32,*vM2_42,*vM2_52,*vM2_62,*vM2_72,*vM2_82,*vM2_92;
FILE *vM3_02,*vM3_12,*vM3_22,*vM3_32,*vM3_42,*vM3_52,*vM3_62,*vM3_72,*vM3_82,*vM3_92;
FILE *vM4_02,*vM4_12,*vM4_22,*vM4_32,*vM4_42,*vM4_52,*vM4_62,*vM4_72,*vM4_82,*vM4_92;
FILE *vM5_02,*vM5_12,*vM5_22,*vM5_32,*vM5_42,*vM5_52,*vM5_62,*vM5_72,*vM5_82,*vM5_92;
FILE *vM6_02,*vM6_12,*vM6_22,*vM6_32,*vM6_42,*vM6_52,*vM6_62,*vM6_72,*vM6_82,*vM6_92;
FILE *vM7_02,*vM7_12,*vM7_22,*vM7_32,*vM7_42,*vM7_52,*vM7_62,*vM7_72,*vM7_82,*vM7_92;
void main(void){
int theta,i,ii;
double sigPYT,sigSBT,sigLBT,sigMT;
int ActPY1_ON[N_assm+2][N_T+2],ActSB1_ON[N_assm+2][N_T+2],ActLB1_ON[N_assm+2][N_T+2],duration;
int ActPY2_ON[N_assm+2][N_T+2],ActSB2_ON[N_assm+2][N_T+2],ActLB2_ON[N_assm+2][N_T+2],ActM_ON[N_assm+2][N_T+2];
int ActPY1_OF[N_assm+2][N_T+2],ActSB1_OF[N_assm+2][N_T+2],ActLB1_OF[N_assm+2][N_T+2];
int ActPY2_OF[N_assm+2][N_T+2],ActSB2_OF[N_assm+2][N_T+2],ActLB2_OF[N_assm+2][N_T+2],ActM_OF[N_assm+2][N_T+2];
init();
// V1 cells
uPY0_01=fopen("uPY0_01.dat","w");
uPY1_01=fopen("uPY1_01.dat","w");
uPY2_01=fopen("uPY2_01.dat","w");
uPY3_01=fopen("uPY3_01.dat","w");
uPY4_01=fopen("uPY4_01.dat","w");
uPY5_01=fopen("uPY5_01.dat","w");
uPY6_01=fopen("uPY6_01.dat","w");
uPY7_01=fopen("uPY7_01.dat","w");
leak1 =fopen("leak1c.dat","w"); // a given PYCÖÌinput currents
rec1 =fopen("rec1c.dat","w");
fed1 =fopen("fed1c.dat","w");
lat1 =fopen("lat1c.dat","w");
ext1 =fopen("ext1c.dat","w");
topdown =fopen("topdownc.dat","w");
MG1 =fopen("MG1c.dat","w");
extSB1 =fopen("extSBc1.dat","w");
extLB1 =fopen("extLBc1.dat","w");
vPY0_01=fopen("vPY0_01.dat","w");
vPY0_11=fopen("vPY0_11.dat","w");
vPY0_21=fopen("vPY0_21.dat","w");
vPY0_31=fopen("vPY0_31.dat","w");
vPY0_41=fopen("vPY0_41.dat","w");
vPY0_51=fopen("vPY0_51.dat","w");
vPY0_61=fopen("vPY0_61.dat","w");
vPY0_71=fopen("vPY0_71.dat","w");
vPY0_81=fopen("vPY0_81.dat","w");
vPY0_91=fopen("vPY0_91.dat","w");
vPY1_01=fopen("vPY1_01.dat","w");
vPY1_11=fopen("vPY1_11.dat","w");
vPY1_21=fopen("vPY1_21.dat","w");
vPY1_31=fopen("vPY1_31.dat","w");
vPY1_41=fopen("vPY1_41.dat","w");
vPY1_51=fopen("vPY1_51.dat","w");
vPY1_61=fopen("vPY1_61.dat","w");
vPY1_71=fopen("vPY1_71.dat","w");
vPY1_81=fopen("vPY1_81.dat","w");
vPY1_91=fopen("vPY1_91.dat","w");
vPY2_01=fopen("vPY2_01.dat","w");
vPY2_11=fopen("vPY2_11.dat","w");
vPY2_21=fopen("vPY2_21.dat","w");
vPY2_31=fopen("vPY2_31.dat","w");
vPY2_41=fopen("vPY2_41.dat","w");
vPY2_51=fopen("vPY2_51.dat","w");
vPY2_61=fopen("vPY2_61.dat","w");
vPY2_71=fopen("vPY2_71.dat","w");
vPY2_81=fopen("vPY2_81.dat","w");
vPY2_91=fopen("vPY2_91.dat","w");
vPY3_01=fopen("vPY3_01.dat","w");
vPY3_11=fopen("vPY3_11.dat","w");
vPY3_21=fopen("vPY3_21.dat","w");
vPY3_31=fopen("vPY3_31.dat","w");
vPY3_41=fopen("vPY3_41.dat","w");
vPY3_51=fopen("vPY3_51.dat","w");
vPY3_61=fopen("vPY3_61.dat","w");
vPY3_71=fopen("vPY3_71.dat","w");
vPY3_81=fopen("vPY3_81.dat","w");
vPY3_91=fopen("vPY3_91.dat","w");
vPY4_01=fopen("vPY4_01.dat","w");
vPY4_11=fopen("vPY4_11.dat","w");
vPY4_21=fopen("vPY4_21.dat","w");
vPY4_31=fopen("vPY4_31.dat","w");
vPY4_41=fopen("vPY4_41.dat","w");
vPY4_51=fopen("vPY4_51.dat","w");
vPY4_61=fopen("vPY4_61.dat","w");
vPY4_71=fopen("vPY4_71.dat","w");
vPY4_81=fopen("vPY4_81.dat","w");
vPY4_91=fopen("vPY4_91.dat","w");
vPY5_01=fopen("vPY5_01.dat","w");
vPY5_11=fopen("vPY5_11.dat","w");
vPY5_21=fopen("vPY5_21.dat","w");
vPY5_31=fopen("vPY5_31.dat","w");
vPY5_41=fopen("vPY5_41.dat","w");
vPY5_51=fopen("vPY5_51.dat","w");
vPY5_61=fopen("vPY5_61.dat","w");
vPY5_71=fopen("vPY5_71.dat","w");
vPY5_81=fopen("vPY5_81.dat","w");
vPY5_91=fopen("vPY5_91.dat","w");
vPY6_01=fopen("vPY6_01.dat","w");
vPY6_11=fopen("vPY6_11.dat","w");
vPY6_21=fopen("vPY6_21.dat","w");
vPY6_31=fopen("vPY6_31.dat","w");
vPY6_41=fopen("vPY6_41.dat","w");
vPY6_51=fopen("vPY6_51.dat","w");
vPY6_61=fopen("vPY6_61.dat","w");
vPY6_71=fopen("vPY6_71.dat","w");
vPY6_81=fopen("vPY6_81.dat","w");
vPY6_91=fopen("vPY6_91.dat","w");
vPY7_01=fopen("vPY7_01.dat","w");
vPY7_11=fopen("vPY7_11.dat","w");
vPY7_21=fopen("vPY7_21.dat","w");
vPY7_31=fopen("vPY7_31.dat","w");
vPY7_41=fopen("vPY7_41.dat","w");
vPY7_51=fopen("vPY7_51.dat","w");
vPY7_61=fopen("vPY7_61.dat","w");
vPY7_71=fopen("vPY7_71.dat","w");
vPY7_81=fopen("vPY7_81.dat","w");
vPY7_91=fopen("vPY7_91.dat","w");
uSB0_01=fopen("uSB0_01.dat","w");
uSB1_01=fopen("uSB1_01.dat","w");
uSB2_01=fopen("uSB2_01.dat","w");
uSB3_01=fopen("uSB3_01.dat","w");
uSB4_01=fopen("uSB4_01.dat","w");
uSB5_01=fopen("uSB5_01.dat","w");
uSB6_01=fopen("uSB6_01.dat","w");
uSB7_01=fopen("uSB7_01.dat","w");
uLB0_01=fopen("uLB0_01.dat","w");
uLB1_01=fopen("uLB1_01.dat","w");
uLB2_01=fopen("uLB2_01.dat","w");
uLB3_01=fopen("uLB3_01.dat","w");
uLB4_01=fopen("uLB4_01.dat","w");
uLB5_01=fopen("uLB5_01.dat","w");
uLB6_01=fopen("uLB6_01.dat","w");
uLB7_01=fopen("uLB7_01.dat","w");
// V2 cells
uPY0_02=fopen("uPY0_02.dat","w");
uPY1_02=fopen("uPY1_02.dat","w");
uPY2_02=fopen("uPY2_02.dat","w");
uPY3_02=fopen("uPY3_02.dat","w");
uPY4_02=fopen("uPY4_02.dat","w");
uPY5_02=fopen("uPY5_02.dat","w");
uPY6_02=fopen("uPY6_02.dat","w");
uPY7_02=fopen("uPY7_02.dat","w");
vPY0_02=fopen("vPY0_02.dat","w");
vPY0_12=fopen("vPY0_12.dat","w");
vPY0_22=fopen("vPY0_22.dat","w");
vPY0_32=fopen("vPY0_32.dat","w");
vPY0_42=fopen("vPY0_42.dat","w");
vPY0_52=fopen("vPY0_52.dat","w");
vPY0_62=fopen("vPY0_62.dat","w");
vPY0_72=fopen("vPY0_72.dat","w");
vPY0_82=fopen("vPY0_82.dat","w");
vPY0_92=fopen("vPY0_92.dat","w");
vPY1_02=fopen("vPY1_02.dat","w");
vPY1_12=fopen("vPY1_12.dat","w");
vPY1_22=fopen("vPY1_22.dat","w");
vPY1_32=fopen("vPY1_32.dat","w");
vPY1_42=fopen("vPY1_42.dat","w");
vPY1_52=fopen("vPY1_52.dat","w");
vPY1_62=fopen("vPY1_62.dat","w");
vPY1_72=fopen("vPY1_72.dat","w");
vPY1_82=fopen("vPY1_82.dat","w");
vPY1_92=fopen("vPY1_92.dat","w");
vPY2_02=fopen("vPY2_02.dat","w");
vPY2_12=fopen("vPY2_12.dat","w");
vPY2_22=fopen("vPY2_22.dat","w");
vPY2_32=fopen("vPY2_32.dat","w");
vPY2_42=fopen("vPY2_42.dat","w");
vPY2_52=fopen("vPY2_52.dat","w");
vPY2_62=fopen("vPY2_62.dat","w");
vPY2_72=fopen("vPY2_72.dat","w");
vPY2_82=fopen("vPY2_82.dat","w");
vPY2_92=fopen("vPY2_92.dat","w");
vPY3_02=fopen("vPY3_02.dat","w");
vPY3_12=fopen("vPY3_12.dat","w");
vPY3_22=fopen("vPY3_22.dat","w");
vPY3_32=fopen("vPY3_32.dat","w");
vPY3_42=fopen("vPY3_42.dat","w");
vPY3_52=fopen("vPY3_52.dat","w");
vPY3_62=fopen("vPY3_62.dat","w");
vPY3_72=fopen("vPY3_72.dat","w");
vPY3_82=fopen("vPY3_82.dat","w");
vPY3_92=fopen("vPY3_92.dat","w");
vPY4_02=fopen("vPY4_02.dat","w");
vPY4_12=fopen("vPY4_12.dat","w");
vPY4_22=fopen("vPY4_22.dat","w");
vPY4_32=fopen("vPY4_32.dat","w");
vPY4_42=fopen("vPY4_42.dat","w");
vPY4_52=fopen("vPY4_52.dat","w");
vPY4_62=fopen("vPY4_62.dat","w");
vPY4_72=fopen("vPY4_72.dat","w");
vPY4_82=fopen("vPY4_82.dat","w");
vPY4_92=fopen("vPY4_92.dat","w");
vPY5_02=fopen("vPY5_02.dat","w");
vPY5_12=fopen("vPY5_12.dat","w");
vPY5_22=fopen("vPY5_22.dat","w");
vPY5_32=fopen("vPY5_32.dat","w");
vPY5_42=fopen("vPY5_42.dat","w");
vPY5_52=fopen("vPY5_52.dat","w");
vPY5_62=fopen("vPY5_62.dat","w");
vPY5_72=fopen("vPY5_72.dat","w");
vPY5_82=fopen("vPY5_82.dat","w");
vPY5_92=fopen("vPY5_92.dat","w");
vPY6_02=fopen("vPY6_02.dat","w");
vPY6_12=fopen("vPY6_12.dat","w");
vPY6_22=fopen("vPY6_22.dat","w");
vPY6_32=fopen("vPY6_32.dat","w");
vPY6_42=fopen("vPY6_42.dat","w");
vPY6_52=fopen("vPY6_52.dat","w");
vPY6_62=fopen("vPY6_62.dat","w");
vPY6_72=fopen("vPY6_72.dat","w");
vPY6_82=fopen("vPY6_82.dat","w");
vPY6_92=fopen("vPY6_92.dat","w");
vPY7_02=fopen("vPY7_02.dat","w");
vPY7_12=fopen("vPY7_12.dat","w");
vPY7_22=fopen("vPY7_22.dat","w");
vPY7_32=fopen("vPY7_32.dat","w");
vPY7_42=fopen("vPY7_42.dat","w");
vPY7_52=fopen("vPY7_52.dat","w");
vPY7_62=fopen("vPY7_62.dat","w");
vPY7_72=fopen("vPY7_72.dat","w");
vPY7_82=fopen("vPY7_82.dat","w");
vPY7_92=fopen("vPY7_92.dat","w");
uLB0_02=fopen("uLB0_02.dat","w");
uLB1_02=fopen("uLB1_02.dat","w");
uLB2_02=fopen("uLB2_02.dat","w");
uLB3_02=fopen("uLB3_02.dat","w");
uLB4_02=fopen("uLB4_02.dat","w");
uLB5_02=fopen("uLB5_02.dat","w");
uLB6_02=fopen("uLB6_02.dat","w");
uLB7_02=fopen("uLB7_02.dat","w");
uM0_02=fopen("uM0_02.dat","w");
uM1_02=fopen("uM1_02.dat","w");
uM2_02=fopen("uM2_02.dat","w");
uM3_02=fopen("uM3_02.dat","w");
uM4_02=fopen("uM4_02.dat","w");
uM5_02=fopen("uM5_02.dat","w");
uM6_02=fopen("uM6_02.dat","w");
uM7_02=fopen("uM7_02.dat","w");
vM3_02=fopen("vM3_02.dat","w");
vM3_12=fopen("vM3_12.dat","w");
vM3_22=fopen("vM3_22.dat","w");
vM3_32=fopen("vM3_32.dat","w");
vM3_42=fopen("vM3_42.dat","w");
vM3_52=fopen("vM3_52.dat","w");
vM3_62=fopen("vM3_62.dat","w");
vM3_72=fopen("vM3_72.dat","w");
vM3_82=fopen("vM3_82.dat","w");
vM3_92=fopen("vM3_92.dat","w");
for (theta=0; theta<=N_assm; ++theta){
for (ii=0; ii<=N_T; ++ii){
ActPY1_ON[theta][ii] = 0;
ActSB1_ON[theta][ii] = 0;
ActLB1_ON[theta][ii] = 0;
ActPY1_OF[theta][ii] = 0;
ActSB1_OF[theta][ii] = 0;
ActLB1_OF[theta][ii] = 0;
uPY1[theta][ii]=UPYres;
uSB1[theta][ii]=USBres;
uLB1[theta][ii]=ULBres;
}
}
for (theta=0; theta<=N_assm; ++theta){
for (ii=0; ii<=N_T; ++ii){
ActPY2_ON[theta][ii] = 0;
ActM_ON[theta][ii] = 0;
ActSB2_ON[theta][ii] = 0;
ActLB2_ON[theta][ii] = 0;
ActPY2_OF[theta][ii] = 0;
ActM_OF[theta][ii] = 0;
ActSB2_OF[theta][ii] = 0;
ActLB2_OF[theta][ii] = 0;
uPY2[theta][ii]=UPYres;
uM[theta][ii]=UMres;
uSB2[theta][ii]=USBres;
uLB2[theta][ii]=ULBres;
}
}
duration = (int)(0.001/DT);
for (t=0; t<PERIOD; ++t){
display();
for (theta=0; theta<=N_assm-1; ++theta){
for (i=0; i<=N_T; ++i){
if (theta==COLUMN && i==NEURON){
I_leak1 = duPY_leak1[theta][i]*(cmPY/DT);
I_rec_1 = duPY_rec_1[theta][i]*(cmPY/DT);
I_fed_1 = duPY_fed_1[theta][i]*(cmPY/DT);
I_lat_1 = duPY_lat_1[theta][i]*(cmPY/DT);
I_topdown = duPY_topdown[theta][i]*(cmPY/DT);
I_ext_1 = duPY_ext_1[theta][i]*(cmPY/DT);
I_MG1 = duPY_MGB1[theta]*(cmPY/DT)*(int)(rand()/32768.0+inp_prob);
}
uPY1[theta][i] += difuPY1(theta,i);
sigPYT = sigmoidPY(uPY1[theta][i]);
if (ActPY1_ON[theta][i]==0 && ActPY1_OF[theta][i]==0) vPY1[theta][i][t]=(double)(int)(rand01(&SEEDMP)+sigPYT);
if (vPY1[theta][i][t]==1.0){
uPY1[theta][i]=UPYact;
GlutPY_c1[theta][i]=Glut_c;
ActPY1_ON[theta][i]=1;
ActPY1_OF[theta][i]=1;
}else{
GlutPY_c1[theta][i]=0.0;
}
if (ActPY1_ON[theta][i] != 0){
++ActPY1_ON[theta][i];
uPY1[theta][i]=UPYact;
GlutPY_c1[theta][i]=Glut_c;
}
if (ActPY1_OF[theta][i] != 0){
++ActPY1_OF[theta][i];
}
if (ActPY1_ON[theta][i] > duration){
uPY1[theta][i]=UPYres;
ActPY1_ON[theta][i] = 0;
}
if (ActPY1_OF[theta][i] > 10*duration){
ActPY1_OF[theta][i] = 0;
}
rPY1[theta][i] += difrPY1(theta,i);
rPY1d[theta][i][t] = rPY1[theta][i];
if (t%INTV == 0){
}
uSB1[theta][i] += difuSB1(theta,i);
sigSBT = sigmoidSB(uSB1[theta][i]);
if (ActSB1_ON[theta][i]==0 && ActSB1_OF[theta][i]==0) vSB1[theta][i][t]=(double)(int)(rand01(&SEEDMP)+sigSBT);
if (vSB1[theta][i][t]==1.0){
uSB1[theta][i]=USBact;
GABASB_c1[theta][i][t]=GABA_cS;
ActSB1_ON[theta][i]=1;
ActSB1_OF[theta][i]=1;
}else{
GABASB_c1[theta][i][t]=0.0;
}
if (ActSB1_ON[theta][i] != 0){
++ActSB1_ON[theta][i];
uSB1[theta][i]=USBact;
GABASB_c1[theta][i][t]=GABA_cS;
}
if (ActSB1_OF[theta][i] != 0){
++ActSB1_OF[theta][i];
}
if (ActSB1_ON[theta][i] > duration){
uSB1[theta][i]=USBres;
ActSB1_ON[theta][i] = 0;
}
if (ActSB1_OF[theta][i] > 10*duration){
ActSB1_OF[theta][i] = 0;
}
rSB1[theta][i] += difrSB1(theta,i);
sF[theta][i] += difsF(theta,i);
if (t%INTV == 0){
}
uLB1[theta][i] += difuLB1(theta,i);
sigLBT = sigmoidLB(uLB1[theta][i]);
if (ActLB1_ON[theta][i]==0 && ActLB1_OF[theta][i]==0) vLB1[theta][i][t]=(double)(int)(rand01(&SEEDMP)+sigLBT);
if (vLB1[theta][i][t]==1.0){
uLB1[theta][i]=ULBact;
GABALB_c1[theta][i][t]=GABA_cL1;
ActLB1_ON[theta][i]=1;
ActLB1_OF[theta][i]=1;
}else{
GABALB_c1[theta][i][t]=0.0;
}
if (ActLB1_ON[theta][i] != 0){
++ActLB1_ON[theta][i];
uLB1[theta][i]=ULBact;
GABALB_c1[theta][i][t]=GABA_cL1;
}
if (ActLB1_OF[theta][i] != 0){
++ActLB1_OF[theta][i];
}
if (ActLB1_ON[theta][i] > duration){
uLB1[theta][i]=ULBres;
ActLB1_ON[theta][i] = 0;
}
if (ActLB1_OF[theta][i] > 10*duration){
ActLB1_OF[theta][i] = 0;
}
rLB1[theta][i] += difrLB1(theta,i);
if (t%INTV == 0){
}
if (theta==COLUMN && i==NEURON){
I_leak2 = duPY_leak2[theta][i]*(cmPY/DT);
I_rec_2 = duPY_rec_2[theta][i]*(cmPY/DT);
I_fed_2 = duPY_fed_2[theta][i]*(cmPY/DT);
I_lat_2 = duPY_lat_2[theta][i]*(cmPY/DT);
I_ext_2 = duPY_ext_2[theta][i]*(cmPY/DT);
}
uPY2[theta][i] += difuPY2(theta,i);
sigPYT = sigmoidPY2(uPY2[theta][i]);
if (ActPY2_ON[theta][i]==0 && ActPY2_OF[theta][i]==0) vPY2[theta][i][t]=(double)(int)(rand01(&SEEDMP)+sigPYT);
if (vPY2[theta][i][t]==1.0){
uPY2[theta][i]=UPYact;
GlutPY_c2[theta][i]=Glut_c;
ActPY2_ON[theta][i]=1;
ActPY2_OF[theta][i]=1;
}else{
GlutPY_c2[theta][i]=0.0;
}
if (ActPY2_ON[theta][i] != 0){
++ActPY2_ON[theta][i];
uPY2[theta][i]=UPYact;
GlutPY_c2[theta][i]=Glut_c;
}
if (ActPY2_OF[theta][i] != 0){
++ActPY2_OF[theta][i];
}
if (ActPY2_ON[theta][i] > duration){
uPY2[theta][i]=UPYres;
ActPY2_ON[theta][i] = 0;
}
if (ActPY2_OF[theta][i] > 10*duration){
ActPY2_OF[theta][i] = 0;
}
rPY2[theta][i] += difrPY2(theta,i);
rPY2d[theta][i][t] = rPY2[theta][i];
if (t%INTV == 0){
}
uM[theta][i] += difuM(theta,i);
sigMT = sigmoidM(uM[theta][i]);
if (ActM_ON[theta][i]==0 && ActM_OF[theta][i]==0) vM[theta][i][t]=(double)(int)(rand01(&SEEDMP)+sigMT);
if (vM[theta][i][t]==1.0){
uM[theta][i]=UMact;
GlutM[theta][i]=Glut_c;
ActM_ON[theta][i]=1;
ActM_OF[theta][i]=1;
}else{
GlutM[theta][i]=0.0;
}
if (ActM_ON[theta][i] != 0){
++ActM_ON[theta][i];
uM[theta][i]=UMact;
GlutM[theta][i]=Glut_c;
}
if (ActM_OF[theta][i] != 0){
++ActM_OF[theta][i];
}
if (ActM_ON[theta][i] > duration){
uM[theta][i]=UMres;
ActM_ON[theta][i] = 0;
}
if (ActM_OF[theta][i] > 10*duration){
ActM_OF[theta][i] = 0;
}
rM[theta][i] += difrM(theta,i);
rMd[theta][i][t] = rM[theta][i];
if (t%INTV == 0){
}
uSB2[theta][i] += difuSB2(theta,i);
sigSBT = sigmoidSB2(uSB2[theta][i]);
if (ActSB2_ON[theta][i]==0 && ActSB2_OF[theta][i]==0) vSB2[theta][i][t]=(double)(int)(rand01(&SEEDMP)+sigSBT);
if (vSB2[theta][i][t]==1.0){
uSB2[theta][i]=USBact;
GABASB_c2[theta][i][t]=GABA_cS;
ActSB2_ON[theta][i]=1;
ActSB2_OF[theta][i]=1;
}else{
GABASB_c2[theta][i][t]=0.0;
}
if (ActSB2_ON[theta][i] != 0){
++ActSB2_ON[theta][i];
uSB2[theta][i]=USBact;
GABASB_c2[theta][i][t]=GABA_cS;
}
if (ActSB2_OF[theta][i] != 0){
++ActSB2_OF[theta][i];
}
if (ActSB2_ON[theta][i] > duration){
uSB2[theta][i]=USBres;
ActSB2_ON[theta][i] = 0;
}
if (ActSB2_OF[theta][i] > 10*duration){
ActSB2_OF[theta][i] = 0;
}
rSB2[theta][i] += difrSB2(theta,i);
if (t%INTV == 0){
}
uLB2[theta][i] += difuLB2(theta,i);
sigLBT = sigmoidLB2(uLB2[theta][i]);
if (ActLB2_ON[theta][i]==0 && ActLB2_OF[theta][i]==0) vLB2[theta][i][t]=(double)(int)(rand01(&SEEDMP)+sigLBT);
if (vLB2[theta][i][t]==1.0){
uLB2[theta][i]=ULBact;
GABALB_c2[theta][i][t]=GABA_cL2;
ActLB2_ON[theta][i]=1;
ActLB2_OF[theta][i]=1;
}else{
GABALB_c2[theta][i][t]=0.0;
}
if (ActLB2_ON[theta][i] != 0){
++ActLB2_ON[theta][i];
uLB2[theta][i]=ULBact;
GABALB_c2[theta][i][t]=GABA_cL2;
}
if (ActLB2_OF[theta][i] != 0){
++ActLB2_OF[theta][i];
}
if (ActLB2_ON[theta][i] > duration){
uLB2[theta][i]=ULBres;
ActLB2_ON[theta][i] = 0;
}
if (ActLB2_OF[theta][i] > 10*duration){
ActLB2_OF[theta][i] = 0;
}
rLB2[theta][i] += difrLB2(theta,i);
if (t%INTV == 0){
}
if (t>=OUT){
if (theta==0 && i==0){
fprintf(uPY0_01,"%f\n",uPY1[theta][i]);
fprintf(uPY0_02,"%f\n",uPY2[theta][i]);
fprintf(uM0_02,"%f\n",uM[theta][i]);
fprintf(uSB0_01,"%f\n",uSB1[theta][i]);
fprintf(uLB0_01,"%f\n",uLB1[theta][i]);
fprintf(uLB0_02,"%f\n",uLB2[theta][i]);
if (vPY1[theta][i][t]==0.0){
fprintf(vPY0_01,"%f\n",-10.0);
}else{
fprintf(vPY0_01,"%f\n",vPY1[theta][i][t]+OFSBCA*theta+i*OFSWCA);
}
if (vPY2[theta][i][t]==0.0){
fprintf(vPY0_02,"%f\n",-10.0);
}else{
fprintf(vPY0_02,"%f\n",vPY2[theta][i][t]+OFSBCA*theta+i*OFSWCA);
}
}
if (theta==0 && i==1){
if (vPY1[theta][i][t]==0.0){
fprintf(vPY0_11,"%f\n",-10.0);
}else{
fprintf(vPY0_11,"%f\n",vPY1[theta][i][t]+OFSBCA*theta+i*OFSWCA);
}
if (vPY2[theta][i][t]==0.0){
fprintf(vPY0_12,"%f\n",-10.0);
}else{
fprintf(vPY0_12,"%f\n",vPY2[theta][i][t]+OFSBCA*theta+i*OFSWCA);
}
}
if (theta==0 && i==2){
if (vPY1[theta][i][t]==0.0){
fprintf(vPY0_21,"%f\n",-10.0);
}else{
fprintf(vPY0_21,"%f\n",vPY1[theta][i][t]+OFSBCA*theta+i*OFSWCA);
}
if (vPY2[theta][i][t]==0.0){
fprintf(vPY0_22,"%f\n",-10.0);
}else{
fprintf(vPY0_22,"%f\n",vPY2[theta][i][t]+OFSBCA*theta+i*OFSWCA);
}
}
if (theta==0 && i==3){
if (vPY1[theta][i][t]==0.0){
fprintf(vPY0_31,"%f\n",-10.0);
}else{
fprintf(vPY0_31,"%f\n",vPY1[theta][i][t]+OFSBCA*theta+i*OFSWCA);
}
if (vPY2[theta][i][t]==0.0){
fprintf(vPY0_32,"%f\n",-10.0);
}else{
fprintf(vPY0_32,"%f\n",vPY2[theta][i][t]+OFSBCA*theta+i*OFSWCA);
}
}
if (theta==0 && i==4){
if (vPY1[theta][i][t]==0.0){
fprintf(vPY0_41,"%f\n",-10.0);
}else{
fprintf(vPY0_41,"%f\n",vPY1[theta][i][t]+OFSBCA*theta+i*OFSWCA);
}
if (vPY2[theta][i][t]==0.0){
fprintf(vPY0_42,"%f\n",-10.0);
}else{
fprintf(vPY0_42,"%f\n",vPY2[theta][i][t]+OFSBCA*theta+i*OFSWCA);
}