Generated Code
The following is c code generated by the CellML API from this CellML file. (Back to language selection)
The raw code is available.
/* There are a total of 53 entries in the algebraic variable array. There are a total of 7 entries in each of the rate and state variable arrays. There are a total of 114 entries in the constant variable array. */ /* * VOI is time in component environment (day). * STATES[0] is OBp in component OBp (pM). * CONSTANTS[0] is OBp_t0 in component OBp (pM). * ALGEBRAIC[49] is OBp_in in component OBp (flux). * ALGEBRAIC[9] is OBp_out in component OBp (flux). * CONSTANTS[1] is OBu_t0 in component model_parameters (pM). * CONSTANTS[77] is DifferOBpNormal in component OBp (first_order_rate_constant). * CONSTANTS[2] is D_OBp_t0 in component model_parameters (first_order_rate_constant). * CONSTANTS[3] is TGFbNormal in component OBp (pM). * CONSTANTS[4] is KD_TGF_beta_repress in component model_parameters (pM). * CONSTANTS[81] is ProlifOBpNormal in component OBp (first_order_rate_constant). * CONSTANTS[5] is frac_prolifOBp_vs_differOBu in component OBp (dimensionless). * CONSTANTS[6] is OBpNormal in component OBp (pM). * CONSTANTS[7] is OBp_sat in component OBp (pM). * CONSTANTS[86] is DifferOBu in component OBp (first_order_rate_constant). * ALGEBRAIC[1] is ProlifOBp in component OBp (first_order_rate_constant). * CONSTANTS[8] is D_OBu_t0 in component model_parameters (first_order_rate_constant). * CONSTANTS[9] is pd_OBp_t0 in component model_parameters (flux). * CONSTANTS[82] is Pi_TGFbeta_OBu_act_t0 in component TGF_beta (dimensionless). * ALGEBRAIC[8] is Pi_TGFbeta_OBp_rep in component TGF_beta (dimensionless). * ALGEBRAIC[46] is Pi_WNT in component Wnt (dimensionless). * CONSTANTS[112] is Pi_WNT_0 in component Wnt (dimensionless). * STATES[1] is OBa in component OBa (pM). * ALGEBRAIC[10] is OBa_in in component OBa (flux). * ALGEBRAIC[2] is OBa_out in component OBa (flux). * CONSTANTS[10] is pd_OBa_t0 in component model_parameters (flux). * CONSTANTS[11] is D_OBa_t0 in component model_parameters (first_order_rate_constant). * CONSTANTS[12] is A_OBa_t0 in component model_parameters (first_order_rate_constant). * STATES[2] is OCp in component OCp (pM). * ALGEBRAIC[52] is OCp_in in component OCp (flux). * ALGEBRAIC[47] is OCp_out in component OCp (flux). * CONSTANTS[13] is OCu_t0 in component model_parameters (pM). * ALGEBRAIC[44] is Pi_RANKL_act_OCp in component RANK_RANKL_OPG (dimensionless). * ALGEBRAIC[50] is Pi_RANKL_act_OCu in component RANK_RANKL_OPG (dimensionless). * CONSTANTS[14] is D_OCu_t0 in component model_parameters (first_order_rate_constant). * CONSTANTS[15] is pd_OCp_t0 in component model_parameters (flux). * CONSTANTS[16] is D_OCp_t0 in component model_parameters (first_order_rate_constant). * STATES[3] is OCa in component OCa (pM). * ALGEBRAIC[51] is OCa_in in component OCa (flux). * ALGEBRAIC[7] is OCa_out in component OCa (flux). * CONSTANTS[17] is pd_OCa_t0 in component model_parameters (flux). * CONSTANTS[18] is A_OCa_t0 in component model_parameters (first_order_rate_constant). * ALGEBRAIC[5] is Pi_TGFbeta_OCa_act in component TGF_beta (dimensionless). * STATES[4] is fbm in component fbm (dimensionless). * CONSTANTS[19] is K_form in component model_parameters (second_order_rate_constant). * CONSTANTS[20] is K_res in component model_parameters (second_order_rate_constant). * ALGEBRAIC[0] is dfbmdt in component fbm (first_order_rate_constant). * STATES[5] is OCY in component OCY (pM). * ALGEBRAIC[3] is OCY_act in component OCY (pM). * CONSTANTS[79] is OCY_act_0 in component OCY (pM). * CONSTANTS[21] is fact_0 in component model_parameters (pM). * STATES[6] is vm in component vm (dimensionless). * CONSTANTS[22] is XKAPPA in component model_parameters (first_order_rate_constant). * CONSTANTS[23] is vmmax in component model_parameters (dimensionless). * CONSTANTS[80] is PTH_tot in component PTH (pM). * CONSTANTS[83] is Pi_PTH_act in component PTH (dimensionless). * CONSTANTS[84] is Pi_PTH_rep in component PTH (dimensionless). * CONSTANTS[24] is Beta_PTH in component model_parameters (flux). * CONSTANTS[25] is P_PTH_d in component model_parameters (flux). * CONSTANTS[26] is Deg_PTH in component model_parameters (first_order_rate_constant). * CONSTANTS[27] is KD_PTH_act in component model_parameters (pM). * CONSTANTS[28] is KD_PTH_rep in component model_parameters (pM). * ALGEBRAIC[36] is RANK in component RANK_RANKL_OPG (pM). * ALGEBRAIC[37] is RANKL in component RANK_RANKL_OPG (pM). * ALGEBRAIC[38] is OPG in component RANK_RANKL_OPG (pM). * ALGEBRAIC[39] is RANKL_tot in component RANK_RANKL_OPG (pM). * CONSTANTS[85] is RANKL_max in component RANK_RANKL_OPG (pM). * ALGEBRAIC[40] is P_RANKL1 in component RANK_RANKL_OPG (flux). * ALGEBRAIC[41] is P_RANKL2 in component RANK_RANKL_OPG (flux). * ALGEBRAIC[42] is P_RANKL in component RANK_RANKL_OPG (flux). * CONSTANTS[29] is P_RANKL_d in component model_parameters (flux). * ALGEBRAIC[34] is Pi_NO_PTH_act_rep in component NO_PTH (dimensionless). * CONSTANTS[30] is N_RANK_OCp in component model_parameters (dimensionless). * CONSTANTS[31] is N_RANKL_OBp_max in component model_parameters (dimensionless). * CONSTANTS[32] is K_RANK_RANKL in component model_parameters (pM). * CONSTANTS[33] is Beta_OPG in component model_parameters (first_order_rate_constant). * CONSTANTS[34] is OPG_max in component model_parameters (pM). * CONSTANTS[35] is Deg_OPG in component model_parameters (first_order_rate_constant). * CONSTANTS[36] is Deg_OPG_RANKL in component model_parameters (first_order_rate_constant). * CONSTANTS[37] is K_OPG_RANKL in component model_parameters (pM). * CONSTANTS[38] is Beta_RANKL_OCY in component model_parameters (first_order_rate_constant). * CONSTANTS[39] is Beta_RANKL_OBp in component model_parameters (first_order_rate_constant). * CONSTANTS[40] is Deg_RANKL in component model_parameters (first_order_rate_constant). * CONSTANTS[41] is Deg_RANK_RANKL in component model_parameters (first_order_rate_constant). * CONSTANTS[42] is KD_RANKL_act_OCp in component model_parameters (pM). * CONSTANTS[43] is KD_RANKL_act_OCu in component model_parameters (pM). * ALGEBRAIC[4] is TGF_beta in component TGF_beta (pM). * CONSTANTS[78] is TGF_beta_t0 in component TGF_beta (pM). * CONSTANTS[44] is OCa_t0 in component TGF_beta (pM). * CONSTANTS[45] is Alpha in component model_parameters (dimensionless). * CONSTANTS[46] is KD_TGF_beta_activate in component model_parameters (pM). * ALGEBRAIC[6] is Pi_TGFbeta_OBu_act in component TGF_beta (dimensionless). * ALGEBRAIC[45] is Scl in component Scl (pM). * CONSTANTS[111] is Scl_0 in component Scl (pM). * ALGEBRAIC[48] is P_Scl_b in component Scl (flux). * CONSTANTS[113] is P_Scl_b_0 in component Scl (flux). * ALGEBRAIC[33] is A in component Scl (second_order_rate_constant). * CONSTANTS[108] is A_0 in component Scl (second_order_rate_constant). * ALGEBRAIC[35] is B in component Scl (first_order_rate_constant). * CONSTANTS[109] is B_0 in component Scl (first_order_rate_constant). * ALGEBRAIC[43] is C in component Scl (flux). * CONSTANTS[110] is C_0 in component Scl (flux). * ALGEBRAIC[31] is OCYprod in component Scl (flux). * CONSTANTS[107] is OCYprod_0 in component Scl (flux). * CONSTANTS[89] is Wnt in component Wnt (pM). * CONSTANTS[47] is Wnt_0 in component model_parameters (pM). * ALGEBRAIC[29] is Pi_eps_rep in component SED (dimensionless). * CONSTANTS[106] is Pi_eps_rep_stst in component SED (dimensionless). * CONSTANTS[87] is Beta_Scl in component Scl (first_order_rate_constant). * CONSTANTS[48] is Beta_Scl_0 in component model_parameters (first_order_rate_constant). * CONSTANTS[49] is KD_SclLRP5 in component model_parameters (pM). * CONSTANTS[50] is Deg_Scl in component model_parameters (first_order_rate_constant). * CONSTANTS[51] is Scl_max in component model_parameters (pM). * CONSTANTS[52] is KD_WntLRP5 in component model_parameters (pM). * CONSTANTS[53] is Deg_SclLRP5 in component model_parameters (first_order_rate_constant). * CONSTANTS[54] is LRP5perCell in component model_parameters (dimensionless). * ALGEBRAIC[11] is LRP5tot in component Scl (pM). * CONSTANTS[88] is LRP5tot_0 in component Scl (pM). * CONSTANTS[55] is P_Scl_d in component model_parameters (flux). * CONSTANTS[90] is PTH_tot in component NO_PTH (pM). * ALGEBRAIC[30] is NO_tot in component NO_PTH (pM). * CONSTANTS[103] is NO_eq in component NO_PTH (pM). * CONSTANTS[91] is Beta_NO in component NO_PTH (first_order_rate_constant). * CONSTANTS[56] is Beta_NO_0 in component model_parameters (first_order_rate_constant). * CONSTANTS[57] is P_NO_d in component model_parameters (flux). * CONSTANTS[58] is Deg_NO in component model_parameters (first_order_rate_constant). * ALGEBRAIC[28] is Pi_eps_act in component SED (dimensionless). * CONSTANTS[102] is Pi_eps_act_stst in component SED (dimensionless). * CONSTANTS[59] is NO_max in component model_parameters (pM). * CONSTANTS[104] is KD_rep_NO in component NO_PTH (pM). * CONSTANTS[60] is aa in component NO_PTH (dimensionless). * CONSTANTS[92] is Pi_PTH_act in component NO_PTH (dimensionless). * ALGEBRAIC[32] is Pi_NO_rep in component NO_PTH (dimensionless). * CONSTANTS[61] is lambda_s in component model_parameters (dimensionless). * CONSTANTS[62] is lambda_c in component model_parameters (dimensionless). * ALGEBRAIC[26] is SED in component SED (MPa). * ALGEBRAIC[27] is SED_bm in component SED (MPa). * CONSTANTS[63] is sig_macro_t0 in component model_parameters (MPa). * CONSTANTS[64] is de_sig_macro in component model_parameters (MPa). * CONSTANTS[98] is sig_macro in component SED (MPa). * CONSTANTS[93] is sig_1 in component SED (MPa). * CONSTANTS[94] is sig_2 in component SED (MPa). * CONSTANTS[99] is sig_3 in component SED (MPa). * CONSTANTS[95] is sig_4 in component SED (MPa). * CONSTANTS[96] is sig_5 in component SED (MPa). * CONSTANTS[97] is sig_6 in component SED (MPa). * ALGEBRAIC[20] is eps_1 in component SED (dimensionless). * ALGEBRAIC[21] is eps_2 in component SED (dimensionless). * ALGEBRAIC[22] is eps_3 in component SED (dimensionless). * ALGEBRAIC[23] is eps_4 in component SED (dimensionless). * ALGEBRAIC[24] is eps_5 in component SED (dimensionless). * ALGEBRAIC[25] is eps_6 in component SED (dimensionless). * ALGEBRAIC[12] is dens_tis in component SED (g_per_cm3). * CONSTANTS[65] is vo in component model_parameters (dimensionless). * CONSTANTS[66] is rho_m in component model_parameters (g_per_cm3). * CONSTANTS[67] is rho_o in component model_parameters (g_per_cm3). * ALGEBRAIC[13] is fvas in component SED (dimensionless). * ALGEBRAIC[14] is dens in component SED (g_per_cm3). * ALGEBRAIC[15] is dens_1 in component SED (dimensionless). * ALGEBRAIC[16] is E_mod in component SED (MPa). * CONSTANTS[68] is nu in component model_parameters (dimensionless). * ALGEBRAIC[17] is S_11 in component SED (per_MPa). * ALGEBRAIC[18] is S_12 in component SED (per_MPa). * ALGEBRAIC[19] is S_44 in component SED (per_MPa). * CONSTANTS[69] is omega in component model_parameters (dimensionless). * CONSTANTS[100] is valeq in component SED (dimensionless). * CONSTANTS[70] is taueq in component model_parameters (MPa). * CONSTANTS[71] is alphaAct in component model_parameters (dimensionless). * CONSTANTS[72] is alphaRep in component model_parameters (dimensionless). * CONSTANTS[73] is gammaAct in component model_parameters (dimensionless). * CONSTANTS[74] is gammaRep in component model_parameters (dimensionless). * CONSTANTS[75] is rhoAct in component model_parameters (dimensionless). * CONSTANTS[76] is rhoRep in component model_parameters (dimensionless). * CONSTANTS[101] is deltaAct in component SED (MPa). * CONSTANTS[105] is deltaRep in component SED (MPa). * RATES[0] is d/dt OBp in component OBp (pM). * RATES[1] is d/dt OBa in component OBa (pM). * RATES[2] is d/dt OCp in component OCp (pM). * RATES[3] is d/dt OCa in component OCa (pM). * RATES[4] is d/dt fbm in component fbm (dimensionless). * RATES[5] is d/dt OCY in component OCY (pM). * RATES[6] is d/dt vm in component vm (dimensionless). */ void initConsts(double* CONSTANTS, double* RATES, double *STATES) { STATES[0] = 1.1631869976e-03; CONSTANTS[0] = 1.1631869976e-03; CONSTANTS[1] = 0.01; CONSTANTS[2] = 0.185; CONSTANTS[3] = 0.0001; CONSTANTS[4] = 0.000175426051821094; CONSTANTS[5] = 0.5; CONSTANTS[6] = 0.001; CONSTANTS[7] = 0.005; CONSTANTS[8] = 0.166; CONSTANTS[9] = 0; STATES[1] = 9.1880026722e-04; CONSTANTS[10] = 0; CONSTANTS[11] = 0.0212; CONSTANTS[12] = 0.1908; STATES[2] = 1.3556879825e-03; CONSTANTS[13] = 0.01; CONSTANTS[14] = 0.0219; CONSTANTS[15] = 0; CONSTANTS[16] = 0.01958; STATES[3] = 1.8376005344e-05; CONSTANTS[17] = 0; CONSTANTS[18] = 10; STATES[4] = 15; CONSTANTS[19] = 50; CONSTANTS[20] = 2500; STATES[5] = 1.2734398187e-02; CONSTANTS[21] = 0.000414138; STATES[6] = 3.5893417161e-01; CONSTANTS[22] = 0.007; CONSTANTS[23] = 0.516; CONSTANTS[24] = 250; CONSTANTS[25] = 0; CONSTANTS[26] = 86; CONSTANTS[27] = 0.65; CONSTANTS[28] = 0.222581427709954; CONSTANTS[29] = 0; CONSTANTS[30] = 4160; CONSTANTS[31] = 2703476; CONSTANTS[32] = 10; CONSTANTS[33] = 162490033.783568; CONSTANTS[34] = 131.428571428571; CONSTANTS[35] = 532608.695652174; CONSTANTS[36] = 10.132471014805; CONSTANTS[37] = 0.0151142857142857; CONSTANTS[38] = 5660; CONSTANTS[39] = 23600; CONSTANTS[40] = 10.132471014805; CONSTANTS[41] = 10.132471014805; CONSTANTS[42] = 3.34; CONSTANTS[43] = 16.7; CONSTANTS[44] = 0.0001; CONSTANTS[45] = 1; CONSTANTS[46] = 0.000563278809675429; CONSTANTS[47] = 170; CONSTANTS[48] = 24000; CONSTANTS[49] = 10; CONSTANTS[50] = 1; CONSTANTS[51] = 70; CONSTANTS[52] = 1000; CONSTANTS[53] = 50; CONSTANTS[54] = 5; CONSTANTS[55] = 0; CONSTANTS[56] = 3440; CONSTANTS[57] = 0; CONSTANTS[58] = 0.0021; CONSTANTS[59] = 200000000; CONSTANTS[60] = 2; CONSTANTS[61] = 0.450454; CONSTANTS[62] = 0.900909; CONSTANTS[63] = -0.1457; CONSTANTS[64] = 0; CONSTANTS[65] = 0.428571428571428; CONSTANTS[66] = 3.2; CONSTANTS[67] = 1.41; CONSTANTS[68] = 0.3; CONSTANTS[69] = 0.95; CONSTANTS[70] = 0.006652; CONSTANTS[71] = 1; CONSTANTS[72] = 1; CONSTANTS[73] = 7; CONSTANTS[74] = 8.01559; CONSTANTS[75] = 0; CONSTANTS[76] = 0; CONSTANTS[77] = ( CONSTANTS[2]*1.00000)/(1.00000+CONSTANTS[3]/CONSTANTS[4]); CONSTANTS[78] = CONSTANTS[45]*CONSTANTS[44]; CONSTANTS[79] = CONSTANTS[21]*20.0000; CONSTANTS[80] = (CONSTANTS[24]+CONSTANTS[25])/CONSTANTS[26]; CONSTANTS[81] = ( CONSTANTS[5]*CONSTANTS[77])/(1.00000 - CONSTANTS[6]/CONSTANTS[7]); CONSTANTS[82] = CONSTANTS[78]/(CONSTANTS[46]+CONSTANTS[78]); CONSTANTS[83] = CONSTANTS[80]/(CONSTANTS[80]+CONSTANTS[27]); CONSTANTS[84] = 1.00000/(1.00000+CONSTANTS[80]/CONSTANTS[28]); CONSTANTS[85] = CONSTANTS[31]*CONSTANTS[0]; CONSTANTS[86] = (1.00000 - CONSTANTS[5])*CONSTANTS[8]*CONSTANTS[82]; CONSTANTS[87] = CONSTANTS[48]; CONSTANTS[88] = CONSTANTS[54]*CONSTANTS[0]; CONSTANTS[89] = CONSTANTS[47]; CONSTANTS[90] = (CONSTANTS[24]+CONSTANTS[25])/CONSTANTS[26]; CONSTANTS[91] = CONSTANTS[56]; CONSTANTS[92] = CONSTANTS[90]/(CONSTANTS[90]+CONSTANTS[27]); CONSTANTS[93] = 0.00000; CONSTANTS[94] = 0.00000; CONSTANTS[95] = 0.00000; CONSTANTS[96] = 0.00000; CONSTANTS[97] = 0.00000; CONSTANTS[98] = CONSTANTS[63]+CONSTANTS[64]; CONSTANTS[99] = CONSTANTS[98]; CONSTANTS[100] = CONSTANTS[69]; CONSTANTS[101] = CONSTANTS[70]*pow((CONSTANTS[71] - CONSTANTS[100])/(CONSTANTS[100] - CONSTANTS[75]), 1.00000/CONSTANTS[73]); CONSTANTS[102] = CONSTANTS[75]+( (CONSTANTS[71] - CONSTANTS[75])*pow(CONSTANTS[70], CONSTANTS[73]))/(pow(CONSTANTS[101], CONSTANTS[73])+pow(CONSTANTS[70], CONSTANTS[73])); CONSTANTS[103] = ( CONSTANTS[56]*CONSTANTS[102]*CONSTANTS[79])/(CONSTANTS[58]+( CONSTANTS[56]*CONSTANTS[102]*CONSTANTS[79])/CONSTANTS[59]); CONSTANTS[104] = CONSTANTS[103]/CONSTANTS[60]; CONSTANTS[105] = CONSTANTS[70]*pow((CONSTANTS[100] - CONSTANTS[76])/(CONSTANTS[72] - CONSTANTS[100]), 1.00000/CONSTANTS[74]); CONSTANTS[106] = CONSTANTS[72] - ( (CONSTANTS[72] - CONSTANTS[76])*pow(CONSTANTS[70], CONSTANTS[74]))/(pow(CONSTANTS[105], CONSTANTS[74])+pow(CONSTANTS[70], CONSTANTS[74])); CONSTANTS[107] = CONSTANTS[48]*CONSTANTS[79]*CONSTANTS[106]; CONSTANTS[108] = (1.00000/CONSTANTS[49])*(CONSTANTS[50]+CONSTANTS[107]/CONSTANTS[51]); CONSTANTS[109] = ( CONSTANTS[108]*CONSTANTS[49]*(1.00000+CONSTANTS[47]/CONSTANTS[52])+( CONSTANTS[53]*CONSTANTS[88])/CONSTANTS[49]) - (CONSTANTS[55]+CONSTANTS[107])/CONSTANTS[49]; CONSTANTS[110] = - (CONSTANTS[55]+CONSTANTS[107])*(1.00000+CONSTANTS[47]/CONSTANTS[52]); CONSTANTS[111] = (- CONSTANTS[109]+ pow((pow(CONSTANTS[109], 2.00000) - 4.00000*CONSTANTS[108]*CONSTANTS[110]), 1.0 / 2))/( 2.00000*CONSTANTS[108]); CONSTANTS[112] = CONSTANTS[47]/( CONSTANTS[52]*(1.00000+CONSTANTS[47]/CONSTANTS[52]+CONSTANTS[111]/CONSTANTS[49])); CONSTANTS[113] = CONSTANTS[107]*(1.00000 - CONSTANTS[111]/CONSTANTS[51]); } void computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { RATES[6] = CONSTANTS[22]*(CONSTANTS[23] - STATES[6]) - ( STATES[6]*CONSTANTS[19]*STATES[1])/STATES[4]; ALGEBRAIC[0] = CONSTANTS[19]*STATES[1] - CONSTANTS[20]*STATES[3]; RATES[4] = ALGEBRAIC[0]; RATES[5] = CONSTANTS[21]*ALGEBRAIC[0]; ALGEBRAIC[4] = CONSTANTS[45]*STATES[3]; ALGEBRAIC[8] = 1.00000/(1.00000+ALGEBRAIC[4]/CONSTANTS[4]); ALGEBRAIC[9] = CONSTANTS[2]*ALGEBRAIC[8]*STATES[0]; ALGEBRAIC[10] = ALGEBRAIC[9]+CONSTANTS[10]; ALGEBRAIC[2] = (CONSTANTS[11]+CONSTANTS[12])*STATES[1]; RATES[1] = ALGEBRAIC[10] - ALGEBRAIC[2]; ALGEBRAIC[1] = CONSTANTS[81]*(1.00000 - STATES[0]/CONSTANTS[7]); ALGEBRAIC[3] = CONSTANTS[21]*STATES[4]; ALGEBRAIC[12] = 1.00000+ (CONSTANTS[66] - 1.00000)*STATES[6]+ (CONSTANTS[67] - 1.00000)*CONSTANTS[65]; ALGEBRAIC[14] = ( ALGEBRAIC[12]*STATES[4])/100.000; ALGEBRAIC[15] = ALGEBRAIC[14]/1.00000; ALGEBRAIC[16] = (ALGEBRAIC[15]<1.20000 ? 2014.00*pow(ALGEBRAIC[15], 2.50000) : 1763.00*pow(ALGEBRAIC[15], 3.20000)); ALGEBRAIC[17] = 1.00000/ALGEBRAIC[16]; ALGEBRAIC[18] = - CONSTANTS[68]/ALGEBRAIC[16]; ALGEBRAIC[20] = ALGEBRAIC[17]*CONSTANTS[93]+ ALGEBRAIC[18]*CONSTANTS[94]+ ALGEBRAIC[18]*CONSTANTS[99]; ALGEBRAIC[21] = ALGEBRAIC[18]*CONSTANTS[93]+ ALGEBRAIC[17]*CONSTANTS[94]+ ALGEBRAIC[18]*CONSTANTS[99]; ALGEBRAIC[22] = ALGEBRAIC[18]*CONSTANTS[93]+ ALGEBRAIC[18]*CONSTANTS[94]+ ALGEBRAIC[17]*CONSTANTS[99]; ALGEBRAIC[19] = (2.00000+ 2.00000*CONSTANTS[68])/ALGEBRAIC[16]; ALGEBRAIC[23] = ALGEBRAIC[19]*CONSTANTS[95]; ALGEBRAIC[24] = ALGEBRAIC[19]*CONSTANTS[96]; ALGEBRAIC[25] = ALGEBRAIC[19]*CONSTANTS[97]; ALGEBRAIC[26] = 0.500000*( CONSTANTS[93]*ALGEBRAIC[20]+ CONSTANTS[94]*ALGEBRAIC[21]+ CONSTANTS[99]*ALGEBRAIC[22]+ CONSTANTS[95]*ALGEBRAIC[23]+ CONSTANTS[96]*ALGEBRAIC[24]+ CONSTANTS[97]*ALGEBRAIC[25]); ALGEBRAIC[13] = 1.00000 - STATES[4]/100.000; ALGEBRAIC[27] = ALGEBRAIC[26]/pow(1.00000 - ALGEBRAIC[13], 2.00000); ALGEBRAIC[29] = CONSTANTS[72] - ( (CONSTANTS[72] - CONSTANTS[76])*pow(ALGEBRAIC[27], CONSTANTS[74]))/(pow(CONSTANTS[105], CONSTANTS[74])+pow(ALGEBRAIC[27], CONSTANTS[74])); ALGEBRAIC[31] = CONSTANTS[87]*ALGEBRAIC[3]*ALGEBRAIC[29]; ALGEBRAIC[33] = (1.00000/CONSTANTS[49])*(CONSTANTS[50]+ALGEBRAIC[31]/CONSTANTS[51]); ALGEBRAIC[11] = CONSTANTS[54]*STATES[0]; ALGEBRAIC[35] = ( ALGEBRAIC[33]*CONSTANTS[49]*(1.00000+CONSTANTS[89]/CONSTANTS[52])+( CONSTANTS[53]*ALGEBRAIC[11])/CONSTANTS[49]) - (CONSTANTS[55]+ALGEBRAIC[31])/CONSTANTS[49]; ALGEBRAIC[43] = - (CONSTANTS[55]+ALGEBRAIC[31])*(1.00000+CONSTANTS[89]/CONSTANTS[52]); ALGEBRAIC[45] = (- ALGEBRAIC[35]+ pow((pow(ALGEBRAIC[35], 2.00000) - 4.00000*ALGEBRAIC[33]*ALGEBRAIC[43]), 1.0 / 2))/( 2.00000*ALGEBRAIC[33]); ALGEBRAIC[46] = CONSTANTS[89]/( CONSTANTS[52]*(1.00000+CONSTANTS[89]/CONSTANTS[52]+ALGEBRAIC[45]/CONSTANTS[49])); ALGEBRAIC[49] = CONSTANTS[86]*CONSTANTS[1]+( ALGEBRAIC[1]*STATES[0]*ALGEBRAIC[46])/CONSTANTS[112]+CONSTANTS[9]; RATES[0] = ALGEBRAIC[49] - ALGEBRAIC[9]; ALGEBRAIC[28] = CONSTANTS[75]+( (CONSTANTS[71] - CONSTANTS[75])*pow(ALGEBRAIC[27], CONSTANTS[73]))/(pow(CONSTANTS[101], CONSTANTS[73])+pow(ALGEBRAIC[27], CONSTANTS[73])); ALGEBRAIC[30] = ( CONSTANTS[91]*ALGEBRAIC[28]*ALGEBRAIC[3]+CONSTANTS[57])/(CONSTANTS[58]+( CONSTANTS[91]*ALGEBRAIC[28]*ALGEBRAIC[3])/CONSTANTS[59]); ALGEBRAIC[32] = 1.00000/(1.00000+ALGEBRAIC[30]/CONSTANTS[104]); ALGEBRAIC[34] = CONSTANTS[61]*(CONSTANTS[92]+ALGEBRAIC[32])+ CONSTANTS[62]*CONSTANTS[92]*ALGEBRAIC[32]; rootfind_0(VOI, CONSTANTS, RATES, STATES, ALGEBRAIC, pret); ALGEBRAIC[44] = ALGEBRAIC[37]/(CONSTANTS[42]+ALGEBRAIC[37]); ALGEBRAIC[47] = CONSTANTS[16]*ALGEBRAIC[44]*STATES[2]; ALGEBRAIC[51] = ALGEBRAIC[47]+CONSTANTS[17]; ALGEBRAIC[5] = ALGEBRAIC[4]/(CONSTANTS[46]+ALGEBRAIC[4]); ALGEBRAIC[7] = CONSTANTS[18]*ALGEBRAIC[5]*STATES[3]; RATES[3] = ALGEBRAIC[51] - ALGEBRAIC[7]; ALGEBRAIC[50] = ALGEBRAIC[37]/(CONSTANTS[43]+ALGEBRAIC[37]); ALGEBRAIC[52] = CONSTANTS[14]*CONSTANTS[13]*ALGEBRAIC[50]+CONSTANTS[15]; RATES[2] = ALGEBRAIC[52] - ALGEBRAIC[47]; } void computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC) { ALGEBRAIC[0] = CONSTANTS[19]*STATES[1] - CONSTANTS[20]*STATES[3]; ALGEBRAIC[4] = CONSTANTS[45]*STATES[3]; ALGEBRAIC[8] = 1.00000/(1.00000+ALGEBRAIC[4]/CONSTANTS[4]); ALGEBRAIC[9] = CONSTANTS[2]*ALGEBRAIC[8]*STATES[0]; ALGEBRAIC[10] = ALGEBRAIC[9]+CONSTANTS[10]; ALGEBRAIC[2] = (CONSTANTS[11]+CONSTANTS[12])*STATES[1]; ALGEBRAIC[1] = CONSTANTS[81]*(1.00000 - STATES[0]/CONSTANTS[7]); ALGEBRAIC[3] = CONSTANTS[21]*STATES[4]; ALGEBRAIC[12] = 1.00000+ (CONSTANTS[66] - 1.00000)*STATES[6]+ (CONSTANTS[67] - 1.00000)*CONSTANTS[65]; ALGEBRAIC[14] = ( ALGEBRAIC[12]*STATES[4])/100.000; ALGEBRAIC[15] = ALGEBRAIC[14]/1.00000; ALGEBRAIC[16] = (ALGEBRAIC[15]<1.20000 ? 2014.00*pow(ALGEBRAIC[15], 2.50000) : 1763.00*pow(ALGEBRAIC[15], 3.20000)); ALGEBRAIC[17] = 1.00000/ALGEBRAIC[16]; ALGEBRAIC[18] = - CONSTANTS[68]/ALGEBRAIC[16]; ALGEBRAIC[20] = ALGEBRAIC[17]*CONSTANTS[93]+ ALGEBRAIC[18]*CONSTANTS[94]+ ALGEBRAIC[18]*CONSTANTS[99]; ALGEBRAIC[21] = ALGEBRAIC[18]*CONSTANTS[93]+ ALGEBRAIC[17]*CONSTANTS[94]+ ALGEBRAIC[18]*CONSTANTS[99]; ALGEBRAIC[22] = ALGEBRAIC[18]*CONSTANTS[93]+ ALGEBRAIC[18]*CONSTANTS[94]+ ALGEBRAIC[17]*CONSTANTS[99]; ALGEBRAIC[19] = (2.00000+ 2.00000*CONSTANTS[68])/ALGEBRAIC[16]; ALGEBRAIC[23] = ALGEBRAIC[19]*CONSTANTS[95]; ALGEBRAIC[24] = ALGEBRAIC[19]*CONSTANTS[96]; ALGEBRAIC[25] = ALGEBRAIC[19]*CONSTANTS[97]; ALGEBRAIC[26] = 0.500000*( CONSTANTS[93]*ALGEBRAIC[20]+ CONSTANTS[94]*ALGEBRAIC[21]+ CONSTANTS[99]*ALGEBRAIC[22]+ CONSTANTS[95]*ALGEBRAIC[23]+ CONSTANTS[96]*ALGEBRAIC[24]+ CONSTANTS[97]*ALGEBRAIC[25]); ALGEBRAIC[13] = 1.00000 - STATES[4]/100.000; ALGEBRAIC[27] = ALGEBRAIC[26]/pow(1.00000 - ALGEBRAIC[13], 2.00000); ALGEBRAIC[29] = CONSTANTS[72] - ( (CONSTANTS[72] - CONSTANTS[76])*pow(ALGEBRAIC[27], CONSTANTS[74]))/(pow(CONSTANTS[105], CONSTANTS[74])+pow(ALGEBRAIC[27], CONSTANTS[74])); ALGEBRAIC[31] = CONSTANTS[87]*ALGEBRAIC[3]*ALGEBRAIC[29]; ALGEBRAIC[33] = (1.00000/CONSTANTS[49])*(CONSTANTS[50]+ALGEBRAIC[31]/CONSTANTS[51]); ALGEBRAIC[11] = CONSTANTS[54]*STATES[0]; ALGEBRAIC[35] = ( ALGEBRAIC[33]*CONSTANTS[49]*(1.00000+CONSTANTS[89]/CONSTANTS[52])+( CONSTANTS[53]*ALGEBRAIC[11])/CONSTANTS[49]) - (CONSTANTS[55]+ALGEBRAIC[31])/CONSTANTS[49]; ALGEBRAIC[43] = - (CONSTANTS[55]+ALGEBRAIC[31])*(1.00000+CONSTANTS[89]/CONSTANTS[52]); ALGEBRAIC[45] = (- ALGEBRAIC[35]+ pow((pow(ALGEBRAIC[35], 2.00000) - 4.00000*ALGEBRAIC[33]*ALGEBRAIC[43]), 1.0 / 2))/( 2.00000*ALGEBRAIC[33]); ALGEBRAIC[46] = CONSTANTS[89]/( CONSTANTS[52]*(1.00000+CONSTANTS[89]/CONSTANTS[52]+ALGEBRAIC[45]/CONSTANTS[49])); ALGEBRAIC[49] = CONSTANTS[86]*CONSTANTS[1]+( ALGEBRAIC[1]*STATES[0]*ALGEBRAIC[46])/CONSTANTS[112]+CONSTANTS[9]; ALGEBRAIC[28] = CONSTANTS[75]+( (CONSTANTS[71] - CONSTANTS[75])*pow(ALGEBRAIC[27], CONSTANTS[73]))/(pow(CONSTANTS[101], CONSTANTS[73])+pow(ALGEBRAIC[27], CONSTANTS[73])); ALGEBRAIC[30] = ( CONSTANTS[91]*ALGEBRAIC[28]*ALGEBRAIC[3]+CONSTANTS[57])/(CONSTANTS[58]+( CONSTANTS[91]*ALGEBRAIC[28]*ALGEBRAIC[3])/CONSTANTS[59]); ALGEBRAIC[32] = 1.00000/(1.00000+ALGEBRAIC[30]/CONSTANTS[104]); ALGEBRAIC[34] = CONSTANTS[61]*(CONSTANTS[92]+ALGEBRAIC[32])+ CONSTANTS[62]*CONSTANTS[92]*ALGEBRAIC[32]; ALGEBRAIC[44] = ALGEBRAIC[37]/(CONSTANTS[42]+ALGEBRAIC[37]); ALGEBRAIC[47] = CONSTANTS[16]*ALGEBRAIC[44]*STATES[2]; ALGEBRAIC[51] = ALGEBRAIC[47]+CONSTANTS[17]; ALGEBRAIC[5] = ALGEBRAIC[4]/(CONSTANTS[46]+ALGEBRAIC[4]); ALGEBRAIC[7] = CONSTANTS[18]*ALGEBRAIC[5]*STATES[3]; ALGEBRAIC[50] = ALGEBRAIC[37]/(CONSTANTS[43]+ALGEBRAIC[37]); ALGEBRAIC[52] = CONSTANTS[14]*CONSTANTS[13]*ALGEBRAIC[50]+CONSTANTS[15]; ALGEBRAIC[6] = ALGEBRAIC[4]/(CONSTANTS[46]+ALGEBRAIC[4]); ALGEBRAIC[48] = ALGEBRAIC[31]*(1.00000 - ALGEBRAIC[45]/CONSTANTS[51]); } void objfunc_0(double *p, double *hx, int m, int n, void *adata) { struct rootfind_info* rfi = (struct rootfind_info*)adata; #define VOI rfi->aVOI #define CONSTANTS rfi->aCONSTANTS #define RATES rfi->aRATES #define STATES rfi->aSTATES #define ALGEBRAIC rfi->aALGEBRAIC #define pret rfi->aPRET ALGEBRAIC[36] = p[0]; ALGEBRAIC[37] = p[1]; ALGEBRAIC[38] = p[2]; ALGEBRAIC[39] = p[3]; ALGEBRAIC[40] = p[4]; ALGEBRAIC[41] = p[5]; ALGEBRAIC[42] = p[6]; hx[0] = ALGEBRAIC[36] - ( CONSTANTS[30]*STATES[2])/(1.00000+ (1.00000/CONSTANTS[32])*ALGEBRAIC[37]); hx[1] = ALGEBRAIC[38] - ( CONSTANTS[33]*CONSTANTS[84]*STATES[1])/(( CONSTANTS[33]*CONSTANTS[84]*STATES[1])/CONSTANTS[34]+CONSTANTS[35]+ (CONSTANTS[36]/CONSTANTS[37])*ALGEBRAIC[37]); hx[2] = ALGEBRAIC[39] - ALGEBRAIC[37]*(1.00000+ALGEBRAIC[36]/CONSTANTS[32]+ALGEBRAIC[38]/CONSTANTS[37]); hx[3] = ALGEBRAIC[40] - CONSTANTS[38]*(1.00000 - ALGEBRAIC[39]/CONSTANTS[85])*ALGEBRAIC[3]; hx[4] = ALGEBRAIC[41] - CONSTANTS[39]*ALGEBRAIC[34]*(1.00000 - ALGEBRAIC[39]/CONSTANTS[85])*STATES[0]; hx[5] = ALGEBRAIC[42] - (ALGEBRAIC[40]+ALGEBRAIC[41]); hx[6] = ALGEBRAIC[37] - (ALGEBRAIC[42]+CONSTANTS[29])/(CONSTANTS[40]+ (CONSTANTS[41]/CONSTANTS[32])*ALGEBRAIC[36]+ (CONSTANTS[36]/CONSTANTS[37])*ALGEBRAIC[38]); #undef VOI #undef CONSTANTS #undef RATES #undef STATES #undef ALGEBRAIC #undef pret } void rootfind_0(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC, int* pret) { static double p[7] = {0.1,0.1,0.1,0.1,0.1,0.1,0.1}; double bp[7], work[LM_DIF_WORKSZ(7, 7)]; struct rootfind_info rfi; rfi.aVOI = VOI; rfi.aCONSTANTS = CONSTANTS; rfi.aRATES = RATES; rfi.aSTATES = STATES; rfi.aALGEBRAIC = ALGEBRAIC; rfi.aPRET = pret; do_levmar(objfunc_0, p, bp, work, pret, 7, &rfi); ALGEBRAIC[36] = p[0]; ALGEBRAIC[37] = p[1]; ALGEBRAIC[38] = p[2]; ALGEBRAIC[39] = p[3]; ALGEBRAIC[40] = p[4]; ALGEBRAIC[41] = p[5]; ALGEBRAIC[42] = p[6]; }