% # iNa_IN_JB12:
%
% Fast sodium current for generic interneurons used in the
% DynaSim implementation of (Benita et al., 2012).
%
% - References:
%     - Benita, J. M., Guillamon, A., Deco, G., & Sanchez-Vives, M. V. (2012).
%     Synaptic depression and slow oscillatory activity in a biophysical
%     network model of the cerebral cortex. Frontiers in Computational
%     Neuroscience, 6. https://doi.org/10.3389/fncom.2012.00064
%
% - Tags: sodium, current, intrinsic, interneuron
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Parameters
gNa = 35 % mS/cm^2
ENa = 55 % mV

hNaIC = 0.7
hNaNoiseIC = 0.1

% Functions
alphaM(X) = 0.5.*(X+35)./(1-exp(-(X+35)./10))
betaM(X) =  20.*exp(-(X+60)./18)
alphaH(X) = 0.35.*exp(-(X+58)./20)
betaH(X) =  5./(1+exp(-(X+28)./10))

Minf(X) = alphaM(X)./(alphaM(X) + betaM(X))

INa_IN_JB12(X,hNa) = -gNa.*Minf(X).^3.*hNa.*(X-ENa)

monitor INa_IN_JB12
monitor Minf

% ODEs and ICs
hNa' = (alphaH(X).*(1-hNa)) - (betaH(X).*hNa)
hNa(0)=hNaIC+hNaNoiseIC.*rand(1, Npop)

% Interface
@current += INa_IN_JB12(X,hNa)