├── How_to_Install_NEURON.txt ├── Jupyter_notebooks ├── Ball_and_Stick.ipynb ├── Inhibition_location_Gidon_et_al.ipynb ├── Layer_5b_pyramidal_cell.ipynb ├── Layer_5b_pyramidal_cell_Calcium_Spike.ipynb ├── Single_compartment_neuron_active.ipynb ├── Single_compartment_neuron_passive.ipynb ├── Timed_inhibition_Doron_et_al.ipynb ├── models │ ├── L5PCbiophys3.hoc │ └── L5PCtemplate.hoc ├── mods │ ├── CaDynamics_E2.mod │ ├── Ca_HVA.mod │ ├── Ca_LVAst.mod │ ├── Ih.mod │ ├── Im.mod │ ├── K_Pst.mod │ ├── K_Tst.mod │ ├── NaTa_t.mod │ ├── NaTs2_t.mod │ ├── Nap_Et2.mod │ ├── ProbAMPA.mod │ ├── ProbAMPANMDA.mod │ ├── ProbAMPANMDA2_ratio.mod │ ├── ProbAMPANMDA_EMS.mod │ ├── ProbGABAA.mod │ ├── ProbGABAAB_EMS.mod │ ├── ProbGABAA_EMS.mod │ ├── ProbNMDA.mod │ ├── SK_E2.mod │ ├── SKv3_1.mod │ ├── epsp.mod │ ├── kv.mod │ └── na.mod └── morphologies │ └── cell1.asc ├── NEURON_tutorial.pptx ├── Python_scripts ├── Ball_and_Stick.py ├── Inhibition_location_Gidon_et_al.py ├── Layer_5b_pyramidal_cell.py ├── Layer_5b_pyramidal_cell_calcium_spike.py ├── Single_compartment_neuron_active.py ├── Single_compartment_neuron_passive.py ├── Timed_inhibition_Doron_et_al.py ├── models │ ├── L5PCbiophys3.hoc │ └── L5PCtemplate.hoc ├── mods │ ├── CaDynamics_E2.mod │ ├── Ca_HVA.mod │ ├── Ca_LVAst.mod │ ├── Ih.mod │ ├── Im.mod │ ├── K_Pst.mod │ ├── K_Tst.mod │ ├── NaTa_t.mod │ ├── NaTs2_t.mod │ ├── Nap_Et2.mod │ ├── ProbAMPA.mod │ ├── ProbAMPANMDA.mod │ ├── ProbAMPANMDA2_ratio.mod │ ├── ProbAMPANMDA_EMS.mod │ ├── ProbGABAA.mod │ ├── ProbGABAAB_EMS.mod │ ├── ProbGABAA_EMS.mod │ ├── ProbNMDA.mod │ ├── SK_E2.mod │ ├── SKv3_1.mod │ ├── epsp.mod │ ├── kv.mod │ └── na.mod └── morphologies │ └── cell1.asc ├── README.md └── main.JPG /How_to_Install_NEURON.txt: -------------------------------------------------------------------------------- 1 | 2 | (After installing Python as instructed here: https://www.anaconda.com/distribution/) 3 | 4 | ## Windows 5 | 1. Open https://www.neuron.yale.edu/neuron/download with your web browser. 6 | 2. Click on - Download Windows installer (64 bit). 7 | 3. Install NEURON and make sure to select "Set DOS environment. (Useful if ...)" when asked to select components to install. 8 | 9 | 10 | ## macOS 11 | 1. Open https://www.neuron.yale.edu/neuron/download with your web browser. 12 | 2. Click on - Download OSX installer. 13 | 3. Install NEURON and click YES to all questions. 14 | 15 | 16 | ## Linux 17 | 1. Open https://www.neuron.yale.edu/neuron/download with your web browser. 18 | 2. Download the NEURON installer which fits your linux distribution (.dep or .rpm). 19 | 3. Install NEURON 20 | 4. Open a terminal window. 21 | 5. Type: 22 | echo 'export PYTHONPATH=/usr/local/nrn/lib/python:$PYTHONPATH' >> ~/.bashrc 23 | 24 | 25 | 26 | To test that NEURON was installed correctly open jupyter notebook or any python shell and check if the following commands are working: 27 | from neuron import gui 28 | from neuron import h 29 | 30 | 31 | 32 | ## Troubleshooting: 33 | 34 | 1. (Ubuntu) - Can not compile mod files with nrnivmodl, get "/usr/bin/ld: cannot find -lncurses" 35 | Solution: 36 | you need to install ncurses development, in ubuntu this is how to install it: 37 | sudo apt-get install libncurses-dev 38 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /Jupyter_notebooks/models/L5PCbiophys3.hoc: -------------------------------------------------------------------------------- 1 | // Author: Etay Hay, 2011 2 | // Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of 3 | // Dendritic and Perisomatic Active Properties 4 | // (Hay et al., PLoS Computational Biology, 2011) 5 | // 6 | // Model of L5 Pyramidal Cell, constrained both for BAC firing and Current Step Firing 7 | 8 | 9 | begintemplate L5PCbiophys 10 | public biophys 11 | 12 | proc biophys() { 13 | forsec $o1.all { 14 | insert pas 15 | cm = 1 16 | Ra = 100 17 | e_pas = -90 18 | } 19 | 20 | forsec $o1.somatic { 21 | insert Ca_LVAst 22 | insert Ca_HVA 23 | insert SKv3_1 24 | insert SK_E2 25 | insert K_Tst 26 | insert K_Pst 27 | insert Nap_Et2 28 | insert NaTa_t 29 | insert CaDynamics_E2 30 | insert Ih 31 | ek = -85 32 | ena = 50 33 | gIhbar_Ih = 0.0002 34 | g_pas = 0.0000338 35 | decay_CaDynamics_E2 = 460.0 36 | gamma_CaDynamics_E2 = 0.000501 37 | gCa_LVAstbar_Ca_LVAst = 0.00343 38 | gCa_HVAbar_Ca_HVA = 0.000992 39 | gSKv3_1bar_SKv3_1 = 0.693 40 | gSK_E2bar_SK_E2 = 0.0441 41 | gK_Tstbar_K_Tst = 0.0812 42 | gK_Pstbar_K_Pst = 0.00223 43 | gNap_Et2bar_Nap_Et2 = 0.00172 44 | gNaTa_tbar_NaTa_t = 2.04 45 | } 46 | 47 | forsec $o1.apical { 48 | cm = 2 49 | insert Ih 50 | insert SK_E2 51 | insert Ca_LVAst 52 | insert Ca_HVA 53 | insert SKv3_1 54 | insert NaTa_t 55 | insert Im 56 | insert CaDynamics_E2 57 | ek = -85 58 | ena = 50 59 | decay_CaDynamics_E2 = 122 60 | gamma_CaDynamics_E2 = 0.000509 61 | gSK_E2bar_SK_E2 = 0.0012 62 | gSKv3_1bar_SKv3_1 = 0.000261 63 | gNaTa_tbar_NaTa_t = 0.0213 64 | gImbar_Im = 0.0000675 65 | g_pas = 0.0000589 66 | } 67 | $o1.distribute_channels("apic","gIhbar_Ih",2,-0.8696,3.6161,0.0,2.0870,0.00020000000) 68 | $o1.distribute_channels("apic","gCa_LVAstbar_Ca_LVAst",3,1.000000,0.010000,685.000000,885.000000,0.0187000000) 69 | $o1.distribute_channels("apic","gCa_HVAbar_Ca_HVA",3,1.000000,0.100000,685.000000,885.000000,0.0005550000) 70 | 71 | forsec $o1.basal { 72 | cm = 2 73 | insert Ih 74 | gIhbar_Ih = 0.0002 75 | g_pas = 0.0000467 76 | } 77 | 78 | forsec $o1.axonal { 79 | g_pas = 0.0000325 80 | } 81 | } 82 | 83 | endtemplate L5PCbiophys -------------------------------------------------------------------------------- /Jupyter_notebooks/models/L5PCtemplate.hoc: -------------------------------------------------------------------------------- 1 | // Author: Etay Hay, 2011 2 | // Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of 3 | // Dendritic and Perisomatic Active Properties 4 | // (Hay et al., PLoS Computational Biology, 2011) 5 | // 6 | // Template for models of L5 Pyramidal Cell 7 | 8 | begintemplate L5PCtemplate 9 | public init 10 | public locateSites, getLongestBranch 11 | public soma, dend, apic, axon, getAbsSecIndex 12 | public all, somatic, apical, axonal, basal, nSecSoma, nSecApical, nSecBasal, nSecAxonal, nSecAll, nSecAxonalOrig, SecSyn, distribute_channels 13 | objref SecSyn, this 14 | objref all, somatic, apical, axonal, basal 15 | strdef tstr 16 | 17 | //$s1 - morphology file name 18 | proc init() {localobj nl,import 19 | all = new SectionList() 20 | somatic = new SectionList() 21 | basal = new SectionList() 22 | apical = new SectionList() 23 | axonal = new SectionList() 24 | forall delete_section() 25 | 26 | nl = new Import3d_Neurolucida3() 27 | nl.quiet = 1 28 | nl.input($s1) 29 | import = new Import3d_GUI(nl, 0) 30 | import.instantiate(this) 31 | geom_nseg() 32 | biophys() 33 | forsec this.all { 34 | if(diam == 0){ 35 | diam = 1 36 | printf("Error : Morphology problem with section [%s] 0 diam \n", secname()) 37 | } 38 | } 39 | } 40 | 41 | create soma[1], dend[1], apic[1], axon[1] 42 | 43 | proc geom() { 44 | } 45 | 46 | proc geom_nseg() {local nSec, L1, L2, D1, D2, nSeg1, nSeg2 47 | soma area(.5) // make sure diam reflects 3d points 48 | nSec = 0 49 | forsec all { 50 | nseg = 1 + 2*int(L/40) 51 | nSec = nSec + 1 52 | } 53 | 54 | nSecAll = nSec 55 | nSec = 0 56 | forsec somatic { nSec = nSec + 1} 57 | nSecSoma = nSec 58 | nSec = 0 59 | forsec apical { nSec = nSec + 1} 60 | nSecApical= nSec 61 | nSec = 0 62 | forsec basal { nSec = nSec + 1} 63 | nSecBasal = nSec 64 | nSec = 0 65 | forsec axonal { nSec = nSec + 1} 66 | nSecAxonalOrig = nSecAxonal = nSec 67 | } 68 | 69 | proc biophys() {localobj bp 70 | delete_axon() 71 | area(0.5) 72 | distance() 73 | access soma 74 | 75 | bp = new L5PCbiophys() 76 | bp.biophys(this) 77 | } 78 | 79 | // deleting axon, keeping only first 60 micrometers 80 | proc delete_axon(){ 81 | forsec axonal{delete_section()} 82 | create axon[2] 83 | access axon[0]{ 84 | L= 30 85 | diam = 1 86 | nseg = 1+2*int(L/40) 87 | all.append() 88 | axonal.append() 89 | } 90 | access axon[1]{ 91 | L= 30 92 | diam = 1 93 | nseg = 1+2*int(L/40) 94 | all.append() 95 | axonal.append() 96 | } 97 | 98 | nSecAxonal = 2 99 | connect axon(0), soma(0.5) 100 | connect axon[1](0), axon[0](1) 101 | access soma 102 | } 103 | 104 | proc distribute_channels() {local dist,val,base,maxLength 105 | base = $8 106 | soma distance() 107 | maxLength = getLongestBranch($s1) 108 | 109 | forsec $s1 { 110 | if(0==strcmp($s2,"Ra")){ 111 | Ra = $8 112 | } else { 113 | for(x) { 114 | if ($3==3) { 115 | dist = distance(x) 116 | } else { 117 | dist = distance(x)/maxLength 118 | } 119 | val = calculate_distribution($3,dist,$4,$5,$6,$7,$8) 120 | sprint(tstr,"%s(%-5.10f) = %-5.10f",$s2,x,val) 121 | execute(tstr) 122 | } 123 | } 124 | } 125 | } 126 | 127 | // $1 is the distribution type: 128 | // 0 linear, 1 sigmoid, 2 exponential 129 | // 3 step for absolute distance (in microns) 130 | func calculate_distribution() {local value 131 | if ($1==0) {value = $3 + $2*$4} 132 | if ($1==1) {value = $3 + ($4/(1+exp(($2-$5)/$6)))} 133 | if ($1==2) {value = $3 + $6*exp($4*($2-$5))} 134 | if ($1==3) { 135 | if (($2 > $5) && ($2 < $6)) { 136 | value = $3 137 | } else { 138 | value = $4 139 | } 140 | } 141 | value = value*$7 142 | return value 143 | } 144 | 145 | // $s1 section 146 | func getLongestBranch(){local maxL,d localobj distallist,sref 147 | sprint(tstr,"%s distance()",$s1) 148 | execute(tstr,this) 149 | 150 | if(0==strcmp($s1,"axon")){ 151 | sprint(tstr,"%s[0] distance(1)",$s1) 152 | execute(tstr,this) 153 | } 154 | 155 | maxL = 0 156 | d = 0 157 | distallist = new SectionList() 158 | forsec $s1 { 159 | sref = new SectionRef() 160 | if (sref.nchild==0) distallist.append() 161 | } 162 | forsec distallist{ 163 | d = distance(1) 164 | if(maxL= d0) { 202 | siteX = (site-d0)/(d1-d0) 203 | secNum = i 204 | vv = new Vector() 205 | ll.append(vv.append(secNum,siteX)) 206 | } 207 | i = i+1 208 | } 209 | return ll 210 | } 211 | 212 | func getAbsSecIndex(){ local nAbsInd, index localobj str,strObj 213 | strObj = new StringFunctions() 214 | str = new String() 215 | nAbsInd = 0 216 | index = 0 217 | if(strObj.substr($s1, "soma") > 0) { 218 | strObj.tail($s1, "soma", str.s) 219 | if(sscanf(str.s, "%*c%d", &index) < 0) { 220 | index = 0 221 | } 222 | nAbsInd = index 223 | }else if (strObj.substr($s1, "axon") >0) { 224 | strObj.tail($s1, "axon", str.s) 225 | if(sscanf(str.s, "%*c%d", &index) < 0) { 226 | index = 0 227 | } 228 | nAbsInd = nSecSoma + index 229 | }else if (strObj.substr($s1, "dend") >0) { 230 | strObj.tail($s1, "dend", str.s) 231 | if(sscanf(str.s, "%*c%d", &index) < 0) { 232 | index = 0 233 | } 234 | nAbsInd = nSecSoma + nSecAxonalOrig + index 235 | }else if (strObj.substr($s1, "apic") > 0) { 236 | strObj.tail($s1, "apic", str.s) 237 | if(sscanf(str.s, "%*c%d", &index) < 0) { 238 | index = 0 239 | } 240 | nAbsInd = nSecSoma + nSecAxonalOrig + nSecBasal + index 241 | } 242 | return nAbsInd 243 | } 244 | 245 | 246 | endtemplate L5PCtemplate -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/CaDynamics_E2.mod: -------------------------------------------------------------------------------- 1 | : Dynamics that track inside calcium concentration 2 | : modified from Destexhe et al. 1994 3 | 4 | NEURON { 5 | SUFFIX CaDynamics_E2 6 | USEION ca READ ica WRITE cai 7 | RANGE decay, gamma, minCai, depth 8 | } 9 | 10 | UNITS { 11 | (mV) = (millivolt) 12 | (mA) = (milliamp) 13 | FARADAY = (faraday) (coulombs) 14 | (molar) = (1/liter) 15 | (mM) = (millimolar) 16 | (um) = (micron) 17 | } 18 | 19 | PARAMETER { 20 | gamma = 0.05 : percent of free calcium (not buffered) 21 | decay = 80 (ms) : rate of removal of calcium 22 | depth = 0.1 (um) : depth of shell 23 | minCai = 1e-4 (mM) 24 | } 25 | 26 | ASSIGNED {ica (mA/cm2)} 27 | 28 | STATE { 29 | cai (mM) 30 | } 31 | 32 | BREAKPOINT { SOLVE states METHOD cnexp } 33 | 34 | DERIVATIVE states { 35 | cai' = -(10000)*(ica*gamma/(2*FARADAY*depth)) - (cai - minCai)/decay 36 | } 37 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/Ca_HVA.mod: -------------------------------------------------------------------------------- 1 | :Comment : 2 | :Reference : : Reuveni, Friedman, Amitai, and Gutnick, J.Neurosci. 1993 3 | 4 | NEURON { 5 | SUFFIX Ca_HVA 6 | USEION ca READ eca WRITE ica 7 | RANGE gCa_HVAbar, gCa_HVA, ica 8 | } 9 | 10 | UNITS { 11 | (S) = (siemens) 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | } 15 | 16 | PARAMETER { 17 | gCa_HVAbar = 0.00001 (S/cm2) 18 | } 19 | 20 | ASSIGNED { 21 | v (mV) 22 | eca (mV) 23 | ica (mA/cm2) 24 | gCa_HVA (S/cm2) 25 | mInf 26 | mTau 27 | mAlpha 28 | mBeta 29 | hInf 30 | hTau 31 | hAlpha 32 | hBeta 33 | } 34 | 35 | STATE { 36 | m 37 | h 38 | } 39 | 40 | BREAKPOINT { 41 | SOLVE states METHOD cnexp 42 | gCa_HVA = gCa_HVAbar*m*m*h 43 | ica = gCa_HVA*(v-eca) 44 | } 45 | 46 | DERIVATIVE states { 47 | rates() 48 | m' = (mInf-m)/mTau 49 | h' = (hInf-h)/hTau 50 | } 51 | 52 | INITIAL{ 53 | rates() 54 | m = mInf 55 | h = hInf 56 | } 57 | 58 | PROCEDURE rates(){ 59 | UNITSOFF 60 | if((v == -27) ){ 61 | v = v+0.0001 62 | } 63 | mAlpha = (0.055*(-27-v))/(exp((-27-v)/3.8) - 1) 64 | mBeta = (0.94*exp((-75-v)/17)) 65 | mInf = mAlpha/(mAlpha + mBeta) 66 | mTau = 1/(mAlpha + mBeta) 67 | hAlpha = (0.000457*exp((-13-v)/50)) 68 | hBeta = (0.0065/(exp((-v-15)/28)+1)) 69 | hInf = hAlpha/(hAlpha + hBeta) 70 | hTau = 1/(hAlpha + hBeta) 71 | UNITSON 72 | } 73 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/Ca_LVAst.mod: -------------------------------------------------------------------------------- 1 | :Comment : LVA ca channel. Note: mtau is an approximation from the plots 2 | :Reference : : Avery and Johnston 1996, tau from Randall 1997 3 | :Comment: shifted by -10 mv to correct for junction potential 4 | :Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 5 | 6 | NEURON { 7 | SUFFIX Ca_LVAst 8 | USEION ca READ eca WRITE ica 9 | RANGE gCa_LVAstbar, gCa_LVAst, ica 10 | } 11 | 12 | UNITS { 13 | (S) = (siemens) 14 | (mV) = (millivolt) 15 | (mA) = (milliamp) 16 | } 17 | 18 | PARAMETER { 19 | gCa_LVAstbar = 0.00001 (S/cm2) 20 | } 21 | 22 | ASSIGNED { 23 | v (mV) 24 | eca (mV) 25 | ica (mA/cm2) 26 | gCa_LVAst (S/cm2) 27 | mInf 28 | mTau 29 | hInf 30 | hTau 31 | } 32 | 33 | STATE { 34 | m 35 | h 36 | } 37 | 38 | BREAKPOINT { 39 | SOLVE states METHOD cnexp 40 | gCa_LVAst = gCa_LVAstbar*m*m*h 41 | ica = gCa_LVAst*(v-eca) 42 | } 43 | 44 | DERIVATIVE states { 45 | rates() 46 | m' = (mInf-m)/mTau 47 | h' = (hInf-h)/hTau 48 | } 49 | 50 | INITIAL{ 51 | rates() 52 | m = mInf 53 | h = hInf 54 | } 55 | 56 | PROCEDURE rates(){ 57 | LOCAL qt 58 | qt = 2.3^((34-21)/10) 59 | 60 | UNITSOFF 61 | v = v + 10 62 | mInf = 1.0000/(1+ exp((v - -30.000)/-6)) 63 | mTau = (5.0000 + 20.0000/(1+exp((v - -25.000)/5)))/qt 64 | hInf = 1.0000/(1+ exp((v - -80.000)/6.4)) 65 | hTau = (20.0000 + 50.0000/(1+exp((v - -40.000)/7)))/qt 66 | v = v - 10 67 | UNITSON 68 | } 69 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/Ih.mod: -------------------------------------------------------------------------------- 1 | :Comment : 2 | :Reference : : Kole,Hallermann,and Stuart, J. Neurosci. 2006 3 | 4 | NEURON { 5 | SUFFIX Ih 6 | NONSPECIFIC_CURRENT ihcn 7 | RANGE gIhbar, gIh, ihcn 8 | } 9 | 10 | UNITS { 11 | (S) = (siemens) 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | } 15 | 16 | PARAMETER { 17 | gIhbar = 0.00001 (S/cm2) 18 | ehcn = -45.0 (mV) 19 | } 20 | 21 | ASSIGNED { 22 | v (mV) 23 | ihcn (mA/cm2) 24 | gIh (S/cm2) 25 | mInf 26 | mTau 27 | mAlpha 28 | mBeta 29 | } 30 | 31 | STATE { 32 | m 33 | } 34 | 35 | BREAKPOINT { 36 | SOLVE states METHOD cnexp 37 | gIh = gIhbar*m 38 | ihcn = gIh*(v-ehcn) 39 | } 40 | 41 | DERIVATIVE states { 42 | rates() 43 | m' = (mInf-m)/mTau 44 | } 45 | 46 | INITIAL{ 47 | rates() 48 | m = mInf 49 | } 50 | 51 | PROCEDURE rates(){ 52 | UNITSOFF 53 | if(v == -154.9){ 54 | v = v + 0.0001 55 | } 56 | mAlpha = 0.001*6.43*(v+154.9)/(exp((v+154.9)/11.9)-1) 57 | mBeta = 0.001*193*exp(v/33.1) 58 | mInf = mAlpha/(mAlpha + mBeta) 59 | mTau = 1/(mAlpha + mBeta) 60 | UNITSON 61 | } 62 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/Im.mod: -------------------------------------------------------------------------------- 1 | :Reference : : Adams et al. 1982 - M-currents and other potassium currents in bullfrog sympathetic neurones 2 | :Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 3 | 4 | NEURON { 5 | SUFFIX Im 6 | USEION k READ ek WRITE ik 7 | RANGE gImbar, gIm, ik 8 | } 9 | 10 | UNITS { 11 | (S) = (siemens) 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | } 15 | 16 | PARAMETER { 17 | gImbar = 0.00001 (S/cm2) 18 | } 19 | 20 | ASSIGNED { 21 | v (mV) 22 | ek (mV) 23 | ik (mA/cm2) 24 | gIm (S/cm2) 25 | mInf 26 | mTau 27 | mAlpha 28 | mBeta 29 | } 30 | 31 | STATE { 32 | m 33 | } 34 | 35 | BREAKPOINT { 36 | SOLVE states METHOD cnexp 37 | gIm = gImbar*m 38 | ik = gIm*(v-ek) 39 | } 40 | 41 | DERIVATIVE states { 42 | rates() 43 | m' = (mInf-m)/mTau 44 | } 45 | 46 | INITIAL{ 47 | rates() 48 | m = mInf 49 | } 50 | 51 | PROCEDURE rates(){ 52 | LOCAL qt 53 | qt = 2.3^((34-21)/10) 54 | 55 | UNITSOFF 56 | mAlpha = 3.3e-3*exp(2.5*0.04*(v - -35)) 57 | mBeta = 3.3e-3*exp(-2.5*0.04*(v - -35)) 58 | mInf = mAlpha/(mAlpha + mBeta) 59 | mTau = (1/(mAlpha + mBeta))/qt 60 | UNITSON 61 | } 62 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/K_Pst.mod: -------------------------------------------------------------------------------- 1 | :Comment : The persistent component of the K current 2 | :Reference : : Voltage-gated K+ channels in layer 5 neocortical pyramidal neurones from young rats:subtypes and gradients,Korngreen and Sakmann, J. Physiology, 2000 3 | :Comment : shifted -10 mv to correct for junction potential 4 | :Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 5 | 6 | 7 | NEURON { 8 | SUFFIX K_Pst 9 | USEION k READ ek WRITE ik 10 | RANGE gK_Pstbar, gK_Pst, ik 11 | } 12 | 13 | UNITS { 14 | (S) = (siemens) 15 | (mV) = (millivolt) 16 | (mA) = (milliamp) 17 | } 18 | 19 | PARAMETER { 20 | gK_Pstbar = 0.00001 (S/cm2) 21 | } 22 | 23 | ASSIGNED { 24 | v (mV) 25 | ek (mV) 26 | ik (mA/cm2) 27 | gK_Pst (S/cm2) 28 | mInf 29 | mTau 30 | hInf 31 | hTau 32 | } 33 | 34 | STATE { 35 | m 36 | h 37 | } 38 | 39 | BREAKPOINT { 40 | SOLVE states METHOD cnexp 41 | gK_Pst = gK_Pstbar*m*m*h 42 | ik = gK_Pst*(v-ek) 43 | } 44 | 45 | DERIVATIVE states { 46 | rates() 47 | m' = (mInf-m)/mTau 48 | h' = (hInf-h)/hTau 49 | } 50 | 51 | INITIAL{ 52 | rates() 53 | m = mInf 54 | h = hInf 55 | } 56 | 57 | PROCEDURE rates(){ 58 | LOCAL qt 59 | qt = 2.3^((34-21)/10) 60 | UNITSOFF 61 | v = v + 10 62 | mInf = (1/(1 + exp(-(v+1)/12))) 63 | if(v<-50){ 64 | mTau = (1.25+175.03*exp(-v * -0.026))/qt 65 | }else{ 66 | mTau = ((1.25+13*exp(-v*0.026)))/qt 67 | } 68 | hInf = 1/(1 + exp(-(v+54)/-11)) 69 | hTau = (360+(1010+24*(v+55))*exp(-((v+75)/48)^2))/qt 70 | v = v - 10 71 | UNITSON 72 | } 73 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/K_Tst.mod: -------------------------------------------------------------------------------- 1 | :Comment : The transient component of the K current 2 | :Reference : : Voltage-gated K+ channels in layer 5 neocortical pyramidal neurones from young rats:subtypes and gradients,Korngreen and Sakmann, J. Physiology, 2000 3 | :Comment : shifted -10 mv to correct for junction potential 4 | :Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 5 | 6 | NEURON { 7 | SUFFIX K_Tst 8 | USEION k READ ek WRITE ik 9 | RANGE gK_Tstbar, gK_Tst, ik 10 | } 11 | 12 | UNITS { 13 | (S) = (siemens) 14 | (mV) = (millivolt) 15 | (mA) = (milliamp) 16 | } 17 | 18 | PARAMETER { 19 | gK_Tstbar = 0.00001 (S/cm2) 20 | } 21 | 22 | ASSIGNED { 23 | v (mV) 24 | ek (mV) 25 | ik (mA/cm2) 26 | gK_Tst (S/cm2) 27 | mInf 28 | mTau 29 | hInf 30 | hTau 31 | } 32 | 33 | STATE { 34 | m 35 | h 36 | } 37 | 38 | BREAKPOINT { 39 | SOLVE states METHOD cnexp 40 | gK_Tst = gK_Tstbar*(m^4)*h 41 | ik = gK_Tst*(v-ek) 42 | } 43 | 44 | DERIVATIVE states { 45 | rates() 46 | m' = (mInf-m)/mTau 47 | h' = (hInf-h)/hTau 48 | } 49 | 50 | INITIAL{ 51 | rates() 52 | m = mInf 53 | h = hInf 54 | } 55 | 56 | PROCEDURE rates(){ 57 | LOCAL qt 58 | qt = 2.3^((34-21)/10) 59 | 60 | UNITSOFF 61 | v = v + 10 62 | mInf = 1/(1 + exp(-(v+0)/19)) 63 | mTau = (0.34+0.92*exp(-((v+71)/59)^2))/qt 64 | hInf = 1/(1 + exp(-(v+66)/-10)) 65 | hTau = (8+49*exp(-((v+73)/23)^2))/qt 66 | v = v - 10 67 | UNITSON 68 | } 69 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/NaTa_t.mod: -------------------------------------------------------------------------------- 1 | :Reference :Colbert and Pan 2002 2 | 3 | NEURON { 4 | SUFFIX NaTa_t 5 | USEION na READ ena WRITE ina 6 | RANGE gNaTa_tbar, gNaTa_t, ina 7 | } 8 | 9 | UNITS { 10 | (S) = (siemens) 11 | (mV) = (millivolt) 12 | (mA) = (milliamp) 13 | } 14 | 15 | PARAMETER { 16 | gNaTa_tbar = 0.00001 (S/cm2) 17 | } 18 | 19 | ASSIGNED { 20 | v (mV) 21 | ena (mV) 22 | ina (mA/cm2) 23 | gNaTa_t (S/cm2) 24 | mInf 25 | mTau 26 | mAlpha 27 | mBeta 28 | hInf 29 | hTau 30 | hAlpha 31 | hBeta 32 | } 33 | 34 | STATE { 35 | m 36 | h 37 | } 38 | 39 | BREAKPOINT { 40 | SOLVE states METHOD cnexp 41 | gNaTa_t = gNaTa_tbar*m*m*m*h 42 | ina = gNaTa_t*(v-ena) 43 | } 44 | 45 | DERIVATIVE states { 46 | rates() 47 | m' = (mInf-m)/mTau 48 | h' = (hInf-h)/hTau 49 | } 50 | 51 | INITIAL{ 52 | rates() 53 | m = mInf 54 | h = hInf 55 | } 56 | 57 | PROCEDURE rates(){ 58 | LOCAL qt 59 | qt = 2.3^((34-21)/10) 60 | 61 | UNITSOFF 62 | if(v == -38){ 63 | v = v+0.0001 64 | } 65 | mAlpha = (0.182 * (v- -38))/(1-(exp(-(v- -38)/6))) 66 | mBeta = (0.124 * (-v -38))/(1-(exp(-(-v -38)/6))) 67 | mTau = (1/(mAlpha + mBeta))/qt 68 | mInf = mAlpha/(mAlpha + mBeta) 69 | 70 | if(v == -66){ 71 | v = v + 0.0001 72 | } 73 | 74 | hAlpha = (-0.015 * (v- -66))/(1-(exp((v- -66)/6))) 75 | hBeta = (-0.015 * (-v -66))/(1-(exp((-v -66)/6))) 76 | hTau = (1/(hAlpha + hBeta))/qt 77 | hInf = hAlpha/(hAlpha + hBeta) 78 | UNITSON 79 | } -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/NaTs2_t.mod: -------------------------------------------------------------------------------- 1 | :Reference :Colbert and Pan 2002 2 | :comment: took the NaTa and shifted both activation/inactivation by 6 mv 3 | 4 | NEURON { 5 | SUFFIX NaTs2_t 6 | USEION na READ ena WRITE ina 7 | RANGE gNaTs2_tbar, gNaTs2_t, ina 8 | } 9 | 10 | UNITS { 11 | (S) = (siemens) 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | } 15 | 16 | PARAMETER { 17 | gNaTs2_tbar = 0.00001 (S/cm2) 18 | } 19 | 20 | ASSIGNED { 21 | v (mV) 22 | ena (mV) 23 | ina (mA/cm2) 24 | gNaTs2_t (S/cm2) 25 | mInf 26 | mTau 27 | mAlpha 28 | mBeta 29 | hInf 30 | hTau 31 | hAlpha 32 | hBeta 33 | } 34 | 35 | STATE { 36 | m 37 | h 38 | } 39 | 40 | BREAKPOINT { 41 | SOLVE states METHOD cnexp 42 | gNaTs2_t = gNaTs2_tbar*m*m*m*h 43 | ina = gNaTs2_t*(v-ena) 44 | } 45 | 46 | DERIVATIVE states { 47 | rates() 48 | m' = (mInf-m)/mTau 49 | h' = (hInf-h)/hTau 50 | } 51 | 52 | INITIAL{ 53 | rates() 54 | m = mInf 55 | h = hInf 56 | } 57 | 58 | PROCEDURE rates(){ 59 | LOCAL qt 60 | qt = 2.3^((34-21)/10) 61 | 62 | UNITSOFF 63 | if(v == -32){ 64 | v = v+0.0001 65 | } 66 | mAlpha = (0.182 * (v- -32))/(1-(exp(-(v- -32)/6))) 67 | mBeta = (0.124 * (-v -32))/(1-(exp(-(-v -32)/6))) 68 | mInf = mAlpha/(mAlpha + mBeta) 69 | mTau = (1/(mAlpha + mBeta))/qt 70 | 71 | if(v == -60){ 72 | v = v + 0.0001 73 | } 74 | hAlpha = (-0.015 * (v- -60))/(1-(exp((v- -60)/6))) 75 | hBeta = (-0.015 * (-v -60))/(1-(exp((-v -60)/6))) 76 | hInf = hAlpha/(hAlpha + hBeta) 77 | hTau = (1/(hAlpha + hBeta))/qt 78 | UNITSON 79 | } -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/Nap_Et2.mod: -------------------------------------------------------------------------------- 1 | :Comment : mtau deduced from text (said to be 6 times faster than for NaTa) 2 | :Comment : so I used the equations from NaT and multiplied by 6 3 | :Reference : Modeled according to kinetics derived from Magistretti & Alonso 1999 4 | :Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 5 | 6 | NEURON { 7 | SUFFIX Nap_Et2 8 | USEION na READ ena WRITE ina 9 | RANGE gNap_Et2bar, gNap_Et2, ina 10 | } 11 | 12 | UNITS { 13 | (S) = (siemens) 14 | (mV) = (millivolt) 15 | (mA) = (milliamp) 16 | } 17 | 18 | PARAMETER { 19 | gNap_Et2bar = 0.00001 (S/cm2) 20 | } 21 | 22 | ASSIGNED { 23 | v (mV) 24 | ena (mV) 25 | ina (mA/cm2) 26 | gNap_Et2 (S/cm2) 27 | mInf 28 | mTau 29 | mAlpha 30 | mBeta 31 | hInf 32 | hTau 33 | hAlpha 34 | hBeta 35 | } 36 | 37 | STATE { 38 | m 39 | h 40 | } 41 | 42 | BREAKPOINT { 43 | SOLVE states METHOD cnexp 44 | gNap_Et2 = gNap_Et2bar*m*m*m*h 45 | ina = gNap_Et2*(v-ena) 46 | } 47 | 48 | DERIVATIVE states { 49 | rates() 50 | m' = (mInf-m)/mTau 51 | h' = (hInf-h)/hTau 52 | } 53 | 54 | INITIAL{ 55 | rates() 56 | m = mInf 57 | h = hInf 58 | } 59 | 60 | PROCEDURE rates(){ 61 | LOCAL qt 62 | qt = 2.3^((34-21)/10) 63 | 64 | UNITSOFF 65 | mInf = 1.0/(1+exp((v- -52.6)/-4.6)) 66 | if(v == -38){ 67 | v = v+0.0001 68 | } 69 | mAlpha = (0.182 * (v- -38))/(1-(exp(-(v- -38)/6))) 70 | mBeta = (0.124 * (-v -38))/(1-(exp(-(-v -38)/6))) 71 | mTau = 6*(1/(mAlpha + mBeta))/qt 72 | 73 | if(v == -17){ 74 | v = v + 0.0001 75 | } 76 | if(v == -64.4){ 77 | v = v+0.0001 78 | } 79 | 80 | hInf = 1.0/(1+exp((v- -48.8)/10)) 81 | hAlpha = -2.88e-6 * (v + 17) / (1 - exp((v + 17)/4.63)) 82 | hBeta = 6.94e-6 * (v + 64.4) / (1 - exp(-(v + 64.4)/2.63)) 83 | hTau = (1/(hAlpha + hBeta))/qt 84 | UNITSON 85 | } -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/ProbAMPA.mod: -------------------------------------------------------------------------------- 1 | TITLE AMPA receptor with presynaptic short-term plasticity 2 | 3 | COMMENT 4 | AMPA receptor conductance using a dual-exponential profile 5 | presynaptic short-term plasticity based on Fuhrmann et al, 2002 6 | Implemented by Srikanth Ramaswamy, Blue Brain Project, March 2009 ENDCOMMENT 7 | 8 | 9 | NEURON { 10 | THREADSAFE 11 | POINT_PROCESS ProbAMPA 12 | RANGE tau_r, tau_d 13 | RANGE Use, u, Dep, Fac, u0 14 | RANGE i, g, e 15 | NONSPECIFIC_CURRENT i 16 | } 17 | 18 | PARAMETER { 19 | tau_r = 0.2 (ms) : dual-exponential conductance profile 20 | tau_d = 1.7 (ms) : IMPORTANT: tau_r < tau_d 21 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 22 | Dep = 100 (ms) : relaxation time constant from depression 23 | Fac = 10 (ms) : relaxation time constant from facilitation 24 | e = 0 (mV) : AMPA reversal potential 25 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 26 | u0 = 0 :initial value of u, which is the running value of Use 27 | } 28 | 29 | COMMENT 30 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 31 | for comparison with Pr to decide whether to activate the synapse or not 32 | ENDCOMMENT 33 | 34 | VERBATIM 35 | #include 36 | #include 37 | #include 38 | 39 | float ranfAMPA(){ 40 | //double MAX = (double)RAND_MAX; 41 | double r = (rand() / (double) RAND_MAX); 42 | return r; 43 | } 44 | 45 | void SetSeedNowAMPA(){ 46 | #ifdef SYN_DEBUG 47 | srand(time(NULL)); 48 | #else 49 | srand(888); 50 | #endif 51 | return; 52 | } 53 | ENDVERBATIM 54 | 55 | 56 | ASSIGNED { 57 | v (mV) 58 | i (nA) 59 | g (uS) 60 | factor 61 | } 62 | 63 | STATE { 64 | A : state variable to construct the dual-exponential profile - decays with conductance tau_r 65 | B : state variable to construct the dual-exponential profile - decays with conductance tau_d 66 | } 67 | 68 | INITIAL{ 69 | LOCAL tp 70 | A = 0 71 | B = 0 72 | tp = (tau_r*tau_d)/(tau_d-tau_r)*log(tau_d/tau_r) :time to peak of the conductance 73 | factor = -exp(-tp/tau_r)+exp(-tp/tau_d) :Normalization factor - so that when t = tp, gsyn = gpeak 74 | factor = 1/factor 75 | SetSeedNowAMPA() 76 | } 77 | 78 | BREAKPOINT { 79 | SOLVE state METHOD cnexp 80 | g = gmax*(B-A) :compute time varying conductance as the difference of state variables B and A 81 | i = g*(v-e) :compute the driving force based on the time varying conductance, membrane potential, and AMPA reversal 82 | } 83 | 84 | DERIVATIVE state{ 85 | A' = -A/tau_r 86 | B' = -B/tau_d 87 | } 88 | 89 | 90 | NET_RECEIVE (weight, Pv, Pr, u, tsyn (ms)){ 91 | INITIAL{ 92 | Pv=1 93 | u=u0 94 | tsyn=t 95 | } 96 | 97 | : calc u at event- 98 | if (Fac > 0) { 99 | u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 100 | } else { 101 | u = Use 102 | } 103 | if(Fac > 0){ 104 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 105 | } 106 | 107 | 108 | Pv = 1 - (1-Pv) * exp(-(t-tsyn)/Dep) :Probability Pv for a vesicle to be available for release, analogous to the pool of synaptic 109 | :resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al. 110 | Pr = u * Pv :Pr is calculated as Pv * u (running value of Use) 111 | Pv = Pv - u * Pv :update Pv as per Eq. 3 in Fuhrmann et al. 112 | :printf("Pv = %g\n", Pv) 113 | :printf("Pr = %g\n", Pr) 114 | tsyn = t 115 | if (ranfAMPA() < Pr){ 116 | A = A + weight*factor 117 | B = B + weight*factor 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/ProbAMPANMDA.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | /** 3 | * @file ProbAMPANMDA.mod 4 | * @brief 5 | * @author king 6 | * @date 2010-03-03 7 | * @remark Copyright © BBP/EPFL 2005-2011; All rights reserved. Do not distribute without further notice. 8 | */ 9 | ENDCOMMENT 10 | 11 | TITLE AMPA and NMDA receptor with presynaptic short-term plasticity 12 | 13 | 14 | COMMENT 15 | AMPA and NMDA receptor conductance using a dual-exponential profile 16 | presynaptic short-term plasticity based on Fuhrmann et al. 2002 17 | ENDCOMMENT 18 | 19 | 20 | NEURON { 21 | THREADSAFE 22 | 23 | POINT_PROCESS ProbAMPANMDA 24 | RANGE tau_r_AMPA, tau_d_AMPA, tau_r_NMDA, tau_d_NMDA 25 | RANGE Use, u, Dep, Fac, u0, mg, NMDA_ratio 26 | RANGE i, i_AMPA, i_NMDA, g_AMPA, g_NMDA, g, e 27 | NONSPECIFIC_CURRENT i, i_AMPA,i_NMDA 28 | POINTER rng 29 | RANGE synapseID, verboseLevel 30 | } 31 | 32 | PARAMETER { 33 | 34 | tau_r_AMPA = 0.2 (ms) : dual-exponential conductance profile 35 | tau_d_AMPA = 1.7 (ms) : IMPORTANT: tau_r < tau_d 36 | tau_r_NMDA = 0.29 (ms) : dual-exponential conductance profile 37 | tau_d_NMDA = 43 (ms) : IMPORTANT: tau_r < tau_d 38 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 39 | Dep = 100 (ms) : relaxation time constant from depression 40 | Fac = 10 (ms) : relaxation time constant from facilitation 41 | e = 0 (mV) : AMPA and NMDA reversal potential 42 | mg = 1 (mM) : initial concentration of mg2+ 43 | mggate 44 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 45 | u0 = 0 :initial value of u, which is the running value of Use 46 | NMDA_ratio = 0.71 (1) : The ratio of NMDA to AMPA 47 | synapseID = 0 48 | verboseLevel = 0 49 | } 50 | 51 | COMMENT 52 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 53 | for comparison with Pr to decide whether to activate the synapse or not 54 | ENDCOMMENT 55 | 56 | VERBATIM 57 | 58 | #include 59 | #include 60 | #include 61 | 62 | double nrn_random_pick(void* r); 63 | void* nrn_random_arg(int argpos); 64 | 65 | ENDVERBATIM 66 | 67 | 68 | ASSIGNED { 69 | 70 | v (mV) 71 | i (nA) 72 | i_AMPA (nA) 73 | i_NMDA (nA) 74 | g_AMPA (uS) 75 | g_NMDA (uS) 76 | g (uS) 77 | factor_AMPA 78 | factor_NMDA 79 | rng 80 | } 81 | 82 | STATE { 83 | 84 | A_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_r_AMPA 85 | B_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_d_AMPA 86 | A_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_r_NMDA 87 | B_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_d_NMDA 88 | } 89 | 90 | INITIAL{ 91 | 92 | LOCAL tp_AMPA, tp_NMDA 93 | 94 | A_AMPA = 0 95 | B_AMPA = 0 96 | 97 | A_NMDA = 0 98 | B_NMDA = 0 99 | 100 | tp_AMPA = (tau_r_AMPA*tau_d_AMPA)/(tau_d_AMPA-tau_r_AMPA)*log(tau_d_AMPA/tau_r_AMPA) :time to peak of the conductance 101 | tp_NMDA = (tau_r_NMDA*tau_d_NMDA)/(tau_d_NMDA-tau_r_NMDA)*log(tau_d_NMDA/tau_r_NMDA) :time to peak of the conductance 102 | 103 | factor_AMPA = -exp(-tp_AMPA/tau_r_AMPA)+exp(-tp_AMPA/tau_d_AMPA) :AMPA Normalization factor - so that when t = tp_AMPA, gsyn = gpeak 104 | factor_AMPA = 1/factor_AMPA 105 | 106 | factor_NMDA = -exp(-tp_NMDA/tau_r_NMDA)+exp(-tp_NMDA/tau_d_NMDA) :NMDA Normalization factor - so that when t = tp_NMDA, gsyn = gpeak 107 | factor_NMDA = 1/factor_NMDA 108 | 109 | } 110 | 111 | BREAKPOINT { 112 | 113 | SOLVE state METHOD cnexp 114 | mggate = 1 / (1 + exp(0.062 (/mV) * -(v)) * (mg / 3.57 (mM))) :mggate kinetics - Jahr & Stevens 1990 115 | g_AMPA = gmax*(B_AMPA-A_AMPA) :compute time varying conductance as the difference of state variables B_AMPA and A_AMPA 116 | g_NMDA = gmax*(B_NMDA-A_NMDA) * mggate :compute time varying conductance as the difference of state variables B_NMDA and A_NMDA and mggate kinetics 117 | g = g_AMPA + g_NMDA 118 | i_AMPA = g_AMPA*(v-e) :compute the AMPA driving force based on the time varying conductance, membrane potential, and AMPA reversal 119 | i_NMDA = g_NMDA*(v-e) :compute the NMDA driving force based on the time varying conductance, membrane potential, and NMDA reversal 120 | i = i_AMPA + i_NMDA 121 | } 122 | 123 | DERIVATIVE state{ 124 | 125 | A_AMPA' = -A_AMPA/tau_r_AMPA 126 | B_AMPA' = -B_AMPA/tau_d_AMPA 127 | A_NMDA' = -A_NMDA/tau_r_NMDA 128 | B_NMDA' = -B_NMDA/tau_d_NMDA 129 | } 130 | 131 | 132 | NET_RECEIVE (weight,weight_AMPA, weight_NMDA, Pv, Pr, u, tsyn (ms)){ 133 | LOCAL result 134 | weight_AMPA = weight 135 | weight_NMDA = weight * NMDA_ratio 136 | 137 | INITIAL{ 138 | Pv=1 139 | u=u0 140 | tsyn=t 141 | } 142 | 143 | : calc u at event- 144 | if (Fac > 0) { 145 | u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 146 | } else { 147 | u = Use 148 | } 149 | if(Fac > 0){ 150 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 151 | } 152 | 153 | 154 | Pv = 1 - (1-Pv) * exp(-(t-tsyn)/Dep) :Probability Pv for a vesicle to be available for release, analogous to the pool of synaptic 155 | :resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al. 156 | Pr = u * Pv :Pr is calculated as Pv * u (running value of Use) 157 | Pv = Pv - u * Pv :update Pv as per Eq. 3 in Fuhrmann et al. 158 | result = erand() : throw the random number 159 | 160 | if( verboseLevel > 0 ) { 161 | printf("Synapse %f at time %g: Pv = %g Pr = %g erand = %g\n", synapseID, t, Pv, Pr, result ) 162 | } 163 | 164 | tsyn = t 165 | 166 | if (result < Pr) { 167 | A_AMPA = A_AMPA + weight_AMPA*factor_AMPA 168 | B_AMPA = B_AMPA + weight_AMPA*factor_AMPA 169 | A_NMDA = A_NMDA + weight_NMDA*factor_NMDA 170 | B_NMDA = B_NMDA + weight_NMDA*factor_NMDA 171 | 172 | if( verboseLevel > 0 ) { 173 | printf( " vals %g %g %g %g\n", A_AMPA, weight_AMPA, factor_AMPA, weight ) 174 | } 175 | } 176 | } 177 | 178 | PROCEDURE setRNG() { 179 | VERBATIM 180 | { 181 | /** 182 | * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file. 183 | * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod 184 | * which points out that the Random must be in negexp(1) mode 185 | */ 186 | void** pv = (void**)(&_p_rng); 187 | if( ifarg(1)) { 188 | *pv = nrn_random_arg(1); 189 | } else { 190 | *pv = (void*)0; 191 | } 192 | } 193 | ENDVERBATIM 194 | } 195 | 196 | FUNCTION erand() { 197 | VERBATIM 198 | double value; 199 | if (_p_rng) { 200 | /* 201 | :Supports separate independent but reproducible streams for 202 | : each instance. However, the corresponding hoc Random 203 | : distribution MUST be set to Random.negexp(1) 204 | */ 205 | value = nrn_random_pick(_p_rng); 206 | //printf("random stream for this simulation = %lf\n",value); 207 | return value; 208 | }else{ 209 | ENDVERBATIM 210 | : the old standby. Cannot use if reproducible parallel sim 211 | : independent of nhost or which host this instance is on 212 | : is desired, since each instance on this cpu draws from 213 | : the same stream 214 | erand = exprand(1) 215 | VERBATIM 216 | } 217 | ENDVERBATIM 218 | erand = value 219 | } 220 | 221 | FUNCTION toggleVerbose() { 222 | verboseLevel = 1-verboseLevel 223 | } 224 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/ProbAMPANMDA2_ratio.mod: -------------------------------------------------------------------------------- 1 | TITLE AMPA and NMDA receptor with presynaptic short-term plasticity 2 | 3 | 4 | COMMENT 5 | AMPA and NMDA receptor conductance using a dual-exponential profile 6 | presynaptic short-term plasticity based on Fuhrmann et al. 2002 7 | Implemented by Srikanth Ramaswamy, Blue Brain Project, July 2009 8 | Etay: changed weight to be equal for NMDA and AMPA, gmax accessible in Neuron 9 | 10 | ENDCOMMENT 11 | 12 | 13 | NEURON { 14 | 15 | POINT_PROCESS ProbAMPANMDA2_RATIO 16 | RANGE tau_r_AMPA, tau_d_AMPA, tau_r_NMDA, tau_d_NMDA 17 | RANGE Use, u, Dep, Fac, u0, weight_NMDA 18 | RANGE i, i_AMPA, i_NMDA, g_AMPA, g_NMDA, e, gmax, mgVoltageCoeff 19 | NONSPECIFIC_CURRENT i 20 | POINTER rng 21 | } 22 | 23 | PARAMETER { 24 | 25 | tau_r_AMPA = 0.2 (ms) : dual-exponential conductance profile 26 | tau_d_AMPA = 1.7 (ms) : IMPORTANT: tau_r < tau_d 27 | tau_r_NMDA = 2.04 (ms) : dual-exponential conductance profile 28 | tau_d_NMDA = 75.2 (ms) : IMPORTANT: tau_r < tau_d 29 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 30 | Dep = 100 (ms) : relaxation time constant from depression 31 | Fac = 10 (ms) : relaxation time constant from facilitation 32 | e = 0 (mV) : AMPA and NMDA reversal potential 33 | mg = 1 (mM) : initial concentration of mg2+ 34 | mgVoltageCoeff = 0.08 (mV) : the coefficient for the voltage dependance of the equation 35 | mggate 36 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 37 | u0 = 0 :initial value of u, which is the running value of Use 38 | } 39 | 40 | COMMENT 41 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 42 | for comparison with Pr to decide whether to activate the synapse or not 43 | ENDCOMMENT 44 | 45 | VERBATIM 46 | 47 | #include 48 | #include 49 | #include 50 | 51 | double nrn_random_pick(void* r); 52 | void* nrn_random_arg(int argpos); 53 | 54 | ENDVERBATIM 55 | 56 | 57 | ASSIGNED { 58 | 59 | v (mV) 60 | i (nA) 61 | i_AMPA (nA) 62 | i_NMDA (nA) 63 | g_AMPA (uS) 64 | g_NMDA (uS) 65 | factor_AMPA 66 | factor_NMDA 67 | rng 68 | weight_NMDA 69 | a 70 | } 71 | 72 | STATE { 73 | 74 | A_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_r_AMPA 75 | B_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_d_AMPA 76 | A_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_r_NMDA 77 | B_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_d_NMDA 78 | } 79 | 80 | INITIAL{ 81 | 82 | LOCAL tp_AMPA, tp_NMDA 83 | 84 | A_AMPA = 0 85 | B_AMPA = 0 86 | 87 | A_NMDA = 0 88 | B_NMDA = 0 89 | 90 | tp_AMPA = (tau_r_AMPA*tau_d_AMPA)/(tau_d_AMPA-tau_r_AMPA)*log(tau_d_AMPA/tau_r_AMPA) :time to peak of the conductance 91 | tp_NMDA = (tau_r_NMDA*tau_d_NMDA)/(tau_d_NMDA-tau_r_NMDA)*log(tau_d_NMDA/tau_r_NMDA) :time to peak of the conductance 92 | 93 | factor_AMPA = -exp(-tp_AMPA/tau_r_AMPA)+exp(-tp_AMPA/tau_d_AMPA) :AMPA Normalization factor - so that when t = tp_AMPA, gsyn = gpeak 94 | factor_AMPA = 1/factor_AMPA 95 | 96 | factor_NMDA = -exp(-tp_NMDA/tau_r_NMDA)+exp(-tp_NMDA/tau_d_NMDA) :NMDA Normalization factor - so that when t = tp_NMDA, gsyn = gpeak 97 | factor_NMDA = 1/factor_NMDA 98 | 99 | } 100 | 101 | BREAKPOINT { 102 | 103 | SOLVE state METHOD cnexp 104 | mggate = 1 / (1 + exp(mgVoltageCoeff * -(v)) * (mg / 3.57 (mM))) :mggate kinetics - Jahr & Stevens 1990 105 | g_AMPA = (1) * gmax * (B_AMPA-A_AMPA) :compute time varying conductance as the difference of state variables B_AMPA and A_AMPA 106 | g_NMDA = gmax*(B_NMDA-A_NMDA) * mggate :compute time varying conductance as the difference of state variables B_NMDA and A_NMDA and mggate kinetics 107 | i_AMPA = g_AMPA*(v-e) :compute the AMPA driving force based on the time varying conductance, membrane potential, and AMPA reversal 108 | i_NMDA = g_NMDA*(v-e) :compute the NMDA driving force based on the time varying conductance, membrane potential, and NMDA reversal 109 | i = i_AMPA + i_NMDA 110 | } 111 | 112 | DERIVATIVE state{ 113 | 114 | A_AMPA' = -A_AMPA/tau_r_AMPA 115 | B_AMPA' = -B_AMPA/tau_d_AMPA 116 | A_NMDA' = -A_NMDA/tau_r_NMDA 117 | B_NMDA' = -B_NMDA/tau_d_NMDA 118 | } 119 | 120 | 121 | NET_RECEIVE (weight,weight_AMPA, weight_NMDA, Pv, Pr, u, tsyn (ms)){ 122 | 123 | weight_AMPA = weight 124 | weight_NMDA = weight 125 | :printf("NMDA weight = %g\n", weight_NMDA) 126 | 127 | INITIAL{ 128 | Pv=1 129 | u=u0 130 | tsyn=t 131 | } 132 | 133 | : calc u at event- 134 | if (Fac > 0) { 135 | u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 136 | } else { 137 | u = Use 138 | } 139 | if(Fac > 0){ 140 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 141 | } 142 | 143 | 144 | Pv = 1 - (1-Pv) * exp(-(t-tsyn)/Dep) :Probability Pv for a vesicle to be available for release, analogous to the pool of synaptic 145 | :resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al. 146 | Pr = u * Pv :Pr is calculated as Pv * u (running value of Use) 147 | Pv = Pv - u * Pv :update Pv as per Eq. 3 in Fuhrmann et al. 148 | :printf("Pv = %g\n", Pv) 149 | :printf("Pr = %g\n", Pr) 150 | tsyn = t 151 | 152 | A_AMPA = A_AMPA + weight_AMPA*factor_AMPA 153 | B_AMPA = B_AMPA + weight_AMPA*factor_AMPA 154 | A_NMDA = A_NMDA + weight_NMDA*factor_NMDA 155 | B_NMDA = B_NMDA + weight_NMDA*factor_NMDA 156 | 157 | } 158 | 159 | PROCEDURE setRNG() { 160 | VERBATIM 161 | { 162 | /** 163 | * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file. 164 | * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod 165 | * which points out that the Random must be in negexp(1) mode 166 | */ 167 | void** pv = (void**)(&_p_rng); 168 | if( ifarg(1)) { 169 | *pv = nrn_random_arg(1); 170 | } else { 171 | *pv = (void*)0; 172 | } 173 | } 174 | ENDVERBATIM 175 | } 176 | 177 | FUNCTION erand() { 178 | VERBATIM 179 | //FILE *fi; 180 | double value; 181 | if (_p_rng) { 182 | /* 183 | :Supports separate independent but reproducible streams for 184 | : each instance. However, the corresponding hoc Random 185 | : distribution MUST be set to Random.negexp(1) 186 | */ 187 | value = nrn_random_pick(_p_rng); 188 | //fi = fopen("RandomStreamMCellRan4.txt", "w"); 189 | //fprintf(fi,"random stream for this simulation = %lf\n",value); 190 | //printf("random stream for this simulation = %lf\n",value); 191 | return value; 192 | }else{ 193 | ENDVERBATIM 194 | : the old standby. Cannot use if reproducible parallel sim 195 | : independent of nhost or which host this instance is on 196 | : is desired, since each instance on this cpu draws from 197 | : the same stream 198 | erand = exprand(1) 199 | VERBATIM 200 | } 201 | ENDVERBATIM 202 | erand = value 203 | } 204 | 205 | 206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/ProbAMPANMDA_EMS.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | /** 3 | * @file ProbAMPANMDA_EMS.mod 4 | * @brief 5 | * @author king, muller, reimann, ramaswamy 6 | * @date 2011-08-17 7 | * @remark Copyright © BBP/EPFL 2005-2011; All rights reserved. Do not distribute without further notice. 8 | */ 9 | ENDCOMMENT 10 | 11 | TITLE Probabilistic AMPA and NMDA receptor with presynaptic short-term plasticity 12 | 13 | 14 | COMMENT 15 | AMPA and NMDA receptor conductance using a dual-exponential profile 16 | presynaptic short-term plasticity as in Fuhrmann et al. 2002 17 | 18 | _EMS (Eilif Michael Srikanth) 19 | Modification of ProbAMPANMDA: 2-State model by Eilif Muller, Michael Reimann, Srikanth Ramaswamy, Blue Brain Project, August 2011 20 | This new model was motivated by the following constraints: 21 | 22 | 1) No consumption on failure. 23 | 2) No release just after release until recovery. 24 | 3) Same ensemble averaged trace as deterministic/canonical Tsodyks-Markram 25 | using same parameters determined from experiment. 26 | 4) Same quantal size as present production probabilistic model. 27 | 28 | To satisfy these constaints, the synapse is implemented as a 29 | uni-vesicular (generalization to multi-vesicular should be 30 | straight-forward) 2-state Markov process. The states are 31 | {1=recovered, 0=unrecovered}. 32 | 33 | For a pre-synaptic spike or external spontaneous release trigger 34 | event, the synapse will only release if it is in the recovered state, 35 | and with probability u (which follows facilitation dynamics). If it 36 | releases, it will transition to the unrecovered state. Recovery is as 37 | a Poisson process with rate 1/Dep. 38 | 39 | This model satisys all of (1)-(4). 40 | 41 | 42 | ENDCOMMENT 43 | 44 | 45 | NEURON { 46 | THREADSAFE 47 | POINT_PROCESS ProbAMPANMDA_EMS 48 | RANGE tau_r_AMPA, tau_d_AMPA, tau_r_NMDA, tau_d_NMDA 49 | RANGE Use, u, Dep, Fac, u0, mg, Rstate, tsyn_fac, u 50 | RANGE i, i_AMPA, i_NMDA, g_AMPA, g_NMDA, g, e, NMDA_ratio 51 | RANGE A_AMPA_step, B_AMPA_step, A_NMDA_step, B_NMDA_step 52 | NONSPECIFIC_CURRENT i 53 | POINTER rng 54 | RANGE synapseID, verboseLevel 55 | } 56 | 57 | PARAMETER { 58 | 59 | 60 | tau_r_AMPA = 0.2 (ms) : dual-exponential conductance profile 61 | tau_d_AMPA = 1.7 (ms) : IMPORTANT: tau_r < tau_d 62 | tau_r_NMDA = 0.29 (ms) : dual-exponential conductance profile 63 | tau_d_NMDA = 43 (ms) : IMPORTANT: tau_r < tau_d 64 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 65 | Dep = 100 (ms) : relaxation time constant from depression 66 | Fac = 10 (ms) : relaxation time constant from facilitation 67 | e = 0 (mV) : AMPA and NMDA reversal potential 68 | mg = 1 (mM) : initial concentration of mg2+ 69 | mggate 70 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 71 | u0 = 0 :initial value of u, which is the running value of release probability 72 | synapseID = 0 73 | verboseLevel = 0 74 | NMDA_ratio = 0.71 (1) : The ratio of NMDA to AMPA 75 | } 76 | 77 | COMMENT 78 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 79 | for comparison with Pr to decide whether to activate the synapse or not 80 | ENDCOMMENT 81 | 82 | VERBATIM 83 | 84 | #include 85 | #include 86 | #include 87 | 88 | double nrn_random_pick(void* r); 89 | void* nrn_random_arg(int argpos); 90 | 91 | ENDVERBATIM 92 | 93 | 94 | ASSIGNED { 95 | 96 | v (mV) 97 | i (nA) 98 | i_AMPA (nA) 99 | i_NMDA (nA) 100 | g_AMPA (uS) 101 | g_NMDA (uS) 102 | g (uS) 103 | factor_AMPA 104 | factor_NMDA 105 | A_AMPA_step 106 | B_AMPA_step 107 | A_NMDA_step 108 | B_NMDA_step 109 | rng 110 | 111 | : Recording these three, you can observe full state of model 112 | : tsyn_fac gives you presynaptic times, Rstate gives you 113 | : state transitions, 114 | : u gives you the "release probability" at transitions 115 | : (attention: u is event based based, so only valid at incoming events) 116 | Rstate (1) : recovered state {0=unrecovered, 1=recovered} 117 | tsyn_fac (ms) : the time of the last spike 118 | u (1) : running release probability 119 | 120 | } 121 | 122 | STATE { 123 | 124 | A_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_r_AMPA 125 | B_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_d_AMPA 126 | A_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_r_NMDA 127 | B_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_d_NMDA 128 | } 129 | 130 | INITIAL{ 131 | 132 | LOCAL tp_AMPA, tp_NMDA 133 | 134 | Rstate=1 135 | tsyn_fac=0 136 | u=u0 137 | 138 | A_AMPA = 0 139 | B_AMPA = 0 140 | 141 | A_NMDA = 0 142 | B_NMDA = 0 143 | 144 | tp_AMPA = (tau_r_AMPA*tau_d_AMPA)/(tau_d_AMPA-tau_r_AMPA)*log(tau_d_AMPA/tau_r_AMPA) :time to peak of the conductance 145 | tp_NMDA = (tau_r_NMDA*tau_d_NMDA)/(tau_d_NMDA-tau_r_NMDA)*log(tau_d_NMDA/tau_r_NMDA) :time to peak of the conductance 146 | 147 | factor_AMPA = -exp(-tp_AMPA/tau_r_AMPA)+exp(-tp_AMPA/tau_d_AMPA) :AMPA Normalization factor - so that when t = tp_AMPA, gsyn = gpeak 148 | factor_AMPA = 1/factor_AMPA 149 | 150 | factor_NMDA = -exp(-tp_NMDA/tau_r_NMDA)+exp(-tp_NMDA/tau_d_NMDA) :NMDA Normalization factor - so that when t = tp_NMDA, gsyn = gpeak 151 | factor_NMDA = 1/factor_NMDA 152 | 153 | A_AMPA_step = exp(dt*(( - 1.0 ) / tau_r_AMPA)) 154 | B_AMPA_step = exp(dt*(( - 1.0 ) / tau_d_AMPA)) 155 | A_NMDA_step = exp(dt*(( - 1.0 ) / tau_r_NMDA)) 156 | B_NMDA_step = exp(dt*(( - 1.0 ) / tau_d_NMDA)) 157 | } 158 | 159 | BREAKPOINT { 160 | 161 | SOLVE state 162 | mggate = 1 / (1 + exp(0.062 (/mV) * -(v)) * (mg / 3.57 (mM))) :mggate kinetics - Jahr & Stevens 1990 163 | g_AMPA = gmax*(B_AMPA-A_AMPA) :compute time varying conductance as the difference of state variables B_AMPA and A_AMPA 164 | g_NMDA = gmax*(B_NMDA-A_NMDA) * mggate :compute time varying conductance as the difference of state variables B_NMDA and A_NMDA and mggate kinetics 165 | g = g_AMPA + g_NMDA 166 | i_AMPA = g_AMPA*(v-e) :compute the AMPA driving force based on the time varying conductance, membrane potential, and AMPA reversal 167 | i_NMDA = g_NMDA*(v-e) :compute the NMDA driving force based on the time varying conductance, membrane potential, and NMDA reversal 168 | i = i_AMPA + i_NMDA 169 | } 170 | 171 | PROCEDURE state() { 172 | A_AMPA = A_AMPA*A_AMPA_step 173 | B_AMPA = B_AMPA*B_AMPA_step 174 | A_NMDA = A_NMDA*A_NMDA_step 175 | B_NMDA = B_NMDA*B_NMDA_step 176 | } 177 | 178 | 179 | NET_RECEIVE (weight,weight_AMPA, weight_NMDA, Psurv, tsyn (ms)){ 180 | LOCAL result 181 | weight_AMPA = weight 182 | weight_NMDA = weight * NMDA_ratio 183 | : Locals: 184 | : Psurv - survival probability of unrecovered state 185 | : tsyn - time since last surival evaluation. 186 | 187 | INITIAL{ 188 | tsyn=t 189 | } 190 | 191 | : Do not perform any calculations if the synapse (netcon) is deactivated. This avoids drawing from the random stream 192 | if( !(weight > 0) ) { 193 | VERBATIM 194 | return; 195 | ENDVERBATIM 196 | } 197 | 198 | : calc u at event- 199 | if (Fac > 0) { 200 | u = u*exp(-(t - tsyn_fac)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 201 | } else { 202 | u = Use 203 | } 204 | if(Fac > 0){ 205 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 206 | } 207 | 208 | : tsyn_fac knows about all spikes, not only those that released 209 | : i.e. each spike can increase the u, regardless of recovered state. 210 | tsyn_fac = t 211 | 212 | : recovery 213 | 214 | if (Rstate == 0) { 215 | : probability of survival of unrecovered state based on Poisson recovery with rate 1/tau 216 | Psurv = exp(-(t-tsyn)/Dep) 217 | result = urand() 218 | if (result>Psurv) { 219 | Rstate = 1 : recover 220 | 221 | if( verboseLevel > 0 ) { 222 | printf( "Recovered! %f at time %g: Psurv = %g, urand=%g\n", synapseID, t, Psurv, result ) 223 | } 224 | 225 | } 226 | else { 227 | : survival must now be from this interval 228 | tsyn = t 229 | if( verboseLevel > 0 ) { 230 | printf( "Failed to recover! %f at time %g: Psurv = %g, urand=%g\n", synapseID, t, Psurv, result ) 231 | } 232 | } 233 | } 234 | 235 | if (Rstate == 1) { 236 | result = urand() 237 | if (result 0 ) { 247 | printf( "Release! %f at time %g: vals %g %g %g %g\n", synapseID, t, A_AMPA, weight_AMPA, factor_AMPA, weight ) 248 | } 249 | 250 | } 251 | else { 252 | if( verboseLevel > 0 ) { 253 | printf("Failure! %f at time %g: urand = %g\n", synapseID, t, result ) 254 | } 255 | 256 | } 257 | 258 | } 259 | 260 | } 261 | 262 | PROCEDURE setRNG() { 263 | VERBATIM 264 | { 265 | /** 266 | * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file. 267 | * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod 268 | * which points out that the Random must be in uniform(1) mode 269 | */ 270 | void** pv = (void**)(&_p_rng); 271 | if( ifarg(1)) { 272 | *pv = nrn_random_arg(1); 273 | } else { 274 | *pv = (void*)0; 275 | } 276 | } 277 | ENDVERBATIM 278 | } 279 | 280 | FUNCTION urand() { 281 | VERBATIM 282 | double value; 283 | if (_p_rng) { 284 | /* 285 | :Supports separate independent but reproducible streams for 286 | : each instance. However, the corresponding hoc Random 287 | : distribution MUST be set to Random.negexp(1) 288 | */ 289 | value = nrn_random_pick(_p_rng); 290 | //printf("random stream for this simulation = %lf\n",value); 291 | return value; 292 | }else{ 293 | ENDVERBATIM 294 | : the old standby. Cannot use if reproducible parallel sim 295 | : independent of nhost or which host this instance is on 296 | : is desired, since each instance on this cpu draws from 297 | : the same stream 298 | value = scop_random(1) 299 | VERBATIM 300 | } 301 | ENDVERBATIM 302 | urand = value 303 | } 304 | 305 | FUNCTION toggleVerbose() { 306 | verboseLevel = 1-verboseLevel 307 | } 308 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/ProbGABAA.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | /** 3 | * @file ProbGABAA.mod 4 | * @brief 5 | * @author king 6 | * @date 2010-03-03 7 | * @remark Copyright © BBP/EPFL 2005-2011; All rights reserved. Do not distribute without further notice. 8 | */ 9 | ENDCOMMENT 10 | 11 | TITLE GABAA receptor with presynaptic short-term plasticity 12 | 13 | 14 | COMMENT 15 | GABAA receptor conductance using a dual-exponential profile 16 | presynaptic short-term plasticity based on Fuhrmann et al, 2002 17 | Implemented by Srikanth Ramaswamy, Blue Brain Project, March 2009 18 | ENDCOMMENT 19 | 20 | 21 | NEURON { 22 | THREADSAFE 23 | POINT_PROCESS ProbGABAA 24 | RANGE tau_r, tau_d 25 | RANGE Use, u, Dep, Fac, u0 26 | RANGE i, g, e 27 | NONSPECIFIC_CURRENT i 28 | POINTER rng 29 | RANGE synapseID, verboseLevel 30 | } 31 | 32 | PARAMETER { 33 | tau_r = 0.2 (ms) : dual-exponential conductance profile 34 | tau_d = 8 (ms) : IMPORTANT: tau_r < tau_d 35 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 36 | Dep = 100 (ms) : relaxation time constant from depression 37 | Fac = 10 (ms) : relaxation time constant from facilitation 38 | e = -80 (mV) : GABAA reversal potential 39 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 40 | u0 = 0 :initial value of u, which is the running value of Use 41 | synapseID = 0 42 | verboseLevel = 0 43 | } 44 | 45 | COMMENT 46 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 47 | for comparison with Pr to decide whether to activate the synapse or not 48 | ENDCOMMENT 49 | 50 | VERBATIM 51 | #include 52 | #include 53 | #include 54 | 55 | double nrn_random_pick(void* r); 56 | void* nrn_random_arg(int argpos); 57 | 58 | ENDVERBATIM 59 | 60 | 61 | ASSIGNED { 62 | v (mV) 63 | i (nA) 64 | g (uS) 65 | factor 66 | rng 67 | } 68 | 69 | STATE { 70 | A : state variable to construct the dual-exponential profile - decays with conductance tau_r 71 | B : state variable to construct the dual-exponential profile - decays with conductance tau_d 72 | } 73 | 74 | INITIAL{ 75 | LOCAL tp 76 | A = 0 77 | B = 0 78 | tp = (tau_r*tau_d)/(tau_d-tau_r)*log(tau_d/tau_r) :time to peak of the conductance 79 | factor = -exp(-tp/tau_r)+exp(-tp/tau_d) :Normalization factor - so that when t = tp, gsyn = gpeak 80 | factor = 1/factor 81 | } 82 | 83 | BREAKPOINT { 84 | SOLVE state METHOD cnexp 85 | g = gmax*(B-A) :compute time varying conductance as the difference of state variables B and A 86 | i = g*(v-e) :compute the driving force based on the time varying conductance, membrane potential, and GABAA reversal 87 | } 88 | 89 | DERIVATIVE state{ 90 | A' = -A/tau_r 91 | B' = -B/tau_d 92 | } 93 | 94 | 95 | NET_RECEIVE (weight, Pv, Pr, u, tsyn (ms)){ 96 | LOCAL result 97 | INITIAL{ 98 | Pv=1 99 | u=u0 100 | tsyn=t 101 | } 102 | 103 | : calc u at event- 104 | if (Fac > 0) { 105 | u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 106 | } else { 107 | u = Use 108 | } 109 | if(Fac > 0) { 110 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 111 | } 112 | 113 | 114 | Pv = 1 - (1-Pv) * exp(-(t-tsyn)/Dep) :Probability Pv for a vesicle to be available for release, analogous to the pool of synaptic 115 | :resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al. 116 | Pr = u * Pv :Pr is calculated as Pv * u (running value of Use) 117 | Pv = Pv - u * Pv :update Pv as per Eq. 3 in Fuhrmann et al. 118 | result = erand() : throw the random number 119 | 120 | if( verboseLevel > 0 ) { 121 | printf("Synapse %f at time %g: Pv = %g Pr = %g erand = %g\n", synapseID, t, Pv, Pr, result ) 122 | } 123 | 124 | tsyn = t 125 | if (result < Pr) { 126 | A = A + weight*factor 127 | B = B + weight*factor 128 | 129 | if( verboseLevel > 0 ) { 130 | printf( " vals %g %g %g %g\n", A, B, weight, factor ) 131 | } 132 | } 133 | } 134 | 135 | PROCEDURE setRNG() { 136 | VERBATIM 137 | { 138 | /** 139 | * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file. 140 | * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod 141 | */ 142 | void** pv = (void**)(&_p_rng); 143 | if( ifarg(1)) { 144 | *pv = nrn_random_arg(1); 145 | } else { 146 | *pv = (void*)0; 147 | } 148 | } 149 | ENDVERBATIM 150 | } 151 | 152 | FUNCTION erand() { 153 | VERBATIM 154 | double value; 155 | if (_p_rng) { 156 | /* 157 | :Supports separate independent but reproducible streams for 158 | : each instance. However, the corresponding hoc Random 159 | : distribution MUST be set to Random.negexp(1) 160 | */ 161 | value = nrn_random_pick(_p_rng); 162 | //printf("random stream for this simulation = %lf\n",value); 163 | return value; 164 | }else{ 165 | ENDVERBATIM 166 | : the old standby. Cannot use if reproducible parallel sim 167 | : independent of nhost or which host this instance is on 168 | : is desired, since each instance on this cpu draws from 169 | : the same stream 170 | erand = exprand(1) 171 | VERBATIM 172 | } 173 | ENDVERBATIM 174 | erand = value 175 | } 176 | 177 | FUNCTION toggleVerbose() { 178 | verboseLevel = 1 - verboseLevel 179 | } 180 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/ProbGABAAB_EMS.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | /** 3 | * @file ProbGABAAB.mod 4 | * @brief 5 | * @author king, muller 6 | * @date 2011-08-17 7 | * @remark Copyright © BBP/EPFL 2005-2011; All rights reserved. Do not distribute without further notice. 8 | */ 9 | ENDCOMMENT 10 | 11 | TITLE GABAAB receptor with presynaptic short-term plasticity 12 | 13 | 14 | COMMENT 15 | GABAA receptor conductance using a dual-exponential profile 16 | presynaptic short-term plasticity based on Fuhrmann et al, 2002 17 | Implemented by Srikanth Ramaswamy, Blue Brain Project, March 2009 18 | 19 | _EMS (Eilif Michael Srikanth) 20 | Modification of ProbGABAA: 2-State model by Eilif Muller, Michael Reimann, Srikanth Ramaswamy, Blue Brain Project, August 2011 21 | This new model was motivated by the following constraints: 22 | 23 | 1) No consumption on failure. 24 | 2) No release just after release until recovery. 25 | 3) Same ensemble averaged trace as deterministic/canonical Tsodyks-Markram 26 | using same parameters determined from experiment. 27 | 4) Same quantal size as present production probabilistic model. 28 | 29 | To satisfy these constaints, the synapse is implemented as a 30 | uni-vesicular (generalization to multi-vesicular should be 31 | straight-forward) 2-state Markov process. The states are 32 | {1=recovered, 0=unrecovered}. 33 | 34 | For a pre-synaptic spike or external spontaneous release trigger 35 | event, the synapse will only release if it is in the recovered state, 36 | and with probability u (which follows facilitation dynamics). If it 37 | releases, it will transition to the unrecovered state. Recovery is as 38 | a Poisson process with rate 1/Dep. 39 | 40 | This model satisys all of (1)-(4). 41 | 42 | 43 | ENDCOMMENT 44 | 45 | 46 | NEURON { 47 | THREADSAFE 48 | POINT_PROCESS ProbGABAAB_EMS 49 | RANGE tau_r_GABAA, tau_d_GABAA, tau_r_GABAB, tau_d_GABAB 50 | RANGE Use, u, Dep, Fac, u0, Rstate, tsyn_fac, u 51 | RANGE i,i_GABAA, i_GABAB, g_GABAA, g_GABAB, g, e_GABAA, e_GABAB, GABAB_ratio 52 | RANGE A_GABAA_step, B_GABAA_step, A_GABAB_step, B_GABAB_step 53 | NONSPECIFIC_CURRENT i 54 | POINTER rng 55 | RANGE synapseID, verboseLevel 56 | } 57 | 58 | PARAMETER { 59 | tau_r_GABAA = 0.2 (ms) : dual-exponential conductance profile 60 | tau_d_GABAA = 8 (ms) : IMPORTANT: tau_r < tau_d 61 | tau_r_GABAB = 3.5 (ms) : dual-exponential conductance profile :Placeholder value from hippocampal recordings SR 62 | tau_d_GABAB = 260.9 (ms) : IMPORTANT: tau_r < tau_d :Placeholder value from hippocampal recordings 63 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 64 | Dep = 100 (ms) : relaxation time constant from depression 65 | Fac = 10 (ms) : relaxation time constant from facilitation 66 | e_GABAA = -80 (mV) : GABAA reversal potential 67 | e_GABAB = -97 (mV) : GABAB reversal potential 68 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 69 | u0 = 0 :initial value of u, which is the running value of release probability 70 | synapseID = 0 71 | verboseLevel = 0 72 | GABAB_ratio = 0 (1) : The ratio of GABAB to GABAA 73 | } 74 | 75 | COMMENT 76 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 77 | for comparison with Pr to decide whether to activate the synapse or not 78 | ENDCOMMENT 79 | 80 | VERBATIM 81 | #include 82 | #include 83 | #include 84 | 85 | double nrn_random_pick(void* r); 86 | void* nrn_random_arg(int argpos); 87 | 88 | ENDVERBATIM 89 | 90 | 91 | ASSIGNED { 92 | v (mV) 93 | i (nA) 94 | i_GABAA (nA) 95 | i_GABAB (nA) 96 | g_GABAA (uS) 97 | g_GABAB (uS) 98 | A_GABAA_step 99 | B_GABAA_step 100 | A_GABAB_step 101 | B_GABAB_step 102 | g (uS) 103 | factor_GABAA 104 | factor_GABAB 105 | rng 106 | 107 | : Recording these three, you can observe full state of model 108 | : tsyn_fac gives you presynaptic times, Rstate gives you 109 | : state transitions, 110 | : u gives you the "release probability" at transitions 111 | : (attention: u is event based based, so only valid at incoming events) 112 | Rstate (1) : recovered state {0=unrecovered, 1=recovered} 113 | tsyn_fac (ms) : the time of the last spike 114 | u (1) : running release probability 115 | 116 | 117 | } 118 | 119 | STATE { 120 | A_GABAA : GABAA state variable to construct the dual-exponential profile - decays with conductance tau_r_GABAA 121 | B_GABAA : GABAA state variable to construct the dual-exponential profile - decays with conductance tau_d_GABAA 122 | A_GABAB : GABAB state variable to construct the dual-exponential profile - decays with conductance tau_r_GABAB 123 | B_GABAB : GABAB state variable to construct the dual-exponential profile - decays with conductance tau_d_GABAB 124 | } 125 | 126 | INITIAL{ 127 | 128 | LOCAL tp_GABAA, tp_GABAB 129 | 130 | Rstate=1 131 | tsyn_fac=0 132 | u=u0 133 | 134 | A_GABAA = 0 135 | B_GABAA = 0 136 | 137 | A_GABAB = 0 138 | B_GABAB = 0 139 | 140 | tp_GABAA = (tau_r_GABAA*tau_d_GABAA)/(tau_d_GABAA-tau_r_GABAA)*log(tau_d_GABAA/tau_r_GABAA) :time to peak of the conductance 141 | tp_GABAB = (tau_r_GABAB*tau_d_GABAB)/(tau_d_GABAB-tau_r_GABAB)*log(tau_d_GABAB/tau_r_GABAB) :time to peak of the conductance 142 | 143 | factor_GABAA = -exp(-tp_GABAA/tau_r_GABAA)+exp(-tp_GABAA/tau_d_GABAA) :GABAA Normalization factor - so that when t = tp_GABAA, gsyn = gpeak 144 | factor_GABAA = 1/factor_GABAA 145 | 146 | factor_GABAB = -exp(-tp_GABAB/tau_r_GABAB)+exp(-tp_GABAB/tau_d_GABAB) :GABAB Normalization factor - so that when t = tp_GABAB, gsyn = gpeak 147 | factor_GABAB = 1/factor_GABAB 148 | 149 | A_GABAA_step = exp(dt*(( - 1.0 ) / tau_r_GABAA)) 150 | B_GABAA_step = exp(dt*(( - 1.0 ) / tau_d_GABAA)) 151 | A_GABAB_step = exp(dt*(( - 1.0 ) / tau_r_GABAB)) 152 | B_GABAB_step = exp(dt*(( - 1.0 ) / tau_d_GABAB)) 153 | } 154 | 155 | BREAKPOINT { 156 | SOLVE state 157 | 158 | g_GABAA = gmax*(B_GABAA-A_GABAA) :compute time varying conductance as the difference of state variables B_GABAA and A_GABAA 159 | g_GABAB = gmax*(B_GABAB-A_GABAB) :compute time varying conductance as the difference of state variables B_GABAB and A_GABAB 160 | g = g_GABAA + g_GABAB 161 | i_GABAA = g_GABAA*(v-e_GABAA) :compute the GABAA driving force based on the time varying conductance, membrane potential, and GABAA reversal 162 | i_GABAB = g_GABAB*(v-e_GABAB) :compute the GABAB driving force based on the time varying conductance, membrane potential, and GABAB reversal 163 | i = i_GABAA + i_GABAB 164 | } 165 | 166 | PROCEDURE state() { 167 | A_GABAA = A_GABAA*A_GABAA_step 168 | B_GABAA = B_GABAA*B_GABAA_step 169 | A_GABAB = A_GABAB*A_GABAB_step 170 | B_GABAB = B_GABAB*B_GABAB_step 171 | } 172 | 173 | 174 | NET_RECEIVE (weight, weight_GABAA, weight_GABAB, Psurv, tsyn (ms)){ 175 | LOCAL result 176 | weight_GABAA = weight 177 | weight_GABAB = weight*GABAB_ratio 178 | : Locals: 179 | : Psurv - survival probability of unrecovered state 180 | : tsyn - time since last surival evaluation. 181 | 182 | 183 | INITIAL{ 184 | tsyn=t 185 | } 186 | 187 | : Do not perform any calculations if the synapse (netcon) is deactivated. This avoids drawing from the random stream 188 | if( !(weight > 0) ) { 189 | VERBATIM 190 | return; 191 | ENDVERBATIM 192 | } 193 | 194 | : calc u at event- 195 | if (Fac > 0) { 196 | u = u*exp(-(t - tsyn_fac)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 197 | } else { 198 | u = Use 199 | } 200 | if(Fac > 0){ 201 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 202 | } 203 | 204 | : tsyn_fac knows about all spikes, not only those that released 205 | : i.e. each spike can increase the u, regardless of recovered state. 206 | tsyn_fac = t 207 | 208 | : recovery 209 | if (Rstate == 0) { 210 | : probability of survival of unrecovered state based on Poisson recovery with rate 1/tau 211 | Psurv = exp(-(t-tsyn)/Dep) 212 | result = urand() 213 | if (result>Psurv) { 214 | Rstate = 1 : recover 215 | 216 | if( verboseLevel > 0 ) { 217 | printf( "Recovered! %f at time %g: Psurv = %g, urand=%g\n", synapseID, t, Psurv, result ) 218 | } 219 | 220 | } 221 | else { 222 | : survival must now be from this interval 223 | tsyn = t 224 | if( verboseLevel > 0 ) { 225 | printf( "Failed to recover! %f at time %g: Psurv = %g, urand=%g\n", synapseID, t, Psurv, result ) 226 | } 227 | } 228 | } 229 | 230 | if (Rstate == 1) { 231 | result = urand() 232 | if (result 0 ) { 243 | printf( "Release! %f at time %g: vals %g %g %g \n", synapseID, t, A_GABAA, weight_GABAA, factor_GABAA ) 244 | } 245 | 246 | } 247 | else { 248 | if( verboseLevel > 0 ) { 249 | printf("Failure! %f at time %g: urand = %g\n", synapseID, t, result ) 250 | } 251 | 252 | } 253 | 254 | } 255 | 256 | 257 | 258 | } 259 | 260 | 261 | PROCEDURE setRNG() { 262 | VERBATIM 263 | { 264 | /** 265 | * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file. 266 | * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod 267 | */ 268 | void** pv = (void**)(&_p_rng); 269 | if( ifarg(1)) { 270 | *pv = nrn_random_arg(1); 271 | } else { 272 | *pv = (void*)0; 273 | } 274 | } 275 | ENDVERBATIM 276 | } 277 | 278 | FUNCTION urand() { 279 | VERBATIM 280 | double value; 281 | if (_p_rng) { 282 | /* 283 | :Supports separate independent but reproducible streams for 284 | : each instance. However, the corresponding hoc Random 285 | : distribution MUST be set to Random.uniform(1) 286 | */ 287 | value = nrn_random_pick(_p_rng); 288 | //printf("random stream for this simulation = %lf\n",value); 289 | return value; 290 | }else{ 291 | ENDVERBATIM 292 | : the old standby. Cannot use if reproducible parallel sim 293 | : independent of nhost or which host this instance is on 294 | : is desired, since each instance on this cpu draws from 295 | : the same stream 296 | urand = scop_random(1) 297 | VERBATIM 298 | } 299 | ENDVERBATIM 300 | urand = value 301 | } 302 | 303 | FUNCTION toggleVerbose() { 304 | verboseLevel = 1 - verboseLevel 305 | } 306 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/ProbGABAA_EMS.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | /** 3 | * @file ProbGABAA.mod 4 | * @brief 5 | * @author king, muller 6 | * @date 2011-08-17 7 | * @remark Copyright © BBP/EPFL 2005-2011; All rights reserved. Do not distribute without further notice. 8 | */ 9 | ENDCOMMENT 10 | 11 | TITLE GABAA receptor with presynaptic short-term plasticity 12 | 13 | 14 | COMMENT 15 | GABAA receptor conductance using a dual-exponential profile 16 | presynaptic short-term plasticity based on Fuhrmann et al, 2002 17 | Implemented by Srikanth Ramaswamy, Blue Brain Project, March 2009 18 | 19 | _EMS (Eilif Michael Srikanth) 20 | Modification of ProbGABAA: 2-State model by Eilif Muller, Michael Reimann, Srikanth Ramaswamy, Blue Brain Project, August 2011 21 | This new model was motivated by the following constraints: 22 | 23 | 1) No consumption on failure. 24 | 2) No release just after release until recovery. 25 | 3) Same ensemble averaged trace as deterministic/canonical Tsodyks-Markram 26 | using same parameters determined from experiment. 27 | 4) Same quantal size as present production probabilistic model. 28 | 29 | To satisfy these constaints, the synapse is implemented as a 30 | uni-vesicular (generalization to multi-vesicular should be 31 | straight-forward) 2-state Markov process. The states are 32 | {1=recovered, 0=unrecovered}. 33 | 34 | For a pre-synaptic spike or external spontaneous release trigger 35 | event, the synapse will only release if it is in the recovered state, 36 | and with probability u (which follows facilitation dynamics). If it 37 | releases, it will transition to the unrecovered state. Recovery is as 38 | a Poisson process with rate 1/Dep. 39 | 40 | This model satisys all of (1)-(4). 41 | 42 | 43 | ENDCOMMENT 44 | 45 | 46 | NEURON { 47 | THREADSAFE 48 | POINT_PROCESS ProbGABAA_EMS 49 | RANGE tau_r, tau_d 50 | RANGE Use, u, Dep, Fac, u0, Rstate, tsyn_fac, u 51 | RANGE i, g, e 52 | NONSPECIFIC_CURRENT i 53 | POINTER rng 54 | RANGE synapseID, verboseLevel 55 | } 56 | 57 | PARAMETER { 58 | tau_r = 0.2 (ms) : dual-exponential conductance profile 59 | tau_d = 8 (ms) : IMPORTANT: tau_r < tau_d 60 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 61 | Dep = 100 (ms) : relaxation time constant from depression 62 | Fac = 10 (ms) : relaxation time constant from facilitation 63 | e = -80 (mV) : GABAA reversal potential 64 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 65 | u0 = 0 :initial value of u, which is the running value of release probability 66 | synapseID = 0 67 | verboseLevel = 0 68 | } 69 | 70 | COMMENT 71 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 72 | for comparison with Pr to decide whether to activate the synapse or not 73 | ENDCOMMENT 74 | 75 | VERBATIM 76 | #include 77 | #include 78 | #include 79 | 80 | double nrn_random_pick(void* r); 81 | void* nrn_random_arg(int argpos); 82 | 83 | ENDVERBATIM 84 | 85 | 86 | ASSIGNED { 87 | v (mV) 88 | i (nA) 89 | g (uS) 90 | factor 91 | rng 92 | 93 | : Recording these three, you can observe full state of model 94 | : tsyn_fac gives you presynaptic times, Rstate gives you 95 | : state transitions, 96 | : u gives you the "release probability" at transitions 97 | : (attention: u is event based based, so only valid at incoming events) 98 | Rstate (1) : recovered state {0=unrecovered, 1=recovered} 99 | tsyn_fac (ms) : the time of the last spike 100 | u (1) : running release probability 101 | 102 | 103 | } 104 | 105 | STATE { 106 | A : state variable to construct the dual-exponential profile - decays with conductance tau_r 107 | B : state variable to construct the dual-exponential profile - decays with conductance tau_d 108 | } 109 | 110 | INITIAL{ 111 | 112 | LOCAL tp 113 | A = 0 114 | B = 0 115 | tp = (tau_r*tau_d)/(tau_d-tau_r)*log(tau_d/tau_r) :time to peak of the conductance 116 | factor = -exp(-tp/tau_r)+exp(-tp/tau_d) :Normalization factor - so that when t = tp, gsyn = gpeak 117 | factor = 1/factor 118 | 119 | Rstate=1 120 | tsyn_fac=0 121 | u=u0 122 | 123 | } 124 | 125 | BREAKPOINT { 126 | SOLVE state METHOD cnexp 127 | g = gmax*(B-A) :compute time varying conductance as the difference of state variables B and A 128 | i = g*(v-e) :compute the driving force based on the time varying conductance, membrane potential, and GABAA reversal 129 | } 130 | 131 | DERIVATIVE state{ 132 | A' = -A/tau_r 133 | B' = -B/tau_d 134 | } 135 | 136 | 137 | NET_RECEIVE (weight, Psurv, tsyn (ms)){ 138 | LOCAL result 139 | 140 | : Locals: 141 | : Psurv - survival probability of unrecovered state 142 | : tsyn - time since last surival evaluation. 143 | 144 | 145 | INITIAL{ 146 | tsyn=t 147 | } 148 | 149 | : calc u at event- 150 | if (Fac > 0) { 151 | u = u*exp(-(t - tsyn_fac)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 152 | } else { 153 | u = Use 154 | } 155 | if(Fac > 0){ 156 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 157 | } 158 | 159 | : tsyn_fac knows about all spikes, not only those that released 160 | : i.e. each spike can increase the u, regardless of recovered state. 161 | tsyn_fac = t 162 | 163 | : recovery 164 | 165 | if (Rstate == 0) { 166 | : probability of survival of unrecovered state based on Poisson recovery with rate 1/tau 167 | Psurv = exp(-(t-tsyn)/Dep) 168 | result = urand() 169 | if (result>Psurv) { 170 | Rstate = 1 : recover 171 | 172 | if( verboseLevel > 0 ) { 173 | printf( "Recovered! %f at time %g: Psurv = %g, urand=%g\n", synapseID, t, Psurv, result ) 174 | } 175 | 176 | } 177 | else { 178 | : survival must now be from this interval 179 | tsyn = t 180 | if( verboseLevel > 0 ) { 181 | printf( "Failed to recover! %f at time %g: Psurv = %g, urand=%g\n", synapseID, t, Psurv, result ) 182 | } 183 | } 184 | } 185 | 186 | if (Rstate == 1) { 187 | result = urand() 188 | if (result 0 ) { 197 | printf( "Release! %f at time %g: vals %g %g %g \n", synapseID, t, A, weight, factor ) 198 | } 199 | 200 | } 201 | else { 202 | if( verboseLevel > 0 ) { 203 | printf("Failure! %f at time %g: urand = %g\n", synapseID, t, result ) 204 | } 205 | 206 | } 207 | 208 | } 209 | 210 | 211 | 212 | } 213 | 214 | 215 | PROCEDURE setRNG() { 216 | VERBATIM 217 | { 218 | /** 219 | * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file. 220 | * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod 221 | */ 222 | void** pv = (void**)(&_p_rng); 223 | if( ifarg(1)) { 224 | *pv = nrn_random_arg(1); 225 | } else { 226 | *pv = (void*)0; 227 | } 228 | } 229 | ENDVERBATIM 230 | } 231 | 232 | FUNCTION urand() { 233 | VERBATIM 234 | double value; 235 | if (_p_rng) { 236 | /* 237 | :Supports separate independent but reproducible streams for 238 | : each instance. However, the corresponding hoc Random 239 | : distribution MUST be set to Random.uniform(1) 240 | */ 241 | value = nrn_random_pick(_p_rng); 242 | //printf("random stream for this simulation = %lf\n",value); 243 | return value; 244 | }else{ 245 | ENDVERBATIM 246 | : the old standby. Cannot use if reproducible parallel sim 247 | : independent of nhost or which host this instance is on 248 | : is desired, since each instance on this cpu draws from 249 | : the same stream 250 | urand = scop_random(1) 251 | VERBATIM 252 | } 253 | ENDVERBATIM 254 | urand = value 255 | } 256 | 257 | FUNCTION toggleVerbose() { 258 | verboseLevel = 1 - verboseLevel 259 | } 260 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/ProbNMDA.mod: -------------------------------------------------------------------------------- 1 | TITLE NMDA receptor with presynaptic short-term plasticity 2 | 3 | 4 | COMMENT 5 | NMDA receptor conductance using a dual-exponential profile 6 | Presynaptic short-term plasticity based on Fuhrmann et al, 2002 7 | Implemented by Srikanth Ramaswamy, Blue Brain Project, March 2009 8 | ENDCOMMENT 9 | 10 | NEURON { 11 | THREADSAFE 12 | POINT_PROCESS ProbNMDA 13 | RANGE tau_r, tau_d 14 | RANGE Use, u, Dep, Fac, u0 15 | RANGE i, g, e 16 | RANGE mg,mggate 17 | NONSPECIFIC_CURRENT i 18 | } 19 | 20 | PARAMETER { 21 | tau_r = 0.29 (ms) : dual-exponential conductance profile 22 | tau_d = 43 (ms) : IMPORTANT: tau_r < tau_d 23 | Use = 0.67 (1) : Utilization of synaptic efficacy (just initial values! Use,Dep and Fac are overwritten by BlueBuilder assigned values) 24 | Dep = 800 (ms) : relaxation time constant from depression 25 | Fac = 3 (ms) : relaxation time constant from facilitation 26 | e = 0 (mV) : NMDA reversal potential 27 | gmax = 0.001 (us) : weight conversion factor (from nS to uS) 28 | mg = 1 (mM) : initial concentration of mg2+ 29 | mggate 30 | u0 = 0 :initial value of u, which is the running value of Use 31 | } 32 | 33 | COMMENT 34 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 35 | for comparison with Pr to decide whether to activate the synapse or not 36 | ENDCOMMENT 37 | 38 | VERBATIM 39 | #include 40 | #include 41 | #include 42 | 43 | float ranfNMDA(){ 44 | //double MAX = (double)RAND_MAX; 45 | double r = (rand() / (double) RAND_MAX); 46 | return r; 47 | } 48 | 49 | void SetSeedNowNMDA(){ 50 | #ifdef SYN_DEBUG 51 | srand(time(NULL)); 52 | #else 53 | srand(888); 54 | #endif 55 | return; 56 | } 57 | ENDVERBATIM 58 | 59 | 60 | 61 | ASSIGNED { 62 | v (mV) 63 | i (nA) 64 | g (uS) 65 | factor 66 | } 67 | 68 | STATE { 69 | A : state variable to construct the dual-exponential profile - decays with conductance tau_r 70 | B : state variable to construct the dual-exponential profile - decays with conductance tau_d 71 | } 72 | 73 | INITIAL{ 74 | LOCAL tp 75 | A = 0 76 | B = 0 77 | tp = (tau_r*tau_d)/(tau_d-tau_r)*log(tau_d/tau_r) :time to peak of the conductance 78 | factor = -exp(-tp/tau_r)+exp(-tp/tau_d) :Normalization factor - so that when t = tp, gsyn = gpeak 79 | factor = 1/factor 80 | SetSeedNowNMDA() 81 | } 82 | 83 | BREAKPOINT { 84 | SOLVE state METHOD cnexp 85 | mggate = 1 / (1 + exp(0.062 (/mV) * -(v)) * (mg / 3.57 (mM))) :mggate kinetics - Jahr & Stevens 1990 86 | g = gmax*(B - A)*mggate 87 | i = g*(v - e) 88 | } 89 | 90 | DERIVATIVE state { 91 | A' = -A/tau_r 92 | B' = -B/tau_d 93 | } 94 | 95 | NET_RECEIVE (weight, Pv, Pr, u, tsyn (ms)){ 96 | weight = weight*0.71 97 | :printf("weight NMDA = %g \n ",weight) 98 | :the NETCON.weight = gsyn (per synaptic contact) * scaling factor * 0.71, as gNMDA/gAMPA = 0.71 from Chaelon et al. 2003, and Markram et al. 1997 99 | INITIAL{ 100 | Pv=1 101 | u=u0 102 | tsyn=t 103 | } 104 | : calc u at event- 105 | if (Fac > 0) { 106 | u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 107 | } else { 108 | u = Use 109 | } 110 | if(Fac > 0){ 111 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 112 | } 113 | 114 | 115 | Pv = 1 - (1-Pv) * exp(-(t-tsyn)/Dep) :Probability Pv for a vesicle to be available for release, analogous to the pool of synaptic 116 | :resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al. 117 | Pr = u * Pv :Pr is calculated as Pv * u (running value of Use) 118 | Pv = Pv - u * Pv :update Pv as per Eq. 3 in Fuhrmann et al. 119 | :printf("Pv = %g\n", Pv) 120 | :printf("Pr = %g\n", Pr) 121 | tsyn = t 122 | if (ranfNMDA() < Pr){ 123 | A = A + weight*factor 124 | B = B + weight*factor 125 | } 126 | } 127 | 128 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/SK_E2.mod: -------------------------------------------------------------------------------- 1 | : SK-type calcium-activated potassium current 2 | : Reference : Kohler et al. 1996 3 | 4 | NEURON { 5 | SUFFIX SK_E2 6 | USEION k READ ek WRITE ik 7 | USEION ca READ cai 8 | RANGE gSK_E2bar, gSK_E2, ik 9 | } 10 | 11 | UNITS { 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | (mM) = (milli/liter) 15 | } 16 | 17 | PARAMETER { 18 | v (mV) 19 | gSK_E2bar = .000001 (mho/cm2) 20 | zTau = 1 (ms) 21 | ek (mV) 22 | cai (mM) 23 | } 24 | 25 | ASSIGNED { 26 | zInf 27 | ik (mA/cm2) 28 | gSK_E2 (S/cm2) 29 | } 30 | 31 | STATE { 32 | z FROM 0 TO 1 33 | } 34 | 35 | BREAKPOINT { 36 | SOLVE states METHOD cnexp 37 | gSK_E2 = gSK_E2bar * z 38 | ik = gSK_E2 * (v - ek) 39 | } 40 | 41 | DERIVATIVE states { 42 | rates(cai) 43 | z' = (zInf - z) / zTau 44 | } 45 | 46 | PROCEDURE rates(ca(mM)) { 47 | if(ca < 1e-7){ 48 | ca = ca + 1e-07 49 | } 50 | zInf = 1/(1 + (0.00043 / ca)^4.8) 51 | } 52 | 53 | INITIAL { 54 | rates(cai) 55 | z = zInf 56 | } 57 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/SKv3_1.mod: -------------------------------------------------------------------------------- 1 | :Comment : 2 | :Reference : : Characterization of a Shaw-related potassium channel family in rat brain, The EMBO Journal, vol.11, no.7,2473-2486 (1992) 3 | 4 | NEURON { 5 | SUFFIX SKv3_1 6 | USEION k READ ek WRITE ik 7 | RANGE gSKv3_1bar, gSKv3_1, ik 8 | } 9 | 10 | UNITS { 11 | (S) = (siemens) 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | } 15 | 16 | PARAMETER { 17 | gSKv3_1bar = 0.00001 (S/cm2) 18 | } 19 | 20 | ASSIGNED { 21 | v (mV) 22 | ek (mV) 23 | ik (mA/cm2) 24 | gSKv3_1 (S/cm2) 25 | mInf 26 | mTau 27 | } 28 | 29 | STATE { 30 | m 31 | } 32 | 33 | BREAKPOINT { 34 | SOLVE states METHOD cnexp 35 | gSKv3_1 = gSKv3_1bar*m 36 | ik = gSKv3_1*(v-ek) 37 | } 38 | 39 | DERIVATIVE states { 40 | rates() 41 | m' = (mInf-m)/mTau 42 | } 43 | 44 | INITIAL{ 45 | rates() 46 | m = mInf 47 | } 48 | 49 | PROCEDURE rates(){ 50 | UNITSOFF 51 | mInf = 1/(1+exp(((v -(18.700))/(-9.700)))) 52 | mTau = 0.2*20.000/(1+exp(((v -(-46.560))/(-44.140)))) 53 | UNITSON 54 | } 55 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/epsp.mod: -------------------------------------------------------------------------------- 1 | : this model is built-in to neuron with suffix epsp 2 | : Schaefer et al. 2003 3 | 4 | COMMENT 5 | modified from syn2.mod 6 | injected current with exponential rise and decay current defined by 7 | i = 0 for t < onset and 8 | i=amp*((1-exp(-(t-onset)/tau0))-(1-exp(-(t-onset)/tau1))) 9 | for t > onset 10 | 11 | compare to experimental current injection: 12 | i = - amp*(1-exp(-t/t1))*(exp(-t/t2)) 13 | 14 | -> tau1==t2 tau0 ^-1 = t1^-1 + t2^-1 15 | ENDCOMMENT 16 | 17 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 18 | 19 | NEURON { 20 | POINT_PROCESS epsp 21 | RANGE onset, tau0, tau1, imax, i, myv 22 | NONSPECIFIC_CURRENT i 23 | } 24 | UNITS { 25 | (nA) = (nanoamp) 26 | (mV) = (millivolt) 27 | (umho) = (micromho) 28 | } 29 | 30 | PARAMETER { 31 | onset=0 (ms) 32 | tau0=0.2 (ms) 33 | tau1=3.0 (ms) 34 | imax=0 (nA) 35 | v (mV) 36 | } 37 | 38 | ASSIGNED { i (nA) myv (mV)} 39 | 40 | LOCAL a[2] 41 | LOCAL tpeak 42 | LOCAL adjust 43 | LOCAL amp 44 | 45 | BREAKPOINT { 46 | myv = v 47 | i = curr(t) 48 | } 49 | 50 | FUNCTION myexp(x) { 51 | if (x < -100) { 52 | myexp = 0 53 | }else{ 54 | myexp = exp(x) 55 | } 56 | } 57 | 58 | FUNCTION curr(x) { 59 | tpeak=tau0*tau1*log(tau0/tau1)/(tau0-tau1) 60 | adjust=1/((1-myexp(-tpeak/tau0))-(1-myexp(-tpeak/tau1))) 61 | amp=adjust*imax 62 | if (x < onset) { 63 | curr = 0 64 | }else{ 65 | a[0]=1-myexp(-(x-onset)/tau0) 66 | a[1]=1-myexp(-(x-onset)/tau1) 67 | curr = -amp*(a[0]-a[1]) 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/kv.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | kv.mod 3 | 4 | Potassium channel, Hodgkin-Huxley style kinetics 5 | Kinetic rates based roughly on Sah et al. and Hamill et al. (1991) 6 | 7 | Author: Zach Mainen, Salk Institute, 1995, zach@salk.edu 8 | 9 | 26 Ago 2002 Modification of original channel to allow 10 | variable time step and to correct an initialization error. 11 | Done by Michael Hines(michael.hines@yale.e) and 12 | Ruggero Scorcioni(rscorcio@gmu.edu) at EU Advance Course 13 | in Computational Neuroscience. Obidos, Portugal 14 | 15 | 20110202 made threadsafe by Ted Carnevale 16 | 20120514 fixed singularity in PROCEDURE rates 17 | 18 | Special comment: 19 | 20 | This mechanism was designed to be run at a single operating 21 | temperature--37 deg C--which can be specified by the hoc 22 | assignment statement 23 | celsius = 37 24 | This mechanism is not intended to be used at other temperatures, 25 | or to investigate the effects of temperature changes. 26 | 27 | Zach Mainen created this particular model by adapting conductances 28 | from lower temperature to run at higher temperature, and found it 29 | necessary to reduce the temperature sensitivity of spike amplitude 30 | and time course. He accomplished this by increasing the net ionic 31 | conductance through the heuristic of changing the standard HH 32 | formula 33 | g = gbar*product_of_gating_variables 34 | to 35 | g = tadj*gbar*product_of_gating_variables 36 | where 37 | tadj = q10^((celsius - temp)/10) 38 | temp is the "reference temperature" (at which the gating variable 39 | time constants were originally determined) 40 | celsius is the "operating temperature" 41 | 42 | Users should note that this is equivalent to changing the channel 43 | density from gbar at the "reference temperature" temp (the 44 | temperature at which the at which the gating variable time 45 | constants were originally determined) to tadj*gbar at the 46 | "operating temperature" celsius. 47 | ENDCOMMENT 48 | 49 | NEURON { 50 | THREADSAFE 51 | SUFFIX kv 52 | USEION k READ ek WRITE ik 53 | RANGE n, gk, gbar 54 | RANGE ninf, ntau 55 | GLOBAL Ra, Rb 56 | GLOBAL q10, temp, tadj, vmin, vmax 57 | } 58 | 59 | UNITS { 60 | (mA) = (milliamp) 61 | (mV) = (millivolt) 62 | (pS) = (picosiemens) 63 | (um) = (micron) 64 | } 65 | 66 | PARAMETER { 67 | gbar = 5 (pS/um2) : 0.03 mho/cm2 68 | 69 | tha = 25 (mV) : v 1/2 for inf 70 | qa = 9 (mV) : inf slope 71 | 72 | Ra = 0.02 (/ms) : max act rate 73 | Rb = 0.002 (/ms) : max deact rate 74 | 75 | : dt (ms) 76 | temp = 23 (degC) : original temp 77 | q10 = 2.3 : temperature sensitivity 78 | 79 | vmin = -120 (mV) 80 | vmax = 100 (mV) 81 | } 82 | 83 | 84 | ASSIGNED { 85 | v (mV) 86 | celsius (degC) 87 | a (/ms) 88 | b (/ms) 89 | ik (mA/cm2) 90 | gk (pS/um2) 91 | ek (mV) 92 | ninf 93 | ntau (ms) 94 | tadj 95 | } 96 | 97 | 98 | STATE { n } 99 | 100 | INITIAL { 101 | tadj = q10^((celsius - temp)/(10 (degC))) : make all threads calculate tadj at initialization 102 | 103 | trates(v) 104 | n = ninf 105 | } 106 | 107 | BREAKPOINT { 108 | SOLVE states METHOD cnexp 109 | gk = tadj*gbar*n 110 | ik = (1e-4) * gk * (v - ek) 111 | } 112 | 113 | DERIVATIVE states { :Computes state variable n 114 | trates(v) : at the current v and dt. 115 | n' = (ninf-n)/ntau 116 | } 117 | 118 | PROCEDURE trates(v (mV)) { :Computes rate and other constants at current v. 119 | :Call once from HOC to initialize inf at resting v. 120 | TABLE ninf, ntau 121 | DEPEND celsius, temp, Ra, Rb, tha, qa 122 | FROM vmin TO vmax WITH 199 123 | 124 | rates(v): not consistently executed from here if usetable_hh == 1 125 | 126 | : tinc = -dt * tadj 127 | : nexp = 1 - exp(tinc/ntau) 128 | } 129 | 130 | UNITSOFF 131 | PROCEDURE rates(v (mV)) { :Computes rate and other constants at current v. 132 | :Call once from HOC to initialize inf at resting v. 133 | 134 | : singular when v = tha 135 | : a = Ra * (v - tha) / (1 - exp(-(v - tha)/qa)) 136 | : a = Ra * qa*((v - tha)/qa) / (1 - exp(-(v - tha)/qa)) 137 | : a = Ra * qa*(-(v - tha)/qa) / (exp(-(v - tha)/qa) - 1) 138 | a = Ra * qa * efun(-(v - tha)/qa) 139 | 140 | : singular when v = tha 141 | : b = -Rb * (v - tha) / (1 - exp((v - tha)/qa)) 142 | : b = -Rb * qa*((v - tha)/qa) / (1 - exp((v - tha)/qa)) 143 | : b = Rb * qa*((v - tha)/qa) / (exp((v - tha)/qa) - 1) 144 | b = Rb * qa * efun((v - tha)/qa) 145 | 146 | tadj = q10^((celsius - temp)/10) 147 | ntau = 1/tadj/(a+b) 148 | ninf = a/(a+b) 149 | } 150 | UNITSON 151 | 152 | FUNCTION efun(z) { 153 | if (fabs(z) < 1e-4) { 154 | efun = 1 - z/2 155 | }else{ 156 | efun = z/(exp(z) - 1) 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /Jupyter_notebooks/mods/na.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | na.mod 3 | 4 | Sodium channel, Hodgkin-Huxley style kinetics. 5 | 6 | Kinetics were fit to data from Huguenard et al. (1988) and Hamill et 7 | al. (1991) 8 | 9 | qi is not well constrained by the data, since there are no points 10 | between -80 and -55. So this was fixed at 5 while the thi1,thi2,Rg,Rd 11 | were optimized using a simplex least square proc 12 | 13 | voltage dependencies are shifted approximately from the best 14 | fit to give higher threshold 15 | 16 | Author: Zach Mainen, Salk Institute, 1994, zach@salk.edu 17 | 18 | 26 Ago 2002 Modification of original channel to allow 19 | variable time step and to correct an initialization error. 20 | Done by Michael Hines(michael.hines@yale.e) and 21 | Ruggero Scorcioni(rscorcio@gmu.edu) at EU Advance Course 22 | in Computational Neuroscience. Obidos, Portugal 23 | 24 | 11 Jan 2007 Fixed glitch in trap where (v/th) was where (v-th)/q is. 25 | (thanks Ronald van Elburg!) 26 | 27 | 20110202 made threadsafe by Ted Carnevale 28 | 20120514 replaced vtrap0 with efun, which is a better approximation 29 | in the vicinity of a singularity 30 | 31 | Special comment: 32 | 33 | This mechanism was designed to be run at a single operating 34 | temperature--37 deg C--which can be specified by the hoc 35 | assignment statement 36 | celsius = 37 37 | This mechanism is not intended to be used at other temperatures, 38 | or to investigate the effects of temperature changes. 39 | 40 | Zach Mainen created this particular model by adapting conductances 41 | from lower temperature to run at higher temperature, and found it 42 | necessary to reduce the temperature sensitivity of spike amplitude 43 | and time course. He accomplished this by increasing the net ionic 44 | conductance through the heuristic of changing the standard HH 45 | formula 46 | g = gbar*product_of_gating_variables 47 | to 48 | g = tadj*gbar*product_of_gating_variables 49 | where 50 | tadj = q10^((celsius - temp)/10) 51 | temp is the "reference temperature" (at which the gating variable 52 | time constants were originally determined) 53 | celsius is the "operating temperature" 54 | 55 | Users should note that this is equivalent to changing the channel 56 | density from gbar at the "reference temperature" temp (the 57 | temperature at which the at which the gating variable time 58 | constants were originally determined) to tadj*gbar at the 59 | "operating temperature" celsius. 60 | ENDCOMMENT 61 | 62 | NEURON { 63 | THREADSAFE 64 | SUFFIX na 65 | USEION na READ ena WRITE ina 66 | RANGE m, h, gna, gbar 67 | GLOBAL tha, thi1, thi2, qa, qi, qinf, thinf 68 | RANGE minf, hinf, mtau, htau 69 | GLOBAL Ra, Rb, Rd, Rg 70 | GLOBAL q10, temp, tadj, vmin, vmax, vshift 71 | } 72 | 73 | UNITS { 74 | (mA) = (milliamp) 75 | (mV) = (millivolt) 76 | (pS) = (picosiemens) 77 | (um) = (micron) 78 | } 79 | 80 | PARAMETER { 81 | gbar = 1000 (pS/um2) : 0.12 mho/cm2 82 | vshift = -10 (mV) : voltage shift (affects all) 83 | 84 | tha = -35 (mV) : v 1/2 for act (-42) 85 | qa = 9 (mV) : act slope 86 | Ra = 0.182 (/ms) : open (v) 87 | Rb = 0.124 (/ms) : close (v) 88 | 89 | thi1 = -50 (mV) : v 1/2 for inact 90 | thi2 = -75 (mV) : v 1/2 for inact 91 | qi = 5 (mV) : inact tau slope 92 | thinf = -65 (mV) : inact inf slope 93 | qinf = 6.2 (mV) : inact inf slope 94 | Rg = 0.0091 (/ms) : inact (v) 95 | Rd = 0.024 (/ms) : inact recov (v) 96 | 97 | temp = 23 (degC) : original temp 98 | q10 = 2.3 : temperature sensitivity 99 | 100 | : dt (ms) 101 | vmin = -120 (mV) 102 | vmax = 100 (mV) 103 | } 104 | 105 | ASSIGNED { 106 | v (mV) 107 | celsius (degC) 108 | ina (mA/cm2) 109 | gna (pS/um2) 110 | ena (mV) 111 | minf hinf 112 | mtau (ms) htau (ms) 113 | tadj 114 | } 115 | 116 | STATE { m h } 117 | 118 | INITIAL { 119 | tadj = q10^((celsius - temp)/(10 (degC))) : make all threads calculate tadj at initialization 120 | 121 | trates(v+vshift) 122 | m = minf 123 | h = hinf 124 | } 125 | 126 | BREAKPOINT { 127 | SOLVE states METHOD cnexp 128 | gna = tadj*gbar*m*m*m*h 129 | ina = (1e-4) * gna * (v - ena) 130 | } 131 | 132 | : LOCAL mexp, hexp 133 | 134 | DERIVATIVE states { :Computes state variables m, h, and n 135 | trates(v+vshift) : at the current v and dt. 136 | m' = (minf-m)/mtau 137 | h' = (hinf-h)/htau 138 | } 139 | 140 | PROCEDURE trates(v (mV)) { 141 | TABLE minf, hinf, mtau, htau 142 | DEPEND celsius, temp, Ra, Rb, Rd, Rg, tha, thi1, thi2, qa, qi, qinf 143 | FROM vmin TO vmax WITH 199 144 | 145 | rates(v): not consistently executed from here if usetable == 1 146 | 147 | : tinc = -dt * tadj 148 | 149 | : mexp = 1 - exp(tinc/mtau) 150 | : hexp = 1 - exp(tinc/htau) 151 | } 152 | 153 | 154 | : efun() is a better approx than trap0 in vicinity of singularity-- 155 | 156 | UNITSOFF 157 | PROCEDURE rates(vm (mV)) { 158 | LOCAL a, b 159 | 160 | : a = trap0(vm,tha,Ra,qa) 161 | a = Ra * qa * efun((tha - vm)/qa) 162 | 163 | : b = trap0(-vm,-tha,Rb,qa) 164 | b = Rb * qa * efun((vm - tha)/qa) 165 | 166 | tadj = q10^((celsius - temp)/10) 167 | 168 | mtau = 1/tadj/(a+b) 169 | minf = a/(a+b) 170 | 171 | :"h" inactivation 172 | 173 | : a = trap0(vm,thi1,Rd,qi) 174 | a = Rd * qi * efun((thi1 - vm)/qi) 175 | 176 | : b = trap0(-vm,-thi2,Rg,qi) 177 | b = Rg * qi * efun((vm - thi2)/qi) 178 | 179 | htau = 1/tadj/(a+b) 180 | hinf = 1/(1+exp((vm-thinf)/qinf)) 181 | } 182 | UNITSON 183 | 184 | COMMENT 185 | FUNCTION trap0(v,th,a,q) { 186 | if (fabs((v-th)/q) > 1e-6) { 187 | trap0 = a * (v - th) / (1 - exp(-(v - th)/q)) 188 | } else { 189 | trap0 = a * q 190 | } 191 | } 192 | ENDCOMMENT 193 | 194 | FUNCTION efun(z) { 195 | if (fabs(z) < 1e-6) { 196 | efun = 1 - z/2 197 | }else{ 198 | efun = z/(exp(z) - 1) 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /NEURON_tutorial.pptx: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orena1/NEURON_tutorial/a00179f6339533369b88789c2493ca9ed73e8c0b/NEURON_tutorial.pptx -------------------------------------------------------------------------------- /Python_scripts/Ball_and_Stick.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | from neuron import h 3 | from neuron import gui 4 | import matplotlib.pyplot as plt 5 | import numpy as np 6 | plt.ion() 7 | ################### 8 | # # Build Model # # 9 | ################### 10 | 11 | soma = h.Section(name="soma") 12 | soma.L = 10 # um 13 | soma.diam = 10 # um 14 | soma.Ra = 100 15 | soma.insert('pas') 16 | soma.g_pas = 1/10000 # 1/Rm - Rm ohm*cm^2 17 | 18 | dend = h.Section(name="dend") 19 | dend.L = 500 # um 20 | dend.diam = 1 # um 21 | dend.Ra = 100 # ohm*cm 22 | dend.insert('pas') 23 | dend.g_pas = 1/10000 24 | 25 | dend.connect(soma, 1, 0) #connect the end of the soma to the start of the dendrite 26 | 27 | h("forall { nseg = int((L/(0.1*lambda_f(100))+0.9)/2)*2 + 1 }") 28 | 29 | ######################### 30 | # # Set up experiment # # 31 | ######################### 32 | 33 | stim = h.IClamp(soma(0.5)) # add a current clamp the the middle of the soma 34 | stim.delay = 10 # ms 35 | stim.dur = 100 # ms 36 | stim.amp = 0.1 # nA 37 | 38 | soma_v = h.Vector() # set up a recording vector 39 | soma_v.record(soma(0.5)._ref_v) # record voltage at the middle of the soma 40 | 41 | # Record voltage from all segments in the dendrite 42 | dend_vs = [] 43 | for seg in dend: 44 | dend_vs.append(h.Vector()) 45 | dend_vs[-1].record(seg._ref_v) 46 | 47 | t = h.Vector() 48 | t.record(h._ref_t) #record time. 49 | h.v_init = -70 # set starting voltage 50 | h.tstop = 200 # set simulation time 51 | h.run() # run simulation 52 | 53 | 54 | ################ 55 | # Plot Results # 56 | ################ 57 | plt.figure(figsize=(8,5)) 58 | plt.plot(t, soma_v,color='k',label='soma(0.5)') 59 | for i,v in list(enumerate(dend_vs))[::3]: 60 | plt.plot(t, v, color=(0,0,0.5+0.5*i/len(dend_vs)), 61 | label = 'dend({:.2})'.format(i/len(dend_vs))) 62 | 63 | plt.xlim(0,200) 64 | plt.xlabel('Time (ms)', fontsize = 15) 65 | plt.ylabel('Voltage (mV)', fontsize = 15) 66 | plt.legend(fontsize = 14, frameon=False) 67 | plt.tight_layout() 68 | 69 | 70 | ########################### 71 | # Add HH channels to soma # 72 | ########################### 73 | 74 | h.tstop = 25 75 | stim.dur = 5 76 | soma.insert('kv') # add potassium channel 77 | soma.gbar_kv = 2000 # set the potassium conductance 78 | 79 | soma.insert('na') # add sodium channel 80 | soma.gbar_na = 10000 # set the sodium conductance 81 | h.celsius = 30 82 | 83 | h.run() 84 | plt.figure(figsize=(8,5)) 85 | plt.plot(t, soma_v,color='k',label='soma(0.5)') 86 | for i,v in list(enumerate(dend_vs))[::3]: 87 | plt.plot(t, v, color=(0,0,0.5+0.5*i/len(dend_vs)), 88 | label = 'dend({:.2})'.format(i/len(dend_vs))) 89 | 90 | 91 | plt.xlabel('Time (ms)', fontsize = 15) 92 | plt.ylabel('Voltage (mV)', fontsize = 15) 93 | plt.legend(fontsize = 14, frameon=False) 94 | plt.tight_layout() 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | -------------------------------------------------------------------------------- /Python_scripts/Inhibition_location_Gidon_et_al.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | from neuron import h 3 | from neuron import gui 4 | import matplotlib.pyplot as plt 5 | import numpy as np 6 | plt.ion() 7 | ################### 8 | # # Build Model # # 9 | ################### 10 | v_rest = -60 # the baseline voltage. 11 | 12 | soma = h.Section(name="soma") 13 | soma.L = 25 14 | soma.diam = 25 15 | soma.Ra = 100 16 | soma.insert('pas') 17 | soma.g_pas = 1/20000 18 | soma.e_pas = v_rest # the reversal of the passive channels 19 | 20 | soma.insert('na') # insert active conductances to the soma. 21 | soma.gbar_na = 5000 # set the Na conductance 22 | soma.insert('kv') 23 | soma.gbar_kv = 1500 # set the K conductance 24 | h.celsius = 30 25 | 26 | 27 | dend = h.Section(name="dend") 28 | dend.L = 700 29 | dend.diam = 1 30 | dend.Ra = 100 31 | dend.insert('pas') 32 | dend.e_pas = v_rest 33 | dend.g_pas = 1/20000 34 | 35 | dend.connect(soma, 1, 0) #connect the end of the soma to the start of the dendrite 36 | 37 | # set number of segement 38 | h("forall { nseg = int((L/(0.1*lambda_f(100))+0.9)/2)*2 + 1 }") 39 | h.define_shape() 40 | 41 | ######################### 42 | # # Set up experiment # # 43 | ######################### 44 | 45 | #We create 20 AMPA_NMDA synapses: 46 | hotspot_NMDA_synapses = [] 47 | hotspot_NMDA_netcons = [] 48 | hotspot_NMDA_netstims = [] 49 | for j in range(20): 50 | hotspot_NMDA_synapses.append(h.ProbAMPANMDA2_RATIO(dend(0.6))) 51 | hotspot_NMDA_netstims.append(h.NetStim()) 52 | hotspot_NMDA_netcons.append(h.NetCon(hotspot_NMDA_netstims[j], hotspot_NMDA_synapses[j])) 53 | 54 | hotspot_NMDA_synapses[j].tau_r_AMPA = 0.33 # AMPA rise time 55 | hotspot_NMDA_synapses[j].tau_d_AMPA = 1 # AMPA decay time 56 | hotspot_NMDA_synapses[j].e=0 57 | hotspot_NMDA_synapses[j].tau_r_NMDA = 0.23 # NMDA rise time 58 | hotspot_NMDA_synapses[j].tau_d_NMDA = 55 # NMDA decay time 59 | 60 | 61 | hotspot_NMDA_netcons[j].weight[0]= 0.5 # strength of the synapse 62 | 63 | hotspot_NMDA_netstims[j].number = 9e9 # number of synaptic activation 64 | hotspot_NMDA_netstims[j].noise = 1 # randomness 65 | hotspot_NMDA_netstims[j].interval = 50 # mean time between spikes |50 ms = 20 Hz| 66 | 67 | #create one inhibitory synapse at location 0.1 68 | on_path_inhibition = h.Exp2Syn(dend(0.2)) 69 | on_path_inhibition.tau1 = 0.01 # synapse rise time 70 | on_path_inhibition.tau2 = 9e9 # synapse decay time 71 | on_path_inhibition.e = v_rest 72 | 73 | #create one inhibitory synapse at location 0.9 74 | off_path_inhibition = h.Exp2Syn(dend(0.99)) 75 | off_path_inhibition.tau1 = 0.01 76 | off_path_inhibition.tau2 = 9e9 77 | off_path_inhibition.e = v_rest 78 | 79 | #create a NetStim that will activate the synapses at t=1000 80 | inhibition_netstim = h.NetStim() 81 | inhibition_netstim.number = 1 # number of synaptic activation 82 | inhibition_netstim.start = 1000 # activation start time 83 | inhibition_netstim.noise = 0 # randomness 84 | on_path_netcon = h.NetCon(inhibition_netstim, on_path_inhibition) 85 | off_path_netcon = h.NetCon(inhibition_netstim, off_path_inhibition) 86 | 87 | ######################### 88 | # # set up recording # # 89 | ######################### 90 | 91 | soma_v = h.Vector() # set up a recording vector 92 | soma_v.record(soma(0.5)._ref_v) # record voltage at the middle of the soma 93 | 94 | # Record voltage from all segments in the dendrite 95 | dend_vs = [] 96 | for seg in dend: 97 | dend_vs.append(h.Vector()) 98 | dend_vs[-1].record(seg._ref_v) 99 | 100 | t = h.Vector() 101 | t.record(h._ref_t) #record time. 102 | h.v_init = v_rest # set starting voltage 103 | h.tstop = 5000 # set simulation time 104 | 105 | 106 | ########################################### 107 | # Run simulation with proximal inhibition # 108 | ########################################### 109 | inhibition_weight = 0.0045 110 | 111 | on_path_netcon.weight[0] = inhibition_weight # activate the on_path synapse 112 | off_path_netcon.weight[0] = 0 # deactivate the off path synapse by changing its conductance to 0 113 | h.run() 114 | soma_v_proximal_inh = list(soma_v) 115 | 116 | ########################################## 117 | # Run simulation with distal inhibition # 118 | ########################################## 119 | on_path_netcon.weight[0] = 0 # deactivate the on path synapse by changing its conductance to 0 120 | off_path_netcon.weight[0] = inhibition_weight # activate only the on_path synapse 121 | h.run() 122 | soma_v_distal_inh = list(soma_v) 123 | 124 | 125 | ################ 126 | # Plot Results # 127 | ################ 128 | plt.figure(figsize=(8,5)) 129 | ax = plt.subplot(2,1,1) 130 | plt.plot(t, soma_v_proximal_inh,color='orange',label='on path\ninhibition') 131 | plt.plot([1000,1000], [-75,40], 'red') 132 | plt.text(950,-20,'inhibition start',color='red',rotation=90,va='center', bbox=dict(facecolor='lightgray', edgecolor='red',pad=0.5, boxstyle='round,pad=0.1')) 133 | plt.ylabel('Voltage (mV)') 134 | ax.spines["right"].set_visible(False) 135 | ax.spines["top"].set_visible(False) 136 | plt.title('on path inhibition', color='orange') 137 | 138 | ax1 = plt.subplot(2,1,2,sharex=ax,sharey=ax) 139 | plt.plot(t, soma_v_distal_inh,color='black',label='off path\ninhibition') 140 | plt.plot([1000,1000], [-75,40], 'red') 141 | plt.text(950,-20,'inhibition start',color='red',rotation=90,va='center', bbox=dict(facecolor='lightgray', edgecolor='red',pad=0.5,boxstyle='round,pad=0.1')) 142 | plt.xlabel('Time (ms)') 143 | plt.ylabel('Voltage (mV)') 144 | plt.title('off path inhibition', color='black') 145 | plt.xlim(0,5000) 146 | plt.ylim(-75,40) 147 | ax1.spines["right"].set_visible(False) 148 | ax1.spines["top"].set_visible(False) 149 | plt.tight_layout() 150 | 151 | 152 | 153 | 154 | 155 | 156 | 157 | -------------------------------------------------------------------------------- /Python_scripts/Layer_5b_pyramidal_cell.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | from neuron import h 3 | from neuron import gui 4 | import matplotlib.pyplot as plt 5 | import numpy as np 6 | plt.ion() 7 | 8 | 9 | ##=================== creating cell object =========================== 10 | h.load_file("import3d.hoc") 11 | morphology_file = "morphologies/cell1.asc" 12 | h.load_file("models/L5PCbiophys3.hoc") 13 | h.load_file("models/L5PCtemplate.hoc") 14 | L5PC = h.L5PCtemplate(morphology_file) 15 | 16 | ##==================== stimulus settings =========================== 17 | stim = h.IClamp(L5PC.soma[0](0.5)) 18 | stim.dur = 1000 19 | stim.delay = 400 20 | stim.amp = 0.793 21 | 22 | ##==================== recording settings ========================== 23 | t = h.Vector() 24 | t.record(h._ref_t) 25 | 26 | soma_v = h.Vector() 27 | soma_v.record(L5PC.soma[0](0.5)._ref_v) 28 | 29 | nexus_v = h.Vector() 30 | nexus_v.record(L5PC.apic[36](0.9)._ref_v) 31 | 32 | stim_current = h.Vector() 33 | stim_current.record(stim._ref_i) 34 | 35 | #============================= simulation ================================ 36 | 37 | h.v_init = -80 38 | h.tstop = 1500 39 | h.celsius = 37 40 | h.run() 41 | 42 | #============================= plotting ================================ 43 | 44 | 45 | f, (ax0, ax1) = plt.subplots(2,1, figsize=(5,4), gridspec_kw = {'height_ratios':[3, 1]}) 46 | ax0.plot(t,soma_v, 'k', label = 'soma') 47 | ax0.plot(t,nexus_v, 'orange', label = 'apic[36]') 48 | ax0.legend(frameon=False) 49 | ax1.plot(t,stim_current) 50 | 51 | ax0.set_ylabel('Voltage (mV)') 52 | #ax0.set_ylim(-80,20) 53 | ax0.spines['right'].set_visible(False) 54 | ax0.spines['top'].set_visible(False) 55 | ax0.spines['bottom'].set_visible(False) 56 | ax0.get_xaxis().set_visible(False) 57 | 58 | 59 | ax1.plot([50,50],[0.1,0.35],'k') 60 | ax1.text(80,0.2,'250 pA',va='center') 61 | ax1.set_ylabel('I (nA)') 62 | ax1.set_xlabel('t (ms)') 63 | #ax1.set_ylim(-0.01,0.02) 64 | ax1.spines['right'].set_visible(False) 65 | ax1.spines['top'].set_visible(False) 66 | ax1.spines['left'].set_visible(False) 67 | ax1.get_yaxis().set_visible(False) 68 | plt.tight_layout() 69 | 70 | 71 | -------------------------------------------------------------------------------- /Python_scripts/Layer_5b_pyramidal_cell_calcium_spike.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | from neuron import h 3 | from neuron import gui 4 | import matplotlib.pyplot as plt 5 | import numpy as np 6 | plt.ion() 7 | 8 | ##=================== creating cell object =========================== 9 | h.load_file("import3d.hoc") 10 | morphology_file = "morphologies/cell1.asc" 11 | h.load_file("models/L5PCbiophys3.hoc") 12 | h.load_file("models/L5PCtemplate.hoc") 13 | L5PC = h.L5PCtemplate(morphology_file) 14 | 15 | ##==================== stimulus settings =========================== 16 | stim = h.IClamp(0.5, sec=L5PC.soma[0]) 17 | stim.dur = 5 18 | stim.delay = 150 19 | stim_current = h.Vector() 20 | stim_current.record(stim._ref_i) 21 | 22 | syn = h.epsp(L5PC.apic[36](0.9)) 23 | syn.tau0 = 0.5 24 | syn.tau1 = 5 25 | syn.onset = stim.delay + 5 26 | syn_current = h.Vector() 27 | syn_current.record(syn._ref_i) 28 | 29 | ##==================== recording settings ========================== 30 | t = h.Vector() 31 | t.record(h._ref_t) 32 | 33 | soma_v = h.Vector() 34 | soma_v.record(L5PC.soma[0](0.5)._ref_v) 35 | 36 | nexus_v = h.Vector() 37 | nexus_v.record(L5PC.apic[36](0.9)._ref_v) 38 | 39 | 40 | ##======================== general settings =================================== 41 | h.v_init = -80 42 | h.tstop = 250 43 | h.celsius = 37 44 | 45 | #============================= plotting function ================================ 46 | def plot_result(t, soma_v, nexus_v, stim_current, syn_current, show_from = 4400): 47 | t = np.array(t)[show_from:] 48 | soma_v = np.array(soma_v)[show_from:] 49 | nexus_v = np.array(nexus_v)[show_from:] 50 | stim_current = np.array(stim_current)[show_from:] 51 | syn_current = np.array(syn_current)[show_from:] 52 | f, (ax0, ax1, ax2) = plt.subplots(3,1, figsize = (6.5,3),gridspec_kw = {'height_ratios':[4, 1,1]}) 53 | ax0.plot(t,soma_v, label = 'soma') 54 | ax0.plot(t,nexus_v, label = 'apic[36]') 55 | ax0.set_ylabel('Voltage (mV)') 56 | ax0.set_ylim(-80,40) 57 | ax0.spines['right'].set_visible(False) 58 | ax0.spines['top'].set_visible(False) 59 | ax0.spines['bottom'].set_visible(False) 60 | ax0.get_xaxis().set_visible(False) 61 | ax0.legend(frameon=False) 62 | 63 | ax1.plot(t, np.array(syn_current)*-1, color='red', label='EPSP-like current') 64 | ax1.set_ylim(-0.02,2) 65 | ax1.spines['right'].set_visible(False) 66 | ax1.spines['top'].set_visible(False) 67 | ax1.spines['bottom'].set_visible(False) 68 | ax1.get_xaxis().set_visible(False) 69 | ax1.legend(frameon=False) 70 | 71 | ax2.plot(t, stim_current, color='black', label='step current') 72 | ax2.set_ylabel('Current (nA)', ha='left', labelpad=15) 73 | ax2.set_xlabel('Time (ms)') 74 | ax2.set_ylim(-0.02,2) 75 | ax2.spines['right'].set_visible(False) 76 | ax2.spines['top'].set_visible(False) 77 | ax2.legend(frameon=False) 78 | 79 | #============================= simulation ================================ 80 | 81 | 82 | syn.imax = 0.5 83 | stim.amp = 0 84 | h.run() 85 | plot_result(t, soma_v, nexus_v, stim_current, syn_current) 86 | 87 | syn.imax = 0 88 | stim.amp = 1.9 89 | h.run() 90 | plot_result(t, soma_v, nexus_v, stim_current, syn_current) 91 | 92 | 93 | syn.imax = 0.5 94 | stim.amp = 1.9 95 | h.run() 96 | plot_result(t, soma_v, nexus_v, stim_current, syn_current) 97 | -------------------------------------------------------------------------------- /Python_scripts/Single_compartment_neuron_active.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | from neuron import h 3 | from neuron import gui 4 | import matplotlib.pyplot as plt 5 | import numpy as np 6 | plt.ion() 7 | 8 | # create model 9 | soma = h.Section(name="soma") 10 | soma.L = 10 11 | soma.diam = 10 12 | soma.Ra = 100 13 | soma.insert('pas') # add passive properties 14 | soma.g_pas = 1/10000 # set the specific membrane resistance to 10000 ohm*cm^2 15 | 16 | # add active conductances (the channels [mod files] are from Mainen and Sejnowski 1996) 17 | soma.insert('kv') # add potassium channel 18 | soma.gbar_kv = 2000 # set the potassium conductance 19 | 20 | soma.insert('na') # add sodium channel 21 | soma.gbar_na = 8000 # set the sodium conductance 22 | h.celsius = 30 23 | 24 | 25 | # current clamp 26 | stim = h.IClamp(soma(0.5)) 27 | stim.amp = 0.007446 28 | stim.delay = 250 29 | stim.dur = 1000 30 | 31 | # record voltage of some and injected current 32 | # and the time 33 | soma_v = h.Vector() 34 | soma_v.record(soma(0.5)._ref_v) 35 | 36 | stim_current = h.Vector() 37 | stim_current.record(stim._ref_i) 38 | 39 | t = h.Vector() 40 | t.record(h._ref_t) 41 | 42 | 43 | # run simulation 44 | h.tstop = 1500 # set the simulation time 45 | h.v_init = -70 46 | h.run() 47 | 48 | # plot the injected current and the voltage response 49 | f, (ax0, ax1) = plt.subplots(2,1, figsize=(4,3), gridspec_kw = {'height_ratios':[3, 1]}) 50 | ax0.plot(t,soma_v, 'k') 51 | ax1.plot(t,stim_current, 'gray') 52 | 53 | ax0.set_ylabel('Voltage (mV)') 54 | ax0.spines['right'].set_visible(False) 55 | ax0.spines['top'].set_visible(False) 56 | ax0.spines['bottom'].set_visible(False) 57 | ax0.get_xaxis().set_visible(False) 58 | 59 | 60 | ax1.plot([50,50],[0.01,0.02],'k') 61 | ax1.text(80,0.015,'10pA',va='center') 62 | ax1.set_ylabel('I (nA)') 63 | ax1.set_xlabel('t (ms)') 64 | ax1.spines['right'].set_visible(False) 65 | ax1.spines['top'].set_visible(False) 66 | ax1.spines['left'].set_visible(False) 67 | ax1.get_yaxis().set_visible(False) 68 | plt.tight_layout() 69 | -------------------------------------------------------------------------------- /Python_scripts/Single_compartment_neuron_passive.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | from neuron import h 3 | from neuron import gui 4 | import matplotlib.pyplot as plt 5 | import numpy as np 6 | plt.ion() 7 | 8 | # create model 9 | soma = h.Section(name='soma') 10 | soma.L = 10 # the length of the soma 11 | soma.diam = 10 # the diameter of the soma 12 | soma.Ra = 100 # tha axial resistance 13 | soma.insert('pas') # add passive properties 14 | soma.g_pas = 1/10000 # set the specific membrane to 10000 ohm*cm^2 15 | 16 | # current clamp 17 | stim = h.IClamp(soma(0.5)) 18 | stim.delay = 20 # start of the current injection (ms) 19 | stim.dur = 100 # duration (ms) 20 | stim.amp = 0.01 # amplitude (nA) 21 | 22 | # record voltage of soma and injected current 23 | # and the time 24 | soma_v = h.Vector() 25 | soma_v.record(soma(0.5)._ref_v) 26 | 27 | stim_current = h.Vector() 28 | stim_current.record(stim._ref_i) 29 | 30 | t = h.Vector() 31 | t.record(h._ref_t) 32 | 33 | h.tstop = 220 # set the simulation time 34 | h.v_init = -70 35 | # run simulation 36 | h.run() 37 | 38 | # plotting 39 | f, (ax0, ax1) = plt.subplots(2,1, gridspec_kw = {'height_ratios':[3, 1]}) 40 | ax0.plot(t,soma_v, 'k') 41 | ax1.plot(t,stim_current, 'gray', label='I (nA)') 42 | 43 | ax0.set_ylabel('Voltage (mV)') 44 | ax0.set_ylim(-80,-30) 45 | ax0.spines['right'].set_visible(False) 46 | ax0.spines['top'].set_visible(False) 47 | ax0.spines['bottom'].set_visible(False) 48 | ax0.get_xaxis().set_visible(False) 49 | 50 | 51 | ax1.set_ylabel('I (nA)') 52 | ax1.set_xlabel('t (ms)') 53 | ax1.set_ylim(-0.01,0.02) 54 | ax1.spines['right'].set_visible(False) 55 | ax1.spines['top'].set_visible(False) 56 | ax1.spines['left'].set_visible(False) 57 | ax1.get_yaxis().set_visible(False) 58 | ax1.legend(frameon=False) 59 | 60 | -------------------------------------------------------------------------------- /Python_scripts/Timed_inhibition_Doron_et_al.py: -------------------------------------------------------------------------------- 1 | from __future__ import division 2 | from neuron import h 3 | from neuron import gui 4 | import matplotlib.pyplot as plt 5 | import numpy as np 6 | plt.ion() 7 | 8 | ##=================== creating cell object =========================== 9 | h.load_file("import3d.hoc") 10 | morphology_file = "morphologies/cell1.asc" 11 | h.load_file("models/L5PCbiophys3.hoc") 12 | h.load_file("models/L5PCtemplate.hoc") 13 | L5PC = h.L5PCtemplate(morphology_file) 14 | 15 | ##==================== create synapses =========================== 16 | 17 | #NMDA synapse 18 | NMDA_synapse = h.ProbAMPANMDA2_RATIO(0.5, sec = L5PC.soma[0]) 19 | NMDA_netstim = h.NetStim(0.5, sec = L5PC.soma[0]) 20 | NMDA_netcons =h.NetCon(NMDA_netstim, NMDA_synapse) 21 | NMDA_synapse.tau_r_AMPA = 0.33 22 | NMDA_synapse.tau_d_AMPA = 1 23 | NMDA_synapse.e=0 24 | NMDA_synapse.mgVoltageCoeff = 0.08 25 | 26 | NMDA_netstim.number = 1 27 | NMDA_netstim.noise = 0 28 | NMDA_netstim.start = 100 29 | 30 | NMDA_netcons.weight[0]= 0.9 31 | 32 | 33 | #GABA synapse 34 | GABA_synapse = h.Exp2Syn(0.5, sec = L5PC.soma[0]) 35 | GABA_netstim = h.NetStim(0.5, sec = L5PC.soma[0]) 36 | GABA_netcon = h.NetCon(GABA_netstim, GABA_synapse) 37 | 38 | GABA_synapse.tau1 = 1.8 39 | GABA_synapse.tau2 = 5 40 | GABA_synapse.e = -80 41 | 42 | GABA_netstim.number = 1 43 | GABA_netstim.noise = 0 44 | 45 | GABA_netcon.weight[0] = 0.4 46 | 47 | 48 | ##==================== recording settings ========================== 49 | t = h.Vector() # record time 50 | t.record(h._ref_t) 51 | 52 | loc_1 = L5PC.apic[60](0.5) # first locaitons 53 | 54 | NMDA_synapse.loc(loc_1) # moving the synapses 55 | GABA_synapse.loc(loc_1) 56 | 57 | voltage_at_NMDA_location = h.Vector() 58 | voltage_at_NMDA_location.record(loc_1._ref_v) # record voltage at synaptic location 59 | voltages = {} 60 | 61 | #============================= simulation ================================ 62 | h.v_init = -80 63 | h.tstop = 250 64 | 65 | NMDA_netcons.weight[0]= 50 66 | GABA_netcon.weight[0] = 0.009 67 | delta_ts = [0,5,10,20,9e9] # delays between the NMDA activation to GABA activation 68 | h.tstop = 200 69 | for delta_t in delta_ts: 70 | GABA_netstim.start = NMDA_netstim.start + delta_t 71 | h.run() 72 | voltages[delta_t] = np.array(voltage_at_NMDA_location) 73 | 74 | 75 | 76 | #============================= plotting ================================ 77 | def plot_results(t,voltages,delay_1, delay_2): 78 | plt.figure(figsize=(8,5)) 79 | ax = plt.subplot(1,2,1) 80 | plt.plot(t,voltages[9e9],'--k') 81 | plt.plot(t,voltages[delay_1],) 82 | plt.plot(100,0,'or') 83 | plt.plot(100+delay_1,0,'ob',alpha=0.5) 84 | plt.text(130,0,r'$\Delta$t = ' +str(delay_1) +' msec',color='blue') 85 | plt.xlim(95,200) 86 | ax.spines["right"].set_visible(False) 87 | ax.spines["top"].set_visible(False) 88 | ax.set_ylabel('Voltage (mV)') 89 | ax = plt.subplot(1,2,2) 90 | plt.plot(t,voltages[9e9],'--k') 91 | plt.plot(t,voltages[delay_2],) 92 | plt.plot(100,0,'or') 93 | plt.plot(100+delay_2,0,'ob',alpha=0.5) 94 | plt.text(130,0,r'$\Delta$t = ' +str(delay_2) +' msec',color='blue') 95 | plt.xlim(95,200) 96 | ax.spines["right"].set_visible(False) 97 | ax.spines["left"].set_visible(False) 98 | ax.spines["top"].set_visible(False) 99 | ax.get_yaxis().set_visible(False) 100 | plt.suptitle('Time (ms)', x=0.5,y=0.05) 101 | 102 | plot_results(t,voltages, 5,20) 103 | -------------------------------------------------------------------------------- /Python_scripts/models/L5PCbiophys3.hoc: -------------------------------------------------------------------------------- 1 | // Author: Etay Hay, 2011 2 | // Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of 3 | // Dendritic and Perisomatic Active Properties 4 | // (Hay et al., PLoS Computational Biology, 2011) 5 | // 6 | // Model of L5 Pyramidal Cell, constrained both for BAC firing and Current Step Firing 7 | 8 | 9 | begintemplate L5PCbiophys 10 | public biophys 11 | 12 | proc biophys() { 13 | forsec $o1.all { 14 | insert pas 15 | cm = 1 16 | Ra = 100 17 | e_pas = -90 18 | } 19 | 20 | forsec $o1.somatic { 21 | insert Ca_LVAst 22 | insert Ca_HVA 23 | insert SKv3_1 24 | insert SK_E2 25 | insert K_Tst 26 | insert K_Pst 27 | insert Nap_Et2 28 | insert NaTa_t 29 | insert CaDynamics_E2 30 | insert Ih 31 | ek = -85 32 | ena = 50 33 | gIhbar_Ih = 0.0002 34 | g_pas = 0.0000338 35 | decay_CaDynamics_E2 = 460.0 36 | gamma_CaDynamics_E2 = 0.000501 37 | gCa_LVAstbar_Ca_LVAst = 0.00343 38 | gCa_HVAbar_Ca_HVA = 0.000992 39 | gSKv3_1bar_SKv3_1 = 0.693 40 | gSK_E2bar_SK_E2 = 0.0441 41 | gK_Tstbar_K_Tst = 0.0812 42 | gK_Pstbar_K_Pst = 0.00223 43 | gNap_Et2bar_Nap_Et2 = 0.00172 44 | gNaTa_tbar_NaTa_t = 2.04 45 | } 46 | 47 | forsec $o1.apical { 48 | cm = 2 49 | insert Ih 50 | insert SK_E2 51 | insert Ca_LVAst 52 | insert Ca_HVA 53 | insert SKv3_1 54 | insert NaTa_t 55 | insert Im 56 | insert CaDynamics_E2 57 | ek = -85 58 | ena = 50 59 | decay_CaDynamics_E2 = 122 60 | gamma_CaDynamics_E2 = 0.000509 61 | gSK_E2bar_SK_E2 = 0.0012 62 | gSKv3_1bar_SKv3_1 = 0.000261 63 | gNaTa_tbar_NaTa_t = 0.0213 64 | gImbar_Im = 0.0000675 65 | g_pas = 0.0000589 66 | } 67 | $o1.distribute_channels("apic","gIhbar_Ih",2,-0.8696,3.6161,0.0,2.0870,0.00020000000) 68 | $o1.distribute_channels("apic","gCa_LVAstbar_Ca_LVAst",3,1.000000,0.010000,685.000000,885.000000,0.0187000000) 69 | $o1.distribute_channels("apic","gCa_HVAbar_Ca_HVA",3,1.000000,0.100000,685.000000,885.000000,0.0005550000) 70 | 71 | forsec $o1.basal { 72 | cm = 2 73 | insert Ih 74 | gIhbar_Ih = 0.0002 75 | g_pas = 0.0000467 76 | } 77 | 78 | forsec $o1.axonal { 79 | g_pas = 0.0000325 80 | } 81 | } 82 | 83 | endtemplate L5PCbiophys -------------------------------------------------------------------------------- /Python_scripts/models/L5PCtemplate.hoc: -------------------------------------------------------------------------------- 1 | // Author: Etay Hay, 2011 2 | // Models of Neocortical Layer 5b Pyramidal Cells Capturing a Wide Range of 3 | // Dendritic and Perisomatic Active Properties 4 | // (Hay et al., PLoS Computational Biology, 2011) 5 | // 6 | // Template for models of L5 Pyramidal Cell 7 | 8 | begintemplate L5PCtemplate 9 | public init 10 | public locateSites, getLongestBranch 11 | public soma, dend, apic, axon, getAbsSecIndex 12 | public all, somatic, apical, axonal, basal, nSecSoma, nSecApical, nSecBasal, nSecAxonal, nSecAll, nSecAxonalOrig, SecSyn, distribute_channels 13 | objref SecSyn, this 14 | objref all, somatic, apical, axonal, basal 15 | strdef tstr 16 | 17 | //$s1 - morphology file name 18 | proc init() {localobj nl,import 19 | all = new SectionList() 20 | somatic = new SectionList() 21 | basal = new SectionList() 22 | apical = new SectionList() 23 | axonal = new SectionList() 24 | forall delete_section() 25 | 26 | nl = new Import3d_Neurolucida3() 27 | nl.quiet = 1 28 | nl.input($s1) 29 | import = new Import3d_GUI(nl, 0) 30 | import.instantiate(this) 31 | geom_nseg() 32 | biophys() 33 | forsec this.all { 34 | if(diam == 0){ 35 | diam = 1 36 | printf("Error : Morphology problem with section [%s] 0 diam \n", secname()) 37 | } 38 | } 39 | } 40 | 41 | create soma[1], dend[1], apic[1], axon[1] 42 | 43 | proc geom() { 44 | } 45 | 46 | proc geom_nseg() {local nSec, L1, L2, D1, D2, nSeg1, nSeg2 47 | soma area(.5) // make sure diam reflects 3d points 48 | nSec = 0 49 | forsec all { 50 | nseg = 1 + 2*int(L/40) 51 | nSec = nSec + 1 52 | } 53 | 54 | nSecAll = nSec 55 | nSec = 0 56 | forsec somatic { nSec = nSec + 1} 57 | nSecSoma = nSec 58 | nSec = 0 59 | forsec apical { nSec = nSec + 1} 60 | nSecApical= nSec 61 | nSec = 0 62 | forsec basal { nSec = nSec + 1} 63 | nSecBasal = nSec 64 | nSec = 0 65 | forsec axonal { nSec = nSec + 1} 66 | nSecAxonalOrig = nSecAxonal = nSec 67 | } 68 | 69 | proc biophys() {localobj bp 70 | delete_axon() 71 | area(0.5) 72 | distance() 73 | access soma 74 | 75 | bp = new L5PCbiophys() 76 | bp.biophys(this) 77 | } 78 | 79 | // deleting axon, keeping only first 60 micrometers 80 | proc delete_axon(){ 81 | forsec axonal{delete_section()} 82 | create axon[2] 83 | access axon[0]{ 84 | L= 30 85 | diam = 1 86 | nseg = 1+2*int(L/40) 87 | all.append() 88 | axonal.append() 89 | } 90 | access axon[1]{ 91 | L= 30 92 | diam = 1 93 | nseg = 1+2*int(L/40) 94 | all.append() 95 | axonal.append() 96 | } 97 | 98 | nSecAxonal = 2 99 | connect axon(0), soma(0.5) 100 | connect axon[1](0), axon[0](1) 101 | access soma 102 | } 103 | 104 | proc distribute_channels() {local dist,val,base,maxLength 105 | base = $8 106 | soma distance() 107 | maxLength = getLongestBranch($s1) 108 | 109 | forsec $s1 { 110 | if(0==strcmp($s2,"Ra")){ 111 | Ra = $8 112 | } else { 113 | for(x) { 114 | if ($3==3) { 115 | dist = distance(x) 116 | } else { 117 | dist = distance(x)/maxLength 118 | } 119 | val = calculate_distribution($3,dist,$4,$5,$6,$7,$8) 120 | sprint(tstr,"%s(%-5.10f) = %-5.10f",$s2,x,val) 121 | execute(tstr) 122 | } 123 | } 124 | } 125 | } 126 | 127 | // $1 is the distribution type: 128 | // 0 linear, 1 sigmoid, 2 exponential 129 | // 3 step for absolute distance (in microns) 130 | func calculate_distribution() {local value 131 | if ($1==0) {value = $3 + $2*$4} 132 | if ($1==1) {value = $3 + ($4/(1+exp(($2-$5)/$6)))} 133 | if ($1==2) {value = $3 + $6*exp($4*($2-$5))} 134 | if ($1==3) { 135 | if (($2 > $5) && ($2 < $6)) { 136 | value = $3 137 | } else { 138 | value = $4 139 | } 140 | } 141 | value = value*$7 142 | return value 143 | } 144 | 145 | // $s1 section 146 | func getLongestBranch(){local maxL,d localobj distallist,sref 147 | sprint(tstr,"%s distance()",$s1) 148 | execute(tstr,this) 149 | 150 | if(0==strcmp($s1,"axon")){ 151 | sprint(tstr,"%s[0] distance(1)",$s1) 152 | execute(tstr,this) 153 | } 154 | 155 | maxL = 0 156 | d = 0 157 | distallist = new SectionList() 158 | forsec $s1 { 159 | sref = new SectionRef() 160 | if (sref.nchild==0) distallist.append() 161 | } 162 | forsec distallist{ 163 | d = distance(1) 164 | if(maxL= d0) { 202 | siteX = (site-d0)/(d1-d0) 203 | secNum = i 204 | vv = new Vector() 205 | ll.append(vv.append(secNum,siteX)) 206 | } 207 | i = i+1 208 | } 209 | return ll 210 | } 211 | 212 | func getAbsSecIndex(){ local nAbsInd, index localobj str,strObj 213 | strObj = new StringFunctions() 214 | str = new String() 215 | nAbsInd = 0 216 | index = 0 217 | if(strObj.substr($s1, "soma") > 0) { 218 | strObj.tail($s1, "soma", str.s) 219 | if(sscanf(str.s, "%*c%d", &index) < 0) { 220 | index = 0 221 | } 222 | nAbsInd = index 223 | }else if (strObj.substr($s1, "axon") >0) { 224 | strObj.tail($s1, "axon", str.s) 225 | if(sscanf(str.s, "%*c%d", &index) < 0) { 226 | index = 0 227 | } 228 | nAbsInd = nSecSoma + index 229 | }else if (strObj.substr($s1, "dend") >0) { 230 | strObj.tail($s1, "dend", str.s) 231 | if(sscanf(str.s, "%*c%d", &index) < 0) { 232 | index = 0 233 | } 234 | nAbsInd = nSecSoma + nSecAxonalOrig + index 235 | }else if (strObj.substr($s1, "apic") > 0) { 236 | strObj.tail($s1, "apic", str.s) 237 | if(sscanf(str.s, "%*c%d", &index) < 0) { 238 | index = 0 239 | } 240 | nAbsInd = nSecSoma + nSecAxonalOrig + nSecBasal + index 241 | } 242 | return nAbsInd 243 | } 244 | 245 | 246 | endtemplate L5PCtemplate -------------------------------------------------------------------------------- /Python_scripts/mods/CaDynamics_E2.mod: -------------------------------------------------------------------------------- 1 | : Dynamics that track inside calcium concentration 2 | : modified from Destexhe et al. 1994 3 | 4 | NEURON { 5 | SUFFIX CaDynamics_E2 6 | USEION ca READ ica WRITE cai 7 | RANGE decay, gamma, minCai, depth 8 | } 9 | 10 | UNITS { 11 | (mV) = (millivolt) 12 | (mA) = (milliamp) 13 | FARADAY = (faraday) (coulombs) 14 | (molar) = (1/liter) 15 | (mM) = (millimolar) 16 | (um) = (micron) 17 | } 18 | 19 | PARAMETER { 20 | gamma = 0.05 : percent of free calcium (not buffered) 21 | decay = 80 (ms) : rate of removal of calcium 22 | depth = 0.1 (um) : depth of shell 23 | minCai = 1e-4 (mM) 24 | } 25 | 26 | ASSIGNED {ica (mA/cm2)} 27 | 28 | STATE { 29 | cai (mM) 30 | } 31 | 32 | BREAKPOINT { SOLVE states METHOD cnexp } 33 | 34 | DERIVATIVE states { 35 | cai' = -(10000)*(ica*gamma/(2*FARADAY*depth)) - (cai - minCai)/decay 36 | } 37 | -------------------------------------------------------------------------------- /Python_scripts/mods/Ca_HVA.mod: -------------------------------------------------------------------------------- 1 | :Comment : 2 | :Reference : : Reuveni, Friedman, Amitai, and Gutnick, J.Neurosci. 1993 3 | 4 | NEURON { 5 | SUFFIX Ca_HVA 6 | USEION ca READ eca WRITE ica 7 | RANGE gCa_HVAbar, gCa_HVA, ica 8 | } 9 | 10 | UNITS { 11 | (S) = (siemens) 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | } 15 | 16 | PARAMETER { 17 | gCa_HVAbar = 0.00001 (S/cm2) 18 | } 19 | 20 | ASSIGNED { 21 | v (mV) 22 | eca (mV) 23 | ica (mA/cm2) 24 | gCa_HVA (S/cm2) 25 | mInf 26 | mTau 27 | mAlpha 28 | mBeta 29 | hInf 30 | hTau 31 | hAlpha 32 | hBeta 33 | } 34 | 35 | STATE { 36 | m 37 | h 38 | } 39 | 40 | BREAKPOINT { 41 | SOLVE states METHOD cnexp 42 | gCa_HVA = gCa_HVAbar*m*m*h 43 | ica = gCa_HVA*(v-eca) 44 | } 45 | 46 | DERIVATIVE states { 47 | rates() 48 | m' = (mInf-m)/mTau 49 | h' = (hInf-h)/hTau 50 | } 51 | 52 | INITIAL{ 53 | rates() 54 | m = mInf 55 | h = hInf 56 | } 57 | 58 | PROCEDURE rates(){ 59 | UNITSOFF 60 | if((v == -27) ){ 61 | v = v+0.0001 62 | } 63 | mAlpha = (0.055*(-27-v))/(exp((-27-v)/3.8) - 1) 64 | mBeta = (0.94*exp((-75-v)/17)) 65 | mInf = mAlpha/(mAlpha + mBeta) 66 | mTau = 1/(mAlpha + mBeta) 67 | hAlpha = (0.000457*exp((-13-v)/50)) 68 | hBeta = (0.0065/(exp((-v-15)/28)+1)) 69 | hInf = hAlpha/(hAlpha + hBeta) 70 | hTau = 1/(hAlpha + hBeta) 71 | UNITSON 72 | } 73 | -------------------------------------------------------------------------------- /Python_scripts/mods/Ca_LVAst.mod: -------------------------------------------------------------------------------- 1 | :Comment : LVA ca channel. Note: mtau is an approximation from the plots 2 | :Reference : : Avery and Johnston 1996, tau from Randall 1997 3 | :Comment: shifted by -10 mv to correct for junction potential 4 | :Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 5 | 6 | NEURON { 7 | SUFFIX Ca_LVAst 8 | USEION ca READ eca WRITE ica 9 | RANGE gCa_LVAstbar, gCa_LVAst, ica 10 | } 11 | 12 | UNITS { 13 | (S) = (siemens) 14 | (mV) = (millivolt) 15 | (mA) = (milliamp) 16 | } 17 | 18 | PARAMETER { 19 | gCa_LVAstbar = 0.00001 (S/cm2) 20 | } 21 | 22 | ASSIGNED { 23 | v (mV) 24 | eca (mV) 25 | ica (mA/cm2) 26 | gCa_LVAst (S/cm2) 27 | mInf 28 | mTau 29 | hInf 30 | hTau 31 | } 32 | 33 | STATE { 34 | m 35 | h 36 | } 37 | 38 | BREAKPOINT { 39 | SOLVE states METHOD cnexp 40 | gCa_LVAst = gCa_LVAstbar*m*m*h 41 | ica = gCa_LVAst*(v-eca) 42 | } 43 | 44 | DERIVATIVE states { 45 | rates() 46 | m' = (mInf-m)/mTau 47 | h' = (hInf-h)/hTau 48 | } 49 | 50 | INITIAL{ 51 | rates() 52 | m = mInf 53 | h = hInf 54 | } 55 | 56 | PROCEDURE rates(){ 57 | LOCAL qt 58 | qt = 2.3^((34-21)/10) 59 | 60 | UNITSOFF 61 | v = v + 10 62 | mInf = 1.0000/(1+ exp((v - -30.000)/-6)) 63 | mTau = (5.0000 + 20.0000/(1+exp((v - -25.000)/5)))/qt 64 | hInf = 1.0000/(1+ exp((v - -80.000)/6.4)) 65 | hTau = (20.0000 + 50.0000/(1+exp((v - -40.000)/7)))/qt 66 | v = v - 10 67 | UNITSON 68 | } 69 | -------------------------------------------------------------------------------- /Python_scripts/mods/Ih.mod: -------------------------------------------------------------------------------- 1 | :Comment : 2 | :Reference : : Kole,Hallermann,and Stuart, J. Neurosci. 2006 3 | 4 | NEURON { 5 | SUFFIX Ih 6 | NONSPECIFIC_CURRENT ihcn 7 | RANGE gIhbar, gIh, ihcn 8 | } 9 | 10 | UNITS { 11 | (S) = (siemens) 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | } 15 | 16 | PARAMETER { 17 | gIhbar = 0.00001 (S/cm2) 18 | ehcn = -45.0 (mV) 19 | } 20 | 21 | ASSIGNED { 22 | v (mV) 23 | ihcn (mA/cm2) 24 | gIh (S/cm2) 25 | mInf 26 | mTau 27 | mAlpha 28 | mBeta 29 | } 30 | 31 | STATE { 32 | m 33 | } 34 | 35 | BREAKPOINT { 36 | SOLVE states METHOD cnexp 37 | gIh = gIhbar*m 38 | ihcn = gIh*(v-ehcn) 39 | } 40 | 41 | DERIVATIVE states { 42 | rates() 43 | m' = (mInf-m)/mTau 44 | } 45 | 46 | INITIAL{ 47 | rates() 48 | m = mInf 49 | } 50 | 51 | PROCEDURE rates(){ 52 | UNITSOFF 53 | if(v == -154.9){ 54 | v = v + 0.0001 55 | } 56 | mAlpha = 0.001*6.43*(v+154.9)/(exp((v+154.9)/11.9)-1) 57 | mBeta = 0.001*193*exp(v/33.1) 58 | mInf = mAlpha/(mAlpha + mBeta) 59 | mTau = 1/(mAlpha + mBeta) 60 | UNITSON 61 | } 62 | -------------------------------------------------------------------------------- /Python_scripts/mods/Im.mod: -------------------------------------------------------------------------------- 1 | :Reference : : Adams et al. 1982 - M-currents and other potassium currents in bullfrog sympathetic neurones 2 | :Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 3 | 4 | NEURON { 5 | SUFFIX Im 6 | USEION k READ ek WRITE ik 7 | RANGE gImbar, gIm, ik 8 | } 9 | 10 | UNITS { 11 | (S) = (siemens) 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | } 15 | 16 | PARAMETER { 17 | gImbar = 0.00001 (S/cm2) 18 | } 19 | 20 | ASSIGNED { 21 | v (mV) 22 | ek (mV) 23 | ik (mA/cm2) 24 | gIm (S/cm2) 25 | mInf 26 | mTau 27 | mAlpha 28 | mBeta 29 | } 30 | 31 | STATE { 32 | m 33 | } 34 | 35 | BREAKPOINT { 36 | SOLVE states METHOD cnexp 37 | gIm = gImbar*m 38 | ik = gIm*(v-ek) 39 | } 40 | 41 | DERIVATIVE states { 42 | rates() 43 | m' = (mInf-m)/mTau 44 | } 45 | 46 | INITIAL{ 47 | rates() 48 | m = mInf 49 | } 50 | 51 | PROCEDURE rates(){ 52 | LOCAL qt 53 | qt = 2.3^((34-21)/10) 54 | 55 | UNITSOFF 56 | mAlpha = 3.3e-3*exp(2.5*0.04*(v - -35)) 57 | mBeta = 3.3e-3*exp(-2.5*0.04*(v - -35)) 58 | mInf = mAlpha/(mAlpha + mBeta) 59 | mTau = (1/(mAlpha + mBeta))/qt 60 | UNITSON 61 | } 62 | -------------------------------------------------------------------------------- /Python_scripts/mods/K_Pst.mod: -------------------------------------------------------------------------------- 1 | :Comment : The persistent component of the K current 2 | :Reference : : Voltage-gated K+ channels in layer 5 neocortical pyramidal neurones from young rats:subtypes and gradients,Korngreen and Sakmann, J. Physiology, 2000 3 | :Comment : shifted -10 mv to correct for junction potential 4 | :Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 5 | 6 | 7 | NEURON { 8 | SUFFIX K_Pst 9 | USEION k READ ek WRITE ik 10 | RANGE gK_Pstbar, gK_Pst, ik 11 | } 12 | 13 | UNITS { 14 | (S) = (siemens) 15 | (mV) = (millivolt) 16 | (mA) = (milliamp) 17 | } 18 | 19 | PARAMETER { 20 | gK_Pstbar = 0.00001 (S/cm2) 21 | } 22 | 23 | ASSIGNED { 24 | v (mV) 25 | ek (mV) 26 | ik (mA/cm2) 27 | gK_Pst (S/cm2) 28 | mInf 29 | mTau 30 | hInf 31 | hTau 32 | } 33 | 34 | STATE { 35 | m 36 | h 37 | } 38 | 39 | BREAKPOINT { 40 | SOLVE states METHOD cnexp 41 | gK_Pst = gK_Pstbar*m*m*h 42 | ik = gK_Pst*(v-ek) 43 | } 44 | 45 | DERIVATIVE states { 46 | rates() 47 | m' = (mInf-m)/mTau 48 | h' = (hInf-h)/hTau 49 | } 50 | 51 | INITIAL{ 52 | rates() 53 | m = mInf 54 | h = hInf 55 | } 56 | 57 | PROCEDURE rates(){ 58 | LOCAL qt 59 | qt = 2.3^((34-21)/10) 60 | UNITSOFF 61 | v = v + 10 62 | mInf = (1/(1 + exp(-(v+1)/12))) 63 | if(v<-50){ 64 | mTau = (1.25+175.03*exp(-v * -0.026))/qt 65 | }else{ 66 | mTau = ((1.25+13*exp(-v*0.026)))/qt 67 | } 68 | hInf = 1/(1 + exp(-(v+54)/-11)) 69 | hTau = (360+(1010+24*(v+55))*exp(-((v+75)/48)^2))/qt 70 | v = v - 10 71 | UNITSON 72 | } 73 | -------------------------------------------------------------------------------- /Python_scripts/mods/K_Tst.mod: -------------------------------------------------------------------------------- 1 | :Comment : The transient component of the K current 2 | :Reference : : Voltage-gated K+ channels in layer 5 neocortical pyramidal neurones from young rats:subtypes and gradients,Korngreen and Sakmann, J. Physiology, 2000 3 | :Comment : shifted -10 mv to correct for junction potential 4 | :Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 5 | 6 | NEURON { 7 | SUFFIX K_Tst 8 | USEION k READ ek WRITE ik 9 | RANGE gK_Tstbar, gK_Tst, ik 10 | } 11 | 12 | UNITS { 13 | (S) = (siemens) 14 | (mV) = (millivolt) 15 | (mA) = (milliamp) 16 | } 17 | 18 | PARAMETER { 19 | gK_Tstbar = 0.00001 (S/cm2) 20 | } 21 | 22 | ASSIGNED { 23 | v (mV) 24 | ek (mV) 25 | ik (mA/cm2) 26 | gK_Tst (S/cm2) 27 | mInf 28 | mTau 29 | hInf 30 | hTau 31 | } 32 | 33 | STATE { 34 | m 35 | h 36 | } 37 | 38 | BREAKPOINT { 39 | SOLVE states METHOD cnexp 40 | gK_Tst = gK_Tstbar*(m^4)*h 41 | ik = gK_Tst*(v-ek) 42 | } 43 | 44 | DERIVATIVE states { 45 | rates() 46 | m' = (mInf-m)/mTau 47 | h' = (hInf-h)/hTau 48 | } 49 | 50 | INITIAL{ 51 | rates() 52 | m = mInf 53 | h = hInf 54 | } 55 | 56 | PROCEDURE rates(){ 57 | LOCAL qt 58 | qt = 2.3^((34-21)/10) 59 | 60 | UNITSOFF 61 | v = v + 10 62 | mInf = 1/(1 + exp(-(v+0)/19)) 63 | mTau = (0.34+0.92*exp(-((v+71)/59)^2))/qt 64 | hInf = 1/(1 + exp(-(v+66)/-10)) 65 | hTau = (8+49*exp(-((v+73)/23)^2))/qt 66 | v = v - 10 67 | UNITSON 68 | } 69 | -------------------------------------------------------------------------------- /Python_scripts/mods/NaTa_t.mod: -------------------------------------------------------------------------------- 1 | :Reference :Colbert and Pan 2002 2 | 3 | NEURON { 4 | SUFFIX NaTa_t 5 | USEION na READ ena WRITE ina 6 | RANGE gNaTa_tbar, gNaTa_t, ina 7 | } 8 | 9 | UNITS { 10 | (S) = (siemens) 11 | (mV) = (millivolt) 12 | (mA) = (milliamp) 13 | } 14 | 15 | PARAMETER { 16 | gNaTa_tbar = 0.00001 (S/cm2) 17 | } 18 | 19 | ASSIGNED { 20 | v (mV) 21 | ena (mV) 22 | ina (mA/cm2) 23 | gNaTa_t (S/cm2) 24 | mInf 25 | mTau 26 | mAlpha 27 | mBeta 28 | hInf 29 | hTau 30 | hAlpha 31 | hBeta 32 | } 33 | 34 | STATE { 35 | m 36 | h 37 | } 38 | 39 | BREAKPOINT { 40 | SOLVE states METHOD cnexp 41 | gNaTa_t = gNaTa_tbar*m*m*m*h 42 | ina = gNaTa_t*(v-ena) 43 | } 44 | 45 | DERIVATIVE states { 46 | rates() 47 | m' = (mInf-m)/mTau 48 | h' = (hInf-h)/hTau 49 | } 50 | 51 | INITIAL{ 52 | rates() 53 | m = mInf 54 | h = hInf 55 | } 56 | 57 | PROCEDURE rates(){ 58 | LOCAL qt 59 | qt = 2.3^((34-21)/10) 60 | 61 | UNITSOFF 62 | if(v == -38){ 63 | v = v+0.0001 64 | } 65 | mAlpha = (0.182 * (v- -38))/(1-(exp(-(v- -38)/6))) 66 | mBeta = (0.124 * (-v -38))/(1-(exp(-(-v -38)/6))) 67 | mTau = (1/(mAlpha + mBeta))/qt 68 | mInf = mAlpha/(mAlpha + mBeta) 69 | 70 | if(v == -66){ 71 | v = v + 0.0001 72 | } 73 | 74 | hAlpha = (-0.015 * (v- -66))/(1-(exp((v- -66)/6))) 75 | hBeta = (-0.015 * (-v -66))/(1-(exp((-v -66)/6))) 76 | hTau = (1/(hAlpha + hBeta))/qt 77 | hInf = hAlpha/(hAlpha + hBeta) 78 | UNITSON 79 | } -------------------------------------------------------------------------------- /Python_scripts/mods/NaTs2_t.mod: -------------------------------------------------------------------------------- 1 | :Reference :Colbert and Pan 2002 2 | :comment: took the NaTa and shifted both activation/inactivation by 6 mv 3 | 4 | NEURON { 5 | SUFFIX NaTs2_t 6 | USEION na READ ena WRITE ina 7 | RANGE gNaTs2_tbar, gNaTs2_t, ina 8 | } 9 | 10 | UNITS { 11 | (S) = (siemens) 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | } 15 | 16 | PARAMETER { 17 | gNaTs2_tbar = 0.00001 (S/cm2) 18 | } 19 | 20 | ASSIGNED { 21 | v (mV) 22 | ena (mV) 23 | ina (mA/cm2) 24 | gNaTs2_t (S/cm2) 25 | mInf 26 | mTau 27 | mAlpha 28 | mBeta 29 | hInf 30 | hTau 31 | hAlpha 32 | hBeta 33 | } 34 | 35 | STATE { 36 | m 37 | h 38 | } 39 | 40 | BREAKPOINT { 41 | SOLVE states METHOD cnexp 42 | gNaTs2_t = gNaTs2_tbar*m*m*m*h 43 | ina = gNaTs2_t*(v-ena) 44 | } 45 | 46 | DERIVATIVE states { 47 | rates() 48 | m' = (mInf-m)/mTau 49 | h' = (hInf-h)/hTau 50 | } 51 | 52 | INITIAL{ 53 | rates() 54 | m = mInf 55 | h = hInf 56 | } 57 | 58 | PROCEDURE rates(){ 59 | LOCAL qt 60 | qt = 2.3^((34-21)/10) 61 | 62 | UNITSOFF 63 | if(v == -32){ 64 | v = v+0.0001 65 | } 66 | mAlpha = (0.182 * (v- -32))/(1-(exp(-(v- -32)/6))) 67 | mBeta = (0.124 * (-v -32))/(1-(exp(-(-v -32)/6))) 68 | mInf = mAlpha/(mAlpha + mBeta) 69 | mTau = (1/(mAlpha + mBeta))/qt 70 | 71 | if(v == -60){ 72 | v = v + 0.0001 73 | } 74 | hAlpha = (-0.015 * (v- -60))/(1-(exp((v- -60)/6))) 75 | hBeta = (-0.015 * (-v -60))/(1-(exp((-v -60)/6))) 76 | hInf = hAlpha/(hAlpha + hBeta) 77 | hTau = (1/(hAlpha + hBeta))/qt 78 | UNITSON 79 | } -------------------------------------------------------------------------------- /Python_scripts/mods/Nap_Et2.mod: -------------------------------------------------------------------------------- 1 | :Comment : mtau deduced from text (said to be 6 times faster than for NaTa) 2 | :Comment : so I used the equations from NaT and multiplied by 6 3 | :Reference : Modeled according to kinetics derived from Magistretti & Alonso 1999 4 | :Comment: corrected rates using q10 = 2.3, target temperature 34, orginal 21 5 | 6 | NEURON { 7 | SUFFIX Nap_Et2 8 | USEION na READ ena WRITE ina 9 | RANGE gNap_Et2bar, gNap_Et2, ina 10 | } 11 | 12 | UNITS { 13 | (S) = (siemens) 14 | (mV) = (millivolt) 15 | (mA) = (milliamp) 16 | } 17 | 18 | PARAMETER { 19 | gNap_Et2bar = 0.00001 (S/cm2) 20 | } 21 | 22 | ASSIGNED { 23 | v (mV) 24 | ena (mV) 25 | ina (mA/cm2) 26 | gNap_Et2 (S/cm2) 27 | mInf 28 | mTau 29 | mAlpha 30 | mBeta 31 | hInf 32 | hTau 33 | hAlpha 34 | hBeta 35 | } 36 | 37 | STATE { 38 | m 39 | h 40 | } 41 | 42 | BREAKPOINT { 43 | SOLVE states METHOD cnexp 44 | gNap_Et2 = gNap_Et2bar*m*m*m*h 45 | ina = gNap_Et2*(v-ena) 46 | } 47 | 48 | DERIVATIVE states { 49 | rates() 50 | m' = (mInf-m)/mTau 51 | h' = (hInf-h)/hTau 52 | } 53 | 54 | INITIAL{ 55 | rates() 56 | m = mInf 57 | h = hInf 58 | } 59 | 60 | PROCEDURE rates(){ 61 | LOCAL qt 62 | qt = 2.3^((34-21)/10) 63 | 64 | UNITSOFF 65 | mInf = 1.0/(1+exp((v- -52.6)/-4.6)) 66 | if(v == -38){ 67 | v = v+0.0001 68 | } 69 | mAlpha = (0.182 * (v- -38))/(1-(exp(-(v- -38)/6))) 70 | mBeta = (0.124 * (-v -38))/(1-(exp(-(-v -38)/6))) 71 | mTau = 6*(1/(mAlpha + mBeta))/qt 72 | 73 | if(v == -17){ 74 | v = v + 0.0001 75 | } 76 | if(v == -64.4){ 77 | v = v+0.0001 78 | } 79 | 80 | hInf = 1.0/(1+exp((v- -48.8)/10)) 81 | hAlpha = -2.88e-6 * (v + 17) / (1 - exp((v + 17)/4.63)) 82 | hBeta = 6.94e-6 * (v + 64.4) / (1 - exp(-(v + 64.4)/2.63)) 83 | hTau = (1/(hAlpha + hBeta))/qt 84 | UNITSON 85 | } -------------------------------------------------------------------------------- /Python_scripts/mods/ProbAMPA.mod: -------------------------------------------------------------------------------- 1 | TITLE AMPA receptor with presynaptic short-term plasticity 2 | 3 | COMMENT 4 | AMPA receptor conductance using a dual-exponential profile 5 | presynaptic short-term plasticity based on Fuhrmann et al, 2002 6 | Implemented by Srikanth Ramaswamy, Blue Brain Project, March 2009 ENDCOMMENT 7 | 8 | 9 | NEURON { 10 | THREADSAFE 11 | POINT_PROCESS ProbAMPA 12 | RANGE tau_r, tau_d 13 | RANGE Use, u, Dep, Fac, u0 14 | RANGE i, g, e 15 | NONSPECIFIC_CURRENT i 16 | } 17 | 18 | PARAMETER { 19 | tau_r = 0.2 (ms) : dual-exponential conductance profile 20 | tau_d = 1.7 (ms) : IMPORTANT: tau_r < tau_d 21 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 22 | Dep = 100 (ms) : relaxation time constant from depression 23 | Fac = 10 (ms) : relaxation time constant from facilitation 24 | e = 0 (mV) : AMPA reversal potential 25 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 26 | u0 = 0 :initial value of u, which is the running value of Use 27 | } 28 | 29 | COMMENT 30 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 31 | for comparison with Pr to decide whether to activate the synapse or not 32 | ENDCOMMENT 33 | 34 | VERBATIM 35 | #include 36 | #include 37 | #include 38 | 39 | float ranfAMPA(){ 40 | //double MAX = (double)RAND_MAX; 41 | double r = (rand() / (double) RAND_MAX); 42 | return r; 43 | } 44 | 45 | void SetSeedNowAMPA(){ 46 | #ifdef SYN_DEBUG 47 | srand(time(NULL)); 48 | #else 49 | srand(888); 50 | #endif 51 | return; 52 | } 53 | ENDVERBATIM 54 | 55 | 56 | ASSIGNED { 57 | v (mV) 58 | i (nA) 59 | g (uS) 60 | factor 61 | } 62 | 63 | STATE { 64 | A : state variable to construct the dual-exponential profile - decays with conductance tau_r 65 | B : state variable to construct the dual-exponential profile - decays with conductance tau_d 66 | } 67 | 68 | INITIAL{ 69 | LOCAL tp 70 | A = 0 71 | B = 0 72 | tp = (tau_r*tau_d)/(tau_d-tau_r)*log(tau_d/tau_r) :time to peak of the conductance 73 | factor = -exp(-tp/tau_r)+exp(-tp/tau_d) :Normalization factor - so that when t = tp, gsyn = gpeak 74 | factor = 1/factor 75 | SetSeedNowAMPA() 76 | } 77 | 78 | BREAKPOINT { 79 | SOLVE state METHOD cnexp 80 | g = gmax*(B-A) :compute time varying conductance as the difference of state variables B and A 81 | i = g*(v-e) :compute the driving force based on the time varying conductance, membrane potential, and AMPA reversal 82 | } 83 | 84 | DERIVATIVE state{ 85 | A' = -A/tau_r 86 | B' = -B/tau_d 87 | } 88 | 89 | 90 | NET_RECEIVE (weight, Pv, Pr, u, tsyn (ms)){ 91 | INITIAL{ 92 | Pv=1 93 | u=u0 94 | tsyn=t 95 | } 96 | 97 | : calc u at event- 98 | if (Fac > 0) { 99 | u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 100 | } else { 101 | u = Use 102 | } 103 | if(Fac > 0){ 104 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 105 | } 106 | 107 | 108 | Pv = 1 - (1-Pv) * exp(-(t-tsyn)/Dep) :Probability Pv for a vesicle to be available for release, analogous to the pool of synaptic 109 | :resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al. 110 | Pr = u * Pv :Pr is calculated as Pv * u (running value of Use) 111 | Pv = Pv - u * Pv :update Pv as per Eq. 3 in Fuhrmann et al. 112 | :printf("Pv = %g\n", Pv) 113 | :printf("Pr = %g\n", Pr) 114 | tsyn = t 115 | if (ranfAMPA() < Pr){ 116 | A = A + weight*factor 117 | B = B + weight*factor 118 | } 119 | } 120 | -------------------------------------------------------------------------------- /Python_scripts/mods/ProbAMPANMDA.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | /** 3 | * @file ProbAMPANMDA.mod 4 | * @brief 5 | * @author king 6 | * @date 2010-03-03 7 | * @remark Copyright © BBP/EPFL 2005-2011; All rights reserved. Do not distribute without further notice. 8 | */ 9 | ENDCOMMENT 10 | 11 | TITLE AMPA and NMDA receptor with presynaptic short-term plasticity 12 | 13 | 14 | COMMENT 15 | AMPA and NMDA receptor conductance using a dual-exponential profile 16 | presynaptic short-term plasticity based on Fuhrmann et al. 2002 17 | ENDCOMMENT 18 | 19 | 20 | NEURON { 21 | THREADSAFE 22 | 23 | POINT_PROCESS ProbAMPANMDA 24 | RANGE tau_r_AMPA, tau_d_AMPA, tau_r_NMDA, tau_d_NMDA 25 | RANGE Use, u, Dep, Fac, u0, mg, NMDA_ratio 26 | RANGE i, i_AMPA, i_NMDA, g_AMPA, g_NMDA, g, e 27 | NONSPECIFIC_CURRENT i, i_AMPA,i_NMDA 28 | POINTER rng 29 | RANGE synapseID, verboseLevel 30 | } 31 | 32 | PARAMETER { 33 | 34 | tau_r_AMPA = 0.2 (ms) : dual-exponential conductance profile 35 | tau_d_AMPA = 1.7 (ms) : IMPORTANT: tau_r < tau_d 36 | tau_r_NMDA = 0.29 (ms) : dual-exponential conductance profile 37 | tau_d_NMDA = 43 (ms) : IMPORTANT: tau_r < tau_d 38 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 39 | Dep = 100 (ms) : relaxation time constant from depression 40 | Fac = 10 (ms) : relaxation time constant from facilitation 41 | e = 0 (mV) : AMPA and NMDA reversal potential 42 | mg = 1 (mM) : initial concentration of mg2+ 43 | mggate 44 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 45 | u0 = 0 :initial value of u, which is the running value of Use 46 | NMDA_ratio = 0.71 (1) : The ratio of NMDA to AMPA 47 | synapseID = 0 48 | verboseLevel = 0 49 | } 50 | 51 | COMMENT 52 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 53 | for comparison with Pr to decide whether to activate the synapse or not 54 | ENDCOMMENT 55 | 56 | VERBATIM 57 | 58 | #include 59 | #include 60 | #include 61 | 62 | double nrn_random_pick(void* r); 63 | void* nrn_random_arg(int argpos); 64 | 65 | ENDVERBATIM 66 | 67 | 68 | ASSIGNED { 69 | 70 | v (mV) 71 | i (nA) 72 | i_AMPA (nA) 73 | i_NMDA (nA) 74 | g_AMPA (uS) 75 | g_NMDA (uS) 76 | g (uS) 77 | factor_AMPA 78 | factor_NMDA 79 | rng 80 | } 81 | 82 | STATE { 83 | 84 | A_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_r_AMPA 85 | B_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_d_AMPA 86 | A_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_r_NMDA 87 | B_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_d_NMDA 88 | } 89 | 90 | INITIAL{ 91 | 92 | LOCAL tp_AMPA, tp_NMDA 93 | 94 | A_AMPA = 0 95 | B_AMPA = 0 96 | 97 | A_NMDA = 0 98 | B_NMDA = 0 99 | 100 | tp_AMPA = (tau_r_AMPA*tau_d_AMPA)/(tau_d_AMPA-tau_r_AMPA)*log(tau_d_AMPA/tau_r_AMPA) :time to peak of the conductance 101 | tp_NMDA = (tau_r_NMDA*tau_d_NMDA)/(tau_d_NMDA-tau_r_NMDA)*log(tau_d_NMDA/tau_r_NMDA) :time to peak of the conductance 102 | 103 | factor_AMPA = -exp(-tp_AMPA/tau_r_AMPA)+exp(-tp_AMPA/tau_d_AMPA) :AMPA Normalization factor - so that when t = tp_AMPA, gsyn = gpeak 104 | factor_AMPA = 1/factor_AMPA 105 | 106 | factor_NMDA = -exp(-tp_NMDA/tau_r_NMDA)+exp(-tp_NMDA/tau_d_NMDA) :NMDA Normalization factor - so that when t = tp_NMDA, gsyn = gpeak 107 | factor_NMDA = 1/factor_NMDA 108 | 109 | } 110 | 111 | BREAKPOINT { 112 | 113 | SOLVE state METHOD cnexp 114 | mggate = 1 / (1 + exp(0.062 (/mV) * -(v)) * (mg / 3.57 (mM))) :mggate kinetics - Jahr & Stevens 1990 115 | g_AMPA = gmax*(B_AMPA-A_AMPA) :compute time varying conductance as the difference of state variables B_AMPA and A_AMPA 116 | g_NMDA = gmax*(B_NMDA-A_NMDA) * mggate :compute time varying conductance as the difference of state variables B_NMDA and A_NMDA and mggate kinetics 117 | g = g_AMPA + g_NMDA 118 | i_AMPA = g_AMPA*(v-e) :compute the AMPA driving force based on the time varying conductance, membrane potential, and AMPA reversal 119 | i_NMDA = g_NMDA*(v-e) :compute the NMDA driving force based on the time varying conductance, membrane potential, and NMDA reversal 120 | i = i_AMPA + i_NMDA 121 | } 122 | 123 | DERIVATIVE state{ 124 | 125 | A_AMPA' = -A_AMPA/tau_r_AMPA 126 | B_AMPA' = -B_AMPA/tau_d_AMPA 127 | A_NMDA' = -A_NMDA/tau_r_NMDA 128 | B_NMDA' = -B_NMDA/tau_d_NMDA 129 | } 130 | 131 | 132 | NET_RECEIVE (weight,weight_AMPA, weight_NMDA, Pv, Pr, u, tsyn (ms)){ 133 | LOCAL result 134 | weight_AMPA = weight 135 | weight_NMDA = weight * NMDA_ratio 136 | 137 | INITIAL{ 138 | Pv=1 139 | u=u0 140 | tsyn=t 141 | } 142 | 143 | : calc u at event- 144 | if (Fac > 0) { 145 | u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 146 | } else { 147 | u = Use 148 | } 149 | if(Fac > 0){ 150 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 151 | } 152 | 153 | 154 | Pv = 1 - (1-Pv) * exp(-(t-tsyn)/Dep) :Probability Pv for a vesicle to be available for release, analogous to the pool of synaptic 155 | :resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al. 156 | Pr = u * Pv :Pr is calculated as Pv * u (running value of Use) 157 | Pv = Pv - u * Pv :update Pv as per Eq. 3 in Fuhrmann et al. 158 | result = erand() : throw the random number 159 | 160 | if( verboseLevel > 0 ) { 161 | printf("Synapse %f at time %g: Pv = %g Pr = %g erand = %g\n", synapseID, t, Pv, Pr, result ) 162 | } 163 | 164 | tsyn = t 165 | 166 | if (result < Pr) { 167 | A_AMPA = A_AMPA + weight_AMPA*factor_AMPA 168 | B_AMPA = B_AMPA + weight_AMPA*factor_AMPA 169 | A_NMDA = A_NMDA + weight_NMDA*factor_NMDA 170 | B_NMDA = B_NMDA + weight_NMDA*factor_NMDA 171 | 172 | if( verboseLevel > 0 ) { 173 | printf( " vals %g %g %g %g\n", A_AMPA, weight_AMPA, factor_AMPA, weight ) 174 | } 175 | } 176 | } 177 | 178 | PROCEDURE setRNG() { 179 | VERBATIM 180 | { 181 | /** 182 | * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file. 183 | * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod 184 | * which points out that the Random must be in negexp(1) mode 185 | */ 186 | void** pv = (void**)(&_p_rng); 187 | if( ifarg(1)) { 188 | *pv = nrn_random_arg(1); 189 | } else { 190 | *pv = (void*)0; 191 | } 192 | } 193 | ENDVERBATIM 194 | } 195 | 196 | FUNCTION erand() { 197 | VERBATIM 198 | double value; 199 | if (_p_rng) { 200 | /* 201 | :Supports separate independent but reproducible streams for 202 | : each instance. However, the corresponding hoc Random 203 | : distribution MUST be set to Random.negexp(1) 204 | */ 205 | value = nrn_random_pick(_p_rng); 206 | //printf("random stream for this simulation = %lf\n",value); 207 | return value; 208 | }else{ 209 | ENDVERBATIM 210 | : the old standby. Cannot use if reproducible parallel sim 211 | : independent of nhost or which host this instance is on 212 | : is desired, since each instance on this cpu draws from 213 | : the same stream 214 | erand = exprand(1) 215 | VERBATIM 216 | } 217 | ENDVERBATIM 218 | erand = value 219 | } 220 | 221 | FUNCTION toggleVerbose() { 222 | verboseLevel = 1-verboseLevel 223 | } 224 | -------------------------------------------------------------------------------- /Python_scripts/mods/ProbAMPANMDA2_ratio.mod: -------------------------------------------------------------------------------- 1 | TITLE AMPA and NMDA receptor with presynaptic short-term plasticity 2 | 3 | 4 | COMMENT 5 | AMPA and NMDA receptor conductance using a dual-exponential profile 6 | presynaptic short-term plasticity based on Fuhrmann et al. 2002 7 | Implemented by Srikanth Ramaswamy, Blue Brain Project, July 2009 8 | Etay: changed weight to be equal for NMDA and AMPA, gmax accessible in Neuron 9 | 10 | ENDCOMMENT 11 | 12 | 13 | NEURON { 14 | 15 | POINT_PROCESS ProbAMPANMDA2_RATIO 16 | RANGE tau_r_AMPA, tau_d_AMPA, tau_r_NMDA, tau_d_NMDA 17 | RANGE Use, u, Dep, Fac, u0, weight_NMDA 18 | RANGE i, i_AMPA, i_NMDA, g_AMPA, g_NMDA, e, gmax, mgVoltageCoeff 19 | NONSPECIFIC_CURRENT i 20 | POINTER rng 21 | } 22 | 23 | PARAMETER { 24 | 25 | tau_r_AMPA = 0.2 (ms) : dual-exponential conductance profile 26 | tau_d_AMPA = 1.7 (ms) : IMPORTANT: tau_r < tau_d 27 | tau_r_NMDA = 2.04 (ms) : dual-exponential conductance profile 28 | tau_d_NMDA = 75.2 (ms) : IMPORTANT: tau_r < tau_d 29 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 30 | Dep = 100 (ms) : relaxation time constant from depression 31 | Fac = 10 (ms) : relaxation time constant from facilitation 32 | e = 0 (mV) : AMPA and NMDA reversal potential 33 | mg = 1 (mM) : initial concentration of mg2+ 34 | mgVoltageCoeff = 0.08 (mV) : the coefficient for the voltage dependance of the equation 35 | mggate 36 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 37 | u0 = 0 :initial value of u, which is the running value of Use 38 | } 39 | 40 | COMMENT 41 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 42 | for comparison with Pr to decide whether to activate the synapse or not 43 | ENDCOMMENT 44 | 45 | VERBATIM 46 | 47 | #include 48 | #include 49 | #include 50 | 51 | double nrn_random_pick(void* r); 52 | void* nrn_random_arg(int argpos); 53 | 54 | ENDVERBATIM 55 | 56 | 57 | ASSIGNED { 58 | 59 | v (mV) 60 | i (nA) 61 | i_AMPA (nA) 62 | i_NMDA (nA) 63 | g_AMPA (uS) 64 | g_NMDA (uS) 65 | factor_AMPA 66 | factor_NMDA 67 | rng 68 | weight_NMDA 69 | a 70 | } 71 | 72 | STATE { 73 | 74 | A_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_r_AMPA 75 | B_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_d_AMPA 76 | A_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_r_NMDA 77 | B_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_d_NMDA 78 | } 79 | 80 | INITIAL{ 81 | 82 | LOCAL tp_AMPA, tp_NMDA 83 | 84 | A_AMPA = 0 85 | B_AMPA = 0 86 | 87 | A_NMDA = 0 88 | B_NMDA = 0 89 | 90 | tp_AMPA = (tau_r_AMPA*tau_d_AMPA)/(tau_d_AMPA-tau_r_AMPA)*log(tau_d_AMPA/tau_r_AMPA) :time to peak of the conductance 91 | tp_NMDA = (tau_r_NMDA*tau_d_NMDA)/(tau_d_NMDA-tau_r_NMDA)*log(tau_d_NMDA/tau_r_NMDA) :time to peak of the conductance 92 | 93 | factor_AMPA = -exp(-tp_AMPA/tau_r_AMPA)+exp(-tp_AMPA/tau_d_AMPA) :AMPA Normalization factor - so that when t = tp_AMPA, gsyn = gpeak 94 | factor_AMPA = 1/factor_AMPA 95 | 96 | factor_NMDA = -exp(-tp_NMDA/tau_r_NMDA)+exp(-tp_NMDA/tau_d_NMDA) :NMDA Normalization factor - so that when t = tp_NMDA, gsyn = gpeak 97 | factor_NMDA = 1/factor_NMDA 98 | 99 | } 100 | 101 | BREAKPOINT { 102 | 103 | SOLVE state METHOD cnexp 104 | mggate = 1 / (1 + exp(mgVoltageCoeff * -(v)) * (mg / 3.57 (mM))) :mggate kinetics - Jahr & Stevens 1990 105 | g_AMPA = (1) * gmax * (B_AMPA-A_AMPA) :compute time varying conductance as the difference of state variables B_AMPA and A_AMPA 106 | g_NMDA = gmax*(B_NMDA-A_NMDA) * mggate :compute time varying conductance as the difference of state variables B_NMDA and A_NMDA and mggate kinetics 107 | i_AMPA = g_AMPA*(v-e) :compute the AMPA driving force based on the time varying conductance, membrane potential, and AMPA reversal 108 | i_NMDA = g_NMDA*(v-e) :compute the NMDA driving force based on the time varying conductance, membrane potential, and NMDA reversal 109 | i = i_AMPA + i_NMDA 110 | } 111 | 112 | DERIVATIVE state{ 113 | 114 | A_AMPA' = -A_AMPA/tau_r_AMPA 115 | B_AMPA' = -B_AMPA/tau_d_AMPA 116 | A_NMDA' = -A_NMDA/tau_r_NMDA 117 | B_NMDA' = -B_NMDA/tau_d_NMDA 118 | } 119 | 120 | 121 | NET_RECEIVE (weight,weight_AMPA, weight_NMDA, Pv, Pr, u, tsyn (ms)){ 122 | 123 | weight_AMPA = weight 124 | weight_NMDA = weight 125 | :printf("NMDA weight = %g\n", weight_NMDA) 126 | 127 | INITIAL{ 128 | Pv=1 129 | u=u0 130 | tsyn=t 131 | } 132 | 133 | : calc u at event- 134 | if (Fac > 0) { 135 | u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 136 | } else { 137 | u = Use 138 | } 139 | if(Fac > 0){ 140 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 141 | } 142 | 143 | 144 | Pv = 1 - (1-Pv) * exp(-(t-tsyn)/Dep) :Probability Pv for a vesicle to be available for release, analogous to the pool of synaptic 145 | :resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al. 146 | Pr = u * Pv :Pr is calculated as Pv * u (running value of Use) 147 | Pv = Pv - u * Pv :update Pv as per Eq. 3 in Fuhrmann et al. 148 | :printf("Pv = %g\n", Pv) 149 | :printf("Pr = %g\n", Pr) 150 | tsyn = t 151 | 152 | A_AMPA = A_AMPA + weight_AMPA*factor_AMPA 153 | B_AMPA = B_AMPA + weight_AMPA*factor_AMPA 154 | A_NMDA = A_NMDA + weight_NMDA*factor_NMDA 155 | B_NMDA = B_NMDA + weight_NMDA*factor_NMDA 156 | 157 | } 158 | 159 | PROCEDURE setRNG() { 160 | VERBATIM 161 | { 162 | /** 163 | * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file. 164 | * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod 165 | * which points out that the Random must be in negexp(1) mode 166 | */ 167 | void** pv = (void**)(&_p_rng); 168 | if( ifarg(1)) { 169 | *pv = nrn_random_arg(1); 170 | } else { 171 | *pv = (void*)0; 172 | } 173 | } 174 | ENDVERBATIM 175 | } 176 | 177 | FUNCTION erand() { 178 | VERBATIM 179 | //FILE *fi; 180 | double value; 181 | if (_p_rng) { 182 | /* 183 | :Supports separate independent but reproducible streams for 184 | : each instance. However, the corresponding hoc Random 185 | : distribution MUST be set to Random.negexp(1) 186 | */ 187 | value = nrn_random_pick(_p_rng); 188 | //fi = fopen("RandomStreamMCellRan4.txt", "w"); 189 | //fprintf(fi,"random stream for this simulation = %lf\n",value); 190 | //printf("random stream for this simulation = %lf\n",value); 191 | return value; 192 | }else{ 193 | ENDVERBATIM 194 | : the old standby. Cannot use if reproducible parallel sim 195 | : independent of nhost or which host this instance is on 196 | : is desired, since each instance on this cpu draws from 197 | : the same stream 198 | erand = exprand(1) 199 | VERBATIM 200 | } 201 | ENDVERBATIM 202 | erand = value 203 | } 204 | 205 | 206 | 207 | 208 | 209 | -------------------------------------------------------------------------------- /Python_scripts/mods/ProbAMPANMDA_EMS.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | /** 3 | * @file ProbAMPANMDA_EMS.mod 4 | * @brief 5 | * @author king, muller, reimann, ramaswamy 6 | * @date 2011-08-17 7 | * @remark Copyright © BBP/EPFL 2005-2011; All rights reserved. Do not distribute without further notice. 8 | */ 9 | ENDCOMMENT 10 | 11 | TITLE Probabilistic AMPA and NMDA receptor with presynaptic short-term plasticity 12 | 13 | 14 | COMMENT 15 | AMPA and NMDA receptor conductance using a dual-exponential profile 16 | presynaptic short-term plasticity as in Fuhrmann et al. 2002 17 | 18 | _EMS (Eilif Michael Srikanth) 19 | Modification of ProbAMPANMDA: 2-State model by Eilif Muller, Michael Reimann, Srikanth Ramaswamy, Blue Brain Project, August 2011 20 | This new model was motivated by the following constraints: 21 | 22 | 1) No consumption on failure. 23 | 2) No release just after release until recovery. 24 | 3) Same ensemble averaged trace as deterministic/canonical Tsodyks-Markram 25 | using same parameters determined from experiment. 26 | 4) Same quantal size as present production probabilistic model. 27 | 28 | To satisfy these constaints, the synapse is implemented as a 29 | uni-vesicular (generalization to multi-vesicular should be 30 | straight-forward) 2-state Markov process. The states are 31 | {1=recovered, 0=unrecovered}. 32 | 33 | For a pre-synaptic spike or external spontaneous release trigger 34 | event, the synapse will only release if it is in the recovered state, 35 | and with probability u (which follows facilitation dynamics). If it 36 | releases, it will transition to the unrecovered state. Recovery is as 37 | a Poisson process with rate 1/Dep. 38 | 39 | This model satisys all of (1)-(4). 40 | 41 | 42 | ENDCOMMENT 43 | 44 | 45 | NEURON { 46 | THREADSAFE 47 | POINT_PROCESS ProbAMPANMDA_EMS 48 | RANGE tau_r_AMPA, tau_d_AMPA, tau_r_NMDA, tau_d_NMDA 49 | RANGE Use, u, Dep, Fac, u0, mg, Rstate, tsyn_fac, u 50 | RANGE i, i_AMPA, i_NMDA, g_AMPA, g_NMDA, g, e, NMDA_ratio 51 | RANGE A_AMPA_step, B_AMPA_step, A_NMDA_step, B_NMDA_step 52 | NONSPECIFIC_CURRENT i 53 | POINTER rng 54 | RANGE synapseID, verboseLevel 55 | } 56 | 57 | PARAMETER { 58 | 59 | 60 | tau_r_AMPA = 0.2 (ms) : dual-exponential conductance profile 61 | tau_d_AMPA = 1.7 (ms) : IMPORTANT: tau_r < tau_d 62 | tau_r_NMDA = 0.29 (ms) : dual-exponential conductance profile 63 | tau_d_NMDA = 43 (ms) : IMPORTANT: tau_r < tau_d 64 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 65 | Dep = 100 (ms) : relaxation time constant from depression 66 | Fac = 10 (ms) : relaxation time constant from facilitation 67 | e = 0 (mV) : AMPA and NMDA reversal potential 68 | mg = 1 (mM) : initial concentration of mg2+ 69 | mggate 70 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 71 | u0 = 0 :initial value of u, which is the running value of release probability 72 | synapseID = 0 73 | verboseLevel = 0 74 | NMDA_ratio = 0.71 (1) : The ratio of NMDA to AMPA 75 | } 76 | 77 | COMMENT 78 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 79 | for comparison with Pr to decide whether to activate the synapse or not 80 | ENDCOMMENT 81 | 82 | VERBATIM 83 | 84 | #include 85 | #include 86 | #include 87 | 88 | double nrn_random_pick(void* r); 89 | void* nrn_random_arg(int argpos); 90 | 91 | ENDVERBATIM 92 | 93 | 94 | ASSIGNED { 95 | 96 | v (mV) 97 | i (nA) 98 | i_AMPA (nA) 99 | i_NMDA (nA) 100 | g_AMPA (uS) 101 | g_NMDA (uS) 102 | g (uS) 103 | factor_AMPA 104 | factor_NMDA 105 | A_AMPA_step 106 | B_AMPA_step 107 | A_NMDA_step 108 | B_NMDA_step 109 | rng 110 | 111 | : Recording these three, you can observe full state of model 112 | : tsyn_fac gives you presynaptic times, Rstate gives you 113 | : state transitions, 114 | : u gives you the "release probability" at transitions 115 | : (attention: u is event based based, so only valid at incoming events) 116 | Rstate (1) : recovered state {0=unrecovered, 1=recovered} 117 | tsyn_fac (ms) : the time of the last spike 118 | u (1) : running release probability 119 | 120 | } 121 | 122 | STATE { 123 | 124 | A_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_r_AMPA 125 | B_AMPA : AMPA state variable to construct the dual-exponential profile - decays with conductance tau_d_AMPA 126 | A_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_r_NMDA 127 | B_NMDA : NMDA state variable to construct the dual-exponential profile - decays with conductance tau_d_NMDA 128 | } 129 | 130 | INITIAL{ 131 | 132 | LOCAL tp_AMPA, tp_NMDA 133 | 134 | Rstate=1 135 | tsyn_fac=0 136 | u=u0 137 | 138 | A_AMPA = 0 139 | B_AMPA = 0 140 | 141 | A_NMDA = 0 142 | B_NMDA = 0 143 | 144 | tp_AMPA = (tau_r_AMPA*tau_d_AMPA)/(tau_d_AMPA-tau_r_AMPA)*log(tau_d_AMPA/tau_r_AMPA) :time to peak of the conductance 145 | tp_NMDA = (tau_r_NMDA*tau_d_NMDA)/(tau_d_NMDA-tau_r_NMDA)*log(tau_d_NMDA/tau_r_NMDA) :time to peak of the conductance 146 | 147 | factor_AMPA = -exp(-tp_AMPA/tau_r_AMPA)+exp(-tp_AMPA/tau_d_AMPA) :AMPA Normalization factor - so that when t = tp_AMPA, gsyn = gpeak 148 | factor_AMPA = 1/factor_AMPA 149 | 150 | factor_NMDA = -exp(-tp_NMDA/tau_r_NMDA)+exp(-tp_NMDA/tau_d_NMDA) :NMDA Normalization factor - so that when t = tp_NMDA, gsyn = gpeak 151 | factor_NMDA = 1/factor_NMDA 152 | 153 | A_AMPA_step = exp(dt*(( - 1.0 ) / tau_r_AMPA)) 154 | B_AMPA_step = exp(dt*(( - 1.0 ) / tau_d_AMPA)) 155 | A_NMDA_step = exp(dt*(( - 1.0 ) / tau_r_NMDA)) 156 | B_NMDA_step = exp(dt*(( - 1.0 ) / tau_d_NMDA)) 157 | } 158 | 159 | BREAKPOINT { 160 | 161 | SOLVE state 162 | mggate = 1 / (1 + exp(0.062 (/mV) * -(v)) * (mg / 3.57 (mM))) :mggate kinetics - Jahr & Stevens 1990 163 | g_AMPA = gmax*(B_AMPA-A_AMPA) :compute time varying conductance as the difference of state variables B_AMPA and A_AMPA 164 | g_NMDA = gmax*(B_NMDA-A_NMDA) * mggate :compute time varying conductance as the difference of state variables B_NMDA and A_NMDA and mggate kinetics 165 | g = g_AMPA + g_NMDA 166 | i_AMPA = g_AMPA*(v-e) :compute the AMPA driving force based on the time varying conductance, membrane potential, and AMPA reversal 167 | i_NMDA = g_NMDA*(v-e) :compute the NMDA driving force based on the time varying conductance, membrane potential, and NMDA reversal 168 | i = i_AMPA + i_NMDA 169 | } 170 | 171 | PROCEDURE state() { 172 | A_AMPA = A_AMPA*A_AMPA_step 173 | B_AMPA = B_AMPA*B_AMPA_step 174 | A_NMDA = A_NMDA*A_NMDA_step 175 | B_NMDA = B_NMDA*B_NMDA_step 176 | } 177 | 178 | 179 | NET_RECEIVE (weight,weight_AMPA, weight_NMDA, Psurv, tsyn (ms)){ 180 | LOCAL result 181 | weight_AMPA = weight 182 | weight_NMDA = weight * NMDA_ratio 183 | : Locals: 184 | : Psurv - survival probability of unrecovered state 185 | : tsyn - time since last surival evaluation. 186 | 187 | INITIAL{ 188 | tsyn=t 189 | } 190 | 191 | : Do not perform any calculations if the synapse (netcon) is deactivated. This avoids drawing from the random stream 192 | if( !(weight > 0) ) { 193 | VERBATIM 194 | return; 195 | ENDVERBATIM 196 | } 197 | 198 | : calc u at event- 199 | if (Fac > 0) { 200 | u = u*exp(-(t - tsyn_fac)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 201 | } else { 202 | u = Use 203 | } 204 | if(Fac > 0){ 205 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 206 | } 207 | 208 | : tsyn_fac knows about all spikes, not only those that released 209 | : i.e. each spike can increase the u, regardless of recovered state. 210 | tsyn_fac = t 211 | 212 | : recovery 213 | 214 | if (Rstate == 0) { 215 | : probability of survival of unrecovered state based on Poisson recovery with rate 1/tau 216 | Psurv = exp(-(t-tsyn)/Dep) 217 | result = urand() 218 | if (result>Psurv) { 219 | Rstate = 1 : recover 220 | 221 | if( verboseLevel > 0 ) { 222 | printf( "Recovered! %f at time %g: Psurv = %g, urand=%g\n", synapseID, t, Psurv, result ) 223 | } 224 | 225 | } 226 | else { 227 | : survival must now be from this interval 228 | tsyn = t 229 | if( verboseLevel > 0 ) { 230 | printf( "Failed to recover! %f at time %g: Psurv = %g, urand=%g\n", synapseID, t, Psurv, result ) 231 | } 232 | } 233 | } 234 | 235 | if (Rstate == 1) { 236 | result = urand() 237 | if (result 0 ) { 247 | printf( "Release! %f at time %g: vals %g %g %g %g\n", synapseID, t, A_AMPA, weight_AMPA, factor_AMPA, weight ) 248 | } 249 | 250 | } 251 | else { 252 | if( verboseLevel > 0 ) { 253 | printf("Failure! %f at time %g: urand = %g\n", synapseID, t, result ) 254 | } 255 | 256 | } 257 | 258 | } 259 | 260 | } 261 | 262 | PROCEDURE setRNG() { 263 | VERBATIM 264 | { 265 | /** 266 | * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file. 267 | * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod 268 | * which points out that the Random must be in uniform(1) mode 269 | */ 270 | void** pv = (void**)(&_p_rng); 271 | if( ifarg(1)) { 272 | *pv = nrn_random_arg(1); 273 | } else { 274 | *pv = (void*)0; 275 | } 276 | } 277 | ENDVERBATIM 278 | } 279 | 280 | FUNCTION urand() { 281 | VERBATIM 282 | double value; 283 | if (_p_rng) { 284 | /* 285 | :Supports separate independent but reproducible streams for 286 | : each instance. However, the corresponding hoc Random 287 | : distribution MUST be set to Random.negexp(1) 288 | */ 289 | value = nrn_random_pick(_p_rng); 290 | //printf("random stream for this simulation = %lf\n",value); 291 | return value; 292 | }else{ 293 | ENDVERBATIM 294 | : the old standby. Cannot use if reproducible parallel sim 295 | : independent of nhost or which host this instance is on 296 | : is desired, since each instance on this cpu draws from 297 | : the same stream 298 | value = scop_random(1) 299 | VERBATIM 300 | } 301 | ENDVERBATIM 302 | urand = value 303 | } 304 | 305 | FUNCTION toggleVerbose() { 306 | verboseLevel = 1-verboseLevel 307 | } 308 | -------------------------------------------------------------------------------- /Python_scripts/mods/ProbGABAA.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | /** 3 | * @file ProbGABAA.mod 4 | * @brief 5 | * @author king 6 | * @date 2010-03-03 7 | * @remark Copyright © BBP/EPFL 2005-2011; All rights reserved. Do not distribute without further notice. 8 | */ 9 | ENDCOMMENT 10 | 11 | TITLE GABAA receptor with presynaptic short-term plasticity 12 | 13 | 14 | COMMENT 15 | GABAA receptor conductance using a dual-exponential profile 16 | presynaptic short-term plasticity based on Fuhrmann et al, 2002 17 | Implemented by Srikanth Ramaswamy, Blue Brain Project, March 2009 18 | ENDCOMMENT 19 | 20 | 21 | NEURON { 22 | THREADSAFE 23 | POINT_PROCESS ProbGABAA 24 | RANGE tau_r, tau_d 25 | RANGE Use, u, Dep, Fac, u0 26 | RANGE i, g, e 27 | NONSPECIFIC_CURRENT i 28 | POINTER rng 29 | RANGE synapseID, verboseLevel 30 | } 31 | 32 | PARAMETER { 33 | tau_r = 0.2 (ms) : dual-exponential conductance profile 34 | tau_d = 8 (ms) : IMPORTANT: tau_r < tau_d 35 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 36 | Dep = 100 (ms) : relaxation time constant from depression 37 | Fac = 10 (ms) : relaxation time constant from facilitation 38 | e = -80 (mV) : GABAA reversal potential 39 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 40 | u0 = 0 :initial value of u, which is the running value of Use 41 | synapseID = 0 42 | verboseLevel = 0 43 | } 44 | 45 | COMMENT 46 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 47 | for comparison with Pr to decide whether to activate the synapse or not 48 | ENDCOMMENT 49 | 50 | VERBATIM 51 | #include 52 | #include 53 | #include 54 | 55 | double nrn_random_pick(void* r); 56 | void* nrn_random_arg(int argpos); 57 | 58 | ENDVERBATIM 59 | 60 | 61 | ASSIGNED { 62 | v (mV) 63 | i (nA) 64 | g (uS) 65 | factor 66 | rng 67 | } 68 | 69 | STATE { 70 | A : state variable to construct the dual-exponential profile - decays with conductance tau_r 71 | B : state variable to construct the dual-exponential profile - decays with conductance tau_d 72 | } 73 | 74 | INITIAL{ 75 | LOCAL tp 76 | A = 0 77 | B = 0 78 | tp = (tau_r*tau_d)/(tau_d-tau_r)*log(tau_d/tau_r) :time to peak of the conductance 79 | factor = -exp(-tp/tau_r)+exp(-tp/tau_d) :Normalization factor - so that when t = tp, gsyn = gpeak 80 | factor = 1/factor 81 | } 82 | 83 | BREAKPOINT { 84 | SOLVE state METHOD cnexp 85 | g = gmax*(B-A) :compute time varying conductance as the difference of state variables B and A 86 | i = g*(v-e) :compute the driving force based on the time varying conductance, membrane potential, and GABAA reversal 87 | } 88 | 89 | DERIVATIVE state{ 90 | A' = -A/tau_r 91 | B' = -B/tau_d 92 | } 93 | 94 | 95 | NET_RECEIVE (weight, Pv, Pr, u, tsyn (ms)){ 96 | LOCAL result 97 | INITIAL{ 98 | Pv=1 99 | u=u0 100 | tsyn=t 101 | } 102 | 103 | : calc u at event- 104 | if (Fac > 0) { 105 | u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 106 | } else { 107 | u = Use 108 | } 109 | if(Fac > 0) { 110 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 111 | } 112 | 113 | 114 | Pv = 1 - (1-Pv) * exp(-(t-tsyn)/Dep) :Probability Pv for a vesicle to be available for release, analogous to the pool of synaptic 115 | :resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al. 116 | Pr = u * Pv :Pr is calculated as Pv * u (running value of Use) 117 | Pv = Pv - u * Pv :update Pv as per Eq. 3 in Fuhrmann et al. 118 | result = erand() : throw the random number 119 | 120 | if( verboseLevel > 0 ) { 121 | printf("Synapse %f at time %g: Pv = %g Pr = %g erand = %g\n", synapseID, t, Pv, Pr, result ) 122 | } 123 | 124 | tsyn = t 125 | if (result < Pr) { 126 | A = A + weight*factor 127 | B = B + weight*factor 128 | 129 | if( verboseLevel > 0 ) { 130 | printf( " vals %g %g %g %g\n", A, B, weight, factor ) 131 | } 132 | } 133 | } 134 | 135 | PROCEDURE setRNG() { 136 | VERBATIM 137 | { 138 | /** 139 | * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file. 140 | * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod 141 | */ 142 | void** pv = (void**)(&_p_rng); 143 | if( ifarg(1)) { 144 | *pv = nrn_random_arg(1); 145 | } else { 146 | *pv = (void*)0; 147 | } 148 | } 149 | ENDVERBATIM 150 | } 151 | 152 | FUNCTION erand() { 153 | VERBATIM 154 | double value; 155 | if (_p_rng) { 156 | /* 157 | :Supports separate independent but reproducible streams for 158 | : each instance. However, the corresponding hoc Random 159 | : distribution MUST be set to Random.negexp(1) 160 | */ 161 | value = nrn_random_pick(_p_rng); 162 | //printf("random stream for this simulation = %lf\n",value); 163 | return value; 164 | }else{ 165 | ENDVERBATIM 166 | : the old standby. Cannot use if reproducible parallel sim 167 | : independent of nhost or which host this instance is on 168 | : is desired, since each instance on this cpu draws from 169 | : the same stream 170 | erand = exprand(1) 171 | VERBATIM 172 | } 173 | ENDVERBATIM 174 | erand = value 175 | } 176 | 177 | FUNCTION toggleVerbose() { 178 | verboseLevel = 1 - verboseLevel 179 | } 180 | -------------------------------------------------------------------------------- /Python_scripts/mods/ProbGABAAB_EMS.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | /** 3 | * @file ProbGABAAB.mod 4 | * @brief 5 | * @author king, muller 6 | * @date 2011-08-17 7 | * @remark Copyright © BBP/EPFL 2005-2011; All rights reserved. Do not distribute without further notice. 8 | */ 9 | ENDCOMMENT 10 | 11 | TITLE GABAAB receptor with presynaptic short-term plasticity 12 | 13 | 14 | COMMENT 15 | GABAA receptor conductance using a dual-exponential profile 16 | presynaptic short-term plasticity based on Fuhrmann et al, 2002 17 | Implemented by Srikanth Ramaswamy, Blue Brain Project, March 2009 18 | 19 | _EMS (Eilif Michael Srikanth) 20 | Modification of ProbGABAA: 2-State model by Eilif Muller, Michael Reimann, Srikanth Ramaswamy, Blue Brain Project, August 2011 21 | This new model was motivated by the following constraints: 22 | 23 | 1) No consumption on failure. 24 | 2) No release just after release until recovery. 25 | 3) Same ensemble averaged trace as deterministic/canonical Tsodyks-Markram 26 | using same parameters determined from experiment. 27 | 4) Same quantal size as present production probabilistic model. 28 | 29 | To satisfy these constaints, the synapse is implemented as a 30 | uni-vesicular (generalization to multi-vesicular should be 31 | straight-forward) 2-state Markov process. The states are 32 | {1=recovered, 0=unrecovered}. 33 | 34 | For a pre-synaptic spike or external spontaneous release trigger 35 | event, the synapse will only release if it is in the recovered state, 36 | and with probability u (which follows facilitation dynamics). If it 37 | releases, it will transition to the unrecovered state. Recovery is as 38 | a Poisson process with rate 1/Dep. 39 | 40 | This model satisys all of (1)-(4). 41 | 42 | 43 | ENDCOMMENT 44 | 45 | 46 | NEURON { 47 | THREADSAFE 48 | POINT_PROCESS ProbGABAAB_EMS 49 | RANGE tau_r_GABAA, tau_d_GABAA, tau_r_GABAB, tau_d_GABAB 50 | RANGE Use, u, Dep, Fac, u0, Rstate, tsyn_fac, u 51 | RANGE i,i_GABAA, i_GABAB, g_GABAA, g_GABAB, g, e_GABAA, e_GABAB, GABAB_ratio 52 | RANGE A_GABAA_step, B_GABAA_step, A_GABAB_step, B_GABAB_step 53 | NONSPECIFIC_CURRENT i 54 | POINTER rng 55 | RANGE synapseID, verboseLevel 56 | } 57 | 58 | PARAMETER { 59 | tau_r_GABAA = 0.2 (ms) : dual-exponential conductance profile 60 | tau_d_GABAA = 8 (ms) : IMPORTANT: tau_r < tau_d 61 | tau_r_GABAB = 3.5 (ms) : dual-exponential conductance profile :Placeholder value from hippocampal recordings SR 62 | tau_d_GABAB = 260.9 (ms) : IMPORTANT: tau_r < tau_d :Placeholder value from hippocampal recordings 63 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 64 | Dep = 100 (ms) : relaxation time constant from depression 65 | Fac = 10 (ms) : relaxation time constant from facilitation 66 | e_GABAA = -80 (mV) : GABAA reversal potential 67 | e_GABAB = -97 (mV) : GABAB reversal potential 68 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 69 | u0 = 0 :initial value of u, which is the running value of release probability 70 | synapseID = 0 71 | verboseLevel = 0 72 | GABAB_ratio = 0 (1) : The ratio of GABAB to GABAA 73 | } 74 | 75 | COMMENT 76 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 77 | for comparison with Pr to decide whether to activate the synapse or not 78 | ENDCOMMENT 79 | 80 | VERBATIM 81 | #include 82 | #include 83 | #include 84 | 85 | double nrn_random_pick(void* r); 86 | void* nrn_random_arg(int argpos); 87 | 88 | ENDVERBATIM 89 | 90 | 91 | ASSIGNED { 92 | v (mV) 93 | i (nA) 94 | i_GABAA (nA) 95 | i_GABAB (nA) 96 | g_GABAA (uS) 97 | g_GABAB (uS) 98 | A_GABAA_step 99 | B_GABAA_step 100 | A_GABAB_step 101 | B_GABAB_step 102 | g (uS) 103 | factor_GABAA 104 | factor_GABAB 105 | rng 106 | 107 | : Recording these three, you can observe full state of model 108 | : tsyn_fac gives you presynaptic times, Rstate gives you 109 | : state transitions, 110 | : u gives you the "release probability" at transitions 111 | : (attention: u is event based based, so only valid at incoming events) 112 | Rstate (1) : recovered state {0=unrecovered, 1=recovered} 113 | tsyn_fac (ms) : the time of the last spike 114 | u (1) : running release probability 115 | 116 | 117 | } 118 | 119 | STATE { 120 | A_GABAA : GABAA state variable to construct the dual-exponential profile - decays with conductance tau_r_GABAA 121 | B_GABAA : GABAA state variable to construct the dual-exponential profile - decays with conductance tau_d_GABAA 122 | A_GABAB : GABAB state variable to construct the dual-exponential profile - decays with conductance tau_r_GABAB 123 | B_GABAB : GABAB state variable to construct the dual-exponential profile - decays with conductance tau_d_GABAB 124 | } 125 | 126 | INITIAL{ 127 | 128 | LOCAL tp_GABAA, tp_GABAB 129 | 130 | Rstate=1 131 | tsyn_fac=0 132 | u=u0 133 | 134 | A_GABAA = 0 135 | B_GABAA = 0 136 | 137 | A_GABAB = 0 138 | B_GABAB = 0 139 | 140 | tp_GABAA = (tau_r_GABAA*tau_d_GABAA)/(tau_d_GABAA-tau_r_GABAA)*log(tau_d_GABAA/tau_r_GABAA) :time to peak of the conductance 141 | tp_GABAB = (tau_r_GABAB*tau_d_GABAB)/(tau_d_GABAB-tau_r_GABAB)*log(tau_d_GABAB/tau_r_GABAB) :time to peak of the conductance 142 | 143 | factor_GABAA = -exp(-tp_GABAA/tau_r_GABAA)+exp(-tp_GABAA/tau_d_GABAA) :GABAA Normalization factor - so that when t = tp_GABAA, gsyn = gpeak 144 | factor_GABAA = 1/factor_GABAA 145 | 146 | factor_GABAB = -exp(-tp_GABAB/tau_r_GABAB)+exp(-tp_GABAB/tau_d_GABAB) :GABAB Normalization factor - so that when t = tp_GABAB, gsyn = gpeak 147 | factor_GABAB = 1/factor_GABAB 148 | 149 | A_GABAA_step = exp(dt*(( - 1.0 ) / tau_r_GABAA)) 150 | B_GABAA_step = exp(dt*(( - 1.0 ) / tau_d_GABAA)) 151 | A_GABAB_step = exp(dt*(( - 1.0 ) / tau_r_GABAB)) 152 | B_GABAB_step = exp(dt*(( - 1.0 ) / tau_d_GABAB)) 153 | } 154 | 155 | BREAKPOINT { 156 | SOLVE state 157 | 158 | g_GABAA = gmax*(B_GABAA-A_GABAA) :compute time varying conductance as the difference of state variables B_GABAA and A_GABAA 159 | g_GABAB = gmax*(B_GABAB-A_GABAB) :compute time varying conductance as the difference of state variables B_GABAB and A_GABAB 160 | g = g_GABAA + g_GABAB 161 | i_GABAA = g_GABAA*(v-e_GABAA) :compute the GABAA driving force based on the time varying conductance, membrane potential, and GABAA reversal 162 | i_GABAB = g_GABAB*(v-e_GABAB) :compute the GABAB driving force based on the time varying conductance, membrane potential, and GABAB reversal 163 | i = i_GABAA + i_GABAB 164 | } 165 | 166 | PROCEDURE state() { 167 | A_GABAA = A_GABAA*A_GABAA_step 168 | B_GABAA = B_GABAA*B_GABAA_step 169 | A_GABAB = A_GABAB*A_GABAB_step 170 | B_GABAB = B_GABAB*B_GABAB_step 171 | } 172 | 173 | 174 | NET_RECEIVE (weight, weight_GABAA, weight_GABAB, Psurv, tsyn (ms)){ 175 | LOCAL result 176 | weight_GABAA = weight 177 | weight_GABAB = weight*GABAB_ratio 178 | : Locals: 179 | : Psurv - survival probability of unrecovered state 180 | : tsyn - time since last surival evaluation. 181 | 182 | 183 | INITIAL{ 184 | tsyn=t 185 | } 186 | 187 | : Do not perform any calculations if the synapse (netcon) is deactivated. This avoids drawing from the random stream 188 | if( !(weight > 0) ) { 189 | VERBATIM 190 | return; 191 | ENDVERBATIM 192 | } 193 | 194 | : calc u at event- 195 | if (Fac > 0) { 196 | u = u*exp(-(t - tsyn_fac)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 197 | } else { 198 | u = Use 199 | } 200 | if(Fac > 0){ 201 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 202 | } 203 | 204 | : tsyn_fac knows about all spikes, not only those that released 205 | : i.e. each spike can increase the u, regardless of recovered state. 206 | tsyn_fac = t 207 | 208 | : recovery 209 | if (Rstate == 0) { 210 | : probability of survival of unrecovered state based on Poisson recovery with rate 1/tau 211 | Psurv = exp(-(t-tsyn)/Dep) 212 | result = urand() 213 | if (result>Psurv) { 214 | Rstate = 1 : recover 215 | 216 | if( verboseLevel > 0 ) { 217 | printf( "Recovered! %f at time %g: Psurv = %g, urand=%g\n", synapseID, t, Psurv, result ) 218 | } 219 | 220 | } 221 | else { 222 | : survival must now be from this interval 223 | tsyn = t 224 | if( verboseLevel > 0 ) { 225 | printf( "Failed to recover! %f at time %g: Psurv = %g, urand=%g\n", synapseID, t, Psurv, result ) 226 | } 227 | } 228 | } 229 | 230 | if (Rstate == 1) { 231 | result = urand() 232 | if (result 0 ) { 243 | printf( "Release! %f at time %g: vals %g %g %g \n", synapseID, t, A_GABAA, weight_GABAA, factor_GABAA ) 244 | } 245 | 246 | } 247 | else { 248 | if( verboseLevel > 0 ) { 249 | printf("Failure! %f at time %g: urand = %g\n", synapseID, t, result ) 250 | } 251 | 252 | } 253 | 254 | } 255 | 256 | 257 | 258 | } 259 | 260 | 261 | PROCEDURE setRNG() { 262 | VERBATIM 263 | { 264 | /** 265 | * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file. 266 | * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod 267 | */ 268 | void** pv = (void**)(&_p_rng); 269 | if( ifarg(1)) { 270 | *pv = nrn_random_arg(1); 271 | } else { 272 | *pv = (void*)0; 273 | } 274 | } 275 | ENDVERBATIM 276 | } 277 | 278 | FUNCTION urand() { 279 | VERBATIM 280 | double value; 281 | if (_p_rng) { 282 | /* 283 | :Supports separate independent but reproducible streams for 284 | : each instance. However, the corresponding hoc Random 285 | : distribution MUST be set to Random.uniform(1) 286 | */ 287 | value = nrn_random_pick(_p_rng); 288 | //printf("random stream for this simulation = %lf\n",value); 289 | return value; 290 | }else{ 291 | ENDVERBATIM 292 | : the old standby. Cannot use if reproducible parallel sim 293 | : independent of nhost or which host this instance is on 294 | : is desired, since each instance on this cpu draws from 295 | : the same stream 296 | urand = scop_random(1) 297 | VERBATIM 298 | } 299 | ENDVERBATIM 300 | urand = value 301 | } 302 | 303 | FUNCTION toggleVerbose() { 304 | verboseLevel = 1 - verboseLevel 305 | } 306 | -------------------------------------------------------------------------------- /Python_scripts/mods/ProbGABAA_EMS.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | /** 3 | * @file ProbGABAA.mod 4 | * @brief 5 | * @author king, muller 6 | * @date 2011-08-17 7 | * @remark Copyright © BBP/EPFL 2005-2011; All rights reserved. Do not distribute without further notice. 8 | */ 9 | ENDCOMMENT 10 | 11 | TITLE GABAA receptor with presynaptic short-term plasticity 12 | 13 | 14 | COMMENT 15 | GABAA receptor conductance using a dual-exponential profile 16 | presynaptic short-term plasticity based on Fuhrmann et al, 2002 17 | Implemented by Srikanth Ramaswamy, Blue Brain Project, March 2009 18 | 19 | _EMS (Eilif Michael Srikanth) 20 | Modification of ProbGABAA: 2-State model by Eilif Muller, Michael Reimann, Srikanth Ramaswamy, Blue Brain Project, August 2011 21 | This new model was motivated by the following constraints: 22 | 23 | 1) No consumption on failure. 24 | 2) No release just after release until recovery. 25 | 3) Same ensemble averaged trace as deterministic/canonical Tsodyks-Markram 26 | using same parameters determined from experiment. 27 | 4) Same quantal size as present production probabilistic model. 28 | 29 | To satisfy these constaints, the synapse is implemented as a 30 | uni-vesicular (generalization to multi-vesicular should be 31 | straight-forward) 2-state Markov process. The states are 32 | {1=recovered, 0=unrecovered}. 33 | 34 | For a pre-synaptic spike or external spontaneous release trigger 35 | event, the synapse will only release if it is in the recovered state, 36 | and with probability u (which follows facilitation dynamics). If it 37 | releases, it will transition to the unrecovered state. Recovery is as 38 | a Poisson process with rate 1/Dep. 39 | 40 | This model satisys all of (1)-(4). 41 | 42 | 43 | ENDCOMMENT 44 | 45 | 46 | NEURON { 47 | THREADSAFE 48 | POINT_PROCESS ProbGABAA_EMS 49 | RANGE tau_r, tau_d 50 | RANGE Use, u, Dep, Fac, u0, Rstate, tsyn_fac, u 51 | RANGE i, g, e 52 | NONSPECIFIC_CURRENT i 53 | POINTER rng 54 | RANGE synapseID, verboseLevel 55 | } 56 | 57 | PARAMETER { 58 | tau_r = 0.2 (ms) : dual-exponential conductance profile 59 | tau_d = 8 (ms) : IMPORTANT: tau_r < tau_d 60 | Use = 1.0 (1) : Utilization of synaptic efficacy (just initial values! Use, Dep and Fac are overwritten by BlueBuilder assigned values) 61 | Dep = 100 (ms) : relaxation time constant from depression 62 | Fac = 10 (ms) : relaxation time constant from facilitation 63 | e = -80 (mV) : GABAA reversal potential 64 | gmax = .001 (uS) : weight conversion factor (from nS to uS) 65 | u0 = 0 :initial value of u, which is the running value of release probability 66 | synapseID = 0 67 | verboseLevel = 0 68 | } 69 | 70 | COMMENT 71 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 72 | for comparison with Pr to decide whether to activate the synapse or not 73 | ENDCOMMENT 74 | 75 | VERBATIM 76 | #include 77 | #include 78 | #include 79 | 80 | double nrn_random_pick(void* r); 81 | void* nrn_random_arg(int argpos); 82 | 83 | ENDVERBATIM 84 | 85 | 86 | ASSIGNED { 87 | v (mV) 88 | i (nA) 89 | g (uS) 90 | factor 91 | rng 92 | 93 | : Recording these three, you can observe full state of model 94 | : tsyn_fac gives you presynaptic times, Rstate gives you 95 | : state transitions, 96 | : u gives you the "release probability" at transitions 97 | : (attention: u is event based based, so only valid at incoming events) 98 | Rstate (1) : recovered state {0=unrecovered, 1=recovered} 99 | tsyn_fac (ms) : the time of the last spike 100 | u (1) : running release probability 101 | 102 | 103 | } 104 | 105 | STATE { 106 | A : state variable to construct the dual-exponential profile - decays with conductance tau_r 107 | B : state variable to construct the dual-exponential profile - decays with conductance tau_d 108 | } 109 | 110 | INITIAL{ 111 | 112 | LOCAL tp 113 | A = 0 114 | B = 0 115 | tp = (tau_r*tau_d)/(tau_d-tau_r)*log(tau_d/tau_r) :time to peak of the conductance 116 | factor = -exp(-tp/tau_r)+exp(-tp/tau_d) :Normalization factor - so that when t = tp, gsyn = gpeak 117 | factor = 1/factor 118 | 119 | Rstate=1 120 | tsyn_fac=0 121 | u=u0 122 | 123 | } 124 | 125 | BREAKPOINT { 126 | SOLVE state METHOD cnexp 127 | g = gmax*(B-A) :compute time varying conductance as the difference of state variables B and A 128 | i = g*(v-e) :compute the driving force based on the time varying conductance, membrane potential, and GABAA reversal 129 | } 130 | 131 | DERIVATIVE state{ 132 | A' = -A/tau_r 133 | B' = -B/tau_d 134 | } 135 | 136 | 137 | NET_RECEIVE (weight, Psurv, tsyn (ms)){ 138 | LOCAL result 139 | 140 | : Locals: 141 | : Psurv - survival probability of unrecovered state 142 | : tsyn - time since last surival evaluation. 143 | 144 | 145 | INITIAL{ 146 | tsyn=t 147 | } 148 | 149 | : calc u at event- 150 | if (Fac > 0) { 151 | u = u*exp(-(t - tsyn_fac)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 152 | } else { 153 | u = Use 154 | } 155 | if(Fac > 0){ 156 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 157 | } 158 | 159 | : tsyn_fac knows about all spikes, not only those that released 160 | : i.e. each spike can increase the u, regardless of recovered state. 161 | tsyn_fac = t 162 | 163 | : recovery 164 | 165 | if (Rstate == 0) { 166 | : probability of survival of unrecovered state based on Poisson recovery with rate 1/tau 167 | Psurv = exp(-(t-tsyn)/Dep) 168 | result = urand() 169 | if (result>Psurv) { 170 | Rstate = 1 : recover 171 | 172 | if( verboseLevel > 0 ) { 173 | printf( "Recovered! %f at time %g: Psurv = %g, urand=%g\n", synapseID, t, Psurv, result ) 174 | } 175 | 176 | } 177 | else { 178 | : survival must now be from this interval 179 | tsyn = t 180 | if( verboseLevel > 0 ) { 181 | printf( "Failed to recover! %f at time %g: Psurv = %g, urand=%g\n", synapseID, t, Psurv, result ) 182 | } 183 | } 184 | } 185 | 186 | if (Rstate == 1) { 187 | result = urand() 188 | if (result 0 ) { 197 | printf( "Release! %f at time %g: vals %g %g %g \n", synapseID, t, A, weight, factor ) 198 | } 199 | 200 | } 201 | else { 202 | if( verboseLevel > 0 ) { 203 | printf("Failure! %f at time %g: urand = %g\n", synapseID, t, result ) 204 | } 205 | 206 | } 207 | 208 | } 209 | 210 | 211 | 212 | } 213 | 214 | 215 | PROCEDURE setRNG() { 216 | VERBATIM 217 | { 218 | /** 219 | * This function takes a NEURON Random object declared in hoc and makes it usable by this mod file. 220 | * Note that this method is taken from Brett paper as used by netstim.hoc and netstim.mod 221 | */ 222 | void** pv = (void**)(&_p_rng); 223 | if( ifarg(1)) { 224 | *pv = nrn_random_arg(1); 225 | } else { 226 | *pv = (void*)0; 227 | } 228 | } 229 | ENDVERBATIM 230 | } 231 | 232 | FUNCTION urand() { 233 | VERBATIM 234 | double value; 235 | if (_p_rng) { 236 | /* 237 | :Supports separate independent but reproducible streams for 238 | : each instance. However, the corresponding hoc Random 239 | : distribution MUST be set to Random.uniform(1) 240 | */ 241 | value = nrn_random_pick(_p_rng); 242 | //printf("random stream for this simulation = %lf\n",value); 243 | return value; 244 | }else{ 245 | ENDVERBATIM 246 | : the old standby. Cannot use if reproducible parallel sim 247 | : independent of nhost or which host this instance is on 248 | : is desired, since each instance on this cpu draws from 249 | : the same stream 250 | urand = scop_random(1) 251 | VERBATIM 252 | } 253 | ENDVERBATIM 254 | urand = value 255 | } 256 | 257 | FUNCTION toggleVerbose() { 258 | verboseLevel = 1 - verboseLevel 259 | } 260 | -------------------------------------------------------------------------------- /Python_scripts/mods/ProbNMDA.mod: -------------------------------------------------------------------------------- 1 | TITLE NMDA receptor with presynaptic short-term plasticity 2 | 3 | 4 | COMMENT 5 | NMDA receptor conductance using a dual-exponential profile 6 | Presynaptic short-term plasticity based on Fuhrmann et al, 2002 7 | Implemented by Srikanth Ramaswamy, Blue Brain Project, March 2009 8 | ENDCOMMENT 9 | 10 | NEURON { 11 | THREADSAFE 12 | POINT_PROCESS ProbNMDA 13 | RANGE tau_r, tau_d 14 | RANGE Use, u, Dep, Fac, u0 15 | RANGE i, g, e 16 | RANGE mg,mggate 17 | NONSPECIFIC_CURRENT i 18 | } 19 | 20 | PARAMETER { 21 | tau_r = 0.29 (ms) : dual-exponential conductance profile 22 | tau_d = 43 (ms) : IMPORTANT: tau_r < tau_d 23 | Use = 0.67 (1) : Utilization of synaptic efficacy (just initial values! Use,Dep and Fac are overwritten by BlueBuilder assigned values) 24 | Dep = 800 (ms) : relaxation time constant from depression 25 | Fac = 3 (ms) : relaxation time constant from facilitation 26 | e = 0 (mV) : NMDA reversal potential 27 | gmax = 0.001 (us) : weight conversion factor (from nS to uS) 28 | mg = 1 (mM) : initial concentration of mg2+ 29 | mggate 30 | u0 = 0 :initial value of u, which is the running value of Use 31 | } 32 | 33 | COMMENT 34 | The Verbatim block is needed to generate random nos. from a uniform distribution between 0 and 1 35 | for comparison with Pr to decide whether to activate the synapse or not 36 | ENDCOMMENT 37 | 38 | VERBATIM 39 | #include 40 | #include 41 | #include 42 | 43 | float ranfNMDA(){ 44 | //double MAX = (double)RAND_MAX; 45 | double r = (rand() / (double) RAND_MAX); 46 | return r; 47 | } 48 | 49 | void SetSeedNowNMDA(){ 50 | #ifdef SYN_DEBUG 51 | srand(time(NULL)); 52 | #else 53 | srand(888); 54 | #endif 55 | return; 56 | } 57 | ENDVERBATIM 58 | 59 | 60 | 61 | ASSIGNED { 62 | v (mV) 63 | i (nA) 64 | g (uS) 65 | factor 66 | } 67 | 68 | STATE { 69 | A : state variable to construct the dual-exponential profile - decays with conductance tau_r 70 | B : state variable to construct the dual-exponential profile - decays with conductance tau_d 71 | } 72 | 73 | INITIAL{ 74 | LOCAL tp 75 | A = 0 76 | B = 0 77 | tp = (tau_r*tau_d)/(tau_d-tau_r)*log(tau_d/tau_r) :time to peak of the conductance 78 | factor = -exp(-tp/tau_r)+exp(-tp/tau_d) :Normalization factor - so that when t = tp, gsyn = gpeak 79 | factor = 1/factor 80 | SetSeedNowNMDA() 81 | } 82 | 83 | BREAKPOINT { 84 | SOLVE state METHOD cnexp 85 | mggate = 1 / (1 + exp(0.062 (/mV) * -(v)) * (mg / 3.57 (mM))) :mggate kinetics - Jahr & Stevens 1990 86 | g = gmax*(B - A)*mggate 87 | i = g*(v - e) 88 | } 89 | 90 | DERIVATIVE state { 91 | A' = -A/tau_r 92 | B' = -B/tau_d 93 | } 94 | 95 | NET_RECEIVE (weight, Pv, Pr, u, tsyn (ms)){ 96 | weight = weight*0.71 97 | :printf("weight NMDA = %g \n ",weight) 98 | :the NETCON.weight = gsyn (per synaptic contact) * scaling factor * 0.71, as gNMDA/gAMPA = 0.71 from Chaelon et al. 2003, and Markram et al. 1997 99 | INITIAL{ 100 | Pv=1 101 | u=u0 102 | tsyn=t 103 | } 104 | : calc u at event- 105 | if (Fac > 0) { 106 | u = u*exp(-(t - tsyn)/Fac) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 107 | } else { 108 | u = Use 109 | } 110 | if(Fac > 0){ 111 | u = u + Use*(1-u) :update facilitation variable if Fac>0 Eq. 2 in Fuhrmann et al. 112 | } 113 | 114 | 115 | Pv = 1 - (1-Pv) * exp(-(t-tsyn)/Dep) :Probability Pv for a vesicle to be available for release, analogous to the pool of synaptic 116 | :resources available for release in the deterministic model. Eq. 3 in Fuhrmann et al. 117 | Pr = u * Pv :Pr is calculated as Pv * u (running value of Use) 118 | Pv = Pv - u * Pv :update Pv as per Eq. 3 in Fuhrmann et al. 119 | :printf("Pv = %g\n", Pv) 120 | :printf("Pr = %g\n", Pr) 121 | tsyn = t 122 | if (ranfNMDA() < Pr){ 123 | A = A + weight*factor 124 | B = B + weight*factor 125 | } 126 | } 127 | 128 | -------------------------------------------------------------------------------- /Python_scripts/mods/SK_E2.mod: -------------------------------------------------------------------------------- 1 | : SK-type calcium-activated potassium current 2 | : Reference : Kohler et al. 1996 3 | 4 | NEURON { 5 | SUFFIX SK_E2 6 | USEION k READ ek WRITE ik 7 | USEION ca READ cai 8 | RANGE gSK_E2bar, gSK_E2, ik 9 | } 10 | 11 | UNITS { 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | (mM) = (milli/liter) 15 | } 16 | 17 | PARAMETER { 18 | v (mV) 19 | gSK_E2bar = .000001 (mho/cm2) 20 | zTau = 1 (ms) 21 | ek (mV) 22 | cai (mM) 23 | } 24 | 25 | ASSIGNED { 26 | zInf 27 | ik (mA/cm2) 28 | gSK_E2 (S/cm2) 29 | } 30 | 31 | STATE { 32 | z FROM 0 TO 1 33 | } 34 | 35 | BREAKPOINT { 36 | SOLVE states METHOD cnexp 37 | gSK_E2 = gSK_E2bar * z 38 | ik = gSK_E2 * (v - ek) 39 | } 40 | 41 | DERIVATIVE states { 42 | rates(cai) 43 | z' = (zInf - z) / zTau 44 | } 45 | 46 | PROCEDURE rates(ca(mM)) { 47 | if(ca < 1e-7){ 48 | ca = ca + 1e-07 49 | } 50 | zInf = 1/(1 + (0.00043 / ca)^4.8) 51 | } 52 | 53 | INITIAL { 54 | rates(cai) 55 | z = zInf 56 | } 57 | -------------------------------------------------------------------------------- /Python_scripts/mods/SKv3_1.mod: -------------------------------------------------------------------------------- 1 | :Comment : 2 | :Reference : : Characterization of a Shaw-related potassium channel family in rat brain, The EMBO Journal, vol.11, no.7,2473-2486 (1992) 3 | 4 | NEURON { 5 | SUFFIX SKv3_1 6 | USEION k READ ek WRITE ik 7 | RANGE gSKv3_1bar, gSKv3_1, ik 8 | } 9 | 10 | UNITS { 11 | (S) = (siemens) 12 | (mV) = (millivolt) 13 | (mA) = (milliamp) 14 | } 15 | 16 | PARAMETER { 17 | gSKv3_1bar = 0.00001 (S/cm2) 18 | } 19 | 20 | ASSIGNED { 21 | v (mV) 22 | ek (mV) 23 | ik (mA/cm2) 24 | gSKv3_1 (S/cm2) 25 | mInf 26 | mTau 27 | } 28 | 29 | STATE { 30 | m 31 | } 32 | 33 | BREAKPOINT { 34 | SOLVE states METHOD cnexp 35 | gSKv3_1 = gSKv3_1bar*m 36 | ik = gSKv3_1*(v-ek) 37 | } 38 | 39 | DERIVATIVE states { 40 | rates() 41 | m' = (mInf-m)/mTau 42 | } 43 | 44 | INITIAL{ 45 | rates() 46 | m = mInf 47 | } 48 | 49 | PROCEDURE rates(){ 50 | UNITSOFF 51 | mInf = 1/(1+exp(((v -(18.700))/(-9.700)))) 52 | mTau = 0.2*20.000/(1+exp(((v -(-46.560))/(-44.140)))) 53 | UNITSON 54 | } 55 | -------------------------------------------------------------------------------- /Python_scripts/mods/epsp.mod: -------------------------------------------------------------------------------- 1 | : this model is built-in to neuron with suffix epsp 2 | : Schaefer et al. 2003 3 | 4 | COMMENT 5 | modified from syn2.mod 6 | injected current with exponential rise and decay current defined by 7 | i = 0 for t < onset and 8 | i=amp*((1-exp(-(t-onset)/tau0))-(1-exp(-(t-onset)/tau1))) 9 | for t > onset 10 | 11 | compare to experimental current injection: 12 | i = - amp*(1-exp(-t/t1))*(exp(-t/t2)) 13 | 14 | -> tau1==t2 tau0 ^-1 = t1^-1 + t2^-1 15 | ENDCOMMENT 16 | 17 | INDEPENDENT {t FROM 0 TO 1 WITH 1 (ms)} 18 | 19 | NEURON { 20 | POINT_PROCESS epsp 21 | RANGE onset, tau0, tau1, imax, i, myv 22 | NONSPECIFIC_CURRENT i 23 | } 24 | UNITS { 25 | (nA) = (nanoamp) 26 | (mV) = (millivolt) 27 | (umho) = (micromho) 28 | } 29 | 30 | PARAMETER { 31 | onset=0 (ms) 32 | tau0=0.2 (ms) 33 | tau1=3.0 (ms) 34 | imax=0 (nA) 35 | v (mV) 36 | } 37 | 38 | ASSIGNED { i (nA) myv (mV)} 39 | 40 | LOCAL a[2] 41 | LOCAL tpeak 42 | LOCAL adjust 43 | LOCAL amp 44 | 45 | BREAKPOINT { 46 | myv = v 47 | i = curr(t) 48 | } 49 | 50 | FUNCTION myexp(x) { 51 | if (x < -100) { 52 | myexp = 0 53 | }else{ 54 | myexp = exp(x) 55 | } 56 | } 57 | 58 | FUNCTION curr(x) { 59 | tpeak=tau0*tau1*log(tau0/tau1)/(tau0-tau1) 60 | adjust=1/((1-myexp(-tpeak/tau0))-(1-myexp(-tpeak/tau1))) 61 | amp=adjust*imax 62 | if (x < onset) { 63 | curr = 0 64 | }else{ 65 | a[0]=1-myexp(-(x-onset)/tau0) 66 | a[1]=1-myexp(-(x-onset)/tau1) 67 | curr = -amp*(a[0]-a[1]) 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /Python_scripts/mods/kv.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | kv.mod 3 | 4 | Potassium channel, Hodgkin-Huxley style kinetics 5 | Kinetic rates based roughly on Sah et al. and Hamill et al. (1991) 6 | 7 | Author: Zach Mainen, Salk Institute, 1995, zach@salk.edu 8 | 9 | 26 Ago 2002 Modification of original channel to allow 10 | variable time step and to correct an initialization error. 11 | Done by Michael Hines(michael.hines@yale.e) and 12 | Ruggero Scorcioni(rscorcio@gmu.edu) at EU Advance Course 13 | in Computational Neuroscience. Obidos, Portugal 14 | 15 | 20110202 made threadsafe by Ted Carnevale 16 | 20120514 fixed singularity in PROCEDURE rates 17 | 18 | Special comment: 19 | 20 | This mechanism was designed to be run at a single operating 21 | temperature--37 deg C--which can be specified by the hoc 22 | assignment statement 23 | celsius = 37 24 | This mechanism is not intended to be used at other temperatures, 25 | or to investigate the effects of temperature changes. 26 | 27 | Zach Mainen created this particular model by adapting conductances 28 | from lower temperature to run at higher temperature, and found it 29 | necessary to reduce the temperature sensitivity of spike amplitude 30 | and time course. He accomplished this by increasing the net ionic 31 | conductance through the heuristic of changing the standard HH 32 | formula 33 | g = gbar*product_of_gating_variables 34 | to 35 | g = tadj*gbar*product_of_gating_variables 36 | where 37 | tadj = q10^((celsius - temp)/10) 38 | temp is the "reference temperature" (at which the gating variable 39 | time constants were originally determined) 40 | celsius is the "operating temperature" 41 | 42 | Users should note that this is equivalent to changing the channel 43 | density from gbar at the "reference temperature" temp (the 44 | temperature at which the at which the gating variable time 45 | constants were originally determined) to tadj*gbar at the 46 | "operating temperature" celsius. 47 | ENDCOMMENT 48 | 49 | NEURON { 50 | THREADSAFE 51 | SUFFIX kv 52 | USEION k READ ek WRITE ik 53 | RANGE n, gk, gbar 54 | RANGE ninf, ntau 55 | GLOBAL Ra, Rb 56 | GLOBAL q10, temp, tadj, vmin, vmax 57 | } 58 | 59 | UNITS { 60 | (mA) = (milliamp) 61 | (mV) = (millivolt) 62 | (pS) = (picosiemens) 63 | (um) = (micron) 64 | } 65 | 66 | PARAMETER { 67 | gbar = 5 (pS/um2) : 0.03 mho/cm2 68 | 69 | tha = 25 (mV) : v 1/2 for inf 70 | qa = 9 (mV) : inf slope 71 | 72 | Ra = 0.02 (/ms) : max act rate 73 | Rb = 0.002 (/ms) : max deact rate 74 | 75 | : dt (ms) 76 | temp = 23 (degC) : original temp 77 | q10 = 2.3 : temperature sensitivity 78 | 79 | vmin = -120 (mV) 80 | vmax = 100 (mV) 81 | } 82 | 83 | 84 | ASSIGNED { 85 | v (mV) 86 | celsius (degC) 87 | a (/ms) 88 | b (/ms) 89 | ik (mA/cm2) 90 | gk (pS/um2) 91 | ek (mV) 92 | ninf 93 | ntau (ms) 94 | tadj 95 | } 96 | 97 | 98 | STATE { n } 99 | 100 | INITIAL { 101 | tadj = q10^((celsius - temp)/(10 (degC))) : make all threads calculate tadj at initialization 102 | 103 | trates(v) 104 | n = ninf 105 | } 106 | 107 | BREAKPOINT { 108 | SOLVE states METHOD cnexp 109 | gk = tadj*gbar*n 110 | ik = (1e-4) * gk * (v - ek) 111 | } 112 | 113 | DERIVATIVE states { :Computes state variable n 114 | trates(v) : at the current v and dt. 115 | n' = (ninf-n)/ntau 116 | } 117 | 118 | PROCEDURE trates(v (mV)) { :Computes rate and other constants at current v. 119 | :Call once from HOC to initialize inf at resting v. 120 | TABLE ninf, ntau 121 | DEPEND celsius, temp, Ra, Rb, tha, qa 122 | FROM vmin TO vmax WITH 199 123 | 124 | rates(v): not consistently executed from here if usetable_hh == 1 125 | 126 | : tinc = -dt * tadj 127 | : nexp = 1 - exp(tinc/ntau) 128 | } 129 | 130 | UNITSOFF 131 | PROCEDURE rates(v (mV)) { :Computes rate and other constants at current v. 132 | :Call once from HOC to initialize inf at resting v. 133 | 134 | : singular when v = tha 135 | : a = Ra * (v - tha) / (1 - exp(-(v - tha)/qa)) 136 | : a = Ra * qa*((v - tha)/qa) / (1 - exp(-(v - tha)/qa)) 137 | : a = Ra * qa*(-(v - tha)/qa) / (exp(-(v - tha)/qa) - 1) 138 | a = Ra * qa * efun(-(v - tha)/qa) 139 | 140 | : singular when v = tha 141 | : b = -Rb * (v - tha) / (1 - exp((v - tha)/qa)) 142 | : b = -Rb * qa*((v - tha)/qa) / (1 - exp((v - tha)/qa)) 143 | : b = Rb * qa*((v - tha)/qa) / (exp((v - tha)/qa) - 1) 144 | b = Rb * qa * efun((v - tha)/qa) 145 | 146 | tadj = q10^((celsius - temp)/10) 147 | ntau = 1/tadj/(a+b) 148 | ninf = a/(a+b) 149 | } 150 | UNITSON 151 | 152 | FUNCTION efun(z) { 153 | if (fabs(z) < 1e-4) { 154 | efun = 1 - z/2 155 | }else{ 156 | efun = z/(exp(z) - 1) 157 | } 158 | } 159 | -------------------------------------------------------------------------------- /Python_scripts/mods/na.mod: -------------------------------------------------------------------------------- 1 | COMMENT 2 | na.mod 3 | 4 | Sodium channel, Hodgkin-Huxley style kinetics. 5 | 6 | Kinetics were fit to data from Huguenard et al. (1988) and Hamill et 7 | al. (1991) 8 | 9 | qi is not well constrained by the data, since there are no points 10 | between -80 and -55. So this was fixed at 5 while the thi1,thi2,Rg,Rd 11 | were optimized using a simplex least square proc 12 | 13 | voltage dependencies are shifted approximately from the best 14 | fit to give higher threshold 15 | 16 | Author: Zach Mainen, Salk Institute, 1994, zach@salk.edu 17 | 18 | 26 Ago 2002 Modification of original channel to allow 19 | variable time step and to correct an initialization error. 20 | Done by Michael Hines(michael.hines@yale.e) and 21 | Ruggero Scorcioni(rscorcio@gmu.edu) at EU Advance Course 22 | in Computational Neuroscience. Obidos, Portugal 23 | 24 | 11 Jan 2007 Fixed glitch in trap where (v/th) was where (v-th)/q is. 25 | (thanks Ronald van Elburg!) 26 | 27 | 20110202 made threadsafe by Ted Carnevale 28 | 20120514 replaced vtrap0 with efun, which is a better approximation 29 | in the vicinity of a singularity 30 | 31 | Special comment: 32 | 33 | This mechanism was designed to be run at a single operating 34 | temperature--37 deg C--which can be specified by the hoc 35 | assignment statement 36 | celsius = 37 37 | This mechanism is not intended to be used at other temperatures, 38 | or to investigate the effects of temperature changes. 39 | 40 | Zach Mainen created this particular model by adapting conductances 41 | from lower temperature to run at higher temperature, and found it 42 | necessary to reduce the temperature sensitivity of spike amplitude 43 | and time course. He accomplished this by increasing the net ionic 44 | conductance through the heuristic of changing the standard HH 45 | formula 46 | g = gbar*product_of_gating_variables 47 | to 48 | g = tadj*gbar*product_of_gating_variables 49 | where 50 | tadj = q10^((celsius - temp)/10) 51 | temp is the "reference temperature" (at which the gating variable 52 | time constants were originally determined) 53 | celsius is the "operating temperature" 54 | 55 | Users should note that this is equivalent to changing the channel 56 | density from gbar at the "reference temperature" temp (the 57 | temperature at which the at which the gating variable time 58 | constants were originally determined) to tadj*gbar at the 59 | "operating temperature" celsius. 60 | ENDCOMMENT 61 | 62 | NEURON { 63 | THREADSAFE 64 | SUFFIX na 65 | USEION na READ ena WRITE ina 66 | RANGE m, h, gna, gbar 67 | GLOBAL tha, thi1, thi2, qa, qi, qinf, thinf 68 | RANGE minf, hinf, mtau, htau 69 | GLOBAL Ra, Rb, Rd, Rg 70 | GLOBAL q10, temp, tadj, vmin, vmax, vshift 71 | } 72 | 73 | UNITS { 74 | (mA) = (milliamp) 75 | (mV) = (millivolt) 76 | (pS) = (picosiemens) 77 | (um) = (micron) 78 | } 79 | 80 | PARAMETER { 81 | gbar = 1000 (pS/um2) : 0.12 mho/cm2 82 | vshift = -10 (mV) : voltage shift (affects all) 83 | 84 | tha = -35 (mV) : v 1/2 for act (-42) 85 | qa = 9 (mV) : act slope 86 | Ra = 0.182 (/ms) : open (v) 87 | Rb = 0.124 (/ms) : close (v) 88 | 89 | thi1 = -50 (mV) : v 1/2 for inact 90 | thi2 = -75 (mV) : v 1/2 for inact 91 | qi = 5 (mV) : inact tau slope 92 | thinf = -65 (mV) : inact inf slope 93 | qinf = 6.2 (mV) : inact inf slope 94 | Rg = 0.0091 (/ms) : inact (v) 95 | Rd = 0.024 (/ms) : inact recov (v) 96 | 97 | temp = 23 (degC) : original temp 98 | q10 = 2.3 : temperature sensitivity 99 | 100 | : dt (ms) 101 | vmin = -120 (mV) 102 | vmax = 100 (mV) 103 | } 104 | 105 | ASSIGNED { 106 | v (mV) 107 | celsius (degC) 108 | ina (mA/cm2) 109 | gna (pS/um2) 110 | ena (mV) 111 | minf hinf 112 | mtau (ms) htau (ms) 113 | tadj 114 | } 115 | 116 | STATE { m h } 117 | 118 | INITIAL { 119 | tadj = q10^((celsius - temp)/(10 (degC))) : make all threads calculate tadj at initialization 120 | 121 | trates(v+vshift) 122 | m = minf 123 | h = hinf 124 | } 125 | 126 | BREAKPOINT { 127 | SOLVE states METHOD cnexp 128 | gna = tadj*gbar*m*m*m*h 129 | ina = (1e-4) * gna * (v - ena) 130 | } 131 | 132 | : LOCAL mexp, hexp 133 | 134 | DERIVATIVE states { :Computes state variables m, h, and n 135 | trates(v+vshift) : at the current v and dt. 136 | m' = (minf-m)/mtau 137 | h' = (hinf-h)/htau 138 | } 139 | 140 | PROCEDURE trates(v (mV)) { 141 | TABLE minf, hinf, mtau, htau 142 | DEPEND celsius, temp, Ra, Rb, Rd, Rg, tha, thi1, thi2, qa, qi, qinf 143 | FROM vmin TO vmax WITH 199 144 | 145 | rates(v): not consistently executed from here if usetable == 1 146 | 147 | : tinc = -dt * tadj 148 | 149 | : mexp = 1 - exp(tinc/mtau) 150 | : hexp = 1 - exp(tinc/htau) 151 | } 152 | 153 | 154 | : efun() is a better approx than trap0 in vicinity of singularity-- 155 | 156 | UNITSOFF 157 | PROCEDURE rates(vm (mV)) { 158 | LOCAL a, b 159 | 160 | : a = trap0(vm,tha,Ra,qa) 161 | a = Ra * qa * efun((tha - vm)/qa) 162 | 163 | : b = trap0(-vm,-tha,Rb,qa) 164 | b = Rb * qa * efun((vm - tha)/qa) 165 | 166 | tadj = q10^((celsius - temp)/10) 167 | 168 | mtau = 1/tadj/(a+b) 169 | minf = a/(a+b) 170 | 171 | :"h" inactivation 172 | 173 | : a = trap0(vm,thi1,Rd,qi) 174 | a = Rd * qi * efun((thi1 - vm)/qi) 175 | 176 | : b = trap0(-vm,-thi2,Rg,qi) 177 | b = Rg * qi * efun((vm - thi2)/qi) 178 | 179 | htau = 1/tadj/(a+b) 180 | hinf = 1/(1+exp((vm-thinf)/qinf)) 181 | } 182 | UNITSON 183 | 184 | COMMENT 185 | FUNCTION trap0(v,th,a,q) { 186 | if (fabs((v-th)/q) > 1e-6) { 187 | trap0 = a * (v - th) / (1 - exp(-(v - th)/q)) 188 | } else { 189 | trap0 = a * q 190 | } 191 | } 192 | ENDCOMMENT 193 | 194 | FUNCTION efun(z) { 195 | if (fabs(z) < 1e-6) { 196 | efun = 1 - z/2 197 | }else{ 198 | efun = z/(exp(z) - 1) 199 | } 200 | } 201 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ### This tutorial will help you understand how to use [The NEURON simulation environment](https://neuron.yale.edu/neuron/) 2 | 3 | [![Main](main.JPG)](https://github.com/orena1/NEURON_tutorial/raw/master/NEURON_tutorial.pptx "main") 4 | 5 | 6 | #### Instructions 7 | 8 | In order to use this tutorial, you need to install NEURON ([How_to_Install_NEURON.txt](https://github.com/orena1/NEURON_tutorial/blob/master/How_to_Install_NEURON.txt)); after installing NEURON, you can decide whether to use jupyter notebook or Python scripts. 9 | 10 | You will also need to compile to mod files. 11 | For example, if you decide to use the Jupyter_notebooks 12 | 13 | Linux/Mac: 14 | 1. Open Terminal 15 | 2. Go to Jupyter_notebooks directory 16 | 3. Type: nrnivmodl mods 17 | 18 | Windows: 19 | 1. Move all files from the folder [mods](https://github.com/orena1/NEURON_tutorial/tree/master/Jupyter_notebooks/mods) to the [base-directory](https://github.com/orena1/NEURON_tutorial/tree/master/Jupyter_notebooks) 20 | 2. Use the [following instructions](https://neuron.yale.edu/neuron/static/docs/nmodl/mswin.html) (second section - Compiling mod files in NEURON 5.1 and later), choose the base-directory that now contains all the mod files 21 | 22 | After completing the installations download the **[NEURON_tutorial.pptx](https://github.com/orena1/NEURON_tutorial/raw/master/NEURON_tutorial.pptx)** and follow the instructions in the presentation. Suggested exercises are available in the slides notes (The presentation is also available here: https://1drv.ms/p/s!ApfBr7JWIT35mj3A1Sjcw3hKNCdF?e=4yG34n) 23 | 24 | 25 | Feel free to open [Issues](https://github.com/orena1/NEURON_tutorial/issues) if you find any bugs, or have any suggestions. 26 | 27 | You can follow my latest research on [Twitter](https://twitter.com/Oren_Amsalem) 28 | -------------------------------------------------------------------------------- /main.JPG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/orena1/NEURON_tutorial/a00179f6339533369b88789c2493ca9ed73e8c0b/main.JPG --------------------------------------------------------------------------------