# [−]Struct lumol::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.

## Implementations

### 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.

## Blanket Implementations

### impl<T> Pointable for T

#### type Init = T

The type for initializers.

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

#### type Owned = T

The resulting type after obtaining ownership.

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

#### type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.