Skip to content

Multicompartment and large network models

Jason Sherfey edited this page Dec 15, 2017 · 30 revisions

Currently, DynaSim is best suited to modeling networks with populations of single-compartment neurons. However, it can be used to model cells and networks with arbitrary complexity. In practice, implementing cell models with a few compartments is straightforward in DynaSim; however, custom scripts (see below) are needed to implement complex morphologies; we would recommend using NEURON for modeling morphologically-detailed neurons.

Compartments can be specified in DynaSim using the populations field or the compartments field; the latter is an alias for the former; it was added for conceptual clarity in the model specification.

Excitatory cell S driving the dendrite (Edend) of a two-comparmtent E-cell:



For more examples that include compartmental dimensions/geometry, see

  • This script walks through the DynaSim implementation of a NEURON model including 2-compartment pyramidal cells and fast spiking interneurons.
  • It also demonstrates using for-loops to construct more complex dendritic morphologies.

Below is one approach to connecting cylindrical compartments into arbors with complex morphologies. As presented, it demonstrates the implementation of bidirectional axial currents between compartments Ed and Es; it can be extended to connect larger sets of compartments by adding elements for each compartment to the variables compartments, lengths, and diameters, as well as adding to the variable connections the corresponding direction ([from to]) for each inter-compartmental connection (e.g., axial current via the iCOM mechanism).

% Given: 
% - DynaSim specification structure 'spec' with two compartments ('Es', 'Ed')
% - Compartment dimensions stored in variables (ls, ds) and (ld, dd) for Es and Ed, respectively.

% Add intercompartmental connections to 'spec'
Ri=1.5; % axial resistance [MOhm-um], Ri=150 Ohm-cm
% collect relevant info
compartments={'Es' 'Ed'};  % list of names for compartments (or populations) in the specification structure
lengths     =[ls   ld];    % cylinder lengths for the elements of "compartments"
diameters   =[ds   dd];    % cylinder diameters for the elements of "compartments"
connections={[1 2],[2 1]}; % directed connections with indices into the variable "compartments". e.g.) [1 2] means to connect the first element of "compartments" to the second element of "compartments".
% add connections to specification
for c=1:length(connections)
  spec.connections(c).direction=[compartments{src} '->' compartments{dst}];

% alternative calculation for asymmetric and heterogeneous coupling strength (gCOM):
% g12=@(r1,L1,r2,L2)(r1*r2^2)/(Ri*L1*(L1*r2^2+L2*r1^2));
% gCOM=g12*(surface area)=g12*(2*pi*r1*L1)
% d->s: g12(ds/2,ls,dd/2,ld)*(pi*ls*ds)
% s->d: g12(dd/2,ld,ds/2,ls)*(pi*ld*dd)
% Units: [Ri]=MOhm*um, [r]=[L]=um, then [g12]=uS/um2 and [gCOM]=uS. Ra=1/gCOM
% Reference:

A similar for-loop approach can be used to connect large sets of populations into large networks; however, different connection mechanisms (e.g., iAMPA, iNMDA, iGABAa) should be used in that case, and connectivity matrices (e.g., netcon) will need to be specified, in addition to maximal conductance (e.g., gAMPA, gNMDA, gGABAa).