# [−]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`

`impl UnitCell`

`pub fn infinite() -> UnitCell`

`pub fn infinite() -> UnitCell`

Create an infinite unit cell

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

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

`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

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

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

Get the cell shape

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

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

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

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

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

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

Get the distances between faces of the unit cell

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

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

Get the first angle of the cell

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

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

Get the second angle of the cell

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

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

Get the third angle of the cell

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

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

Get the volume of the cell

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

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

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

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

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

Get the matricial representation of the unit cell

`impl UnitCell`

`impl UnitCell`

Geometric operations using periodic boundary conditions

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

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

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

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

Get the fractional representation of the `vector`

in this cell

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

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

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

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

`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

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

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

`impl PartialEq<UnitCell> for UnitCell`

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

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

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

This method tests for `!=`

.

`impl Debug for UnitCell`

`impl Debug for UnitCell`

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

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

Formats the value using the given formatter. Read more

`impl Copy for UnitCell`

`impl Copy for UnitCell`

`impl Clone for UnitCell`

`impl Clone for UnitCell`

## Auto Trait Implementations

## Blanket Implementations

`impl<T> ToOwned for T where`

T: Clone,

[src]

`impl<T> ToOwned for T where`

T: Clone,

`type Owned = T`

`fn to_owned(&self) -> T`

[src]

`fn to_owned(&self) -> T`

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

`fn clone_into(&self, target: &mut T)`

[src]

`fn clone_into(&self, target: &mut T)`

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

)

recently added

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

`impl<T> From for T`

[src]

`impl<T> From for T`

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

U: From<T>,

[src]

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

U: From<T>,

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

T: From<U>,

[src]

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

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]

`fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>`

`try_from`

)Performs the conversion.

`impl<T> Borrow for T where`

T: ?Sized,

[src]

`impl<T> Borrow for T where`

T: ?Sized,

#### ⓘImportant traits for &'a mut R`fn borrow(&self) -> &T`

[src]

`fn borrow(&self) -> &T`

Immutably borrows from an owned value. Read more

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

U: TryFrom<T>,

[src]

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

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]

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

`try_from`

)Performs the conversion.

`impl<T> BorrowMut for T where`

T: ?Sized,

[src]

`impl<T> BorrowMut for T where`

T: ?Sized,

#### ⓘImportant traits for &'a mut R`fn borrow_mut(&mut self) -> &mut T`

[src]

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

Mutably borrows from an owned value. Read more

`impl<T> Any for T where`

T: 'static + ?Sized,

[src]

`impl<T> Any for T where`

T: 'static + ?Sized,

`fn get_type_id(&self) -> TypeId`

[src]

`fn get_type_id(&self) -> TypeId`

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