pub struct Boxcar {
pub epsilon: f64,
pub left: f64,
pub right: f64,
}Expand description
Constant valued potential in a given range of r (not differentiable).
U(r) = \begin{cases}
0 & r \lt a \\
\varepsilon & a \le r \lt b \\
0 & r \ge b
\end{cases}Compute boxcar potential function. Some uses of this in the literature call it the “square well” potential.
§Examples
Basic usage:
use hoomd_interaction::univariate::{Boxcar, UnivariateEnergy};
let epsilon = 1.5;
let (left, right) = (1.0, 2.5);
let boxcar = Boxcar {
epsilon,
left,
right,
};
assert_eq!(boxcar.energy(0.0), 0.0);
assert_eq!(boxcar.energy(1.0), 1.5);
assert_eq!(boxcar.energy(2.0), 1.5);
assert_eq!(boxcar.energy(2.5), 0.0);
assert_eq!(boxcar.energy(1000.0), 0.0);The parameters are public fields and may be accessed directly:
use hoomd_interaction::univariate::{Boxcar, UnivariateEnergy};
let mut boxcar = Boxcar {
epsilon: 1.5,
left: 1.0,
right: 2.5,
};
boxcar.epsilon = -2.0;
boxcar.left = 0.0;
boxcar.right = 1.0;Fields§
§epsilon: f64Energy scale ([energy]).
left: f64Left side of the boxcar ([length]).
right: f64Right side of the boxcar ([length]).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Boxcar
impl<'de> Deserialize<'de> for Boxcar
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 UnivariateEnergy for Boxcar
impl UnivariateEnergy for Boxcar
impl StructuralPartialEq for Boxcar
Auto Trait Implementations§
impl Freeze for Boxcar
impl RefUnwindSafe for Boxcar
impl Send for Boxcar
impl Sync for Boxcar
impl Unpin for Boxcar
impl UnsafeUnpin for Boxcar
impl UnwindSafe for Boxcar
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