pub struct PeriodicBox { /* private fields */ }Expand description
An invertible unit-cell basis and its inverse.
Implementations§
Source§impl PeriodicBox
impl PeriodicBox
Sourcepub fn from_cell(cell: UnitCell) -> Result<Self, SpatialError>
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.
Sourcepub fn displacement(&self, left: [f32; 3], right: [f32; 3]) -> [f32; 3]
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.
Sourcepub fn minimum_image(&self, left: [f32; 3], right: [f32; 3]) -> PeriodicImage
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.
Sourcepub fn displacement_f64(&self, left: [f64; 3], right: [f64; 3]) -> [f64; 3]
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.
Sourcepub fn distance_squared(&self, left: [f32; 3], right: [f32; 3]) -> f32
pub fn distance_squared(&self, left: [f32; 3], right: [f32; 3]) -> f32
Squared minimum-image separation.
Sourcepub fn fractional(&self, position: [f32; 3]) -> [f64; 3]
pub fn fractional(&self, position: [f32; 3]) -> [f64; 3]
Converts a Cartesian position to fractional cell coordinates.
Sourcepub fn cartesian(&self, fractional: [f64; 3]) -> [f32; 3]
pub fn cartesian(&self, fractional: [f64; 3]) -> [f32; 3]
Converts fractional cell coordinates to Cartesian ångström.
Trait Implementations§
Source§impl Clone for PeriodicBox
impl Clone for PeriodicBox
impl Copy for PeriodicBox
Source§impl Debug for PeriodicBox
impl Debug for PeriodicBox
Source§impl PartialEq for PeriodicBox
impl PartialEq for PeriodicBox
impl StructuralPartialEq for PeriodicBox
Auto Trait Implementations§
impl Freeze for PeriodicBox
impl RefUnwindSafe for PeriodicBox
impl Send for PeriodicBox
impl Sync for PeriodicBox
impl Unpin for PeriodicBox
impl UnsafeUnpin for PeriodicBox
impl UnwindSafe for PeriodicBox
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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