/* There are a total of 16 entries in the algebraic variable array. There are a total of 6 entries in each of the rate and state variable arrays. There are a total of 11 entries in the constant variable array. */ /* * VOI is t in component environment (ms). * STATES[0] is V_m in component membrane (mV). * ALGEBRAIC[0] is i_Stim in component membrane (mA_per_cm2). * CONSTANTS[0] is stim_amplitude in component membrane (mA_per_cm2). * CONSTANTS[1] is stim_duration in component membrane (ms). * ALGEBRAIC[6] is i_Naf in component fast_sodium_channel (mA_per_cm2). * ALGEBRAIC[12] is i_Nap in component persistent_sodium_channel (mA_per_cm2). * ALGEBRAIC[13] is i_Ks in component slow_potassium_channel (mA_per_cm2). * ALGEBRAIC[14] is i_Kf in component juxtaparanodal_fast_potassium_channel (mA_per_cm2). * ALGEBRAIC[15] is i_Lk in component leakage_channel (mA_per_cm2). * CONSTANTS[2] is C_n in component membrane (mF_per_cm2). * CONSTANTS[3] is E_Na in component membrane (mV). * CONSTANTS[4] is E_K in component membrane (mV). * CONSTANTS[5] is E_Lk in component membrane (mV). * CONSTANTS[6] is g_Naf in component fast_sodium_channel (S_per_cm2). * STATES[1] is m in component fast_sodium_channel_m_gate (dimensionless). * STATES[2] is h in component fast_sodium_channel_h_gate (dimensionless). * ALGEBRAIC[1] is alpha_m in component fast_sodium_channel_m_gate (per_ms). * ALGEBRAIC[7] is beta_m in component fast_sodium_channel_m_gate (per_ms). * ALGEBRAIC[2] is alpha_h in component fast_sodium_channel_h_gate (per_ms). * ALGEBRAIC[8] is beta_h in component fast_sodium_channel_h_gate (per_ms). * CONSTANTS[7] is g_Nap in component persistent_sodium_channel (S_per_cm2). * STATES[3] is p in component persistent_sodium_channel_p_gate (dimensionless). * ALGEBRAIC[3] is alpha_p in component persistent_sodium_channel_p_gate (per_ms). * ALGEBRAIC[9] is beta_p in component persistent_sodium_channel_p_gate (per_ms). * CONSTANTS[8] is g_Ks in component slow_potassium_channel (S_per_cm2). * STATES[4] is s in component slow_potassium_channel_s_gate (dimensionless). * ALGEBRAIC[4] is alpha_s in component slow_potassium_channel_s_gate (per_ms). * ALGEBRAIC[10] is beta_s in component slow_potassium_channel_s_gate (per_ms). * CONSTANTS[9] is g_Kf in component juxtaparanodal_fast_potassium_channel (S_per_cm2). * STATES[5] is n in component juxtaparanodal_fast_potassium_channel_n_gate (dimensionless). * ALGEBRAIC[5] is alpha_n in component juxtaparanodal_fast_potassium_channel_n_gate (per_ms). * ALGEBRAIC[11] is beta_n in component juxtaparanodal_fast_potassium_channel_n_gate (per_ms). * CONSTANTS[10] is g_Lk in component leakage_channel (S_per_cm2). * RATES[0] is d/dt V_m in component membrane (mV). * RATES[1] is d/dt m in component fast_sodium_channel_m_gate (dimensionless). * RATES[2] is d/dt h in component fast_sodium_channel_h_gate (dimensionless). * RATES[3] is d/dt p in component persistent_sodium_channel_p_gate (dimensionless). * RATES[4] is d/dt s in component slow_potassium_channel_s_gate (dimensionless). * RATES[5] is d/dt n in component juxtaparanodal_fast_potassium_channel_n_gate (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = -88.5901439103062; CONSTANTS[0] = 0.05; CONSTANTS[1] = 0.5; CONSTANTS[2] = 0.002; CONSTANTS[3] = 50; CONSTANTS[4] = -90; CONSTANTS[5] = -90; CONSTANTS[6] = 3; STATES[1] = 0.0302964457761589; STATES[2] = 0.841520865130776; CONSTANTS[7] = 0.01; STATES[3] = 0.0969864645712442; CONSTANTS[8] = 0.08; STATES[4] = 0.00997371545602793; CONSTANTS[9] = 0; STATES[5] = 0.000886041197111556; CONSTANTS[10] = 0.007; } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = ( 6.57000*(STATES[0]+20.4000))/(1.00000 - exp(- (STATES[0]+20.4000)/10.3000)); ALGEBRAIC[7] = ( - 0.304000*(STATES[0]+25.7000))/(1.00000 - exp((STATES[0]+25.7000)/9.16000)); RATES[1] = ALGEBRAIC[1]*(1.00000 - STATES[1]) - ALGEBRAIC[7]*STATES[1]; ALGEBRAIC[2] = ( - 0.340000*(STATES[0]+114.000))/(1.00000 - exp((STATES[0]+114.000)/11.0000)); ALGEBRAIC[8] = 12.6000/(1.00000+exp(- (STATES[0]+31.8000)/13.4000)); RATES[2] = ALGEBRAIC[2]*(1.00000 - STATES[2]) - ALGEBRAIC[8]*STATES[2]; ALGEBRAIC[3] = ( 0.0353000*(STATES[0]+27.0000))/(1.00000 - exp(- (STATES[0]+27.0000)/10.2000)); ALGEBRAIC[9] = ( - 0.000883000*(STATES[0]+34.0000))/(1.00000 - exp((STATES[0]+34.0000)/10.0000)); RATES[3] = ALGEBRAIC[3]*(1.00000 - STATES[3]) - ALGEBRAIC[9]*STATES[3]; ALGEBRAIC[4] = 0.300000/(1.00000+exp(- (STATES[0]+53.0000)/5.00000)); ALGEBRAIC[10] = 0.0300000/(1.00000+exp(- (STATES[0]+90.0000)/1.00000)); RATES[4] = ALGEBRAIC[4]*(1.00000 - STATES[4]) - ALGEBRAIC[10]*STATES[4]; ALGEBRAIC[5] = ( 0.0462000*(STATES[0]+83.2000))/(1.00000 - exp(- (STATES[0]+83.2000)/1.10000)); ALGEBRAIC[11] = ( - 0.0824000*(STATES[0]+66.0000))/(1.00000 - exp((STATES[0]+66.0000)/10.5000)); RATES[5] = ALGEBRAIC[5]*(1.00000 - STATES[5]) - ALGEBRAIC[11]*STATES[5]; ALGEBRAIC[0] = (VOI>=10.0000&&VOI<=10.0000+CONSTANTS[1] ? CONSTANTS[0] : 0.00000); ALGEBRAIC[6] = CONSTANTS[6]*pow(STATES[1], 3.00000)*STATES[2]*(STATES[0] - CONSTANTS[3]); ALGEBRAIC[12] = CONSTANTS[7]*pow(STATES[3], 3.00000)*(STATES[0] - CONSTANTS[3]); ALGEBRAIC[13] = CONSTANTS[8]*STATES[4]*(STATES[0] - CONSTANTS[4]); ALGEBRAIC[14] = CONSTANTS[9]*pow(STATES[5], 4.00000)*(STATES[0] - CONSTANTS[4]); ALGEBRAIC[15] = CONSTANTS[10]*(STATES[0] - CONSTANTS[5]); RATES[0] = - (- ALGEBRAIC[0]+ALGEBRAIC[6]+ALGEBRAIC[12]+ALGEBRAIC[13]+ALGEBRAIC[14]+ALGEBRAIC[15])/CONSTANTS[2]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[1] = ( 6.57000*(STATES[0]+20.4000))/(1.00000 - exp(- (STATES[0]+20.4000)/10.3000)); ALGEBRAIC[7] = ( - 0.304000*(STATES[0]+25.7000))/(1.00000 - exp((STATES[0]+25.7000)/9.16000)); ALGEBRAIC[2] = ( - 0.340000*(STATES[0]+114.000))/(1.00000 - exp((STATES[0]+114.000)/11.0000)); ALGEBRAIC[8] = 12.6000/(1.00000+exp(- (STATES[0]+31.8000)/13.4000)); ALGEBRAIC[3] = ( 0.0353000*(STATES[0]+27.0000))/(1.00000 - exp(- (STATES[0]+27.0000)/10.2000)); ALGEBRAIC[9] = ( - 0.000883000*(STATES[0]+34.0000))/(1.00000 - exp((STATES[0]+34.0000)/10.0000)); ALGEBRAIC[4] = 0.300000/(1.00000+exp(- (STATES[0]+53.0000)/5.00000)); ALGEBRAIC[10] = 0.0300000/(1.00000+exp(- (STATES[0]+90.0000)/1.00000)); ALGEBRAIC[5] = ( 0.0462000*(STATES[0]+83.2000))/(1.00000 - exp(- (STATES[0]+83.2000)/1.10000)); ALGEBRAIC[11] = ( - 0.0824000*(STATES[0]+66.0000))/(1.00000 - exp((STATES[0]+66.0000)/10.5000)); ALGEBRAIC[0] = (VOI>=10.0000&&VOI<=10.0000+CONSTANTS[1] ? CONSTANTS[0] : 0.00000); ALGEBRAIC[6] = CONSTANTS[6]*pow(STATES[1], 3.00000)*STATES[2]*(STATES[0] - CONSTANTS[3]); ALGEBRAIC[12] = CONSTANTS[7]*pow(STATES[3], 3.00000)*(STATES[0] - CONSTANTS[3]); ALGEBRAIC[13] = CONSTANTS[8]*STATES[4]*(STATES[0] - CONSTANTS[4]); ALGEBRAIC[14] = CONSTANTS[9]*pow(STATES[5], 4.00000)*(STATES[0] - CONSTANTS[4]); ALGEBRAIC[15] = CONSTANTS[10]*(STATES[0] - CONSTANTS[5]); }