;; Cerebellar Purkinje Cell: resurgent Na current and high frequency
;; firing (Khaliq et al 2003).

(nemo-model K1

  ((input v 
	  (cai from ion-pools)
	  (ica from ion-currents))

   (const ena = 60)
   (const ek = -88)
   (const ca0 = 1e-4)

   (component (type ion-channel) (name K1)
   ;; HH TEA-sensitive Purkinje potassium current

	      (component (type gate)

			 ;; constants

			 ;; rate functions

			 (K1_v = (v + 11)) ;; account for junction potential

			 (K1_minf = 
  		           (let ((mivh -24)
				 (mik  15.4))
			     (1 / (1 + exp (neg (K1_v - mivh) / mik)))))


			 (K1_mtau =
			   (let ((mty0   0.00012851)
				 (mtvh1  100.7)
				 (mtk1   12.9)
				 (mtvh2  -56.0)
				 (mtk2   -23.1))
			     (1e3 * (if (K1_v < -35) 
					then (3.0 * (3.4225e-5 + 0.00498 * exp (neg (K1_v) / -28.29)))
					else (mty0 + 1.0 / (exp ((K1_v + mtvh1) / mtk1) + exp ((K1_v + mtvh2) / mtk2)))
					))))

			 (K1_hinf = 
			   (let ((hiy0  0.31)
				 (hiA   0.78)
				 (hivh  -5.802)
				 (hik   11.2))
			     (hiy0 + hiA / (1 + exp ((K1_v - hivh) / hik)))))


			 (K1_htau = 
			      (1e3 * (if ( K1_v > 0 ) 
					   then (0.0012 + 0.0023 * exp (-0.141 * K1_v))
					   else (1.2202e-05 + 0.012 * exp (neg (((K1_v - (-56.3)) / 49.6) ^ 2))))))

			 (hh-ionic-gate 
			  (K1  ;; ion name: exported variables will be of the form {ion}_{id}
			   (initial-m  (K1_minf))
			   (initial-h  (K1_hinf))
			   (m-power    3)
			   (h-power    1)
			   (m-inf      (K1_minf))
			   (m-tau      (K1_mtau))
			   (h-inf      (K1_hinf))
			   (h-tau      (K1_htau))))
			 
			 )
	      
	      (component (type pore)
			 (const  gbar_K1  = 0.004)
			 (output gbar_K1 ))
	      
	      (component (type permeating-substance) (name k)
			 (const e_K1 = ek)
			 (output e_K1 ))
	      
	      ) ;; end K1 current

))