jLM.CME#

Well-stirred CME model

Functions

setLMLogConsole([level])

Set the logger to write to the console as the code is working

setLMLogFile(filename[, level])

Set up file handler to print log to file

setLMLoggerLevel(level)

Set the level of the logger for the application

Classes

CMESimulation([volume, name])

A constructor for the CMESimulation

tqdm(*_, **__)

Decorate an iterable object, returning an iterator which acts exactly like the original iterable, but prints a dynamically updating progressbar every time a value is requested.

class jLM.CME.CMESimulation(volume=None, name='unnamed')[source]#

Bases: object

A constructor for the CMESimulation

Parameters:
  • volume – The reaction vessel volume (in Litres). Specifying ‘None’ signifies that the user has already accounted for volume in rate constants.

  • name – The name of the CME simulation; Default: “unnamed”

Returns:

CMESimulation

addConcentration(species='unknown', conc=0.0)[source]#

Add a concentration of particles of the specified type to the simulation

Parameters:
  • species – The name of the specie to add

  • concentration – The concentration of the species (Molar). Particle count is rounded to nearest integer.

addParticles(species='unknown', count=1)[source]#

Add a specified number of particles of the specified type to the specified region

Parameters:
  • species – The name of the specie to add particles to

  • count – The number of that particle to start with (default 1)

addReaction(reactant, product, rate)[source]#

Adds a 0th, 1st or 2nd order reaction

Reaction rates are specified as stochastic rates: i.e. in units of \(1/\mathrm{s}\).

Parameters:
  • reactant – The list or reactants

  • product – The list of products

  • rate – The stochastic rate of reaction

buildReactionModel()[source]#

Return the Lattice Microbes ReactionModel object for fine-tuning

Returns:

The reaction model for the simulation

defineSpecies(species)[source]#

Define a species of particles that exist in the simulation

Parameters:

species – A list of species to add to the simulation

run(filename, method, replicates=1, seed=None, cudaDevices=None, checkpointInterval=0)[source]#

Run the simulation using the specified solver the specified amount of time

Parameters:
  • filename – The HDF file to write to

  • method – The class name for the solver to use (e.g., lm::cme::GillespieDSolver”)

  • replicates – The number of replicates to serially run

  • seed – A seed for the random number generator to use when running the simulation; None indicates default

runMPI(filename, method, replicates=1, driver='mpirun', ppe=1, seed=None)[source]#

Run the simulation using a call to mpirun with the given options

Parameters:
  • filename – The HDF file to write to

  • method – The class name for the solver to use (e.g. lm::cme::GillespieDSolver”)

  • replicates – The number of replicates to serially run

  • driver – The program to execute the parallel run, e.g. “mpirun”, “aprun”, “ibrun”, etc.

  • ppe – The number of processing elements to use (e.g. number of nodes)

  • seed – A seed for the random number generator to use when running the simulation; None indicates default

runSolver(filename, solver, replicates=1, cudaDevices=None, checkpointInterval=0)[source]#

Run a simulation with a given solver

Parameters:
  • filename – The HDF file to write to

  • solver – An MESolver object

  • replicates – The number of replicates to serially run

save(filename)[source]#

Create an HDF5 version of the simulation amenable for later running or stand-alone running

Parameters:

filename – The filename to save the simulation setup in

setHookInterval(time)[source]#

Set the simulation hook interval

Parameters:

time – Time length between hook calls

setRandomSeed(seed)[source]#

Set a known random seed

Parameters:

seed – Random seed

setSimulationTime(time)[source]#

Set the total simulation time

Parameters:

time – Time length of the simulation

setTimestep(time)[source]#

set the simulation time step :param time: The length of simulation timestep for CME

setWriteInterval(time)[source]#

Set the simulation state write-to-disk interval :param time: Time length between writes