MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
IzhikevichNrn.cpp
Go to the documentation of this file.
1 // IzhikevichNrn.cpp ---
2 //
3 // Filename: IzhikevichNrn.cpp
4 // Description:
5 // Author: Subhasis Ray
6 // Maintainer:
7 // Created: Fri Jul 8 10:00:33 2011 (+0530)
8 // Version:
9 // Last-Updated: Mon Nov 5 16:58:20 2012 (+0530)
10 // By: subha
11 // Update #: 110
12 // URL:
13 // Keywords:
14 // Compatibility:
15 //
16 //
17 
18 // Commentary:
19 //
20 //
21 //
22 //
23 
24 // Change log:
25 //
26 //
27 //
28 
29 // Code:
30 
31 #include "header.h"
32 #include "IzhikevichNrn.h"
33 
34 
36 {
37  static SrcFinfo1< double > spike("spikeOut",
38  "Sends out spike events");
39  return &spike;
40 }
41 
43 {
44  static SrcFinfo1< double > VmOut("VmOut",
45  "Sends out Vm");
46  return &VmOut;
47 }
48 
50 {
51 
52  static DestFinfo process(
53  "process",
54  "Handles process call",
56  static DestFinfo reinit(
57  "reinit",
58  "Handles reinit call",
60 
61  static Finfo * processShared[] = {
62  &process,
63  &reinit
64  };
65 
66  static SharedFinfo proc(
67  "proc",
68  "Shared message to receive Process message from scheduler",
69  processShared, sizeof( processShared ) / sizeof( Finfo* ) );
70 
72  // Field definitions
74 
76  "Vmax",
77  "Maximum membrane potential. Membrane potential is reset to c whenever"
78  " it reaches Vmax. NOTE: Izhikevich model specifies the PEAK voltage,"
79  " rather than THRSHOLD voltage. The threshold depends on the previous"
80  " history.",
84  "c",
85  "Reset potential. Membrane potential is reset to c whenever it reaches"
86  " Vmax.",
90  "d",
91  "Parameter d in Izhikevich model. Unit is V/s.",
95  "a",
96  "Parameter a in Izhikevich model. Unit is s^{-1}",
100  "b",
101  "Parameter b in Izhikevich model. Unit is s^{-1}",
105  "Vm",
106  "Membrane potential, equivalent to v in Izhikevich equation.",
110  "u",
111  "Parameter u in Izhikevich equation. Unit is V/s",
114  "Im",
115  "Total current going through the membrane. Unit is A.",
117  static ValueFinfo<IzhikevichNrn, double> initVm(
118  "initVm",
119  "Initial membrane potential. Unit is V.",
122  static ValueFinfo<IzhikevichNrn, double> inject(
123  "inject",
124  "External current injection into the neuron",
128  "initU",
129  "Initial value of u.",
132 
134  "alpha",
135  "Coefficient of v^2 in Izhikevich equation. Defaults to 0.04 in "
136  "physiological unit. In SI it should be 40000.0. Unit is V^-1 s^{-1}",
139 
141  "beta",
142  "Coefficient of v in Izhikevich model. Defaults to 5 in physiological"
143  " unit, 5000.0 for SI units. Unit is s^{-1}",
147  "gamma",
148  "Constant term in Izhikevich model. Defaults to 140 in both"
149  " physiological and SI units. unit is V/s.",
152  static ValueFinfo<IzhikevichNrn, double> RmByTau(
153  "RmByTau",
154  "Hidden coefficient of input current term (I) in Izhikevich model. Defaults to 1e9 Ohm/s.",
157 
158  static ValueFinfo<IzhikevichNrn, bool> accommodating(
159  "accommodating",
160  "True if this neuron is an accommodating one. The equation for recovery"
161  " variable u is special in this case.",
164 
166  "u0",
167  "This is used for accommodating neurons where recovery variables u is"
168  " computed as: u += tau*a*(b*(Vm-u0))",
171 
173  // MsgDest definition
175  static DestFinfo injectMsg(
176  "injectMsg",
177  "Injection current into the neuron.",
179 
180  static DestFinfo cDest(
181  "cDest",
182  "Destination message to modify parameter c at runtime.",
184 
185  static DestFinfo dDest(
186  "dDest",
187  "Destination message to modify parameter d at runtime.",
189 
190  static DestFinfo aDest(
191  "aDest",
192  "Destination message modify parameter a at runtime.",
194 
195  static DestFinfo bDest(
196  "bDest",
197  "Destination message to modify parameter b at runtime",
199 
200 
201  static DestFinfo handleChannel("handleChannel",
202  "Handles conductance and reversal potential arguments from Channel",
204 
205  static Finfo * channelShared[] = {
206  &handleChannel,
207  VmOut()
208  };
209 
210  static SharedFinfo channel("channel",
211  "This is a shared message from a IzhikevichNrn to channels."
212  "The first entry is a MsgDest for the info coming from "
213  "the channel. It expects Gk and Ek from the channel "
214  "as args. The second entry is a MsgSrc sending Vm ",
215  channelShared, sizeof( channelShared ) / sizeof( Finfo* )
216  );
217  static Finfo* IzhikevichNrnFinfos[] = {
218  &proc,
219  &Vmax,
220  &c,
221  &d,
222  &a,
223  &b,
224  &u,
225  &Vm,
226  &Im,
227  &inject,
228  &RmByTau,
229  &accommodating,
230  &u0,
231  &initVm,
232  &initU,
233  &alpha,
234  &beta,
235  &gamma,
236  &injectMsg,
237  &cDest,
238  &dDest,
239  &bDest,
240  &aDest,
241  VmOut(),
242  spikeOut(),
243  &channel,
244  };
245 
246  static string doc[] = {
247  "Name", "IzhikevichNrn",
248  "Author", "Subhasis Ray",
249  "Description", "Izhikevich model of spiking neuron "
250  "(Izhikevich,EM. 2003. Simple model of spiking neurons. Neural"
251  " Networks, IEEE Transactions on 14(6). pp 1569-1572).\n"
252  " This class obeys the equations (in physiological units):\n"
253  " dVm/dt = 0.04 * Vm^2 + 5 * Vm + 140 - u + inject\n"
254  " du/dt = a * (b * Vm - u)\n"
255  " if Vm >= Vmax then Vm = c and u = u + d\n"
256  " Vmax = 30 mV in the paper."
257  };
258  static Dinfo< IzhikevichNrn > dinfo;
259  static Cinfo IzhikevichNrnCinfo(
260  "IzhikevichNrn",
262  IzhikevichNrnFinfos,
263  sizeof( IzhikevichNrnFinfos ) / sizeof( Finfo* ),
264  &dinfo,
265  doc,
266  sizeof(doc)/sizeof(string));
267 
268  return &IzhikevichNrnCinfo;
269 }
270 
272 
274  alpha_(40000.0), // 0.04 physiological unit
275  beta_(5000.0), // 5 physiological unit
276  gamma_(140.0), // 140 physiological unit
277  RmByTau_(1e6), // Assuming Izhikevich was using nA as unit of
278  // current, 1e6 Ohm will be the scaling term for SI
279  a_(20.0),
280  b_(200.0),
281  c_(-0.065), // -65 mV
282  d_(2.0), // assuming u is in mV/ms
283  Vm_(-0.065),
284  u_(-13.0),
285  Vmax_(0.03), // 30 mV
286  initVm_(-0.065),// -65 mV
287  initU_(-13.0),
288  sum_inject_(0.0),
289  Im_(0.0),
290  savedVm_(-0.065),
291  accommodating_(false),
292  u0_(-0.065),
293  inject_(0.0)
294 {
295  ;
296 }
297 
299 {
300  ;
301 }
303 {
304  a_ = value;
305 }
306 
307 double IzhikevichNrn::getA() const
308 {
309  return a_;
310 }
311 
313 {
314  b_ = value;
315 }
316 
317 double IzhikevichNrn::getB() const
318 {
319  return b_;
320 }
322 {
323  c_ = value;
324 }
325 
326 double IzhikevichNrn::getC() const
327 {
328  return c_;
329 }
330 
332 {
333  d_ = value;
334 }
335 
336 double IzhikevichNrn::getD() const
337 {
338  return d_;
339 }
340 
342 {
343  RmByTau_ = value;
344 }
345 
347 {
348  return RmByTau_;
349 }
351 {
352  Vm_ = value;
353 }
354 double IzhikevichNrn::getU() const
355 {
356  return u_;
357 }
358 
359 double IzhikevichNrn::getVm() const
360 {
361  return savedVm_;
362 }
363 
365 {
366  Vmax_ = value;
367 }
368 
370 {
371  return Vmax_;
372 }
373 
375 {
376  alpha_ = value;
377 }
378 
380 {
381  return alpha_;
382 }
383 
385 {
386  beta_ = value;
387 }
388 
390 {
391  return beta_;
392 }
393 
395 {
396  gamma_ = value;
397 }
398 
400 {
401  return gamma_;
402 }
403 
405 {
406  inject_ = value;
407 }
408 
410 {
411  return inject_;
412 }
413 
414 double IzhikevichNrn::getIm() const
415 {
416  return Im_;
417 }
418 
420 {
421  initVm_ = value;
422 }
423 
425 {
426  return initVm_;
427 }
428 
430 {
431  initU_ = value;
432 }
433 
435 {
436  return initU_;
437 }
438 
440 {
442 }
443 
445 {
446  return accommodating_;
447 }
448 
450 {
451  u0_ = value;
452 }
453 
454 double IzhikevichNrn::getU0() const
455 {
456  return u0_;
457 }
458 
459 void IzhikevichNrn::handleChannel(double Gk, double Ek)
460 {
461  sum_inject_ += Gk * (Ek - Vm_);
462 }
463 
464 void IzhikevichNrn::process(const Eref& eref, ProcPtr proc)
465 {
466  Vm_ += proc->dt * ((alpha_ * Vm_ + beta_) * Vm_
467  + gamma_ - u_ + RmByTau_ * sum_inject_);
468  if (accommodating_){
469  u_ += proc->dt * a_ * b_ * (Vm_ - u0_);
470  } else {
471  u_ += proc->dt * a_ * (b_ * Vm_ - u_);
472  }
473  Im_ = sum_inject_;
474  sum_inject_ = inject_;
475  // This check is to ensure that checking Vm field will always
476  // return Vmax when Vm actually crosses Vmax.
477  if (Vm_ >= Vmax_){
478  Vm_ = c_;
479  u_ += d_;
480  savedVm_ = Vmax_;
481  VmOut()->send(eref, Vmax_);
482  spikeOut()->send(eref, proc->currTime);
483  } else {
484  savedVm_ = Vm_;
485  VmOut()->send(eref, Vm_);
486  }
487 }
488 
489 void IzhikevichNrn::reinit(const Eref& eref, ProcPtr proc)
490 {
491  sum_inject_ = 0.0;
492  Vm_ = initVm_;
493  u_ = initU_;
494  Im_ = 0.0;
495  savedVm_ = Vm_;
496  VmOut()->send(eref, Vm_);
497 }
498 
499 //
500 // IzhikevichNrn.cpp ends here
void setBeta(double value)
uint32_t value
Definition: moosemodule.h:42
void handleChannel(double Gk, double Ek)
double currTime
Definition: ProcInfo.h:19
Definition: Dinfo.h:60
void setB(double value)
double getGamma() const
void setVm(double value)
static const Cinfo * initCinfo()
void setAlpha(double value)
double getU0() const
void setU0(double value)
double getVm() const
Definition: OpFunc.h:40
void setAccommodating(bool value)
void setInitU(double value)
double getIm() const
double getC() const
static const Cinfo * IzhikevichNrnCinfo
double sum_inject_
static SrcFinfo1< double > * spikeOut()
void setC(double value)
double getRmByTau() const
double getAlpha() const
void setInitVm(double value)
double dt
Definition: ProcInfo.h:18
double getInitU() const
void reinit(const Eref &eref, ProcPtr proc)
Definition: OpFunc.h:27
Definition: Eref.h:26
void setInject(double value)
void setGamma(double value)
bool getAccommodating() const
double getBeta() const
double getU() const
double getB() const
void setRmByTau(double value)
void setD(double value)
static SrcFinfo1< double > * VmOut()
double getVmax() const
double getInject() const
void setVmax(double value)
double getA() const
static const Cinfo * initCinfo()
Definition: Neutral.cpp:16
void process(const Eref &eref, ProcPtr proc)
Definition: Cinfo.h:18
void setA(double value)
double getD() const
double getInitVm() const
Definition: Finfo.h:12