jaxdem.utils.gridState#
Utility functions to initialize states with particles arranged in a grid.
Functions
|
Create a state where particles sit on a rectangular lattice. |
- jaxdem.utils.gridState.grid_state(*, n_per_axis: Sequence[int], spacing: ArrayLike | float, radius: float = 1.0, mass: float = 1.0, jitter: float = 0.0, vel_range: ArrayLike | None = None, radius_range: ArrayLike | None = None, mass_range: ArrayLike | None = None, seed: int = 0, key: jax.Array | None = None) State[source][source]#
Create a state where particles sit on a rectangular lattice.
Random values can be sampled for particle radii, masses and velocities by specifying
*_rangearguments, which are interpreted as(min, max)bounds for a uniform distribution. When a range is not provided the correspondingradiusormassargument is used for all particles and the velocity components are sampled in[-1, 1].- Parameters:
n_per_axis (tuple[int]) – Number of spheres along each axis.
spacing (tuple[float] | float) – Centre-to-centre distance; scalar is broadcast to every axis.
radius (float) – Shared radius / mass for all particles when the corresponding range is not provided.
mass (float) – Shared radius / mass for all particles when the corresponding range is not provided.
jitter (float) – Add a uniform random offset in the range [-jitter, +jitter] for non-perfect grids (useful to break symmetry).
vel_range (ArrayLike | None) –
(min, max)values for the velocity components, radii and masses.radius_range (ArrayLike | None) –
(min, max)values for the velocity components, radii and masses.mass_range (ArrayLike | None) –
(min, max)values for the velocity components, radii and masses.seed (int) – Integer seed used when
keyis not supplied.key (PRNG key, optional) – Controls randomness. If
Nonea key will be created fromseed.
- Return type: