Nov 9, 2015
Updated the code with correct license.
|
|
|
2 |
* Copyright (c) 2015 University of Lübeck |
|
3 |
* |
|
4 |
* Permission is hereby granted, free of charge, to any person obtaining a copy |
|
5 |
* of this software and associated documentation files (the "Software"), to deal |
|
6 |
* in the Software without restriction, including without limitation the rights |
|
7 |
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell |
|
8 |
* copies of the Software, and to permit persons to whom the Software is |
|
9 |
* furnished to do so, subject to the following conditions: |
|
10 |
* |
|
11 |
* The above copyright notice and this permission notice shall be included in |
|
12 |
* all copies or substantial portions of the Software. |
|
13 |
* |
|
14 |
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
15 |
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
16 |
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
17 |
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
|
18 |
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
|
19 |
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
|
20 |
* THE SOFTWARE. |
|
21 |
* |
|
22 |
* AUTHORS: Michael Schellenberger Costa: mschellenbergercosta@gmail.com |
|
23 |
* |
Sep 13, 2016
Major cleanup and moderinization
|
|
|
78 |
/* Potassium pump */ |
|
79 |
double Na_pump (int) const; |
|
80 |
|
|
81 |
/* Noise functions */ |
|
82 |
double noise_xRK (int,int) const; |
|
83 |
double noise_aRK (int) const; |
|
84 |
|
|
85 |
/* Helper functions */ |
|
86 |
inline std::vector<double> init (double value) |
|
87 |
{return {value, 0.0, 0.0, 0.0, 0.0};} |
|
88 |
|
|
89 |
inline void add_RK (std::vector<double>& var) |
|
90 |
{var[0] = (-3*var[0] + 2*var[1] + 4*var[2] + 2*var[3] + var[4])/6;} |
|
91 |
|
|
92 |
inline void add_RK_noise (std::vector<double>& var, unsigned noise) |
|
93 |
{var[0] = (-3*var[0] + 2*var[1] + 4*var[2] + 2*var[3] + var[4])/6 + noise_aRK(noise);} |
|
94 |
|
|
95 |
/* Declaration and Initialization of parameters */ |
|
96 |
/* Membrane time in ms */ |
|
97 |
const double tau_p = 30; |
|
98 |
const double tau_i = 30; |
|
99 |
|
|
100 |
/* Maximum firing rate in ms^-1 */ |
|
101 |
const double Qp_max = 30.E-3; |
|
102 |
const double Qi_max = 60.E-3; |
|
103 |
|
|
104 |
/* Sigmoid threshold in mV */ |
|
105 |
const double theta_p = -58.5; |
|
106 |
const double theta_i = -58.5; |
|
107 |
|
|
108 |
/* Sigmoid gain in mV */ |
|
109 |
const double sigma_p = 4; |
|
110 |
const double sigma_i = 6; |
|
111 |
|
|
112 |
/* Scaling parameter for sigmoidal mapping (dimensionless) */ |
|
113 |
const double C1 = (M_PI/sqrt(3)); |
|
114 |
|
|
115 |
/* parameters of the firing adaption */ |
|
116 |
const double alpha_Na = 2; /* Sodium influx per spike in mM ms */ |
|
117 |
const double tau_Na = 1.7; /* Sodium time constant in ms */ |
|
118 |
|
|
119 |
const double R_pump = 0.09; /* Na-K pump constant in mM/ms */ |
|
120 |
const double Na_eq = 9.5; /* Na-eq concentration in mM */ |
|
121 |
|
|
122 |
/* PSP rise time in ms^-1 */ |
|
123 |
const double gamma_e = 70E-3; |
|
124 |
const double gamma_g = 58.6E-3; |
|
125 |
|
|
126 |
/* Axonal flux time constant */ |
|
127 |
const double nu = 120E-3; |
|
128 |
|
|
129 |
/* Leak weight in aU*/ |
|
130 |
const double g_L = 1.; |
|
131 |
|
|
132 |
/* Synaptic weight in ms */ |
|
133 |
const double g_AMPA = 1.; |
|
134 |
const double g_GABA = 1.; |
|
135 |
|
|
136 |
/* Conductivity */ |
|
137 |
/* KNa in mS/cm^2 */ |
|
138 |
const double g_KNa = 1.33; |
|
139 |
|
|
140 |
/* Reversal potentials in mV */ |
|
141 |
/* Synaptic */ |
|
142 |
const double E_AMPA = 0; |
|
143 |
const double E_GABA = -70; |
|
144 |
|
|
145 |
/* Leak */ |
|
146 |
const double E_L_p = -64; |
|
147 |
const double E_L_i = -64; |
|
148 |
|
|
149 |
/* Potassium */ |
|
150 |
const double E_K = -100; |
|
151 |
|
|
152 |
/* Noise parameters in ms^-1 */ |
|
153 |
const double mphi = 0E-3; |
|
154 |
const double dphi = 20E-1; |
|
155 |
double input = 0.0; |
|
156 |
|
|
157 |
/* Connectivities (dimensionless) */ |
|
158 |
const double N_pp = 115; |
|
159 |
const double N_ip = 72; |
|
160 |
const double N_pi = 90; |
|
161 |
const double N_ii = 90; |
|
162 |
const double N_pt = 2.5; |
|
163 |
const double N_it = 2.5; |
|
164 |
|
|
165 |
/* Pointer to thalamic column */ |
|
166 |
Thalamic_Column* Thalamus; |
|
167 |
|
|
168 |
/* Parameters for SRK4 iteration */ |
|
169 |
const std::vector<double> A = {0.5, 0.5, 1.0, 1.0}; |
|
170 |
const std::vector<double> B = {0.75, 0.75, 0.0, 0.0}; |
|
171 |
|
|
172 |
/* Random number generators */ |
Sep 13, 2016
Major cleanup and moderinization
|
|
|
174 |
|
|
175 |
/* Container for noise */ |
|
176 |
std::vector<double> Rand_vars; |
|
177 |
|
|
178 |
/* Population variables */ |
|
179 |
std::vector<double> Vp = init(E_L_p), /* excitatory membrane voltage */ |
|
180 |
Vi = init(E_L_i), /* inhibitory membrane voltage */ |
|
181 |
Na = init(Na_eq), /* Na concentration */ |
|
182 |
s_ep= init(0.0), /* PostSP from excitatory to excitatory population */ |
|
183 |
s_ei= init(0.0), /* PostSP from excitatory to inhibitory population */ |
|
184 |
s_gp= init(0.0), /* PostSP from inhibitory to excitatory population */ |
|
185 |
s_gi= init(0.0), /* PostSP from inhibitory to inhibitory population */ |
|
186 |
y = init(0.0), /* axonal flux */ |
|
187 |
x_ep= init(0.0), /* derivative of s_ep */ |
|
188 |
x_ei= init(0.0), /* derivative of s_ei */ |
|
189 |
x_gp= init(0.0), /* derivative of s_gp */ |
|
190 |
x_gi= init(0.0), /* derivative of s_gi */ |
|
191 |
x = init(0.0); /* derivative of y */ |
|
192 |
|
|
193 |
/* Data storage access */ |