# 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. Restart() Read the state (particle coordinates and velocities, other relevant data for objects is not implemented yet) Rigid() Can only be used with Rigid Object Vector or Rigid Ellipsoid, see Initial conditions. 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.

## Details¶

class FromArray

Set particles according to given position and velocity arrays.

__init__(pos: List[List[float[3]]], vel: List[List[float[3]]]) → 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

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[List[float[7]]], 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 floats: , 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 Restart

Read the state (particle coordinates and velocities, other relevant data for objects is not implemented yet)

__init__(path: str = 'restart/') → None
Parameters: path – folder where the restart files reside. The exact filename will be like this: /.chk
class Rigid

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)

1. __init__(com_q: List[List[float[7]]], 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 floats: <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

2. __init__(com_q: List[List[float[7]]], coords: List[List[float[3]]]) -> 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 floats: <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

3. __init__(com_q: List[List[float[7]]], coords: List[List[float[3]]], init_vels: List[List[float[3]]]) -> 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 floats: <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 Center-Of-Mass velocities of the bodies. One entry (list of 3 floats) in the list corresponds to one object

class Uniform

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__(density: float) → None
Parameters: density – target density
class 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. These IC may be used with any Particle Vector, but only make sense for regular PV.

__init__(density: float, filter: Callable[[Tuple[float, float, float]], bool]) → None
Parameters: density – target density filter – given position, returns True if the particle should be kept
class UniformSphere

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__(density: float, center: Tuple[float, float, float], radius: float, inside: bool) → None
Parameters: density – target density center – center of the sphere radius – radius of the sphere inside – whether the particles should be inside or outside the sphere