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:
force_factor_rad: Radial part ($- \frac{1}{r} \frac{dE}{dr}$).force_factor_ang: Angular part ($ \frac{dE}{d(\cos\theta)}$).
Required Associated Types§
Required Methods§
Sourcefn energy(r_sq: T, cos_theta: T, params: Self::Params) -> T
fn energy(r_sq: T, cos_theta: T, params: Self::Params) -> T
Computes only the potential energy.
Sourcefn diff(r_sq: T, cos_theta: T, params: Self::Params) -> (T, T)
fn diff(r_sq: T, cos_theta: T, params: Self::Params) -> (T, T)
Computes only the derivative factors (force_factor_rad, force_factor_ang).
Sourcefn compute(r_sq: T, cos_theta: T, params: Self::Params) -> HybridEnergyDiff<T>
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.