begintemplate celltemplate
public apcounter,apvec
public all,dends,tcdends,ccdends,ccsyn,tcsyn,ccnetcon,tcnetcon,soma,dend
	public Esyn,Enetcon,Isyn,Inetcon,Esourse,numdend,Vvec,spikevec,segdends
	objref Esyn,Enetcon[2],Isyn,Inetcon,Esourse[2]
	objref apcounter,apvec,nil,Vvec[2],spikevec[2]
	
proc celldef() {
  topol()
}

create soma, dend[15], apic[29]

proc topol() { local i
  connect dend(0), soma(1)
  connect dend[1](0), soma(0)
  for i = 2, 3 connect dend[i](0), dend[1](1)
  for i = 4, 5 connect dend[i](0), dend[3](1)
  connect dend[6](0), soma(0)
  for i = 7, 8 connect dend[i](0), dend[6](1)
  connect dend[9](0), soma(0)
  for i = 10, 11 connect dend[i](0), dend[9](1)
  connect dend[12](0), soma(0)
  for i = 13, 14 connect dend[i](0), dend[12](1)
  connect apic(0), soma(0)
  for i = 1, 3 connect apic[i](0), apic[i-1](1)
  connect apic[4](0), apic[2](1)
  for i = 5, 6 connect apic[i](0), apic[4](1)
  connect apic[7](0), apic[1](1)
  for i = 8, 9 connect apic[i](0), apic[i-1](1)
  connect apic[10](0), apic[8](1)
  for i = 11, 12 connect apic[i](0), apic[10](1)
  for i = 13, 14 connect apic[i](0), apic[i-1](1)
  connect apic[15](0), apic[13](1)
  connect apic[16](0), apic[12](1)
  for i = 17, 18 connect apic[i](0), apic[16](1)
  for i = 19, 20 connect apic[i](0), apic[18](1)
  for i = 21, 22 connect apic[i](0), apic[20](1)
  for i = 23, 24 connect apic[i](0), apic[22](1)
  connect apic[25](0), apic[7](1)
  connect apic[26](0), apic(1)
  for i = 27, 28 connect apic[i](0), apic[26](1)
  basic_shape()
}
proc shape3d_1() {
  soma {pt3dclear()
	pt3dadd(-7.3375, -7.8625, 11.0725, 23.3853)
	pt3dadd(7.1, 7.36, 21.06, 2.19)
  }
  dend {pt3dclear()
	pt3dadd(7.1, 0.36, 21.06, 2.19)
	pt3dadd(9.88, 0.37, 21.06, 2.19)
	pt3dadd(15.29, 2.84, 21.06, 2.19)
	pt3dadd(19.99, 3.63, 21.06, 2.19)
	pt3dadd(26.23, 3.37, 20.71, 1.83)
	pt3dadd(30.02, 2.95, 20.71, 1.83)
	pt3dadd(34.43, 3.06, 20.71, 1.83)
	pt3dadd(41.77, 3.52, 20.71, 1.83)
	pt3dadd(50.83, 2.45, 20.66, 1.83)
	pt3dadd(59.22, 4.45, 20.71, 1.83)
	pt3dadd(69.61, 6.74, 20.46, 1.83)
	pt3dadd(74.73, 8.53, 20.51, 1.83)
	pt3dadd(91.79, 13.21, 20.91, 1.83)
	pt3dadd(102.85, 19.64, 22.51, 1.83)
	pt3dadd(114.2, 23.95, 22.76, 1.83)
	pt3dadd(124.27, 25.24, 26.16, 1.83)
	pt3dadd(132.36, 32.13, 26.86, 1.83)
	pt3dadd(138.01, 33.31, 28.71, 1.46)
  }
  dend[1] {pt3dclear()
	pt3dadd(-0.3375, -3.8625, 11.0725, 2.56)
	pt3dadd(-2.46, -13.51, 7.86, 2.56)
	pt3dadd(-4.23, -16.73, 7.81, 2.56)
	pt3dadd(-5.65, -22.88, 1.66, 2.56)
  }
  dend[2] {pt3dclear()
	pt3dadd(-5.65, -22.88, 1.66, 2.56)
	pt3dadd(-8.47, -24.86, 3.91, 1.83)
	pt3dadd(-15.81, -25.32, 3.96, 1.83)
	pt3dadd(-19.88, -28.36, 3.96, 1.83)
	pt3dadd(-31.9, -32.39, 3.96, 1.46)
	pt3dadd(-37.5, -37.17, 0.96, 1.46)
	pt3dadd(-42.24, -39.92, 0.61, 1.46)
	pt3dadd(-45.11, -41.08, -0.54, 1.46)
	pt3dadd(-50.38, -43.22, -8.09, 1.46)
	pt3dadd(-57.23, -46.27, -11.99, 1.46)
  }
  dend[3] {pt3dclear()
	pt3dadd(-5.65, -22.88, 1.66, 2.56)
	pt3dadd(-6.6, -26.05, 3.01, 1.46)
	pt3dadd(-3.23, -30.27, 3.01, 1.46)
	pt3dadd(-3.55, -35.69, 2.86, 1.46)
	pt3dadd(-4.11, -39.82, 5.01, 1.46)
  }
  dend[4] {pt3dclear()
	pt3dadd(-4.11, -39.82, 5.01, 1.46)
	pt3dadd(1.85, -43.54, 11.11, 1.46)
	pt3dadd(3.39, -44.59, 11.11, 1.46)
	pt3dadd(5.7, -47.56, 11.11, 1.46)
	pt3dadd(9.65, -53.21, 11.11, 1.46)
	pt3dadd(14.08, -58.66, 11.16, 1.46)
	pt3dadd(22.88, -68.76, 18.76, 1.46)
	pt3dadd(26.56, -77.86, 23.66, 1.46)
	pt3dadd(29.45, -85.05, 28.06, 1.1)
	pt3dadd(40.27, -93.22, 28.06, 1.1)
	pt3dadd(44.99, -98, 28.06, 1.1)
	pt3dadd(55.47, -108.8, 28.31, 1.1)
	pt3dadd(65.12, -127.2, 30.86, 1.1)
	pt3dadd(71.58, -136.29, 32.86, 1.1)
	pt3dadd(92.57, -147.59, 35.86, 1.1)
	pt3dadd(96.66, -152.9, 35.86, 1.1)
	pt3dadd(100.04, -159.89, 35.86, 1.1)
  }
  dend[5] {pt3dclear()
	pt3dadd(-4.11, -39.82, 5.01, 1.46)
	pt3dadd(-3.62, -42.41, -6.09, 1.46)
	pt3dadd(-3.56, -48.79, -6.04, 1.46)
	pt3dadd(-4.07, -53.74, -6.09, 1.46)
	pt3dadd(-2.6, -64.29, -6.04, 1.46)
	pt3dadd(-1.72, -70.63, -7.69, 1.46)
	pt3dadd(-1.82, -84.88, -8.19, 1.46)
	pt3dadd(-0.61, -101.68, -8.24, 1.46)
	pt3dadd(-0.38, -116.08, -8.29, 1.46)
	pt3dadd(-0.44, -128.37, -4.24, 1.46)
	pt3dadd(-3.33, -142.72, -10.69, 1.46)
	pt3dadd(-4.34, -158.18, -5.29, 1.46)
	pt3dadd(-6.16, -173.69, -1.49, 1.46)
	pt3dadd(-8.89, -177.3, -0.39, 1.46)
  }
  dend[6] {pt3dclear()
	pt3dadd(-0.3375, -3.8625, 11.0725, 1.83)
	pt3dadd(1.07, 3.17, 16.61, 1.83)
	pt3dadd(3.89, 5.15, 16.61, 1.83)
	pt3dadd(9.93, 8.15, 16.61, 1.83)
	pt3dadd(21.74, 13.07, 16.81, 1.83)
	pt3dadd(30.09, 13.1, 16.81, 1.83)
	pt3dadd(36.22, 14.47, 16.81, 1.83)
	pt3dadd(44.03, 17.91, 16.81, 1.83)
	pt3dadd(53.08, 22.41, 16.81, 1.46)
	pt3dadd(57.15, 22.66, 16.81, 1.46)
  }
  dend[7] {pt3dclear()
	pt3dadd(57.15, 22.66, 16.81, 1.46)
	pt3dadd(67.31, 25.1, 22.96, 1.46)
	pt3dadd(70.52, 26.12, 24.41, 1.46)
	pt3dadd(90.5, 18.04, 28.21, 1.46)
	pt3dadd(108.79, 10.67, 29.86, 1.46)
	pt3dadd(129.53, 6.24, 31.06, 1.46)
	pt3dadd(141.06, -0.24, 22.16, 1.46)
	pt3dadd(151.96, -4.47, 22.16, 1.1)
  }
  dend[8] {pt3dclear()
	pt3dadd(57.15, 22.66, 16.81, 1.46)
	pt3dadd(57.67, 27.61, 22.01, 1.1)
	pt3dadd(56.41, 32.12, 21.91, 1.1)
	pt3dadd(60.94, 38.13, 26.66, 1.1)
  }
  dend[9] {pt3dclear()
	pt3dadd(-0.3375, -3.8625, 11.0725, 1.1)
	pt3dadd(3.45, 4.55, -7.74, 1.1)
	pt3dadd(6.93, 9.03, -7.69, 1.1)
	pt3dadd(8.75, 11.43, -7.69, 1.1)
	pt3dadd(14.35, 13.42, -7.69, 1.1)
	pt3dadd(18.9, 16.66, -7.69, 1.1)
	pt3dadd(24.78, 22.11, -7.69, 1.1)
	pt3dadd(34.64, 29.44, -7.69, 1.1)
	pt3dadd(50.5, 35.02, -7.69, 1.1)
	pt3dadd(58.26, 36.49, -7.69, 1.1)
	pt3dadd(68.1, 36.29, -7.69, 1.1)
  }
  dend[10] {pt3dclear()
	pt3dadd(68.1, 36.29, -7.69, 1.1)
	pt3dadd(75.39, 34.78, -7.69, 1.1)
	pt3dadd(82.73, 35.24, -7.69, 1.1)
	pt3dadd(85.31, 35.73, -16.24, 1.1)
  }
  dend[11] {pt3dclear()
	pt3dadd(68.1, 36.29, -7.69, 1.1)
	pt3dadd(70.95, 43.02, -3.34, 1.1)
	pt3dadd(75.57, 55.76, -11.34, 1.1)
	pt3dadd(85.53, 58.68, -10.99, 1.1)
	pt3dadd(89.89, 62.39, -10.99, 1.1)
  }
  dend[12] {pt3dclear()
	pt3dadd(-0.3375, -3.8625, 11.0725, 1.46)
	pt3dadd(7.4, -3.88, -8.34, 1.46)
	pt3dadd(12.19, -1.94, -8.29, 1.46)
	pt3dadd(16.13, -2.02, -8.34, 1.46)
	pt3dadd(20.83, -4.02, -8.34, 1.46)
	pt3dadd(28.81, -8.6, -8.29, 1.46)
	pt3dadd(32.98, -9.97, -8.29, 1.46)
  }
  dend[13] {pt3dclear()
	pt3dadd(32.98, -9.97, -8.29, 1.46)
	pt3dadd(40.82, -14.89, -8.34, 1.46)
	pt3dadd(51.91, -19.6, -8.29, 1.46)
	pt3dadd(62.52, -21.72, -8.29, 1.46)
	pt3dadd(69.33, -23.42, -8.34, 1.46)
	pt3dadd(82.44, -28.98, -8.29, 1.46)
	pt3dadd(94.3, -32.82, 1.96, 1.46)
	pt3dadd(97.32, -34.11, 1.96, 1.46)
  }
  dend[14] {pt3dclear()
	pt3dadd(32.98, -9.97, -8.29, 1.46)
	pt3dadd(41.28, -9.13, -9.29, 1.46)
	pt3dadd(45.3, -5.27, -9.29, 1.46)
	pt3dadd(53.73, -4.09, -9.29, 1.46)
	pt3dadd(56.99, -1.1, -9.29, 1.46)
	pt3dadd(63.04, 12.22, -7.54, 1.46)
	pt3dadd(64.46, 15.59, -7.54, 1.46)
  }
  apic {pt3dclear()
	pt3dadd(-0.3375, -3.8625, 11.0725, 1.83)
	pt3dadd(-7.74, 0.32, 18.36, 1.83)
	pt3dadd(-10.04, 0.5, 18.36, 1.83)
	pt3dadd(-13.5, 3.56, 18.36, 1.83)
	pt3dadd(-14.27, 5.48, 18.36, 1.83)
	pt3dadd(-15.1, 8.21, 18.36, 1.83)
	pt3dadd(-16.44, 8.78, 18.36, 1.83)
	pt3dadd(-18.46, 9.64, 18.36, 1.83)
	pt3dadd(-19.18, 10.74, 19.76, 1.83)
	pt3dadd(-20.1, 12.32, 19.76, 1.83)
	pt3dadd(-21.35, 14.04, 19.76, 1.83)
	pt3dadd(-24.31, 16.73, 19.76, 1.83)
  }
  apic[1] {pt3dclear()
	pt3dadd(-24.31, 16.73, 19.76, 1.83)
	pt3dadd(-25.15, 17.24, 20.01, 1.83)
	pt3dadd(-28.65, 18.33, 20.36, 1.83)
	pt3dadd(-31.63, 18.8, 22.56, 1.83)
	pt3dadd(-35.33, 20.37, 22.71, 1.83)
	pt3dadd(-38.02, 21.51, 22.76, 1.83)
	pt3dadd(-40.28, 23.66, 24.11, 1.83)
	pt3dadd(-41.39, 25.72, 24.16, 1.83)
	pt3dadd(-45.23, 26.96, 28.21, 1.83)
	pt3dadd(-47.05, 27.33, 28.61, 1.83)
  }
  apic[2] {pt3dclear()
	pt3dadd(-47.05, 27.33, 28.61, 1.83)
	pt3dadd(-46.53, 29.5, 30.56, 1.83)
	pt3dadd(-45.86, 31.99, 30.61, 1.83)
	pt3dadd(-45.25, 35.31, 30.56, 1.83)
	pt3dadd(-44.02, 41.94, 31.01, 1.83)
	pt3dadd(-44.3, 42.83, 31.01, 1.83)
  }
  apic[3] {pt3dclear()
	pt3dadd(-44.3, 42.83, 31.01, 1.83)
	pt3dadd(-38.06, 51.32, 30.96, 1.83)
	pt3dadd(-34.98, 65.11, 32.66, 1.46)
	pt3dadd(-32.76, 74.09, 32.71, 1.46)
	pt3dadd(-30.58, 83.89, 33.36, 1.1)
	pt3dadd(-29.3, 89.71, 33.31, 1.1)
	pt3dadd(-19.54, 111.78, 29.81, 1.1)
	pt3dadd(-14.43, 119.14, 29.81, 1.1)
  }
  apic[4] {pt3dclear()
	pt3dadd(-44.3, 42.83, 31.01, 1.83)
	pt3dadd(-44.51, 48.88, 30.91, 0.73)
	pt3dadd(-43.73, 60.07, 61.06, 1.1)
	pt3dadd(-44.17, 64.63, 61.06, 1.1)
	pt3dadd(-45.48, 69.95, 61.06, 1.1)
	pt3dadd(-46.12, 74.99, 61.06, 1.1)
	pt3dadd(-47.68, 81.61, 61.06, 1.1)
	pt3dadd(-49, 89.71, 61.06, 1.1)
	pt3dadd(-49.3, 94.61, 61.06, 1.1)
	pt3dadd(-46.06, 103.16, 61.06, 1.1)
	pt3dadd(-43.87, 107.4, 61.06, 1.1)
	pt3dadd(-40.88, 117.25, 61.26, 1.1)
	pt3dadd(-39.13, 126.04, 63.06, 1.1)
	pt3dadd(-38.37, 129.69, 70.86, 1.1)
  }
  apic[5] {pt3dclear()
	pt3dadd(-38.37, 129.69, 70.86, 1.1)
	pt3dadd(-37.05, 134.69, 70.91, 1.1)
	pt3dadd(-33.12, 137.39, 70.91, 1.1)
	pt3dadd(-31.07, 141.29, 70.91, 1.1)
	pt3dadd(-28.55, 148.16, 70.91, 1.1)
	pt3dadd(-22.35, 159.03, 70.91, 1.1)
	pt3dadd(-20.3, 162.93, 70.91, 1.1)
	pt3dadd(-18.44, 167.3, 70.91, 1.1)
  }
  apic[6] {pt3dclear()
	pt3dadd(-38.37, 129.69, 70.86, 1.1)
	pt3dadd(-40.59, 133.81, 59.06, 1.1)
	pt3dadd(-41.24, 141.63, 58.96, 1.1)
	pt3dadd(-43.56, 147.38, 58.96, 1.1)
	pt3dadd(-47.27, 151.73, 61.31, 1.1)
	pt3dadd(-52.77, 164, 65.96, 1.1)
	pt3dadd(-53.85, 170.81, 70.61, 1.1)
  }
  apic[7] {pt3dclear()
	pt3dadd(-47.05, 27.33, 28.61, 1.83)
  }
}
proc shape3d_2() {
  apic[7] {	pt3dadd(-51.95, 30.55, 29.41, 1.46)
	pt3dadd(-54.88, 32.99, 29.41, 1.46)
	pt3dadd(-58.77, 35.04, 29.41, 1.46)
	pt3dadd(-66.31, 37.84, 29.41, 1.46)
	pt3dadd(-80.48, 44.65, 29.16, 1.46)
	pt3dadd(-80.42, 45.31, 29.16, 1.46)
  }
  apic[8] {pt3dclear()
	pt3dadd(-80.42, 45.31, 29.16, 1.46)
	pt3dadd(-93.07, 52.38, 30.16, 1.46)
	pt3dadd(-96.96, 54.43, 30.21, 1.46)
  }
  apic[9] {pt3dclear()
	pt3dadd(-96.96, 54.43, 30.21, 1.46)
	pt3dadd(-99.66, 58.35, 30.21, 1.46)
	pt3dadd(-101.3, 61.03, 30.21, 1.46)
	pt3dadd(-102.79, 64.05, 30.21, 1.46)
	pt3dadd(-103.78, 72.02, 30.21, 1.46)
	pt3dadd(-108.59, 78.43, 28.31, 1.46)
	pt3dadd(-103, 85.99, 35.16, 1.46)
	pt3dadd(-99.9, 91.42, 32.71, 1.46)
	pt3dadd(-96, 99.69, 32.71, 1.46)
	pt3dadd(-95.17, 112.85, 32.71, 1.46)
	pt3dadd(-91.9, 126.16, 32.71, 1.46)
	pt3dadd(-86.87, 142.69, 32.71, 1.46)
	pt3dadd(-82.25, 147.94, 38.06, 1.83)
	pt3dadd(-81.77, 150.92, 38.06, 1.83)
	pt3dadd(-79.63, 155.97, 38.01, 1.46)
	pt3dadd(-76.2, 164.04, 38.41, 1.46)
	pt3dadd(-63.68, 178.59, 40.76, 1.46)
	pt3dadd(-55.7, 198.21, 39.61, 1.46)
	pt3dadd(-57.55, 220.05, 34.51, 1.46)
	pt3dadd(-56.05, 232.92, 29.71, 1.46)
	pt3dadd(-56.44, 236.66, 23.36, 1.46)
  }
  apic[10] {pt3dclear()
	pt3dadd(-96.96, 54.43, 30.21, 1.46)
	pt3dadd(-101.57, 54.79, 37.76, 1.1)
	pt3dadd(-108.29, 57.65, 37.81, 1.1)
	pt3dadd(-114.97, 62.47, 37.86, 1.1)
	pt3dadd(-118.86, 64.52, 37.86, 1.1)
  }
  apic[11] {pt3dclear()
	pt3dadd(-118.86, 64.52, 37.86, 1.1)
	pt3dadd(-117.73, 69.99, 37.91, 1.1)
	pt3dadd(-116.27, 78.11, 37.86, 1.1)
	pt3dadd(-114.26, 82.82, 37.86, 1.1)
	pt3dadd(-113.95, 91.03, 37.91, 1.1)
	pt3dadd(-113.83, 96.94, 37.91, 1.1)
	pt3dadd(-115.49, 107.97, 37.91, 1.1)
	pt3dadd(-108.76, 134.11, 37.91, 1.1)
	pt3dadd(-110.14, 145.81, 37.91, 1.1)
	pt3dadd(-110.54, 152.34, 46.36, 1.1)
	pt3dadd(-110.74, 168.71, 45.91, 1.1)
	pt3dadd(-110.76, 177.06, 45.51, 1.1)
	pt3dadd(-109.95, 193, 45.26, 1.1)
	pt3dadd(-127.84, 209.73, 45.06, 1.1)
	pt3dadd(-128.69, 220.81, 45.06, 1.1)
	pt3dadd(-137.27, 235.18, 44.96, 1.1)
	pt3dadd(-140.23, 245.97, 44.96, 1.1)
	pt3dadd(-146.79, 259.48, 44.76, 1.1)
	pt3dadd(-150.68, 277.42, 44.76, 1.1)
	pt3dadd(-159.43, 283.91, 49.81, 1.1)
  }
  apic[12] {pt3dclear()
	pt3dadd(-118.86, 64.52, 37.86, 1.1)
	pt3dadd(-125.93, 64.27, 43.06, 1.1)
	pt3dadd(-135.34, 68.27, 43.06, 1.1)
	pt3dadd(-148.79, 73.98, 43.06, 1.1)
	pt3dadd(-160.79, 77.48, 43.06, 1.1)
  }
  apic[13] {pt3dclear()
	pt3dadd(-160.79, 77.48, 43.06, 1.1)
	pt3dadd(-162.61, 77.86, 65.86, 1.1)
	pt3dadd(-163.81, 78.77, 65.86, 1.1)
  }
  apic[14] {pt3dclear()
	pt3dadd(-163.81, 78.77, 65.86, 1.1)
	pt3dadd(-167.48, 85.09, 66.86, 1.1)
	pt3dadd(-169.03, 91.71, 67.61, 1.1)
	pt3dadd(-169.05, 97.27, 70.36, 1.1)
	pt3dadd(-168.01, 101.6, 74.66, 1.1)
	pt3dadd(-166.19, 104, 77.26, 1.1)
	pt3dadd(-162.18, 107.86, 77.31, 1.1)
	pt3dadd(-160.46, 111.9, 79.06, 1.1)
	pt3dadd(-156.4, 117.72, 84.46, 1.1)
	pt3dadd(-153.69, 124.12, 87.21, 1.1)
	pt3dadd(-151.41, 132.29, 88.56, 1.1)
	pt3dadd(-149.22, 136.52, 90.56, 1.1)
	pt3dadd(-148.81, 143.1, 96.96, 1.1)
	pt3dadd(-151.9, 150.76, 101.31, 1.1)
	pt3dadd(-154.71, 159.1, 105.46, 1.1)
	pt3dadd(-156.93, 166.01, 107.81, 1.1)
	pt3dadd(-158.54, 173.44, 109.31, 1.1)
	pt3dadd(-157.02, 177.96, 110.46, 1.1)
	pt3dadd(-153.14, 181.48, 113.71, 1.1)
  }
  apic[15] {pt3dclear()
	pt3dadd(-163.81, 78.77, 65.86, 1.1)
	pt3dadd(-166.25, 75.83, 58.06, 1.1)
	pt3dadd(-170.51, 73.27, 58.11, 1.1)
	pt3dadd(-178.8, 69.64, 58.11, 1.1)
	pt3dadd(-189.19, 65.71, 58.11, 1.1)
	pt3dadd(-212.62, 58.18, 58.11, 1.1)
	pt3dadd(-226.72, 55.82, 58.11, 1.1)
	pt3dadd(-256.86, 48.36, 60.91, 1.1)
	pt3dadd(-281.16, 44.37, 63.16, 1.1)
	pt3dadd(-297.52, 44.16, 65.41, 1.1)
	pt3dadd(-314.83, 43.57, 67.21, 1.1)
	pt3dadd(-324.85, 41.47, 68.81, 1.1)
	pt3dadd(-332.38, 41.49, 70.86, 1.1)
	pt3dadd(-377.53, 65.02, 70.06, 1.1)
	pt3dadd(-396.06, 74.63, 65.86, 1.1)
  }
  apic[16] {pt3dclear()
	pt3dadd(-160.79, 77.48, 43.06, 1.1)
	pt3dadd(-176.87, 82.02, 48.71, 1.46)
	pt3dadd(-182.53, 83.63, 48.71, 1.46)
	pt3dadd(-191.7, 86.33, 48.71, 1.46)
	pt3dadd(-197.57, 91.2, 52.06, 1.46)
	pt3dadd(-204.33, 92.09, 53.31, 1.46)
	pt3dadd(-214.12, 94.26, 53.36, 1.46)
	pt3dadd(-228.72, 100.06, 54.76, 1.46)
	pt3dadd(-236.6, 103, 57.06, 1.46)
	pt3dadd(-243.85, 106.48, 58.11, 1.46)
	pt3dadd(-253.26, 110.47, 58.11, 1.46)
	pt3dadd(-258.11, 112.13, 58.06, 1.46)
	pt3dadd(-262.43, 113.17, 58.06, 1.46)
  }
  apic[17] {pt3dclear()
	pt3dadd(-262.43, 113.17, 58.06, 1.46)
	pt3dadd(-269.47, 110.6, 58.71, 1.46)
	pt3dadd(-295.55, 106.18, 60.51, 1.46)
	pt3dadd(-299.62, 105.92, 62.66, 0.73)
	pt3dadd(-303.84, 105.33, 66.41, 0.37)
	pt3dadd(-308.57, 99.79, 72.56, 0.37)
	pt3dadd(-312.89, 98.05, 74.06, 0.37)
	pt3dadd(-317.87, 96.59, 75.01, 0.37)
	pt3dadd(-323.39, 98.54, 76.31, 0.37)
  }
  apic[18] {pt3dclear()
	pt3dadd(-262.43, 113.17, 58.06, 1.46)
	pt3dadd(-264.21, 115.52, 57.46, 1.1)
	pt3dadd(-267.24, 116.8, 57.46, 1.1)
  }
  apic[19] {pt3dclear()
	pt3dadd(-267.24, 116.8, 57.46, 1.1)
	pt3dadd(-273.9, 116.06, 56.56, 0.37)
	pt3dadd(-282.53, 115.35, 55.76, 0.37)
	pt3dadd(-291.56, 118.39, 54.96, 0.37)
	pt3dadd(-299.95, 119.17, 54.96, 0.37)
	pt3dadd(-305.23, 119.82, 54.96, 0.37)
	pt3dadd(-316.36, 122.56, 54.51, 0.37)
	pt3dadd(-326.78, 124.2, 48.21, 0.37)
	pt3dadd(-334.42, 128.64, 46.21, 0.37)
	pt3dadd(-339.79, 130.92, 46.06, 0.37)
  }
  apic[20] {pt3dclear()
	pt3dadd(-267.24, 116.8, 57.46, 1.1)
	pt3dadd(-273.72, 118.36, 63.61, 0.73)
	pt3dadd(-278.47, 121.18, 63.61, 1.1)
	pt3dadd(-280.88, 122.99, 63.61, 1.1)
  }
  apic[21] {pt3dclear()
	pt3dadd(-280.88, 122.99, 63.61, 1.1)
	pt3dadd(-279.16, 127.03, 63.61, 0.73)
	pt3dadd(-280.18, 130.24, 63.61, 0.73)
	pt3dadd(-278.46, 134.28, 60.91, 0.73)
	pt3dadd(-275.3, 136.12, 59.06, 0.73)
	pt3dadd(-272.77, 140.21, 56.21, 0.73)
	pt3dadd(-272.64, 143.33, 56.16, 0.73)
	pt3dadd(-272.51, 146.45, 53.86, 0.73)
	pt3dadd(-270.74, 149.67, 52.96, 0.73)
	pt3dadd(-269.56, 154.33, 52.96, 0.73)
	pt3dadd(-269.34, 161.39, 51.11, 0.73)
	pt3dadd(-272.37, 165.45, 50.66, 0.73)
	pt3dadd(-279, 169.46, 48.36, 0.73)
	pt3dadd(-283.29, 175.25, 44.86, 0.73)
	pt3dadd(-283.16, 181.16, 43.56, 0.73)
	pt3dadd(-284.71, 184.99, 39.96, 0.73)
	pt3dadd(-286.41, 191.27, 39.71, 0.73)
  }
  apic[22] {pt3dclear()
	pt3dadd(-280.88, 122.99, 63.61, 1.1)
	pt3dadd(-284.09, 124.75, 64.11, 1.1)
	pt3dadd(-286.02, 126.76, 64.16, 1.1)
	pt3dadd(-288.23, 128.1, 64.16, 1.1)
	pt3dadd(-291.73, 129.19, 64.16, 1.1)
	pt3dadd(-294.57, 129.99, 64.16, 1.1)
	pt3dadd(-297.4, 130.8, 64.16, 1.1)
	pt3dadd(-298.51, 132.86, 64.16, 1.1)
	pt3dadd(-299.95, 135.06, 64.16, 1.1)
  }
  apic[23] {pt3dclear()
	pt3dadd(-299.95, 135.06, 64.16, 1.1)
	pt3dadd(-298.91, 139.38, 64.16, 0.73)
	pt3dadd(-296.71, 140.83, 64.71, 0.73)
	pt3dadd(-294.46, 144.25, 68.06, 0.73)
	pt3dadd(-292.66, 149.44, 69.26, 0.73)
	pt3dadd(-290.99, 154.29, 71.11, 0.73)
	pt3dadd(-286.69, 158.82, 71.51, 0.73)
	pt3dadd(-282.01, 165.18, 71.76, 0.73)
	pt3dadd(-282.31, 170.07, 72.56, 0.73)
	pt3dadd(-284.83, 179.09, 72.66, 0.73)
	pt3dadd(-283.62, 188.5, 73.46, 0.73)
	pt3dadd(-278.24, 202.1, 73.51, 0.73)
	pt3dadd(-273.62, 212.06, 73.51, 0.73)
	pt3dadd(-263.36, 228.75, 76.11, 0.73)
	pt3dadd(-255.9, 237.9, 79.36, 0.73)
	pt3dadd(-253.09, 245.45, 81.81, 0.73)
  }
  apic[24] {pt3dclear()
	pt3dadd(-299.95, 135.06, 64.16, 1.1)
	pt3dadd(-303.12, 136.01, 64.21, 1.46)
	pt3dadd(-305.14, 136.86, 64.21, 1.46)
	pt3dadd(-310.56, 137.18, 64.26, 1.46)
	pt3dadd(-316.65, 137.78, 64.26, 1.46)
	pt3dadd(-320.64, 141.46, 64.26, 1.46)
	pt3dadd(-325.01, 143.31, 64.26, 1.46)
	pt3dadd(-329, 144.21, 64.26, 1.46)
	pt3dadd(-333.03, 145.92, 64.21, 1.46)
	pt3dadd(-343.22, 151.83, 64.26, 1.46)
	pt3dadd(-352.01, 155.59, 64.26, 1.83)
	pt3dadd(-360.75, 159.3, 64.26, 1.83)
	pt3dadd(-366.99, 162.35, 64.26, 1.83)
  }
  apic[25] {pt3dclear()
	pt3dadd(-80.42, 45.31, 29.16, 1.46)
	pt3dadd(-84.44, 44.24, -8.79, 0.37)
	pt3dadd(-89, 43.79, -8.74, 0.37)
	pt3dadd(-97.82, 43.56, -9.24, 0.37)
	pt3dadd(-106.17, 46.31, -10.14, 0.37)
	pt3dadd(-110.15, 44.43, -11.04, 0.37)
	pt3dadd(-119.92, 41.03, -10.99, 0.37)
	pt3dadd(-126.97, 41.24, -10.99, 0.37)
  }
  apic[26] {pt3dclear()
	pt3dadd(-24.31, 16.73, 19.76, 1.83)
  }
}
proc shape3d_3() {
  apic[26] {	pt3dadd(-24.46, 19.18, -3.39, 1.1)
	pt3dadd(-25.09, 21.43, -3.39, 1.1)
	pt3dadd(-26.35, 23.15, -3.39, 1.1)
	pt3dadd(-28.32, 25.98, -3.39, 1.1)
  }
  apic[27] {pt3dclear()
	pt3dadd(-28.32, 25.98, -3.39, 1.1)
	pt3dadd(-21.36, 24.61, -1.24, 1.1)
	pt3dadd(-15.67, 27.76, -1.24, 1.1)
	pt3dadd(-12.03, 32.57, -1.24, 1.1)
	pt3dadd(-5.69, 43.78, -1.24, 1.1)
  }
  apic[28] {pt3dclear()
	pt3dadd(-28.32, 25.98, -3.39, 1.1)
	pt3dadd(-31.88, 27.88, -3.69, 1.1)
	pt3dadd(-38.99, 31.7, -3.69, 1.1)
	pt3dadd(-41.05, 33.37, -3.69, 1.1)
	pt3dadd(-48.36, 40.44, -3.69, 1.1)
	pt3dadd(-52.36, 44.12, -3.09, 1.1)
	pt3dadd(-58.79, 47.65, 2.61, 1.1)
	pt3dadd(-72.24, 53.36, 4.91, 1.1)
	pt3dadd(-84.58, 57.01, 2.56, 1.1)
	pt3dadd(-94.76, 62.92, 2.56, 1.1)
	pt3dadd(-104.28, 68.55, 2.56, 1.1)
	pt3dadd(-108.12, 72.56, 2.56, 1.1)
	pt3dadd(-115.44, 79.64, 2.56, 1.1)
	pt3dadd(-117.99, 83.9, 2.56, 1.1)
	pt3dadd(-120.41, 91.28, 2.56, 1.1)
	pt3dadd(-121.54, 98.91, -0.59, 1.1)
	pt3dadd(-119.51, 111.16, -0.59, 1.1)
  }
}
proc basic_shape() {
  shape3d_1()
  shape3d_2()
  shape3d_3()
}

	objref all,dends,tcdends,ccdends,ccsyn,tcsyn,ccnetcon,tcnetcon,apcounter,apvec,nil
	objref all,dends,segdends,Esyn,Esourse[2]
