Struct gosh_elastic::Spring
source · pub struct Spring { /* private fields */ }
Expand description
Represents an elastic spring between a central node i and with its neighboring node j.
Implementations§
source§impl Spring
impl Spring
sourcepub fn new(wij: f64) -> Self
pub fn new(wij: f64) -> Self
Construct an Spring
for elastic interaction between node i
and node
j
Parameters
- wij: the weight (elastic constant) of spring
sourcepub fn with_length(self, dij: f64) -> Self
pub fn with_length(self, dij: f64) -> Self
Set optional natural length of spring. The default value is 0.
sourcepub fn energy_force(
&self,
displace: impl Into<Vector3f>,
distance: impl Into<Option<f64>>
) -> (f64, Vector3f)
pub fn energy_force(
&self,
displace: impl Into<Vector3f>,
distance: impl Into<Option<f64>>
) -> (f64, Vector3f)
Returns energy and the force contribution of its neighbor j to center i.
displace
is the displacement vector from center i to its neighbor j.
distance
is optional, if not set, it will be evaluated from
displacement vector.
Trait Implementations§
impl Copy for Spring
Auto Trait Implementations§
impl RefUnwindSafe for Spring
impl Send for Spring
impl Sync for Spring
impl Unpin for Spring
impl UnwindSafe for Spring
Blanket Implementations§
§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.