HybridKernel

Trait HybridKernel 

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

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

Trait for potentials dependent on both distance and angle (e.g., H-Bonds).

Models interaction energy as a function of squared distance $r^2$ and cosine of angle $\cos\theta$.

§Mathematical Contract

  • Input: Squared distance $r^2$ and cosine of angle $\cos\theta$.
  • Output: Two derivative factors:
    1. force_factor_rad: Radial part ($- \frac{1}{r} \frac{dE}{dr}$).
    2. force_factor_ang: Angular part ($ \frac{dE}{d(\cos\theta)}$).

Required Associated Types§

Source

type Params: Copy

Associated constants/parameters required by the potential.

Required Methods§

Source

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

Computes only the potential energy.

Source

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

Computes only the derivative factors (force_factor_rad, force_factor_ang).

Source

fn compute(r_sq: T, cos_theta: T, params: Self::Params) -> HybridEnergyDiff<T>

Computes both energy and derivative factors 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§