proc connect_cells() {local i, j
for i=0, nmitral-1 {
for j=0, ngranule-1 {
mgconnect(i, j)
}
}
}
// connect mitral $1 to granule $2 based on mitral position and granule
// position. Only connect if secden long enough to reach granule
proc mgconnect() {local mp, gp, delta, x localobj mgrs
mp = mitral_x.x[$1]
gp = len*($2+.5)/ngranule
delta = gp - mp
if (abs(delta) > Lsec) { return }
x = delta/Lsec
if (delta >= 0) { // use secden[0]
mgrs = mk_mgrs($1, "secden[0]", x, $2, "dend[0]", 1)
}else{ // use secden[1]
mgrs = mk_mgrs($1, "secden[1]", -x, $2, "dend[0]", 1)
}
// store position and relation info in synapse to aid in
// selection and movie making
if (object_id(mgrs)) {
if (mgrs.mexist) {
mgrs.fi.mgid = mgrs.mitral_gid
mgrs.fi.ggid = mgrs.granule_gid
mgrs.fi.srcgid = mgrs.gd_gid
mgrs.fi.x = gp
}
if (mgrs.gexist) {
mgrs.ampanmda.mgid = mgrs.mitral_gid
mgrs.ampanmda.ggid = mgrs.granule_gid
mgrs.ampanmda.srcgid = mgrs.md_gid
mgrs.ampanmda.x = gp
}
}
}