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 matchthe pattern is returned.
- pattern: Complex = NoneBNGL pattern to select molecules based on their species, might use compartments.
get_molecule (id: int) -> Molecule¶
Returns a information on a molecule from the simulated environment,None if the molecule does not exist.
- id: intUnique id of the molecule to be retrieved.Example: 1900_molecule_introspection/model.py
get_species_name (species_id: int) -> str¶
Returns a string representing canonical species name in the BNGL format.
- species_id: intId of the species.
get_vertex (object: GeometryObject, vertex_index: int) -> Vec3¶
Returns coordinates of a vertex.
- object: GeometryObject
- vertex_index: intThis is the index of the vertex in the geometry object’s walls (wall_list).Example: 1340_get_vertex/model.py
get_wall (object: GeometryObject, wall_index: int) -> Wall¶
Returns information about a wall belonging to a given object.
- object: GeometryObjectGeometry object whose wall to retrieve.
- wall_index: intThis is the index of the wall in the geometry object’s walls (wall_list).Example: 1330_get_wall/model.py
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 oflength 1 um (micrometer).This represents the unit vector pointing outwards from the vertex.
- object: GeometryObjectGeometry object whose vertex to retrieve.
- vertex_index: intThis is the index of the vertex in the geometry object’s vertex_list.Example: 1320_get_vertex_unit_normal/model.py
get_wall_unit_normal (object: GeometryObject, wall_index: int) -> Vec3¶
Returns wall normal converted to a unit vector of length 1um.
- object: GeometryObjectGeometry object whose wall’s normal to retrieve.
- wall_index: intThis is the index of the vertex in the geometry object’s walls (wall_list).Example: 1310_get_wall_unit_normal/model.py
get_wall_color (object: GeometryObject, wall_index: int) -> Color¶
Returns color of a wall.
- object: GeometryObjectGeometry object whose wall’s color to retrieve.
- wall_index: intThis 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: GeometryObjectGeometry object whose wall’s color to retrieve.
- wall_index: intThis is the index of the vertex in the geometry object’s walls (wall_list).
- color: ColorColor 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 createdmolecule. All reactions change ID of molecules even in reactions such asA@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 neededautomatically and if this species is removed, this particular species_id valuewon’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 moleculeshave 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 coordinatesrelative 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 themolecule located.- default argument value in constructor: -1
Methods:¶
remove ()¶
Removes this molecule from simulation. Any subsequent modificationsof this molecule won’t have any effect.Example: 1920_molecule_remove/model.py
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 toretrieve just the normal value without the need to prepare thiswhole 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