The program is separated logically into two main tasks. The first consists of reading and processing the differential equations, while the second consists of running the simulation. For the first part, stode takes as input a text file specifying the set of differential equations to be parsed, as well as the rate constants, reactants (with their initial concentrations) and other constants needed to determine the system. This file is lexically analysed into tokens and fed to a grammar which instantiates and assigns values to the various variables representing the reactants, constants and differential equations. Following this, stode reconstructs the reactions associated with the differential equations, and if necessary calculates the actual particle numbers from the given reactant concentrations.
The second task is that of performing the simulation. This is done according to Gillespie's algorithm, whereby at each step, the probability of each reaction being the next is calculated. This is proportional to the number of participating reactants and the rate constant for that reaction. Two random numbers are then generated, which in association with these probabilities, allow the next reaction and the time at which it occurs to be chosen. The time and particle numbers are then updated, and the probabilities for the next step calculated.
The simulation proceeds in this way until a specified number of steps have been completed, or a specified total time has been reached. During the course of execution, the particle numbers and time for each step are written to a file.
The program may be run in stand-alone mode, or with a GUI front-end. Generally the latter is somewhat slower, as the GUI has some overhead, but allows the progress of the simulation to be viewed in real time, and allows fine-tweaking of the various parameters. For very long runs, the user will probably prefer to use the stand-alone version.
When the graphical user interface front end is invoked, the user may specify the file to be used as input, or may enter or modify the relevant data in the supplied editor window. The results of the processed input may then be examined before the simulation is begun. As mentioned above, the simulation results are displayed in real time in a plotting window, which in addition may be set to display results over the whole time frame or for a specifiable number of the most recent steps. As was the case for the stand-alone version, the results are written to a file as it is run. For both versions, a gnuplot command file is generated before exiting. This allows easy viewing of the results with gnuplot.