# 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 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. 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[float3], vel: List[float3]) → 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[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 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 of the particle vector from restart files.

__init__(path: str = 'restart/') → None
Parameters: path – folder where the restart files reside.
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[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 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[ComQ], coords: List[float3]) -> 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[ComQ], coords: List[float3], init_vels: List[float3]) -> 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 Rod

Can only be used with Rod Vector. These IC will initialize the particles of each rod according to the the given explicit center-line 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], float3], torsion: Callable[[float], float], a: float, initial_frame: float3 = float3(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 floats: , 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 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__(number_density: float) → None
Parameters: number_density – target number 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__(number_density: float, filter: Callable[[float3], bool]) → None
Parameters: number_density – target number 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__(number_density: float, center: float3, 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