I have a large network of cells that are gap-junction coupled; 318 cells in total. The cells are simply somas. The coupling between cells is determined by a coupling matrix; if cell and cell[j] are coupled, CouplingMatrix.x[j]=1, else =0.

This coupling matrix is strictly lower triangular.

I now want to use this matrix to set up all the gap junction connections in my network of cells. I use something like:

Code: Select all

```
// All cells coupled
load_file("All_morphology.hoc")
chdir("H:/models/beta/jo/")
load_file("gapjunction.hoc")
objectvar CoupledMatrix, CoupledFile
CoupledMatrix=new Matrix()
CoupledFile=new File()
CoupledFile.ropen("H4-1-1_CouplingMatrix.dat") // first line is NROW NCOL. Remove space from end of file.
CoupledMatrix.scanf(CoupledFile) // CoupledMatrix.x[2][1] = 1 so Cell[2].soma and Cell[1].soma are coupled.
objectvar gap[50244-1] // (318*318)/2-318 = elements in the strictly lower triangular matrix
k=1
for i=0, 159-1 {
for j=0, 318-1 {
gap = new gapjunction(cell[i],cell[j],0.5,0.5,0.0002*CoupledMatrix.x[i][j]) // 200pS
k=k+1
}
}
```

Also, is this the most efficient way of handling such a large and complex (at least its one of the largest ones I have handled) network of coupled cells in NEURON? Any hints that would perhaps speed up simulations would be greatly appreciated.

Here is gapjunction.hoc:

Code: Select all

```
// makes a gap junction between 2 soma compartments
// $o1 - cell[1],
// $o2 - cell[2],
// $3, $4 - position within section1, section2
// $5 - gj conductance
begintemplate gapjunction
public g
public setg, setcells, cell1, cell2
objref con1, con2
proc init() {
objref con1, con2
$o1.soma con1 = new Gap($3)
$o2.soma con2 = new Gap($4)
setpointer con1.vgap, $o2.soma.v($4)
setpointer con2.vgap, $o1.soma.v($3)
con1.g = $5
con2.g = $5
}
proc setg() { // change the gj conductance externally
con1.g = $1
con2.g = $1
}
endtemplate gapjunction
```

Linford