MOOSE - Multiscale Object Oriented Simulation Environment
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
QIF.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 "QIF.h"
16 
17 using namespace moose;
18 
20 {
21  static string doc[] =
22  {
23  "Name", "QIF",
24  "Author", "Aditya Gilra",
25  "Description", "Leaky Integrate-and-Fire neuron with Quadratic term in Vm."
26  "Based on Spiking Neuron Models book by Gerstner and Kistler."
27  "Rm*Cm * dVm/dt = a0*(Vm-Em)*(Vm-vCritical) + Rm*I"
28  };
29 
30  static ElementValueFinfo< QIF, double > vCritical(
31  "vCritical",
32  "Critical voltage for spike initiation",
35  );
36 
37 
39  "a0",
40  "Parameter in Rm*Cm dVm/dt = a0*(Vm-Em)*(Vm-vCritical) + Rm*I, a0>0",
41  &QIF::setA0,
42  &QIF::getA0
43  );
44 
45  static Finfo* QIFFinfos[] = {
46  &vCritical, // Value
47  &a0 // Value
48  };
49 
50  static Dinfo< QIF > dinfo;
51  static Cinfo QIFCinfo(
52  "QIF",
53  IntFireBase::initCinfo(), // this is the initCinfo of the parent class
54  QIFFinfos,
55  sizeof( QIFFinfos ) / sizeof (Finfo*),
56  &dinfo,
57  doc,
58  sizeof(doc)/sizeof(string)
59  );
60 
61  return &QIFCinfo;
62 }
63 
64 static const Cinfo* QIFCinfo = QIF::initCinfo();
65 
67 // Here we put the QIF class functions.
69 
71 {a0_ = 0.0;
72 vCritical_ = 0.0;}
73 
75 {;}
76 
78 // QIF::Dest function definitions.
80 
81 void QIF::vProcess( const Eref& e, ProcPtr p )
82 {
83  // fully taking over Compartment's vProcess due to quadratic term in Vm
84  // we no longer care about A and B
85  fired_ = false;
86  if ( p->currTime < lastEvent_ + refractT_ ) {
87  Vm_ = vReset_;
88  sumInject_ = 0.0;
89  VmOut()->send( e, Vm_ );
90  } else {
91  // activation can be a continous variable (graded synapse).
92  // So integrate it at every time step, thus *dt.
93  // For a delta-fn synapse, SynHandler-s divide by dt and send activation.
94  // See: http://www.genesis-sim.org/GENESIS/Hyperdoc/Manual-26.html#synchan
95  // for this continuous definition of activation.
96  Vm_ += activation_ * p->dt;
97  activation_ = 0.0;
98  if ( Vm_ > threshold_ ) {
99  Vm_ = vReset_;
100  lastEvent_ = p->currTime;
101  fired_ = true;
102  spikeOut()->send( e, p->currTime );
103  VmOut()->send( e, Vm_ );
104  } else {
105  Vm_ += ( (inject_+sumInject_)
106  + a0_*(Vm_-Em_)*(Vm_-vCritical_)/Rm_ ) * p->dt / Cm_;
107  lastIm_ = Im_;
108  Im_ = 0.0;
109  sumInject_ = 0.0;
110  // Send out Vm to channels, SpikeGens, etc.
111  VmOut()->send( e, Vm_ );
112  }
113  }
114 }
115 
116 void QIF::vReinit( const Eref& e, ProcPtr p )
117 {
118  activation_ = 0.0;
119  fired_ = false;
120  lastEvent_ = -refractT_; // Allow it to fire right away.
121  Compartment::vReinit( e, p );
122 }
123 
124 void QIF::setVCritical( const Eref& e, double val )
125 {
126  vCritical_ = val;
127 }
128 
129 double QIF::getVCritical( const Eref& e ) const
130 {
131  return vCritical_;
132 }
133 
134 void QIF::setA0( const Eref& e, double val )
135 {
136  a0_ = val;
137 }
138 
139 double QIF::getA0( const Eref& e ) const
140 {
141  return a0_;
142 }
143 
void vReinit(const Eref &e, ProcPtr p)
double currTime
Definition: ProcInfo.h:19
Definition: Dinfo.h:60
double getA0(const Eref &e) const
Definition: QIF.cpp:139
static const Cinfo * initCinfo()
Definition: QIF.cpp:19
double getVCritical(const Eref &e) const
Definition: QIF.cpp:129
void vProcess(const Eref &e, ProcPtr p)
Definition: QIF.cpp:81
QIF()
Definition: QIF.cpp:70
double a0_
Definition: QIF.h:50
double dt
Definition: ProcInfo.h:18
static SrcFinfo1< double > * spikeOut()
Message src for outgoing spikes.
Definition: IntFireBase.cpp:17
double vCritical_
Definition: QIF.h:49
static const Cinfo * initCinfo()
Definition: IntFireBase.cpp:27
Definition: Eref.h:26
static const Cinfo * QIFCinfo
Definition: QIF.cpp:64
void setA0(const Eref &e, double val)
Definition: QIF.cpp:134
void setVCritical(const Eref &e, double val)
Definition: QIF.cpp:124
static SrcFinfo1< double > * VmOut()
virtual ~QIF()
Definition: QIF.cpp:74
void vReinit(const Eref &e, ProcPtr p)
Definition: QIF.cpp:116
Definition: Cinfo.h:18
Definition: Finfo.h:12