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

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

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)

&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

&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)

&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<'a> From<&'a UnitCell> for UnitCell`

`impl Copy for UnitCell`

`impl PartialEq<UnitCell> for UnitCell`

`impl Clone for UnitCell`

`fn clone(&self) -> UnitCell`

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

1.0.0[src]

Performs copy-assignment from `source`

. Read more

`impl Debug for UnitCell`

## Auto Trait Implementations

## Blanket Implementations

`impl<T> From for T`

[src]

`impl<T, U> Into for T where`

U: From<T>,

[src]

U: From<T>,

`impl<T> ToOwned for T where`

T: Clone,

[src]

T: Clone,

`impl<T, U> TryFrom for T where`

T: From<U>,

[src]

T: From<U>,

`type Error = !`

`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]

`impl<T> Borrow for T where`

T: ?Sized,

[src]

T: ?Sized,

`impl<T> BorrowMut for T where`

T: ?Sized,

[src]

T: ?Sized,

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

[src]

`impl<T, U> TryInto for T where`

U: TryFrom<T>,

[src]

U: TryFrom<T>,

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

`try_from`

)The type returned in the event of a conversion error.

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

[src]

`impl<T> Any for T where`

T: 'static + ?Sized,

[src]

T: 'static + ?Sized,