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()

Executes the simulation and returns a CellContainer.

class AgentSettings(**kwds)

Bases: object

Contains settings needed to specify properties of the RodAgent

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.

n_vertices

Number of vertices to use for this agent

spring_length_threshold

Threshold when the bacterium divides

class Configuration(**kwds)

Bases: object

Contains all settings needed to configure the simulation

static from_json(json_string)

Deserializes this struct from a json 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_agents

Number of agents to put into the simulation. Depending on the size specified, this number may be lowered artificially to account for the required space.

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/.

randomize_position

Determines the amount with which positions should be randomized. Should be a value between 0.0 and 1.0.

rng_seed

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

save_interval

Interval in which results will be saved

show_progressbar

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

t0

Starting time

t_max

Maximum solving time

class RodAgent(pos, vel, diffusion_constant=0.0, spring_tension=1.0, rigidity=2.0, spring_length=3.0, damping=1.0, radius=3.0, strength=0.1, potential_stiffness=0.5, cutoff=10.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
run_simulation(config, agent_settings)

Use the run_simulation_with_agents()

Executes the simulation with the given Configuration

Deprecated since version 0.4: Use the run_simulation_with_agents() function instead.

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.