Gfluct.mod 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229
  1. TITLE Fluctuating conductances
  2. COMMENT
  3. -----------------------------------------------------------------------------
  4. Fluctuating conductance model for synaptic bombardment
  5. ======================================================
  6. THEORY
  7. Synaptic bombardment is represented by a stochastic model containing
  8. two fluctuating conductances g_e(t) and g_i(t) descibed by:
  9. Isyn = g_e(t) * [V - E_e] + g_i(t) * [V - E_i]
  10. d g_e / dt = -(g_e - g_e0) / tau_e + sqrt(D_e) * Ft
  11. d g_i / dt = -(g_i - g_i0) / tau_i + sqrt(D_i) * Ft
  12. where E_e, E_i are the reversal potentials, g_e0, g_i0 are the average
  13. conductances, tau_e, tau_i are time constants, D_e, D_i are noise diffusion
  14. coefficients and Ft is a gaussian white noise of unit standard deviation.
  15. g_e and g_i are described by an Ornstein-Uhlenbeck (OU) stochastic process
  16. where tau_e and tau_i represent the "correlation" (if tau_e and tau_i are
  17. zero, g_e and g_i are white noise). The estimation of OU parameters can
  18. be made from the power spectrum:
  19. S(w) = 2 * D * tau^2 / (1 + w^2 * tau^2)
  20. and the diffusion coeffient D is estimated from the variance:
  21. D = 2 * sigma^2 / tau
  22. NUMERICAL RESOLUTION
  23. The numerical scheme for integration of OU processes takes advantage
  24. of the fact that these processes are gaussian, which led to an exact
  25. update rule independent of the time step dt (see Gillespie DT, Am J Phys
  26. 64: 225, 1996):
  27. x(t+dt) = x(t) * exp(-dt/tau) + A * N(0,1)
  28. where A = sqrt( D*tau/2 * (1-exp(-2*dt/tau)) ) and N(0,1) is a normal
  29. random number (avg=0, sigma=1)
  30. IMPLEMENTATION
  31. This mechanism is implemented as a nonspecific current defined as a
  32. point process.
  33. PARAMETERS
  34. The mechanism takes the following parameters:
  35. E_e = 0 (mV) : reversal potential of excitatory conductance
  36. E_i = -75 (mV) : reversal potential of inhibitory conductance
  37. g_e0 = 0.0121 (umho) : average excitatory conductance
  38. g_i0 = 0.0573 (umho) : average inhibitory conductance
  39. std_e = 0.0030 (umho) : standard dev of excitatory conductance
  40. std_i = 0.0066 (umho) : standard dev of inhibitory conductance
  41. tau_e = 2.728 (ms) : time constant of excitatory conductance
  42. tau_i = 10.49 (ms) : time constant of inhibitory conductance
  43. Gfluct2: conductance cannot be negative
  44. REFERENCE
  45. Destexhe, A., Rudolph, M., Fellous, J-M. and Sejnowski, T.J.
  46. Fluctuating synaptic conductances recreate in-vivo--like activity in
  47. neocortical neurons. Neuroscience 107: 13-24 (2001).
  48. (electronic copy available at http://cns.iaf.cnrs-gif.fr)
  49. A. Destexhe, 1999
  50. -----------------------------------------------------------------------------
  51. ENDCOMMENT
  52. INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)}
  53. NEURON {
  54. POINT_PROCESS Gfluct2
  55. RANGE g_e, g_i, E_e, E_i, g_e0, g_i0, g_e1, g_i1
  56. RANGE std_e, std_i, tau_e, tau_i, D_e, D_i
  57. RANGE new_seed
  58. NONSPECIFIC_CURRENT i
  59. THREADSAFE
  60. POINTER donotuse
  61. }
  62. UNITS {
  63. (nA) = (nanoamp)
  64. (mV) = (millivolt)
  65. (umho) = (micromho)
  66. }
  67. PARAMETER {
  68. dt (ms)
  69. E_e = 0 (mV) : reversal potential of excitatory conductance
  70. E_i = -75 (mV) : reversal potential of inhibitory conductance
  71. g_e0 = 0.0121 (umho) : average excitatory conductance
  72. g_i0 = 0.0573 (umho) : average inhibitory conductance
  73. std_e = 0.0030 (umho) : standard dev of excitatory conductance
  74. std_i = 0.0066 (umho) : standard dev of inhibitory conductance
  75. tau_e = 2.728 (ms) : time constant of excitatory conductance
  76. tau_i = 10.49 (ms) : time constant of inhibitory conductance
  77. }
  78. ASSIGNED {
  79. v (mV) : membrane voltage
  80. i (nA) : fluctuating current
  81. g_e (umho) : total excitatory conductance
  82. g_i (umho) : total inhibitory conductance
  83. g_e1 (umho) : fluctuating excitatory conductance
  84. g_i1 (umho) : fluctuating inhibitory conductance
  85. D_e (umho umho /ms) : excitatory diffusion coefficient
  86. D_i (umho umho /ms) : inhibitory diffusion coefficient
  87. exp_e
  88. exp_i
  89. amp_e (umho)
  90. amp_i (umho)
  91. donotuse
  92. }
  93. INITIAL {
  94. g_e1 = 0
  95. g_i1 = 0
  96. if(tau_e != 0) {
  97. D_e = 2 * std_e * std_e / tau_e
  98. exp_e = exp(-dt/tau_e)
  99. amp_e = std_e * sqrt( (1-exp(-2*dt/tau_e)) )
  100. }
  101. if(tau_i != 0) {
  102. D_i = 2 * std_i * std_i / tau_i
  103. exp_i = exp(-dt/tau_i)
  104. amp_i = std_i * sqrt( (1-exp(-2*dt/tau_i)) )
  105. }
  106. }
  107. BREAKPOINT {
  108. SOLVE oup
  109. if(tau_e==0) {
  110. g_e = std_e * grand()
  111. }
  112. if(tau_i==0) {
  113. g_i = std_i * grand()
  114. }
  115. g_e = g_e0 + g_e1
  116. if(g_e < 0) { g_e = 0 }
  117. g_i = g_i0 + g_i1
  118. if(g_i < 0) { g_i = 0 }
  119. i = g_e * (v - E_e) + g_i * (v - E_i)
  120. }
  121. PROCEDURE oup() { : use grand()
  122. if(tau_e!=0) {
  123. g_e1 = exp_e * g_e1 + amp_e * grand()
  124. }
  125. if(tau_i!=0) {
  126. g_i1 = exp_i * g_i1 + amp_i * grand()
  127. }
  128. }
  129. PROCEDURE new_seed(seed) { : procedure to set the seed
  130. set_seed(seed)
  131. VERBATIM
  132. printf("Setting random generator with seed = %g\n", _lseed);
  133. ENDVERBATIM
  134. }
  135. VERBATIM
  136. double nrn_random_pick(void* r);
  137. void* nrn_random_arg(int argpos);
  138. ENDVERBATIM
  139. FUNCTION grand() {
  140. VERBATIM
  141. if (_p_donotuse) {
  142. /*
  143. : Supports separate independent but reproducible streams for
  144. : each instance. However, the corresponding hoc Random
  145. : distribution MUST be set to Random.uniform(0,1)
  146. */
  147. _lgrand = nrn_random_pick(_p_donotuse);
  148. }else{
  149. /* only can be used in main thread */
  150. if (_nt != nrn_threads) {
  151. hoc_execerror("multithread random in InUnif"," only via hoc Random");
  152. }
  153. ENDVERBATIM
  154. : the old standby. Cannot use if reproducible parallel sim
  155. : independent of nhost or which host this instance is on
  156. : is desired, since each instance on this cpu draws from
  157. : the same stream
  158. grand = normrand(0,1)
  159. VERBATIM
  160. }
  161. ENDVERBATIM
  162. }
  163. PROCEDURE noiseFromRandom() {
  164. VERBATIM
  165. {
  166. void** pv = (void**)(&_p_donotuse);
  167. if (ifarg(1)) {
  168. *pv = nrn_random_arg(1);
  169. }else{
  170. *pv = (void*)0;
  171. }
  172. }
  173. ENDVERBATIM
  174. }