Skip to main content

Position

Trait Position 

Source
pub trait Position {
    type Position;

    // Required methods
    fn position(&self) -> &Self::Position;
    fn position_mut(&mut self) -> &mut Self::Position;
}
Expand description

Locate a site or body in space: $\vec{r}$

When applied to body properties, Position describes the location of the body relative to the origin of the system coordinate system.

When applied to site properties, Position has a context-dependent definition.

  • Elements in Microstate::sites have a position located in the system frame.
  • Elements in Body::sites have a position located in the body frame.

§Units

Position vectors have units of $[\mathrm{length}]$.

§Derive macro

Use the Position derive macro to automatically implement the Position trait on a type. The type must have a field named position.

use hoomd_microstate::property::Position;
use hoomd_vector::Cartesian;

#[derive(Position)]
struct Custom {
    position: Cartesian<3>,
}

Required Associated Types§

Source

type Position

Every position is located in this vector space.

Required Methods§

Source

fn position(&self) -> &Self::Position

The position of this body or site $[\mathrm{length}]$.

Source

fn position_mut(&mut self) -> &mut Self::Position

The mutable position of this body or site $[\mathrm{length}]$.

Implementors§