% # iK_IN_JB12:
%
% Fast delayed rectifier potassium 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: potassium, current, intrinsic, pyramidal, soma
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Parameters
gK = 9   % mS/cm^2
EK = -90 % mV

nKIC = 0.13
nKNoiseIC = 0.01

% Functions
alphaN(X) = 0.05.*(X+34)./(1 - exp(-(X+34)./10))
betaN(X) =  0.625.*exp(-(X+44)./80)

IK_IN_JB12(X,nK) = -gK.*nK.^4.*(X-EK)
monitor IK_IN_JB12

% ODEs and ICs
nK' = (alphaN(X).*(1-nK)) - (betaN(X).*nK)
nK(0)=nKIC+nKNoiseIC.*rand(1,Npop)

% Interface
@current += IK_IN_JB12(X,nK)