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 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[8] 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[5] 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[16] is O in component O (dimensionless).
 * ALGEBRAIC[10] is alpha in component rate_constants (per_ms).
 * ALGEBRAIC[12] is alpha_ in component rate_constants (per_ms).
 * ALGEBRAIC[14] is beta in component rate_constants (per_ms).
 * ALGEBRAIC[17] is beta_ in component rate_constants (per_ms).
 * ALGEBRAIC[20] 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[2] is C_G in component O (dimensionless).
 * CONSTANTS[16] is Cm in component membrane_post (uF_per_cm2).
 * ALGEBRAIC[3] is i_syn in component synaptic_current (uA_per_cm2).
 * ALGEBRAIC[15] is i_Na_post in component sodium_current_post (uA_per_cm2).
 * ALGEBRAIC[18] is i_K_post in component potassium_current_post (uA_per_cm2).
 * ALGEBRAIC[6] 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[13] is x_infinity in component sodium_current_post (dimensionless).
 * ALGEBRAIC[9] is alpha_x in component sodium_current_post (dimensionless).
 * ALGEBRAIC[11] is beta_x in component sodium_current_post (dimensionless).
 * STATES[10] is n_post in component potassium_current_n_gate_post (dimensionless).
 * ALGEBRAIC[4] is alpha_n in component potassium_current_n_gate_post (per_ms).
 * ALGEBRAIC[7] 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).
 */
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;
}
void
computeRates(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[5]*STATES[0];
RATES[2] =  CONSTANTS[11]*ALGEBRAIC[0]*(1.00000 - STATES[2]) -  CONSTANTS[12]*STATES[2];
ALGEBRAIC[4] = ( 0.0200000*(STATES[1]+55.0000))/(1.00000 - exp(- (STATES[1]+55.0000)/10.0000));
ALGEBRAIC[7] =  0.250000*exp(- (STATES[1]+65.0000)/80.0000);
RATES[10] =  ALGEBRAIC[4]*(1.00000 - STATES[10]) -  ALGEBRAIC[7]*STATES[10];
ALGEBRAIC[16] = ((((((1.00000 - STATES[3]) - STATES[4]) - STATES[6]) - STATES[8]) - STATES[5]) - STATES[7]) - STATES[9];
ALGEBRAIC[10] =  0.450000*exp(STATES[1]/22.0000);
ALGEBRAIC[14] =  0.0150000*exp(- STATES[1]/14.0000);
RATES[8] = ( 2.00000*ALGEBRAIC[10]*STATES[6]+ 4.00000*ALGEBRAIC[14]*ALGEBRAIC[16]) -  STATES[8]*( 3.00000*ALGEBRAIC[14]+ALGEBRAIC[10]);
ALGEBRAIC[3] =  CONSTANTS[17]*STATES[2]*(STATES[1] - CONSTANTS[18]);
ALGEBRAIC[9] = ( 0.200000*(STATES[1]+40.0000))/(1.00000 -  1.00000*exp(- (STATES[1]+40.0000)/10.0000));
ALGEBRAIC[11] =  8.00000*exp(1.00000/- (STATES[1]+65.0000/18.0000));
ALGEBRAIC[13] = ALGEBRAIC[9]/(ALGEBRAIC[9]+ALGEBRAIC[11]);
ALGEBRAIC[15] =  120.000*pow(ALGEBRAIC[13], 3.00000)*(1.00000 - STATES[10])*(STATES[1] - 120.000);
ALGEBRAIC[18] =  36.0000*pow(STATES[10], 4.00000)*(STATES[1]+77.0000);
ALGEBRAIC[6] =  0.300000*(STATES[1]+54.0000);
RATES[1] = - (ALGEBRAIC[15]+ALGEBRAIC[18]+ALGEBRAIC[6]+ALGEBRAIC[3])/CONSTANTS[16];
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[5] =  - 5.18200*ALGEBRAIC[1];
ALGEBRAIC[8] = ALGEBRAIC[5]/( 2.00000*CONSTANTS[7]*CONSTANTS[8]* 3.14159265358979);
ALGEBRAIC[19] =  ALGEBRAIC[16]*ALGEBRAIC[8]+0.100000;
RATES[0] =  CONSTANTS[3]*ALGEBRAIC[19]*(1.00000 - STATES[0]) -  CONSTANTS[4]*STATES[0];
ALGEBRAIC[20] = ( 3.00000*STATES[2])/(680.000+ 320.000*STATES[2]);
RATES[3] = ( ALGEBRAIC[14]*STATES[4]+ CONSTANTS[13]*STATES[5]) -  STATES[3]*( 4.00000*ALGEBRAIC[10]+ALGEBRAIC[20]);
RATES[4] = ( 4.00000*ALGEBRAIC[10]*STATES[3]+ 2.00000*ALGEBRAIC[14]*STATES[6]+ CONSTANTS[14]*STATES[7]) -  STATES[4]*(ALGEBRAIC[14]+ 3.00000*ALGEBRAIC[10]+ALGEBRAIC[20]);
RATES[6] = ( 3.00000*ALGEBRAIC[10]*STATES[4]+ 3.00000*ALGEBRAIC[14]*STATES[8]+ CONSTANTS[15]*STATES[9]) -  STATES[6]*( 2.00000*ALGEBRAIC[14]+ 2.00000*ALGEBRAIC[10]+ALGEBRAIC[20]);
ALGEBRAIC[12] = ALGEBRAIC[10]/8.00000;
ALGEBRAIC[17] =  ALGEBRAIC[14]*8.00000;
RATES[5] = ( ALGEBRAIC[17]*STATES[7]+ ALGEBRAIC[20]*STATES[3]) -  STATES[5]*( 4.00000*ALGEBRAIC[12]+CONSTANTS[13]);
RATES[7] = ( 4.00000*ALGEBRAIC[12]*STATES[5]+ 2.00000*ALGEBRAIC[17]*STATES[9]+ ALGEBRAIC[20]*STATES[4]) -  STATES[7]*(ALGEBRAIC[17]+ 3.00000*ALGEBRAIC[12]+CONSTANTS[14]);
RATES[9] = ( 3.00000*ALGEBRAIC[12]*STATES[7]+ ALGEBRAIC[20]*STATES[6]) -  STATES[9]*( 2.00000*ALGEBRAIC[17]+CONSTANTS[15]);
}
void
computeVariables(double VOI, double* CONSTANTS, double* RATES, double* STATES, double* ALGEBRAIC)
{
ALGEBRAIC[0] =  CONSTANTS[5]*STATES[0];
ALGEBRAIC[4] = ( 0.0200000*(STATES[1]+55.0000))/(1.00000 - exp(- (STATES[1]+55.0000)/10.0000));
ALGEBRAIC[7] =  0.250000*exp(- (STATES[1]+65.0000)/80.0000);
ALGEBRAIC[16] = ((((((1.00000 - STATES[3]) - STATES[4]) - STATES[6]) - STATES[8]) - STATES[5]) - STATES[7]) - STATES[9];
ALGEBRAIC[10] =  0.450000*exp(STATES[1]/22.0000);
ALGEBRAIC[14] =  0.0150000*exp(- STATES[1]/14.0000);
ALGEBRAIC[3] =  CONSTANTS[17]*STATES[2]*(STATES[1] - CONSTANTS[18]);
ALGEBRAIC[9] = ( 0.200000*(STATES[1]+40.0000))/(1.00000 -  1.00000*exp(- (STATES[1]+40.0000)/10.0000));
ALGEBRAIC[11] =  8.00000*exp(1.00000/- (STATES[1]+65.0000/18.0000));
ALGEBRAIC[13] = ALGEBRAIC[9]/(ALGEBRAIC[9]+ALGEBRAIC[11]);
ALGEBRAIC[15] =  120.000*pow(ALGEBRAIC[13], 3.00000)*(1.00000 - STATES[10])*(STATES[1] - 120.000);
ALGEBRAIC[18] =  36.0000*pow(STATES[10], 4.00000)*(STATES[1]+77.0000);
ALGEBRAIC[6] =  0.300000*(STATES[1]+54.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[5] =  - 5.18200*ALGEBRAIC[1];
ALGEBRAIC[8] = ALGEBRAIC[5]/( 2.00000*CONSTANTS[7]*CONSTANTS[8]* 3.14159265358979);
ALGEBRAIC[19] =  ALGEBRAIC[16]*ALGEBRAIC[8]+0.100000;
ALGEBRAIC[20] = ( 3.00000*STATES[2])/(680.000+ 320.000*STATES[2]);
ALGEBRAIC[12] = ALGEBRAIC[10]/8.00000;
ALGEBRAIC[17] =  ALGEBRAIC[14]*8.00000;
ALGEBRAIC[2] = STATES[5]+STATES[7]+STATES[9];
}