% # iKS_PYso_JB12:
%
% Non-inactivating potassium current, for generic pyramidal soma compartments
% used in the DynaSim implementation of (Benita et al., 2012). The original
% paper cites this mechanism from (Wang, 1999a).
%
% - 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
%     - Wang, X. J. (1999). Fast burst firing and short-term synaptic
%     plasticity: a model of neocortical chattering neurons. Neuroscience,
%     89(2), 347–362. Retrieved from
%     https://www.ncbi.nlm.nih.gov/pubmed/10077318
%
% - Tags: potassium, current, intrinsic, pyramidal, soma
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% Parameters
gKS = 0.576 % mS/cm^2
EKS = -100 % mV, same as potassium reversal potential

phi = 1 % temperature factor
mKSIC = 0.005
mKSNoiseIC = 0.001

% Functions
Minf(X) = 1./(1 + exp(-(X+34)./6.5))
tauM(X) = 8./(exp(-(X+55)./30) + exp((X+55)./30))

IKS_PYso_JB12(X,mKS) = -gKS.*mKS.^3.*(X-EKS)

monitor IKS_PYso_JB12

% ODEs and ICs
mKS' = phi.*(Minf(X) - mKS)./tauM(X)
mKS(0)=mKSIC+mKSNoiseIC.*rand(1, Npop)

% Interface
@current += IKS_PYso_JB12(X,mKS)