pub struct Linear<V> {
pub alpha: f64,
pub plane_origin: V,
pub plane_normal: Unit<V>,
}Expand description
Linear potential based on position.
U = \alpha \cdot \vec{n} \cdot ( \vec{r} - \vec{p} )Computes a linear external potential at a point in space relative to the plane
origin p, plane normal n, and the interaction strength alpha.
§Example
Basic usage:
use hoomd_interaction::external::Linear;
use hoomd_vector::{Cartesian, Unit};
let linear = Linear {
alpha: 2.0,
plane_origin: [0.0, -10.0].into(),
plane_normal: [0.0, 1.0].try_into()?,
};Fields§
§alpha: f64Interaction strength ([energy] [length]^(-1)).
plane_origin: VPoint on the plane where U=0 ([length]).
plane_normal: Unit<V>Vector normal to the plane (unitless).
Implementations§
Source§impl<V> Linear<V>where
V: InnerProduct,
impl<V> Linear<V>where
V: InnerProduct,
Sourcepub fn energy(&self, r: &V) -> f64
pub fn energy(&self, r: &V) -> f64
Compute the energy of a point in the linear field.
§Example
use hoomd_interaction::external::Linear;
use hoomd_vector::{Cartesian, Unit};
let linear = Linear {
alpha: 2.0,
plane_origin: [0.0, -10.0].into(),
plane_normal: [0.0, 1.0].try_into()?,
};
let energy = linear.energy(&[0.0, 0.0].into());
assert_eq!(energy, 20.0);Trait Implementations§
Source§impl<'de, V> Deserialize<'de> for Linear<V>where
V: Deserialize<'de>,
impl<'de, V> Deserialize<'de> for Linear<V>where
V: Deserialize<'de>,
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<S, P> SiteEnergy<S> for Linear<P>where
S: Position<Position = P>,
P: InnerProduct,
impl<S, P> SiteEnergy<S> for Linear<P>where
S: Position<Position = P>,
P: InnerProduct,
Source§fn site_energy(&self, site_properties: &S) -> f64
fn site_energy(&self, site_properties: &S) -> f64
Evaluate the energy contribution of a single site.
Source§fn site_energy_initial(&self, site_properties: &S) -> f64
fn site_energy_initial(&self, site_properties: &S) -> f64
Evaluate the energy contribution of a single site in the initial state. Read more
Source§fn is_only_infinite_or_zero() -> bool
fn is_only_infinite_or_zero() -> bool
Does this potential only ever return infinity or zero? Read more
impl<V> StructuralPartialEq for Linear<V>
Auto Trait Implementations§
impl<V> Freeze for Linear<V>where
V: Freeze,
impl<V> RefUnwindSafe for Linear<V>where
V: RefUnwindSafe,
impl<V> Send for Linear<V>where
V: Send,
impl<V> Sync for Linear<V>where
V: Sync,
impl<V> Unpin for Linear<V>where
V: Unpin,
impl<V> UnsafeUnpin for Linear<V>where
V: UnsafeUnpin,
impl<V> UnwindSafe for Linear<V>where
V: 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
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