proc distribute2(){local x localobj sl
		
        strdef stmp,distfunc,mech
        sl = $o1
        mech = $s2
        distfunc = $s3
		//print distfunc
        sprint(distfunc,"%%s %s(%%f) = %s",mech, distfunc)
		//print distfunc
        forsec sl for(x) {
			secname()
            sprint (stmp,distfunc,secname(),x,distance(x))
			//print stmp
            execute(stmp)
        }
    }
proc tfunc(){

strdef tmp_str,const_str
const_str = "(0.0 * %g + 1.0)*"
transvec.printf()
    // Initialise distance function to soma

    // Run the biophysics function from the template
	//print transvec.x(0)
	//axonal na 1.6
	sprint(tmp_str,"%s%f",const_str,transvec.x(0))
	distribute2(cell.axonal,"gNaTa_tbar_NaTa_t",tmp_str)
	//somatic na 1.2
	//print transvec.x(1)
	sprint(tmp_str,"%s%f",const_str,transvec.x(1))
	distribute2(cell.somatic,"gNaTs2_tbar_NaTs2_t",tmp_str)
	//axonal potassium
	//print transvec.x(2)
	sprint(tmp_str,"%s%f",const_str,transvec.x(2))
	distribute2(cell.axonal,"gK_Tstbar_K_Tst",tmp_str)
	//apical Ih
	//distribute($o1.apical,"gIhbar_Ih","(-0.869600 + 2.087000*exp((%g-0.000000)*0.003100))*0.000080")
	sprint(tmp_str,"%s%f","(-0.869600 + 2.087000*exp((%g-0.000000)*0.003100))*",transvec.x(3))
	distribute2(cell.apical,"gIhbar_Ih",tmp_str)
	//apical Im
	//distribute($o1.apical,"gImbar_Im","(0.0 * %g + 1.0)*0.000143")
	sprint(tmp_str,"%s%f",const_str,transvec.x(4))
	distribute2(cell.apical,"gImbar_Im",tmp_str)
	//axonal sk
	//	distribute($o1.somatic,"gSKv3_1bar_SKv3_1","(0.0 * %g + 1.0)*0.303472")
	sprint(tmp_str,"%s%f",const_str,transvec.x(5))
	distribute2(cell.axonal,"gSKv3_1bar_SKv3_1",tmp_str)
	
}