pub trait TorsionKernel<T: Real> {
type Params: Copy;
// Required methods
fn energy(cos_phi: T, sin_phi: T, params: Self::Params) -> T;
fn diff(cos_phi: T, sin_phi: T, params: Self::Params) -> T;
fn compute(cos_phi: T, sin_phi: T, params: Self::Params) -> EnergyDiff<T>;
}Expand description
Trait for torsional potentials (Dihedrals).
Models interaction energy as a function of the dihedral angle $\phi$.
§Mathematical Contract
- Input: Both $\cos\phi$ and $\sin\phi$ are required to determine phase and
compute multi-term expansions (e.g., $\cos(n\phi)$) without
acos. - Output (Diff): The pure torque $T$ defined as: $$ T = \frac{dE}{d\phi} $$
Required Associated Types§
Required Methods§
Sourcefn energy(cos_phi: T, sin_phi: T, params: Self::Params) -> T
fn energy(cos_phi: T, sin_phi: T, params: Self::Params) -> T
Computes only the potential energy.
Sourcefn compute(cos_phi: T, sin_phi: T, params: Self::Params) -> EnergyDiff<T>
fn compute(cos_phi: T, sin_phi: T, params: Self::Params) -> EnergyDiff<T>
Computes both energy and pure torque efficiently. Should share intermediate calculations where possible.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.