I need to do the userdefined shortterm plasticity.
My code is modified from Exp2Syn. Fac is for facilitation, Dep is for depression and DepR and FacR is for their recoveries.
NEURON {
POINT_PROCESS PlaExp2Syn
RANGE tau1, tau2, e, i
NONSPECIFIC_CURRENT i
RANGE g
RANGE Fac, Dep, FacR, DepR, F, D, plas
}
UNITS {
(nA) = (nanoamp)
(mV) = (millivolt)
(umho) = (micromho)
}
PARAMETER {
tau1 = 0.1 (ms) < 1e9, 1e9 >
tau2 = 0.3 (ms) < 1e9, 1e9 >
e = 0 (mV)
: these values are from Yan's model
}
ASSIGNED {
v (mV)
i (nA)
g (us)
factor
total (us)
Fac
FacR
Dep
DepR
plas
}
STATE {
A (us)
B (us)
}
INITIAL {
LOCAL tp
if (tau1/tau2 > 0.9999) {
tau1 = 0.9999*tau2
}
:when tau1>tau2, the syanpse turns into an alpha function synapse
A = 0
B = 0
D = 1
F = 1
tp = (tau1*tau2)/(tau2  tau1) * log(tau2/tau1)
factor = exp(tp/tau1) + exp(tp/tau2)
factor = 1/factor
}
BREAKPOINT {
SOLVE state METHOD cnexp
g = B  A
i = g*(v  e)
plas = D * F
}
DERIVATIVE state {
A' = A/tau1
B' = B/tau2
D' = DepR*(1plas)  Dep
F' = Fac  FacR*(1plas)
}
NET_RECEIVE(weight (us), Fac, FacR, Dep, DepR) {
:tsyn = t
A = A + weight*factor*plas
B = B + weight*factor*plas
}
I pass the Fac, FacR, Dep and DepR as weight array. in the format
netcon.weight[0]=weight
netcon.weight[1]=Fac
netcon.weight[2]=FacR
netcon.weight[3]=Dep
netcon.weight[4]=DepR
but no matter how I changed the value of Fac, FacR, Dep and DepR in hoc file, the EPSPs are not affected. But when I assign values to them in the mod file, EPSPs show plasticity.
Can you please tell me how to fix this? that means how can i change the shortterm plasticity in hoc without recompiling the mod file each time?
Thanks a lot!
how to pass variables into mod file?

 Site Admin
 Posts: 5810
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: how to pass variables into mod file?
This mechanism doesn't do what you think it should because the Fac, Dep, FacR, and DepR that are declared to be RANGE variables have nothing to do with the Fac, FacR, Dep, and DepR that are part of the weight vector. And you definitely do not want to be using hoc statements to assign values to the weight vector's elements. If you want to see examples of NMODL code for synaptic mechanisms that have short term plasticity, please go to ModelDB http://senselab.med.yale.edu/modeldb/ and examine entries 3815 and 3264. All statements that involve the weight vector's elements should be in the NET_RECEIVE block.
In the NMODL code you posted, the statements that govern the plasticity state variables seem unlikely to produce meaningful results. What is your conceptual model of short term plasticity, stated as algebraic or differential equations?
In the NMODL code you posted, the statements that govern the plasticity state variables seem unlikely to produce meaningful results. What is your conceptual model of short term plasticity, stated as algebraic or differential equations?
Re: how to pass variables into mod file?
Thanks for the reply.
what i want to do is define the facilitation/depression and their recovery rates in the hoc to change the PSP.
the plasticity are governed by these simple equations.
PSPn=PSPn1*plasticity
plasticity=depression*facilitation
depression'= Depression_Recovery *( 1 plasticity)  Depression * PSPn1
facilitation' = Facilitation * PSPn1  Facilitation Recovery * ( 1  plasticity)
initial values for depression and facilitation is 1.
Thanks a lot!
what i want to do is define the facilitation/depression and their recovery rates in the hoc to change the PSP.
the plasticity are governed by these simple equations.
PSPn=PSPn1*plasticity
plasticity=depression*facilitation
depression'= Depression_Recovery *( 1 plasticity)  Depression * PSPn1
facilitation' = Facilitation * PSPn1  Facilitation Recovery * ( 1  plasticity)
initial values for depression and facilitation is 1.
Thanks a lot!

 Site Admin
 Posts: 5810
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: how to pass variables into mod file?
In this equation
depression'= Depression_Recovery *( 1 plasticity)  Depression * PSPn1
are "depression" and "Depresson" supposed to be the same variable?
In this equation
facilitation' = Facilitation * PSPn1  Facilitation Recovery * ( 1  plasticity)
are "facilitation" and "Facilitation" supposed to be the same variable?
Assuming that the answers to these questions are "yes" and "yes"
What is supposed to happen to depression and facilitation if there are no inputs? According to the equations, depression = facilitaton = 1 is not a stable point unless PSP amplitude is 0, and if psp amplitude is 0, it will stay 0 forever. Or do you really want depression and facilitation to start changing even if there are no inputs?
depression'= Depression_Recovery *( 1 plasticity)  Depression * PSPn1
are "depression" and "Depresson" supposed to be the same variable?
In this equation
facilitation' = Facilitation * PSPn1  Facilitation Recovery * ( 1  plasticity)
are "facilitation" and "Facilitation" supposed to be the same variable?
Assuming that the answers to these questions are "yes" and "yes"
What is supposed to happen to depression and facilitation if there are no inputs? According to the equations, depression = facilitaton = 1 is not a stable point unless PSP amplitude is 0, and if psp amplitude is 0, it will stay 0 forever. Or do you really want depression and facilitation to start changing even if there are no inputs?
Re: how to pass variables into mod file?
Sorry no they are not supposed to be the same. Depression and Facilitation are supposed to be a constant defined by user (passing to the NET_RECEIVE) and depression and facilitation are the components of plasticity.
plasticity = depression * facilitation
depression'= Depression_Recovery *( 1 plasticity)  Depression * PSPn1
facilitation' = Facilitation * PSPn1  Facilitation Recovery * ( 1  plasticity)
Depression, Depression_Recovery, Facilitation, Facilitation_Recovery are all constants defined by hoc. depression and facilitation are timedependent and determine the amplitude of PSPs.
I changed my code as this:
NET_RECEIVE(weight (us), Fac, FacR, Dep, DepR, tsyn (ms)) {
INITIAL {
: these are in NET_RECEIVE to be perstream
F = 1
D = 1
tsyn = t
: this header will appear once per stream
}
D = D * exp(Dep*(ttsyn))
F = F * exp(Fac*(ttsyn))
: depression and facilitation without recovery
tsyn = t
A = A + weight*factor*D*F
B = B + weight*factor*D*F
}
where D and F are for overall depression and facilitation.
I didnt take the recovery mechanisms into account and this part works fine. I've got difficulties in how to put the recovery solution into this equation. I tried it for almost a week and completely lost. Can you help me here with it?
Thanks a lot! You reply my questions everyday!!!
plasticity = depression * facilitation
depression'= Depression_Recovery *( 1 plasticity)  Depression * PSPn1
facilitation' = Facilitation * PSPn1  Facilitation Recovery * ( 1  plasticity)
Depression, Depression_Recovery, Facilitation, Facilitation_Recovery are all constants defined by hoc. depression and facilitation are timedependent and determine the amplitude of PSPs.
I changed my code as this:
NET_RECEIVE(weight (us), Fac, FacR, Dep, DepR, tsyn (ms)) {
INITIAL {
: these are in NET_RECEIVE to be perstream
F = 1
D = 1
tsyn = t
: this header will appear once per stream
}
D = D * exp(Dep*(ttsyn))
F = F * exp(Fac*(ttsyn))
: depression and facilitation without recovery
tsyn = t
A = A + weight*factor*D*F
B = B + weight*factor*D*F
}
where D and F are for overall depression and facilitation.
I didnt take the recovery mechanisms into account and this part works fine. I've got difficulties in how to put the recovery solution into this equation. I tried it for almost a week and completely lost. Can you help me here with it?
Thanks a lot! You reply my questions everyday!!!

 Site Admin
 Posts: 5810
 Joined: Wed May 18, 2005 4:50 pm
 Location: Yale University School of Medicine
 Contact:
