//Procedures and functions to place synapses with AMPA and NMDA conductances
proc syn_cc() {
//procedure to place synapse with AMPA conductance
dendno=$1
secno=$2
gsyn=$3
option=$4
if (option==1) { //connect to the shaft
dend[dendno].sec {ampasyn.loc(secno)}
} else { //connect to the spine
spinearray[0].sec {ampasyn.loc(0.5)}
}
ampasyn.gmax = gsyn
ampasyn.tau0 = 0.2
ampasyn.tau1 = 2
ampasyn.e = 0
ampasyn.onset = synwait
}
proc syn_nmdacc() {
//procedure to place synapse with NMDA conductance
dendno=$1
secno=$2
gsyn=$3
option=$4
if (option==1) { //connect to the shaft
dend[dendno].sec {nmdasyn.loc(secno)}
} else { //connect to the spine
spinearray[0].sec {nmdasyn.loc(0.5)}
}
nmdasyn.gmax = gsyn
nmdasyn.onset = synwait
}
//conductance values based on EM data
parta=0.00007
partn=0.00006
NA=3.95*parta //nonperforated synapse AMPA
PAp=8.01*parta //proximal perforated synapse AMPA
PAm=11.60*parta //middle perforated synapse AMPA
PAd=12.43*parta //distal perforated synapse AMPA
NN=2.50*partn //nonperforated synapse NMDA
PNp=8.29*partn //proximal perforated synapse NMDA
PNm=5.90*partn //middle perforated synapse NMDA
PNd=5.95*partn //distal perforated synapse NMDA
func calc_syn_strength() {local type
//function to calculate synaptic strength based on distance from the soma, using EM derived data for linear conductance change
type=$1 //1=AMPA, 2=NMDA
distval=$2
if (type==1) {
if (distval<135) {
return (0.0653*distval+2.786)*parta
} else {
return (0.0166*distval+9.359)*parta
}
} else {
if (distval<135) {
return (-0.0435*distval+11.77)*partn
} else {
return (-0.001*distval+6.035)*partn
}
}
}
func findpoint() {
//pick a random point with linearly decreasing probability, mimicking the nonperforated synapse scaling from the data
dendlength=$1
point=$2
fb=-0.02*dendlength*dendlength+(5.8*dendlength)
outpoint=25*(5.8-sqrt(5.8*5.8-0.08*point*fb))/dendlength
return outpoint
}