// Trying to open ../diagnostic/tstop.dat
 // new end time timtot =   150.
 // Trying to open ../diagnostic/dt_F.dat
 // new dt =  0.002
 // comp[     1] neighs:    54    2   15   28   41
 // comp[     2] neighs:     1    3    4    0    0
 // comp[     3] neighs:     2    4    5    6    0
 // comp[     4] neighs:     2    3    7    0    0
 // comp[     5] neighs:     3    6    8    0    0
 // comp[     6] neighs:     3    5    9    0    0
 // comp[     7] neighs:     4   10    0    0    0
 // comp[     8] neighs:     5   11    0    0    0
 // comp[     9] neighs:     6    0    0    0    0
 // comp[    10] neighs:     7    0    0    0    0
 // comp[    11] neighs:     8   12    0    0    0
 // comp[    12] neighs:    11   13    0    0    0
 // comp[    13] neighs:    12   14    0    0    0
 // comp[    14] neighs:    13    0    0    0    0
 // comp[    15] neighs:     1   16   17    0    0
 // comp[    16] neighs:    15   17   18   19    0
 // comp[    17] neighs:    15   16   20    0    0
 // comp[    18] neighs:    16   19   21    0    0
 // comp[    19] neighs:    16   18   22    0    0
 // comp[    20] neighs:    17   23    0    0    0
 // comp[    21] neighs:    18   24    0    0    0
 // comp[    22] neighs:    19    0    0    0    0
 // comp[    23] neighs:    20    0    0    0    0
 // comp[    24] neighs:    21   25    0    0    0
 // comp[    25] neighs:    24   26    0    0    0
 // comp[    26] neighs:    25   27    0    0    0
 // comp[    27] neighs:    26    0    0    0    0
 // comp[    28] neighs:     1   29   30    0    0
 // comp[    29] neighs:    28   30   31   32    0
 // comp[    30] neighs:    28   29   33    0    0
 // comp[    31] neighs:    29   32   34    0    0
 // comp[    32] neighs:    29   31   35    0    0
 // comp[    33] neighs:    30   36    0    0    0
 // comp[    34] neighs:    31   37    0    0    0
 // comp[    35] neighs:    32    0    0    0    0
 // comp[    36] neighs:    33    0    0    0    0
 // comp[    37] neighs:    34   38    0    0    0
 // comp[    38] neighs:    37   39    0    0    0
 // comp[    39] neighs:    38   40    0    0    0
 // comp[    40] neighs:    39    0    0    0    0
 // comp[    41] neighs:     1   42   43    0    0
 // comp[    42] neighs:    41   43   44   45    0
 // comp[    43] neighs:    41   42   46    0    0
 // comp[    44] neighs:    42   45   47    0    0
 // comp[    45] neighs:    42   44   48    0    0
 // comp[    46] neighs:    43   49    0    0    0
 // comp[    47] neighs:    44   50    0    0    0
 // comp[    48] neighs:    45    0    0    0    0
 // comp[    49] neighs:    46    0    0    0    0
 // comp[    50] neighs:    47   51    0    0    0
 // comp[    51] neighs:    50   52    0    0    0
 // comp[    52] neighs:    51   53    0    0    0
 // comp[    53] neighs:    52    0    0    0    0
 // comp[    54] neighs:     1   55    0    0    0
 // comp[    55] neighs:    54   56   58    0    0
 // comp[    56] neighs:    55   57   58    0    0
 // comp[    57] neighs:    56    0    0    0    0
 // comp[    58] neighs:    55   56   59    0    0
 // comp[    59] neighs:    58    0    0    0    0
