pub struct HarmonicRepulsion {
pub a: f64,
pub r_cut: f64,
}Expand description
Repulsive half of a quadratic potential well.
HarmonicRepulsion is the conservative part of the dissipative particle
dynamics soft potential. The parameter a controls the strength of the
potential and r_cut sets the distance at which the energy goes to 0.
The potential produce the radially repulsive force between particles as:
F(r) = \begin{cases}
-\frac{A}{r_\mathrm{cut}} \left( r - r_\mathrm{cut}\right) & r < r_\mathrm{cut} \\
0 & r \ge r_\mathrm{cut}
\end{cases}resulting from the potential energy:
U(r) = \begin{cases}
\frac{1}{2} \frac{A}{r_\mathrm{cut}} \left(r - r_\mathrm{cut}\right)^2 & r \lt r_\mathrm{cut} \\
0 & r \ge r_\mathrm{cut}
\end{cases}This potential forms the left half of a harmonic well centered at
$r = r_\mathrm{cut}$ with a spring constant $k = \frac{A}{r_\mathrm{cut}}$.
Note that this potential has a maximum value of $A$ at $r=0$ and is
therefore allows particles to completely overlap.
§Examples
use approxim::{assert_abs_diff_eq, assert_relative_eq};
use hoomd_interaction::univariate::{
HarmonicRepulsion, UnivariateEnergy, UnivariateForce,
};
let a = 1.0;
let r_cut = 1.0;
let h_repsulsion = HarmonicRepulsion { a, r_cut };
assert_abs_diff_eq!(h_repsulsion.energy(1.5), 0.0);
assert_relative_eq!(h_repsulsion.energy(0.5), 0.125);
assert_abs_diff_eq!(h_repsulsion.force(0.5), 0.5, epsilon = 1e-12);The parameters are public fields and may be accessed directly:
use hoomd_interaction::univariate::HarmonicRepulsion;
let mut h_repulsion = HarmonicRepulsion { a: 1.0, r_cut: 1.0 };
h_repulsion.a = 5.0;
h_repulsion.r_cut = 0.75;Fields§
§a: f64Potential strength $[\mathrm{energy}] [\mathrm{length}]^{-1}$.
r_cut: f64Distance cut-off $[\mathrm{length}]$.
Trait Implementations§
Source§impl Clone for HarmonicRepulsion
impl Clone for HarmonicRepulsion
Source§fn clone(&self) -> HarmonicRepulsion
fn clone(&self) -> HarmonicRepulsion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for HarmonicRepulsion
impl Debug for HarmonicRepulsion
Source§impl<'de> Deserialize<'de> for HarmonicRepulsion
impl<'de> Deserialize<'de> for HarmonicRepulsion
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 HarmonicRepulsion
impl PartialEq for HarmonicRepulsion
Source§impl Serialize for HarmonicRepulsion
impl Serialize for HarmonicRepulsion
Source§impl UnivariateEnergy for HarmonicRepulsion
impl UnivariateEnergy for HarmonicRepulsion
Source§impl UnivariateForce for HarmonicRepulsion
impl UnivariateForce for HarmonicRepulsion
impl StructuralPartialEq for HarmonicRepulsion
Auto Trait Implementations§
impl Freeze for HarmonicRepulsion
impl RefUnwindSafe for HarmonicRepulsion
impl Send for HarmonicRepulsion
impl Sync for HarmonicRepulsion
impl Unpin for HarmonicRepulsion
impl UnwindSafe for HarmonicRepulsion
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