public class GillespieSimple extends StochasticSimulator
For reference see Daniel T. Gillespie., A General Method for Numerically Simulating the Stochastic Time Evolution of Coupled Chemical Reactions, J.Comp.Phys. 22, 403 (1976)
Modifier and Type | Field and Description |
---|---|
private boolean |
changed |
private static RNG |
GENERATOR |
reverseTime
Constructor and Description |
---|
GillespieSimple(AmountManager amountManager,
TransitionKernel transitionKernel)
Implementation of Gillespie's Direct method.
|
GillespieSimple(AmountManager amountManager,
TransitionKernel transitionKernel,
boolean reverseTime)
Implementation of Gillespie's Direct method.
|
Modifier and Type | Method and Description |
---|---|
private double |
calculateRTotal()
Calculate the h's described in (14) page 413 and the sum a (26) page 418.
|
private SimulationEvent |
directMCReaction()
obtains a random (but following a specific distribution) reaction as described by the direct method in chapter 5A
page 417ff.
|
protected double |
directMCTau(double sum)
obtains a random (but following a specific distribution) timestep as described by the direct method in chapter 5A
page 417ff.
|
String |
getName()
Gets the name of the algorithm.
|
private boolean |
isThetaEventInCurrentStep(double tau)
Determine of there is a theta event in the current time step, taking into account possible reverse time jumps.
|
void |
performStep()
Performs one simulation step.
|
void |
reinitialize()
Reset propensities when a event has been executed.
|
void |
setRngSeed(int seed)
Seed the RNG if required.
|
addObserver, doEvent, doEvent, doThetaEvent, getDefaultObserver, getNextThetaEventTime, init, registerNewTheta, run, run
private boolean changed
private static final RNG GENERATOR
public GillespieSimple(AmountManager amountManager, TransitionKernel transitionKernel)
amountManager
- the amount manager used in the simulator.transitionKernel
- the transition kernel to be used with the stochastic solver.public GillespieSimple(AmountManager amountManager, TransitionKernel transitionKernel, boolean reverseTime)
amountManager
- the amount manager used in the simulator.transitionKernel
- the transition kernel to be used with the stochastic solver.reverseTime
- true if we wish to go backwards in time.public final void reinitialize()
StochasticSimulator
reinitialize
in class StochasticSimulator
public final void performStep()
StochasticSimulator
Simulator#setAmount(int, long)
and Simulator#setVolume(double)
if they need correct values!performStep
in class StochasticSimulator
private double calculateRTotal()
private boolean isThetaEventInCurrentStep(double tau)
tau
- the time interval (will be negative for reverse time).public final String getName()
StochasticSimulator
getName
in class StochasticSimulator
public final void setRngSeed(int seed)
StochasticSimulator
setRngSeed
in class StochasticSimulator
seed
- the RNG seed.private SimulationEvent directMCReaction()
protected final double directMCTau(double sum)
sum
- sum of the propensitiesCopyright © 2015 University of Glasgow. All rights reserved.