begintemplate OLM

public soma, dend2, dend4, dend3, dend1, dend7, dend8, dend6, dend5


create soma[9], dend2[6], dend4[22], dend3[2], dend1[20], dend7[10], dend8[11]
create dend6[3], dend5
forall {Ra = 150}


proc init() {

	topol()
	memb()
}

forall{nseg=L/10+1}

proc topol() { local i
  connect soma[1](0), soma[0](0)
  for i = 2, 8 connect soma[i](0), soma[i-2](1)
  connect dend2(0), soma[0](0)
  for i = 1, 2 connect dend2[i](0), dend2[i-1](1)
  connect dend2[3](0), dend2[1](1)
  for i = 4, 5 connect dend2[i](0), dend2[3](1)
  connect dend4(0), soma(1)
  for i = 1, 2 connect dend4[i](0), dend4(1)
  for i = 3, 4 connect dend4[i](0), dend4[1](1)
  for i = 5, 6 connect dend4[i](0), dend4[2](1)
  for i = 7, 8 connect dend4[i](0), dend4[3](1)
  for i = 9, 10 connect dend4[i](0), dend4[4](1)
  for i = 11, 12 connect dend4[i](0), dend4[6](1)
  for i = 13, 14 connect dend4[i](0), dend4[7](1)
  for i = 15, 16 connect dend4[i](0), dend4[10](1)
  for i = 17, 18 connect dend4[i](0), dend4[11](1)
  for i = 19, 20 connect dend4[i](0), dend4[12](1)
  connect dend4[21](0), dend4[15](1)
  connect dend3(0), dend2(1)
  connect dend3[1](0), dend3(1)
  connect dend1(0), soma[1](1)
  for i = 1, 2 connect dend1[i](0), dend1(1)
  for i = 3, 4 connect dend1[i](0), dend1[i-2](1)
  for i = 5, 8 connect dend1[i](0), dend1[i-3](1)
  for i = 9, 10 connect dend1[i](0), dend1[i-4](1)
  for i = 11, 12 connect dend1[i](0), dend1[i-1](1)
  for i = 13, 14 connect dend1[i](0), dend1[i-2](1)
  for i = 15, 16 connect dend1[i](0), dend1[i-3](1)
  connect dend1[17](0), dend1[13](1)
  for i = 18, 19 connect dend1[i](0), dend1[15](1)
  connect dend7(0), soma[3](1)
  for i = 1, 2 connect dend7[i](0), dend7[i-1](1)
  for i = 3, 4 connect dend7[i](0), dend7[i-2](1)
  for i = 5, 7 connect dend7[i](0), dend7[2](1)
  for i = 8, 9 connect dend7[i](0), dend7[i-5](1)
  connect dend8(0), soma[8](1)
  for i = 1, 4 connect dend8[i](0), dend8(1)
  connect dend8[5](0), dend8[1](1)
  for i = 6, 7 connect dend8[i](0), dend8[5](1)
  connect dend8[8](0), dend8[6](1)
  for i = 9, 10 connect dend8[i](0), dend8[8](1)
  connect dend6(0), soma[8](1)
  for i = 1, 2 connect dend6[i](0), dend6(1)
  connect dend5(0), soma[8](1)
  basic_shape()
}

