Generated Code

The following is c_ida code generated by the CellML API from this CellML file. (Back to language selection)

The raw code is available.

/*
   There are a total of 68 entries in the algebraic variable array.
   There are a total of 17 entries in each of the rate and state variable arrays.
   There are a total of 47 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (millisecond).
 * STATES[0] is V in component membrane (millivolt).
 * CONSTANTS[0] is R in component membrane (joule_per_mole_kelvin).
 * CONSTANTS[1] is T in component membrane (kelvin).
 * CONSTANTS[2] is F in component membrane (coulomb_per_millimole).
 * CONSTANTS[3] is Cm in component membrane (microF_per_cm2).
 * CONSTANTS[4] is V_c in component membrane (micrometre3).
 * ALGEBRAIC[7] is i_K1 in component inward_rectifier_potassium_current (picoA_per_picoF).
 * ALGEBRAIC[50] is i_to in component transient_outward_current (picoA_per_picoF).
 * ALGEBRAIC[8] is i_Kr in component rapid_time_dependent_potassium_current (picoA_per_picoF).
 * ALGEBRAIC[17] is i_Ks in component slow_time_dependent_potassium_current (picoA_per_picoF).
 * ALGEBRAIC[36] is i_CaL in component L_type_Ca_current (picoA_per_picoF).
 * ALGEBRAIC[55] is i_NaK in component sodium_potassium_pump_current (picoA_per_picoF).
 * ALGEBRAIC[22] is i_Na in component fast_sodium_current (picoA_per_picoF).
 * ALGEBRAIC[35] is i_b_Na in component sodium_background_current (picoA_per_picoF).
 * ALGEBRAIC[56] is i_NaCa in component sodium_calcium_exchanger_current (picoA_per_picoF).
 * ALGEBRAIC[49] is i_b_Ca in component calcium_background_current (picoA_per_picoF).
 * ALGEBRAIC[58] is i_p_K in component potassium_pump_current (picoA_per_picoF).
 * ALGEBRAIC[57] is i_p_Ca in component calcium_pump_current (picoA_per_picoF).
 * ALGEBRAIC[67] is i_Stim in component membrane (picoA_per_picoF).
 * ALGEBRAIC[66] is Istim in component stimulus_protocol (picoA_per_picoF).
 * ALGEBRAIC[0] is E_Na in component reversal_potentials (millivolt).
 * ALGEBRAIC[1] is E_K in component reversal_potentials (millivolt).
 * ALGEBRAIC[2] is E_Ks in component reversal_potentials (millivolt).
 * ALGEBRAIC[3] is E_Ca in component reversal_potentials (millivolt).
 * CONSTANTS[5] is P_kna in component reversal_potentials (nanoA_per_millimolar).
 * CONSTANTS[6] is K_o in component potassium_dynamics (millimolar).
 * CONSTANTS[7] is Na_o in component sodium_dynamics (millimolar).
 * STATES[1] is K_i in component potassium_dynamics (millimolar).
 * STATES[2] is Na_i in component sodium_dynamics (millimolar).
 * CONSTANTS[8] is Ca_o in component calcium_dynamics (millimolar).
 * STATES[3] is Ca_i in component calcium_dynamics (millimolar).
 * CONSTANTS[9] is g_K1 in component inward_rectifier_potassium_current (nanoS_per_picoF).
 * ALGEBRAIC[6] is xK1_inf in component inward_rectifier_potassium_current (dimensionless).
 * ALGEBRAIC[4] is alpha_K1 in component inward_rectifier_potassium_current (dimensionless).
 * ALGEBRAIC[5] is beta_K1 in component inward_rectifier_potassium_current (dimensionless).
 * CONSTANTS[10] is g_Kr in component rapid_time_dependent_potassium_current (nanoS_per_picoF).
 * STATES[4] is Xr1 in component rapid_time_dependent_potassium_current_Xr1_gate (dimensionless).
 * STATES[5] is Xr2 in component rapid_time_dependent_potassium_current_Xr2_gate (dimensionless).
 * ALGEBRAIC[9] is xr1_inf in component rapid_time_dependent_potassium_current_Xr1_gate (dimensionless).
 * ALGEBRAIC[10] is alpha_xr1 in component rapid_time_dependent_potassium_current_Xr1_gate (per_millisecond).
 * ALGEBRAIC[11] is beta_xr1 in component rapid_time_dependent_potassium_current_Xr1_gate (per_millisecond).
 * ALGEBRAIC[12] is tau_xr1 in component rapid_time_dependent_potassium_current_Xr1_gate (millisecond).
 * ALGEBRAIC[13] is xr2_inf in component rapid_time_dependent_potassium_current_Xr2_gate (dimensionless).
 * ALGEBRAIC[14] is alpha_xr2 in component rapid_time_dependent_potassium_current_Xr2_gate (per_millisecond).
 * ALGEBRAIC[15] is beta_xr2 in component rapid_time_dependent_potassium_current_Xr2_gate (per_millisecond).
 * ALGEBRAIC[16] is tau_xr2 in component rapid_time_dependent_potassium_current_Xr2_gate (millisecond).
 * CONSTANTS[11] is g_Ks in component slow_time_dependent_potassium_current (nanoS_per_picoF).
 * STATES[6] is Xs in component slow_time_dependent_potassium_current_Xs_gate (dimensionless).
 * ALGEBRAIC[18] is xs_inf in component slow_time_dependent_potassium_current_Xs_gate (dimensionless).
 * ALGEBRAIC[19] is alpha_xs in component slow_time_dependent_potassium_current_Xs_gate (per_millisecond).
 * ALGEBRAIC[20] is beta_xs in component slow_time_dependent_potassium_current_Xs_gate (per_millisecond).
 * ALGEBRAIC[21] is tau_xs in component slow_time_dependent_potassium_current_Xs_gate (millisecond).
 * CONSTANTS[12] is g_Na in component fast_sodium_current (nanoS_per_picoF).
 * STATES[7] is m in component fast_sodium_current_m_gate (dimensionless).
 * STATES[8] is h in component fast_sodium_current_h_gate (dimensionless).
 * STATES[9] is j in component fast_sodium_current_j_gate (dimensionless).
 * ALGEBRAIC[23] is m_inf in component fast_sodium_current_m_gate (dimensionless).
 * ALGEBRAIC[24] is alpha_m in component fast_sodium_current_m_gate (per_millisecond).
 * ALGEBRAIC[25] is beta_m in component fast_sodium_current_m_gate (per_millisecond).
 * ALGEBRAIC[26] is tau_m in component fast_sodium_current_m_gate (millisecond).
 * ALGEBRAIC[27] is h_inf in component fast_sodium_current_h_gate (dimensionless).
 * ALGEBRAIC[28] is alpha_h in component fast_sodium_current_h_gate (per_millisecond).
 * ALGEBRAIC[29] is beta_h in component fast_sodium_current_h_gate (per_millisecond).
 * ALGEBRAIC[30] is tau_h in component fast_sodium_current_h_gate (millisecond).
 * ALGEBRAIC[31] is j_inf in component fast_sodium_current_j_gate (dimensionless).
 * ALGEBRAIC[32] is alpha_j in component fast_sodium_current_j_gate (per_millisecond).
 * ALGEBRAIC[33] is beta_j in component fast_sodium_current_j_gate (per_millisecond).
 * ALGEBRAIC[34] is tau_j in component fast_sodium_current_j_gate (millisecond).
 * CONSTANTS[13] is g_bna in component sodium_background_current (nanoS_per_picoF).
 * CONSTANTS[14] is g_CaL in component L_type_Ca_current (nanoS_per_picoF).
 * STATES[10] is d in component L_type_Ca_current_d_gate (dimensionless).
 * STATES[11] is f in component L_type_Ca_current_f_gate (dimensionless).
 * STATES[12] is fCa in component L_type_Ca_current_fCa_gate (dimensionless).
 * ALGEBRAIC[37] is d_inf in component L_type_Ca_current_d_gate (dimensionless).
 * ALGEBRAIC[38] is alpha_d in component L_type_Ca_current_d_gate (per_millisecond).
 * ALGEBRAIC[39] is beta_d in component L_type_Ca_current_d_gate (per_millisecond).
 * ALGEBRAIC[40] is gamma_d in component L_type_Ca_current_d_gate (per_millisecond).
 * ALGEBRAIC[41] is tau_d in component L_type_Ca_current_d_gate (millisecond).
 * ALGEBRAIC[42] is f_inf in component L_type_Ca_current_f_gate (dimensionless).
 * ALGEBRAIC[43] is tau_f in component L_type_Ca_current_f_gate (millisecond).
 * ALGEBRAIC[44] is alpha_fCa in component L_type_Ca_current_fCa_gate (dimensionless).
 * ALGEBRAIC[45] is beta_fCa in component L_type_Ca_current_fCa_gate (dimensionless).
 * ALGEBRAIC[46] is gama_fCa in component L_type_Ca_current_fCa_gate (dimensionless).
 * ALGEBRAIC[47] is fCa_inf in component L_type_Ca_current_fCa_gate (dimensionless).
 * CONSTANTS[46] is tau_fCa in component L_type_Ca_current_fCa_gate (millisecond).
 * ALGEBRAIC[48] is d_fCa in component L_type_Ca_current_fCa_gate (dimensionless).
 * CONSTANTS[15] is g_bca in component calcium_background_current (nanoS_per_picoF).
 * CONSTANTS[16] is g_to in component transient_outward_current (nanoS_per_picoF).
 * STATES[13] is s in component transient_outward_current_s_gate (dimensionless).
 * STATES[14] is r in component transient_outward_current_r_gate (dimensionless).
 * ALGEBRAIC[51] is s_inf in component transient_outward_current_s_gate (dimensionless).
 * ALGEBRAIC[52] is tau_s in component transient_outward_current_s_gate (dimensionless).
 * ALGEBRAIC[53] is r_inf in component transient_outward_current_r_gate (dimensionless).
 * ALGEBRAIC[54] is tau_r in component transient_outward_current_r_gate (millisecond).
 * CONSTANTS[17] is P_NaK in component sodium_potassium_pump_current (picoA_per_picoF).
 * CONSTANTS[18] is K_mk in component sodium_potassium_pump_current (millimolar).
 * CONSTANTS[19] is K_mNa in component sodium_potassium_pump_current (millimolar).
 * CONSTANTS[20] is K_NaCa in component sodium_calcium_exchanger_current (picoA_per_picoF).
 * CONSTANTS[21] is K_sat in component sodium_calcium_exchanger_current (dimensionless).
 * CONSTANTS[22] is alpha in component sodium_calcium_exchanger_current (dimensionless).
 * CONSTANTS[23] is gamma in component sodium_calcium_exchanger_current (dimensionless).
 * CONSTANTS[24] is Km_Ca in component sodium_calcium_exchanger_current (millimolar).
 * CONSTANTS[25] is Km_Nai in component sodium_calcium_exchanger_current (millimolar).
 * CONSTANTS[26] is g_pCa in component calcium_pump_current (nanoS_per_picoF).
 * CONSTANTS[27] is K_pCa in component calcium_pump_current (millimolar).
 * CONSTANTS[28] is g_pK in component potassium_pump_current (nanoS_per_picoF).
 * STATES[15] is Ca_SR in component calcium_dynamics (millimolar).
 * ALGEBRAIC[59] is i_rel in component calcium_dynamics (millimolar_per_millisecond).
 * ALGEBRAIC[60] is i_up in component calcium_dynamics (millimolar_per_millisecond).
 * ALGEBRAIC[61] is i_leak in component calcium_dynamics (millimolar_per_millisecond).
 * STATES[16] is g in component calcium_dynamics (dimensionless).
 * CONSTANTS[29] is tau_g in component calcium_dynamics (millisecond).
 * ALGEBRAIC[62] is g_inf in component calcium_dynamics (dimensionless).
 * CONSTANTS[30] is a_rel in component calcium_dynamics (millimolar_per_millisecond).
 * CONSTANTS[31] is b_rel in component calcium_dynamics (millimolar).
 * CONSTANTS[32] is c_rel in component calcium_dynamics (millimolar_per_millisecond).
 * CONSTANTS[33] is K_up in component calcium_dynamics (millimolar).
 * CONSTANTS[34] is V_leak in component calcium_dynamics (per_millisecond).
 * CONSTANTS[35] is Vmax_up in component calcium_dynamics (millimolar_per_millisecond).
 * ALGEBRAIC[64] is Ca_i_bufc in component calcium_dynamics (millimolar).
 * ALGEBRAIC[65] is Ca_sr_bufsr in component calcium_dynamics (millimolar).
 * CONSTANTS[36] is Buf_c in component calcium_dynamics (millimolar).
 * CONSTANTS[37] is K_buf_c in component calcium_dynamics (millimolar).
 * CONSTANTS[38] is Buf_sr in component calcium_dynamics (millimolar).
 * CONSTANTS[39] is K_buf_sr in component calcium_dynamics (millimolar).
 * CONSTANTS[40] is V_sr in component calcium_dynamics (micrometre3).
 * ALGEBRAIC[63] is d_g in component calcium_dynamics (dimensionless).
 * CONSTANTS[41] is IstimStart in component stimulus_protocol (millisecond).
 * CONSTANTS[42] is IstimEnd in component stimulus_protocol (millisecond).
 * CONSTANTS[43] is IstimAmplitude in component stimulus_protocol (picoA_per_picoF).
 * CONSTANTS[44] is IstimPeriod in component stimulus_protocol (millisecond).
 * CONSTANTS[45] is IstimPulseDuration in component stimulus_protocol (millisecond).
 * RATES[0] is d/dt V in component membrane (millivolt).
 * RATES[4] is d/dt Xr1 in component rapid_time_dependent_potassium_current_Xr1_gate (dimensionless).
 * RATES[5] is d/dt Xr2 in component rapid_time_dependent_potassium_current_Xr2_gate (dimensionless).
 * RATES[6] is d/dt Xs in component slow_time_dependent_potassium_current_Xs_gate (dimensionless).
 * RATES[7] is d/dt m in component fast_sodium_current_m_gate (dimensionless).
 * RATES[8] is d/dt h in component fast_sodium_current_h_gate (dimensionless).
 * RATES[9] is d/dt j in component fast_sodium_current_j_gate (dimensionless).
 * RATES[10] is d/dt d in component L_type_Ca_current_d_gate (dimensionless).
 * RATES[11] is d/dt f in component L_type_Ca_current_f_gate (dimensionless).
 * RATES[12] is d/dt fCa in component L_type_Ca_current_fCa_gate (dimensionless).
 * RATES[13] is d/dt s in component transient_outward_current_s_gate (dimensionless).
 * RATES[14] is d/dt r in component transient_outward_current_r_gate (dimensionless).
 * RATES[16] is d/dt g in component calcium_dynamics (dimensionless).
 * RATES[3] is d/dt Ca_i in component calcium_dynamics (millimolar).
 * RATES[15] is d/dt Ca_SR in component calcium_dynamics (millimolar).
 * RATES[2] is d/dt Na_i in component sodium_dynamics (millimolar).
 * RATES[1] is d/dt K_i in component potassium_dynamics (millimolar).
 * There are a total of 12 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
STATES[0] = -86.2;
CONSTANTS[0] = 8314.472;
CONSTANTS[1] = 310;
CONSTANTS[2] = 96485.3415;
CONSTANTS[3] = 0.185;
CONSTANTS[4] = 0.016404;
CONSTANTS[5] = 0.03;
CONSTANTS[6] = 5.4;
CONSTANTS[7] = 140;
STATES[1] = 138.3;
STATES[2] = 11.6;
CONSTANTS[8] = 2;
STATES[3] = 0.0002;
CONSTANTS[9] = 5.405;
CONSTANTS[10] = 0.096;
STATES[4] = 0;
STATES[5] = 1;
CONSTANTS[11] = 0.245;
STATES[6] = 0;
CONSTANTS[12] = 14.838;
STATES[7] = 0;
STATES[8] = 0.75;
STATES[9] = 0.75;
CONSTANTS[13] = 0.00029;
CONSTANTS[14] = 0.000175;
STATES[10] = 0;
STATES[11] = 1;
STATES[12] = 1;
CONSTANTS[15] = 0.000592;
CONSTANTS[16] = 0.073;
STATES[13] = 1;
STATES[14] = 0;
CONSTANTS[17] = 1.362;
CONSTANTS[18] = 1;
CONSTANTS[19] = 40;
CONSTANTS[20] = 1000;
CONSTANTS[21] = 0.1;
CONSTANTS[22] = 2.5;
CONSTANTS[23] = 0.35;
CONSTANTS[24] = 1.38;
CONSTANTS[25] = 87.5;
CONSTANTS[26] = 0.825;
CONSTANTS[27] = 0.0005;
CONSTANTS[28] = 0.0146;
STATES[15] = 0.2;
STATES[16] = 1;
CONSTANTS[29] = 2;
CONSTANTS[30] = 0.016464;
CONSTANTS[31] = 0.25;
CONSTANTS[32] = 0.008232;
CONSTANTS[33] = 0.00025;
CONSTANTS[34] = 8e-5;
CONSTANTS[35] = 0.000425;
CONSTANTS[36] = 0.15;
CONSTANTS[37] = 0.001;
CONSTANTS[38] = 10;
CONSTANTS[39] = 0.3;
CONSTANTS[40] = 0.001094;
CONSTANTS[41] = 100;
CONSTANTS[42] = 50000;
CONSTANTS[43] = -52;
CONSTANTS[44] = 1000;
CONSTANTS[45] = 1;
CONSTANTS[46] = 2.00000;
RATES[0] = 0.1001;
RATES[4] = 0.1001;
RATES[5] = 0.1001;
RATES[6] = 0.1001;
RATES[7] = 0.1001;
RATES[8] = 0.1001;
RATES[9] = 0.1001;
RATES[10] = 0.1001;
RATES[11] = 0.1001;
RATES[12] = 0.1001;
RATES[13] = 0.1001;
RATES[14] = 0.1001;
RATES[16] = 0.1001;
RATES[3] = 0.1001;
RATES[15] = 0.1001;
RATES[2] = 0.1001;
RATES[1] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] -  (- 1.00000/1.00000)*(ALGEBRAIC[7]+ALGEBRAIC[50]+ALGEBRAIC[8]+ALGEBRAIC[17]+ALGEBRAIC[36]+ALGEBRAIC[55]+ALGEBRAIC[22]+ALGEBRAIC[35]+ALGEBRAIC[56]+ALGEBRAIC[49]+ALGEBRAIC[58]+ALGEBRAIC[57]+ALGEBRAIC[67]);
resid[1] = RATES[4] - (ALGEBRAIC[9] - STATES[4])/ALGEBRAIC[12];
resid[2] = RATES[5] - (ALGEBRAIC[13] - STATES[5])/ALGEBRAIC[16];
resid[3] = RATES[6] - (ALGEBRAIC[18] - STATES[6])/ALGEBRAIC[21];
resid[4] = RATES[7] - (ALGEBRAIC[23] - STATES[7])/ALGEBRAIC[26];
resid[5] = RATES[8] - (ALGEBRAIC[27] - STATES[8])/ALGEBRAIC[30];
resid[6] = RATES[9] - (ALGEBRAIC[31] - STATES[9])/ALGEBRAIC[34];
resid[7] = RATES[10] - (ALGEBRAIC[37] - STATES[10])/ALGEBRAIC[41];
resid[8] = RATES[11] - (ALGEBRAIC[42] - STATES[11])/ALGEBRAIC[43];
resid[9] = RATES[12] - (CONDVAR[4]>0.00000&&CONDVAR[5]>0.00000 ? 0.00000 : ALGEBRAIC[48]);
resid[10] = RATES[13] - (ALGEBRAIC[51] - STATES[13])/ALGEBRAIC[52];
resid[11] = RATES[14] - (ALGEBRAIC[53] - STATES[14])/ALGEBRAIC[54];
resid[12] = RATES[16] - (CONDVAR[7]>0.00000&&CONDVAR[8]>0.00000 ? 0.00000 : ALGEBRAIC[63]);
resid[13] = RATES[3] -  ALGEBRAIC[64]*(((ALGEBRAIC[61] - ALGEBRAIC[60])+ALGEBRAIC[59]) -  (((ALGEBRAIC[36]+ALGEBRAIC[49]+ALGEBRAIC[57]) -  2.00000*ALGEBRAIC[56])/( 2.00000*CONSTANTS[4]*CONSTANTS[2]))*CONSTANTS[3]);
resid[14] = RATES[15] -  (( ALGEBRAIC[65]*CONSTANTS[4])/CONSTANTS[40])*(ALGEBRAIC[60] - (ALGEBRAIC[59]+ALGEBRAIC[61]));
resid[15] = RATES[2] -  (- (ALGEBRAIC[22]+ALGEBRAIC[35]+ 3.00000*ALGEBRAIC[55]+ 3.00000*ALGEBRAIC[56])/( CONSTANTS[4]*CONSTANTS[2]))*CONSTANTS[3];
resid[16] = RATES[1] -  (- ((ALGEBRAIC[7]+ALGEBRAIC[50]+ALGEBRAIC[8]+ALGEBRAIC[17]+ALGEBRAIC[58]+ALGEBRAIC[67]) -  2.00000*ALGEBRAIC[55])/( CONSTANTS[4]*CONSTANTS[2]))*CONSTANTS[3];
}
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[1] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[6]/STATES[1]);
ALGEBRAIC[4] = 0.100000/(1.00000+exp( 0.0600000*((STATES[0] - ALGEBRAIC[1]) - 200.000)));
ALGEBRAIC[5] = ( 3.00000*exp( 0.000200000*((STATES[0] - ALGEBRAIC[1])+100.000))+exp( 0.100000*((STATES[0] - ALGEBRAIC[1]) - 10.0000)))/(1.00000+exp( - 0.500000*(STATES[0] - ALGEBRAIC[1])));
ALGEBRAIC[6] = ALGEBRAIC[4]/(ALGEBRAIC[4]+ALGEBRAIC[5]);
ALGEBRAIC[7] =  CONSTANTS[9]*ALGEBRAIC[6]*(STATES[0] - ALGEBRAIC[1]);
ALGEBRAIC[8] =  CONSTANTS[10]* pow((CONSTANTS[6]/5.40000), 1.0 / 2)*STATES[4]*STATES[5]*(STATES[0] - ALGEBRAIC[1]);
ALGEBRAIC[9] = 1.00000/(1.00000+exp((- 26.0000 - STATES[0])/7.00000));
ALGEBRAIC[10] = 450.000/(1.00000+exp((- 45.0000 - STATES[0])/10.0000));
ALGEBRAIC[11] = 6.00000/(1.00000+exp((STATES[0]+30.0000)/11.5000));
ALGEBRAIC[12] =  ALGEBRAIC[10]*ALGEBRAIC[11];
ALGEBRAIC[13] = 1.00000/(1.00000+exp((STATES[0]+88.0000)/24.0000));
ALGEBRAIC[14] = 3.00000/(1.00000+exp((- 60.0000 - STATES[0])/20.0000));
ALGEBRAIC[15] = 1.12000/(1.00000+exp((STATES[0] - 60.0000)/20.0000));
ALGEBRAIC[16] =  ALGEBRAIC[14]*ALGEBRAIC[15];
ALGEBRAIC[2] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log((CONSTANTS[6]+ CONSTANTS[5]*CONSTANTS[7])/(STATES[1]+ CONSTANTS[5]*STATES[2]));
ALGEBRAIC[17] =  CONSTANTS[11]*pow(STATES[6], 2.00000)*(STATES[0] - ALGEBRAIC[2]);
ALGEBRAIC[18] = 1.00000/(1.00000+exp((- 5.00000 - STATES[0])/14.0000));
ALGEBRAIC[19] = 1100.00/ pow((1.00000+exp((- 10.0000 - STATES[0])/6.00000)), 1.0 / 2);
ALGEBRAIC[20] = 1.00000/(1.00000+exp((STATES[0] - 60.0000)/20.0000));
ALGEBRAIC[21] =  ALGEBRAIC[19]*ALGEBRAIC[20];
ALGEBRAIC[0] =  (( CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[7]/STATES[2]);
ALGEBRAIC[22] =  CONSTANTS[12]*pow(STATES[7], 3.00000)*STATES[8]*STATES[9]*(STATES[0] - ALGEBRAIC[0]);
ALGEBRAIC[23] = 1.00000/pow(1.00000+exp((- 56.8600 - STATES[0])/9.03000), 2.00000);
ALGEBRAIC[24] = 1.00000/(1.00000+exp((- 60.0000 - STATES[0])/5.00000));
ALGEBRAIC[25] = 0.100000/(1.00000+exp((STATES[0]+35.0000)/5.00000))+0.100000/(1.00000+exp((STATES[0] - 50.0000)/200.000));
ALGEBRAIC[26] =  ALGEBRAIC[24]*ALGEBRAIC[25];
ALGEBRAIC[27] = 1.00000/pow(1.00000+exp((STATES[0]+71.5500)/7.43000), 2.00000);
ALGEBRAIC[28] = (CONDVAR[0]<0.00000 ?  0.0570000*exp(- (STATES[0]+80.0000)/6.80000) : 0.00000);
ALGEBRAIC[29] = (CONDVAR[1]<0.00000 ?  2.70000*exp( 0.0790000*STATES[0])+ 310000.*exp( 0.348500*STATES[0]) : 0.770000/( 0.130000*(1.00000+exp((STATES[0]+10.6600)/- 11.1000))));
ALGEBRAIC[30] = 1.00000/(ALGEBRAIC[28]+ALGEBRAIC[29]);
ALGEBRAIC[31] = 1.00000/pow(1.00000+exp((STATES[0]+71.5500)/7.43000), 2.00000);
ALGEBRAIC[32] = (CONDVAR[2]<0.00000 ? ( ( - 25428.0*exp( 0.244400*STATES[0]) -  6.94800e-06*exp( - 0.0439100*STATES[0]))*(STATES[0]+37.7800))/(1.00000+exp( 0.311000*(STATES[0]+79.2300))) : 0.00000);
ALGEBRAIC[33] = (CONDVAR[3]<0.00000 ? ( 0.0242400*exp( - 0.0105200*STATES[0]))/(1.00000+exp( - 0.137800*(STATES[0]+40.1400))) : ( 0.600000*exp( 0.0570000*STATES[0]))/(1.00000+exp( - 0.100000*(STATES[0]+32.0000))));
ALGEBRAIC[34] = 1.00000/(ALGEBRAIC[32]+ALGEBRAIC[33]);
ALGEBRAIC[35] =  CONSTANTS[13]*(STATES[0] - ALGEBRAIC[0]);
ALGEBRAIC[36] = ( (( CONSTANTS[14]*STATES[10]*STATES[11]*STATES[12]*4.00000*STATES[0]*pow(CONSTANTS[2], 2.00000))/( CONSTANTS[0]*CONSTANTS[1]))*( STATES[3]*exp(( 2.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) -  0.341000*CONSTANTS[8]))/(exp(( 2.00000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])) - 1.00000);
ALGEBRAIC[37] = 1.00000/(1.00000+exp((- 5.00000 - STATES[0])/7.50000));
ALGEBRAIC[38] = 1.40000/(1.00000+exp((- 35.0000 - STATES[0])/13.0000))+0.250000;
ALGEBRAIC[39] = 1.40000/(1.00000+exp((STATES[0]+5.00000)/5.00000));
ALGEBRAIC[40] = 1.00000/(1.00000+exp((50.0000 - STATES[0])/20.0000));
ALGEBRAIC[41] =  ALGEBRAIC[38]*ALGEBRAIC[39]+ALGEBRAIC[40];
ALGEBRAIC[42] = 1.00000/(1.00000+exp((STATES[0]+20.0000)/7.00000));
ALGEBRAIC[43] =  1125.00*exp(- pow(STATES[0]+27.0000, 2.00000)/240.000)+80.0000+165.000/(1.00000+exp((25.0000 - STATES[0])/10.0000));
ALGEBRAIC[44] = 1.00000/(1.00000+pow(STATES[3]/0.000325000, 8.00000));
ALGEBRAIC[45] = 0.100000/(1.00000+exp((STATES[3] - 0.000500000)/0.000100000));
ALGEBRAIC[46] = 0.200000/(1.00000+exp((STATES[3] - 0.000750000)/0.000800000));
ALGEBRAIC[47] = (ALGEBRAIC[44]+ALGEBRAIC[45]+ALGEBRAIC[46]+0.230000)/1.46000;
ALGEBRAIC[48] = (ALGEBRAIC[47] - STATES[12])/CONSTANTS[46];
ALGEBRAIC[3] =  (( 0.500000*CONSTANTS[0]*CONSTANTS[1])/CONSTANTS[2])*log(CONSTANTS[8]/STATES[3]);
ALGEBRAIC[49] =  CONSTANTS[15]*(STATES[0] - ALGEBRAIC[3]);
ALGEBRAIC[50] =  CONSTANTS[16]*STATES[14]*STATES[13]*(STATES[0] - ALGEBRAIC[1]);
ALGEBRAIC[51] = 1.00000/(1.00000+exp((STATES[0]+28.0000)/5.00000));
ALGEBRAIC[52] =  1000.00*exp(- pow(STATES[0]+67.0000, 2.00000)/1000.00)+8.00000;
ALGEBRAIC[53] = 1.00000/(1.00000+exp((20.0000 - STATES[0])/6.00000));
ALGEBRAIC[54] =  9.50000*exp(- pow(STATES[0]+40.0000, 2.00000)/1800.00)+0.800000;
ALGEBRAIC[55] = (( (( CONSTANTS[17]*CONSTANTS[6])/(CONSTANTS[6]+CONSTANTS[18]))*STATES[2])/(STATES[2]+CONSTANTS[19]))/(1.00000+ 0.124500*exp(( - 0.100000*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))+ 0.0353000*exp(( - STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[56] = ( CONSTANTS[20]*( exp(( CONSTANTS[23]*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))*pow(STATES[2], 3.00000)*CONSTANTS[8] -  exp(( (CONSTANTS[23] - 1.00000)*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))*pow(CONSTANTS[7], 3.00000)*STATES[3]*CONSTANTS[22]))/( (pow(CONSTANTS[25], 3.00000)+pow(CONSTANTS[7], 3.00000))*(CONSTANTS[24]+CONSTANTS[8])*(1.00000+ CONSTANTS[21]*exp(( (CONSTANTS[23] - 1.00000)*STATES[0]*CONSTANTS[2])/( CONSTANTS[0]*CONSTANTS[1]))));
ALGEBRAIC[57] = ( CONSTANTS[26]*STATES[3])/(STATES[3]+CONSTANTS[27]);
ALGEBRAIC[58] = ( CONSTANTS[28]*(STATES[0] - ALGEBRAIC[1]))/(1.00000+exp((25.0000 - STATES[0])/5.98000));
ALGEBRAIC[59] =  (( CONSTANTS[30]*pow(STATES[15], 2.00000))/(pow(CONSTANTS[31], 2.00000)+pow(STATES[15], 2.00000))+CONSTANTS[32])*STATES[10]*STATES[16];
ALGEBRAIC[60] = CONSTANTS[35]/(1.00000+pow(CONSTANTS[33], 2.00000)/pow(STATES[3], 2.00000));
ALGEBRAIC[61] =  CONSTANTS[34]*(STATES[15] - STATES[3]);
ALGEBRAIC[62] = (CONDVAR[6]<0.00000 ? 1.00000/(1.00000+pow(STATES[3]/0.000350000, 6.00000)) : 1.00000/(1.00000+pow(STATES[3]/0.000350000, 16.0000)));
ALGEBRAIC[63] = (ALGEBRAIC[62] - STATES[16])/CONSTANTS[29];
ALGEBRAIC[64] = 1.00000/(1.00000+( CONSTANTS[36]*CONSTANTS[37])/pow(STATES[3]+CONSTANTS[37], 2.00000));
ALGEBRAIC[65] = 1.00000/(1.00000+( CONSTANTS[38]*CONSTANTS[39])/pow(STATES[15]+CONSTANTS[39], 2.00000));
ALGEBRAIC[66] = (CONDVAR[9]>=0.00000&&CONDVAR[10]<=0.00000&&CONDVAR[11]<=0.00000 ? CONSTANTS[43] : 0.00000);
ALGEBRAIC[67] = ALGEBRAIC[66];
}
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;
SI[6] = 1.0;
SI[7] = 1.0;
SI[8] = 1.0;
SI[9] = 1.0;
SI[10] = 1.0;
SI[11] = 1.0;
SI[12] = 1.0;
SI[13] = 1.0;
SI[14] = 1.0;
SI[15] = 1.0;
SI[16] = 1.0;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
CONDVAR[0] = STATES[0] - - 40.0000;
CONDVAR[1] = STATES[0] - - 40.0000;
CONDVAR[2] = STATES[0] - - 40.0000;
CONDVAR[3] = STATES[0] - - 40.0000;
CONDVAR[4] =  0.0100000*ALGEBRAIC[48] - 0.00000;
CONDVAR[5] = STATES[0] - - 60.0000;
CONDVAR[6] = STATES[3] - 0.000350000;
CONDVAR[7] =  0.0100000*ALGEBRAIC[63] - 0.00000;
CONDVAR[8] = STATES[0] - - 60.0000;
CONDVAR[9] = VOI - CONSTANTS[41];
CONDVAR[10] = VOI - CONSTANTS[42];
CONDVAR[11] = ((VOI - CONSTANTS[41]) -  floor((VOI - CONSTANTS[41])/CONSTANTS[44])*CONSTANTS[44]) - CONSTANTS[45];
}