## How to set up large network of gap junction coupled cells

NMODL and the Channel Builder.
lb5999
Posts: 56
Joined: Mon Oct 11, 2010 9:12 am

### How to set up large network of gap junction coupled cells

Dear NEURON Forum,

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

chdir("H:/models/beta/jo/")

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

}
}

``````
There are 318 cells, and so there are (318*159)-318 lower triangular entries, hence the iterations in the for loop. I think I have done this correctly, but I also feel that isn't the most efficient way of doing this. Many gap junctions have been generated, despite the gap junction conductance being 0. How do I make this code more sophisticated (and, I assume, the simulations faster), by only generating a gap junction point process when CoupledMatrix.x[j] is non-zero? Some kind of "if" statement?

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
``````
Kind regards,
Linford
ted