//Layer V
//Apical Comp 0,2-4
//Oblique Comp 1
//Basal 5-7
//Soma 8
//Layer II
//Apical Comp 0,2-3
//Oblique Comp 1
//Basal 4-6
//Soma 7

//wiring-config_6_1_06.hoc
// FeedForward Inputs to Layer II 
// to e's (seg,rtype 0A-1N,weight,delay)
FFtoII(1,0,0.002,0) //0.002
FFtoII(5,0,0.002,0)
FFtoII(6,0,0.002,0)
// to i's (rtype 0A-1N,weight,delay)
FFtoIL2(0,0.004,0)

// FeedForward Inputs to Layer V 
// to e's (seg,rtype 0A-1N,weight,delay)
FFtoV(1,0,0.001,5) //0.0001
FFtoV(6,0,0.001,5)
FFtoV(7,0,0.001,5)
// to i's (rtype,weight,delay)
FFtoIL5(0,0.002,5)

/****** LATE INPUTS ********/
// FeedForward Inputs to Layer II 
// to e's (seg,rtype 0A-1N,weight,delay)
FF2toII(1,0,0.08,0) //0.005 AMPA
FF2toII(5,0,0.08,0)
FF2toII(6,0,0.08,0)
//FF2toII(1,1,0.005,0) //0.005 NMDA
//FF2toII(5,1,0.005,0)
//FF2toII(6,1,0.005,0)

// to i's (rtype 0A-1N,weight,delay)
FF2toIL2(0,0.08,0) //0.001

// FeedForward Inputs to Layer V 
// to e's (seg,rtype 0A-1N,weight,delay)
FF2toV(1,0,0.04,5) //0.02 AMPA
FF2toV(6,0,0.04,5)
FF2toV(7,0,0.04,5)
//FF2toV(1,1,0.002,5) //0.02 NMDA
//FF2toV(6,1,0.002,5)
//FF2toV(7,1,0.002,5)
// to i's (rtype,weight,delay)
FF2toIL5(0,0.04,5)  //0.001
//TRY TO WEAKEN THESE AGAIN??
//********************//

// FeedBack Inputs to Layer II/V 
// to e's (seg,rtype 0A-1N,weight,delay)
FBtoII(3,1,0.004,0)//0.004 NMDA
FBtoV(4,1,0.004,0)//.0025
FBtoII(3,0,0.004,0)//0.004 AMPA
FBtoV(4,0,0.004,0)//.0025

// to i's (rtype 0A-1N,weight,delay)
FBtoIL2(0,0.002,0)
FBtoIL2(1,0.002,0)

//////////////////////////////////////////////////////
///////////////////////////////////////////////////////
// Layer II excitatory connections
// to e's L2 (maxW,Wsc,seg,rtyp 0A-1N,minD,Dsc)
IItoII(0.001,3,1,0,1,3) //0.005
IItoII(0.001,3,5,0,1,3)
IItoII(0.001,3,6,0,1,3)
IItoII(0.0005,3,1,1,1,3)
IItoII(0.0005,3,5,1,1,3)
IItoII(0.0005,3,6,1,1,3)

// to e's L5
IItoV(0.00025,3,1,0,3,3) //0.00025
IItoV(0.00025,3,6,0,3,3)
IItoV(0.00025,3,7,0,3,3)
IItoV(0.00025,3,4,0,3,3) //0.00025 WSC/DSC=10

// to i's L2(cell#,maxW,Wsc,pos,rtyp 0A-1N,minD,Dsc)
IItoIL2(0,0.01,3,3,0,1,3) //WSC WDC =3 0.001
IItoIL2(1,0.01,3,6,0,1,3)
IItoIL2(2,0.01,3,9,0,1,3)
// to i's L5
IItoIL5(0,0.00025,3,3,0,3,3)
IItoIL5(1,0.00025,3,6,0,3,3)
IItoIL5(2,0.00025,3,9,0,3,3)

// Layer II inhibitory connections
// to e's L2 (cell#,maxW,Wsc,pos,seg,rtype 2GA-3GB,minD,Dsc)
for i=0,2{IL2toII(i,0.05,5,i*3, 7, 2,1,5)} //maxW=0.002 WSC=3 GabaA
for i=0,2{IL2toII(i,0.05,5,i*3, 7, 3,1,5)} // maxW=0 WSC=3 GabaB
// to e's L5
IL2toV(0,0.001,5,3,4,2,1,5) //0.001 6_1 changed to 0.1 added gabaB
IL2toV(1,0.001,5,6,4,2,1,5)	//WSC/DSC 3->7 NOT BAD
IL2toV(2,0.001,5,9,4,2,1,5)
//IL2toV(0,0.01,3,3,4,3,1,3) //0.01 added gabaB 0.01
//IL2toV(1,0.01,3,6,4,3,1,3)	// HELPS GET LATER ACTIVATION
//IL2toV(2,0.01,3,9,4,3,1,3)	
// to i's (maxW,Wsc,minD,Dsc,rtype 2GA-3GB)
IL2toIL2(0.002,2,1,2,2)

// Layer V excitatory connections
// to e's (maxW,Wsc,seg,rtyp 0A-1N,minD,Dsc)
VtoV(0.005,3,6,0,1,3) //0.001 AMPA WSC/DSC=10
VtoV(0.005,3,7,0,1,3)  // 6_1 wsc/dsc 7->10 AGAIN
VtoV(0.005,3,1,0,1,3)	//doesntdomuch?
VtoV(0.0005,3,6,1,1,3) //0.001 NMDA
VtoV(0.0005,3,7,1,1,3)
VtoV(0.0005,3,1,1,1,3)
// to i's (cell#,maxW,Wsc,pos,rtyp 0A-1N,minD,Dsc)
VtoIL5(0,0.001,3,3,0,1,3) //WSC WDC =3 
VtoIL5(1,0.001,3,6,0,1,3)
VtoIL5(2,0.001,3,9,0, 1,3)
//HAVEN'T TRIED E-I NMDA

// Layer V inhibitory connections
// to e's (cell#,maxW,Wsc,pos,seg,rtype 2GA-3GB,minD,Dsc)
for i=0,2{IL5toV(i,0.025,7,i*3,8,2,1,7)} //maxW=0.025 WSC=3GabaA//6_1 0.025->0.1
													//doesntdomuch
for i=0,2{IL5toV(i,0.025,7,i*3, 8, 3,1,7)} // maxW=0.05 WSC=3 GabaB
// to i's (maxW,Wsc,minD,Dsc,rtype 2GA-3GB)
IL5toIL5(0.002,2,1,2,2)


//USING INIT_CORTEX_THRESH.HOC For MAX ... make DEFAULT??