//n_axon_seg = 5

create iseg,hill			//,myelin[2],node[2]

proc create_axon() {

  create iseg,hill			//,myelin[n_axon_seg],node[n_axon_seg]

  soma {
   	equiv_diam = sqrt(area(.5)/(4*PI))
  }
  
  if (numarg()) equiv_diam = $1

  iseg {          		    // initial segment between hillock + myelin
     L = 15
     nseg = 1
     diam = equiv_diam/10   // see Sloper and Powell 1982, Fig.71
  }

  hill {
    L = 10
    nseg = 5
    diam(0:1) = 4*iseg.diam:iseg.diam
  }

  // construct myelinated axon with nodes of ranvier

  /*for i=0,n_axon_seg-1 {
    myelin[i] {         // myelin element
      nseg = 5
      L = 100
      diam = iseg.diam
    }
    node[i] {           // nodes of Ranvier
      nseg = 1
      L = 1.0
      diam = iseg.diam*.75       // nodes are thinner than axon
    }
  }*/

  soma connect hill(0), 0.5
  hill connect iseg(0), 1
  //iseg connect myelin[0](0), 1
  //myelin[0] connect node[0](0), 1

  /*for i=0,n_axon_seg-2  {
      node[i] connect myelin[i+1](0), 1
      myelin[i+1] connect node[i+1](0), 1
  }*/
}