NEST main@caf0ae8
 
Loading...
Searching...
No Matches
aeif_cond_alpha_multisynapse.h
Go to the documentation of this file.
1/*
2 * aeif_cond_alpha_multisynapse.h
3 *
4 * This file is part of NEST.
5 *
6 * Copyright (C) 2004 The NEST Initiative
7 *
8 * NEST is free software: you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation, either version 2 of the License, or
11 * (at your option) any later version.
12 *
13 * NEST is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * You should have received a copy of the GNU General Public License
19 * along with NEST. If not, see <http://www.gnu.org/licenses/>.
20 *
21 */
22
23#ifndef AEIF_COND_ALPHA_MULTISYNAPSE_H
24#define AEIF_COND_ALPHA_MULTISYNAPSE_H
25
26// Generated includes:
27#include "config.h"
28#include <sstream>
29
30#ifdef HAVE_GSL
31
32// External includes:
33#include <gsl/gsl_errno.h>
34#include <gsl/gsl_matrix.h>
35#include <gsl/gsl_odeiv.h>
36
37// Includes from nestkernel:
38#include "archiving_node.h"
39#include "connection.h"
40#include "event.h"
41#include "nest_types.h"
42#include "ring_buffer.h"
44
45/* BeginUserDocs: neuron, integrate-and-fire, adaptation, conductance-based, soft threshold
46
47Short description
48+++++++++++++++++
49
50Conductance based adaptive exponential integrate-and-fire neuron model
51
52Description
53+++++++++++
54
55``aeif_cond_alpha_multisynapse`` is a conductance-based adaptive
56exponential integrate-and-fire neuron model according to Brette and
57Gerstner (2005) with multiple synaptic rise time and decay time
58constants, and synaptic conductance modeled by an alpha function.
59
60It allows an arbitrary number of synaptic time constants. Synaptic
61conductance is modeled by an alpha function, as described by A. Roth
62and M. C. W. van Rossum in Computational Modeling Methods for
63Neuroscientists, MIT Press 2013, Chapter 6.
64
65The time constants are supplied by an array, ``tau_syn``, and the pertaining
66synaptic reversal potentials are supplied by the array ``E_rev``. Port numbers
67are automatically assigned in the range from 1 to n_receptors.
68During connection, the ports are selected with the property ``receptor_type``.
69
70When connecting to conductance-based multisynapse models, all synaptic weights
71must be non-negative.
72
73The membrane potential is given by the following differential equation:
74
75.. math::
76
77 C dV/dt = -g_L(V-E_L) + g_L \cdot \Delta_T \cdot \exp((V-V_T)/\Delta_T)
78 + I_{syn_{tot}}(V, t)- w + I_e
79
80where
81
82.. math::
83
84 I_{syn_{tot}}(V,t) = \sum_i g_i(t) (V - E_{rev,i}) ,
85
86the synapse `i` is excitatory or inhibitory depending on the value of
87:math:`E_{rev,i}` and the differential equation for the
88spike-adaptation current `w` is
89
90.. math::
91
92 \tau_w \cdot dw/dt = a(V - E_L) - w
93
94When the neuron fires a spike, the adaptation current :math:`w <- w + b`.
95
96For implementation details see the
97`aeif_models_implementation <../model_details/aeif_models_implementation.ipynb>`_ notebook.
98
99.. note::
100
101 The default refractory period for ``aeif`` models is zero, consistent with the model definition in
102 Brette & Gerstner :footcite:p:`Brette2005`. Thus, an ``aeif`` neuron with default parameters can fire multiple
103 spikes in a single time step, which can lead to exploding spike numbers and extreme slow-down of simulations.
104
105 To avoid such unphysiological behavior, you should set a refractory time ``t_ref > 0``.
106
107Parameters
108++++++++++
109
110The following parameters can be set in the status Dictionary.
111
112======== ======= =======================================
113**Dynamic state variables:**
114--------------------------------------------------------
115 V_m mV Membrane potential
116 w pA Spike-adaptation current
117======== ======= =======================================
118
119======== ======= =======================================
120**Membrane Parameters**
121--------------------------------------------------------
122 C_m pF Capacity of the membrane
123 t_ref ms Duration of refractory period
124 V_reset mV Reset value for V_m after a spike
125 E_L mV Leak reversal potential
126 g_L nS Leak conductance
127 I_e pA Constant external input current
128 Delta_T mV Slope factor
129 V_th mV Spike initiation threshold
130 V_peak mV Spike detection threshold
131======== ======= =======================================
132
133======== ======= ==================================
134**Spike adaptation parameters**
135---------------------------------------------------
136 a ns Subthreshold adaptation
137 b pA Spike-triggered adaptation
138 tau_w ms Adaptation time constant
139======== ======= ==================================
140
141======== ============= ========================================================
142**Synaptic parameters**
143-------------------------------------------------------------------------------
144E_rev list of mV Reversal potential
145tau_syn list of ms Time constant of synaptic conductance
146======== ============= ========================================================
147
148============= ======= =========================================================
149**Integration parameters**
150-------------------------------------------------------------------------------
151gsl_error_tol real This parameter controls the admissible error of the
152 GSL integrator. Reduce it if NEST complains about
153 numerical instabilities.
154============= ======= =========================================================
155
156Sends
157+++++
158
159SpikeEvent
160
161Receives
162++++++++
163
164SpikeEvent, CurrentEvent, DataLoggingRequest
165
166References
167++++++++++
168
169.. footbibliography::
170
171See also
172++++++++
173
174aeif_cond_alpha_multisynapse
175
176Examples using this model
177+++++++++++++++++++++++++
178
179.. listexamples:: aeif_cond_alpha_multisynapse
180
181EndUserDocs */
182
183namespace nest
184{
195extern "C" int aeif_cond_alpha_multisynapse_dynamics( double, const double*, double*, void* );
196
197void register_aeif_cond_alpha_multisynapse( const std::string& name );
198
199class aeif_cond_alpha_multisynapse : public ArchivingNode
200{
201
202public:
203 aeif_cond_alpha_multisynapse();
204 aeif_cond_alpha_multisynapse( const aeif_cond_alpha_multisynapse& );
205 ~aeif_cond_alpha_multisynapse() override;
206
207 friend int aeif_cond_alpha_multisynapse_dynamics( double, const double*, double*, void* );
208
214 using Node::handle;
215 using Node::handles_test_event;
216
217 size_t send_test_event( Node&, size_t, synindex, bool ) override;
218
219 void handle( SpikeEvent& ) override;
220 void handle( CurrentEvent& ) override;
221 void handle( DataLoggingRequest& ) override;
222
223 size_t handles_test_event( SpikeEvent&, size_t ) override;
224 size_t handles_test_event( CurrentEvent&, size_t ) override;
225 size_t handles_test_event( DataLoggingRequest&, size_t ) override;
226
227 void get_status( Dictionary& ) const override;
228 void set_status( const Dictionary& ) override;
229
230private:
231 void init_buffers_() override;
232 void pre_run_hook() override;
233 void update( Time const&, const long, const long ) override;
234
235 // The next three classes need to be friends to access the State_ class/member
236 friend class DynamicRecordablesMap< aeif_cond_alpha_multisynapse >;
237 friend class DynamicUniversalDataLogger< aeif_cond_alpha_multisynapse >;
238 friend class DataAccessFunctor< aeif_cond_alpha_multisynapse >;
239
240 // ----------------------------------------------------------------
241
245 struct Parameters_
246 {
247 double V_peak_;
248 double V_reset_;
249 double t_ref_;
250
251 double g_L;
252 double C_m;
253 double E_L;
254 double Delta_T;
255 double tau_w;
256 double a;
257 double b;
258 double V_th;
259
260 std::vector< double > tau_syn;
261 std::vector< double > E_rev;
262
263 double I_e;
264
265 double gsl_error_tol;
266
267 // boolean flag which indicates whether the neuron has connections
268 bool has_connections_;
269
270 Parameters_();
271
272 void get( Dictionary& ) const;
273 void set( const Dictionary&, Node* node );
274
276 inline size_t
277 n_receptors() const
278 {
279 return E_rev.size();
280 }
281 };
282
283 // ----------------------------------------------------------------
284
289 struct State_
290 {
299 enum StateVecElems
300 {
301 V_M = 0,
302 W, // 1
303 DG, // 2
304 G, // 3
305 STATE_VECTOR_MIN_SIZE
306 };
307
308 static const size_t NUMBER_OF_FIXED_STATES_ELEMENTS = 2; // V_M, W
309 static const size_t NUM_STATE_ELEMENTS_PER_RECEPTOR = 2; // DG, G
310
311 std::vector< double > y_;
312 int r_;
313
314 State_( const Parameters_& );
315
316 void get( Dictionary& ) const;
317 void set( const Dictionary&, Node* node );
318
319 }; // State_
320
321 // ----------------------------------------------------------------
322
326 struct Buffers_
327 {
328 Buffers_( aeif_cond_alpha_multisynapse& );
329 Buffers_( const Buffers_&, aeif_cond_alpha_multisynapse& );
330
332 DynamicUniversalDataLogger< aeif_cond_alpha_multisynapse > logger_;
333
335 std::vector< RingBuffer > spikes_;
336 RingBuffer currents_;
337
339 gsl_odeiv_step* s_;
340 gsl_odeiv_control* c_;
341 gsl_odeiv_evolve* e_;
342 gsl_odeiv_system sys_;
343
344 // Since IntegrationStep_ is initialized with step_, and the resolution
345 // cannot change after nodes have been created, it is safe to place both
346 // here.
347 double step_;
348 double IntegrationStep_;
350
358 double I_stim_;
359 };
360
361 // ----------------------------------------------------------------
362
366 struct Variables_
367 {
369 std::vector< double > g0_;
370
375 double V_peak;
376
377 unsigned int refractory_counts_;
378 };
379
380 // Data members -----------------------------------------------------------
381
388 Parameters_ P_;
389 State_ S_;
390 Variables_ V_;
391 Buffers_ B_;
394 // Access functions for UniversalDataLogger -------------------------------
395
397 DynamicRecordablesMap< aeif_cond_alpha_multisynapse > recordablesMap_;
398
399 // Data Access Functor getter
400 DataAccessFunctor< aeif_cond_alpha_multisynapse > get_data_access_functor( size_t elem );
401 inline double
402 get_state_element( size_t elem )
403 {
404 return S_.y_[ elem ];
405 };
406
407 // Utility function that inserts the synaptic conductances to the
408 // recordables map
409
410 std::string get_g_receptor_name( size_t receptor );
411 void insert_conductance_recordables( size_t first = 0 );
412};
413
414inline size_t
415aeif_cond_alpha_multisynapse::send_test_event( Node& target, size_t receptor_type, synindex, bool )
416{
417 SpikeEvent e;
418 e.set_sender( *this );
419
420 return target.handles_test_event( e, receptor_type );
421}
422
423inline size_t
424aeif_cond_alpha_multisynapse::handles_test_event( CurrentEvent&, size_t receptor_type )
425{
426 if ( receptor_type != 0 )
427 {
428 throw UnknownReceptorType( receptor_type, get_name() );
429 }
430 return 0;
431}
432
433inline size_t
434aeif_cond_alpha_multisynapse::handles_test_event( DataLoggingRequest& dlr, size_t receptor_type )
435{
436 if ( receptor_type != 0 )
437 {
438 throw UnknownReceptorType( receptor_type, get_name() );
439 }
440 return B_.logger_.connect_logging_device( dlr, recordablesMap_ );
441}
442
443inline void
444aeif_cond_alpha_multisynapse::get_status( Dictionary& d ) const
445{
446 P_.get( d );
447 S_.get( d );
449
450 d[ names::recordables ] = recordablesMap_.get_list();
451}
452
453} // namespace
454
455#endif // HAVE_GSL
456#endif // AEIF_COND_ALPHA_MULTISYNAPSE_H //
Dictionary class for interface to Python and C++ API.
Definition dictionary.h:213
void get_status(Dictionary &d) const override
Export properties of the node by setting entries in the status dictionary.
Definition archiving_node.cpp:220
const std::string E_L("E_L")
const std::string I_e("I_e")
const std::string recordables("recordables")
const std::string C_m("C_m")
const std::string d("d")
const std::string gsl_error_tol("gsl_error_tol")
const std::string V_th("V_th")
const std::string tau_syn("tau_syn")
const std::string a("a")
const std::string V_peak("V_peak")
const std::string n_receptors("n_receptors")
const std::string target("target")
const std::string b("b")
const std::string tau_w("tau_w")
const std::string Delta_T("Delta_T")
const std::string E_rev("E_rev")
const std::string g_L("g_L")
Namespace for the NEST simulation kernel.
Definition beta_normalization_factor.h:33
size_t synindex
For enumerations of synapse types.
Definition nest_types.h:115
const double e
Definition numerics.cpp:32