proc init(){
		objref all,dends,segdends,Esyn,Esourse[2]
		all=new SectionList()
		dends = new SectionList()
		segdends = new SectionList()
		Esyn=new List()
		Enetcon=new List()
		Esourse[0]=new Vector()
		Esourse[1]=new Vector()
		Isyn=new List()
		Inetcon=new List()
		topol()
basic_shape()
		access soma
		distance()
		forall{

			dends.append()
			all.append()
			for i=0,n3d()-1{
				pt3dchange(i,x3d(i)+$1,y3d(i)+$2,z3d(i),diam3d(i))	
			}
			if (diam<3){diam=1}
			nseg=9

			insert pas
			e_pas=-60
			g_pas=1/10000
			cm=1
			Ra=100

		}
		soma dends.remove()		

		
		objref apcounter,apvec,nil
		numdend=0
		forsec dends{numdend=numdend+1 segdends.append()}
		apvec=new Vector()
		access soma
		apcounter=new NetCon(&v(.5), nil)
		apcounter.threshold = -20 
		apcounter.record(apvec)
		//saving voltage vectors
		objref Vvec[numdend+1],spikevec[numdend+1]
		i=0
		forsec dends {
			Vvec[i]=new Vector()
			Vvec[i].record(&v(0.9))
			spikevec[i]=new Vector()
			i=i+1
		}
		Vvec[numdend]=new Vector()
		Vvec[numdend].record(&soma.v(0.5))
		//dends=new SectionList()
}

endtemplate celltemplate