hoomd_interaction/pairwise/mod.rs
1// Copyright (c) 2024-2026 The Regents of the University of Michigan.
2// Part of hoomd-rs, released under the BSD 3-Clause License.
3
4//! Pairwise interactions.
5
6use hoomd_vector::{Rotate, Vector};
7
8pub mod angular_mask;
9#[doc(inline)]
10pub use angular_mask::AngularMask;
11
12mod anisotropic;
13mod approximate_shape_overlap;
14mod hard_shape;
15mod isotropic;
16
17pub use anisotropic::Anisotropic;
18pub use approximate_shape_overlap::ApproximateShapeOverlap;
19pub use hard_shape::{HardShape, HardSphere};
20pub use isotropic::Isotropic;
21
22/// Computes pairwise energies between oriented particles.
23///
24/// An anisotropic pairwise energy is function of the relative position and
25/// orientation of the *j* particle in *i's* reference frame:
26/// ```math
27/// U(\vec{r}_{ij}, \mathbf{o}_{ij})
28/// ```
29///
30/// Implement [`AnisotropicEnergy`] on a custom type or use one of the provided
31/// potentials in [`pairwise`](crate::pairwise) in MD or MC simulations.
32pub trait AnisotropicEnergy<V: Vector, R: Rotate<V>> {
33 /// Compute the pairwise energy between two oriented particles.
34 /// ```math
35 /// U(\vec{r}_{ij}, \mathbf{o}_{ij})
36 /// ```
37 #[must_use]
38 fn energy(&self, r_ij: &V, o_ij: &R) -> f64;
39}
40
41// TODO: determine how to express the torque return type in a general way. Possibly use
42// an associated type of Rotation.