jaxdem.domains.lees_edwards#
Lees-Edwards shear-periodic boundary-condition domain.
Classes
|
A Domain implementation that enforces Lees-Edwards boundary conditions. |
- class jaxdem.domains.lees_edwards.LeesEdwardsDomain(box_size: Array, inv_box_size: Array, anchor: Array, gamma: Array, alpha_axis: Array, beta_axis: Array, alpha: int = 0, beta: int = 1)#
Bases:
DomainA Domain implementation that enforces Lees-Edwards boundary conditions.
The domain is periodic in all directions. Across the shear-gradient axis
beta, periodic images are offset along the shear-flow axisalphaby the current shear straingamma.gammais a plain state field that bothdisplacement()andshift()read directly. The domain does not advance it; the shear protocol is imposed externally by updatinggammabetween steps (e.g. inuser_post_step_actions). For example, constant-rate shear is:from dataclasses import replace def shear(state, system): gamma = system.domain.gamma + gamma_dot * system.dt return state, replace(system, domain=replace(system.domain, gamma=gamma))
while oscillatory shear sets
gamma = gamma_amp * jnp.sin(omega * system.time).- gamma: Array#
Current shear strain; the Lees-Edwards image offset along
alphaisgamma * L_beta. Updated externally to impose the desired shear protocol.
- alpha_axis: Array#
One-hot vector for the shear-flow coordinate.
- beta_axis: Array#
One-hot vector for the shear-gradient coordinate.
- alpha: int#
Index of the shear-flow coordinate.
- beta: int#
Index of the shear-gradient coordinate.
- classmethod Create(dim: int, box_size: Array | None = None, anchor: Array | None = None, gamma: float | Array = 0.0, alpha: int = 0, beta: int = 1, **kwargs: Any) LeesEdwardsDomain[source]#
Construct a Lees-Edwards domain with validated shear axes.
- static displacement(ri: jax.Array, rj: jax.Array, system: System) jax.Array[source]#
Computes the shear-periodic minimum image displacement vector.
When the minimum image crosses the shear-gradient axis
beta, the displacement is shifted along the shear-flow axisalphaby \(\gamma L_\beta\) per crossed image.- 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 box_size and Lees-Edwards shear parameters.
- Returns:
The shear-periodic minimum image displacement vector:
\[\begin{split}& r_{ij} = r_i - r_j \\\\ & r_{ij,\alpha} = r_{ij,\alpha} - \operatorname{round}(r_{ij,\beta}/L_\beta)\gamma L_\beta \\\\ & r_{ij} = r_{ij} - L \left\lfloor 0.5 + r_{ij}/L \right\rfloor\end{split}\]- where:
\(L\) is the domain box size (
Domain.box_size)
- Return type:
jax.Array
- static shift(state: State, system: System) tuple[State, System][source]#
Wraps particles back into the primary shear-periodic simulation box.
\[\begin{split}& n_\beta = \left\lfloor (r_\beta - a_\beta)/L_\beta \right\rfloor \\\\ & r_\alpha = r_\alpha - n_\beta \gamma L_\beta \\\\ & r = r - L \left\lfloor (r-a)/L \right\rfloor\end{split}\]- where:
\(a\) is the domain anchor (
Domain.anchor)\(L\) is the domain box size (
Domain.box_size)