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: f64Spring stiffness $[\mathrm{energy}] [\mathrm{length}]^{-2}$.
maximum_allowed_overlap: f64The largest overlap distance to allow $[\mathrm{length}]$.
epsilon_shoulder: f64Height of the potential as $r$ approaches 0 from the left $[\mathrm{energy}]$
Implementations§
Source§impl OverlapPenalty
impl OverlapPenalty
Sourcepub fn scaled_default(diameter: f64) -> Self
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
impl Clone for OverlapPenalty
Source§fn clone(&self) -> OverlapPenalty
fn clone(&self) -> OverlapPenalty
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for OverlapPenalty
impl Debug for OverlapPenalty
Source§impl Default for OverlapPenalty
impl Default for OverlapPenalty
Source§fn default() -> Self
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
impl<'de> Deserialize<'de> for OverlapPenalty
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>,
Source§impl PartialEq for OverlapPenalty
impl PartialEq for OverlapPenalty
Source§impl Serialize for OverlapPenalty
impl Serialize for OverlapPenalty
Source§impl UnivariateEnergy for OverlapPenalty
impl UnivariateEnergy for OverlapPenalty
impl StructuralPartialEq for OverlapPenalty
Auto Trait Implementations§
impl Freeze for OverlapPenalty
impl RefUnwindSafe for OverlapPenalty
impl Send for OverlapPenalty
impl Sync for OverlapPenalty
impl Unpin for OverlapPenalty
impl UnwindSafe for OverlapPenalty
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
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>
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>
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