pub struct WeeksChandlerAnderson {
pub epsilon: f64,
pub sigma: f64,
}Expand description
Potential with a steep repulsive core.
U(r) = \begin{cases}
4 \varepsilon \left[ \left( \frac{\sigma}{r} \right)^{12} - \left( \frac{\sigma}{r} \right)^{6} \right] + \varepsilon & r \lt 2^{1/6} \sigma \\
0 & r \ge 2^{1/6} \sigma
\end{cases}Compute the Weeks-Chandler-Anderson (WCA) potential and force as a function of r.
§Examples
Basic usage:
use approxim::{assert_abs_diff_eq, assert_relative_eq};
use hoomd_interaction::univariate::{
UnivariateEnergy, UnivariateForce, WeeksChandlerAnderson,
};
let epsilon = 1.5;
let sigma = 2.5;
let wca = WeeksChandlerAnderson { epsilon, sigma };
assert_relative_eq!(wca.energy(sigma), epsilon);
assert_abs_diff_eq!(wca.energy(2.0 * sigma), 0.0);
assert_relative_eq!(wca.energy(2.0_f64.powf(1.0 / 6.0) * sigma), 0.0);
assert_abs_diff_eq!(
wca.force(2.0_f64.powf(1.0 / 6.0) * sigma),
0.0,
epsilon = 1e-12
);The parameters are public fields and may be accessed directly:
use hoomd_interaction::univariate::WeeksChandlerAnderson;
let mut wca = WeeksChandlerAnderson::default();
wca.epsilon = 1.5;
wca.sigma = 3.0;Fields§
§epsilon: f64Energy scale ([energy]).
sigma: f64Interaction width ([length]).
Trait Implementations§
Source§impl Clone for WeeksChandlerAnderson
impl Clone for WeeksChandlerAnderson
Source§fn clone(&self) -> WeeksChandlerAnderson
fn clone(&self) -> WeeksChandlerAnderson
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for WeeksChandlerAnderson
impl Debug for WeeksChandlerAnderson
Source§impl Default for WeeksChandlerAnderson
impl Default for WeeksChandlerAnderson
Source§fn default() -> Self
fn default() -> Self
Construct a WeeksChandlerAnderson with default parameters (epsilon=1.0, sigma=1.0)
§Example
use hoomd_interaction::univariate::WeeksChandlerAnderson;
let wca = WeeksChandlerAnderson::default();Source§impl<'de> Deserialize<'de> for WeeksChandlerAnderson
impl<'de> Deserialize<'de> for WeeksChandlerAnderson
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl PartialEq for WeeksChandlerAnderson
impl PartialEq for WeeksChandlerAnderson
Source§impl Serialize for WeeksChandlerAnderson
impl Serialize for WeeksChandlerAnderson
impl StructuralPartialEq for WeeksChandlerAnderson
Auto Trait Implementations§
impl Freeze for WeeksChandlerAnderson
impl RefUnwindSafe for WeeksChandlerAnderson
impl Send for WeeksChandlerAnderson
impl Sync for WeeksChandlerAnderson
impl Unpin for WeeksChandlerAnderson
impl UnwindSafe for WeeksChandlerAnderson
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more