pub struct Harm<T> { /* private fields */ }Expand description
Implementations§
Trait Implementations§
impl<T: Copy> Copy for Harm<T>
Source§impl<T: Vector> Potential4<T> for Harm<T>
impl<T: Vector> Potential4<T> for Harm<T>
Source§fn energy(&self, cos_phi: T, sin_phi: T) -> T
fn energy(&self, cos_phi: T, sin_phi: T) -> T
Computes the potential energy.
Uses the angle difference formula to compute (phi - phi0) from cos and sin values without explicitly computing atan2.
delta_phi = atan2(sin(phi - phi0), cos(phi - phi0))
= atan2(sin_phi*cos_phi0 - cos_phi*sin_phi0,
cos_phi*cos_phi0 + sin_phi*sin_phi0)
V = k * delta_phi^2Source§fn derivative(&self, cos_phi: T, sin_phi: T) -> T
fn derivative(&self, cos_phi: T, sin_phi: T) -> T
Computes dV/d(phi).
dV/d(phi) = 2k * (phi - phi0)Source§fn energy_derivative(&self, cos_phi: T, sin_phi: T) -> (T, T)
fn energy_derivative(&self, cos_phi: T, sin_phi: T) -> (T, T)
Computes energy and derivative together (optimized).
Shares the computation of sin_delta, cos_delta, and delta_phi.
impl<T: PartialEq> StructuralPartialEq for Harm<T>
Auto Trait Implementations§
impl<T> Freeze for Harm<T>where
T: Freeze,
impl<T> RefUnwindSafe for Harm<T>where
T: RefUnwindSafe,
impl<T> Send for Harm<T>where
T: Send,
impl<T> Sync for Harm<T>where
T: Sync,
impl<T> Unpin for Harm<T>where
T: Unpin,
impl<T> UnsafeUnpin for Harm<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Harm<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more