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 21 entries in the algebraic variable array.
   There are a total of 11 entries in each of the rate and state variable arrays.
   There are a total of 19 entries in the constant variable array.
 */
/*
 * VOI is time in component environment (ms).
 * CONSTANTS[0] is R_gas_const in component parameters (millijoule_per_mole_kelvin).
 * CONSTANTS[1] is Temp in component parameters (kelvin).
 * CONSTANTS[2] is F in component parameters (coulomb_per_mole).
 * STATES[0] is R in component transmitter_release (dimensionless).
 * CONSTANTS[3] is kr_plus in component transmitter_release (per_uM_per_ms).
 * CONSTANTS[4] is kr_minus in component transmitter_release (per_ms).
 * ALGEBRAIC[19] is Ca in component calcium_concentration (uM).
 * ALGEBRAIC[0] is T in component transmitter_release (uM).
 * CONSTANTS[5] is T_bar in component transmitter_release (uM).
 * CONSTANTS[6] is Ca_ex in component calcium_concentration (uM).
 * ALGEBRAIC[18] is Ca_open in component calcium_concentration (uM).
 * CONSTANTS[7] is Dc in component calcium_concentration (micrometre2_per_second).
 * CONSTANTS[8] is r in component calcium_concentration (nanometre).
 * ALGEBRAIC[16] is sigma in component calcium_concentration (uM_per_ms).
 * ALGEBRAIC[1] is i_V in component calcium_concentration (uA).
 * CONSTANTS[9] is g_Ca in component calcium_concentration (pS).
 * CONSTANTS[10] is P in component calcium_concentration (mV_per_uM).
 * STATES[1] is V_post in component membrane_post (mV).
 * ALGEBRAIC[7] is O in component O (dimensionless).
 * ALGEBRAIC[2] is alpha in component rate_constants (per_ms).
 * ALGEBRAIC[3] is alpha_ in component rate_constants (per_ms).
 * ALGEBRAIC[4] is beta in component rate_constants (per_ms).
 * ALGEBRAIC[5] is beta_ in component rate_constants (per_ms).
 * ALGEBRAIC[6] is kG_plus in component rate_constants (per_ms).
 * STATES[2] is b in component rate_constants (dimensionless).
 * CONSTANTS[11] is kb_plus in component rate_constants (per_uM_per_ms).
 * CONSTANTS[12] is kb_minus in component rate_constants (per_ms).
 * CONSTANTS[13] is kG_minus in component rate_constants (per_ms).
 * CONSTANTS[14] is kG2_minus in component rate_constants (per_ms).
 * CONSTANTS[15] is kG3_minus in component rate_constants (per_ms).
 * STATES[3] is C1 in component C1 (dimensionless).
 * STATES[4] is C2 in component C2 (dimensionless).
 * STATES[5] is C_G1 in component C_G1 (dimensionless).
 * STATES[6] is C3 in component C3 (dimensionless).
 * STATES[7] is C_G2 in component C_G2 (dimensionless).
 * STATES[8] is C4 in component C4 (dimensionless).
 * STATES[9] is C_G3 in component C_G3 (dimensionless).
 * ALGEBRAIC[8] is C_G in component O (dimensionless).
 * CONSTANTS[16] is Cm in component membrane_post (uF_per_cm2).
 * ALGEBRAIC[9] is i_syn in component synaptic_current (uA_per_cm2).
 * ALGEBRAIC[20] is i_Na_post in component sodium_current_post (uA_per_cm2).
 * ALGEBRAIC[13] is i_K_post in component potassium_current_post (uA_per_cm2).
 * ALGEBRAIC[10] is i_leak_post in component leak_current_post (uA_per_cm2).
 * CONSTANTS[17] is g_syn in component synaptic_current (mS_per_cm2).
 * CONSTANTS[18] is V_syn in component synaptic_current (mV).
 * ALGEBRAIC[17] is x_infinity in component sodium_current_post (dimensionless).
 * ALGEBRAIC[11] is alpha_x in component sodium_current_post (dimensionless).
 * ALGEBRAIC[12] is beta_x in component sodium_current_post (dimensionless).
 * STATES[10] is n_post in component potassium_current_n_gate_post (dimensionless).
 * ALGEBRAIC[14] is alpha_n in component potassium_current_n_gate_post (per_ms).
 * ALGEBRAIC[15] is beta_n in component potassium_current_n_gate_post (per_ms).
 * RATES[0] is d/dt R in component transmitter_release (dimensionless).
 * RATES[2] is d/dt b in component rate_constants (dimensionless).
 * RATES[3] is d/dt C1 in component C1 (dimensionless).
 * RATES[4] is d/dt C2 in component C2 (dimensionless).
 * RATES[6] is d/dt C3 in component C3 (dimensionless).
 * RATES[8] is d/dt C4 in component C4 (dimensionless).
 * RATES[5] is d/dt C_G1 in component C_G1 (dimensionless).
 * RATES[7] is d/dt C_G2 in component C_G2 (dimensionless).
 * RATES[9] is d/dt C_G3 in component C_G3 (dimensionless).
 * RATES[1] is d/dt V_post in component membrane_post (mV).
 * RATES[10] is d/dt n_post in component potassium_current_n_gate_post (dimensionless).
 * There are a total of 0 condition variables.
 */
