Initial conditions¶
Initial conditions create the distribution of the particles or objects at the beginning of any simulation. Several variants include random placement, reading ICs from Python or restarting from the previous state
Summary¶
FromArray () 
Set particles according to given position and velocity arrays. 
InitialConditions () 
Base class for initial conditions 
Membrane () 
Can only be used with Membrane Object Vector, see Initial conditions. 
MembraneWithTypeId () 
Same as Membrane with an additional type id field which distinguish membranes with different properties. 
RandomChains () 
Creates chains of particles with random shapes at prescribed positions. 
Restart () 
Read the state of the particle vector from restart files. 
Rigid () 
Can only be used with Rigid Object Vector or Rigid Ellipsoid, see Initial conditions. 
Rod () 
Can only be used with Rod Vector. 
StraightChains () 
Creates chains of particles of the same orientations and lengths at prescribed positions. 
Uniform () 
The particles will be generated with the desired number density uniformly at random in all the domain. 
UniformFiltered () 
The particles will be generated with the desired number density uniformly at random in all the domain and then filtered out by the given filter. 
UniformSphere () 
The particles will be generated with the desired number density uniformly at random inside or outside a given sphere. 
UniformWithPolChain () 
The particles will be generated with the desired number density uniformly at random in all the domain. 
Details¶

class
FromArray
¶ Bases:
mmirheo.InitialConditions.InitialConditions
Set particles according to given position and velocity arrays.

__init__
(pos: List[real3], vel: List[real3]) → None¶ Parameters:  pos – array of positions
 vel – array of velocities


class
InitialConditions
¶ Bases:
object
Base class for initial conditions

__init__
()¶ Initialize self. See help(type(self)) for accurate signature.


class
Membrane
¶ Bases:
mmirheo.InitialConditions.InitialConditions
Can only be used with Membrane Object Vector, see Initial conditions. These IC will initialize the particles of each object according to the mesh associated with Membrane, and then the objects will be translated/rotated according to the provided initial conditions.

__init__
(com_q: List[ComQ], global_scale: float=1.0) → None¶ Parameters:  com_q – List describing location and rotation of the created objects. One entry in the list corresponds to one object created. Each entry consist of 7 reals: <com_x> <com_y> <com_z> <q_x> <q_y> <q_z> <q_w>, where com is the center of mass of the object, q is the quaternion of its rotation, not necessarily normalized
 global_scale – All the membranes will be scaled by that value. Useful to implement membranes growth so that they can fill the space with high volume fraction


class
MembraneWithTypeId
¶ Bases:
mmirheo.InitialConditions.Membrane
Same as
Membrane
with an additional type id field which distinguish membranes with different properties. This is may be used withMembraneForces
with the corresponding filter.
__init__
(com_q: List[ComQ], type_ids: List[int], global_scale: float=1.0) → None¶ Parameters:  com_q – List describing location and rotation of the created objects. One entry in the list corresponds to one object created. Each entry consist of 7 reals: <com_x> <com_y> <com_z> <q_x> <q_y> <q_z> <q_w>, where com is the center of mass of the object, q is the quaternion of its rotation, not necessarily normalized
 type_ids – list of type ids. Each entry corresponds to the id of the group to which the corresponding membrane belongs.
 global_scale – All the membranes will be scaled by that value. Useful to implement membranes growth so that they can fill the space with high volume fraction


class
RandomChains
¶ Bases:
mmirheo.InitialConditions.InitialConditions
Creates chains of particles with random shapes at prescribed positions. Each chain is generated by a random walk with a constant step size.

__init__
(positions: List[real3], length: float) → None¶ Parameters:  positions – center of mass of each chain
 length – length of the chains.


class
Restart
¶ Bases:
mmirheo.InitialConditions.InitialConditions
Read the state of the particle vector from restart files.

__init__
(path: str='restart/') → None¶ Parameters: path – folder where the restart files reside.


class
Rigid
¶ Bases:
mmirheo.InitialConditions.InitialConditions
Can only be used with Rigid Object Vector or Rigid Ellipsoid, see Initial conditions. These IC will initialize the particles of each object according to the template .xyz file and then the objects will be translated/rotated according to the provided initial conditions.

__init__
(*args, **kwargs)¶ Overloaded function.
__init__(com_q: List[ComQ], xyz_filename: str) > None
 Args:
 com_q:
List describing location and rotation of the created objects. One entry in the list corresponds to one object created. Each entry consist of 7 reals: <com_x> <com_y> <com_z> <q_x> <q_y> <q_z> <q_w>, where com is the center of mass of the object, q is the quaternion of its rotation, not necessarily normalized
 xyz_filename:
