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 sites and bodies.

When applied to site properties, Position describes the location of the site relative to the origin of the body. In other words, it is the position of the site in the body reference frame.

When applied to body properties Position describes the location of the body relative to the origin of the system coordinate system. In other words, it is the position of the body’s origin in the system reference frame.

§Units

Position vectors have units of [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 [length].

Source

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

The mutable position of this body or site [length].

Implementors§