/* 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[1] is i_Naf in component fast_sodium_channel (mA_per_cm2). * ALGEBRAIC[6] is i_Nap in component persistent_sodium_channel (mA_per_cm2). * ALGEBRAIC[9] is i_Ks in component slow_potassium_channel (mA_per_cm2). * ALGEBRAIC[12] 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[2] is alpha_m in component fast_sodium_channel_m_gate (per_ms). * ALGEBRAIC[3] is beta_m in component fast_sodium_channel_m_gate (per_ms). * ALGEBRAIC[4] is alpha_h in component fast_sodium_channel_h_gate (per_ms). * ALGEBRAIC[5] 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[7] is alpha_p in component persistent_sodium_channel_p_gate (per_ms). * ALGEBRAIC[8] 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[10] is alpha_s in component slow_potassium_channel_s_gate (per_ms). * ALGEBRAIC[11] 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[13] is alpha_n in component juxtaparanodal_fast_potassium_channel_n_gate (per_ms). * ALGEBRAIC[14] 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). * There are a total of 2 condition variables. */ 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; RATES[0] = 0.1001; RATES[1] = 0.1001; RATES[2] = 0.1001; RATES[3] = 0.1001; RATES[4] = 0.1001; RATES[5] = 0.1001; } void computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { resid[0] = RATES[0] - - (- ALGEBRAIC[0]+ALGEBRAIC[1]+ALGEBRAIC[6]+ALGEBRAIC[9]+ALGEBRAIC[12]+ALGEBRAIC[15])/CONSTANTS[2]; resid[1] = RATES[1] - ALGEBRAIC[2]*(1.00000 - STATES[1]) - ALGEBRAIC[3]*STATES[1]; resid[2] = RATES[2] - ALGEBRAIC[4]*(1.00000 - STATES[2]) - ALGEBRAIC[5]*STATES[2]; resid[3] = RATES[3] - ALGEBRAIC[7]*(1.00000 - STATES[3]) - ALGEBRAIC[8]*STATES[3]; resid[4] = RATES[4] - ALGEBRAIC[10]*(1.00000 - STATES[4]) - ALGEBRAIC[11]*STATES[4]; resid[5] = RATES[5] - ALGEBRAIC[13]*(1.00000 - STATES[5]) - ALGEBRAIC[14]*STATES[5]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { } void computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = (CONDVAR[0]>=0.00000&&CONDVAR[1]<=0.00000 ? CONSTANTS[0] : 0.00000); ALGEBRAIC[1] = CONSTANTS[6]*pow(STATES[1], 3.00000)*STATES[2]*(STATES[0] - CONSTANTS[3]); ALGEBRAIC[2] = ( 6.57000*(STATES[0]+20.4000))/(1.00000 - exp(- (STATES[0]+20.4000)/10.3000)); ALGEBRAIC[3] = ( - 0.304000*(STATES[0]+25.7000))/(1.00000 - exp((STATES[0]+25.7000)/9.16000)); ALGEBRAIC[4] = ( - 0.340000*(STATES[0]+114.000))/(1.00000 - exp((STATES[0]+114.000)/11.0000)); ALGEBRAIC[5] = 12.6000/(1.00000+exp(- (STATES[0]+31.8000)/13.4000)); ALGEBRAIC[6] = CONSTANTS[7]*pow(STATES[3], 3.00000)*(STATES[0] - CONSTANTS[3]); ALGEBRAIC[7] = ( 0.0353000*(STATES[0]+27.0000))/(1.00000 - exp(- (STATES[0]+27.0000)/10.2000)); ALGEBRAIC[8] = ( - 0.000883000*(STATES[0]+34.0000))/(1.00000 - exp((STATES[0]+34.0000)/10.0000)); ALGEBRAIC[9] = CONSTANTS[8]*STATES[4]*(STATES[0] - CONSTANTS[4]); ALGEBRAIC[10] = 0.300000/(1.00000+exp(- (STATES[0]+53.0000)/5.00000)); ALGEBRAIC[11] = 0.0300000/(1.00000+exp(- (STATES[0]+90.0000)/1.00000)); ALGEBRAIC[12] = CONSTANTS[9]*pow(STATES[5], 4.00000)*(STATES[0] - CONSTANTS[4]); ALGEBRAIC[13] = ( 0.0462000*(STATES[0]+83.2000))/(1.00000 - exp(- (STATES[0]+83.2000)/1.10000)); ALGEBRAIC[14] = ( - 0.0824000*(STATES[0]+66.0000))/(1.00000 - exp((STATES[0]+66.0000)/10.5000)); ALGEBRAIC[15] = CONSTANTS[10]*(STATES[0] - CONSTANTS[5]); } void getStateInformation(double* SI) { SI[0] = 1.0; SI[1] = 1.0; SI[2] = 1.0; SI[3] = 1.0; SI[4] = 1.0; SI[5] = 1.0; } void computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES, double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS) { CONDVAR[0] = VOI - 10.0000; CONDVAR[1] = VOI - (10.0000+CONSTANTS[1]); }