ProbUDFsyn.mod 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. TITLE AMPA and NMDA receptor with presynaptic short-term plasticity
  2. COMMENT
  3. AMPA and NMDA receptor conductance using a dual-exponential profile
  4. presynaptic short-term plasticity based on Fuhrmann et al. 2002
  5. Implemented by Srikanth Ramaswamy, Blue Brain Project, July 2009
  6. Etay: changed weight to be equal for NMDA and AMPA, gmax accessible in Neuron
  7. ENDCOMMENT
  8. NEURON {
  9. POINT_PROCESS ProbUDFsyn
  10. RANGE tau_r, tau_d
  11. RANGE Use, u, Dep, Fac, u0
  12. RANGE i, g, e, gmax
  13. NONSPECIFIC_CURRENT i
  14. POINTER rng
  15. }
  16. PARAMETER {
  17. tau_r = 0.2 (ms) : dual-exponential conductance profile
  18. tau_d = 1.7 (ms) : IMPORTANT: tau_r < tau_d
  19. Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values)
  20. Dep = 100 (ms) : relaxation time constant from depression
  21. Fac = 10 (ms) : relaxation time constant from facilitation
  22. e = 0 (mV) : AMPA and NMDA reversal potential
  23. gmax = .001 (uS) : weight conversion factor (from nS to uS)
  24. u0 = 0 :initial value of u, which is the running value of Use
  25. }
  26. COMMENT
  27. The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1
  28. for comparison with Pr to decide whether to activate the synapse or not
  29. ENDCOMMENT
  30. VERBATIM
  31. #include<stdlib.h>
  32. #include<stdio.h>
  33. #include<math.h>
  34. double nrn_random_pick(void* r);
  35. void* nrn_random_arg(int argpos);
  36. ENDVERBATIM
  37. ASSIGNED {
  38. v (mV)
  39. i (nA)
  40. g (uS)
  41. factor
  42. rng
  43. weight_NMDA
  44. }
  45. STATE {
  46. A : state variable to construct the dual-exponential profile - decays with conductance tau_r_AMPA
  47. B : state variable to construct the dual-exponential profile - decays with conductance tau_d_AMPA
  48. }
  49. INITIAL{
  50. LOCAL tp
  51. A = 0
  52. B = 0
  53. tp = (tau_r*tau_d)/(tau_d-tau_r)*log(tau_d/tau_r) :time to peak of the conductance
  54. factor = -exp(-tp/tau_r)+exp(-tp/tau_d) : Normalization factor - so that when t = tp, gsyn = gpeak
  55. factor = 1/factor
  56. }
  57. BREAKPOINT {
  58. SOLVE state METHOD cnexp
  59. g = gmax*(B-A) :compute time varying conductance as the difference of state variables B and A
  60. i = g*(v-e) :compute the driving force based on the time varying conductance, membrane potential, and reversal
  61. }
  62. DERIVATIVE state{
  63. A' = -A/tau_r
  64. B' = -B/tau_d
  65. }
  66. NET_RECEIVE (weight, Pv, Pv_tmp, Pr, u, tsyn (ms)){
  67. INITIAL{
  68. Pv=1
  69. u=u0
  70. tsyn=t
  71. }
  72. : calc u at event-
  73. if (Fac > 0) {
  74. u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al.
  75. } else {
  76. u = Use
  77. }
  78. if(Fac > 0){
  79. u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al.
  80. }
  81. Pv_tmp = 1 - (1-Pv) * exp(-(t-tsyn)/Dep) :Probability Pv for a vesicle to be available for release, analogous to the pool of synaptic
  82. :resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al.
  83. Pr = u * Pv_tmp :Pr is calculated as Pv * u (running value of Use)
  84. Pv_tmp = Pv_tmp - u * Pv_tmp :update Pv as per Eq. 3 in Fuhrmann et al.
  85. :printf("Pv = %g\n", Pv)
  86. :printf("Pr = %g\n", Pr)
  87. if (erand() < Pr){
  88. tsyn = t
  89. Pv = Pv_tmp
  90. A = A + weight*factor
  91. B = B + weight*factor
  92. }
  93. }
  94. PROCEDURE setRNG() {
  95. VERBATIM
  96. {
  97. /**
  98. * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file.
  99. * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod
  100. * which points out that the Random must be in negexp(1) mode
  101. */
  102. void** pv = (void**)(&_p_rng);
  103. if( ifarg(1)) {
  104. *pv = nrn_random_arg(1);
  105. } else {
  106. *pv = (void*)0;
  107. }
  108. }
  109. ENDVERBATIM
  110. }
  111. FUNCTION erand() {
  112. VERBATIM
  113. //FILE *fi;
  114. double value;
  115. if (_p_rng) {
  116. /*
  117. :Supports separate independent but reproducible streams for
  118. : each instance. However, the corresponding hoc Random
  119. : distribution MUST be set to Random.negexp(1)
  120. */
  121. value = nrn_random_pick(_p_rng);
  122. //fi = fopen("RandomStreamMCellRan4.txt", "w");
  123. //fprintf(fi,"random stream for this simulation = %lf\n",value);
  124. //printf("random stream for this simulation = %lf\n",value);
  125. return value;
  126. }else{
  127. ENDVERBATIM
  128. : the old standby. Cannot use if reproducible parallel sim
  129. : independent of nhost or which host this instance is on
  130. : is desired, since each instance on this cpu draws from
  131. : the same stream
  132. erand = exprand(1)
  133. VERBATIM
  134. }
  135. ENDVERBATIM
  136. :erand = value :This line must have been a mistake in Hay et al.'s code, it would basically set the return value to a non-initialized double value.
  137. :The reason it sometimes works could be that the memory allocated for the non-initialized happened to contain the random value
  138. :previously generated (or if _p_rng is always a null pointer). However, here we commented this line out.
  139. }