In [1]:
from jLM.units import *
from jLM.LMLogger import *
from jLM.RDME import Sim as RDMESim
from jLM.RegionBuilder import RegionBuilder
import logging
In [2]:
outputFile = "MichaelisMenten.lm"
In [3]:
setLMLogConsole(logging.WARNING)
In [4]:
latticeSpacing = nm(4500 / 64.0)
In [5]:
m_size = micron(4.5, 4.5, 4.5)
lx, ly, lz = [int(round(cDim / latticeSpacing)) for cDim in m_size]
In [6]:
# Create our simulation object
sim = RDMESim("MichaelisMenten Example",
              outputFile,
              [lx, ly, lz],
              latticeSpacing,
              "default",
              "Byte",
              ms(1))
In [7]:
B = RegionBuilder(sim)
default = B.box(lx, ly, lz)
In [8]:
B.compose(
    (sim.region('default'), default)
)
In [9]:
with sim.construct():
    sim.species('E',  texRepr = 'E',  annotation = "Species E")
    sim.species('S',  texRepr = 'S',  annotation = "Species S")
    sim.species('P',  texRepr = 'P',  annotation = "Species P")
    sim.species('ES', texRepr = 'ES', annotation = "Species ES")
New Species
Index Name Annotation
1 E Species E
2 S Species S
3 P Species P
4 ES Species ES
In [10]:
with sim.construct():
    sim.diffusionConst("dRate", 1e-12, texRepr = r'd_{Rate}', annotation = 'Default Diffusion Rate')
New diffusion constants
Index Name Value Annotation
0 $$d_{Rate}$$ 1.000 × 10-12 m2⋅s-1  Default Diffusion Rate
In [11]:
dc = sim.dc

with sim.construct():
    sim.transitionRate(None, None, None, dc.dRate)
In [12]:
with sim.construct():
    sim.rateConst('Rate1', 1e0,     order = 1, annotation = "First Order Reaction Rate")
    sim.rateConst('Rate2', 1.07e-4, order = 2, annotation = "Second Order Reaction Rate")
New reaction rates
Index Name Value Annotation
0 $$k_{\mathrm{Rate1}}$$ 1.000 s-1  First Order Reaction Rate
1 $$k_{\mathrm{Rate2}}$$ 1.070 × 10-4 M-1⋅s-1  Second Order Reaction Rate
In [13]:
sp  = sim.sp
rc  = sim.rc
reg = sim.reg

with sim.construct():
    sim.reaction([sp.E, sp.S], [sp.ES], rc.Rate2, annotation = "Second Order Reaction", regions = [reg.default])
    sim.reaction([sp.ES], [sp.E, sp.S], rc.Rate1, annotation = "First Order Reaction1", regions = [reg.default])
    sim.reaction([sp.ES], [sp.E, sp.P], rc.Rate1, annotation = "First Order Reaction2", regions = [reg.default])
New reactions
Index Reaction Rate Regions Annotation
0 $$E + S\overset{k_{\mathrm{Rate2}}}{\longrightarrow}ES$$ 1.070 × 10-4 M-1⋅s-1  default Second Order Reaction
1 $$ES\overset{k_{\mathrm{Rate1}}}{\longrightarrow}E + S$$ 1.000 s-1  default First Order Reaction1
2 $$ES\overset{k_{\mathrm{Rate1}}}{\longrightarrow}E + P$$ 1.000 s-1  default First Order Reaction2
In [14]:
with sim.construct():
    sim.distributeNumber(sp.E,  reg.default, 909)
    sim.distributeNumber(sp.S,  reg.default, 9091)
    sim.distributeNumber(sp.P,  reg.default, 0)
    sim.distributeNumber(sp.ES, reg.default, 0)
In [15]:
sim.simulationTime = 10.0

write_interval = 0.01
sim.latticeWriteInterval = int(write_interval / sim.timestep)
sim.speciesWriteInterval = int(write_interval / sim.timestep)
In [16]:
sim.finalize()
nodiffregion in finalize: []
In [17]:
sim.run(solver = lm.MpdRdmeSolver(), cudaDevices = [0])
2025-09-02 15:33:02) Info: Using 32 processor(s) and 1 CUDA device(s) per process.
2025-09-02 15:33:02) Info: Assigning 1.00 processor(s) and 1.00 CUDA device(s) per replicate.
2025-09-02 15:33:02) Info: Data output thread running.
2025-09-02 15:33:02) Info: MPDRDME: Rng seed: top word 64093230, bottom word 1
2025-09-02 15:33:18) Info: Data output thread finished.
2025-09-02 15:33:18) Info: Simulation file closed.
Out[17]:

MichaelisMenten Example

Key

  • default

xy-plane; z-index=0

No description has been provided for this image
Simulation
Time step 1.000 × 103 µs
Simulation time 10.000 s
Lattice write interval 10.000 s
Particle count write interval 10.000 s
Number of replicates 1
Trajectory data
Replicate Simulated time Lattice times Count times Initial count Final count
0000001 10.000 s 1001 1001 10000 10000
Lattice
Dimensions 64 × 64 × 64
Particles per site 16
Bytes per particle 1
Lattice spacing 70.312 nm
Subvolume size 3.476 × 10-4 fl
Model summary
Output file MichaelisMenten.lm
Number of species 4
Number of reactions 3
Number of region types 1
Number of rate constants 2
Number of diffusion constants 1
Number of placed particles 0
Region summary
Region Subvolumes Volume Particles Concentration Occupancy
default 262144 91.125 fl 10000 0.182 µM $0.24\,\%$