Skip to main content

AngleKernel

Trait AngleKernel 

Source
pub trait AngleKernel<T: Real> {
    type Params: Copy;

    // Required methods
    fn energy(cos_angle: T, params: Self::Params) -> T;
    fn diff(cos_angle: T, params: Self::Params) -> T;
    fn compute(cos_angle: T, params: Self::Params) -> EnergyDiff<T>;
}
Expand description

Trait for bending potentials (Angle) and inversion potentials (Improper).

Models interaction energy as a function of the cosine of an angle $\theta$ or $\psi$.

§Mathematical Contract

  • Input: Cosine of the angle ($\cos\theta$).
    • For Angles: $\cos\theta = \hat{r}_{ji} \cdot \hat{r}_{jk}$
    • For Inversions: $\cos\psi = \hat{n}_{jik} \cdot \hat{r}_{il}$
  • Output (Diff): The torque-like factor $\Gamma$ defined as: $$ \Gamma = \frac{dE}{d(\cos\theta)} $$

Required Associated Types§

Source

type Params: Copy

Associated constants/parameters required by the potential (e.g., $C, \theta_0$).

Required Methods§

Source

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

Computes only the potential energy.

Source

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

Computes only the torque-like factor $\Gamma$.

Source

fn compute(cos_angle: T, params: Self::Params) -> EnergyDiff<T>

Computes both energy and torque-like factor 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".

Implementors§