// COMPART. LEVEL  RADIUS  LENGTH(MU)
//   1      1     7.50   20.0
//   2      2     1.06   40.0
//   3      3     0.67   40.0
//   4      3     0.67   40.0
//   5      4     0.42   40.0
//   6      4     0.42   40.0
//   7      4     0.67   40.0
//   8      5     0.42   40.0
//   9      5     0.42   40.0
//  10      5     0.67   40.0
//  11      6     0.42   40.0
//  12      7     0.42   40.0
//  13      8     0.42   40.0
//  14      9     0.42   40.0
//  15      2     1.06   40.0
//  16      3     0.67   40.0
//  17      3     0.67   40.0
//  18      4     0.42   40.0
//  19      4     0.42   40.0
//  20      4     0.67   40.0
//  21      5     0.42   40.0
//  22      5     0.42   40.0
//  23      5     0.67   40.0
//  24      6     0.42   40.0
//  25      7     0.42   40.0
//  26      8     0.42   40.0
//  27      9     0.42   40.0
//  28      2     1.06   40.0
//  29      3     0.67   40.0
//  30      3     0.67   40.0
//  31      4     0.42   40.0
//  32      4     0.42   40.0
//  33      4     0.67   40.0
//  34      5     0.42   40.0
//  35      5     0.42   40.0
//  36      5     0.67   40.0
//  37      6     0.42   40.0
//  38      7     0.42   40.0
//  39      8     0.42   40.0
//  40      9     0.42   40.0
//  41      2     1.06   40.0
//  42      3     0.67   40.0
//  43      3     0.67   40.0
//  44      4     0.42   40.0
//  45      4     0.42   40.0
//  46      4     0.67   40.0
//  47      5     0.42   40.0
//  48      5     0.42   40.0
//  49      5     0.67   40.0
//  50      6     0.42   40.0
//  51      7     0.42   40.0
//  52      8     0.42   40.0
//  53      9     0.42   40.0
//  54      0     0.70   50.0
//  55      0     0.60   50.0
//  56      0     0.50   50.0
//  57      0     0.50   50.0
//  58      0     0.50   50.0
//  59      0     0.50   50.0
 /* deepaxax/deepaxax_template.hoc
 automatically written from f2nrn/neuron_code_writer.f
 via subroutines that were inserted into the fortran
 code e.g., deepaxax/integrate_deepaxax.hoc
 
 The template's form was derived by
 Tom Morse and Michael Hines
 from a template, pyr3_template created
 by Roger Traub and Maciej Lazarewicz when they ported
 
         Traub RD, Buhl EH, Gloveli T, Whittington MA.
 Fast Rhythmic Bursting Can Be Induced in Layer 2/3
 Cortical Neurons by Enhancing Persistent Na(+)
 Conductance or by Blocking BK Channels.J Neurophysiol.
 2003 Feb;89(2):909-21.
 
 to NEURON
 
 */
 
 begintemplate deepaxax
	public type
 
 // parts of the template were lifted from a default
 // cell writing from Network Builder NetGUI[0]
 
         public is_art
         public init, topol, basic_shape, subsets
         public geom, biophys 
         public synlist, x, y, z, position
         public connect2target
         public set_netcon_src_comp
         // the above function added to set neton
         // compartment source in the presyn cell
 
         public comp, level, Soma, Dendrites
         public Soma_Dendrites, Axon, all
         public presyn_comp, top_level
         // it is the responsibility of the calling
         // program to set the above presynaptic
         // compartment number
 
         external traub_connect
         objref this
  create  comp[ 59+1]
         objref level[ 9+1], Soma, Dendrites
         objref Soma_Dendrites, Axon
         objref synlist
