jaxdem.domains.periodic#
Periodic boundary-condition domain.
Classes
|
A Domain implementation that enforces periodic boundary conditions. |
- class jaxdem.domains.periodic.PeriodicDomain(box_size: Array, inv_box_size: Array, anchor: Array, *, box_rate: Array = <factory>)#
Bases:
DomainA Domain implementation that enforces periodic boundary conditions.
Particles that move out of one side of the simulation box re-enter from the opposite side. The domain computes the displacement vector between particles with the minimum image convention.
box_rateis the time derivative ofbox_size. Periodic images of a particle move atimage * box_rate, whichrelative_velocitysubtracts. Time stepping does not advancebox_size; setbox_ratewhen a protocol changes the box continuously, and leave it zero otherwise. Discrete rescaling goes throughDomain.resize.- search_geometry: ClassVar[SearchGeometry | None] = 'orthogonal'#
- box_rate: Array#
Time derivative of
box_size, shape(dim,).A periodic image of particle
jsits atpos_j + image * box_sizeand moves atimage * box_ratewhen the box changes. Contact laws read the relative velocity throughrelative_velocity, which subtracts that image velocity; without it a pair interacting across a boundary would see the change of its image offset as sliding and wind up its tangential spring.Domain.resizesets this rate for the duration of its history update and zero means a fixed box.
- classmethod Create(dim: int, box_size: Array | None = None, anchor: Array | None = None, *, box_rate: Array | None = None, **kw: Any) Self[source]#
Construct a periodic box;
box_ratedefaults to zero.
- static relative_velocity(ri: jax.Array, rj: jax.Array, vi: jax.Array, vj: jax.Array, system: System) jax.Array[source]#
Subtract the velocity of the image selected by
displacement.
- search_geometry_drift(previous: Array, old_pos: Array) Array[source]#
Bound periodic image motion for changes along any box axes.
- static displacement(ri: jax.Array, rj: jax.Array, system: System) jax.Array[source]#
Compute the minimum image displacement vector between two particles \(r_i\) and \(r_j\).
For periodic boundary conditions, the displacement is the shortest vector that connects \(r_j\) to \(r_i\), possibly by crossing periodic boundaries.
- Parameters:
ri (jax.Array) – Position vector of the first particle \(r_i\).
rj (jax.Array) – Position vector of the second particle \(r_j\).
system (System) – The configuration of the simulation, containing the domain instance with anchor and box_size for periodicity.
- Returns:
The minimum image displacement vector:
\[\begin{split}& r_{ij} = (r_i - a) - (r_j - a) \\ & r_{ij} = r_{ij} - B \cdot \text{round}(r_{ij}/B)\end{split}\]- where:
\(a\) is the domain anchor (
Domain.anchor)\(B\) is the domain box size (
Domain.box_size)
- Return type:
jax.Array
- static shift(state: State, system: System) tuple[State, System][source]#
Wrap particles back into the primary simulation box.
\[r = r - B \cdot \text{floor}((r - a)/B)\]- where:
\(a\) is the domain anchor (
Domain.anchor)\(B\) is the domain box size (
Domain.box_size)