Expand description
Traits that describe body and/or site properties a a selection types that implement them.
See the crate-level documentation for an overview of how body and site
properties interact with Microstate and model methods.
§Provided types
The structs provided in property may be used as Body and/or
Site properties.
Point represents a position in space:
use hoomd_microstate::property::Point;
use hoomd_vector::Cartesian;
let point = Point::new(Cartesian::from([1.0, -3.0]));OrientedPoint contains both the position and orientation of an extended body:
use hoomd_microstate::property::OrientedPoint;
use hoomd_vector::{Angle, Cartesian};
let point = OrientedPoint {
position: Cartesian::from([1.0, -3.0]),
orientation: Angle::from(1.2),
};DynamicPoint is a point in space with mass and momentum:
use hoomd_microstate::property::DynamicPoint;
use hoomd_vector::Cartesian;
let dynamic_point = DynamicPoint {
position: Cartesian::from([1.0, -3.0]),
momentum: Cartesian::from([-1.0, 2.0]),
mass: 0.5,
..Default::default()
};DynamicOrientedPoint is an extended body with position, orientation, mass, momentum,
a moment of inertia, and angular momentum:
use hoomd_microstate::property::DynamicOrientedPoint;
use hoomd_vector::{Angle, Cartesian};
use std::f64::consts::PI;
let dynamic_point = DynamicOrientedPoint {
position: Cartesian::from([1.0, -3.0]),
orientation: Angle::from(PI / 4.0),
momentum: Cartesian::from([-1.0, 2.0]),
mass: 0.5,
moment_of_inertia: 2.0,
angular_momentum: 1.5,
..Default::default()
};Use the Point, OrientedPoint or a custom type to represent interaction sites.
Point and OrientedPoint can also be used for body properties in Monte Carlo simulations.
Use the Dynamic variants for body properties in molecular dynamics simulations.
§Custom property types
When none of the provided types meets your needs, you can define a custom type.
You must implement Position for your type and may implement other
property traits as needed by your model.
For example, this Custom type implements Position, Orientation,
and has a custom field. The full site properties type is available when
hoomd-rs computes interactions on sites, so you can use the custom fields
in your own custom interaction potentials.
use hoomd_microstate::property::{Orientation, Position};
use hoomd_vector::{Cartesian, Versor};
#[derive(Position, Orientation)]
struct Custom {
position: Cartesian<3>,
orientation: Versor,
custom: f64,
}§Transformations
Implement Transform to take sites from the body frame to the system frame.
Typically, this involves transforming position and orientation while leaving
all other fields unchanged. The three most common implementations of Transform
follow. All these examples are in 3D. To convert to 2D, replace Cartesian<3>
with Cartesian<2> and Versor with Angle.
Non-oriented bodies and sites (i.e. point particles or non-rotating rigid bodies):
use hoomd_microstate::{
Transform,
property::{Point, Position},
};
use hoomd_vector::Cartesian;
#[derive(Position)]
struct Custom {
position: Cartesian<3>,
custom: f64,
}
impl Transform<Custom> for Point<Cartesian<3>> {
fn transform(&self, site_properties: &Custom) -> Custom {
Custom {
position: self.position + site_properties.position,
..*site_properties
}
}
}Oriented bodies and non-oriented sites (i.e. rotating rigid bodies with isotropic site-site interactions):
use hoomd_microstate::{
Transform,
property::{OrientedPoint, Position},
};
use hoomd_vector::{Cartesian, Rotate, Rotation, Versor};
#[derive(Position)]
struct Custom {
position: Cartesian<3>,
custom: f64,
}
impl Transform<Custom> for OrientedPoint<Cartesian<3>, Versor> {
fn transform(&self, site_properties: &Custom) -> Custom {
Custom {
position: self.position
+ self.orientation.rotate(&site_properties.position),
..*site_properties
}
}
}Oriented bodies and oriented sites (i.e. rotating rigid bodies with anisotropic site-site interactions):
use hoomd_microstate::{
Transform,
property::{Orientation, OrientedPoint, Position},
};
use hoomd_vector::{Cartesian, Rotate, Rotation, Versor};
#[derive(Position, Orientation)]
struct Custom {
position: Cartesian<3>,
orientation: Versor,
custom: f64,
}
impl Transform<Custom> for OrientedPoint<Cartesian<3>, Versor> {
fn transform(&self, site_properties: &Custom) -> Custom {
Custom {
position: self.position
+ self.orientation.rotate(&site_properties.position),
orientation: self
.orientation
.combine(&site_properties.orientation),
..*site_properties
}
}
}Structs§
- Dynamic
Oriented Point - A position in space with the properties necessary for translational and rotational motion in MD.
- Dynamic
Point - A position in space with the properties necessary for translational motion in MD.
- Oriented
Hyperbolic Point - The position and orientation of an extended body in hyperbolic space.
- Oriented
Point - A position in space with an orientation.
- Point
- A position in space and nothing more.
Traits§
- Angular
Momentum - The rotational motion of a body: $
\vec{L}$ - Mass
- A body’s resistance to change in translational motion: $
m$ - Moment
OfInertia - A body’s resistance to a change in rotational motion: $
I$ - Momentum
- The translational motion of a body: $
\vec{p}$ - NetForce
- The total force acting on a site or body: $
\vec{F}$ - NetTorque
- The total torque acting on a body: $
\vec{\tau}$ - NetVirial
- The total virial acting on a site or body: $
\mathbf{W}$ - Orientation
- The orientation of a site or body: $
\theta$ or $\mathbf{q}$. - Position
- Locate a site or body in space: $
\vec{r}$ - Rotational
Motion Types - Moment of inertia and angular momentum types.
Derive Macros§
- Orientation
- Automatically implement the
hoomd_microstate::property::Orientationtrait. - Position
- Automatically implement the
hoomd_microstate::property::Positiontrait.