insilico: neuronal network simulation c++ library
TRANSCRIPT
insilicoNeuronal Network Simulation C++ Library
Pranav KulkarniProgrammer, Dr Collins Assisi Lab,IISER Pune
Agenda
● Introduction● Library Design● File Structure● Usage
○ Boost.odeint and example○ Example in Computational Neuroscience○ Memory management○ Data access mechanism
● Example code● Links
2
Introduction
About● insilico is a C++ library for writing Neuronal Network
Simulations in Computational Neuroscience● Developed using C++11, a modern language standard for C++● An easy-to-use application programming interface (API)
Dependencies● Boost.odeint● GCC 4.7+
3
Boost.odeint
7
About● Boost is collection of free portable C++ source libraries● Boost.odeint is a modern C++ library for numerically
solving Ordinary Differential Equations● Developed by Dr Karsten Ahnert and Dr Mario
Mulansky● Homepage: http://headmyshoulder.github.io/odeint-v2/● Part of Boost C++ Library since September 2012
Boost.odeint Example: Lorenz system
// Function that contains dx/dt corresponding to each x
void lorenz( const state_type &x , state_type &dxdt , double t ) {
dxdt[0] = sigma * ( x[1] - x[0] );
dxdt[1] = R * x[0] - x[1] - x[0] * x[2];
dxdt[2] = -b * x[2] + x[0] * x[1];
}
// Main function
int main(int argc, char **argv)
{
state_type x = { 10.0 , 1.0 , 1.0 }; // initial conditions
integrate( lorenz , x , 0.0 , 25.0 , 0.1 , write_lorenz );
} 8
Modeling
Neuron Input File insilico’s Memory Mapping
dxdt:4,
v:-65,
m:0.1,
h:0.9,
n:1,
iext:-5,
del:0.02,
sd:0.5;10
HH Neuron in insilico
1 class HH_Neuron : public Neuron {
2 private:
3 I_Na i_na_component;
4 I_K i_k_component;
5 I_Leak i_leak_component;
6 public:
7 void ode_set(state_type& variables, state_type& dxdt, const double t, const unsigned id) {
8 i_na_component.current(variables, dxdt, t, id);
9 i_k_component.current(variables, dxdt, t, id);
10 i_leak_component.current(variables, dxdt, t, id);
11 double I_Na = engine::neuron_value(id, "I_Na");
12 double I_K = engine::neuron_value(id, "I_K");
13 double I_Leak = engine::neuron_value(id, "I_Leak");
14 double I_Ext = engine::neuron_value(id, "I_Ext");
15
16 int v_index = engine::neuron_index(id, "v");
17 dxdt[v_index] = - I_Na - I_K - I_Leak + I_Ext;
18 }
19 }; 11
I_Na current in insilico
12
1 class I_Na {
2 private:
3 double gna = 120, ena = 115;
4 public:
5 void current(state_type& variables, state_type& dxdt,
const double t, const unsigned id) {
6 int v_index = engine::neuron_index(id, "v");
7 int m_index = engine::neuron_index(id, "m");
8 int h_index = engine::neuron_index(id, "h");
9 double v = variables[v_index];
10 double m = variables[m_index];
11 double h = variables[h_index];
.. // ...snipped...
16 dxdt[m_index] = (alpha_m * (1-m) - beta_m * m);
17 dxdt[h_index] = (alpha_h * (1-h) - beta_h * h);
18
19 engine::neuron_value(id, "I_Na", (gna * pow(m, 3) * h * (v - ena)));
20 }
21 };
Links
● insilico’s Homepagehttp://www.iiserpune.ac.in/~collins/insilico/
● insilico’s Mailing List a.k.a. Developer Channelhttps://groups.google.com/forum/#!forum/insilico
13