obfunc distSynsCluster2() { local totalSyns localobj temprList1, rList1, synList, tempSynList, lengthList1, cumLList1, sref, centerList, t1List, lengthList, cumLList, tobj, toAdd, randomNum, randomNum2, r2, randomVec, distList // INPUTS // numClust = \$1 //number of clusters // section list for synapses to be distributed over= \$2 // gmax = \$3, this is the max conductance of the nmda current // ntar = \$4, this defines the conductance of the ampa current // with ampa current = gmax/ntar // synsPerClust =\$5 //number of synapses per cluster // lClust = \$6 //length of cluster centerList = new List() synList = new List() print "We now have ", synList.count(), " synapses total" seed = 8 lengthList = new Vector(0) // a vector of branch lengths in order numClust = \$1 //numClust synsPerClust =\$5 //number of synapses per cluster lClust = \$6 //length of cluster totalL = 0 forsec \$o2 { totalL += L lengthList.append(L) } cumLList = new Vector(lengthList.size()) // a vector of the cummulative // branch length, in order rList1 = new Vector(numClust) for i=0,lengthList.size()-1{ cumLList.x[i]=lengthList.sum(0,i) } seed = 3878 randomNum = new Random(seed) rN = randomNum.uniform(0,totalL) //randomNum.ACG(seed+88) print numClust for r=1,numClust{ print "" print "" print "=======Cluster", r, "=======" // FIND CENTER OF CLUSTER randomNum.ACG(r+seed+83288) rN = randomNum.uniform(0,totalL) print "random number chosen is ", rN rList1.x[r-1] = rN temprList1 = new Vector() temprList1.copy(rList1) temprList1.sub(rN).abs() print "Chosen numbers so far ", rList1.printf() while(temprList1.indwhere("<",75)!=(r-1)){ print "Random number chosen is too close to another cluster, try again" rN = randomNum.uniform(0,totalL) print "New random number is ", rN rList1.x[r-1] = rN temprList1 = new Vector() temprList1.copy(rList1) temprList1.sub(rN).abs() } //find first index which has length greater than chosen random number centerSecInd = cumLList.indwhere(">",rN) dummy = 0 forsec \$o2{ if(dummy==centerSecInd){ //if we are in the section with the cluster center print "dendrite number ", dummy where = (cumLList.x[centerSecInd]-rN)/L tobj = new AlphaSynapse(where) centerList.append(tobj) distance(0,where) t1List = new SectionList() t1List.append() //t1List.printnames() theLength = L print "the length of this dendrite is ", theLength, " and we need at least", lClust while(theLength