# [−]Struct lumol::sys::UnitCell

pub struct UnitCell { /* fields omitted */ }

An UnitCell defines the system physical boundaries.

The shape of the cell can be any of the CellShape, and will influence how periodic boundary conditions are applied.

## Methods

### impl UnitCell

#### pub fn infinite() -> UnitCell

Create an infinite unit cell

#### pub fn ortho(a: f64, b: f64, c: f64) -> UnitCell

Create an orthorhombic unit cell, with side lengths a, b, c.

#### pub fn cubic(length: f64) -> UnitCell

Create a cubic unit cell, with side lengths length, length, length.

#### pub fn triclinic(    a: f64,     b: f64,     c: f64,     alpha: f64,     beta: f64,     gamma: f64) -> UnitCell

Create a triclinic unit cell, with side lengths a, b, c and angles alpha, beta, gamma.

#### pub fn shape(&self) -> CellShape

Get the cell shape

#### pub fn is_infinite(&self) -> bool

Check if this unit cell is infinite, i.e. if it does not have periodic boundary conditions.

#### pub fn a(&self) -> f64

Get the first length of the cell (i.e. the norm of the first vector of the cell)

#### pub fn b(&self) -> f64

Get the second length of the cell (i.e. the norm of the second vector of the cell)

#### pub fn c(&self) -> f64

Get the third length of the cell (i.e. the norm of the third vector of the cell)

#### pub fn lengths(&self) -> Vector3D

Get the distances between faces of the unit cell

#### pub fn alpha(&self) -> f64

Get the first angle of the cell

#### pub fn beta(&self) -> f64

Get the second angle of the cell

#### pub fn gamma(&self) -> f64

Get the third angle of the cell

#### pub fn volume(&self) -> f64

Get the volume of the cell

#### pub fn scale_mut(&mut self, factor: Matrix3)

Scale this unit cell in-place by multiplying the cell matrix by factor.

#### pub fn scale(&self, s: Matrix3) -> UnitCell

Scale this unit cell by multiplying the cell matrix by s, and return a new scaled unit cell

#### pub fn k_vector(&self, index: [f64; 3]) -> Vector3D

Get the reciprocal vector with the given index. This vector is null for infinite cells.

#### pub fn matrix(&self) -> Matrix3

Get the matricial representation of the unit cell

### impl UnitCell

Geometric operations using periodic boundary conditions

#### pub fn wrap_vector(&self, vect: &mut Vector3D)

Wrap a vector in the unit cell, obeying the periodic boundary conditions. For a cubic cell of side length L, this produce a vector with all components in [0, L).

#### pub fn vector_image(&self, vect: &mut Vector3D)

Find the image of a vector in the unit cell, obeying the periodic boundary conditions. For a cubic cell of side length L, this produce a vector with all components in [-L/2, L/2).

#### pub fn fractional(&self, vector: &Vector3D) -> Vector3D

Get the fractional representation of the vector in this cell

#### pub fn cartesian(&self, fractional: &Vector3D) -> Vector3D

Get the Cartesian representation of the fractional vector in this cell

#### pub fn distance(&self, u: &Vector3D, v: &Vector3D) -> f64

Periodic boundary conditions distance between the point u and the point v

#### pub fn angle(&self, r1: &Vector3D, r2: &Vector3D, r3: &Vector3D) -> f64

Get the angle formed by the points at r1, r2 and r3 using periodic boundary conditions.

#### pub fn angle_and_derivatives(    &self,     r1: &Vector3D,     r2: &Vector3D,     r3: &Vector3D) -> (f64, Vector3D, Vector3D, Vector3D)

Get the angle formed by the points at r1, r2 and r3 using periodic boundary conditions and its derivatives.

#### pub fn dihedral(    &self,     r1: &Vector3D,     r2: &Vector3D,     r3: &Vector3D,     r4: &Vector3D) -> f64

Get the dihedral angle formed by the points at r1, r2, r3, and r4 using periodic boundary conditions.

#### pub fn dihedral_and_derivatives(    &self,     r1: &Vector3D,     r2: &Vector3D,     r3: &Vector3D,     r4: &Vector3D) -> (f64, Vector3D, Vector3D, Vector3D, Vector3D)

Get the dihedral angle and and its derivatives defined by the points at r1, r2, r3, and r4 using periodic boundary conditions.

## Trait Implementations

### impl PartialEq<UnitCell> for UnitCell

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

This method tests for self and other values to be equal, and is used by ==. Read more

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

This method tests for !=.

### impl Debug for UnitCell

#### fn fmt(&self, f: &mut Formatter) -> Result<(), Error>

Formats the value using the given formatter. Read more

### impl Clone for UnitCell

#### fn clone(&self) -> UnitCell

Returns a copy of the value. Read more

#### fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

## Blanket Implementations

### impl<T> ToOwned for T where    T: Clone, [src]

#### fn to_owned(&self) -> T[src]

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

#### fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

### impl<T> From for T[src]

#### fn from(t: T) -> T[src]

Performs the conversion.

### impl<T, U> Into for T where    U: From<T>, [src]

#### fn into(self) -> U[src]

Performs the conversion.

### impl<T, U> TryFrom for T where    T: From<U>, [src]

#### type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

### impl<T> Borrow for T where    T: ?Sized, [src]

#### ⓘImportant traits for &'a mut R### Important traits for &'a mut R impl<'a, R> Read for &'a mut R where    R: Read + ?Sized, impl<'a, W> Write for &'a mut W where    W: Write + ?Sized, impl<'a, I> Iterator for &'a mut I where    I: Iterator + ?Sized,  type Item = <I as Iterator>::Item;fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

### impl<T, U> TryInto for T where    U: TryFrom<T>, [src]

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

🔬 This is a nightly-only experimental API. (try_from)

Performs the conversion.

### impl<T> BorrowMut for T where    T: ?Sized, [src]

#### ⓘImportant traits for &'a mut R### Important traits for &'a mut R impl<'a, R> Read for &'a mut R where    R: Read + ?Sized, impl<'a, W> Write for &'a mut W where    W: Write + ?Sized, impl<'a, I> Iterator for &'a mut I where    I: Iterator + ?Sized,  type Item = <I as Iterator>::Item;fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

### impl<T> Any for T where    T: 'static + ?Sized, [src]

#### fn get_type_id(&self) -> TypeId[src]

🔬 This is a nightly-only experimental API. (get_type_id)

this method will likely be replaced by an associated static

Gets the TypeId of self. Read more