void
initConsts(double* CONSTANTS, double* RATES, double *STATES)
{
CONSTANTS[0] = 8314.41;
CONSTANTS[1] = 310;
CONSTANTS[2] = 96485;
STATES[0] = 0;
CONSTANTS[3] = 0.15;
CONSTANTS[4] = 2.5;
CONSTANTS[5] = 4000.0;
CONSTANTS[6] = 2000.0;
CONSTANTS[7] = 220;
CONSTANTS[8] = 10;
CONSTANTS[9] = 1.2;
CONSTANTS[10] = 0.006;
STATES[1] = -65;
STATES[2] = 0;
CONSTANTS[11] = 2000.0;
CONSTANTS[12] = 1.0;
CONSTANTS[13] = 0.00025;
CONSTANTS[14] = 0.016;
CONSTANTS[15] = 1.024;
STATES[3] = 1;
STATES[4] = 0;
STATES[5] = 0;
STATES[6] = 0;
STATES[7] = 0;
STATES[8] = 0;
STATES[9] = 0;
CONSTANTS[16] = 1.0;
CONSTANTS[17] = 0.2;
CONSTANTS[18] = 0;
STATES[10] = 0;
RATES[0] = 0.1001;
RATES[2] = 0.1001;
RATES[3] = 0.1001;
RATES[4] = 0.1001;
RATES[6] = 0.1001;
RATES[8] = 0.1001;
RATES[5] = 0.1001;
RATES[7] = 0.1001;
RATES[9] = 0.1001;
RATES[1] = 0.1001;
RATES[10] = 0.1001;
}
void
computeResiduals(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
                 double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
resid[0] = RATES[0] -  CONSTANTS[3]*ALGEBRAIC[19]*(1.00000 - STATES[0]) -  CONSTANTS[4]*STATES[0];
resid[1] = RATES[2] -  CONSTANTS[11]*ALGEBRAIC[0]*(1.00000 - STATES[2]) -  CONSTANTS[12]*STATES[2];
resid[2] = RATES[3] - ( ALGEBRAIC[4]*STATES[4]+ CONSTANTS[13]*STATES[5]) -  STATES[3]*( 4.00000*ALGEBRAIC[2]+ALGEBRAIC[6]);
resid[3] = RATES[4] - ( 4.00000*ALGEBRAIC[2]*STATES[3]+ 2.00000*ALGEBRAIC[4]*STATES[6]+ CONSTANTS[14]*STATES[7]) -  STATES[4]*(ALGEBRAIC[4]+ 3.00000*ALGEBRAIC[2]+ALGEBRAIC[6]);
resid[4] = RATES[6] - ( 3.00000*ALGEBRAIC[2]*STATES[4]+ 3.00000*ALGEBRAIC[4]*STATES[8]+ CONSTANTS[15]*STATES[9]) -  STATES[6]*( 2.00000*ALGEBRAIC[4]+ 2.00000*ALGEBRAIC[2]+ALGEBRAIC[6]);
resid[5] = RATES[8] - ( 2.00000*ALGEBRAIC[2]*STATES[6]+ 4.00000*ALGEBRAIC[4]*ALGEBRAIC[7]) -  STATES[8]*( 3.00000*ALGEBRAIC[4]+ALGEBRAIC[2]);
resid[6] = RATES[5] - ( ALGEBRAIC[5]*STATES[7]+ ALGEBRAIC[6]*STATES[3]) -  STATES[5]*( 4.00000*ALGEBRAIC[3]+CONSTANTS[13]);
resid[7] = RATES[7] - ( 4.00000*ALGEBRAIC[3]*STATES[5]+ 2.00000*ALGEBRAIC[5]*STATES[9]+ ALGEBRAIC[6]*STATES[4]) -  STATES[7]*(ALGEBRAIC[5]+ 3.00000*ALGEBRAIC[3]+CONSTANTS[14]);
resid[8] = RATES[9] - ( 3.00000*ALGEBRAIC[3]*STATES[7]+ ALGEBRAIC[6]*STATES[6]) -  STATES[9]*( 2.00000*ALGEBRAIC[5]+CONSTANTS[15]);
resid[9] = RATES[1] - - (ALGEBRAIC[20]+ALGEBRAIC[13]+ALGEBRAIC[10]+ALGEBRAIC[9])/CONSTANTS[16];
resid[10] = RATES[10] -  ALGEBRAIC[14]*(1.00000 - STATES[10]) -  ALGEBRAIC[15]*STATES[10];
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[8] = STATES[5]+STATES[7]+STATES[9];
}
void
computeEssentialVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[5]*STATES[0];
ALGEBRAIC[2] =  0.450000*exp(STATES[1]/22.0000);
ALGEBRAIC[3] = ALGEBRAIC[2]/8.00000;
ALGEBRAIC[4] =  0.0150000*exp(- STATES[1]/14.0000);
ALGEBRAIC[5] =  ALGEBRAIC[4]*8.00000;
ALGEBRAIC[6] = ( 3.00000*STATES[2])/(680.000+ 320.000*STATES[2]);
ALGEBRAIC[7] = ((((((1.00000 - STATES[3]) - STATES[4]) - STATES[6]) - STATES[8]) - STATES[5]) - STATES[7]) - STATES[9];
ALGEBRAIC[9] =  CONSTANTS[17]*STATES[2]*(STATES[1] - CONSTANTS[18]);
ALGEBRAIC[10] =  0.300000*(STATES[1]+54.0000);
ALGEBRAIC[13] =  36.0000*pow(STATES[10], 4.00000)*(STATES[1]+77.0000);
ALGEBRAIC[14] = ( 0.0200000*(STATES[1]+55.0000))/(1.00000 - exp(- (STATES[1]+55.0000)/10.0000));
ALGEBRAIC[15] =  0.250000*exp(- (STATES[1]+65.0000)/80.0000);
ALGEBRAIC[1] = ( (( CONSTANTS[9]*CONSTANTS[10]*2.00000*CONSTANTS[2]*STATES[1])/( CONSTANTS[0]*CONSTANTS[1]))*CONSTANTS[6])/(1.00000 - exp(( 2.00000*CONSTANTS[2]*STATES[1])/( CONSTANTS[0]*CONSTANTS[1])));
ALGEBRAIC[16] =  - 5.18200*ALGEBRAIC[1];
ALGEBRAIC[18] = ALGEBRAIC[16]/( 2.00000*CONSTANTS[7]*CONSTANTS[8]* 3.14159265358979);
ALGEBRAIC[19] =  ALGEBRAIC[7]*ALGEBRAIC[18]+0.100000;
ALGEBRAIC[11] = ( 0.200000*(STATES[1]+40.0000))/(1.00000 -  1.00000*exp(- (STATES[1]+40.0000)/10.0000));
ALGEBRAIC[12] =  8.00000*exp(1.00000/- (STATES[1]+65.0000/18.0000));
ALGEBRAIC[17] = ALGEBRAIC[11]/(ALGEBRAIC[11]+ALGEBRAIC[12]);
ALGEBRAIC[20] =  120.000*pow(ALGEBRAIC[17], 3.00000)*(1.00000 - STATES[10])*(STATES[1] - 120.000);
}
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;
}
void
computeRoots(double VOI, double* CONSTANTS, double* RATES, double* OLDRATES, double* STATES,
             double* OLDSTATES, double* ALGEBRAIC, double* CONDVARS)
{
}