|
Algorithm 3 RDME simulation algorithm using DFSP for diffusion and SSA for reactions
|
1: initialize system state: X, t=0 |
2: Calculate the propensity functions ajk(X) and {where M is the number of reactions and K is the number of voxels} |
3: Generate two random numbers r1,r2∊U(0,1) |
4:
|
5: tnext_diff←t+τD
|
6: whilet<tfinaldo
|
7: iftnext_rxn<tnext_diffthen
|
8: Find μr, μx smallest integers to satisfy
|
9: Update Xμx(tnext_rxn)=Xμx(t)+νμr
|
10: Generate two random numbers r1,r2∊U(0,1) |
11: t←tnext_rxn
|
12: else
|
13: Xnext←∅ |
14: fork∊(1…K) do
|
15: fori∊(1…N) do
|
16: Xnext←Xnext+DFSP_Diffusion(Xk,i) {diffusion of species i in voxel k} |
17: end for
|
18: end for
|
19: X←Xnext
|
20: t←tnext_diff
|
21: tnext_diff←t+τD
|
22: end if
|
23: Update propensity functions ajk(X) and
|
24:
|
25: end while
|