pub struct G96<T> { /* private fields */ }Expand description
Implementations§
Source§impl<T: Vector> G96<T>
impl<T: Vector> G96<T>
Sourcepub fn new(k: f64, r0: f64) -> Self
pub fn new(k: f64, r0: f64) -> Self
Creates a new GROMOS96 bond potential.
§Arguments
k: Force constant (energy/length^4 units)r0: Equilibrium bond length (length units)
§Example
use potentials::bond::G96;
// Convert from harmonic: k_g96 = k_harm / r0^2
let k_harm = 300.0;
let r0 = 1.54;
let bond = G96::<f64>::new(k_harm / (r0 * r0), r0);Sourcepub fn from_r0_sq(k: f64, r0_sq: f64) -> Self
pub fn from_r0_sq(k: f64, r0_sq: f64) -> Self
Creates from r0 squared directly (avoids a multiplication).
Trait Implementations§
Source§impl<T: Vector> Potential2<T> for G96<T>
impl<T: Vector> Potential2<T> for G96<T>
Source§fn energy(&self, r_sq: T) -> T
fn energy(&self, r_sq: T) -> T
Computes the potential energy.
V(r) = (k/4) * (r^2 - r0^2)^2Note: No sqrt required!
Source§fn force_factor(&self, r_sq: T) -> T
fn force_factor(&self, r_sq: T) -> T
Computes the force factor.
dV/dr = (k/4) * 2 * (r^2 - r0^2) * 2r = k * r * (r^2 - r0^2)
S = -(dV/dr)/r = -k * (r^2 - r0^2)Note: No sqrt or division required!
Source§fn energy_force(&self, r_sq: T) -> (T, T)
fn energy_force(&self, r_sq: T) -> (T, T)
Computes energy and force factor together (optimized).
Shares the computation of delta.
impl<T: Copy> Copy for G96<T>
impl<T> StructuralPartialEq for G96<T>
Auto Trait Implementations§
impl<T> Freeze for G96<T>where
T: Freeze,
impl<T> RefUnwindSafe for G96<T>where
T: RefUnwindSafe,
impl<T> Send for G96<T>where
T: Send,
impl<T> Sync for G96<T>where
T: Sync,
impl<T> Unpin for G96<T>where
T: Unpin,
impl<T> UnwindSafe for G96<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