load_file("nrngui.hoc")

load_file("Richytrunctest2.hoc")
celsius=24

for i=0,7 soma[i] {
	insert passsd
	g_passsd=1.1231e-05
	erev_passsd=-66.164
	insert Kleaksd
	gkl_Kleaksd=3.2258e-06
	Ra=300
	cm=0.9
	ek=-95
	insert IM
	gbar_IM=0.000075
	insert IMminret
	gbar_IMminret=0 // 0.000075
	insert Ikdrf
	gbar_Ikdrf = 0.0006
	insert Ikdrs
	gbar_Ikdrs = 0.00023
	insert Ika
	gbar_Ika = 0.00025
	insert Nasoma
	gna_Nasoma = 0.0107
	ena=90
	insert Ih
	gkhbar_Ih = 0.00005
	eh=-32
}

for i=0,51 dendrite[i] {
	insert passsd
	g_passsd=1.1231e-05
	erev_passsd=-66.164
	insert Kleaksd
	gkl_Kleaksd=3.2258e-06
	insert IM
	gbar_IM = 0.000075
	insert IMminret
	gbar_IMminret=0 // 0.000075
	insert Ikdrf
	gbar_Ikdrf = 0.0006
	insert Ikdrs
	gbar_Ikdrs = 0.00023
	insert Ika
	gbar_Ika = 0.00025
	Ra=300
	cm=0.9
	ek=-95
	insert cal
	gcalbar_cal = 0.0025
	insert cad
	insert cat
	gbar_cat = 0.00025
	insert kca
	gkbar_kca = 0.00055
	insert Nadend
	gna_Nadend = 0.0117
	ena=90
        if (hD == 1) {
          insert Ih
        }
}

for i=0,4 axon[i] {insert passaxon
	g_passaxon=6.1771e-05
	erev_passaxon=-66.164
	insert Kleakaxon
	gkl_Kleakaxon=1.7742e-05
	insert Ikdrfaxon
	gbar_Ikdrfaxon = 0.0006
	insert Ikdrsaxon
	gbar_Ikdrsaxon = 0.00023
	Ra=300
	cm=0.9
	ek=-95
	insert Naaxon
	gna_Naaxon = 0.0117
	ena=90
} 

/* 
 * Need to call this again, because we have changed Ra and cm,
 * which affects the number of compartments since lambda_f
 * is calculated using these two parameters in each section.
 */
geom_nseg()