Skip to main content

Point

Struct Point 

Source
pub struct Point<P> {
    pub position: P,
}
Expand description

A position in space and nothing more.

Use Point as a Body or Site property type.

§Example

use hoomd_microstate::property::Point;
use hoomd_vector::Cartesian;

let point = Point::new(Cartesian::from([1.0, -2.0, 3.0]));

Fields§

§position: P

The location of the point in space.

Implementations§

Source§

impl<P> Point<P>

Source

pub fn new(position: P) -> Self

Construct a new point at the given position.

§Example
use hoomd_microstate::property::Point;
use hoomd_vector::Cartesian;

let point = Point::new(Cartesian::from([1.0, -2.0, 3.0]));

Trait Implementations§

Source§

impl<B, X> AppendMicrostate<B, Point<Cartesian<2>>, X, Closed<Hypercuboid<2>>> for HoomdGsdFile

Source§

fn append_microstate( &mut self, microstate: &Microstate<B, Point<Cartesian<2>>, X, Closed<Hypercuboid<2>>>, ) -> Result<Frame<'_>, AppendError>

Append the contents of the microstate as a frame in a GSD file. Read more
Source§

impl<B, X> AppendMicrostate<B, Point<Cartesian<2>>, X, Periodic<Hypercuboid<2>>> for HoomdGsdFile

Source§

fn append_microstate( &mut self, microstate: &Microstate<B, Point<Cartesian<2>>, X, Periodic<Hypercuboid<2>>>, ) -> Result<Frame<'_>, AppendError>

Append the contents of the microstate as a frame in a GSD file. Read more
Source§

impl<B, X> AppendMicrostate<B, Point<Cartesian<3>>, X, Closed<Hypercuboid<3>>> for HoomdGsdFile

Source§

fn append_microstate( &mut self, microstate: &Microstate<B, Point<Cartesian<3>>, X, Closed<Hypercuboid<3>>>, ) -> Result<Frame<'_>, AppendError>

Append the contents of the microstate as a frame in a GSD file. Read more
Source§

impl<B, X> AppendMicrostate<B, Point<Cartesian<3>>, X, Periodic<Hypercuboid<3>>> for HoomdGsdFile

Source§

fn append_microstate( &mut self, microstate: &Microstate<B, Point<Cartesian<3>>, X, Periodic<Hypercuboid<3>>>, ) -> Result<Frame<'_>, AppendError>

Append the contents of the microstate as a frame in a GSD file. Read more
Source§

impl<P: Clone> Clone for Point<P>

Source§

fn clone(&self) -> Point<P>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<P: Debug> Debug for Point<P>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<P: Default> Default for Point<P>

Source§

fn default() -> Point<P>

Returns the “default value” for a type. Read more
Source§

impl<'de, P> Deserialize<'de> for Point<P>
where P: Deserialize<'de>,

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl GenerateGhosts<Point<Hyperbolic<3>>> for Periodic<EightEight>

Source§

fn generate_ghosts( &self, site_properties: &Point<Hyperbolic<3>>, ) -> ArrayVec<Point<Hyperbolic<3>>, MAX_GHOSTS>

Place periodic images of sites near the edge of the periodic boundary

Source§

fn maximum_interaction_range(&self) -> f64

The largest interaction distance between sites. Read more
Source§

impl<P: PartialEq> PartialEq for Point<P>

Source§

