pub struct ApproximateShapeOverlap<E, A, B = A> {
pub shape_i: A,
pub shape_j: B,
pub isotropic: E,
pub resolution: PositiveReal,
}Expand description
Apply an isotropic potential evaluated at the approximate signed overlap distance.
Use ApproximateShapeOverlap combined with OverlapPenalty and
QuickInsert to quickly insert new bodies into the microstate or
QuickCompress to quickly compress the system to a target density.
In both cases, ApproximateShapeOverlap will allow partial overlaps
that can be resolved by later trial moves.
ApproximateShapeOverlap approximates the distance r that shape j
must be moved to remove any overlaps. If the shapes are already separate,
r is 0. Then it returns isotropic.energy(-r). resolution sets the
steps between r values.
The overlap distance is approximate and expensive to evaluate. Do not
use this potential for equilibration or sampling. It is suitable only
for use during a brief initialization phase when QuickInsert is adding
bodies or QuickCompress is compressing the system.
§Example
use hoomd_geometry::{Convex, shape::ConvexPolygon};
use hoomd_interaction::{
pairwise::ApproximateShapeOverlap, univariate::OverlapPenalty,
};
let approximate_shape_overlap = ApproximateShapeOverlap::new(
Convex(ConvexPolygon::regular(6)),
OverlapPenalty::default(),
0.01.try_into()?,
);Fields§
§shape_i: AThe site i’s shape.
shape_j: BThe site j’s shape.
isotropic: EPotential to apply as a function of the signed distance between shapes.
resolution: PositiveRealResolve the separation distance in multiples of this resolution.
Implementations§
Source§impl<E, G> ApproximateShapeOverlap<E, G>
impl<E, G> ApproximateShapeOverlap<E, G>
Sourcepub fn new(shape: G, isotropic: E, resolution: PositiveReal) -> Selfwhere
G: Clone,
pub fn new(shape: G, isotropic: E, resolution: PositiveReal) -> Selfwhere
G: Clone,
Construct a new approximate shape overlap potential.
new() sets both shape_i and shape_j to shape. Use struct
initialization syntax when you need to set these separately.
§Example
use hoomd_geometry::{Convex, shape::ConvexPolygon};
use hoomd_interaction::{
pairwise::ApproximateShapeOverlap, univariate::OverlapPenalty,
};
let approximate_shape_overlap = ApproximateShapeOverlap::new(
Convex(ConvexPolygon::regular(6)),
OverlapPenalty::default(),
0.01.try_into()?,
);Trait Implementations§
Source§impl<E, A, B, V, R> AnisotropicEnergy<V, R> for ApproximateShapeOverlap<E, A, B>
impl<E, A, B, V, R> AnisotropicEnergy<V, R> for ApproximateShapeOverlap<E, A, B>
Source§fn energy(&self, r_ij: &V, o_ij: &R) -> f64
fn energy(&self, r_ij: &V, o_ij: &R) -> f64
Evaluate the energy contribution from a pair of sites.
use hoomd_geometry::{Convex, shape::ConvexPolygon};
use hoomd_interaction::{
SitePairEnergy,
pairwise::{Anisotropic, ApproximateShapeOverlap},
univariate::OverlapPenalty,
};
use hoomd_microstate::property::OrientedPoint;
use hoomd_vector::{Angle, Cartesian};
let approximate_shape_overlap = Anisotropic {
interaction: ApproximateShapeOverlap::new(
Convex(ConvexPolygon::regular(6)),
OverlapPenalty::default(),
0.01.try_into()?,
),
r_cut: 1.0,
};
let a = OrientedPoint {
position: Cartesian::from([0.0, 0.0]),
orientation: Angle::default(),
};
let b = OrientedPoint {
position: Cartesian::from([0.6, 0.0]),
orientation: Angle::default(),
};
let energy = approximate_shape_overlap.site_pair_energy(&a, &b);
assert!(energy >= 100.0);
let c = OrientedPoint {
position: Cartesian::from([0.9, 0.0]),
orientation: Angle::default(),
};
let energy = approximate_shape_overlap.site_pair_energy(&a, &c);
assert!(energy >= 0.0);
assert!(energy < f64::INFINITY);
let d = OrientedPoint {
position: Cartesian::from([1.0, 0.0]),
orientation: Angle::default(),
};
let energy = approximate_shape_overlap.site_pair_energy(&a, &d);
assert_eq!(energy, 0.0);Source§impl<E: Clone, A: Clone, B: Clone> Clone for ApproximateShapeOverlap<E, A, B>
impl<E: Clone, A: Clone, B: Clone> Clone for ApproximateShapeOverlap<E, A, B>
Source§fn clone(&self) -> ApproximateShapeOverlap<E, A, B>
fn clone(&self) -> ApproximateShapeOverlap<E, A, B>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<'de, E, A, B> Deserialize<'de> for ApproximateShapeOverlap<E, A, B>
impl<'de, E, A, B> Deserialize<'de> for ApproximateShapeOverlap<E, A, B>
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<E: PartialEq, A: PartialEq, B: PartialEq> PartialEq for ApproximateShapeOverlap<E, A, B>
impl<E: PartialEq, A: PartialEq, B: PartialEq> PartialEq for ApproximateShapeOverlap<E, A, B>
Source§fn eq(&self, other: &ApproximateShapeOverlap<E, A, B>) -> bool
fn eq(&self, other: &ApproximateShapeOverlap<E, A, B>) -> bool
self and other values to be equal, and is used by ==.Source§impl<E, A, B> Serialize for ApproximateShapeOverlap<E, A, B>
impl<E, A, B> Serialize for ApproximateShapeOverlap<E, A, B>
impl<E, A, B> StructuralPartialEq for ApproximateShapeOverlap<E, A, B>
Auto Trait Implementations§
impl<E, A, B> Freeze for ApproximateShapeOverlap<E, A, B>
impl<E, A, B> RefUnwindSafe for ApproximateShapeOverlap<E, A, B>
impl<E, A, B> Send for ApproximateShapeOverlap<E, A, B>
impl<E, A, B> Sync for ApproximateShapeOverlap<E, A, B>
impl<E, A, B> Unpin for ApproximateShapeOverlap<E, A, B>
impl<E, A, B> UnsafeUnpin for ApproximateShapeOverlap<E, A, B>
impl<E, A, B> UnwindSafe for ApproximateShapeOverlap<E, A, B>
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