jaxdem.forces.law_combiner#
Composite force model that sums multiple force laws.
Classes
|
A ForceModel that sums a tuple of elementary force laws. |
- class jaxdem.forces.law_combiner.LawCombiner(laws: tuple[ForceModel, ...] = ())#
Bases:
ForceModelA ForceModel that sums a tuple of elementary force laws.
The total force, torque, and potential energy of the interaction between particles \(i\) and \(j\) are the sums over the contained laws:
\[F_{ij} = \sum_k F^{(k)}_{ij}, \qquad \tau_{ij} = \sum_k \tau^{(k)}_{ij}, \qquad E_{ij} = \sum_k E^{(k)}_{ij}\]Notes
The combiner evaluates each sub-law with a system whose
force_modelis the sub-law itself. Laws that read their own configuration fromjaxdem.System.force_model(including nested combiners) work correctly.An empty combiner (
laws=()) returns zero force, torque, and energy.ForceRouter.from_dict()uses it as the default no-interaction law.required_material_propertiesis the union of the requirements of all contained laws.
- static force_and_history(i: int, j: int, pos: jax.Array, state: State, system: System, history: Any) tuple[jax.Array, jax.Array, Any][source]#
- property required_material_properties: tuple[str, ...][source]#
Names of the material properties this force model needs.
The sorted union of the material properties required by all contained laws. Each name must be present in
System.mat_table. Used for validation.
- static force(i: int, j: int, pos: jax.Array, state: State, system: System) tuple[jax.Array, jax.Array][source]#
Compute the total force and torque on particle \(i\) from particle \(j\) by summing all contained laws.
- Parameters:
- Returns:
A tuple
(force, torque)with the sums of the forces and torques of all contained laws acting on particle \(i\) from particle \(j\).- Return type:
Tuple[jax.Array, jax.Array]
- static energy(i: int, j: int, pos: jax.Array, state: State, system: System) jax.Array[source]#
Compute the total potential energy of the interaction between particle \(i\) and particle \(j\) by summing all contained laws.
- Parameters:
- Returns:
Scalar total potential energy of the interaction between particles \(i\) and \(j\).
- Return type:
jax.Array