// This experiment is to test the sensitivity of V_S

load_file("nrngui.hoc")
load_file("simulation_base.hoc")
dt = 0.001

objref cutoff_file,vs_list
strdef cutoff_file_name,run_file_name

// want parameters to be set specifically by arguments,
// otherwise fail
// set geom
// set extstim_site, junction_site, prop_site
// assume g_basket=0, g_chand=0, reversal potentials are -70, -50 respectively
// vary soma leak is g_pas=2e-3, e_pas=-80 mV, -70 mV, -60 mV, -50 mV
// assume IS leak is (-70,1e-3)

load_axon(geom,4)
//setup_session()
if(test_axon.stim_loc==0){ quit() }
set_extstim_site(extstim_site,junction_site)

cutoff_file = new File()
//sprint(cutoff_file_name,"vs_list-cutoff_geom%g-ext%d.out",geom,extstim_site)
sprint(cutoff_file_name,"/projectnb/msprfmun/neuron/vs_list-cutoff_geom%g-ext%d.out",geom,extstim_site)
cutoff_file.wopen(cutoff_file_name)

vs_list = new Vector(4)
vs_list.x[0] = -80
vs_list.x[1] = -70
vs_list.x[2] = -60
vs_list.x[3] = -50

set_basket(test_axon,-70,0)
set_g_chand(0)

for(j=0;j<vs_list.size();j=j+1){    
    set_soma_leak(test_axon,vs_list.x[j],2e-3)
    cutoff_file.printf("%g\t",vs_list.x[j])
    //sprint(run_file_name,"vs_list-cutoff-run_geom%g-ext%d-vs_list%d.out",geom,extstim_site,vs_list.x[j])
    sprint(run_file_name,"/projectnb/msprfmun/neuron/vs_list-cutoff-run_geom%g-ext%d-vs_list%d.out",geom,extstim_site,vs_list.x[j])
    run_search(cutoff_file,run_file_name,3)
}

quit()