OverlapPenalty

Struct OverlapPenalty 

Source
pub struct OverlapPenalty {
    pub k: f64,
    pub maximum_allowed_overlap: f64,
    pub epsilon_shoulder: f64,
}
Expand description

Monotonically non-decreasing potential to push sites apart (not differentiable).

OverlapPenalty is specifically designed to work with the QuickInsert and QuickCompress algorithms to quickly prepare states with non-overlapping particles. Combine it with ApproximateShapeOverlap to compute an energy that penalizes hard particle overlaps.

The potential has three regions:

U(r) = \begin{cases}
\infty & r < -d_\mathrm{max} \\
\frac{1}{2} kr^2 + \varepsilon_\mathrm{shoulder} & r < 0 \\
0 & r \ge 0
\end{cases}

The first region describes a completely hard interaction when sites overlap too far. This prevents QuickInsert from creating too much strain with an insertion. The second part applies a harmonic potential that allows trial moves to gradually resolve overlaps. In the third region, sites are allowed to move freely when not overlapping. The shoulder potential prevents trial moves from creating new overlaps.

§Example

use hoomd_interaction::univariate::OverlapPenalty;

let overlap_penalty = OverlapPenalty::default();

Fields§

§k: f64

Spring stiffness $[\mathrm{energy}] [\mathrm{length}]^{-2}$.

§maximum_allowed_overlap: f64

The largest overlap distance to allow $[\mathrm{length}]$.

§epsilon_shoulder: f64

Height of the potential as $r$ approaches 0 from the left $[\mathrm{energy}]$

Implementations§

Source§

impl OverlapPenalty

Source

pub fn scaled_default(diameter: f64) -> Self

Default overlap penalty parameters for a given diameter.

Construct an OverlapPenalty with default parameters scaled to suit a site with the given diameter.

§Example
use hoomd_interaction::univariate::OverlapPenalty;

let overlap_penalty = OverlapPenalty::scaled_default(2.0);

assert_eq!(overlap_penalty.maximum_allowed_overlap, 0.4);

Trait Implementations§

Source§

impl Clone for OverlapPenalty

Source§

fn clone(&self) -> OverlapPenalty

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for OverlapPenalty

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for OverlapPenalty

Source§

fn default() -> Self

Default overlap penalty parameters.

The default values are tuned for use with QuickInsert and QuickCompress applied to systems of spherical particles with diameter approximately 1.

  • $k = 10,000$
  • $d_\mathrm{max} = 0.2$
  • $\varepsilon_\mathrm{shoulder} = 100$

Call OverlapPenalty::scaled_default to initialize with values scaled for use with non-unit diameter sites.

§Example
use hoomd_interaction::univariate::OverlapPenalty;

let overlap_penalty = OverlapPenalty::default();
Source§

impl<'de> Deserialize<'de> for OverlapPenalty

Source§

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 OverlapPenalty

Source§

fn eq(&self, other: &OverlapPenalty) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for OverlapPenalty

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl UnivariateEnergy for OverlapPenalty

Source§

fn energy(&self, r: f64) -> f64

Compute the energy as a function of one variable. Read more
Source§

impl StructuralPartialEq for OverlapPenalty

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,