proc shape3d_1() {
  soma[0] {pt3dclear()
	pt3dadd(-14, -164, 0, 9.22)
	pt3dadd(-11.08, -164, 0, 9.22)
  }
  dend2 {pt3dclear()
	pt3dadd(-14, -164, 0, 1.07)
	pt3dadd(-16.7235, -158.553, 0, 1.07)
  }
  soma[1] {pt3dclear()
	pt3dadd(-14, -164, 0, 8.03)
	pt3dadd(-16.92, -164, 0, 8.03)
  }
  dend4 {pt3dclear()
	pt3dadd(-11.08, -164, 0, 1.38)
	pt3dadd(-11.08, -126.28, 0, 1.38)
  }
  soma[2] {pt3dclear()
	pt3dadd(-11.08, -164, 0, 9.82)
	pt3dadd(-8.16, -164, 0, 9.82)
  }
  dend3 {pt3dclear()
	pt3dadd(-16.7235, -158.553, 0, 0.68)
	pt3dadd(-100.264, -158.553, 0, 0.68)
  }
  dend2[1] {pt3dclear()
	pt3dadd(-16.7235, -158.553, 0, 0.89)
	pt3dadd(-93.3491, -120.24, 0, 0.89)
  }
  dend1 {pt3dclear()
	pt3dadd(-16.92, -164, 0, 1.29)
	pt3dadd(-112.958, -144.792, 0, 1.29)
  }
  soma[3] {pt3dclear()
	pt3dadd(-16.92, -164, 0, 6.78)
	pt3dadd(-19.84, -164, 0, 6.78)
  }
  dend4[1] {pt3dclear()
	pt3dadd(-11.08, -126.28, 0, 1.15)
	pt3dadd(0.279225, -103.562, 0, 1.15)
  }
  dend4[2] {pt3dclear()
	pt3dadd(-11.08, -126.28, 0, 1.07)
	pt3dadd(-11.08, -105.28, 0, 1.07)
  }
  soma[4] {pt3dclear()
	pt3dadd(-8.16, -164, 0, 7.6)
	pt3dadd(-5.24, -164, 0, 7.6)
  }
  dend3[1] {pt3dclear()
	pt3dadd(-100.264, -158.553, 0, 0.64)
	pt3dadd(-161.81, -220.1, 0, 0.64)
  }
  dend2[2] {pt3dclear()
	pt3dadd(-93.3491, -120.24, 0, 0.68)
	pt3dadd(-164.19, -63.5678, 0, 0.68)
  }
  dend2[3] {pt3dclear()
	pt3dadd(-93.3491, -120.24, 0, 0.68)
	pt3dadd(-111.359, -120.24, 0, 0.68)
  }
  dend1[1] {pt3dclear()
	pt3dadd(-112.958, -144.792, 0, 0.86)
	pt3dadd(-120.757, -152.592, 0, 0.86)
  }
  dend1[2] {pt3dclear()
	pt3dadd(-112.958, -144.792, 0, 1.07)
	pt3dadd(-164.51, -127.609, 0, 1.07)
  }
  dend7 {pt3dclear()
	pt3dadd(-19.84, -164, 0, 0.91)
	pt3dadd(-15.0414, -173.597, 0, 0.91)
  }
  soma[5] {pt3dclear()
	pt3dadd(-19.84, -164, 0, 5.87)
	pt3dadd(-22.76, -164, 0, 5.87)
  }
  dend4[3] {pt3dclear()
	pt3dadd(0.279225, -103.562, 0, 0.91)
	pt3dadd(13.3091, -84.0167, 0, 0.91)
  }
  dend4[4] {pt3dclear()
	pt3dadd(0.279225, -103.562, 0, 0.86)
	pt3dadd(0.279225, -71.1015, 0, 0.86)
  }
  dend4[5] {pt3dclear()
	pt3dadd(-11.08, -105.28, 0, 0.86)
	pt3dadd(-24.3204, 7.26383, 0, 0.86)
  }
  dend4[6] {pt3dclear()
	pt3dadd(-11.08, -105.28, 0, 1.07)
	pt3dadd(-75.3074, -23.635, 0, 1.07)
  }
  soma[6] {pt3dclear()
	pt3dadd(-5.24, -164, 0, 4.92)
	pt3dadd(-2.32, -164, 0, 4.92)
  }
  dend2[4] {pt3dclear()
	pt3dadd(-111.359, -120.24, 0, 0.61)
	pt3dadd(-220.009, -120.24, 0, 0.61)
  }
  dend2[5] {pt3dclear()
	pt3dadd(-111.359, -120.24, 0, 0.64)
	pt3dadd(-126.781, -135.662, 0, 0.64)
  }
  dend1[3] {pt3dclear()
	pt3dadd(-120.757, -152.592, 0, 0.86)
	pt3dadd(-131.724, -148.936, 0, 0.86)
  }
  dend1[4] {pt3dclear()
	pt3dadd(-164.51, -127.609, 0, 0.86)
	pt3dadd(-298.417, -144.347, 0, 0.86)
  }
  dend1[5] {pt3dclear()
	pt3dadd(-164.51, -127.609, 0, 0.86)
	pt3dadd(-170.422, -126.426, 0, 0.86)
  }
  dend7[1] {pt3dclear()
	pt3dadd(-15.0414, -173.597, 0, 0.91)
	pt3dadd(-25.6834, -184.239, 0, 0.91)
  }
  soma[7] {pt3dclear()
	pt3dadd(-22.76, -164, 0, 4.15)
	pt3dadd(-25.68, -164, 0, 4.15)
  }
  dend4[7] {pt3dclear()
	pt3dadd(13.3091, -84.0167, 0, 0.88)
	pt3dadd(48.0887, -75.3218, 0, 0.88)
  }
  dend4[8] {pt3dclear()
	pt3dadd(13.3091, -84.0167, 0, 0.86)
	pt3dadd(47.674, -16.0505, 0, 0.86)
  }
  dend4[9] {pt3dclear()
	pt3dadd(0.279225, -71.1015, 0, 0.91)
	pt3dadd(-16.4101, 61.3008, 0, 0.91)
  }
  dend4[10] {pt3dclear()
	pt3dadd(0.279225, -71.1015, 0, 0.86)
	pt3dadd(-7.78179, -63.0405, 0, 0.86)
  }
  dend4[11] {pt3dclear()
	pt3dadd(-75.3074, -23.635, 0, 0.91)
	pt3dadd(-100.596, 13.4543, 0, 0.91)
  }
  dend4[12] {pt3dclear()
	pt3dadd(-75.3074, -23.635, 0, 0.96)
	pt3dadd(-111.346, -6.81688, 0, 0.96)
  }
  soma[8] {pt3dclear()
	pt3dadd(-2.32, -164, 0, 3.24)
	pt3dadd(0.599997, -164, 0, 3.24)
  }
  dend1[6] {pt3dclear()
	pt3dadd(-131.724, -148.936, 0, 0.86)
	pt3dadd(-184.884, -148.936, 0, 0.86)
  }
  dend1[7] {pt3dclear()
	pt3dadd(-298.417, -144.347, 0, 0.86)
	pt3dadd(-298.417, -155.307, 0, 0.86)
  }
  dend1[8] {pt3dclear()
	pt3dadd(-170.422, -126.426, 0, 0.86)
	pt3dadd(-312.032, -126.426, 0, 0.86)
  }
  dend1[9] {pt3dclear()
	pt3dadd(-170.422, -126.426, 0, 0.86)
	pt3dadd(-214.192, -82.6561, 0, 0.86)
  }
  dend7[2] {pt3dclear()
	pt3dadd(-25.6834, -184.239, 0, 0.86)
	pt3dadd(-25.6834, -195.629, 0, 0.86)
  }
  dend7[3] {pt3dclear()
	pt3dadd(-25.6834, -184.239, 0, 0.86)
	pt3dadd(-70.3394, -217.731, 0, 0.86)
  }
  dend4[13] {pt3dclear()
	pt3dadd(48.0887, -75.3218, 0, 0.86)
	pt3dadd(106.58, -63.6235, 0, 0.86)
  }
  dend4[14] {pt3dclear()
	pt3dadd(48.0887, -75.3218, 0, 0.64)
	pt3dadd(67.784, -85.1694, 0, 0.64)
  }
  dend4[15] {pt3dclear()
	pt3dadd(-7.78179, -63.0405, 0, 0.77)
	pt3dadd(-7.78179, -49.2205, 0, 0.77)
  }
  dend4[16] {pt3dclear()
	pt3dadd(-7.78179, -63.0405, 0, 0.77)
	pt3dadd(-31.5911, -51.3376, 0, 0.77)
  }
  dend4[17] {pt3dclear()
	pt3dadd(-100.596, 13.4543, 0, 0.88)
	pt3dadd(-85.3362, 28.7137, 0, 0.88)
  }
  dend4[18] {pt3dclear()
	pt3dadd(-100.596, 13.4543, 0, 0.91)
	pt3dadd(-129.552, 42.4103, 0, 0.91)
  }
  dend4[19] {pt3dclear()
	pt3dadd(-111.346, -6.81688, 0, 0.86)
	pt3dadd(-146.56, 10.7899, 0, 0.86)
  }
  dend4[20] {pt3dclear()
	pt3dadd(-111.346, -6.81688, 0, 0.88)
	pt3dadd(-187.2, 5.8254, 0, 0.88)
  }
  dend8 {pt3dclear()
	pt3dadd(0.599997, -164, 0, 0.91)
	pt3dadd(4.86194, -172.524, 0, 0.91)
  }
  dend6 {pt3dclear()
	pt3dadd(0.599997, -164, 0, 1.09)
	pt3dadd(65.07, -164, 0, 1.09)
  }
  dend5 {pt3dclear()
	pt3dadd(0.599997, -164, 0, 0.91)
	pt3dadd(61.9352, -139.466, 0, 0.91)
  }
  dend1[10] {pt3dclear()
	pt3dadd(-184.884, -148.936, 0, 0.86)
	pt3dadd(-180.154, -153.667, 0, 0.86)
  }
  dend7[4] {pt3dclear()
	pt3dadd(-25.6834, -195.629, 0, 0.86)
	pt3dadd(-12.4872, -200.028, 0, 0.86)
  }
  dend7[5] {pt3dclear()
	pt3dadd(-25.6834, -195.629, 0, 0.77)
	pt3dadd(-53.3343, -278.582, 0, 0.77)
  }
  dend7[6] {pt3dclear()
	pt3dadd(-25.6834, -195.629, 0, 0.86)
	pt3dadd(-25.6834, -218.559, 0, 0.86)
  }
  dend7[7] {pt3dclear()
	pt3dadd(-25.6834, -195.629, 0, 0.86)
	pt3dadd(-38.6013, -234.383, 0, 0.86)
  }
  dend7[8] {pt3dclear()
	pt3dadd(-70.3394, -217.731, 0, 0.77)
	pt3dadd(-173.073, -286.22, 0, 0.77)
  }
  dend4[21] {pt3dclear()
	pt3dadd(-7.78179, -49.2205, 0, 0.77)
	pt3dadd(14.7874, -41.6975, 0, 0.77)
  }
  dend8[1] {pt3dclear()
	pt3dadd(4.86194, -172.524, 0, 0.86)
	pt3dadd(9.89213, -192.645, 0, 0.86)
  }
  dend8[2] {pt3dclear()
	pt3dadd(4.86194, -172.524, 0, 0.77)
	pt3dadd(-83.4101, -238.728, 0, 0.77)
  }
  dend8[3] {pt3dclear()
	pt3dadd(4.86194, -172.524, 0, 0.86)
	pt3dadd(-18.9301, -190.368, 0, 0.86)
  }
  dend8[4] {pt3dclear()
	pt3dadd(4.86194, -172.524, 0, 0.86)
	pt3dadd(31.3759, -179.152, 0, 0.86)
  }
  dend6[1] {pt3dclear()
	pt3dadd(65.07, -164, 0, 0.86)
	pt3dadd(96.8907, -171.955, 0, 0.86)
  }
  dend6[2] {pt3dclear()
	pt3dadd(65.07, -164, 0, 0.86)
	pt3dadd(178.38, -164, 0, 0.86)
  }
  dend1[11] {pt3dclear()
	pt3dadd(-180.154, -153.667, 0, 0.86)
	pt3dadd(-188.108, -158.97, 0, 0.86)
  }
  dend7[9] {pt3dclear()
	pt3dadd(-12.4872, -200.028, 0, 0.86)
	pt3dadd(33.3249, -269.323, 0, 0.86)
  }
  dend8[5] {pt3dclear()
	pt3dadd(9.89213, -192.645, 0, 0.86)
	pt3dadd(20.2865, -223.828, 0, 0.86)
  }
  dend1[12] {pt3dclear()
	pt3dadd(-188.108, -158.97, 0, 0.77)
	pt3dadd(-194.128, -171.009, 0, 0.77)
  }
  dend1[13] {pt3dclear()
	pt3dadd(-188.108, -158.97, 0, 0.77)
	pt3dadd(-291.35, -173.719, 0, 0.77)
  }
  dend8[6] {pt3dclear()
	pt3dadd(20.2865, -223.828, 0, 0.86)
	pt3dadd(49.4123, -252.954, 0, 0.86)
  }
  dend8[7] {pt3dclear()
	pt3dadd(20.2865, -223.828, 0, 0.86)
	pt3dadd(-15.6345, -259.749, 0, 0.86)
  }
  dend1[14] {pt3dclear()
	pt3dadd(-194.128, -171.009, 0, 0.77)
	pt3dadd(-164.947, -188.517, 0, 0.77)
  }
  dend1[15] {pt3dclear()
	pt3dadd(-194.128, -171.009, 0, 0.77)
	pt3dadd(-204.051, -174.316, 0, 0.77)
  }
  dend1[16] {pt3dclear()
	pt3dadd(-291.35, -173.719, 0, 0.77)
	pt3dadd(-305.428, -180.758, 0, 0.77)
  }
  dend1[17] {pt3dclear()
	pt3dadd(-291.35, -173.719, 0, 0.64)
	pt3dadd(-319.27, -164.412, 0, 0.64)
  }
  dend8[8] {pt3dclear()
	pt3dadd(49.4123, -252.954, 0, 0.64)
	pt3dadd(49.4123, -316.314, 0, 0.64)
  }
  dend1[18] {pt3dclear()
	pt3dadd(-204.051, -174.316, 0, 0.77)
	pt3dadd(-212.119, -190.452, 0, 0.77)
  }
  dend1[19] {pt3dclear()
	pt3dadd(-204.051, -174.316, 0, 0.77)
	pt3dadd(-305.796, -194.665, 0, 0.77)
  }
  dend8[9] {pt3dclear()
	pt3dadd(49.4123, -316.314, 0, 0.64)
	pt3dadd(61.0866, -327.988, 0, 0.64)
  }
  dend8[10] {pt3dclear()
	pt3dadd(49.4123, -316.314, 0, 0.64)
	pt3dadd(24.6724, -328.684, 0, 0.64)
  }
}

proc basic_shape() {
  shape3d_1()
}

proc memb() {
forall {
	insert ks ek=-90 vhalfp_ks=-35 kp_ks=2 gksbar_ks=0.0008
	insert kamt gbar_kamt=0.004
	insert nax gbar_nax=0.015 sh_nax=15
	insert pas g_pas=1/25000 Ra=150 cm=1
}	
}

endtemplate OLM