Skip to main content

PeriodicBox

Struct PeriodicBox 

Source
pub struct PeriodicBox { /* private fields */ }
Expand description

An invertible unit-cell basis and its inverse.

Implementations§

Source§

impl PeriodicBox

Source

pub fn from_cell(cell: UnitCell) -> Result<Self, SpatialError>

Builds a periodic box from crystallographic lengths and angles.

§Errors

Returns SpatialError::InvalidCell when any parameter is non-finite, an edge is not positive, or the vectors are coplanar.

Source

pub fn displacement(&self, left: [f32; 3], right: [f32; 3]) -> [f32; 3]

The shortest periodic displacement from left to right.

The nearest rounded fractional image is sufficient for an orthogonal cell. In a skewed cell a neighbouring lattice translation can be shorter, so all twenty-seven candidates around it are checked in a fixed order.

Source

pub fn minimum_image(&self, left: [f32; 3], right: [f32; 3]) -> PeriodicImage

The shortest displacement and exact lattice image selected for it.

Exact distance ties retain the deposited image. Triclinic candidates are visited in a fixed order, so the selected image is deterministic.

Source

pub fn displacement_f64(&self, left: [f64; 3], right: [f64; 3]) -> [f64; 3]

Minimum-image displacement without rounding generated sample positions to stored-coordinate precision. Image selection matches minimum_image.

Source

pub fn distance_squared(&self, left: [f32; 3], right: [f32; 3]) -> f32

Squared minimum-image separation.

Source

pub fn fractional(&self, position: [f32; 3]) -> [f64; 3]

Converts a Cartesian position to fractional cell coordinates.

Source

pub fn cartesian(&self, fractional: [f64; 3]) -> [f32; 3]

Converts fractional cell coordinates to Cartesian ångström.

Source

pub fn wrap(&self, position: [f32; 3]) -> [f32; 3]

Wraps one position into the primary fractional interval [0, 1).

Source

pub fn interpolate( &self, left: [f32; 3], right: [f32; 3], amount: f64, ) -> Option<[f32; 3]>

Interpolates along the shortest periodic geodesic and wraps the result.

Returns None for a non-finite interpolation parameter. Values outside [0, 1] extrapolate along the same selected image.

Trait Implementations§

Source§

impl Clone for PeriodicBox

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for PeriodicBox

Source§

impl Debug for PeriodicBox

Source§

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

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

impl PartialEq for PeriodicBox

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for PeriodicBox

Auto Trait Implementations§

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.