fn eq(&self, other: &Point<P>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<P> Position for Point<P>

Source§

type Position = P

Every position is located in this vector space.
Source§

fn position(&self) -> &P

The position of this body or site [length].
Source§

fn position_mut(&mut self) -> &mut P

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

impl<P> Serialize for Point<P>
where P: Serialize,

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl<const N: usize> Transform<Point<Cartesian<N>>> for Point<Cartesian<N>>

Move Point properties from the local body frame to the system frame.

Source§

fn transform( &self, site_properties: &Point<Cartesian<N>>, ) -> Point<Cartesian<N>>

Points transform by vector addition.

\vec{r} = \vec{r}_\mathrm{body} + \vec{r}_\mathrm{site}
use hoomd_microstate::{Transform, property::Point};
use hoomd_vector::Cartesian;

let body_properties = Point::new(Cartesian::from([1.0, -2.0, 3.0]));
let site_properties = Point::new(Cartesian::from([-3.0, 2.0, 1.0]));

let system_site = body_properties.transform(&site_properties);
assert_eq!(system_site.position, [-2.0, 0.0, 4.0].into());
Source§

impl Transform<Point<Hyperbolic<3>>> for OrientedHyperbolicPoint<3, Angle>

Treat Point<Hyperbolic<3>> sites as constituents of oriented rigid bodies.

Source§

fn transform( &self, site_properties: &Point<Hyperbolic<3>>, ) -> Point<Hyperbolic<3>>

Move Point<Hyperbolic<3>> properties from the local body frame to the system frame.

use approxim::assert_relative_eq;
use hoomd_manifold::Hyperbolic;
use hoomd_microstate::{
    Transform,
    property::{OrientedHyperbolicPoint, Point},
};
use hoomd_vector::Angle;
use std::f64::consts::PI;

let body_boost = 1.1;
let body_orientation = PI / 2.0;
let site_boost = 0.1;
let body = OrientedHyperbolicPoint {
    position: Hyperbolic::<3>::from_polar_coordinates(body_boost, 0.0),
    orientation: Angle::from(body_orientation),
};
let site = Point::new(Hyperbolic::<3>::from_polar_coordinates(
    site_boost,
    -PI / 4.0,
));
let transformed_site = body.transform(&site);
assert_relative_eq!(
    *transformed_site.position.point(),
    [
        (body_boost.sinh()) * (site_boost.cosh())
            + ((PI / 4.0).cos())
                * (body_boost.cosh())
                * (site_boost.sinh()),
        ((PI / 4.0).sin()) * site_boost.sinh(),
        (body_boost.cosh()) * (site_boost.cosh())
            + ((PI / 4.0).cos())
                * (body_boost.sinh())
                * (site_boost.sinh()),
    ]
    .into(),
    epsilon = 1e-12
);
Source§

impl Transform<Point<Hyperbolic<3>>> for Point<Hyperbolic<3>>

Source§

fn transform( &self, site_properties: &Point<Hyperbolic<3>>, ) -> Point<Hyperbolic<3>>

Move Point<Hyperbolic<3>> properties from the local body frame to the system frame.

All positions in hyperbolic space are associated with some $SO(2,1)$ transformation which translates the origin to that position. The local body frame is the frame in which the body position is the origin. The position of the sites in the system frame is obtained by applying the transformation associated with the body’s position to the sites in the local body frame.

Source§

impl Transform<Point<Hyperbolic<4>>> for Point<Hyperbolic<4>>

Source§

fn transform( &self, site_properties: &Point<Hyperbolic<4>>, ) -> Point<Hyperbolic<4>>

Move Point<Hyperbolic<4>> properties from the local body frame to the system frame.

All positions in hyperbolic space are associated with some $SO(3,1)$ transformation which translates the origin to that position. The local body frame is the frame in which the body position is the origin. The position of the sites in the system frame is obtained by applying the transformation associated with the body’s position to the sites in the local body frame.

Source§

impl Transform<Point<Spherical<3>>> for Point<Spherical<3>>

Source§

fn transform( &self, site_properties: &Point<Spherical<3>>, ) -> Point<Spherical<3>>

Move Point<Sphere<3>> properties from the local body frame to the system frame.

All positions on the 2-sphere are associated with some $SO(3)$ transformation which translates the origin to that position. The local body frame is the frame in which the body position is the origin. The position of the sites in the system frame is obtained by applying the transformation associated with the body’s position to the sites in the local body frame.

Source§

impl Transform<Point<Spherical<4>>> for Point<Spherical<4>>

Source§

fn transform( &self, site_properties: &Point<Spherical<4>>, ) -> Point<Spherical<4>>

Move Point<Sphere<4>> properties from the local body frame to the system frame.

All positions on the 3-sphere are associated with some $SO(4)$ transformation which translates the origin to that position. The local body frame is the frame in which the body position is the origin. The position of the sites in the system frame is obtained by applying the transformation associated with the body’s position to the sites in the local body frame.

Source§

impl<V, R> Transform<Point<V>> for OrientedPoint<V, R>
where V: Vector, R: Rotate<V>,

Treat Point sites as constituents of oriented rigid bodies.

Source§

fn transform(&self, site_properties: &Point<V>) -> Point<V>

Move Point properties from the local body frame to the system frame.

\vec{r} = \vec{r}_\mathrm{body} + R_\mathrm{body}(\vec{r}_\mathrm{site})
use approxim::assert_relative_eq;
use hoomd_microstate::{
    Transform,
    property::{OrientedPoint, Point},
};
use hoomd_vector::{Angle, Cartesian};
use std::f64::consts::PI;

let body_properties = OrientedPoint {
    position: Cartesian::from([1.0, -2.0]),
    orientation: Angle::from(PI / 2.0),
};
let site_properties = Point::new(Cartesian::from([-1.0, 0.0]));

let system_site = body_properties.transform(&site_properties);
assert_relative_eq!(system_site.position, [1.0, -3.0].into());
Source§

impl Wrap<Point<Hyperbolic<3>>> for Periodic<EightEight>

Source§

fn wrap( &self, properties: Point<Hyperbolic<3>>, ) -> Result<Point<Hyperbolic<3>>, Error>

Wrap a point on the Hyperbolic to the inside of the {8,8} tile.

Note that the function fails to wrap points that are outside the octagon and further than EightEight::EDGE_LENGTH/2 from any of the vertices. In this case, the function returns Error::CannotWrapProperties

§Example
use approxim::assert_relative_eq;
use hoomd_geometry::shape::EightEight;
use hoomd_manifold::Hyperbolic;
use hoomd_microstate::{
    boundary::{Periodic, Wrap},
    property::Point,
};
use std::f64::consts::PI;

const EIGHTEIGHT: f64 = EightEight::EIGHTEIGHT;
let offset = PI / 8.0;
let boost = 2.0;
let point =
    Hyperbolic::<3>::from_polar_coordinates(boost, offset + PI / 4.0);
let point = Point::new(point);
let periodic = Periodic::new(0.5, EightEight {})?;

let wrapped_point = periodic.wrap(point)?;

let new_boost = 2.0
    * (EIGHTEIGHT.tanh()
        / (offset.cos() - offset.sin() * (1.0 - (2.0_f64).sqrt())))
    .atanh()
    - boost;
let ans = Hyperbolic::<3>::from_polar_coordinates(
    new_boost,
    6.0 * PI / 4.0 - offset,
);
assert_relative_eq!(
    ans.coordinates()[0],
    wrapped_point.position.coordinates()[0],
    epsilon = 1e-12
);
assert_relative_eq!(
    ans.coordinates()[1],
    wrapped_point.position.coordinates()[1],
    epsilon = 1e-12
);
assert_relative_eq!(
    ans.coordinates()[2],
    wrapped_point.position.coordinates()[2],
    epsilon = 1e-12
);
Source§

impl<P: Copy> Copy for Point<P>

Source§

impl<P> StructuralPartialEq for Point<P>

Auto Trait Implementations§

§

impl<P> Freeze for Point<P>
where P: Freeze,

§

impl<P> RefUnwindSafe for Point<P>
where P: RefUnwindSafe,

§

impl<P> Send for Point<P>
where P: Send,

§

impl<P> Sync for Point<P>
where P: Sync,

§

impl<P> Unpin for Point<P>
where P: Unpin,

§

impl<P> UnsafeUnpin for Point<P>
where P: UnsafeUnpin,

§

impl<P> UnwindSafe for Point<P>
where P: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,