Tissue Forge Library Python API Reference
This is the API Reference page for the module: tissue_forge
- tissue_forge.init(*args, **kwargs)
Initialize a simulation in Python
- Parameters
args (PyObject) – positional arguments; first argument is name of simulation (if any)
kwargs (PyObject) –
keyword arguments; currently supported are
dim: (3-component list of floats) the dimensions of the spatial domain; default is [10., 10., 10.]
cutoff: (float) simulation cutoff distance; default is 1.
cells: (3-component list of ints) the discretization of the spatial domain; default is [4, 4, 4]
threads: (int) number of threads; default is hardware maximum
integrator: (int) simulation integrator; default is FORWARD_EULER
dt: (float) time discretization; default is 0.01
bc: (int or dict) boundary conditions; default is everywhere periodic
window_size: (2-component list of ints) size of application window; default is [800, 600]
seed: (int) seed for pseudo-random number generator
load_file: (str) path to saved simulation state to initialize
logger_level: (int) logger level; default is no logging
clip_planes: (list of tuple of (FVector3, FVector3)) list of point-normal pairs of clip planes; default is no planes
- tissue_forge.run(*args, **kwargs)
Runs the event loop until all windows close or simulation time expires. Automatically performs universe time propogation.
- Parameters
args (float) – final time (default runs infinitly)
- tissue_forge.irun()
Alias of
tissue_forge.tissue_forge.Simulator.irun
- tissue_forge.close()
Alias of
tissue_forge.tissue_forge.Simulator.close
- tissue_forge.show()
Alias of
tissue_forge.tissue_forge.Simulator.show
- tissue_forge.step(until: float = 0)
Alias of
tissue_forge.tissue_forge.Universe.step
- tissue_forge.stop()
Alias of
tissue_forge.tissue_forge.Universe.stop
- tissue_forge.start()
Alias of
tissue_forge.tissue_forge.Universe.start
- class tissue_forge.version
- build_date
Package build date
- compiler
Package compiler ID
- compiler_version
Package compiler version
- major
Tissue Forge major version
- minor
Tissue Forge minor version
- patch
Tissue Forge patch version
- system_name
System name
- system_version
System version
- version
Tissue Forge version
- tissue_forge.has_cuda
- Type
boolean
Flag signifying whether CUDA support is installed.
Simulator
- class tissue_forge.SimulatorInterface
- property cuda_config
CUDA runtime interface, if any
- static run(*args, **kwargs)
Runs the event loop until all windows close or simulation time expires. Automatically performs universe time propogation.
- Parameters
args (double) – final time (default runs infinitly)
- static show()
Shows any windows that were specified in the config. This works just like MatPlotLib’s
show
method. Theshow
method does not start the universe time propagation unlikerun
andirun
.
- property threads: int
Number of threads
- tissue_forge.Simulator
- Type
Simulator runtime interface
Universe
- class tissue_forge.UniverseInterface
- property angles
All angles in the universe
- property bonds
All bonds in the universe
- property boundary_conditions
Boundary conditions
- property cutoff: float
Global interaction cutoff distance
- property dihedrals
All dihedrals in the universe
- property dt
Time step
- grid(shape)
Gets a three-dimesional array of particle lists, of all the particles in the system.
- Parameters
shape – shape of grid
- Returns
three-dimension array of particle lists according to discretization and location
- property kinetic_energy
Universe kinetic energy
- property name: str
name of the model / script
- property num_types: int
Number of particle types
- property particles
Gets all particles in the universe
- Return type
ParticleList*
- reset_species()
Reset all species in all particles
- start()
Starts the universe time evolution, and advanced the universe forward by timesteps in
dt
. All methods to build and manipulate universe objects are valid whether the universe time evolution is running or stopped.
- step(until: float = 0)
Performs a single time step of the universe if no arguments are given. Optionally runs until
until
.- Parameters
until – runs the timestep for this length of time, optional.
- stop()
Stops the universe time evolution. This essentially freezes the universe, everything remains the same, except time no longer moves forward.
- property temperature
Universe temperature
- property time
Current time
- virial(origin=None, radius: Optional[float] = None, types=None) fMatrix3
Computes the virial tensor for the either the entire simulation domain, or a specific local virial tensor at a location and radius. Optionally can accept a list of particle types to restrict the virial calculation for specify types.
- Parameters
origin – An optional length-3 array for the origin. Defaults to the center of the simulation domain if not given.
radius – An optional number specifying the size of the region to compute the virial tensor for. Defaults to the entire simulation domain.
types – An optional list of
Particle
types to include in the calculation. Defaults to every particle type.
- Returns
virial tensor
- tissue_forge.Universe
- Type
Universe runtime interface
Boundary Conditions
- class tissue_forge.BoundaryCondition
A condition on a boundary of the universe.
- property kind_str: str
The name of the kind of boundary condition.
- restore
restoring percent.
When objects hit this boundary, they get reflected back at restore percent, so if restore is 0.5, and object hitting the boundary at 3 length / time recoils with a velocity of 1.5 lengths / time.
- velocity
the velocity on the boundary
- name
name of the boundary
- normal
vector normal to the boundary
- class tissue_forge.BoundaryConditions(*args)
The BoundaryConditions class serves as a container for the six instances of the
BoundaryCondition
object- left
The left boundary
- right
The right boundary
- front
The front boundary
- back
The back boundary
- bottom
The bottom boundary
- top
The top boundary
- toString() std::string
Get a JSON string representation
- Return type
string
- Returns
std::string
Constants
Geometry Constants
Boundary Condition Constants
- tissue_forge.BOUNDARY_NONE
no boundary conditions
- tissue_forge.PERIODIC_X
periodic in the x (first) direction
- tissue_forge.PERIODIC_Y
periodic in the y (second) direction
- tissue_forge.PERIODIC_Z
periodic in the z (third) direction
- tissue_forge.PERIODIC_FULL
periodic in the all directions
- tissue_forge.FREESLIP_X
free slip in the x (first) direction
- tissue_forge.FREESLIP_Y
free slip in the y (second) direction
- tissue_forge.FREESLIP_Z
free slip in the z (third) direction
- tissue_forge.FREESLIP_FULL
free slip in the all directions
Integrator Constants
- tissue_forge.FORWARD_EULER
Integrator constant: Forward Euler.
Recommended, most tested, standard single-step.
- tissue_forge.RUNGE_KUTTA_4
Integrator constant: Runge-Kutta.
Experimental Runge-Kutta-4.
Particle Dynamics Constants
- tissue_forge.Newtonian
Newtonian dynamics.
- tissue_forge.Overdamped
Overdamped dynamics.
Potential Constants
- tissue_forge.Potential.Kind.potential
Potential kind
- tissue_forge.Potential.Kind.dpd
Dissipative particle dynamics kind
Particles and Clusters
- class tissue_forge.Particle
The particle data structure.
Instance vars for each particle.
Note that the arrays for
x
,v
andf
are 4 entries long for proper alignment.All particles are stored in a series of contiguous blocks of memory that are owned by the space cells. Each space cell has a array of particle structs.
If you’re building a model, you should probably instead be working with a ParticleHandle.
- handle() TissueForge::ParticleHandle *
Get a handle for this particle.
- toString() std::string
Get a JSON string representation
- static fromString(str: std::string const &) TissueForge::Particle *
Create from a JSON string representation.
The returned particle is not automatically registered with the engine.
To properly register a particle from a string, pass the string to the particle constructor of the appropriate particle type or cluster.
- Parameters
str (string) – constructor string, as returned by toString
- Return type
- Returns
unregistered particle
- __reduce__()
Helper for pickle.
- class tissue_forge.ParticleHandle(*args)
A handle to a particle.
The engine allocates particle memory in blocks, and particle values get moved around all the time, so their addresses change.
The partlist is always ordered by id, i.e. partlist[id] always points to the same particle, even though that particle may move from cell to cell.
This is a safe way to work with a particle.
- property charge
Particle charge
- property mass
Particle mass
- property frozen
Particle frozen flag
- property frozen_x
Particle frozen flag along x
- property frozen_y
Particle frozen flag along y
- property frozen_z
Particle frozen flag along z
- property style
Particle style
- property age
Particle age
- property radius
Particle radius
- property name
Particle name
- property position
Particle position
- property velocity
Particle velocity
- property force
Net force acting on particle
- property force_init
Persistent force acting on particle
- property id
Particle id
- property type_id
Particle type id
- property cluster_id
Cluster particle id, if any; -1 if particle is not in a cluster
- property species
Particle species
- property bonds
Bonds attached to particle
- property angles
Angles attached to particle
- property dihedrals
Dihedrals attached to particle
- part() TissueForge::Particle *
Gets the actual particle of this handle.
- type() TissueForge::ParticleType *
Gets the particle type of this handle.
- split() TissueForge::ParticleHandle *
Splits a single particle into two and returns the new particle.
- Return type
- Returns
new particle
- destroy() HRESULT
Destroys the particle and removes it from inventory.
Subsequent references to a destroyed particle result in an error.
- sphericalPosition(particle: Particle = None, origin: fVector3 = None) TissueForge::FVector3
Calculates the particle’s coordinates in spherical coordinates.
By default, calculations are made with respect to the center of the universe.
- virial(radius: FPTYPE * = None) TissueForge::FMatrix3
Computes the virial tensor. Optionally pass a distance to include a neighborhood.
- Parameters
radius (float) – A distance to define a neighborhood, optional
- become(type: ParticleType) HRESULT
Dynamically changes the type of an object. We can change the type of a ParticleType-derived object to anyther pre-existing ParticleType-derived type. What this means is that if we have an object of say type A, we can change it to another type, say B, and and all of the forces and processes that acted on objects of type A stip and the forces and processes defined for type B now take over.
- Parameters
type (
ParticleType
) – new particle type
- neighbors(distance: FPTYPE const * = None, types: vectorParticleType = None) TissueForge::ParticleList *
Gets a list of nearby particles.
- Parameters
distance (float) – optional search distance; default is simulation cutoff
types (std::vector< TissueForge::ParticleType,std::allocator< TissueForge::ParticleType > >) – optional list of particle types to search by; default is all types
- getBondedNeighbors() TissueForge::ParticleList *
Gets a list of all bonded neighbors.
- distance(_other: ParticleHandle) FPTYPE
Calculates the distance to another particle
- Parameters
_other (
ParticleHandle
) – another particle.
- to_cluster() TissueForge::ClusterParticleHandle *
Limits casting to cluster by type
- class tissue_forge.ParticleTypeSpec
Interface for class-centric design of ParticleType
- mass = None
Particle type mass
- charge = None
Particle type charge
- radius = None
Particle type radius
- target_energy = None
Particle type target energy
- minimum_radius = None
Particle type minimum radius
- eps = None
Particle type nonbonded interaction parameter
- rmin = None
Particle type nonbonded interaction parameter
- dynamics = None
Particle type dynamics flag
- frozen = None
Particle type frozen flag
- name = None
Particle type name
- name2 = None
Particle type second name
- style = None
Particle type style dictionary specification.
Basic rendering details can be specified as a dictionary, like color and visibility,
style = {'color': 'CornflowerBlue', 'visible': False}
This declaration is the same as performing operations on a type after registration,
ptype: ParticleType ptype.style.setColor('CornflowerBlue') ptype.style.setVisible(False)
Rendering instead by species and species amount uses specification for a color mapper,
style = {'colormap': {'species': 'S1', 'map': 'rainbow', 'range': (0, 10)}}
This declaration is the same as performing operations on a type after registration,
ptype: ParticleType ptype.style.newColorMapper(partType=ptype, speciesName='S1', name='rainbow', min=0, max=10)
- species = None
Particle type list of species by name, if any. Species are automatically created and populated in the state vector of the type and all created particles.
- classmethod get()
Get the engine type that corresponds to this class.
The type is automatically registered as necessary.
- Returns
registered type instance
- Return type
- class tissue_forge.ParticleType(noReg: bool const & = False)
Structure containing information on each particle type.
This is only a definition for a type of particle, and not an actual particle with position, velocity, etc. However, particles of this type can be created with one of these.
- property frozen
Particle type frozen flag
- property frozen_x
Particle type frozen flag along x
- property frozen_y
Particle type frozen flag along y
- property frozen_z
Particle type frozen flag along z
- property temperature
Particle type temperature
- property target_temperature
Particle type target temperature
- id
ID of this type
- mass
Default mass of particles
- charge
Default charge of particles
- radius
Default radius of particles
- kinetic_energy
Kinetic energy of all particles of this type.
- potential_energy
Potential energy of all particles of this type.
- target_energy
Target energy of all particles of this type.
- minimum_radius
Default minimum radius of this type.
If a split event occurs, resulting particles will have a radius at least as great as this value.
- dynamics
Default dynamics of particles of this type.
- name
Name of this particle type.
- style
style pointer, optional.
- species
optional pointer to species list. This is the metadata for the species
- parts
list of particles that belong to this type.
- particle(i: int) TissueForge::Particle *
get the i’th particle that’s a member of this type.
- Parameters
i (int) – index of particle to get
- static particleTypeIds() std::set< short,std::less< short >,std::allocator< short > >
Get all current particle type ids, excluding clusters
- _call(*args) TissueForge::ParticleHandle *
Overload 1:
Particle constructor.
Automatically updates when running on a CUDA device.
- Parameters
- Return type
- Returns
ParticleHandle*
Overload 2:
Particle constructor.
Automatically updates when running on a CUDA device.
- Parameters
str (string) – JSON string
clusterId (int) – id of parent cluster, optional
- Return type
- Returns
ParticleHandle*
- factory(nr_parts=0, positions=None, velocities=None, cluster_ids=None)
- newType(_name: char const *) TissueForge::ParticleType *
Particle type constructor.
New type is constructed from the definition of the calling type.
- Parameters
_name (string) – name of the new type
- Return type
- Returns
ParticleType*
- registerType() HRESULT
Registers a type with the engine.
Note that this occurs automatically, unless noReg==true in constructor.
- Return type
int
- Returns
HRESULT
- on_register() void
A callback for when a type is registered
- isRegistered() bool
Tests whether this type is registered
- Return type
boolean
- Returns
true if registered
- get() TissueForge::ParticleType *
Get the type engine instance
- Return type
- Returns
ParticleType*
- items() TissueForge::ParticleList *
Get all particles of this type.
- isCluster() bool
Test whether the type is a cluster type
- toString() std::string
Get a JSON string representation
- static fromString(str: std::string const &) TissueForge::ParticleType *
Create from a JSON string representation.
The returned type is automatically registered with the engine.
- Parameters
str (string) – a string, as returned by
toString
- __reduce__()
Helper for pickle.
- class tissue_forge.ClusterParticleHandle(*args)
Bases:
ParticleHandle
The cluster analogue to
ParticleHandle
.These are special in that they can create particles of their constituent particle types, much like a
ParticleType
.- property radius_of_gyration
Radius of gyration
- property center_of_mass
Center of mass
- property centroid
Centroid
- property moment_of_inertia
Moment of inertia
- items = <function ClusterParticleHandle.items>
- _call(*args) TissueForge::ParticleHandle *
Overload 1:
Constituent particle constructor.
The created particle will belong to this cluster.
Automatically updates when running on a CUDA device.
- Parameters
partType (
ParticleType
) – type of particle to createposition (
FVector3
) – position of new particle, optionalvelocity (
FVector3
) – velocity of new particle, optional
- Return type
- Returns
ParticleHandle*
Overload 2:
Constituent particle constructor.
The created particle will belong to this cluster.
Automatically updates when running on a CUDA device.
- Parameters
partType (
ParticleType
) – type of particle to createstr (string) – JSON string
- Return type
- Returns
ParticleHandle*
- cluster() TissueForge::Cluster *
Gets the actual cluster of this handle.
- Return type
- Returns
Particle*
- split(axis: fVector3 = None, random: bool * = None, time: FPTYPE * = None, normal: fVector3 = None, point: fVector3 = None) TissueForge::ParticleHandle *
Split the cluster.
- Parameters
axis (
FVector3
) – axis of split, optionalrandom (boolean) – divide by randomly and evenly allocating constituent particles, optional
time (float) – time at which to implement the split; currently not supported
normal (
FVector3
) – normal vector of cleavage plane, optionalpoint (
FVector3
) – point on cleavage plane, optional
- Return type
- Returns
ParticleHandle*
- class tissue_forge.ClusterTypeSpec
Bases:
ParticleTypeSpec
Interface for class-centric design of ClusterParticleType
- types = None
List of constituent types of the cluster, if any
- class tissue_forge.ClusterParticleType(noReg: bool const & = False)
Bases:
ParticleType
The cluster analogue to
ParticleType
.- types
list of particle types that belong to this type.
- hasType(type: ParticleType) bool
Tests where this cluster has a particle type
- Parameters
type (
ParticleType
) – type to test- Return type
boolean
- Returns
true if this cluster has the type
- get() TissueForge::ClusterParticleType *
Get the type engine instance
- Return type
- Returns
ClusterParticleType*
ParticleList and ParticleTypeList
- class tissue_forge.ParticleList(*args)
A special list with convenience methods for working with sets of particles.
- property virial
Virial tensor of particles in list
- property radius_of_gyration
Radius of gyration of particles in list
- property center_of_mass
Center of mass of particles in list
- property centroid
Centroid of particles in list
- property moment_of_inertia
Moment of inertia of particles in list
- property positions
Position of each particle in list
- property velocities
Velocity of each particle in list
- property forces
Net forces acting on each particle in list
- __len__() int
- __getitem__(i: int)
- reserve(_nr_parts: size_t) HRESULT
Reserve enough storage for a given number of items.
- Parameters
_nr_parts (int) – number of items
- Return type
int
- Returns
HRESULT
- insert(*args) uint16_t
Inserts the given particle into the list, returns the index of the item.
- Parameters
particle (
ParticleHandle
) – particle to insert- Return type
int
- Returns
uint16_t
- remove(id: int32_t) uint16_t
looks for the item with the given id and deletes it form the list
- Parameters
id (int) – id to remove
- Return type
int
- Returns
uint16_t
- extend(other: ParticleList) void
inserts the contents of another list
- Parameters
other (
ParticleList
) – another list
- item(i: int32_t const &) TissueForge::ParticleHandle *
looks for the item at the given index and returns it if found, otherwise returns NULL
- Parameters
i (int) – index of lookup
- Return type
- Returns
ParticleHandle*
- static all() TissueForge::ParticleList *
returns an instance populated with all current particles
- Return type
- Returns
ParticleList*
- sphericalPositions(origin: fVector3 = None) std::vector< TissueForge::FVector3,std::allocator< TissueForge::FVector3 > >
Get the spherical coordinates of each particle
- Parameters
origin (
FVector3
) – optional origin of coordinates; default is center of universe- Return type
std::vector< TissueForge::FVector3,std::allocator< TissueForge::FVector3 > >
- Returns
std::vector<FVector3>
- toString() std::string
Get a JSON string representation
- Return type
string
- Returns
std::string
- static fromString(str: std::string const &) TissueForge::ParticleList *
Create from a JSON string representation
- Parameters
str (string) –
- Return type
- Returns
ParticleList*
- __reduce__()
Helper for pickle.
- class tissue_forge.ParticleTypeList(*args)
A special list with convenience methods for working with sets of particle types.
- property virial
Virial tensor of particles corresponding to all types in list
- property radius_of_gyration
Radius of gyration of particles corresponding to all types in list
- property center_of_mass
Center of mass of particles corresponding to all types in list
- property centroid
Centroid of particles corresponding to all types in list
- property moment_of_inertia
Moment of inertia of particles corresponding to all types in list
- property positions
Position of each particle corresponding to all types in list
- property velocities
Velocity of each particle corresponding to all types in list
- property forces
Total net force acting on each particle corresponding to all types in list
- __len__() int
- __getitem__(i: int)
- reserve(_nr_parts: size_t) HRESULT
Reserve enough storage for a given number of items.
- Parameters
_nr_parts (int) – number of items
- Return type
int
- Returns
HRESULT
- insert(*args) uint16_t
Inserts the given particle type into the list, returns the index of the item.
- Parameters
ptype (
ParticleType
) –- Return type
int
- Returns
uint16_t
- remove(id: int32_t) uint16_t
looks for the item with the given id and deletes it form the list
- Parameters
id (int) – id to remove
- Return type
int
- Returns
uint16_t
- extend(other: ParticleTypeList) void
inserts the contents of another list
- Parameters
other (
ParticleTypeList
) – another list
- item(i: int32_t const &) TissueForge::ParticleType *
looks for the item at the given index and returns it if found, otherwise returns NULL
- Parameters
i (int) – index of lookup
- Return type
- Returns
ParticleType*
- static all() TissueForge::ParticleTypeList *
returns an instance populated with all current particle types
- Return type
- Returns
ParticleTypeList*
- sphericalPositions(origin: fVector3 = None) std::vector< TissueForge::FVector3,std::allocator< TissueForge::FVector3 > >
Get the spherical coordinates of each particle
- Parameters
origin (
FVector3
) – optional origin of coordinates; default is center of universe- Return type
std::vector< TissueForge::FVector3,std::allocator< TissueForge::FVector3 > >
- Returns
std::vector<FVector3>
- toString() std::string
Get a JSON string representation
- Return type
string
- Returns
std::string
- static fromString(str: std::string const &) TissueForge::ParticleTypeList *
Create from a JSON string representation
- Parameters
str (string) –
- Return type
- Returns
ParticleTypeList*
- __reduce__()
Helper for pickle.
Potentials
- class tissue_forge.tissue_forge._Potential
A Potential object is a compiled interpolation of a given function. The Universe applies potentials to particles to calculate the net force on them.
For performance reasons, Tissue Forge implements potentials as interpolations, which can be much faster than evaluating the function directly.
A potential can be treated just like any callable object.
- property min: float
Minimum distance of evaluation
- property max: float
Maximum distance of evaluation
- property cutoff: float
Cutoff distance
- property domain: (<class 'float'>, <class 'float'>)
Evaluation domain
- property intervals: int
Evaluation intervals
- property bound: bool
Bound flag
- property r0: float
Potential r0 value
- property shifted: bool
Shifted flag
- property periodic: bool
Periodic flag
- property r_square: bool
Potential r2 value
- _call(*args) FPTYPE
- plot(s=None, force=True, potential=False, show=True, ymin=None, ymax=None, *args, **kwargs)
Potential plot function
- toString() std::string
Get a JSON string representation
- Return type
string
- Returns
std::string
- static fromString(str: std::string const &) TissueForge::Potential *
Create from a JSON string representation
- Parameters
str (string) –
- Return type
- Returns
Potential*
- __reduce__()
Helper for pickle.
- static lennard_jones_12_6(min: FPTYPE, max: FPTYPE, A: FPTYPE, B: FPTYPE, tol: FPTYPE * = None) TissueForge::Potential *
Creates a 12-6 Lennard-Jones potential.
The Lennard Jones potential has the form:
\[\left( \frac{A}{r^{12}} - \frac{B}{r^6} \right)\]- Parameters
min (float) – The smallest radius for which the potential will be constructed.
max (float) – The largest radius for which the potential will be constructed.
A (float) – The first parameter of the Lennard-Jones potential.
B (float) – The second parameter of the Lennard-Jones potential.
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to 0.001 * (max - min).
- Return type
- Returns
Potential*
- static lennard_jones_12_6_coulomb(min: FPTYPE, max: FPTYPE, A: FPTYPE, B: FPTYPE, q: FPTYPE, tol: FPTYPE * = None) TissueForge::Potential *
Creates a potential of the sum of a 12-6 Lennard-Jones potential and a shifted Coulomb potential.
The 12-6 Lennard Jones - Coulomb potential has the form:
\[\left( \frac{A}{r^{12}} - \frac{B}{r^6} \right) + q \left( \frac{1}{r} - \frac{1}{max} \right)\]- Parameters
min (float) – The smallest radius for which the potential will be constructed.
max (float) – The largest radius for which the potential will be constructed.
A (float) – The first parameter of the Lennard-Jones potential.
B (float) – The second parameter of the Lennard-Jones potential.
q (float) – The charge scaling of the potential.
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to 0.001 * (max - min).
- Return type
- Returns
Potential*
- static ewald(min: FPTYPE, max: FPTYPE, q: FPTYPE, kappa: FPTYPE, tol: FPTYPE * = None, periodicOrder: unsigned int * = None) TissueForge::Potential *
Creates a real-space Ewald potential.
The Ewald potential has the form:
\[q \frac{\mathrm{erfc}\, ( \kappa r)}{r}\]- Parameters
min (float) – The smallest radius for which the potential will be constructed.
max (float) – The largest radius for which the potential will be constructed.
q (float) – The charge scaling of the potential.
kappa (float) – The screening distance of the Ewald potential.
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to 0.001 * (max - min).
periodicOrder (int) – Order of lattice periodicity along all periodic dimensions. Defaults to 0.
- Return type
- Returns
Potential*
- static coulomb(q: FPTYPE, min: FPTYPE * = None, max: FPTYPE * = None, tol: FPTYPE * = None, periodicOrder: unsigned int * = None) TissueForge::Potential *
Creates a Coulomb potential.
The Coulomb potential has the form:
\[\frac{q}{r}\]- Parameters
q (float) – The charge scaling of the potential.
min (float) – The smallest radius for which the potential will be constructed. Default is 0.01.
max (float) – The largest radius for which the potential will be constructed. Default is 2.0.
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to 0.001 * (max - min).
periodicOrder (int) – Order of lattice periodicity along all periodic dimensions. Defaults to 0.
- Return type
- Returns
Potential*
- static coulombR(q: FPTYPE, kappa: FPTYPE, min: FPTYPE, max: FPTYPE, modes: unsigned int * = None) TissueForge::Potential *
Creates a Coulomb reciprocal potential.
The Coulomb reciprocal potential has the form:
\[\frac{\pi q}{V} \sum_{||\mathbf{m}|| \neq 0} \frac{1}{||\mathbf{m}||^2} \exp \left( \left( i \mathbf{r}_{jk} - \left( \frac{\pi}{\kappa} \right)^{2} \mathbf{m} \right) \cdot \mathbf{m} \right)\]Here \(V\) is the volume of the domain and \(\mathbf{m}\) is a reciprocal vector of the domain.
- Parameters
q (float) – Charge scaling of the potential.
kappa (float) – Screening distance.
min (float) – Smallest radius for which the potential will be constructed.
max (float) – Largest radius for which the potential will be constructed.
modes (int) – Number of Fourier modes along each periodic dimension. Default is 1.
- Return type
- Returns
Potential*
- static harmonic(k: FPTYPE, r0: FPTYPE, min: FPTYPE * = None, max: FPTYPE * = None, tol: FPTYPE * = None) TissueForge::Potential *
Creates a harmonic bond potential.
The harmonic potential has the form:
\[k \left( r-r_0 \right)^2\]- Parameters
k (float) – The energy of the bond.
r0 (float) – The bond rest length.
min (float) – The smallest radius for which the potential will be constructed. Defaults to \(r_0 - r_0 / 2\).
max (float) – The largest radius for which the potential will be constructed. Defaults to \(r_0 + r_0 /2\).
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to \(0.01 \abs(max-min)\).
- Return type
- Returns
Potential*
- static linear(k: FPTYPE, min: FPTYPE * = None, max: FPTYPE * = None, tol: FPTYPE * = None) TissueForge::Potential *
Creates a linear potential.
The linear potential has the form:
\[k r\]- Parameters
k (float) – interaction strength; represents the potential energy peak value.
min (float) – The smallest radius for which the potential will be constructed. Defaults to 0.0.
max (float) – The largest radius for which the potential will be constructed. Defaults to 10.0.
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to 0.001.
- Return type
- Returns
Potential*
- static harmonic_angle(k: FPTYPE, theta0: FPTYPE, min: FPTYPE * = None, max: FPTYPE * = None, tol: FPTYPE * = None) TissueForge::Potential *
Creates a harmonic angle potential.
The harmonic angle potential has the form:
\[k \left(\theta-\theta_{0} \right)^2\]- Parameters
k (float) – The energy of the angle.
theta0 (float) – The minimum energy angle.
min (float) – The smallest angle for which the potential will be constructed. Defaults to zero.
max (float) – The largest angle for which the potential will be constructed. Defaults to PI.
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to 0.005 * (max - min).
- Return type
- Returns
Potential*
- static harmonic_dihedral(k: FPTYPE, delta: FPTYPE, min: FPTYPE * = None, max: FPTYPE * = None, tol: FPTYPE * = None) TissueForge::Potential *
Creates a harmonic dihedral potential.
The harmonic dihedral potential has the form:
\[k \left( \theta - \delta \right) ^2\]- Parameters
k (float) – energy of the dihedral.
delta (float) – minimum energy dihedral.
min (float) – The smallest angle for which the potential will be constructed. Defaults to zero.
max (float) – The largest angle for which the potential will be constructed. Defaults to PI.
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to 0.005 * (max - min).
- Return type
- Returns
Potential*
- static cosine_dihedral(k: FPTYPE, n: int, delta: FPTYPE, tol: FPTYPE * = None) TissueForge::Potential *
Creates a cosine dihedral potential.
The cosine dihedral potential has the form:
\[k \left( 1 + \cos( n \theta-\delta ) \right)\]- Parameters
k (float) – energy of the dihedral.
n (int) – multiplicity of the dihedral.
delta (float) – minimum energy dihedral.
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to 0.01.
- Return type
- Returns
Potential*
- static well(k: FPTYPE, n: FPTYPE, r0: FPTYPE, min: FPTYPE * = None, max: FPTYPE * = None, tol: FPTYPE * = None) TissueForge::Potential *
Creates a well potential.
Useful for binding a particle to a region.
The well potential has the form:
\[\frac{k}{\left(r_0 - r\right)^{n}}\]- Parameters
k (float) – potential prefactor constant, should be decreased for larger n.
n (float) – exponent of the potential, larger n makes a sharper potential.
r0 (float) – The extents of the potential, length units. Represents the maximum extents that a two objects connected with this potential should come apart.
min (float) – The smallest radius for which the potential will be constructed. Defaults to zero.
max (float) – The largest radius for which the potential will be constructed. Defaults to r0.
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to 0.01 * abs(min-max).
- Return type
- Returns
Potential*
- static glj(e: FPTYPE, m: FPTYPE * = None, n: FPTYPE * = None, k: FPTYPE * = None, r0: FPTYPE * = None, min: FPTYPE * = None, max: FPTYPE * = None, tol: FPTYPE * = None, shifted: bool * = None) TissueForge::Potential *
Creates a generalized Lennard-Jones potential.
The generalized Lennard-Jones potential has the form:
\[\frac{\epsilon}{n-m} \left[ m \left( \frac{r_0}{r} \right)^n - n \left( \frac{r_0}{r} \right)^m \right]\]- Parameters
e (float) – effective energy of the potential.
m (float) – order of potential. Defaults to 3
n (float) – order of potential. Defaults to 2*m.
k (float) – mimumum of the potential. Defaults to 1.
r0 (float) – mimumum of the potential. Defaults to 1.
min (float) – The smallest radius for which the potential will be constructed. Defaults to 0.05 * r0.
max (float) – The largest radius for which the potential will be constructed. Defaults to 5 * r0.
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to 0.01.
shifted (boolean) – Flag for whether using a shifted potential. Defaults to true.
- Return type
- Returns
Potential*
- static morse(d: FPTYPE * = None, a: FPTYPE * = None, r0: FPTYPE * = None, min: FPTYPE * = None, max: FPTYPE * = None, tol: FPTYPE * = None, shifted: bool * = None) TissueForge::Potential *
Creates a Morse potential.
The Morse potential has the form:
\[d \left(1 - e^{ -a \left(r - r_0 \right) } \right)^2\]- Parameters
d (float) – well depth. Defaults to 1.0.
a (float) – potential width. Defaults to 6.0.
r0 (float) – equilibrium distance. Defaults to 0.0.
min (float) – The smallest radius for which the potential will be constructed. Defaults to 0.0001.
max (float) – The largest radius for which the potential will be constructed. Defaults to 3.0.
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to 0.001.
shifted (boolean) – Flag for whether using a shifted potential. Defaults to true.
- Return type
- Returns
Potential*
- static overlapping_sphere(mu: FPTYPE * = None, kc: FPTYPE * = None, kh: FPTYPE * = None, r0: FPTYPE * = None, min: FPTYPE * = None, max: FPTYPE * = None, tol: FPTYPE * = None) TissueForge::Potential *
Creates an overlapping-sphere potential from [OFPF+17].
The overlapping-sphere potential has the form:
\[\mu_{ij} s_{ij}(t) \hat{\mathbf{r}}_{ij} \log \left( 1 + \frac{||\mathbf{r}_{ij}|| - s_{ij}(t)}{s_{ij}(t)} \right) \text{ if } ||\mathbf{r}_{ij}|| < s_{ij}(t) ,\]\[\mu_{ij}\left(||\mathbf{r}_{ij}|| - s_{ij}(t)\right) \hat{\mathbf{r}}_{ij} \exp \left( -k_c \frac{||\mathbf{r}_{ij}|| - s_{ij}(t)}{s_{ij}(t)} \right) \text{ if } s_{ij}(t) \leq ||\mathbf{r}_{ij}|| \leq r_{max} ,\]\[0 \text{ otherwise} .\]Osborne refers to \(\mu_{ij}\) as a “spring constant”, this controls the size of the force, and is the potential energy peak value. \(\hat{\mathbf{r}}_{ij}\) is the unit vector from particle \(i\) center to particle \(j\) center, \(k_C\) is a parameter that defines decay of the attractive force. Larger values of \(k_C\) result in a shaper peaked attraction, and thus a shorter ranged force. \(s_{ij}(t)\) is the is the sum of the radii of the two particles.
- Parameters
mu (float) – interaction strength, represents the potential energy peak value. Defaults to 1.0.
kc (float) – decay strength of long range attraction. Larger values make a shorter ranged function. Defaults to 1.0.
kh (float) – Optionally add a harmonic long-range attraction, same as
glj
function. Defaults to 0.0.r0 (float) – Optional harmonic rest length, only used if kh is non-zero. Defaults to 0.0.
min (float) – The smallest radius for which the potential will be constructed. Defaults to 0.001.
max (float) – The largest radius for which the potential will be constructed. Defaults to 10.0.
tol (float) – The tolerance to which the interpolation should match the exact potential. Defaults to 0.001.
- Return type
- Returns
Potential*
- static power(k: FPTYPE * = None, r0: FPTYPE * = None, alpha: FPTYPE * = None, min: FPTYPE * = None, max: FPTYPE * = None, tol: FPTYPE * = None) TissueForge::Potential *
Creates a power potential.
The power potential the general form of many of the potential functions, such as
linear
, etc. power has the form:\[k (r-r_0)^{\alpha}\]- Parameters
k (float) – interaction strength, represents the potential energy peak value. Defaults to 1
r0 (float) – potential rest length, zero of the potential, defaults to 0.
alpha (float) – Exponent, defaults to 1.
min (float) – minimal value potential is computed for, defaults to r0 / 2.
max (float) – cutoff distance, defaults to 3 * r0.
tol (float) – Tolerance, defaults to 0.01.
- Return type
- Returns
Potential*
- static dpd(alpha: FPTYPE * = None, gamma: FPTYPE * = None, sigma: FPTYPE * = None, cutoff: FPTYPE * = None, shifted: bool * = None) TissueForge::Potential *
Creates a Dissipative Particle Dynamics potential.
The Dissipative Particle Dynamics force has the form:
\[\mathbf{F}_{ij} = \mathbf{F}^C_{ij} + \mathbf{F}^D_{ij} + \mathbf{F}^R_{ij}\]The conservative force is:
\[\mathbf{F}^C_{ij} = \alpha \left(1 - \frac{r_{ij}}{r_c}\right) \mathbf{e}_{ij}\]The dissapative force is:
\[\mathbf{F}^D_{ij} = -\gamma \left(1 - \frac{r_{ij}}{r_c}\right)^{2}(\mathbf{e}_{ij} \cdot \mathbf{v}_{ij}) \mathbf{e}_{ij}\]The random force is:
\[\mathbf{F}^R_{ij} = \sigma \left(1 - \frac{r_{ij}}{r_c}\right) \xi_{ij}\Delta t^{-1/2}\mathbf{e}_{ij}\]- Parameters
alpha (float) – interaction strength of the conservative force. Defaults to 1.0.
gamma (float) – interaction strength of dissapative force. Defaults to 1.0.
sigma (float) – strength of random force. Defaults to 1.0.
cutoff (float) – cutoff distance. Defaults to 1.0.
shifted (boolean) – Flag for whether using a shifted potential. Defaults to false.
- Return type
- Returns
Potential*
- class tissue_forge.tissue_forge.Potential
Bases:
_Potential
- custom = <function Potential.custom>
- class tissue_forge.tissue_forge.DPDPotential(alpha: FPTYPE, gamma: FPTYPE, sigma: FPTYPE, cutoff: FPTYPE, shifted: bool)
Bases:
_Potential
- alpha
strength of conserative interaction
- gamma
strength of dissapative interaction
- sigma
strength of random interaction
- static fromPot(pot: _Potential) TissueForge::DPDPotential *
Convert basic potential to DPD.
If the basic potential is not DPD, then NULL is returned.
- Parameters
pot (
Potential
) –- Return type
- Returns
DPDPotential*
- toString() std::string
Get a JSON string representation
- Return type
string
- Returns
std::string
- static fromString(str: std::string const &) TissueForge::DPDPotential *
Create from a JSON string representation
- Parameters
str (string) –
- Return type
- Returns
Potential*
- __reduce__()
Helper for pickle.
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 speciescoupling_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
- 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
- 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
- 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
- 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.
- 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
- class tissue_forge.tissue_forge.Berendsen
Bases:
Force
Berendsen force.
Create one with
Force.berendsen_tstat
.- itau
time constant
- 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.
- class tissue_forge.tissue_forge.Friction
Bases:
Force
Friction force.
Create one with
Force.friction
.- coef
time constant
Fluxes
- class tissue_forge.Fluxes
A flux is defined between a pair of types, and acts on the state vector between a pair of instances.
The indices of the species in each state vector are most likely different, so Tissue Forge tracks the indices in each type, and the transport constatants.
A flux between a pair of types, and pair of respective species needs:
(1) type A, (2) type B, (3) species id in A, (4) species id in B, (5) transport constant.
Allocates Flux as a single block, member pointers point to offsets in these blocks.
Allocated size is: sizeof(Fluxes) + 2 * alloc_size * sizeof(int32) + alloc_size * sizeof(FPTYPE)
- static flux(A: ParticleType, B: ParticleType, name: std::string const &, k: FPTYPE const &, decay: FPTYPE const & = 0.0) TissueForge::Fluxes *
Alias of fluxFick.
- Parameters
A (
ParticleType
) – first typeB (
ParticleType
) – second typename (string) – name of species
k (float) – transport coefficient
decay (float) – optional decay. Defaults to 0.0.
- Return type
- Returns
Fluxes*
- static fluxFick(A: ParticleType, B: ParticleType, name: std::string const &, k: FPTYPE const &, decay: FPTYPE const & = 0.0) TissueForge::Fluxes *
Creates and binds a Fickian diffusion flux.
Fickian diffusion flux implements the analogous reaction:
\[a.S \leftrightarrow b.S ; k \left(1 - \frac{r}{r_{cutoff}} \right)\left(a.S - b.S\right) ,\]\[a.S \rightarrow 0 ; \frac{d}{2} a.S ,\]\[b.S \rightarrow 0 ; \frac{d}{2} b.S ,\]where \(a.S\) is a chemical species located at object \(a\), and likewise for \(b\), \(k\) is the flux constant, \(r\) is the distance between the two objects, \(r_{cutoff}\) is the global cutoff distance, and \(d\) is an optional decay term.
Automatically updates when running on a CUDA device.
- Parameters
A (
ParticleType
) – first typeB (
ParticleType
) – second typename (string) – name of species
k (float) – transport coefficient
decay (float) – optional decay. Defaults to 0.0.
- Return type
- Returns
Fluxes*
- static secrete(A: ParticleType, B: ParticleType, name: std::string const &, k: FPTYPE const &, target: FPTYPE const &, decay: FPTYPE const & = 0.0) TissueForge::Fluxes *
Creates a secretion flux by active pumping.
Secretion flux implements the analogous reaction:
\[a.S \rightarrow b.S ; k \left(1 - \frac{r}{r_{cutoff}} \right)\left(a.S - a.S_{target} \right) ,\]\[a.S \rightarrow 0 ; \frac{d}{2} a.S ,\]\[b.S \rightarrow 0 ; \frac{d}{2} b.S ,\]where \(a.S\) is a chemical species located at object \(a\), and likewise for \(b\), \(k\) is the flux constant, \(r\) is the distance between the two objects, \(r_{cutoff}\) is the global cutoff distance, and \(d\) is an optional decay term.
Automatically updates when running on a CUDA device.
- Parameters
A (
ParticleType
) – first typeB (
ParticleType
) – second typename (string) – name of species
k (float) – transport coefficient
target (float) – target concentration
decay (float) – optional decay. Defaults to 0.0
- Return type
- Returns
Fluxes*
- static uptake(A: ParticleType, B: ParticleType, name: std::string const &, k: FPTYPE const &, target: FPTYPE const &, decay: FPTYPE const & = 0.0) TissueForge::Fluxes *
Creates an uptake flux by active pumping.
Uptake flux implements the analogous reaction:
\[a.S \rightarrow b.S ; k \left(1 - \frac{r}{r_{cutoff}}\right)\left(b.S - b.S_{target} \right)\left(a.S\right) ,\]\[a.S \rightarrow 0 ; \frac{d}{2} a.S ,\]\[b.S \rightarrow 0 ; \frac{d}{2} b.S ,\]where \(a.S\) is a chemical species located at object \(a\), and likewise for \(b\), \(k\) is the flux constant, \(r\) is the distance between the two objects, \(r_{cutoff}\) is the global cutoff distance, and \(d\) is an optional decay term.
Automatically updates when running on a CUDA device.
- Parameters
A (
ParticleType
) – first typeB (
ParticleType
) – second typename (string) – name of species
k (float) – transport coefficient
target (float) – target concentration
decay (float) – optional decay. Defaults to 0.0
- Return type
- Returns
Fluxes*
Bonds
- class tissue_forge.Bond
Bonds apply a potential to a particular set of particles.
If you’re building a model, you should probably instead be working with a BondHandle.
- static create(potential: _Potential, i: ParticleHandle, j: ParticleHandle, half_life: FPTYPE * = None, dissociation_energy: FPTYPE * = None, flags: uint32_t = 0) TissueForge::BondHandle *
Construct a new bond handle and underlying bond.
Automatically updates when running on a CUDA device.
- Parameters
potential (
Potential
) – bond potentiali (
ParticleHandle
) – ith particlej (
ParticleHandle
) – jth particlehalf_life (float) – bond half life
dissociation_energy (float) – dissociation energy
flags (int) – bond flags
- toString() std::string
Get a JSON string representation
- Return type
string
- Returns
std::string
- static fromString(str: std::string const &) TissueForge::Bond *
Create from a JSON string representation.
The returned bond is not automatically registered with the engine.
- Parameters
str (string) –
- Return type
- Returns
Bond*
- __reduce__()
Helper for pickle.
- class tissue_forge.BondHandle(*args)
Handle to a bond
This is a safe way to work with a bond.
Overload 1:
Construct a new bond handle and do nothing Subsequent usage will require a call to ‘init’
Overload 2:
Construct a new bond handle from an existing bond id
- Parameters
id (int) – id of existing bond
Overload 3:
Construct a new bond handle and underlying bond.
Automatically updates when running on a CUDA device.
- Parameters
potential (
Potential
) – bond potentiali (int) – id of ith particle
j (int) – id of jth particle
half_life (float) – bond half life
bond_energy (float) – bond energy
flags (int) – bond flags
- property energy
bond energy
- property parts
bonded particles
- property potential
bond potential
- property id
bond id
- property dissociation_energy
bond dissociation energy
- property half_life
bond half life
- property active
active flag
- property style
bond style
- property age
bond age
- __str__() str
Return str(self).
- __getitem__(index: int)
- static pairwise(pot: _Potential, parts: ParticleList, cutoff: FPTYPE const &, ppairs: vectorPairParticleType_ParticleType, half_life: FPTYPE const &, bond_energy: FPTYPE const &, flags: uint32_t) std::vector< TissueForge::BondHandle *,std::allocator< TissueForge::BondHandle * > > *
Apply bonds to a list of particles.
Automatically updates when running on a CUDA device.
- Parameters
pot (
Potential
) – the potential of the created bondsparts (
ParticleList
) – list of particlescutoff (float) – cutoff distance of particles that are bonded
ppairs (std::vector< std::pair< TissueForge::ParticleType *,TissueForge::ParticleType * > *,std::allocator< std::pair< TissueForge::ParticleType *,TissueForge::ParticleType * > * > >) – type pairs of bonds
half_life (float) – bond half life
bond_energy (float) – bond energy
flags (int) – bond flags
- Return type
std::vector< TissueForge::BondHandle *,std::allocator< TissueForge::BondHandle * > >
- Returns
std::vector<BondHandle*>*
- destroy() HRESULT
Destroy the bond.
Automatically updates when running on a CUDA device.
- Return type
int
- Returns
HRESULT
- static items() std::vector< TissueForge::BondHandle *,std::allocator< TissueForge::BondHandle * > >
Gets all bonds in the universe
- Return type
std::vector< TissueForge::BondHandle *,std::allocator< TissueForge::BondHandle * > >
- Returns
std::vector<BondHandle*>
- decays() bool
Tests whether this bond decays
- Return type
boolean
- Returns
true when the bond should decay
- class tissue_forge.Angle
A bond concerning an angle
If you’re building a model, you should probably instead be working with a AngleHandle.
- static create(potential: _Potential, p1: ParticleHandle, p2: ParticleHandle, p3: ParticleHandle, flags: uint32_t = 0) TissueForge::AngleHandle *
Creates an angle bond.
Automatically updates when running on a CUDA device.
- Parameters
potential (
Potential
) – potential of the bondp1 (
ParticleHandle
) – first outer particlep2 (
ParticleHandle
) – center particlep3 (
ParticleHandle
) – second outer particleflags (int) – angle flags
- Return type
- Returns
AngleHandle*
- toString() std::string
Get a JSON string representation
- Return type
string
- Returns
std::string
- static fromString(str: std::string const &) TissueForge::Angle *
Create from a JSON string representation.
The returned angle is not automatically registered with the engine.
- Parameters
str (string) –
- Return type
- Returns
Angle*
- __reduce__()
Helper for pickle.
- class tissue_forge.AngleHandle(*args)
A handle to an angle bond
This is a safe way to work with an angle bond.
- property energy
angle energy
- property parts
bonded particles
- property potential
angle potential
- property id
angle id
- property dissociation_energy
bond dissociation energy
- property half_life
angle half life
- property active
active flag
- property style
angle style
- property age
angle age
- __str__() str
Return str(self).
- __getitem__(index: int)
- destroy() HRESULT
Destroy the angle.
Automatically updates when running on a CUDA device.
- Return type
int
- Returns
HRESULT
- static items() std::vector< TissueForge::AngleHandle *,std::allocator< TissueForge::AngleHandle * > >
Gets all angles in the universe
- Return type
std::vector< TissueForge::AngleHandle *,std::allocator< TissueForge::AngleHandle * > >
- Returns
std::vector<AngleHandle*>
- decays() bool
Tests whether this bond decays
- Return type
boolean
- Returns
true when the bond should decay
- class tissue_forge.Dihedral
The dihedral structure
- static create(potential: _Potential, p1: ParticleHandle, p2: ParticleHandle, p3: ParticleHandle, p4: ParticleHandle) TissueForge::DihedralHandle *
Creates a dihedral bond
- Parameters
potential (
Potential
) – potential of the bondp1 (
ParticleHandle
) – first outer particlep2 (
ParticleHandle
) – first center particlep3 (
ParticleHandle
) – second center particlep4 (
ParticleHandle
) – second outer particle
- Return type
- Returns
DihedralHandle*
- toString() std::string
Get a JSON string representation
- Return type
string
- Returns
std::string
- static fromString(str: std::string const &) TissueForge::Dihedral *
Create from a JSON string representation.
The returned dihedral is not automatically registered with the engine.
- Parameters
str (string) –
- Return type
- Returns
Dihedral*
- __reduce__()
Helper for pickle.
- class tissue_forge.DihedralHandle(*args)
A handle to a dihedral bond
This is a safe way to work with a dihedral bond.
- property energy
angle energy
- property parts
bonded particles
- property potential
angle potential
- property id
angle id
- property dissociation_energy
bond dissociation energy
- property half_life
angle half life
- property active
active flag
- property style
angle style
- property age
angle age
- get() TissueForge::Dihedral *
Gets the dihedral of this handle
- Return type
- Returns
Dihedral*
- __str__() str
Return str(self).
- __getitem__(index: int)
- destroy() HRESULT
Destroy the dihedral
- Return type
int
- Returns
HRESULT
- static items() std::vector< TissueForge::DihedralHandle *,std::allocator< TissueForge::DihedralHandle * > >
Gets all dihedrals in the universe
- Return type
std::vector< TissueForge::DihedralHandle *,std::allocator< TissueForge::DihedralHandle * > >
- Returns
std::vector<DihedralHandle*>
- decays() bool
Tests whether this bond decays
- Return type
boolean
- Returns
true when the bond should decay
Binding
- tissue_forge.bind.particles(p: _Potential, a: Particle, b: Particle) HRESULT
Bind a potential to a pair of particles
- Parameters
p (
Potential
) – The potentiala (
Particle
) – The first particleb (
Particle
) – The second particle
- Return type
int
- Returns
HRESULT
- tissue_forge.bind.types(p: _Potential, a: ParticleType, b: ParticleType, bound: bool = False) HRESULT
Bind a potential to a pair of particle types.
Automatically updates when running on a CUDA device.
- Parameters
p (
Potential
) – The potentiala (
ParticleType
) – The first typeb (
ParticleType
) – The second typebound (boolean) – Flag signifying whether this potential exclusively operates on particles of different clusters, optional
- Return type
int
- Returns
HRESULT
- tissue_forge.bind.boundary_conditions(p: _Potential, t: ParticleType) HRESULT
Bind a potential to a pair of particle type and all boundary conditions.
Automatically updates when running on a CUDA device.
- Parameters
p (
Potential
) – The potentialt (
ParticleType
) – The particle type
- Return type
int
- Returns
HRESULT
- tissue_forge.bind.boundary_condition(p: _Potential, bc: BoundaryCondition, t: ParticleType) HRESULT
Bind a potential to a pair of particle type and a boundary conditions.
Automatically updates when running on a CUDA device.
- Parameters
p (
Potential
) – The potentialbcs – The boundary condition
t (
ParticleType
) – The particle type
- Return type
int
- Returns
HRESULT
- tissue_forge.bind.force(*args) HRESULT
Overload 1:
Bind a force to a particle type
- Parameters
force (
Force
) – The forcea_type (
ParticleType
) – The particle type
- Return type
int
- Returns
HRESULT
Overload 2:
Bind a force to a particle type with magnitude proportional to a species amount
- Parameters
force (
Force
) – The forcea_type (
ParticleType
) – The particle typecoupling_symbol (string) – The symbol of the species
- Return type
int
- Returns
HRESULT
- tissue_forge.bind.bonds(potential, particles, cutoff, pairs=None, half_life=None, bond_energy=None, flags=0)
Reactions and Species
- tissue_forge.state.Species
alias of
_state_Species
- tissue_forge.state.SpeciesValue
alias of
_state_SpeciesValue
- tissue_forge.state.SpeciesList
alias of
_state_SpeciesList
- tissue_forge.state.StateVector
alias of
_state_StateVector
Events
- tissue_forge.event.Event
alias of
_event_Event
- tissue_forge.event.on_event(invoke_method, predicate_method=None)
Creates and registers an event using prescribed invoke and predicate python function executors
- Parameters
invoke_method (PyObject) – an invoke method; evaluated when an event occurs. Takes an
event.Event
instance as argument and returns 0 on success, 1 on errorpredicate_method – optional predicate method; decides if an event occurs. Takes a
Event
instance as argument and returns 1 to trigger event, -1 on error and 0 otherwise
- tissue_forge.event.TimeEvent
alias of
_event_TimeEvent
- tissue_forge.event.on_time(period, invoke_method, predicate_method=None, distribution='default', start_time=0.0, end_time=-1.0)
Like
on_event
, but for an event that occurs at regular intervals.- Parameters
period (float) – period of event
invoke_method (PyObject) – an invoke method; evaluated when an event occurs. Takes an
TimeEvent
instance as argument and returns 0 on success, 1 on errorpredicate_method – optional predicate method; decides if an event occurs. Takes a
TimeEvent
instance as argument and returns 1 to trigger event, -1 on error and 0 otherwisedistribution (str) – distribution by which the next event time is selected
start_time (float) – time after which the event can occur
end_time (float) – time before which the event can occur; a negative value is interpreted as until ‘forever’
- tissue_forge.event.ParticleEvent
alias of
_event_ParticleEvent
- tissue_forge.event.on_particle(ptype, invoke_method, predicate_method=None, selector='default', single: bool = False)
Like
on_event
, but for a particle of a particular particle type.- Parameters
ptype (ParticleType) – the type of particle to select
invoke_method (PyObject) – an invoke method; evaluated when an event occurs. Takes an
ParticleEvent
instance as argument and returns 0 on success, 1 on errorpredicate_method – optional predicate method; decides if an event occurs. Takes a
ParticleEvent
instance as argument and returns 1 to trigger event, -1 on error and 0 otherwiseselector (str) – name of particle selector
single (bool) – flag to only trigger event once and then return
- tissue_forge.event.ParticleTimeEvent
alias of
_event_ParticleTimeEvent
- tissue_forge.event.on_particletime(ptype, period, invoke_method, predicate_method=None, distribution='default', start_time=0.0, end_time=-1.0, selector='default')
A combination of
on_time
andon_particle
.- Parameters
ptype (ParticleType) – the type of particle to select
period (float) – period of event
invoke_method (PyObject) – an invoke method; evaluated when an event occurs. Takes an
TimeEvent
instance as argument and returns 0 on success, 1 on errorpredicate_method – optional predicate method; decides if an event occurs. Takes a
TimeEvent
instance as argument and returns 1 to trigger event, -1 on error and 0 otherwisedistribution (str) – distribution by which the next event time is selected
start_time (str) – time after which the event can occur
end_time (float) – time before which the event can occur; a negative value is interpreted as until ‘forever’
selector (str) – name of particle selector
- tissue_forge.event.KeyEvent
alias of
_event_KeyEvent
Lattices
- class tissue_forge.lattice.BondRule(func: Callable[[ParticleHandle, ParticleHandle], BondHandle], part_ids: Tuple[int, int], cell_offset: Tuple[int, int, int])
Simple container for info to create a bond when constructing a lattice
- Parameters
func – function of func(p1, p2) that accepts two particle handles and returns a newly created bond.
part_ids – pair of particle ids in current current and other unit cell.
cell_offset – offset vector of other unit cell relative to current unit cell.
- class tissue_forge.lattice.unitcell(N: int, a1: List[float], a2: List[float], a3: List[float], dimensions: int = 3, position: Optional[List[List[float]]] = None, types: Optional[List[ParticleType]] = None, bonds: Optional[List[BondRule]] = None)
A unit cell
A unit cell is a box definition (a1, a2, a3, dimensions), and particle properties for N particles. You do not need to specify all particle properties. Any property omitted will be initialized to defaults. The function
create_lattice
initializes the system with many copies of a unit cell.unitcell
is a completely generic unit cell representation. See other classes in thelattice
module for convenience wrappers for common lattices.Example:
uc = lattice.unitcell(N=2, a1=[1, 0, 0], a2=[0.2, 1.2, 0], a3=[-0.2, 0, 1.0], dimensions=3, position=[[0, 0, 0], [0.5, 0.5, 0.5]], types=[A, B])
- Note:
a1, a2, a3 must define a right handed coordinate system.
- Parameters
N (int) – Number of particles in the unit cell.
a1 (List[float]) – Lattice vector (3-vector).
a2 (List[float]) – Lattice vector (3-vector).
a3 (List[float]) – Lattice vector (3-vector).
dimensions (int) – Dimensionality of the lattice (2 or 3).
position (List[List[float]]) – List of particle positions.
types (List[tf.ParticleType]) – List of particle types
bonds (List[BondRule]) – bond constructors rules
- tissue_forge.lattice.sc(a: float, types: Optional[ParticleType] = None, bond: Optional[Union[Callable[[ParticleHandle, ParticleHandle], BondHandle], List[Callable[[ParticleHandle, ParticleHandle], BondHandle]]]] = None, bond_vector: Tuple[bool] = (True, True, True)) unitcell
Create a unit cell for a simple cubic lattice (3D).
The simple cubic lattice unit cell has one particle:
[0, 0, 0]
And the box matrix:
[[a, 0, 0]
[0, a, 0]
[0, 0, a]]
Example:
uc = tissue_forge.lattice.sc(1.0, A, lambda i, j: tf.Bond.create(pot, i, j, dissociation_energy=100.0))
- Parameters
a – lattice constant
types – particle type
bond – bond constructor(s)
bond_vector – flags for creating bonds in the 1-, 2-, and 3-directions
- Returns
a simple cubic lattice unit cell
- tissue_forge.lattice.bcc(a: float, types: Optional[Union[ParticleType, List[ParticleType]]] = None, bond: Optional[Union[Callable[[ParticleHandle, ParticleHandle], BondHandle], List[Callable[[ParticleHandle, ParticleHandle], BondHandle]]]] = None, bond_vector: Tuple[bool] = (True, True)) unitcell
Create a unit cell for a body centered cubic lattice (3D).
The body centered cubic lattice unit cell has two particles:
[0, 0, 0]
[a/2, a/2, a/2]
And the box matrix:
[[a, 0, 0]
[0, a, 0]
[0, 0, a]]
Example:
uc = tissue_forge.lattice.bcc(1.0, A, lambda i, j: tf.Bond.create(pot, i, j, dissociation_energy=100.0))
- Parameters
a – lattice constant
types – particle type or list of particle types
bond – bond constructor(s)
bond_vector – flags for creating bonds - between the corner particles - between the corner and center particles
- Returns
a body centered cubic lattice unit cell
- tissue_forge.lattice.fcc(a: float, types: Optional[Union[ParticleType, List[ParticleType]]] = None, bond: Optional[Union[Callable[[ParticleHandle, ParticleHandle], BondHandle], List[Callable[[ParticleHandle, ParticleHandle], BondHandle]]]] = None, bond_vector: Tuple[bool] = (True, True)) unitcell
Create a unit cell for a face centered cubic lattice (3D).
The face centered cubic lattice unit cell has four particles:
[0, 0, 0]
[0, a/2, a/2]
[a/2, 0, a/2]
[a/2, a/2, 0]]
And the box matrix:
[[a, 0, 0]
[0, a, 0]
[0, 0, a]]
Example:
uc = tissue_forge.lattice.fcc(1.0, A, lambda i, j: tf.Bond.create(pot, i, j, dissociation_energy=100.0))
- Parameters
a – lattice constant
types – particle type or list of particle types
bond – bond constructor(s)
bond_vector – flags for creating bonds - between the corner particles - between the corner and the center particles
- Returns
a face centered cubic lattice unit cell
- tissue_forge.lattice.sq(a: float, types: Optional[Union[ParticleType, List[ParticleType]]] = None, bond: Optional[Union[Callable[[ParticleHandle, ParticleHandle], BondHandle], List[Callable[[ParticleHandle, ParticleHandle], BondHandle]]]] = None, bond_vector: Tuple[bool] = (True, True, False)) unitcell
Create a unit cell for a square lattice (2D).
The square lattice unit cell has one particle:
[0, 0]
And the box matrix:
[[a, 0]
[0, a]]
Example:
uc = tissue_forge.lattice.sq(1.0, A, lambda i, j: tf.Bond.create(pot, i, j, dissociation_energy=100.0))
- Parameters
a – lattice constant
types – particle type or list of particle types
bond – bond constructor(s)
bond_vector – flags for creating bonds along the 1-, 2- and 3-directions
- Returns
a square lattice unit cell
- tissue_forge.lattice.hex2d(a: float, types: Optional[Union[ParticleType, List[ParticleType]]] = None, bond: Optional[Union[Callable[[ParticleHandle, ParticleHandle], BondHandle], List[Callable[[ParticleHandle, ParticleHandle], BondHandle]]]] = None, bond_vector: Tuple[bool] = (True, True, False)) unitcell
Create a unit cell for a hexagonal lattice (2D).
The hexagonal lattice unit cell has two particles:
[0, 0]
[0, a*sqrt(3)/2]
And the box matrix:
[[a, 0]
[0, a*sqrt(3)]]
Example:
uc = tissue_forge.lattice.hex2d(1.0, A, lambda i, j: tf.Bond.create(pot, i, j, dissociation_energy=100.0))
- Parameters
a – lattice constant
types – particle type or list of particle types
bond – bond constructor(s)
bond_vector – flags for creating bonds along the 1-, 2- and 3-directions
- Returns
a hexagonal lattice unit cell
- tissue_forge.lattice.hcp(a: float, c: Optional[float] = None, types: Optional[Union[ParticleType, List[ParticleType]]] = None, bond: Optional[Union[Callable[[ParticleHandle, ParticleHandle], BondHandle], List[Callable[[ParticleHandle, ParticleHandle], BondHandle]]]] = None, bond_vector: Tuple[bool] = (True, True, True)) unitcell
Create a unit cell for a hexagonal close pack lattice (3D).
The hexagonal close pack lattice unit cell has seven particles:
[0, a*sqrt(3)/2, 0]
[a/2, 0, 0]
[a, a*sqrt(3)/2, 0]
[a*3/2, 0, 0]
[a/2, a*2/sqrt(3), c/2]
[a, a/2/sqrt(3), c/2]
[a*3/2, a*2/sqrt(3), c/2]
And the box matrix:
[[2*a, 0, 0]
[0, a*sqrt(3), 0]
[0, 0, c]]
Example:
uc = tissue_forge.lattice.hcp(1.0, 2.0, A, lambda i, j: tf.Bond.create(pot, i, j, dissociation_energy=100.0))
- Parameters
a – lattice constant
c – height of lattice (default
a
)types – particle type or list of particle types
bond – bond constructor(s)
bond_vector – flags for creating bonds - between the outer particles - between the inner particles - between the outer and inner particles
- Returns
a hexagonal close pack lattice unit cell
- tissue_forge.lattice.create_lattice(uc: unitcell, n: Union[int, List[int]], origin: Optional[List[float]] = None) ndarray
Create a lattice
Takes a unit cell and replicates it the requested number of times in each direction. A generic
unitcell
may have arbitrary vectorsa1
,a2
, anda3
.create_lattice
will rotate the unit cell so thata1
points in thex
direction anda2
is in thexy
plane so that the lattice may be represented as a simulation box. Whenn
is a single value, the lattice is replicatedn
times in each direction. Whenn
is a list, the lattice is replicatedn[i]
times in each ``i``th direction.Examples:
tissue_forge.lattice.create_lattice(uc=tissue_forge.lattice.sc(a=1.0), n=[2,4,2]) tissue_forge.lattice.create_lattice(uc=tissue_forge.lattice.bcc(a=1.0), n=10) tissue_forge.lattice.create_lattice(uc=tissue_forge.lattice.sq(a=1.2), n=[100,10]) tissue_forge.lattice.create_lattice(uc=tissue_forge.lattice.hex2d(a=1.0), n=[100,58])
- Parameters
uc – unit cell
n – number of unit cells to create along all/each direction(s)
origin – origin to begin creating lattice (default centered about simulation origin)
- Returns
particles created in every unit cell
Style
- tissue_forge.rendering.Style
alias of
_rendering_Style
Rendering
- tissue_forge.rendering.ClipPlane
alias of
_rendering_ClipPlane
- tissue_forge.rendering.ClipPlanes
alias of
_rendering_ClipPlanes
System
Logging
Tissue Forge has a detailed logging system. Many internal methods will log extensive details to either the clog (typically stderr) or a user specified file path. The logging system can be configured to log events at various levels of detail. All methods of the Logger are static, and are available immediately upon loading the Tissue Forge package.
To display logging at the lowest level (TRACE
), where every logging message is
displayed, is as simple as,
import tissue_forge as tf
tf.Logger.setLevel(tf.Logger.TRACE)
Enabling logging to terminal and disabling are also single commands,
tf.Logger.enableConsoleLogging(tf.Logger.DEBUG)
...
tf.Logger.disableConsoleLogging()
Messages can also be added to the log by logging level.
tf.Logger.log(tf.Logger.FATAL, "A fatal message. This is the highest priority.")
tf.Logger.log(tf.Logger.CRITICAL, "A critical message")
tf.Logger.log(tf.Logger.ERROR, "An error message")
tf.Logger.log(tf.Logger.WARNING, "A warning message")
tf.Logger.log(tf.Logger.NOTICE, "A notice message")
tf.Logger.log(tf.Logger.INFORMATION, "An informational message")
tf.Logger.log(tf.Logger.DEBUG, "A debugging message.")
tf.Logger.log(tf.Logger.TRACE, "A tracing message. This is the lowest priority.")
- class tissue_forge.Logger
The Tissue Forge logger.
A set of static method for setting the logging level.
- static setLevel(*args, **kwargs) void
Set the Level objectsets the logging level to one a value from Logger::Level
- Parameters
level (int) – logging level
- static getLevel() int
Get the Level objectget the current logging level.
- Return type
int
- Returns
int
- static disableLogging() void
Suppresses all logging output
- static enableConsoleLogging(*args, **kwargs) void
turns on console logging at the given level.
- Parameters
level (int) – logging level
- static disableConsoleLogging() void
stops logging to the console, but file logging may continue.
- static enableFileLogging(*args, **kwargs) void
turns on file logging to the given file as the given level.
If fileName is an empty string, then nothing occurs.
- Parameters
fileName (string) – path to log file
level (int) – logging level
- static disableFileLogging() void
turns off file logging, but has no effect on console logging.
- static getCurrentLevelAsString() std::string
get the textural form of the current logging level.
- Return type
string
- Returns
std::string
- static getFileName() std::string
Get the File Name objectget the name of the currently used log file.
- Return type
string
- Returns
std::string
- static levelToString(level: int) std::string
gets the textual form of a logging level Enum for a given value.
- static stringToLevel(str: std::string const &) TissueForge::LogLevel
parses a string and returns a Logger::Level
- static log(level: TissueForge::LogLevel, msg: std::string const &) void
logs a message to the log.
- Parameters
level (int) – logging level
msg (string) – log message
Utilities
- tissue_forge.random_point(kind: int, dr: Optional[float] = None, phi0: Optional[float] = None, phi1: Optional[float] = None)
Get the coordinates of a random point in a kind of shape.
Currently supports
PointsType.Sphere
,PointsType.Disk
,PointsType.SolidCube
andPointsType.SolidSphere
.- Parameters
kind – kind of shape
dr – thickness parameter; only applicable to solid sphere kind
phi0 – angle lower bound; only applicable to solid sphere kind
phi1 – angle upper bound; only applicable to solid sphere kind
- Returns
coordinates of random points
- Return type
- tissue_forge.random_points(kind: int, n: int = 1, dr: Optional[float] = None, phi0: Optional[float] = None, phi1: Optional[float] = None)
Get the coordinates of random points in a kind of shape.
Currently supports
PointsType.Sphere
,PointsType.Disk
,PointsType.SolidCube
andPointsType.SolidSphere
.- Parameters
kind – kind of shape
n – number of points
dr – thickness parameter; only applicable to solid sphere kind
phi0 – angle lower bound; only applicable to solid sphere kind
phi1 – angle upper bound; only applicable to solid sphere kind
- Returns
coordinates of random points
- Return type
list of
FVector3
- tissue_forge.points(kind: TissueForge::PointsType const &, n: unsigned int const & = 1) std::vector< TissueForge::FVector3,std::allocator< TissueForge::FVector3 > >
Get the coordinates of uniform points in a kind of shape.
Currently supports ring and sphere.
- Parameters
kind (int) – kind of shape
n (int) – number of points
- Return type
std::vector< TissueForge::FVector3,std::allocator< TissueForge::FVector3 > >
- Returns
std::vector<FVector3>
- tissue_forge.filled_cube_uniform(corner1, corner2, num_parts_x: int = 2, num_parts_y: int = 2, num_parts_z: int = 2)
Get the coordinates of a uniformly filled cube.
- Parameters
corner1 (list of float or
FVector3
) – first corner of cubecorner2 (list of float or
FVector3
) – second corner of cubenum_parts_x – number of particles along x-direction of filling axes (>=2)
num_parts_y – number of particles along y-direction of filling axes (>=2)
num_parts_z – number of particles along z-direction of filling axes (>=2)
- Returns
coordinates of uniform points
- Return type
list of
FVector3
- tissue_forge.filled_cube_random(corner1, corner2, num_particles: int)
Get the coordinates of a randomly filled cube.
- tissue_forge.icosphere(subdivisions: int, phi0: float, phi1: float)
Get the coordinates of an icosphere.
- Parameters
subdivisions – number of subdivisions
phi0 – angle lower bound
phi1 – angle upper bound
- Returns
vertices and indices
- Return type
(list of
FVector3
, list of int)
- tissue_forge.color3_names()
Get the names of all available colors
- Return type
list of str
- tissue_forge.random_vector(mean: FloatP_t, std: FloatP_t) TissueForge::FVector3
Generates a randomly oriented vector with random magnitude with given mean and standard deviation according to a normal distribution.
- Parameters
mean (float) – magnitude mean
std (float) – magnitude standard deviation
- Return type
- Returns
FVector3
- tissue_forge.random_unit_vector() TissueForge::FVector3
Generates a randomly oriented unit vector.
- Return type
- Returns
FVector3
- tissue_forge.get_seed() unsigned int
Get the current seed for the pseudo-random number generator
- tissue_forge.set_seed(_seed: unsigned int const * = None) HRESULT
Set the current seed for the pseudo-random number generator
- Parameters
_seed (int) –
- Return type
int
- Returns
HRESULT
Metrics
Basic Tissue Forge Types
Tissue Forge uses some basic types that provide support and convenience
methods for particular operations, especially concerning vector and
tensor operations. Some of these types are completely native to
Tissue Forge, and others constructed partially or completely from
types distributed in various Tissue Forge dependencies (e.g.,
FVector3
from Vector3
, from
Magnum.
- class tissue_forge.dVector2(*args)
A 2D vector with
double
elements- static xAxis(*args, **kwargs) TissueForge::types::TVector2< double >
- static yAxis(*args, **kwargs) TissueForge::types::TVector2< double >
- static xScale(scale: double) TissueForge::types::TVector2< double >
- static yScale(scale: double) TissueForge::types::TVector2< double >
- x(*args) double
- y(*args) double
- flipped() TissueForge::types::TVector2< double >
- dot(*args) double
- __len__() int
- __iadd__(*args) TissueForge::types::TVector2< double > &
- __add__(*args) TissueForge::types::TVector2< double >
- __isub__(*args) TissueForge::types::TVector2< double > &
- __sub__(*args) TissueForge::types::TVector2< double >
- __imul__(*args) TissueForge::types::TVector2< double > &
- __mul__(*args) TissueForge::types::TVector2< double >
- __itruediv__(*args)
- __truediv__(*args)
- length()
length of vector
- normalized()
vector normalized
- resized(length)
resize be a length
- projected(other)
project onto another vector
- projectedOntoNormalized(other)
project onto a normalized vector
- distance(line_start_pt, line_end_pt)
distance from a line defined by two points
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_list() list
convert to a python list
- __str__() str
Return str(self).
- class tissue_forge.fVector2(*args)
A 2D vector with
float
elements- static xAxis(*args, **kwargs) TissueForge::types::TVector2< float >
- static yAxis(*args, **kwargs) TissueForge::types::TVector2< float >
- static xScale(scale: float) TissueForge::types::TVector2< float >
- static yScale(scale: float) TissueForge::types::TVector2< float >
- x(*args) float
- y(*args) float
- flipped() TissueForge::types::TVector2< float >
- dot(*args) float
- __len__() int
- __iadd__(*args) TissueForge::types::TVector2< float > &
- __add__(*args) TissueForge::types::TVector2< float >
- __isub__(*args) TissueForge::types::TVector2< float > &
- __sub__(*args) TissueForge::types::TVector2< float >
- __imul__(*args) TissueForge::types::TVector2< float > &
- __mul__(*args) TissueForge::types::TVector2< float >
- __itruediv__(*args)
- __truediv__(*args)
- length()
length of vector
- normalized()
vector normalized
- resized(length)
resize be a length
- projected(other)
project onto another vector
- projectedOntoNormalized(other)
project onto a normalized vector
- distance(line_start_pt, line_end_pt)
distance from a line defined by two points
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_list() list
convert to a python list
- __str__() str
Return str(self).
- class tissue_forge.iVector2(*args)
A 2D vector with
int
elements- static xAxis(*args, **kwargs) TissueForge::types::TVector2< int >
- static yAxis(*args, **kwargs) TissueForge::types::TVector2< int >
- static xScale(scale: int) TissueForge::types::TVector2< int >
- static yScale(scale: int) TissueForge::types::TVector2< int >
- x(*args) int
- y(*args) int
- flipped() TissueForge::types::TVector2< int >
- dot(*args) int
- __len__() int
- __iadd__(*args) TissueForge::types::TVector2< int > &
- __add__(*args) TissueForge::types::TVector2< int >
- __isub__(*args) TissueForge::types::TVector2< int > &
- __sub__(*args) TissueForge::types::TVector2< int >
- __imul__(*args) TissueForge::types::TVector2< int > &
- __mul__(*args) TissueForge::types::TVector2< int >
- __itruediv__(*args)
- __truediv__(*args)
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_list() list
convert to a python list
- __str__() str
Return str(self).
- class tissue_forge.dVector3(*args)
A 3D vector with
double
elements- static xAxis(*args, **kwargs) TissueForge::types::TVector3< double >
- static yAxis(*args, **kwargs) TissueForge::types::TVector3< double >
- static zAxis(*args, **kwargs) TissueForge::types::TVector3< double >
- static xScale(scale: double) TissueForge::types::TVector3< double >
- static yScale(scale: double) TissueForge::types::TVector3< double >
- static zScale(scale: double) TissueForge::types::TVector3< double >
- x(*args) double
- y(*args) double
- z(*args) double
- r(*args) double
- g(*args) double
- b(*args) double
- xy()
- flipped() TissueForge::types::TVector3< double >
- dot(*args) double
- __len__() int
- __iadd__(*args) TissueForge::types::TVector3< double > &
- __add__(*args) TissueForge::types::TVector3< double >
- __isub__(*args) TissueForge::types::TVector3< double > &
- __sub__(*args) TissueForge::types::TVector3< double >
- __imul__(*args) TissueForge::types::TVector3< double > &
- __mul__(*args) TissueForge::types::TVector3< double >
- __itruediv__(*args)
- __truediv__(*args)
- length()
length of vector
- normalized()
vector normalized
- resized(length)
resize be a length
- projected(other)
project onto another vector
- projectedOntoNormalized(other)
project onto a normalized vector
- distance(line_start_pt, line_end_pt)
distance from a line defined by two points
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_list() list
convert to a python list
- __str__() str
Return str(self).
- class tissue_forge.fVector3(*args)
A 3D vector with
float
elements- static xAxis(*args, **kwargs) TissueForge::types::TVector3< float >
- static yAxis(*args, **kwargs) TissueForge::types::TVector3< float >
- static zAxis(*args, **kwargs) TissueForge::types::TVector3< float >
- static xScale(scale: float) TissueForge::types::TVector3< float >
- static yScale(scale: float) TissueForge::types::TVector3< float >
- static zScale(scale: float) TissueForge::types::TVector3< float >
- x(*args) float
- y(*args) float
- z(*args) float
- r(*args) float
- g(*args) float
- b(*args) float
- xy()
- flipped() TissueForge::types::TVector3< float >
- dot(*args) float
- __len__() int
- __iadd__(*args) TissueForge::types::TVector3< float > &
- __add__(*args) TissueForge::types::TVector3< float >
- __isub__(*args) TissueForge::types::TVector3< float > &
- __sub__(*args) TissueForge::types::TVector3< float >
- __imul__(*args) TissueForge::types::TVector3< float > &
- __mul__(*args) TissueForge::types::TVector3< float >
- __itruediv__(*args)
- __truediv__(*args)
- length()
length of vector
- normalized()
vector normalized
- resized(length)
resize be a length
- projected(other)
project onto another vector
- projectedOntoNormalized(other)
project onto a normalized vector
- distance(line_start_pt, line_end_pt)
distance from a line defined by two points
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_list() list
convert to a python list
- __str__() str
Return str(self).
- class tissue_forge.iVector3(*args)
A 3D vector with
int
elements- static xAxis(*args, **kwargs) TissueForge::types::TVector3< int >
- static yAxis(*args, **kwargs) TissueForge::types::TVector3< int >
- static zAxis(*args, **kwargs) TissueForge::types::TVector3< int >
- static xScale(scale: int) TissueForge::types::TVector3< int >
- static yScale(scale: int) TissueForge::types::TVector3< int >
- static zScale(scale: int) TissueForge::types::TVector3< int >
- x(*args) int
- y(*args) int
- z(*args) int
- r(*args) int
- g(*args) int
- b(*args) int
- xy(*args) TissueForge::types::TVector2< int > const
- flipped() TissueForge::types::TVector3< int >
- dot(*args) int
- __len__() int
- __iadd__(*args) TissueForge::types::TVector3< int > &
- __add__(*args) TissueForge::types::TVector3< int >
- __isub__(*args) TissueForge::types::TVector3< int > &
- __sub__(*args) TissueForge::types::TVector3< int >
- __imul__(*args) TissueForge::types::TVector3< int > &
- __mul__(*args) TissueForge::types::TVector3< int >
- __itruediv__(*args)
- __truediv__(*args)
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_list() list
convert to a python list
- __str__() str
Return str(self).
- class tissue_forge.dVector4(*args)
A 4D vector with
double
elements- x(*args) double
- y(*args) double
- z(*args) double
- w(*args) double
- r(*args) double
- g(*args) double
- b(*args) double
- a(*args) double
- xyz()
- rgb(*args) TissueForge::types::TVector3< double > const
- xy(*args) TissueForge::types::TVector2< double > const
- flipped() TissueForge::types::TVector4< double >
- dot(*args) double
- __len__() int
- __iadd__(*args) TissueForge::types::TVector4< double > &
- __add__(*args) TissueForge::types::TVector4< double >
- __isub__(*args) TissueForge::types::TVector4< double > &
- __sub__(*args) TissueForge::types::TVector4< double >
- __imul__(*args) TissueForge::types::TVector4< double > &
- __mul__(*args) TissueForge::types::TVector4< double >
- __itruediv__(*args)
- __truediv__(*args)
- length()
length of vector
- normalized()
vector normalized
- resized(length)
resize be a length
- projected(other)
project onto another vector
- projectedOntoNormalized(other)
project onto a normalized vector
- distance(point)
distance from a point
- distanceScaled(point)
scaled distance from a point
- classmethod planeEquation(*args)
get a plane equation
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_list() list
convert to a python list
- __str__() str
Return str(self).
- class tissue_forge.fVector4(*args)
A 4D vector with
float
elements- x(*args) float
- y(*args) float
- z(*args) float
- w(*args) float
- r(*args) float
- g(*args) float
- b(*args) float
- a(*args) float
- xyz()
- rgb(*args) TissueForge::types::TVector3< float > const
- xy(*args) TissueForge::types::TVector2< float > const
- flipped() TissueForge::types::TVector4< float >
- dot(*args) float
- __len__() int
- __iadd__(*args) TissueForge::types::TVector4< float > &
- __add__(*args) TissueForge::types::TVector4< float >
- __isub__(*args) TissueForge::types::TVector4< float > &
- __sub__(*args) TissueForge::types::TVector4< float >
- __imul__(*args) TissueForge::types::TVector4< float > &
- __mul__(*args) TissueForge::types::TVector4< float >
- __itruediv__(*args)
- __truediv__(*args)
- length()
length of vector
- normalized()
vector normalized
- resized(length)
resize be a length
- projected(other)
project onto another vector
- projectedOntoNormalized(other)
project onto a normalized vector
- distance(point)
distance from a point
- distanceScaled(point)
scaled distance from a point
- classmethod planeEquation(*args)
get a plane equation
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_list() list
convert to a python list
- __str__() str
Return str(self).
- class tissue_forge.iVector4(*args)
A 4D vector with
int
elements- x(*args) int
- y(*args) int
- z(*args) int
- w(*args) int
- r(*args) int
- g(*args) int
- b(*args) int
- a(*args) int
- xyz(*args) TissueForge::types::TVector3< int > const
- rgb(*args) TissueForge::types::TVector3< int > const
- xy(*args) TissueForge::types::TVector2< int > const
- flipped() TissueForge::types::TVector4< int >
- dot(*args) int
- __len__() int
- __iadd__(*args) TissueForge::types::TVector4< int > &
- __add__(*args) TissueForge::types::TVector4< int >
- __isub__(*args) TissueForge::types::TVector4< int > &
- __sub__(*args) TissueForge::types::TVector4< int >
- __imul__(*args) TissueForge::types::TVector4< int > &
- __mul__(*args) TissueForge::types::TVector4< int >
- __itruediv__(*args)
- __truediv__(*args)
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_list() list
convert to a python list
- __str__() str
Return str(self).
- class tissue_forge.dMatrix3(*args)
A 3x3 square matrix with
double
elements- static rotation(angle: double) TissueForge::types::TMatrix3< double >
- static shearingX(amount: double) TissueForge::types::TMatrix3< double >
- static shearingY(amount: double) TissueForge::types::TMatrix3< double >
- isRigidTransformation() bool
- invertedRigid() TissueForge::types::TMatrix3< double >
- __neg__() TissueForge::types::TMatrix3< double >
- __imul__(number: double) TissueForge::types::TMatrix3< double > &
- __mul__(*args) TissueForge::types::TVector3< double >
- __itruediv__(*args)
- __truediv__(*args)
- flippedCols() TissueForge::types::TMatrix3< double >
- flippedRows() TissueForge::types::TMatrix3< double >
- row(row: std::size_t) TissueForge::types::TVector3< double >
- __mul__(*args) TissueForge::types::TVector3< double >
- transposed() TissueForge::types::TMatrix3< double >
- diagonal() TissueForge::types::TVector3< double >
- inverted() TissueForge::types::TMatrix3< double >
- invertedOrthogonal() TissueForge::types::TMatrix3< double >
- __len__() int
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_lists() list
convert to a list of python lists
- __str__() str
Return str(self).
- class tissue_forge.fMatrix3(*args)
A 3x3 square matrix with
float
elements- static rotation(angle: float) TissueForge::types::TMatrix3< float >
- static shearingX(amount: float) TissueForge::types::TMatrix3< float >
- static shearingY(amount: float) TissueForge::types::TMatrix3< float >
- isRigidTransformation() bool
- invertedRigid() TissueForge::types::TMatrix3< float >
- __neg__() TissueForge::types::TMatrix3< float >
- __imul__(number: float) TissueForge::types::TMatrix3< float > &
- __mul__(*args) TissueForge::types::TVector3< float >
- __itruediv__(*args)
- __truediv__(*args)
- flippedCols() TissueForge::types::TMatrix3< float >
- flippedRows() TissueForge::types::TMatrix3< float >
- row(row: std::size_t) TissueForge::types::TVector3< float >
- __mul__(*args) TissueForge::types::TVector3< float >
- transposed() TissueForge::types::TMatrix3< float >
- diagonal() TissueForge::types::TVector3< float >
- inverted() TissueForge::types::TMatrix3< float >
- invertedOrthogonal() TissueForge::types::TMatrix3< float >
- __len__() int
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_lists() list
convert to a list of python lists
- __str__() str
Return str(self).
- class tissue_forge.dMatrix4(*args)
A 4x4 square matrix with
double
elements- static rotationX(angle: double) TissueForge::types::TMatrix4< double >
- static rotationY(angle: double) TissueForge::types::TMatrix4< double >
- static rotationZ(angle: double) TissueForge::types::TMatrix4< double >
- static shearingXY(amountX: double, amountY: double) TissueForge::types::TMatrix4< double >
- static shearingXZ(amountX: double, amountZ: double) TissueForge::types::TMatrix4< double >
- static shearingYZ(amountY: double, amountZ: double) TissueForge::types::TMatrix4< double >
- static orthographicProjection(size: dVector2, near: double, far: double) TissueForge::types::TMatrix4< double >
- static perspectiveProjection(*args) TissueForge::types::TMatrix4< double >
- static lookAt(eye: dVector3, target: dVector3, up: dVector3) TissueForge::types::TMatrix4< double >
- isRigidTransformation() bool
- rotationScaling() TissueForge::types::TMatrix3< double >
- rotationShear() TissueForge::types::TMatrix3< double >
- rotation(*args) TissueForge::types::TMatrix3< double >
- rotationNormalized() TissueForge::types::TMatrix3< double >
- scalingSquared() TissueForge::types::TVector3< double >
- scaling(*args) TissueForge::types::TVector3< double >
- uniformScalingSquared() double
- uniformScaling() double
- normalMatrix() TissueForge::types::TMatrix3< double >
- right(*args) TissueForge::types::TVector3< double >
- up(*args) TissueForge::types::TVector3< double >
- backward(*args) TissueForge::types::TVector3< double >
- translation(*args) TissueForge::types::TVector3< double >
- invertedRigid() TissueForge::types::TMatrix4< double >
- __neg__() TissueForge::types::TMatrix4< double >
- __imul__(number: double) TissueForge::types::TMatrix4< double > &
- __itruediv__(*args)
- __truediv__(*args)
- flippedCols() TissueForge::types::TMatrix4< double >
- flippedRows() TissueForge::types::TMatrix4< double >
- row(row: std::size_t) TissueForge::types::TVector4< double >
- __mul__(*args) TissueForge::types::TVector4< double >
- transposed() TissueForge::types::TMatrix4< double >
- diagonal() TissueForge::types::TVector4< double >
- inverted() TissueForge::types::TMatrix4< double >
- invertedOrthogonal() TissueForge::types::TMatrix4< double >
- __len__() int
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_lists() list
convert to a list of python lists
- __str__() str
Return str(self).
- class tissue_forge.fMatrix4(*args)
A 4x4 square matrix with
float
elements- static rotationX(angle: float) TissueForge::types::TMatrix4< float >
- static rotationY(angle: float) TissueForge::types::TMatrix4< float >
- static rotationZ(angle: float) TissueForge::types::TMatrix4< float >
- static shearingXY(amountX: float, amountY: float) TissueForge::types::TMatrix4< float >
- static shearingXZ(amountX: float, amountZ: float) TissueForge::types::TMatrix4< float >
- static shearingYZ(amountY: float, amountZ: float) TissueForge::types::TMatrix4< float >
- static orthographicProjection(size: fVector2, near: float, far: float) TissueForge::types::TMatrix4< float >
- static perspectiveProjection(*args) TissueForge::types::TMatrix4< float >
- static lookAt(eye: fVector3, target: fVector3, up: fVector3) TissueForge::types::TMatrix4< float >
- isRigidTransformation() bool
- rotationScaling() TissueForge::types::TMatrix3< float >
- rotationShear() TissueForge::types::TMatrix3< float >
- rotation(*args) TissueForge::types::TMatrix3< float >
- rotationNormalized() TissueForge::types::TMatrix3< float >
- scalingSquared() TissueForge::types::TVector3< float >
- scaling(*args) TissueForge::types::TVector3< float >
- uniformScalingSquared() float
- uniformScaling() float
- normalMatrix() TissueForge::types::TMatrix3< float >
- right(*args) TissueForge::types::TVector3< float >
- up(*args) TissueForge::types::TVector3< float >
- backward(*args) TissueForge::types::TVector3< float >
- translation(*args) TissueForge::types::TVector3< float >
- invertedRigid() TissueForge::types::TMatrix4< float >
- __neg__() TissueForge::types::TMatrix4< float >
- __imul__(number: float) TissueForge::types::TMatrix4< float > &
- __itruediv__(*args)
- __truediv__(*args)
- flippedCols() TissueForge::types::TMatrix4< float >
- flippedRows() TissueForge::types::TMatrix4< float >
- row(row: std::size_t) TissueForge::types::TVector4< float >
- __mul__(*args) TissueForge::types::TVector4< float >
- transposed() TissueForge::types::TMatrix4< float >
- diagonal() TissueForge::types::TVector4< float >
- inverted() TissueForge::types::TMatrix4< float >
- invertedOrthogonal() TissueForge::types::TMatrix4< float >
- __len__() int
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_lists() list
convert to a list of python lists
- __str__() str
Return str(self).
- class tissue_forge.dQuaternion(*args)
A quaternion with
double
elements- static rotation(angle: double, normalizedAxis: dVector3) TissueForge::types::TQuaternion< double >
- data(*args) double const *
- __eq__(other: dQuaternion) bool
Return self==value.
- __ne__(other: dQuaternion) bool
Return self!=value.
- isNormalized() bool
- vector() TissueForge::types::TVector3< double > const
- scalar() double
- angle(*args) double
- axis() TissueForge::types::TVector3< double >
- toMatrix() TissueForge::types::TMatrix3< double >
- toEuler() TissueForge::types::TVector3< double >
- __neg__() TissueForge::types::TQuaternion< double >
- __iadd__(other: dQuaternion) TissueForge::types::TQuaternion< double > &
- __add__(other: dQuaternion) TissueForge::types::TQuaternion< double >
- __isub__(other: dQuaternion) TissueForge::types::TQuaternion< double > &
- __sub__(other: dQuaternion) TissueForge::types::TQuaternion< double >
- __imul__(scalar: double) TissueForge::types::TQuaternion< double > &
- __itruediv__(*args)
- __truediv__(*args)
- __mul__(*args) TissueForge::types::TQuaternion< double >
- dot() double
- length() double
- normalized() TissueForge::types::TQuaternion< double >
- conjugated() TissueForge::types::TQuaternion< double >
- inverted() TissueForge::types::TQuaternion< double >
- invertedNormalized() TissueForge::types::TQuaternion< double >
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_list() list
convert to a python list
- __str__() str
Return str(self).
- class tissue_forge.fQuaternion(*args)
A quaternion with
float
elements- data(*args) float const *
- __eq__(other: fQuaternion) bool
Return self==value.
- __ne__(other: fQuaternion) bool
Return self!=value.
- isNormalized() bool
- vector() TissueForge::types::TVector3< float > const
- scalar() float
- angle(*args) float
- axis() TissueForge::types::TVector3< float >
- toMatrix() TissueForge::types::TMatrix3< float >
- toEuler() TissueForge::types::TVector3< float >
- __neg__() TissueForge::types::TQuaternion< float >
- __iadd__(other: fQuaternion) TissueForge::types::TQuaternion< float > &
- __add__(other: fQuaternion) TissueForge::types::TQuaternion< float >
- __isub__(other: fQuaternion) TissueForge::types::TQuaternion< float > &
- __sub__(other: fQuaternion) TissueForge::types::TQuaternion< float >
- __imul__(scalar: float) TissueForge::types::TQuaternion< float > &
- __itruediv__(*args)
- __truediv__(*args)
- __mul__(*args) TissueForge::types::TQuaternion< float >
- dot() float
- length() float
- normalized() TissueForge::types::TQuaternion< float >
- conjugated() TissueForge::types::TQuaternion< float >
- inverted() TissueForge::types::TQuaternion< float >
- invertedNormalized() TissueForge::types::TQuaternion< float >
- __getitem__(index: int)
- __setitem__(index: int, val)
- as_list() list
convert to a python list
- __str__() str
Return str(self).
- tissue_forge.FQuaternion
alias of
fQuaternion
File I/O
- tissue_forge.io.fromFile3DF(filePath: std::string const &) TissueForge::io::ThreeDFStructure *
Tissue Forge import/export interface
Load a 3D format file
- Parameters
filePath (string) – path of file
- Return type
- Returns
ThreeDFStructure* 3D format data container
- tissue_forge.io.toString() std::string
Return a simulation state as a JSON string
- Return type
string
- Returns
std::string
- tissue_forge.io.mapImportParticleId(pId: unsigned int const &) int
Get the id of a particle according to import data that corresponds to a particle id of current data.
Only valid between initialization and the first simulation step, after which the import summary data is purged.
- Parameters
pId (int) – id of particle in exported data
- Return type
int
- Returns
int >=0 if particle is found; -1 otherwise
- tissue_forge.io.mapImportParticleTypeId(pId: unsigned int const &) int
Get the id of a particle type according to import data that corresponds to a particle type id of current data.
Only valid between initialization and the first simulation step, after which the import summary data is purged.
- Parameters
pId (int) – id of particle type in exported data
- Return type
int
- Returns
int >=0 if particle type is found; -1 otherwise
- tissue_forge.io.ThreeDFRenderData
alias of
_io_ThreeDFRenderData
- tissue_forge.io.ThreeDFStructure
alias of
_io_ThreeDFStructure
- tissue_forge.io.ThreeDFMeshData
alias of
_io_ThreeDFMeshData
- tissue_forge.io.ThreeDFFaceData
alias of
_io_ThreeDFFaceData
- tissue_forge.io.ThreeDFEdgeData
alias of
_io_ThreeDFEdgeData
- tissue_forge.io.ThreeDFVertexData
alias of
_io_ThreeDFVertexData
GPU-Accelerated Modules
Note
This section of the Tissue Forge API is only available in CUDA-supported installations.