Introspection

Introspection

Only internal. This class is used only as a base class to Model, it is not provided through API. Defines interface to introspect simulation state.

Methods:

get_molecule_ids (pattern: Complex=None) -> List[int]

Returns a list of ids of molecules.
If the arguments pattern is not set, the list of all molecule ids is returned.
If the argument pattern is set, the list of all molecule ids whose species match
the pattern is returned.

get_molecule (id: int) -> Molecule

Returns a information on a molecule from the simulated environment,
None if the molecule does not exist.

get_species_name (species_id: int) -> str

Returns a string representing canonical species name in the BNGL format.

get_vertex (object: GeometryObject, vertex_index: int) -> Vec3

Returns coordinates of a vertex.
  • object: GeometryObject
  • vertex_index: int
    This is the index of the vertex in the geometry object’s walls (wall_list).

get_wall (object: GeometryObject, wall_index: int) -> Wall

Returns information about a wall belonging to a given object.
  • object: GeometryObject
    Geometry object whose wall to retrieve.
  • wall_index: int
    This is the index of the wall in the geometry object’s walls (wall_list).

get_vertex_unit_normal (object: GeometryObject, vertex_index: int) -> Vec3

Returns sum of all wall normals that use this vertex converted to a unit vector of
length 1 um (micrometer).
This represents the unit vector pointing outwards from the vertex.
  • object: GeometryObject
    Geometry object whose vertex to retrieve.
  • vertex_index: int
    This is the index of the vertex in the geometry object’s vertex_list.

get_wall_unit_normal (object: GeometryObject, wall_index: int) -> Vec3

Returns wall normal converted to a unit vector of length 1um.
  • object: GeometryObject
    Geometry object whose wall’s normal to retrieve.
  • wall_index: int
    This is the index of the vertex in the geometry object’s walls (wall_list).

get_wall_color (object: GeometryObject, wall_index: int) -> Color

Returns color of a wall.
  • object: GeometryObject
    Geometry object whose wall’s color to retrieve.
  • wall_index: int
    This is the index of the vertex in the geometry object’s walls (wall_list).

set_wall_color (object: GeometryObject, wall_index: int, color: Color)

Sets color of a wall.
  • object: GeometryObject
    Geometry object whose wall’s color to retrieve.
  • wall_index: int
    This is the index of the vertex in the geometry object’s walls (wall_list).
  • color: Color
    Color to be set.

Molecule

Representation of a molecule obtained from Model during simulation obtained through Model.get_molecule. Changes through changing attributes of this object are not allowed except for complete removal of this molecule.

Example: 1900_molecule_introspection/model.py

Attributes:

id: int

Unique id of this molecule. MCell assigns this unique id to each created
molecule. All reactions change ID of molecules even in reactions such as
A@CP -> A@EC.
- default argument value in constructor: ID_INVALID

type: MoleculeType

Type of this molecule, either volume or surface.
- default argument value in constructor: MoleculeType.UNSET

species_id: int

Species id of this molecule.
The species_id value is only temporary. Species ids are created and removed as needed
automatically and if this species is removed, this particular species_id value
won’t be valid. This can happen when a following iteration is simulated.
- default argument value in constructor: ID_INVALID

pos3d: Vec3

Contains position of a molecule in 3D space.
- default argument value in constructor: None

orientation: Orientation

Contains orientation for surface molecule. Volume molecules
have always orientation set to Orientation.NONE.
- default argument value in constructor: Orientation.NOT_SET

pos2d: Vec2

Set only for surface molecules. Position on a wall in UV coordinates
relative to the triangle of the wall.
- default argument value in constructor: None

geometry_object: GeometryObject

Set only for surface molecules.
Is set to a reference to the geometry object on whose surface is the molecule located.
- default argument value in constructor: None

wall_index: int

Set only for surface molecules.
Index of wall belonging to the geometry_object where is the
molecule located.
- default argument value in constructor: -1

Methods:

remove ()

Removes this molecule from simulation. Any subsequent modifications
of this molecule won’t have any effect.

Wall

Constant representation of wall of a geometry object. Changes through changing attributes of this object are not allowed except for the attribute is_movable.

Example: 1330_get_wall/model.py

Attributes:

geometry_object: GeometryObject

Object to which this wall belongs.

wall_index: int

Index of this wall in the object to which this wall belongs.

vertices: List[Vec3]

Vertices of the triangle that represents this wall.

area: float

Area of the wall in um^2.

unit_normal: Vec3

Normal of this wall with unit length of 1 um.
There is also a method Model.get_wall_unit_normal that allows to
retrieve just the normal value without the need to prepare this
whole Wall object.

is_movable: bool

If True, whis wall can be moved through Model.apply_vertex_moves,
if False, wall moves are ignored.
Can be set during simulation.
- default argument value in constructor: True

WallWallHitInfo

This class is used in the return type of Model.apply_vertex_moves. Contains pair of walls that collided.

Example: 1515_tetrahedron_box_collision_moving_3_w_wall_wall_hit/model.py

Attributes:

wall1: Wall

First colliding wall.

wall2: Wall

Second colliding wall.