jaxdem.domains.periodic#

Periodic boundary-condition domain.

Classes

PeriodicDomain(box_size, anchor)

A Domain implementation that enforces periodic boundary conditions.

class jaxdem.domains.periodic.PeriodicDomain(box_size: Array, anchor: Array)[source]#

Bases: Domain

A 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 displacement vector between particles is computed using the minimum image convention.

Notes

  • This domain type is periodic (periodic = True).

periodic: ClassVar[bool] = True#

Whether the domain enforces periodic boundary conditions.

static displacement(ri: jax.Array, rj: jax.Array, system: System) jax.Array[source][source]#

Computes the minimum image displacement vector between two particles \(r_i\) and \(r_j\).

For periodic boundary conditions, the displacement is calculated as the shortest vector that connects \(r_j\) to \(r_i\), potentially 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][source]#

Wraps particles back into the primary simulation box.

\[\begin{split}r = r - B \cdot \text{floor}((r - a)/B) \\\end{split}\]
where:
  • \(a\) is the domain anchor (Domain.anchor)

  • \(B\) is the domain box size (Domain.box_size)

Parameters:
  • state (State) – The current state of the simulation.

  • system (System) – The configuration of the simulation.

Returns:

The updated State object with wrapped particle positions, and the System object.

Return type:

Tuple[State, System]

classmethod registry_name() str[source]#
property type_name: str[source]#