## simple HH neuron with sinusoid trigger current

The basics of how to develop, test, and use models.
kazmer
Posts: 10
Joined: Thu May 17, 2007 2:37 pm

### simple HH neuron with sinusoid trigger current

Hi,

I wrote a simple HH neuron with sinusoid current. I think this may be useful for beginner.

HOC code:
create soma
access soma

soma {
L=10
diam=10
Ra=123
insert leak
}

tstop=500

objref stim
soma stim= new IClampSin(0.5)
stim.del=100
stim.dur=300
stim.freq=15
stim.amp=0.1
stim.phase=0

xpanel("Sinus current")
xvalue("Delay", "stim.del")
xvalue("Duration", "stim.dur")
xvalue("Amplitude", "stim.amp")
xvalue("Frequency", "stim.freq")
xvalue("Phases", "stim.phase")
xpanel()

xpanel("Control")
xbutton("Run","run()")
xbutton("Init","stdinit()")
xpanel()

objref g1
g1=new Graph()
g1.size(0,tstop,-100,60)

objref g
g=new Graph()
g.size(0,tstop,-1,1)

NMODL K+ current:

NEURON{
USEION k READ ek WRITE ik
RANGE gkbar, ik
}

UNITS{
(S)=(siemens)
(mV)=(millivolt)
(mA)=(milliamp)
}

PARAMETER{gkbar=0.036 (S/cm2)}

ASSIGNED{
v (mV)
ek (mV) : typically ~ -70
ik (mA/cm2)
}

STATE{n}

BREAKPOINT{
SOLVE states METHOD cnexp
ik=gkbar*n^4*(v-ek)
}

INITIAL{
n=alpha(v)/(alpha(v)+beta(v))
}

DERIVATIVE states{
n'=(1-n)*alpha(v)-n*beta(v)
}

FUNCTION alpha(Vm (mV)) (/ms){
UNITSOFF
alpha=(0.01*((-65-Vm)+10))/(exp(((-65-Vm)+10)/10)-1)
UNITSON
}

FUNCTION beta(Vm (mV)) (/ms){
UNITSOFF
beta=0.125*exp((-65-Vm)/80)
UNITSON
}

NMODL for Na+ current:

NEURON{
USEION na READ ena WRITE ina
RANGE gnabar, ina
}

UNITS {
(S) = (siemens)
(mV) = (millivolt)
(mA) = (milliamp)
}

PARAMETER{ gnabar=0.12 (S/cm2)}

ASSIGNED{
v (mV)
ena (mV) : typically ~ +55
ina (mA/cm2)
}

STATE { m h}

BREAKPOINT{
SOLVE states METHOD cnexp
ina=gnabar*m^3*h*(v-ena)
}

INITIAL{
m=alpham(v)/(alpham(v)+betam(v))
h=alphah(v)/(alphah(v)+betah(v))
}

DERIVATIVE states{

m'=alpham(v)*(1-m)-m*betam(v)
h'=alphah(v)*(1-h)-betah(v)*h
}

FUNCTION alpham(Vm (mV)) (/ms){
UNITSOFF

alpham=(0.1*(-65-Vm+25))/(exp((-65-Vm+25)/10)-1)
UNITSON
}

FUNCTION betam(Vm (mV)) (/ms){
UNITSOFF
betam=4*exp((-65-Vm)/18)
UNITSON
}

FUNCTION alphah(Vm (mV)) (/ms){
UNITSOFF
alphah=0.07*exp((-65-Vm)/20)
UNITSON
}

FUNCTION betah(Vm (mV)) (/ms){
UNITSOFF
betah=1/(exp((-65-Vm+30)/10)+1)
UNITSON
}

NMODL for leak current:
: a passive leak current

NEURON{

SUFFIX leak
NONSPECIFIC_CURRENT i
RANGE i,e,g
}

PARAMETER{
g=0.001 (siemens/cm2) <0, 1e9>
e=-65 (millivolt)
}

ASSIGNED{

i (milliamp/cm2)
v (millivolt)
}

BREAKPOINT{ i=g*(v-e)}

NMODL for Sinusoid IClamp:

:Sinusoid current clamp

NEURON{
POINT_PROCESS IClampSin
RANGE del, dur, amp, freq, phase, bias
ELECTRODE_CURRENT i
}

UNITS {
(nA) = (nanoamp)
}

PARAMETER {
del=5 (ms)
dur=200 (ms)
amp=1 (nA)
freq=1 (Hz)
bias=0 (nA)
PI=3.14159265358979323846
}

ASSIGNED {
i (nA)
}

BREAKPOINT {
at_time(del)
at_time(del+dur)
if (t < del+dur && t>del) {
i = amp*sin(2*PI*freq*(t-del)/1000+phase)+bias
}else{
i = 0}
}

Try it and play. You will get bursting activity in some sin. amp and frequency.

Best,
Kazmer