Zip archive with all mod files and test-model example can be downloaded here https://storage.r-a-r.org/index.php/s/jLCz6m4k3TXFgmK
Only a few channels use calcium
Code: Select all
CaDynamics_E2.mod: USEION ca READ ica WRITE cai
Ca_HVA.mod: USEION ca READ eca WRITE ica
Ca_LVAst.mod: USEION ca READ eca WRITE ica
SK_E2.mod: USEION ca READ cai
Code: Select all
for secname in self.sections:
if secname == "axon": continue
h.ion_style("ca_ion",3,2,1,1,0,sec=self.sections[secname])
self.sections[secname].cao = 1.2
for seg in self.sections[secname]:
seg.cai = 0.001
Code: Select all
COMMENT
AMPA, NMDA, tonic glutamate, and GAMAb
synaptic depression is taken from T&M model
https://senselab.med.yale.edu/ModelDB/showmodel?model=3815&file=/tsodyks/tmgsyn.mod#tabs-2
ENDCOMMENT
NEURON {
POINT_PROCESS AMPAandNMDAplastic
: -- SYNAPSE -- :
:parameters
RANGE AMPAt1, AMPAt2, AMPAnorm, NMDAt1, NMDAt2, NMDAnorm, e, AMPAfrac, NMDAfrac, AMPAfracca, NMDAfracca
:synaptic depression
RANGE tau_1, tau_rec, u0
NONSPECIFIC_CURRENT i
USEION ca READ cai,cao WRITE ica
: -- PLASTICITY -- :
: STDP
RANGE gammad, gammap, thetap, thetad, taurho, rho12, rhoinit
: STDP FLAGs
RANGE bistable, plastic
:readouts
RANGE i, ampai, nmdai, ampag, nmdag, xrho
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(uS) = (microsiemens)
FARADAY = (faraday) (coulomb)
R = (k-mole) (joule/degC)
}
PARAMETER {
AMPAt1 = 0.1 (ms) <1e-9,1e9>
AMPAt2 = 10 (ms) <1e-9,1e9>
AMPAnorm = 0
AMPAfrac = 0.5 () <0,1>
NMDAt1 = 9 (ms) <1e-9,1e9>
NMDAt2 = 50 (ms) <1e-9,1e9>
NMDAnorm = 0
NMDAfrac = 0.5 () <0,1>
e = 0 (mV)
AMPAfracca = 0.13 : fraction of current that is ca ions; Srupuston &al 95
NMDAfracca = 0.13 : fraction of current that is ca ions; Srupuston &al 95
: tau_1 was the same for inhibitory and excitatory synapses
: in the models used by T et al.
tau_1 = 3 (ms) < 1e-9, 1e9 >
: tau_rec = 800 ms for excitatory
tau_rec = 800 (ms) < 1e-9, 1e9 >
: u0 amount of x->y
u0 = 0.04 <0,1>
: STDP parameters
gammad = 200 <0,50000> : gain of depression
gammap = 321.808 <0,25000> : gain of potentiation
thetad = 1 (mM) <1e-9,1e9> : threshold of depression
thetap = 1.3 (mM) <1e-9,1e9> : threshold of potentiation
taurho = 150e3 (ms) <25e3,2500e3> : time constant of STDP
rho12 = 0.5 : middle point of cubic polynomial term
rhoinit = 0.1 : initial value for rho
: STDP FLAGs
bistable = 0 <0,1> : FLAG if 0 - STDP is not bistable, if 1 - STDP has bistability.
plastic = 1 <0,1> : FLAG if 1 - synapse is plastic, i.e. STDP is active.
}
ASSIGNED {
v (mV)
i (nA)
ik (nA)
ampag (uS)
nmdag (uS)
ampai (nA)
nmdai (nA)
AMPAfactor
NMDAfactor
mgblock (1)
ica (nA)
x
cai (mM)
cao (mM)
celsius
}
STATE {
ampaA (uS)
ampaB (uS)
nmdaA (uS)
nmdaB (uS)
xrho (1)
}
INITIAL {
LOCAL tp, factor
if (AMPAt1/AMPAt2 > 0.9999) { AMPAt1 = 0.9999*AMPAt2 }
if (AMPAt1/AMPAt2 < 1e-9 ) { AMPAt1 = AMPAt2*1e-9 }
ampaA = 0
ampaB = 0
if (AMPAnorm > 0.5){
AMPAfactor = 1./(AMPAt2 - AMPAt1)
} else {
tp = (AMPAt1*AMPAt2)/(AMPAt2 - AMPAt1)* log(AMPAt2/AMPAt1)
factor = -exp(-tp/AMPAt1) + exp(-tp/AMPAt2)
AMPAfactor = 1./factor
}
if (NMDAt1/NMDAt2 > 0.9999) { NMDAt1 = 0.9999*NMDAt2 }
if (NMDAt1/NMDAt2 < 1e-9 ) { NMDAt1 = NMDAt2*1e-9 }
nmdaA = 0
nmdaB = 0
if (NMDAnorm > 0.5 ){
NMDAfactor = 1./(NMDAt2 - NMDAt1)
} else {
tp = (NMDAt1*NMDAt2)/(NMDAt2 - NMDAt1)* log(NMDAt2/NMDAt1)
factor = -exp(-tp/NMDAt1) + exp(-tp/NMDAt2)
NMDAfactor = 1./factor
}
xrho = rhoinit
}
BREAKPOINT {
LOCAL i_ca2p
SOLVE state METHOD cnexp
if (plastic){
ampag = xrho*(ampaB - ampaA)
nmdag = xrho*(nmdaB - nmdaA)
} else {
ampag = ampaB - ampaA
nmdag = nmdaB - nmdaA
}
: Jahr Stevens 1990 J. Neurosci
mgblock = 1.0 / (1.0 + 0.28 * exp(-0.062(/mV) * v) )
ampai = ampag * (v - e) * (1-AMPAfracca)
nmdai = nmdag * (v - e) * mgblock * (1-NMDAfracca)
i_ca2p = 0
if(AMPAfracca>0.0){ : assuming only NMDA pumps calcium
i_ca2p = i_ca2p + ampag * ghkg(v,cai,cao,2) * AMPAfracca
}
if(NMDAfracca>0.0){ : assuming only NMDA pumps calcium
i_ca2p = i_ca2p + nmdag * ghkg(v,cai,cao,2) * mgblock * NMDAfracca
}
ica = i_ca2p
i = ampai + nmdai
}
DERIVATIVE state {
LOCAL rhoinf
rhoinf = -bistable*xrho*(1.-xrho)*(rho12-xrho)+gammap*(1.-xrho)*xheav(cai-thetap)-gammad*xrho*xheav(cai-thetad)
: | STDP bistability | Potentiation | Depression |
ampaA' = -ampaA/AMPAt1
ampaB' = -ampaB/AMPAt2
nmdaA' = -nmdaA/NMDAt1
nmdaB' = -nmdaB/NMDAt2
xrho' = rhoinf/taurho
:DB>>
printf("DB> cai=%g, cao=%g\n",cai,cao)
:<<DB
}
NET_RECEIVE(weight (uS), y, z, tsyn (ms) ) {
INITIAL {
y = 0
z = 0
tsyn = t
}
: first calculate z at event-
: based on prior y and z
z = z*exp(-(t - tsyn)/tau_rec)
z = z + ( y*(exp(-(t - tsyn)/tau_1) - exp(-(t - tsyn)/tau_rec)) / ((tau_1/tau_rec)-1) )
: now calc y at event-
y = y*exp(-(t - tsyn)/tau_1)
x = 1-y-z
y = y + x*u0
tsyn = t
ampaA = ampaA + weight*x*u0*AMPAfactor*AMPAfrac
ampaB = ampaB + weight*x*u0*AMPAfactor*AMPAfrac
nmdaA = nmdaA + weight*x*u0*NMDAfactor*NMDAfrac
nmdaB = nmdaB + weight*x*u0*NMDAfactor*NMDAfrac
}
: from
: http://senselab.med.yale.edu/modeldb/ShowModel.asp?model=144490&file=\bpap\ghk.inc
COMMENT
GHK function that returns effective driving force
Slope at low voltages is 1
z needs to be set as a PARAMETER
ENDCOMMENT
FUNCTION ghkg(v(mV), ci(mM), co(mM), Z) (mV) {
LOCAL xi, f, exi, fxi
f = R*(34.+273.15)/(Z*(1e-3)*FARADAY)
xi = v/f
exi = exp(xi)
if (fabs(xi) < 1e-4) {
fxi = 1 - xi/2
}else{
fxi = xi/(exi - 1)
}
ghkg = f*((ci/co)*exi - 1)*fxi
}
FUNCTION ghk(v(mV), ci(mM), co(mM), Z) (.001 coul/cm3) {
LOCAL xi, f, exi, fxi
f = R*(34.+273.15)/(Z*(1e-3)*FARADAY)
xi = v/f
exi = exp(xi)
if (fabs(xi) < 1e-4) {
fxi = 1 - xi/2
}else{
fxi = xi/(exi - 1)
}
ghk = (.001)*Z*FARADAY*(ci*exi - co)*fxi
}
FUNCTION xheav( x (1) ) (1) {
if ( x >= 0) {
xheav = 1
} else {
xheav = 0
}
}
Let's connect it a middle of apical dendrite:
Code: Select all
xsyn = h.AMPAandNMDAplastic(0.5,sec=xn.sections["apic"])
Code: Select all
for secname in xn.sections:
if secname == "axon": continue
logging.debug("Section {} cao={}".format(secname,xn.sections[secname].cao) )
for seg in xn.sections[secname]:
logging.debug(" > {}, {}".format(seg.cai, seg.cao) )
logging.debug("--- NEURON INIT ---")
h.finitialize()
h.fcurrent()
h.frecord_init()
for secname in xn.sections:
if secname == "axon": continue
logging.debug("Section {} cao={}".format(secname,xn.sections[secname].cao) )
for seg in xn.sections[secname]:
logging.debug(" > {}, {}".format(seg.cai, seg.cao) )
Code: Select all
2020-07-27 00:19:15,301:178 DEBUG :Section apic cao=1.2
2020-07-27 00:19:15,301:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,302:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,303:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,304:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,304:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,304:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,304:180 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,304:178 DEBUG :Section bas0 cao=1.2
.....
2020-07-27 00:19:15,305:183 DEBUG :--- NEURON INIT ---
2020-07-27 00:19:15,305:189 DEBUG :Section soma cao=1.2
2020-07-27 00:19:15,305:191 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,306:189 DEBUG :Section apic cao=2.0
2020-07-27 00:19:15,306:191 DEBUG : > 0.001, 1.2
...
2020-07-27 00:19:15,307:191 DEBUG : > 0.001, 1.2
2020-07-27 00:19:15,307:191 DEBUG : > 5e-05, 2.0
2020-07-27 00:19:15,307:191 DEBUG : > 0.001, 1.2
.....