Table 3

â€¢ Initialize all species and rate constants

â€¢ Compute all reaction rates

â€¢ Loop:

â€ƒâ€ƒâ€ƒ* Set Î¼ = sum of rates for the discrete reactions

â€ƒâ€ƒâ€ƒ* if (p t = Î¼Î”t > Îµ), use Gillespie algorithm:

* R = a uniform random number in (0,1)

* Set timeStep = -log(R)/Î¼

* Find which reaction occurred, update the species involved

â€ƒâ€ƒâ€ƒ* else, use small Î”t approximation:

* R = a uniform random number in [0,1]

* timeStep = continuousTimeStep

* if (R <p t = Î¼ Ã— timeStep), discrete transition has occurred:

â€¢ Determine which discrete transition occurred:

â€¢ Find the first value of k for which

â€¢ If , the forward reaction occurred, otherwise the backward reaction occurred

* else, no discrete transition:

â€¢ No discrete reaction occurs, update is entirely due to continuous reactions (below)

* end if (small Î”t method, determination if discrete transition occurred)

â€ƒâ€ƒâ€ƒ* end if (selection of Gillespie or small Î”t method for discrete reactions)

â€ƒâ€ƒâ€ƒ* Update the continuous species using the Langevin equation, with step size timeStep (where timeStep is either equal to continuousTimeStep or to the step size found by the Gillespie algorithm), using a semi-implicit numerical method

â€ƒâ€ƒâ€ƒ* Update any rates that have been changed by the continuous reactions and the single discrete reaction

â€ƒâ€ƒâ€ƒ* Break when user-defined total simulation time is reached

â€¢ end loop