{load_file(1, "fig8-10.ses")}

proc fig8() {local vi
	v_init = 0
	foo(4.99, 50)
	foo(4.99, 140)
	foo(3.0, 50)
	foo(3.0, 140)
}
proc foo() {
	std()
	atp_nakpump = $1
	adp_nakpump = 5.05 - atp_nakpump
	naout_nakpump = $2
	pc(Graph[0],10,&kout_nakpump(.5), &atpact_nakpump(.5), 1, 1)
}
proc pc() {local x
	$o1.beginline($6, 1)
	for (x=0; x <= $2; x += $2/100) {
		$&3 = x
		init()
		$o1.line(x, $&4 * $5)
	}
	$o1.flush()
}

fig8()

// unidirectional na and k flux from equations 13,14 of
// Feher JJ, Biophys J. 1984 June; 45(6): 1125b
// pubmed central:
// http://www.pubmedcentral.nih.gov/articlerender.fcgi?artid=1434995
// na from steps 1-3 and k from steps 4-6
proc unidir() {local d, j12, j23, j34, j21, j32, j43
	j12 = rf_nakpump[1]  j21 = rb_nakpump[1]
	j23 = rf_nakpump[2]  j32 = rb_nakpump[2]
	j34 = rf_nakpump[3]  j43 = rb_nakpump[3]
	d = j32*j21 + j21*j34 + j23*j34
	na_eflux = j12*j23*j34/d
	na_influx = j43*j32*j21/d

	j12 = rf_nakpump[4]  j21 = rb_nakpump[4]
	j23 = rf_nakpump[5]  j32 = rb_nakpump[5]
	j34 = rf_nakpump[6]  j43 = rb_nakpump[6]
	d = j32*j21 + j21*j34 + j23*j34
	k_influx = j12*j23*j34/d
	k_eflux = j43*j32*j21/d
}

proc pv() {
	$o1.beginline($4,$5)
	for (v_init = $6; v_init <= 50; v_init += 1) {
		init()
		unidir()
		$o1.line(v_init, $&2 * $3)
	}
	$o1.flush()
	v_init = 0
}

proc fig9() {
	std()
	pv(Graph[1], &k_influx, 2, 3, 1, -250)
	pv(Graph[1], &k_eflux, 2 , 3, 1, -250)
	pv(Graph[1], &na_influx, 3, 2, 1, -250)
	pv(Graph[1], &na_eflux, 3, 2, 1, -250)
	pv(Graph[1], &atpact_nakpump(.5), 3, 2, 2, -250)
	pv(Graph[1], &atpact_nakpump(.5), 2, 3, 2, -250)

	atp_nakpump = 3
	adp_nakpump = 2.05
	pv(Graph[2], &na_influx, 3, 2, 1, -100)
	pv(Graph[2], &na_eflux, 3, 2, 1, -100)
	pv(Graph[2], &atpact_nakpump(.5), 3, 2, 2, -100)
}
fig9()

proc pv() {
	$o1.beginline($4,$5)
	for (v_init = -250; v_init <= 50; v_init += 1) {
		init()
		$o1.line(v_init, $&2 * $3)
	}
	$o1.flush()
	v_init = 0
}

proc foo() {local x
	std() x = 1/totalpump_nakpump
	std() pv(Graph[3], &$&1, x, $2, 1)
	std() pc(Graph[4], 50, &nain_nakpump(.5), &$&1, x, $2)
	std() pc(Graph[5], 10, &kout_nakpump(.5), &$&1, x, $2)
}

proc fig10() {
	std()
	foo(&eatp_nakpump(.5), 1)
	foo(&na3eatp_nakpump(.5), 2)
	foo(&na3ep_nakpump(.5), 3)
	foo(&ep_nakpump(.5), 4)
	foo(&k2e_nakpump(.5), 5)
	foo(&k2eatp_nakpump(.5), 6)
}
fig10()