/**** This is from the Wolf et al. (2005) modelDB entry.
**    Copied here to the Rumbell optimization code.
**      
**    cmw 9/1/16
**
*****/


//****************************************************************************
// These are the default parameters for creation of the MSP cell.  This file
// is usually called by hoc/nacb_main.hoc

cai0_ca_ion = 0.001		// mM, Churchill 1998
cao0_ca_ion = 5			// mM, Churchill 1998 - gives eca = 100 mV
cali0_cal_ion = 0.001		// mM, Churchill 1998
calo0_cal_ion = 5			// mM, Churchill 1998 - gives eca = 100 mV
celsius = 22			// degC

global_ra = 100		// not really sure what this is
RA = 100			// ohm-cm - constant for whole cell
CM = 0.96563845				// uF-cm2 - constant for whole cell
G_PAS = 0.0001437			// S/cm2
E_PAS = -79.2586			// mV

G_NAF = 3.5526529495	// soma only
G_NAFD = 0.0195	// all dends
G_NAP = 0.0003926929// soma only
G_NAPD = 1.3802e-7	// all dends, according to Wolf et al. paper
//G_NAPD = 1.3802e-6	// all dends -- CHANGED in Wolf modelDB entry


G_KIR = 0.00014		// S/cm2
G_KAS = 0.0038245948		// soma & prox dends; s/cm2
G_KASD = 0.00095142	// mid & distal dends; S/cm2
G_KAF = 0.0789485208 		// soma & prox dends; S/cm2
G_KAFD = 0.020584	// mid & dist dends; S/cm2
G_BKKCA = 0.0031		// 
G_SKKCA = 0.084
G_KDR = 0.0000796449
G_KDR_AIS = 0.0062194784

G_NAF_AIS = 0.2829563051		// different values allowed in axon initial segment
G_KAS_AIS = 0.0208
G_KAF_AIS = 0.0071847962
G_NAP_AIS = 0.004885817

CAINF = 1e-5			// mM, steady state intracell ca conc.
TAUR = 43			// ms, time const of ca diffusion - Jackson 2003
CA_DRIVE = 10000
CA_PUMP = 0.05

caNMDA = 0.1
P_CAL = 7.424e-7			// cm/s
P_CAL13 = 1.8e-7		//1.7e-6		// cm/s
P_CAN = 2.541e-07			// cm/s
P_CAQ = 0			// cm/s
P_CAR = 8.426e-07			// cm/s
P_CAT = 1.154e-07		// cm/s	4e-7

newEK = -94
ENA = 50


NET_N = 1e10

G_AMPA = 8.5e-4		//350e-6		//8.81e-4
G_NMDA = 12.2e-5	// 9.2e-5	
G_GABA = 0.0021		//4300e-6	//0.0027

AMPA_WT = 1
NMDA_WT = 1
GABA_WT = 1

NOISE = 1

NGLU = 126
NGABA = 118
NSYN = NGABA + NGLU

mshift_na = 6.6594
hshift_na = 0.52039
ashift_k = 13.605
bshift_k = 0.33739
mshift_ka = 10.801
hshift_ka = 14.848
mshift_ca = 9.163
hshift_ca = 11.819
HTAUSHIFT_KAS = -88


// factors for adding the Hay axon
CM_MYELINFAC = 0.02		// Hay myelin had cm=0.02, cm=1 in AIS/soma
AXON_MSHIFT  = 10
AXON_HSHIFT  = 5
AXON_MSLOPEFAC = 1.29		// Hay NaT m_slope was 9/mV in axon, 7/mV in soma
SOMA_MVHALF_NAF = -23.9
SOMA_MSLOPE_NAF = -11.8
SOMA_MSHIFT_NAF = 0
SOMA_HVHALF_NAF = -62.9
SOMA_HSLOPE_NAF = 10.7
SOMA_HSHIFT_NAF = 0

/****************************************************************************
//
//  These values were optimized by Hanbing's runs on 3/18/17 (and followed up by christina), including the -170 and -220 pA injections, and optimizing the KIR kinetics. The morphology (dend, soma, axon) is updated, as is the EK value. 
//
//  Results emailed to me from Hanbing, run on redrocks.

when EK=-90, this gave a good fit:

490	  0.0001365906696078 -80.9547669379664967 1.0660721294525504 0.0076461218561479 0.2002160297856376 107.2005009815930237 14.9992977215247709       0.16

and when EK=-94:

581	  0.0001509364628840 	-79.7237135538248225 	0.9678596364433903 	0.0076007689969894 	0.3271353165413586 	106.0772946544010722 	14.9947079698156163 	      0.19

************************************/

G_PAS = 0.000001
E_PAS =  -89.9999984228
CM    = 0.9
G_KIR = 0.0000602945
QKIR  = 0.2
SHKIR = 44.390512
SLPKIR = 14.99999
//dgkaf = 0.0012340247

V0 = -80

P_CAQ = 0			// cm/s - turn this off, Evans excluded it.

      // note, we will include NaP in this optimization due to the axon inclusion.