// $Id: initxrec.hoc,v 1.2 2005/09/10 23:02:15 ted Exp $
// extracellular recording from model subjected to intracellular stimulation
load_file("nrngui.hoc")

/*
load_file("cell.ses") // specifies anatomical and biophysical properties of the cell
  // For this example, the file recreates CellBuilder
  // but it could also be a plain old hoc file.
  // This file must do the following:
  // 1.  create and connect the sections, and use a single access statement
  //     to declare one of them as the default section
  // 2.  assign biophysical properties and specify discretization,
  //     insert whatever density ("distributed") mechanisms are necessary.
  // 3.  insert extracellular and xtra into all sections that are to "feel" 
  //     the effect of an extracellular field. The parameters of extracellular 
  //     should be assigned the following values:
  //     xraxial=1e+09 xg=1e+09 xc=0 e_extracellular=0
  // 4.  if geometry was specified with the stylized method (i.e. L and diam)
  //     rather than the pt3d method, call define_shape(). Once is enough.
  //     Note that stylized models make sense only if they are 1 dimensional
  //     i.e. unbranched, with all sections lying along a straight line.
  //     This is because section orientation of branched stylized models
  //     is chosen automatically by NEURON, therefore has nothing to do
  //     with biological neurons or the modeler's possible intent to approximate
  //     the shape of a particular cell.
*/
// load_file("initcell.hoc") // for the demo cell
load_file("parameters.hoc")
// activesoma.hoc doesn't insert extracellular or xtra, so do it here
forall {
  insert extracellular
  xraxial = 1e9
  xg = 1e9
  xc = 0
  e_extracellular = 0
  insert xtra
}
load_file("anatscale.hoc")	// show xyz scale bars
load_file("interpxyz.hoc")	// only interpolates sections that have extracellular
load_file("setpointers.hoc")	// automatically calls grindaway() in interpxyz.hoc
load_file("rigc.ses")		// RunControl, graphs of v, vext, e_extracellular
// load_file("rigxc.ses")		// graph of er_xtra, just for diagnostic|development purposes
load_file("field.hoc")		// computes extracellularly recorded potential vrec
load_file("vrecc.ses")		// graph of vrec(t)
load_file("calcrxc.hoc")	// computes transfer r between segments and recording electrodes
                          // may require modification for particular electrode geometries
load_file("iclampc.ses")	// intracellular stimulus
IClamp[0].del = 1e9
load_file("varstep.ses")  // specify adaptive integration
tstop = 2000 // long enough to see the first spike
tstop_changed() // rescale x axes

load_file("msgic.hoc")		// minimal hints