pub struct Site<S> {
pub site_tag: usize,
pub body_tag: usize,
pub properties: S,
}Expand description
Interactions in hoomd-rs apply between sites.
A Site (often called an atom or a particle in other codes) has a
tag that uniquely identities it in the Microstate and is associated
with a given body (see Body). All interactions in hoomd-rs occur
on or between sites as a function of their properties which has the
generic type S. At a minimum, Microstate assumes that S implements
Position. S is generic so that users can build custom
types that store orientation, charge, mass, color, or whatever other fields are
needed to implement their model.
Add sites to the Microstate as members of bodies (Body).
§Example
Find the center of all interaction sites in a Microstate:
use hoomd_microstate::{Body, Microstate, MicrostateBuilder};
use hoomd_vector::{Cartesian, Vector};
let microstate = Microstate::builder()
.bodies([
Body::point(Cartesian::from([1.0, 0.0])),
Body::point(Cartesian::from([-1.0, 2.0])),
])
.try_build()?;
let average_site_position = microstate
.sites()
.iter()
.map(|site| site.properties.position)
.sum::<Cartesian<2>>()
/ (microstate.sites().len() as f64);Fields§
§site_tag: usizeEvery site in a Microstate has a unique value in site_tag.
body_tag: usizeThe body tag of the Body associated with this site.
properties: SThe properties of the site.
Trait Implementations§
Source§impl<'de, S> Deserialize<'de> for Site<S>where
S: Deserialize<'de>,
impl<'de, S> Deserialize<'de> for Site<S>where
S: Deserialize<'de>,
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>,
impl<S: Copy> Copy for Site<S>
impl<S> StructuralPartialEq for Site<S>
Auto Trait Implementations§
impl<S> Freeze for Site<S>where
S: Freeze,
impl<S> RefUnwindSafe for Site<S>where
S: RefUnwindSafe,
impl<S> Send for Site<S>where
S: Send,
impl<S> Sync for Site<S>where
S: Sync,
impl<S> Unpin for Site<S>where
S: Unpin,
impl<S> UnsafeUnpin for Site<S>where
S: UnsafeUnpin,
impl<S> UnwindSafe for Site<S>where
S: UnwindSafe,
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