Template that describes the positions of the body particles before translation or rotation is applied. Standard .xyz file format is used with first line being the number of particles, second comment, third and onwards  particle coordinates. The number of particles in the file must be the same as in number of particles per object in the corresponding PV
__init__(com_q: List[ComQ], coords: List[real3]) > None
 Args:
 com_q:
List describing location and rotation of the created objects. One entry in the list corresponds to one object created. Each entry consist of 7 reals: <com_x> <com_y> <com_z> <q_x> <q_y> <q_z> <q_w>, where com is the center of mass of the object, q is the quaternion of its rotation, not necessarily normalized
 coords:
Template that describes the positions of the body particles before translation or rotation is applied. The number of coordinates must be the same as in number of particles per object in the corresponding PV
__init__(com_q: List[ComQ], coords: List[real3], init_vels: List[real3]) > None
 Args:
 com_q:
List describing location and rotation of the created objects. One entry in the list corresponds to one object created. Each entry consist of 7 reals: <com_x> <com_y> <com_z> <q_x> <q_y> <q_z> <q_w>, where com is the center of mass of the object, q is the quaternion of its rotation, not necessarily normalized
 coords:
Template that describes the positions of the body particles before translation or rotation is applied. The number of coordinates must be the same as in number of particles per object in the corresponding PV
 com_q:
List specifying initial CenterOfMass velocities of the bodies. One entry (list of 3 reals) in the list corresponds to one object


class
Rod
¶ Bases:
mmirheo.InitialConditions.InitialConditions
Can only be used with Rod Vector. These IC will initialize the particles of each rod according to the the given explicit centerline position aand torsion mapping and then the objects will be translated/rotated according to the provided initial conditions.

__init__
(com_q: List[ComQ], center_line: Callable[[float], real3], torsion: Callable[[float], float], a: float, initial_frame: real3=real3(inf, inf, inf)) → None¶ Parameters:  com_q – List describing location and rotation of the created objects. One entry in the list corresponds to one object created. Each entry consist of 7 reals: <com_x> <com_y> <com_z> <q_x> <q_y> <q_z> <q_w>, where com is the center of mass of the object, q is the quaternion of its rotation, not necessarily normalized
 center_line – explicit mapping \(\mathbf{r} : [0,1] \rightarrow R^3\). Assume \(r'(s)\) is constant for all \(s \in [0,1]\).
 torsion – explicit mapping \(\tau : [0,1] \rightarrow R\).
 a – width of the rod
 initial_frame – Orientation of the initial frame (optional) By default, will come up with any orthogonal frame to the rod at origin


class
StraightChains
¶ Bases:
mmirheo.InitialConditions.InitialConditions
Creates chains of particles of the same orientations and lengths at prescribed positions.

__init__
(positions: List[real3], orientations: List[real3], length: float) → None¶ Parameters:  positions – center of mass of each chain
 orientations – array of unit vectors indicating the orientation of the chains
 length – length of the chains.


class
Uniform
¶ Bases:
mmirheo.InitialConditions.InitialConditions
The particles will be generated with the desired number density uniformly at random in all the domain. These IC may be used with any Particle Vector, but only make sense for regular PV.

__init__
(number_density: float) → None¶ Parameters: number_density – target number density


class
UniformFiltered
¶ Bases:
mmirheo.InitialConditions.InitialConditions
The particles will be generated with the desired number density uniformly at random in all the domain and then filtered out by the given filter. These IC may be used with any Particle Vector, but only make sense for regular PV.

__init__
(number_density: float, filter: Callable[[real3], bool]) → None¶ Parameters:  number_density – target number density
 filter – given position, returns True if the particle should be kept


class
UniformSphere
¶ Bases:
mmirheo.InitialConditions.InitialConditions
The particles will be generated with the desired number density uniformly at random inside or outside a given sphere. These IC may be used with any Particle Vector, but only make sense for regular PV.

__init__
(number_density: float, center: real3, radius: float, inside: bool) → None¶ Parameters:  number_density – target number density
 center – center of the sphere
 radius – radius of the sphere
 inside – whether the particles should be inside or outside the sphere


class
UniformWithPolChain
¶ Bases:
mmirheo.InitialConditions.InitialConditions
The particles will be generated with the desired number density uniformly at random in all the domain. In addition, will provide an additional channel containing polymeric chain end to end vectors.

__init__
(number_density: float, q0: float=0.0) → None¶ Parameters:  number_density – target number density
 q0 – average length of the q vector
