So far COPASI only supports the export of C source code, source code for other programming languages might follow if there is need for it.

The C source file COPASI exports is split into several smaller parts which are encapsulated in

` #ifdef`

structures for the C preprocessor. The file consists of ten such sections which can be included in other files by defining the corresponding preprocessor constants at the place of inclusion. Example:#define SIZE_DEFINITIONS #include "SOURCE FILE" #undef SIZE_DEFINITIONS

The file contains the following sections:

Name | Description |

SIZE_DEFINITIONS | Contains size definitions for the individual model elements, e.g. N_COMPARTMENTS for the number of compartments or N_REACTIONS for the number of reactions. All definitions are declared with preprocessor #define statements. |

SPECIES | Contains assignments for the species initial concentrations. The assignments are of the form y[INDEX]=VALUE where INDEX is the index of the species and VALUE is the initial concentration. This assumes that the including code has generated an array of double values of size N_METABS called y. N_METABS is part of the SIZE_DEFINITIONS section (see SIZE_DEFINITIONS above). |

INDEP_SPECIES | Contains assignments for the independent species initial concentrations. The assignments are of the form x[INDEX]=VALUE where INDEX is the index of the independent species and VALUE is the initial concentration. This assumes that the including code has generated an array of double values of size N_INDEP_METABS called x. N_INDEP_METABS is part of the SIZE_DEFINITIONS section (see SIZE_DEFINITIONS above). |

MOIETY | Contains assignments for the moieties. The assignments are of the form y[INDEX]=RSIDE where INDEX is the index of the species and RSIDE is the calculated value for the moiety, e.g. 0.2 - y[INDEX2]. y is the vector of species (see SPECIES above). |

COMPARTMENTS | Contains assignments for the compartments initial volumes. The assignments are of the form c[INDEX]=VALUE where INDEX is the index of the compartment and VALUE is the initial volume. This assumes that the including code has generated an array of double values of size N_COMPARTMENTS called c. N_COMPARTMENTS is part of the SIZE_DEFINITIONS section (see SIZE_DEFINITIONS above). |

GLOBAL_PARAMETERS | Contains assignments for the values of global kinetic parameters. The assignments are of the form gk[INDEX]=VALUE where INDEX is the index of the global parameter and VALUE is the value. This assumes that the including code has generated an array of double values of size N_GLOBAL_PARAMS called k. N_GLOBALPARAMS is part of the SIZE_DEFINITIONS section (see SIZE_DEFINITIONS above). |

KINETIC_PARAMETERS | Contains assignments for the values of local kinetic parameters. The assignments are of the form k[INDEX]=VALUE where INDEX is the index of the local parameter and VALUE is the value. This assumes that the including code has generated an array of double values of size N_KIN_PARAMS called k. N_KIN_PARAMS is part of the SIZE_DEFINITIONS section (see SIZE_DEFINITIONS above). |

KINETIC_FUNCTIONS_HEADER | This section contains the declarations of function definitions. The section has to be included before the function definitions section itself and before the differential equations section is included. |

KINETIC_FUNCTIONS | This section contains the implementation of the function definitions. |

DIFFERENTIAL_EQUATIONS | This section contains the set of differential equations. The result of the right hand side of each differential equation is stored in a variable dxdt[INDEX]. This assumes that the including program has created an array of double values called dxdt of size N_INDEP_METABS. N_INDEP_METABS is part of the SIZE_DEFINITIONS section (see SIZE_DEFINITIONS above). |

Warning: Some models may contains constants or functions that are not included in the ANSI C standard. In order to be able to use exported C source code files with those constants and functions, the user has to provide them, e.g. by including a separate header file that defines those constants and/or functions. Currently those are the constants for pi, Euler's number, TRUE, FALSE and infinity as well as the functions "asinh", "acosh", "atanh", "sec", "csc", "cot", "sech", "csch", "coth", "arcsec", "arccsc", "arccot", "asech", "acsch", "acoth", "factorial" and logical "xor".

In order to export the set of differential equations to a C source code file, you select the Export ODEs menu entry from COPASI's File menu. In the save dialog that shows up, you select