Simulation

This module contains functionality to configure and run simulations.

Define Agent Properties

AgentSettings

A template for defining an agent.

RodMechanicsSettings

Defines properties of to the RodMechanics struct.

MorsePotentialF32

Define interaction properties of the agent.

Running a Simulation

Configuration

Bundles all information required for a simulation.

run_simulation_with_agents()

Executes the simulation and returns a CellContainer.

class AgentSettings(**kwds)

Bases: object

Contains settings needed to specify properties of the RodAgent

to_rod_agent_dict()

Converts the class to a dictionary

growth_rate

Rate with which the length of the bacterium grows

interaction

Settings for the interaction part of RodAgent. See also MorsePotentialF32.

mechanics

Settings for the mechanics part of RodAgent. See also RodMechanicsSettings.

spring_length_threshold

Threshold when the bacterium divides

class Configuration(**kwds)

Bases: object

Contains all settings needed to configure the simulation

static deserialize(data)

TODO

static from_json(json_string)

Deserializes this struct from a json string

static from_toml(filename)

Parses the content of a given toml file and returns a Configuration object which contains the given values. See also from_toml_string().

static from_toml_string(toml_string)

Parses the contents of a given string and returns a Configuration. See also from_toml_string().

to_hash()

Attempts to create a hash from the contents of this Configuration. Warning: This feature is experimental.

to_json()

Serializes this struct to the json format

domain_height

We assume that the domain is a thin 3D slice. This specifies the height of the domain.

domain_size

Overall domain size of the simulation. This may determine an upper bound on the number of agents which can be put into the simulation.

dt

Time increment

n_saves

Interval in which results will be saved

n_threads

Number of threads used for solving the system.

n_voxels

Number of voxels used to solve the system. This may yield performance improvements but specifying a too high number will yield incorrect results. See also https://cellular-raza.com/internals/concepts/domain/decomposition/.

rng_seed

Initial seed for randomizations. This can be useful to run multiple simulations with identical parameters but slightly varying initial conditions.

show_progressbar

Specifies if a progress bar should be shown during the solving process.

t0

Starting time

t_max

Maximum solving time

class PhysicalInteraction(pyobject)

Bases: object

Describes all possible interaction variants

inner()

Extracts a copy of the inner value

class RodAgent(pos, vel, interaction, diffusion_constant=0.0, spring_tension=1.0, rigidity=2.0, spring_length=3.0, damping=1.0, growth_rate=0.1, spring_length_threshold=6.0)

Bases: object

A basic cell-agent which makes use of RodMechanics

growth_rate

Rate with which the cell grows in units 1/MIN.

pos

Position of the agent given by a matrix containing all vertices in order.

radius

The interaction radius as given by the [MorsePotentialF32] interaction struct.

spring_length_threshold

Threshold at which the cell will divide in units MICROMETRE.

vel

Velocity of the agent given by a matrix containing all velocities at vertices in order.

class RodMechanicsSettings

Bases: object

Contains all settings required to construct RodMechanics

damping

Damping constant

diffusion_constant

Controls magnitude of32 stochastic motion

pos
rigidity

Stif32fness at each joint connecting two edges

spring_length

Target spring length

spring_tension

Spring tension between individual vertices

vel
generate_positions_old(n_agents, agent_settings, config, rng_seed=0, dx=0.0, randomize_positions=0.0, n_vertices=8)

Creates positions for multiple :class`RodAgent`s which can be used for simulation purposes.

run_simulation_with_agents(config, agents)

Executes a simulation given a Configuration and a list of RodAgent.

sort_cellular_identifiers(identifiers)

Sorts an iterator of CellIdentifier deterministically.

This function is usefull for generating identical masks every simulation run. This function is implemented as standalone since sorting of a CellIdentifier is typically not supported.

Parameters:

identifiers (list) – A list of CellIdentifier

Returns:

The sorted list.

Return type:

list

class MorsePotentialF32

Famous Morse potential for diatomic molecules. See the documentation at cellular_raza-building_blocks::MorsePotentialF32.

class MiePotentialF32

See documentation at cellular_raza-building_blocks::MorsePotentialF32.