ProbUDF.synapse.nml 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. <?xml version="1.0" encoding="ISO-8859-1"?>
  2. <neuroml xmlns="http://www.neuroml.org/schema/neuroml2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.neuroml.org/schema/neuroml2 https://raw.github.com/NeuroML/NeuroML2/development/Schemas/NeuroML2/NeuroML_v2.3.xsd" id="ProbUDFSynDoc">
  3. <!-- Note that order of different LEMS types matters for validation, since the schema defines what order they should appear in -->
  4. <!-- docs on NET_RECEIVE and INITIAL blocks: https://www.neuron.yale.edu/neuron/static/py_doc/modelspec/programmatic/network/netcon.html -->
  5. <!-- other refs:
  6. - https://github.com/NeuroML/jNeuroML/issues/39#issuecomment-213517949
  7. - https://github.com/JustasB/Mig3DTest/blob/master/NeuroML2/Synapses/FI.synapse.nml
  8. - https://github.com/OpenSourceBrain/EbnerEtAl2019/blob/master/NeuroML2/fourPathwaySyn.synapse.nml
  9. -->
  10. <!-- baseConductanceBasedSynapse has v and gbase as requirements, which we need here -->
  11. <ComponentType name="ProbUDFsyn"
  12. extends="baseConductanceBasedSynapse"
  13. description="AMPA and NMDA receptor conductance using a dual-exponential profile presynaptic short-term plasticity based on Fuhrmann et al. 2002"
  14. >
  15. <Property name="weight" dimension="none" defaultValue="1" />
  16. <!-- NMODL PARAMTER -->
  17. <Parameter name="tau_r" dimension="time" />
  18. <Parameter name="tau_d" dimension="time" />
  19. <Parameter name="Use" dimension="none" />
  20. <Parameter name="Dep" dimension="time" />
  21. <Parameter name="Fac" dimension="time" />
  22. <!-- gmax is defined as gbase, which is inherited from baseConductanceBasedSynapse -->
  23. <Parameter name="erev" dimension="voltage" />
  24. <Parameter name="u0" dimension="none"/>
  25. <DerivedParameter name="tp" dimension="none" value="(tau_r * tau_d) / (tau_d - tau_r) * log(tau_d / tau_r)" />
  26. <DerivedParameter name="factor" dimension="none" value="1 / (-exp(-tp / tau_r) + exp(-tp / tau_d))" />
  27. <Constant name="MVOLT" dimension="voltage" value="1mV"/>
  28. <Constant name="MSEC" dimension="time" value="1ms"/>
  29. <Constant name="MMOL" dimension="concentration" value="1mM"/>
  30. <Exposure name="i" dimension="current"/>
  31. <Exposure name="g" dimension="conductance"/>
  32. <Exposure name="A" dimension="none"/>
  33. <Exposure name="B" dimension="none"/>
  34. <Dynamics>
  35. <!-- NMODL STATE -->
  36. <StateVariable name="Pv_tmp" dimension="none"/>
  37. <StateVariable name="Pv" dimension="none"/>
  38. <StateVariable name="Pr" dimension="none"/>
  39. <StateVariable name="u" dimension="none"/>
  40. <StateVariable name="tsyn" dimension="time"/>
  41. <StateVariable name="A" dimension="none" exposure="A"/>
  42. <StateVariable name="B" dimension="none" exposure="B"/>
  43. <StateVariable name="is_spiking" dimension="none" />
  44. <!-- NMODL rates() -->
  45. <!-- NMODL ASSIGNED -->
  46. <!-- so that all conditions are tested against the same random value -->
  47. <StateVariable name="random_val" dimension="none" />
  48. <DerivedVariable name="g" dimension="conductance" exposure="g" value="gbase * (B - A)" />
  49. <!-- mod file generator multiplies by -1 -->
  50. <DerivedVariable name="i" exposure="i" dimension="current" value="-1 * g * (v - erev)" />
  51. <!-- NMODL DERIVATIVE, rates() -->
  52. <TimeDerivative variable="A" value="-A / tau_r" />
  53. <TimeDerivative variable="B" value="-B / tau_d" />
  54. <TimeDerivative variable="is_spiking" value="0" />
  55. <TimeDerivative variable="tsyn" value="0" />
  56. <TimeDerivative variable="Pv_tmp" value="0" />
  57. <TimeDerivative variable="Pr" value="0" />
  58. <TimeDerivative variable="Pv" value="0" />
  59. <TimeDerivative variable="u" value="0" />
  60. <TimeDerivative variable="random_val" value="0" />
  61. <!-- NMODL INITIAL -->
  62. <OnStart>
  63. <StateAssignment variable="A" value="0" />
  64. <StateAssignment variable="B" value="0" />
  65. <StateAssignment variable="u" value="u0" />
  66. <StateAssignment variable="Pv" value="1" />
  67. <StateAssignment variable="tsyn" value="t" />
  68. <StateAssignment variable="is_spiking" value="0" />
  69. </OnStart>
  70. <!-- NMODL NET_RECEIVE -->
  71. <OnEvent port="in">
  72. <StateAssignment variable="is_spiking" value="1" />
  73. <StateAssignment variable="random_val" value="random(1)" />
  74. <StateAssignment variable="u" value="(H(Fac/MSEC) * ((u * exp(- (t - tsyn)/Fac)) + Use * (1 - (u * exp(- (t - tsyn)/Fac))))) + (H(-Fac/MSEC) * Use)" />
  75. <StateAssignment variable="Pv_tmp" value="(1 - (1 - Pv) * exp(- (t - tsyn ) / Dep))" />
  76. <StateAssignment variable="Pr" value="u * Pv_tmp" />
  77. <StateAssignment variable="Pv" value="(H(Pr - random_val) * (Pv_tmp - Pr)) + (H(random_val - Pr) * Pv)" />
  78. <!-- "weight" is defined in the NET_RECEIVE function, so we cannot use OnCondition for these as "weight" is not defined outside NET_RECEIVE.
  79. So, use H(x) to implement conditional: 1 if x >0 ; 0 if x < 0; 0.5 if x == 0
  80. -->
  81. <StateAssignment variable="A" value="A + (H(Pr - random_val) * (weight * factor))" />
  82. <StateAssignment variable="B" value="B + (H(Pr - random_val) * (weight * factor))" />
  83. <StateAssignment variable="tsyn" value="(H(Pr - random_val) * t) + (H(random_val - Pr) * tsyn)" />
  84. </OnEvent>
  85. <!-- Note: error when using .le. in OnCondition test:
  86. Exception in thread "main" java.lang.NumberFormatException: For input string: ".le."
  87. at java.base/jdk.internal.math.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2054)
  88. at java.base/jdk.internal.math.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
  89. at java.base/java.lang.Double.parseDouble(Double.java:651)
  90. at org.lemsml.jlems.core.expression.ConstantNode.<init>(ConstantNode.java:19)
  91. -->
  92. <!-- reset at last -->
  93. <OnCondition test="is_spiking .eq. 1" >
  94. <StateAssignment variable="is_spiking" value="0" />
  95. </OnCondition>
  96. </Dynamics>
  97. </ComponentType>
  98. </neuroml>