TorsionKernel

Trait TorsionKernel 

Source
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§

Source

type Params: Copy

Associated constants/parameters required by the potential (e.g., $V, n$).

Required Methods§

Source

fn energy(cos_phi: T, sin_phi: T, params: Self::Params) -> T

Computes only the potential energy.

Source

fn diff(cos_phi: T, sin_phi: T, params: Self::Params) -> T

Computes only the pure torque $T$.

Source

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.

Implementors§

Source§

impl<T: Real> TorsionKernel<T> for Torsion

Source§

type Params = (T, u8, T, T)