MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IzhIF.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 ** This program is part of 'MOOSE', the
3 ** Messaging Object Oriented Simulation Environment.
4 ** Copyright (C) 2003-2007 Upinder S. Bhalla. and NCBS
5 ** It is made available under the terms of the
6 ** GNU Lesser General Public License version 2.1
7 ** See the file COPYING.LIB for the full notice.
8 **********************************************************************/
9 
10 #include "header.h"
11 #include "ElementValueFinfo.h"
12 #include "../biophysics/CompartmentBase.h"
13 #include "../biophysics/Compartment.h"
14 #include "IntFireBase.h"
15 #include "IzhIF.h"
16 
17 using namespace moose;
18 
20 {
21  static string doc[] =
22  {
23  "Name", "IzhIF",
24  "Author", "Aditya Gilra",
25  "Description", "Izhikevich neuron (integrate and fire)."
26  "d Vm /dt = a0 * Vm^2 + b0 * Vm + c0 - u + I/Cm "
27  "d u / dt = a * ( b * Vm - u ) "
28  "at each spike, u -> u + d "
29  "by default, a0 = 0.04e6/V/s, b0 = 5e3/s, c0 = 140 V/s are set to SI units, "
30  "so use SI consistently, or change a0, b0, c0 also if you wish to use other units. "
31  "Rm, Em from Compartment are not used here, vReset is same as c in the usual formalism. "
32  "At rest, u0 = b V0, and V0 = ( -(-b0-b) +/- sqrt((b0-b)^2 - 4*a0*c0)) / (2*a0) "
33  "equivalently, to obtain resting Em, set b = (a0*Em^2 + b0*Em + c0)/Em"
34  };
35 
37  "a0",
38  "factor for Vm^2 term in evolution equation for Vm: "
39  "d Vm /dt = a0 * Vm^2 + b0 * Vm + c0 - u + I/Cm ",
40  &IzhIF::setA0,
42  );
43 
45  "b0",
46  "factor for Vm term in evolution equation for Vm: "
47  "d Vm /dt = a0 * Vm^2 + b0 * Vm + c0 - u + I/Cm ",
48  &IzhIF::setB0,
50  );
51 
53  "c0",
54  "constant term in evolution equation for Vm: "
55  "d Vm /dt = a0 * Vm^2 + b0 * Vm + c0 - u + I/Cm ",
56  &IzhIF::setC0,
58  );
59 
61  "a",
62  "a as in d u / dt = a * ( b * Vm - u ) ",
63  &IzhIF::setA,
65  );
66 
68  "b",
69  "b as in d u / dt = a * ( b * Vm - u ) ",
70  &IzhIF::setB,
72  );
73 
75  "d",
76  "u jumps by d at every spike",
77  &IzhIF::setD,
79  );
80 
82  "u",
83  "u is an adaptation variable",
84  &IzhIF::setU,
86  );
87 
89  "vPeak",
90  "Vm is reset when Vm > vPeak",
93  );
94 
96  "uInit",
97  "Initial value of u. It is reset at reinit()",
100  );
101 
102  static Finfo* IzhIFFinfos[] = {
103  &a0, // Value
104  &b0, // Value
105  &c0, // Value
106  &a, // Value
107  &b, // Value
108  &d, // Value
109  &u, // Value
110  &uInit, // Value
111  &vPeak, // Value
112  };
113 
114  static Dinfo< IzhIF > dinfo;
115  static Cinfo IzhIFCinfo(
116  "IzhIF",
118  IzhIFFinfos,
119  sizeof( IzhIFFinfos ) / sizeof (Finfo*),
120  &dinfo,
121  doc,
122  sizeof(doc)/sizeof(string)
123  );
124 
125  return &IzhIFCinfo;
126 }
127 
129 
131 // Here we put the Compartment class functions.
133 
135 {
136 // by default, a0 = 0.04e6/V/s, b0 = 5e3/s, c0 = 140 V/s are set to SI units,
137 // so use SI consistently,
138 // or change a0, b0, c0 via python if you wish to use other units.
139 a0_ = 0.04e6; // V^-1 s^-1
140 b0_ = 5e3; // s^-1
141 c0_ = 140; // V/s
142 a_ = 0.0;
143 b_ = 0.0;
144 d_ = 0.0;
145 uInit_ = 0.0;
146 u_ = 0.0;
147 vPeak_ = 0.0;
148 }
149 
151 {;}
152 
154 // IzhIF::Dest function definitions.
156 
157 void IzhIF::vProcess( const Eref& e, ProcPtr p )
158 {
159  // fully taking over Compartment's vProcess due to quadratic term in Vm
160  // we no longer care about A and B
161  fired_ = false;
162  if ( p->currTime < lastEvent_ + refractT_ ) {
163  Vm_ = vReset_;
164  sumInject_ = 0.0;
165  VmOut()->send( e, Vm_ );
166  } else {
167  // activation can be a continous variable (graded synapse).
168  // So integrate it at every time step, thus *dt.
169  // For a delta-fn synapse, SynHandler-s divide by dt and send activation.
170  // See: http://www.genesis-sim.org/GENESIS/Hyperdoc/Manual-26.html#synchan
171  // for this continuous definition of activation.
172  Vm_ += activation_ * p->dt;
173  activation_ = 0.0;
174  if ( Vm_ > vPeak_ ) {
175  Vm_ = vReset_;
176  u_ += d_;
177  lastEvent_ = p->currTime;
178  fired_ = true;
179  spikeOut()->send( e, p->currTime );
180  VmOut()->send( e, Vm_ );
181  } else {
182  Vm_ += ( (inject_+sumInject_) / Cm_
183  + a0_*pow(Vm_,2.0) + b0_*Vm_ + c0_ - u_ ) * p->dt;
184  u_ += a_ * (b_*Vm_ - u_) * p->dt;
185  lastIm_ = Im_;
186  Im_ = 0.0;
187  sumInject_ = 0.0;
188  // Send out Vm to channels, SpikeGens, etc.
189  VmOut()->send( e, Vm_ );
190  }
191  }
192 }
193 
194 void IzhIF::vReinit( const Eref& e, ProcPtr p )
195 {
196  activation_ = 0.0;
197  u_ = uInit_;
198  fired_ = false;
199  lastEvent_ = -refractT_; // Allow it to fire right away.
200  Compartment::vReinit( e, p );
201 }
202 
203 void IzhIF::setA0( const Eref& e, double val )
204 {
205  a0_ = val;
206 }
207 
208 double IzhIF::getA0( const Eref& e ) const
209 {
210  return a0_;
211 }
212 
213 void IzhIF::setB0( const Eref& e, double val )
214 {
215  b0_ = val;
216 }
217 
218 double IzhIF::getB0( const Eref& e ) const
219 {
220  return b0_;
221 }
222 
223 void IzhIF::setC0( const Eref& e, double val )
224 {
225  c0_ = val;
226 }
227 
228 double IzhIF::getC0( const Eref& e ) const
229 {
230  return c0_;
231 }
232 
233 void IzhIF::setA( const Eref& e, double val )
234 {
235  a_ = val;
236 }
237 
238 double IzhIF::getA( const Eref& e ) const
239 {
240  return a_;
241 }
242 
243 void IzhIF::setB( const Eref& e, double val )
244 {
245  b_ = val;
246 }
247 
248 double IzhIF::getB( const Eref& e ) const
249 {
250  return b_;
251 }
252 
253 void IzhIF::setD( const Eref& e, double val )
254 {
255  d_ = val;
256 }
257 
258 double IzhIF::getD( const Eref& e ) const
259 {
260  return d_;
261 }
262 
263 void IzhIF::setVPeak( const Eref& e, double val )
264 {
265  vPeak_ = val;
266 }
267 
268 double IzhIF::getVPeak( const Eref& e ) const
269 {
270  return vPeak_;
271 }
272 
273 void IzhIF::setU( const Eref& e, double val )
274 {
275  u_ = val;
276 }
277 
278 double IzhIF::getU( const Eref& e ) const
279 {
280  return u_;
281 }
282 
283 void IzhIF::setUInit( const Eref& e, double val )
284 {
285  uInit_ = val;
286 }
287 
288 double IzhIF::getUInit( const Eref& e ) const
289 {
290  return uInit_;
291 }
void setB0(const Eref &e, double val)
Definition: IzhIF.cpp:213
void setA0(const Eref &e, double val)
Definition: IzhIF.cpp:203
double b0_
Definition: IzhIF.h:62
void setUInit(const Eref &e, double val)
Definition: IzhIF.cpp:283
double getD(const Eref &e) const
Definition: IzhIF.cpp:258
void vReinit(const Eref &e, ProcPtr p)
double currTime
Definition: ProcInfo.h:19
double u_
Definition: IzhIF.h:68
Definition: Dinfo.h:60
double a_
Definition: IzhIF.h:64
double a0_
Definition: IzhIF.h:61
void vReinit(const Eref &e, ProcPtr p)
Definition: IzhIF.cpp:194
void setD(const Eref &e, double val)
Definition: IzhIF.cpp:253
double getC0(const Eref &e) const
Definition: IzhIF.cpp:228
double d_
Definition: IzhIF.h:66
double getA(const Eref &e) const
Definition: IzhIF.cpp:238
double getA0(const Eref &e) const
Definition: IzhIF.cpp:208
void setU(const Eref &e, double val)
Definition: IzhIF.cpp:273
double getB0(const Eref &e) const
Definition: IzhIF.cpp:218
void setC0(const Eref &e, double val)
Definition: IzhIF.cpp:223
void vProcess(const Eref &e, ProcPtr p)
Definition: IzhIF.cpp:157
double dt
Definition: ProcInfo.h:18
static SrcFinfo1< double > * spikeOut()
Message src for outgoing spikes.
Definition: IntFireBase.cpp:17
double getVPeak(const Eref &e) const
Definition: IzhIF.cpp:268
static const Cinfo * initCinfo()
Definition: IntFireBase.cpp:27
Definition: Eref.h:26
static const Cinfo * initCinfo()
Definition: IzhIF.cpp:19
double getU(const Eref &e) const
Definition: IzhIF.cpp:278
virtual ~IzhIF()
Definition: IzhIF.cpp:150
void setA(const Eref &e, double val)
Definition: IzhIF.cpp:233
double vPeak_
Definition: IzhIF.h:67
double b_
Definition: IzhIF.h:65
static const Cinfo * IzhIFCinfo
Definition: IzhIF.cpp:128
double getUInit(const Eref &e) const
Definition: IzhIF.cpp:288
double uInit_
Definition: IzhIF.h:69
double getB(const Eref &e) const
Definition: IzhIF.cpp:248
static SrcFinfo1< double > * VmOut()
void setB(const Eref &e, double val)
Definition: IzhIF.cpp:243
double c0_
Definition: IzhIF.h:63
Definition: Cinfo.h:18
Definition: Finfo.h:12
void setVPeak(const Eref &e, double val)
Definition: IzhIF.cpp:263