func type() {return  10 }

         proc init() {
           doubler = 1
  comp[0] delete_section() // clean up for fortran code
            traub_connect( 59+1)
 
            titlePrint()
 
            presyn_comp = 59
            // in Traub model;changed by calling prog.
            objref Soma, Axon, Dendrites, Soma_Dendrites
            objref level
 
            topol()
            shape()
 
            geom()        // the geometry and
            subsets()        // subsets and
            biophys()  // active currents
            synlist = new List() // list of synapses
 // NetGUI[0] stores synapses in the cell object, in 
 // Traub model it is easier to store them outside
            set_doubler() // to double or not
            if (doubler) {double_dend_cond()}
                          /* for taking
  spine membrane area correction into account (the 
  method used doubles max cond's when spines present)
 */
             more_adjustments()
         }
         proc double_dend_cond() {
         /* this function gets replaced later with 
 another one if double_dend_cond() is tacked on. */
         }
 
         proc titlePrint() {
 
 /*              print "
                 print "-----"
                 print "
             print "deepaxax Neuron Model based on "
             print "Traub RD et al (2005, 2003)"
                 print "
                 print "-----"
 Remove title printing with this comment for now.  
 Printing otherwise repeats (for each cell)
 -too voluminous for a network creation */
         }
 
         proc set_doubler() {doubler=0}
         // this function gets replaced with one that
         // sets doubler to 0 when there are no spines
         // in the cell (for no spines the additional
         // hoc code is written from integrate_cell.f
         // where cell is nRT, TCR.  Woops I just
         // found that deepaxax, deepbask, deepLTS,
         // supaxax, supbask, supLTS all use the script
         // cell/run_fortran.sh to replace the =1's with
         // =0's.  I will change the fortran code to
         // make it all run_fortran.sh replacements or
         // not for uniformity.
         proc topol() {
 // create comp[ 60] // note one greater than numcomp due to fortran indicies
  // last argument, parent location for connection
  // is overwritten to 1 for parents with connected children 
  // in below traub_connect proc calls
 traub_connect(this,  1,  54,   0.0611490233, 0)
 traub_connect(this,  1,  2,   0.0873746044, 1)
 traub_connect(this,  1,  15,   0.0873746044, 1)
 traub_connect(this,  1,  28,   0.0873746044, 1)
 traub_connect(this,  1,  41,   0.0873746044, 1)
 traub_connect(this,  2,  3,   0.0250126876, 1)
 traub_connect(this,  2,  4,   0.0250126876, 1)
 traub_connect(this,  3,  4,   0.0174532778, 1)
 traub_connect(this,  3,  5,   0.00988321907, 1)
 traub_connect(this,  3,  6,   0.00988321907, 1)
 traub_connect(this,  4,  7,   0.0174532778,  1.)
 traub_connect(this,  5,  6,   0.00689334805, 1)
 traub_connect(this,  5,  8,   0.00689334805,  1.)
 traub_connect(this,  6,  9,   0.00689334805,  1.)
 traub_connect(this,  7,  10,   0.0174532778,  1.)
 traub_connect(this,  8,  11,   0.00689334805,  1.)
 traub_connect(this,  11,  12,   0.00689334805,  1.)
 traub_connect(this,  12,  13,   0.00689334805,  1.)
 traub_connect(this,  13,  14,   0.00689334805,  1.)
 traub_connect(this,  15,  16,   0.0250126876, 1)
 traub_connect(this,  15,  17,   0.0250126876, 1)
 traub_connect(this,  16,  17,   0.0174532778, 1)
 traub_connect(this,  16,  18,   0.00988321907, 1)
 traub_connect(this,  16,  19,   0.00988321907, 1)
 traub_connect(this,  17,  20,   0.0174532778,  1.)
 traub_connect(this,  18,  19,   0.00689334805, 1)
 traub_connect(this,  18,  21,   0.00689334805,  1.)
 traub_connect(this,  19,  22,   0.00689334805,  1.)
 traub_connect(this,  20,  23,   0.0174532778,  1.)
 traub_connect(this,  21,  24,   0.00689334805,  1.)
 traub_connect(this,  24,  25,   0.00689334805,  1.)
 traub_connect(this,  25,  26,   0.00689334805,  1.)
 traub_connect(this,  26,  27,   0.00689334805,  1.)
 traub_connect(this,  28,  29,   0.0250126876, 1)
 traub_connect(this,  28,  30,   0.0250126876, 1)
 traub_connect(this,  29,  30,   0.0174532778, 1)
 traub_connect(this,  29,  31,   0.00988321907, 1)
 traub_connect(this,  29,  32,   0.00988321907, 1)
 traub_connect(this,  30,  33,   0.0174532778,  1.)
 traub_connect(this,  31,  32,   0.00689334805, 1)
 traub_connect(this,  31,  34,   0.00689334805,  1.)
 traub_connect(this,  32,  35,   0.00689334805,  1.)
 traub_connect(this,  33,  36,   0.0174532778,  1.)
 traub_connect(this,  34,  37,   0.00689334805,  1.)
 traub_connect(this,  37,  38,   0.00689334805,  1.)
 traub_connect(this,  38,  39,   0.00689334805,  1.)
 traub_connect(this,  39,  40,   0.00689334805,  1.)
 traub_connect(this,  41,  42,   0.0250126876, 1)
 traub_connect(this,  41,  43,   0.0250126876, 1)
 traub_connect(this,  42,  43,   0.0174532778, 1)
 traub_connect(this,  42,  44,   0.00988321907, 1)
 traub_connect(this,  42,  45,   0.00988321907, 1)
 traub_connect(this,  43,  46,   0.0174532778,  1.)
 traub_connect(this,  44,  45,   0.00689334805, 1)
 traub_connect(this,  44,  47,   0.00689334805,  1.)
 traub_connect(this,  45,  48,   0.00689334805,  1.)
 traub_connect(this,  46,  49,   0.0174532778,  1.)
 traub_connect(this,  47,  50,   0.00689334805,  1.)
 traub_connect(this,  50,  51,   0.00689334805,  1.)
 traub_connect(this,  51,  52,   0.00689334805,  1.)
 traub_connect(this,  52,  53,   0.00689334805,  1.)
 traub_connect(this,  54,  55,   0.026078893,  1.)
 traub_connect(this,  55,  56,   0.0185405311, 1)
 traub_connect(this,  55,  58,   0.0185405311, 1)
 traub_connect(this,  56,  57,   0.01570795,  1.)
 traub_connect(this,  56,  58,   0.01570795, 1)
 traub_connect(this,  58,  59,   0.01570795,  1.)
 access comp[1] // handy statement if want to start gui's from nrnmainmenu
 }
         proc geom() {
 // the "traub level" subsets are created and defined below
 top_level =  9
 objref level[top_level+1]
 for i=0,top_level { level[i] = new SectionList() }
  
 comp[ 1] { level[ 1].append() L=  20. diam = 2*  7.5 }
 comp[ 2] { level[ 2].append() L=  40. diam = 2*  1.06 }
 comp[ 3] { level[ 3].append() L=  40. diam = 2*  0.666666667 }
 comp[ 4] { level[ 3].append() L=  40. diam = 2*  0.666666667 }
 comp[ 5] { level[ 4].append() L=  40. diam = 2*  0.418972332 }
 comp[ 6] { level[ 4].append() L=  40. diam = 2*  0.418972332 }
 comp[ 7] { level[ 4].append() L=  40. diam = 2*  0.666666667 }
 comp[ 8] { level[ 5].append() L=  40. diam = 2*  0.418972332 }
 comp[ 9] { level[ 5].append() L=  40. diam = 2*  0.418972332 }
 comp[ 10] { level[ 5].append() L=  40. diam = 2*  0.666666667 }
 comp[ 11] { level[ 6].append() L=  40. diam = 2*  0.418972332 }
 comp[ 12] { level[ 7].append() L=  40. diam = 2*  0.418972332 }
 comp[ 13] { level[ 8].append() L=  40. diam = 2*  0.418972332 }
 comp[ 14] { level[ 9].append() L=  40. diam = 2*  0.418972332 }
 comp[ 15] { level[ 2].append() L=  40. diam = 2*  1.06 }
 comp[ 16] { level[ 3].append() L=  40. diam = 2*  0.666666667 }
 comp[ 17] { level[ 3].append() L=  40. diam = 2*  0.666666667 }
 comp[ 18] { level[ 4].append() L=  40. diam = 2*  0.418972332 }
 comp[ 19] { level[ 4].append() L=  40. diam = 2*  0.418972332 }
 comp[ 20] { level[ 4].append() L=  40. diam = 2*  0.666666667 }
 comp[ 21] { level[ 5].append() L=  40. diam = 2*  0.418972332 }
 comp[ 22] { level[ 5].append() L=  40. diam = 2*  0.418972332 }
 comp[ 23] { level[ 5].append() L=  40. diam = 2*  0.666666667 }
 comp[ 24] { level[ 6].append() L=  40. diam = 2*  0.418972332 }
 comp[ 25] { level[ 7].append() L=  40. diam = 2*  0.418972332 }
 comp[ 26] { level[ 8].append() L=  40. diam = 2*  0.418972332 }
 comp[ 27] { level[ 9].append() L=  40. diam = 2*  0.418972332 }
 comp[ 28] { level[ 2].append() L=  40. diam = 2*  1.06 }
 comp[ 29] { level[ 3].append() L=  40. diam = 2*  0.666666667 }
 comp[ 30] { level[ 3].append() L=  40. diam = 2*  0.666666667 }
 comp[ 31] { level[ 4].append() L=  40. diam = 2*  0.418972332 }
 comp[ 32] { level[ 4].append() L=  40. diam = 2*  0.418972332 }
 comp[ 33] { level[ 4].append() L=  40. diam = 2*  0.666666667 }
 comp[ 34] { level[ 5].append() L=  40. diam = 2*  0.418972332 }
 comp[ 35] { level[ 5].append() L=  40. diam = 2*  0.418972332 }
 comp[ 36] { level[ 5].append() L=  40. diam = 2*  0.666666667 }
 comp[ 37] { level[ 6].append() L=  40. diam = 2*  0.418972332 }
 comp[ 38] { level[ 7].append() L=  40. diam = 2*  0.418972332 }
 comp[ 39] { level[ 8].append() L=  40. diam = 2*  0.418972332 }
 comp[ 40] { level[ 9].append() L=  40. diam = 2*  0.418972332 }
 comp[ 41] { level[ 2].append() L=  40. diam = 2*  1.06 }
 comp[ 42] { level[ 3].append() L=  40. diam = 2*  0.666666667 }
 comp[ 43] { level[ 3].append() L=  40. diam = 2*  0.666666667 }
 comp[ 44] { level[ 4].append() L=  40. diam = 2*  0.418972332 }
 comp[ 45] { level[ 4].append() L=  40. diam = 2*  0.418972332 }
 comp[ 46] { level[ 4].append() L=  40. diam = 2*  0.666666667 }
 comp[ 47] { level[ 5].append() L=  40. diam = 2*  0.418972332 }
 comp[ 48] { level[ 5].append() L=  40. diam = 2*  0.418972332 }
 comp[ 49] { level[ 5].append() L=  40. diam = 2*  0.666666667 }
 comp[ 50] { level[ 6].append() L=  40. diam = 2*  0.418972332 }
 comp[ 51] { level[ 7].append() L=  40. diam = 2*  0.418972332 }
 comp[ 52] { level[ 8].append() L=  40. diam = 2*  0.418972332 }
 comp[ 53] { level[ 9].append() L=  40. diam = 2*  0.418972332 }
 comp[ 54] { level[ 0].append() L=  50. diam = 2*  0.7 }
 comp[ 55] { level[ 0].append() L=  50. diam = 2*  0.6 }
 comp[ 56] { level[ 0].append() L=  50. diam = 2*  0.5 }
 comp[ 57] { level[ 0].append() L=  50. diam = 2*  0.5 }
 comp[ 58] { level[ 0].append() L=  50. diam = 2*  0.5 }
 comp[ 59] { level[ 0].append() L=  50. diam = 2*  0.5 }
 } 
 // Here are some commonly used subsets of sections
         objref all
         proc subsets() { local i
           objref Soma, Dendrites, Soma_Dendrites, Axon
           objref all
           Soma = new SectionList()
           Dendrites = new SectionList()
           Soma_Dendrites = new SectionList()
           Axon = new SectionList()
           for i=1,top_level {
             forsec level[i] { // recall level 0 is axon, 1 is soma, higher are dends
               Soma_Dendrites.append()
                 if (i>1) {Dendrites.append()}
             }
           }
           forsec level[1] {
             Soma.append()
           }
           forsec level[0] { Axon.append() }
           all = new SectionList()
           for i=1, 59 comp[i] all.append()
          }
 
        proc shape() {
 
 /*      This section could contain statements like
 {pt3dclear() pt3dadd(-1,-1,0,1) pt3dadd(-1,-2,0,1)}
 These visual settings do not effect the electrical
 and chemical systems of equations.              */
 }
         proc biophys() {
 // 
 //       insert the mechanisms and assign max conductances
 // 
 forsec all { insert pas }   // g_pas has two values; soma-dend,axon
 forsec level[ 0] {
       insert naf2
       gbar_naf2 =   0.4
       insert kdr_fs
       gbar_kdr_fs =   0.4
       insert ka
       gbar_ka =   0.001
       insert k2
       gbar_k2 =   0.0005
 }
 forsec level[ 1] {
       insert naf2
       gbar_naf2 =   0.06
       insert nap
       gbar_nap =   0.0006
       insert kdr_fs
       gbar_kdr_fs =   0.1
       insert kc_fast
       gbar_kc_fast =   0.025
       insert ka
       gbar_ka =   0.001
       insert km
       gbar_km =   0.0005
       insert k2
       gbar_k2 =   0.0005
       insert kahp_slower
       gbar_kahp_slower =   0.0001
       insert cal
       gbar_cal =   0.0001
       insert cat
       gbar_cat =   5.E-05
       insert ar
       gbar_ar =   2.5E-05
       insert cad
       // *** ca diffusion: beta=1/tau
       beta_cad  =   0.02
       // cafor(I) (FORTRAN) converted to phi (NEURON)
       phi_cad =   260000.
 }
 forsec level[ 2] {
       insert naf2
       gbar_naf2 =   0.06
       insert nap
       gbar_nap =   0.0006
       insert kdr_fs
       gbar_kdr_fs =   0.1
       insert kc_fast
       gbar_kc_fast =   0.025
       insert ka
       gbar_ka =   0.001
       insert km
       gbar_km =   0.0005
       insert k2
       gbar_k2 =   0.0005
       insert kahp_slower
       gbar_kahp_slower =   0.0001
       insert cal
       gbar_cal =   0.0001
       insert cat
       gbar_cat =   5.E-05
       insert ar
       gbar_ar =   2.5E-05
       insert cad
       // *** ca diffusion: beta=1/tau
       beta_cad  =   0.05
       // cafor(I) (FORTRAN) converted to phi (NEURON)
       phi_cad =   520000.
 }
 forsec level[ 3] {
       insert naf2
       gbar_naf2 =   0.06
       insert nap
       gbar_nap =   0.0006
       insert kdr_fs
       gbar_kdr_fs =   0.1
       insert kc_fast
       gbar_kc_fast =   0.025
       insert ka
       gbar_ka =   0.001
       insert km
       gbar_km =   0.0005
       insert k2
       gbar_k2 =   0.0005
       insert kahp_slower
       gbar_kahp_slower =   0.0001
       insert cal
       gbar_cal =   0.0001
       insert cat
       gbar_cat =   5.E-05
       insert ar
       gbar_ar =   2.5E-05
       insert cad
       // *** ca diffusion: beta=1/tau
       beta_cad  =   0.05
       // cafor(I) (FORTRAN) converted to phi (NEURON)
       phi_cad =   520000.
 }
 forsec level[ 4] {
       insert naf2
       gbar_naf2 =   0.01
       insert nap
       gbar_nap =   0.0001
       insert kdr_fs
       gbar_kdr_fs =   0.01
       insert kc_fast
       gbar_kc_fast =   0.025
       insert ka
       gbar_ka =   0.001
       insert km
       gbar_km =   0.0005
       insert k2
       gbar_k2 =   0.0005
       insert kahp_slower
       gbar_kahp_slower =   0.0001
       insert cal
       gbar_cal =   0.0002
       insert cat
       gbar_cat =   0.002
       insert ar
       gbar_ar =   2.5E-05
       insert cad
       // *** ca diffusion: beta=1/tau
       beta_cad  =   0.05
       // cafor(I) (FORTRAN) converted to phi (NEURON)
       phi_cad =   520000.
 }
 forsec level[ 5] {
       insert naf2
       gbar_naf2 =   0.01
       insert nap
       gbar_nap =   0.0001
       insert kdr_fs
       gbar_kdr_fs =   0.01
       insert kc_fast
       gbar_kc_fast =   0.025
       insert ka
       gbar_ka =   0.001
       insert km
       gbar_km =   0.0005
       insert k2
       gbar_k2 =   0.0005
       insert kahp_slower
       gbar_kahp_slower =   0.0001
       insert cal
       gbar_cal =   0.0002
       insert cat
       gbar_cat =   0.002
       insert ar
       gbar_ar =   2.5E-05
       insert cad
       // *** ca diffusion: beta=1/tau
       beta_cad  =   0.05
       // cafor(I) (FORTRAN) converted to phi (NEURON)
       phi_cad =   520000.
 }
 forsec level[ 6] {
       insert naf2
       gbar_naf2 =   0.01
       insert nap
       gbar_nap =   0.0001
       insert kdr_fs
       gbar_kdr_fs =   0.01
       insert kc_fast
       gbar_kc_fast =   0.025
       insert ka
       gbar_ka =   0.001
       insert km
       gbar_km =   0.0005
       insert k2
       gbar_k2 =   0.0005
       insert kahp_slower
       gbar_kahp_slower =   0.0001
       insert cal
       gbar_cal =   0.0002
       insert cat
       gbar_cat =   0.002
       insert ar
       gbar_ar =   2.5E-05
       insert cad
       // *** ca diffusion: beta=1/tau
       beta_cad  =   0.05
       // cafor(I) (FORTRAN) converted to phi (NEURON)
       phi_cad =   520000.
 }
 forsec level[ 7] {
       insert naf2
       gbar_naf2 =   0.01
       insert nap
       gbar_nap =   0.0001
       insert kdr_fs
       gbar_kdr_fs =   0.01
       insert kc_fast
       gbar_kc_fast =   0.025
       insert ka
       gbar_ka =   0.001
       insert km
       gbar_km =   0.0005
       insert k2
       gbar_k2 =   0.0005
       insert kahp_slower
       gbar_kahp_slower =   0.0001
       insert cal
       gbar_cal =   0.0002
       insert cat
       gbar_cat =   0.002
       insert ar
       gbar_ar =   2.5E-05
       insert cad
       // *** ca diffusion: beta=1/tau
       beta_cad  =   0.05
       // cafor(I) (FORTRAN) converted to phi (NEURON)
       phi_cad =   520000.
 }
 forsec level[ 8] {
       insert naf2
       gbar_naf2 =   0.01
       insert nap
       gbar_nap =   0.0001
       insert kdr_fs
       gbar_kdr_fs =   0.01
       insert kc_fast
       gbar_kc_fast =   0.025
       insert ka
       gbar_ka =   0.001
       insert km
       gbar_km =   0.0005
       insert k2
       gbar_k2 =   0.0005
       insert kahp_slower
       gbar_kahp_slower =   0.0001
       insert cal
       gbar_cal =   0.0002
       insert cat
       gbar_cat =   0.002
       insert ar
       gbar_ar =   2.5E-05
       insert cad
       // *** ca diffusion: beta=1/tau
       beta_cad  =   0.05
       // cafor(I) (FORTRAN) converted to phi (NEURON)
       phi_cad =   520000.
 }
 forsec level[ 9] {
       insert naf2
       gbar_naf2 =   0.01
       insert nap
       gbar_nap =   0.0001
       insert kdr_fs
       gbar_kdr_fs =   0.01
       insert kc_fast
       gbar_kc_fast =   0.025
       insert ka
       gbar_ka =   0.001
       insert km
       gbar_km =   0.0005
       insert k2
       gbar_k2 =   0.0005
       insert kahp_slower
       gbar_kahp_slower =   0.0001
       insert cal
       gbar_cal =   0.0002
       insert cat
       gbar_cat =   0.002
       insert ar
       gbar_ar =   2.5E-05
       insert cad
       // *** ca diffusion: beta=1/tau
       beta_cad  =   0.05
       // cafor(I) (FORTRAN) converted to phi (NEURON)
       phi_cad =   520000.
 }
 forsec all {
    cm =   1.  // assign global specific capac.
 }
 // 
 //  passive membrane resistance (leak) and axial resistance
 // 
 forsec Soma_Dendrites {
    g_pas =   4.E-05
    Ra =   200.
 }
 forsec Axon {
    g_pas =   0.001
    Ra =   100.
 }
 ceiling_cad = 1e6 //  nearly unlimited Ca concentration
 // print "made it to end of initialization from SCORTMAJ_FRB()"
 }  // end of biophys
 
 // Compartment Area: Dendritic.spines double area of
 // dend. membrane, which in Traubs method is equivalent to
 // only multiplying all dend. max conductances by two
 // (the area is doubled but the volume is const.)
 proc double_dend_cond() {
   spine_area_multiplier = 2
   forsec Dendrites {
        if (ismembrane("nap")) { gbar_nap *= spine_area_multiplier }
        if (ismembrane("napf")) { gbar_napf *= spine_area_multiplier }
        if (ismembrane("napf_tcr")) { gbar_napf_tcr *= spine_area_multiplier }
        if (ismembrane("naf2")) { gbar_naf2 *= spine_area_multiplier }
        if (ismembrane("naf2_tcr")) { gbar_naf2_tcr *= spine_area_multiplier }
        if (ismembrane("naf22")) { gbar_naf22 *= spine_area_multiplier }
        if (ismembrane("kc_fast")) { gbar_kc_fast *= spine_area_multiplier }
        if (ismembrane("kc_fast_fast")) { gbar_kc_fast_fast *= spine_area_multiplier }
        if (ismembrane("kahp")) { gbar_kahp *= spine_area_multiplier }
        if (ismembrane("kahp_slower")) { gbar_kahp_slower *= spine_area_multiplier }
        if (ismembrane("km")) { gbar_km *= spine_area_multiplier }
        if (ismembrane("kdr_fs")) { gbar_kdr_fs *= spine_area_multiplier }
        if (ismembrane("kdr_fs_fs")) { gbar_kdr_fs_fs *= spine_area_multiplier }
        if (ismembrane("ka")) { gbar_ka *= spine_area_multiplier }
        if (ismembrane("ka_ib")) { gbar_ka_ib *= spine_area_multiplier }
        if (ismembrane("k2")) { gbar_k2 *= spine_area_multiplier }
        if (ismembrane("cal")) { gbar_cal *= spine_area_multiplier }
        if (ismembrane("cat")) { gbar_cat *= spine_area_multiplier }
        if (ismembrane("cat_a")) { gbar_cat_a *= spine_area_multiplier }
        if (ismembrane("ar")) { gbar_ar *= spine_area_multiplier }
        if (ismembrane("pas")) { g_pas *= spine_area_multiplier }
        cm = cm * spine_area_multiplier
   }
 }
 // double_dend_cond()  // run for cells w/ spines
 
 // The below is after doubling of dendritic area to
 // take into account the effect of spines
 // These areas were used in the FORTRAN code to 
 // compute the conductances from specific conductances.
 //  I AREA(I) (compartments and their areas)
 //  1   942.477
 //  2   266.406832
 //  3   167.551467
 //  4   167.551467
 //  5   105.299143
 //  6   105.299143
 //  7   167.551467
 //  8   105.299143
 //  9   105.299143
 //  10   167.551467
 //  11   105.299143
 //  12   105.299143
 //  13   105.299143
 //  14   105.299143
 //  15   266.406832
 //  16   167.551467
 //  17   167.551467
 //  18   105.299143
 //  19   105.299143
 //  20   167.551467
 //  21   105.299143
 //  22   105.299143
 //  23   167.551467
 //  24   105.299143
 //  25   105.299143
 //  26   105.299143
 //  27   105.299143
 //  28   266.406832
 //  29   167.551467
 //  30   167.551467
 //  31   105.299143
 //  32   105.299143
 //  33   167.551467
 //  34   105.299143
 //  35   105.299143
 //  36   167.551467
 //  37   105.299143
 //  38   105.299143
 //  39   105.299143
 //  40   105.299143
 //  41   266.406832
 //  42   167.551467
 //  43   167.551467
 //  44   105.299143
 //  45   105.299143
 //  46   167.551467
 //  47   105.299143
 //  48   105.299143
 //  49   167.551467
 //  50   105.299143
 //  51   105.299143
 //  52   105.299143
 //  53   105.299143
 //  54   219.9113
 //  55   188.4954
 //  56   157.0795
 //  57   157.0795
 //  58   157.0795
 //  59   157.0795
        proc position() { local i
 // comp switched to comp[1] since 0 deleted
         comp[1] for i = 0, n3d()-1 {
     pt3dchange(i, $1-x+x3d(i), \
      $2-y+y3d(i), $3-z+z3d(i),diam3d(i))
        }
         x=$1 y=$2 z=$3
        }
         proc connect2target() { 
  // $o1 targ point process, $o2 returned NetCon
           comp[presyn_comp] $o2 = new NetCon(&v(1),$o1)
	$o2.threshold = 0
         }
         objref syn_
         proc synapses() {
         // place for each compartment that has input
         // statements like 
 //comp[3] syn_=new AlphaSynKinT(1) synlist.append(syn_)
 //comp[4] syn_=new NMDA(1) synlist.append(syn_)
         }
 
 // is not an artificial cell:
      func is_art() { return 0 }
 
 
 
         proc more_adjustments() {
 forsec all {
        if (ismembrane("naf2")) {fastNa_shift_naf2=-2.5} 
// global reversal potentials
    ek =  -100.
    e_pas =  -65.
    ena =   50.
    vca =   125.
    forsec all if (ismembrane("ar")) erev_ar =  -40.
    e_gaba_a =  -75.
 }
     // more extended initializations
     // Note: the following currents are not
     // present in fast spiking and LTS interneurons
 // Would be slightly more efficient to not include them
     forsec all {
         if (ismembrane("nap")) {gbar_nap = 0.0}
         if (ismembrane("k2")) {gbar_k2 = 0.0}
         if (ismembrane("km")) {gbar_km = 0.0}
         if (ismembrane("kahp")) {gbar_kahp = 0.0}
         if (ismembrane("kahp_slower")) {gbar_kahp_slower = 0.0}
         if (ismembrane("cat")) {gbar_cat = 0.0}
         if (ismembrane("ar")) {gbar_ar = 0.0}
    }
 }
  endtemplate deepaxax