Forces

class tissue_forge.tissue_forge.Force

Force is a metatype, in that Tissue Forge has lots of different instances of force functions, that have different attributes, but only have one base type.

Forces are one of the fundamental processes in Tissue Forge that cause objects to move.

bind_species(a_type: ParticleType, coupling_symbol: std::string const &) HRESULT

Bind a force to a species.

When a force is bound to a species, the magnitude of the force is scaled by the concentration of the species.

Parameters:
  • a_type (ParticleType) – particle type containing the species

  • coupling_symbol (string) – symbol of the species

Return type:

int

Returns:

HRESULT

static berendsen_tstat(tau: FPTYPE const &) TissueForge::Berendsen *

Creates a Berendsen thermostat.

The thermostat uses the target temperature \(T_0\) from the object to which it is bound. The Berendsen thermostat effectively re-scales the velocities of an object in order to make the temperature of that family of objects match a specified temperature.

The Berendsen thermostat force has the function form:

\[\frac{\mathbf{p}}{\tau_T} \left(\frac{T_0}{T} - 1 \right),\]

where \(\mathbf{p}\) is the momentum, \(T\) is the measured temperature of a family of particles, \(T_0\) is the control temperature, and \(\tau_T\) is the coupling constant. The coupling constant is a measure of the time scale on which the thermostat operates, and has units of time. Smaller values of \(\tau_T\) result in a faster acting thermostat, and larger values result in a slower acting thermostat.

Parameters:

tau (float) – time constant that determines how rapidly the thermostat effects the system.

Return type:

Berendsen

Returns:

Berendsen*

static random(std: FPTYPE const &, mean: FPTYPE const &, duration: FPTYPE const & = 0.01) TissueForge::Gaussian *

Creates a random force.

A random force has a randomly selected orientation and magnitude.

Orientation is selected according to a uniform distribution on the unit sphere.

Magnitude is selected according to a prescribed mean and standard deviation.

Parameters:
  • std (float) – standard deviation of magnitude

  • mean (float) – mean of magnitude

  • duration (float) – duration of force. Defaults to 0.01.

Return type:

Gaussian

Returns:

Gaussian*

static friction(coef: FPTYPE const &) TissueForge::Friction *

Creates a friction force.

A friction force has the form:

\[- \frac{|| \mathbf{v} ||}{\tau} \mathbf{v} ,\]

where \(\mathbf{v}\) is the velocity of a particle and \(\tau\) is a time constant.

Parameters:

coef (float) – time constant

Return type:

Friction

Returns:

Friction*

toString() std::string

Get a JSON string representation

Return type:

string

Returns:

std::string

static fromString(str: std::string const &) TissueForge::Force *

Create from a JSON string representation

Parameters:

str (string) –

Return type:

Force

Returns:

Force*

__reduce__()

Helper for pickle.

class tissue_forge.tissue_forge._CustomForce(*args)

Bases: Force

A custom force function.

The force is updated according to an update frequency.

static fromForce(f: Force) TissueForge::CustomForce *

Convert basic force to CustomForce.

If the basic force is not a CustomForce, then NULL is returned.

Parameters:

f (Force) –

Return type:

CustomForce

Returns:

CustomForce*

class tissue_forge.tissue_forge.CustomForce(*args)

Bases: _CustomForce

Creates an instance from an underlying custom python function

Parameters:
  • f (PyObject) – python function. Takes no arguments and returns a three-component vector.

  • period (float) – period at which the force is updated.

property value

Current value of the force.

This can be set to a function that takes no arguments and returns a 3-component list of floats.

property period

Period of the force

static fromForce(f: Force) TissueForge::py::CustomForcePy *

Convert basic force to CustomForcePy.

If the basic force is not a CustomForcePy, then NULL is returned.

Parameters:

f (Force) –

Return type:

CustomForcePy

Returns:

CustomForcePy*

class tissue_forge.tissue_forge.ForceSum

Bases: Force

f1
f2
static fromForce(f: Force) TissueForge::ForceSum *

Convert basic force to force sum.

If the basic force is not a force sum, then NULL is returned.

Parameters:

f (Force) –

Return type:

ForceSum

Returns:

ForceSum*

class tissue_forge.tissue_forge.Berendsen

Bases: Force

Berendsen force.

Create one with Force.berendsen_tstat.

itau

time constant

static fromForce(f: Force) TissueForge::Berendsen *

Convert basic force to Berendsen.

If the basic force is not a Berendsen, then NULL is returned.

Parameters:

f (Force) –

Return type:

Berendsen

Returns:

Berendsen*

class tissue_forge.tissue_forge.Gaussian

Bases: Force

Random force.

Create one with Force.random.

std

standard deviation of magnitude

mean

mean of magnitude

durration_steps

duration of force.

static fromForce(f: Force) TissueForge::Gaussian *

Convert basic force to Gaussian.

If the basic force is not a Gaussian, then NULL is returned.

Parameters:

f (Force) –

Return type:

Gaussian

Returns:

Gaussian*

class tissue_forge.tissue_forge.Friction

Bases: Force

Friction force.

Create one with Force.friction.

coef

time constant

static fromForce(f: Force) TissueForge::Friction *

Convert basic force to Friction.

If the basic force is not a Friction, then NULL is returned.

Parameters:

f (Force) –

Return type:

Friction

Returns:

Friction*