Re: how to pass variables into mod file?
Before it is useful to talk about NMODL code, you must first have equations that do what you want.
These equations are a problem
plasticity = depression * facilitation
depression'= Depression_Recovery *( 1 plasticity)  Depression * PSPn1
facilitation' = Facilitation * PSPn1  Facilitation Recovery * ( 1  plasticity)
even if you meant to write
plasticity = depression * facilitation
depression'= Depression_Recovery *( 1 plasticity)  depression * PSPn1
facilitation' = facilitation * PSPn1  Facilitation_Recovery * ( 1  plasticity)
At the start of a simulation, depression = facilitation = 1.
Imagine that the synapse is activated at some time t1 and produces a psp with amplitude a.
depression will equal exp(a(tt1)) and facilitation will equal exp(a(tt1)), so plasticity will stay equal to 1.
In other words, there will be no plasticity at all.
To help you see this, rewrite the equations as
d' = dr * (1  d*f)  a*d
f' = a*f  fr * (1  d*f)
(the substitution of d for depression, etc., makes it easier to read and write the equations)
and substitute the solutions
d = exp(a*t)
f = exp(a*t)
(substituting t for tt0 is a simple time shift)
for the terms on the right hand side.
You will immediately see that the "recovery" terms become 0, and you are left with
d' =  a*d
f' = a*f
This confirms that the solution to the equations is
d = exp(a*t)
f = exp(a*t)
And this means that the product D*F in
A = A + weight*factor*D*F
B = B + weight*factor*D*F
is always 1, so there is no plasticity.
These equations are a problem
plasticity = depression * facilitation
depression'= Depression_Recovery *( 1 plasticity)  Depression * PSPn1
facilitation' = Facilitation * PSPn1  Facilitation Recovery * ( 1  plasticity)
even if you meant to write
plasticity = depression * facilitation
depression'= Depression_Recovery *( 1 plasticity)  depression * PSPn1
facilitation' = facilitation * PSPn1  Facilitation_Recovery * ( 1  plasticity)
At the start of a simulation, depression = facilitation = 1.
Imagine that the synapse is activated at some time t1 and produces a psp with amplitude a.
depression will equal exp(a(tt1)) and facilitation will equal exp(a(tt1)), so plasticity will stay equal to 1.
In other words, there will be no plasticity at all.
To help you see this, rewrite the equations as
d' = dr * (1  d*f)  a*d
f' = a*f  fr * (1  d*f)
(the substitution of d for depression, etc., makes it easier to read and write the equations)
and substitute the solutions
d = exp(a*t)
f = exp(a*t)
(substituting t for tt0 is a simple time shift)
for the terms on the right hand side.
You will immediately see that the "recovery" terms become 0, and you are left with
d' =  a*d
f' = a*f
This confirms that the solution to the equations is
d = exp(a*t)
f = exp(a*t)
And this means that the product D*F in
A = A + weight*factor*D*F
B = B + weight*factor*D*F
is always 1, so there is no plasticity.
Re: how to pass variables into mod file?
Sorry I may not say it clear.
depression and facilitation are the final result I want. Depression, Facilitation, Depression Recovery and Facilitation Recovery are the constants defined by hoc file. So I have four parameters to control the overall plasticity (Dep for Depression, DepR for Depression Recovery, Fac for Facilitation and FacR for Facilitation Recovery).
PSP_final = PSP * plasticity (PSP for the postsynaptic potential which is dependent on time)
plasticity = D * F (D for depression and F for facilitation. they are the results I want to get from the differential equations)
D' = DepR*(1plasticity)Dep*PSP_final
F' = Fac*PSP_final  FacR(1plasticity)
for now I only consider either depression or facilitation. so it could be simplified as
D' = DepR*(1D)Dep*PSP_final = DepR*(1D)Dep*D*PSP
F' = Fac*PSP_finalFacR(1F)=Fac*F*PSPFacR(1F)
when DepR and FacR is 0 which means there is no recovery, the equations would be
D' = Dep*D*PSP
F' = Fac*F*PSP
which is all right as you point it out the result is
D = exp(Dep*exp(ttsyn))
F = exp(Fac*exp(ttsyn))
I just could not get it right for the recovery part. To make it clear, I'll rewrite the equations I want to resolve are:
D' = DepR*(1D)Dep*D*PSP
F' = Fac*F*PSPFacR(1F)
In these two equations, D and F are to be solved. DepR, Dep, Fac and FacR are constants. I'm a bit confused with the presence of v in these equations. The results of D with nonzero Dep and DepR should be sawtoothshaped with damping amplitude to a plateau decided by DepR.
I didnt change the color so a bit uneasy to see. The upper trace is the spikes, the middle trace is D (for depression) with a smaller DepR and the lower trace is D with the same Dep and a bigger DepR. PSP is zero when there is no spike delivered to the postsynaptic neuron.
So when a spike arrives, the synapse depresses, but between spikes, the synapse would get some recovery from the depression. The results were done in MATLAB and now I need to build up a larger network so turn to NEURON.
Sorry I've got loads of problems. I've been stuck here for over a week now and catching up to a deadline so really need your help. Thanks a lot!
depression and facilitation are the final result I want. Depression, Facilitation, Depression Recovery and Facilitation Recovery are the constants defined by hoc file. So I have four parameters to control the overall plasticity (Dep for Depression, DepR for Depression Recovery, Fac for Facilitation and FacR for Facilitation Recovery).
PSP_final = PSP * plasticity (PSP for the postsynaptic potential which is dependent on time)
plasticity = D * F (D for depression and F for facilitation. they are the results I want to get from the differential equations)
D' = DepR*(1plasticity)Dep*PSP_final
F' = Fac*PSP_final  FacR(1plasticity)
for now I only consider either depression or facilitation. so it could be simplified as
D' = DepR*(1D)Dep*PSP_final = DepR*(1D)Dep*D*PSP
F' = Fac*PSP_finalFacR(1F)=Fac*F*PSPFacR(1F)
when DepR and FacR is 0 which means there is no recovery, the equations would be
D' = Dep*D*PSP
F' = Fac*F*PSP
which is all right as you point it out the result is
D = exp(Dep*exp(ttsyn))
F = exp(Fac*exp(ttsyn))
I just could not get it right for the recovery part. To make it clear, I'll rewrite the equations I want to resolve are:
D' = DepR*(1D)Dep*D*PSP
F' = Fac*F*PSPFacR(1F)
In these two equations, D and F are to be solved. DepR, Dep, Fac and FacR are constants. I'm a bit confused with the presence of v in these equations. The results of D with nonzero Dep and DepR should be sawtoothshaped with damping amplitude to a plateau decided by DepR.
I didnt change the color so a bit uneasy to see. The upper trace is the spikes, the middle trace is D (for depression) with a smaller DepR and the lower trace is D with the same Dep and a bigger DepR. PSP is zero when there is no spike delivered to the postsynaptic neuron.
So when a spike arrives, the synapse depresses, but between spikes, the synapse would get some recovery from the depression. The results were done in MATLAB and now I need to build up a larger network so turn to NEURON.
Sorry I've got loads of problems. I've been stuck here for over a week now and catching up to a deadline so really need your help. Thanks a lot!
Last edited by yj232 on Mon Jun 27, 2011 6:38 am, edited 3 times in total.
Re: how to pass variables into mod file?
I've simplified the equations into easier ones.
D'= Dep*D : if there is a spike delivered in
D'= DepR*(1D) : no spikes
same for the facilitation
F'= Fac* F : spikes in
F'= FacR*(1F) : no spikes
so during spikes the recovery mechanism take over.
I suppose this should be easier to tackle?
D'= Dep*D : if there is a spike delivered in
D'= DepR*(1D) : no spikes
same for the facilitation
F'= Fac* F : spikes in
F'= FacR*(1F) : no spikes
so during spikes the recovery mechanism take over.
I suppose this should be easier to tackle?
Re: how to pass variables into mod file?
I think I've got this tackled. Thanks for helping.