Struct bader::atoms::Lattice

source ·
pub struct Lattice {
    pub cartesian_shift_matrix: [[f64; 3]; 27],
    pub to_fractional: [[f64; 3]; 3],
    pub to_cartesian: [[f64; 3]; 3],
    pub reduced_cartesian_shift_matrix: [[f64; 3]; 27],
    pub reduced_grid_shift_matrix: Vec<Vec<usize>>,
    pub reduced_to_fractional: [[f64; 3]; 3],
    pub reduced_to_cartesian: [[f64; 3]; 3],
    pub volume: f64,
}
Expand description

Lattice - structure for containing information on the cell

shift matrix ordering:
    0 -> (-1,-1,-1)   7 -> (-1, 1, 0)  14 -> (0, 0, 1)  21 -> (1, 0,-1)
    1 -> (-1,-1, 0)   8 -> (-1, 1, 1)  15 -> (0, 1,-1)  22 -> (1, 0, 0)
    2 -> (-1,-1, 1)   9 -> (0,-1,-1)   16 -> (0, 1, 0)  23 -> (1, 0, 1)
    3 -> (-1, 0,-1)  10 -> (0,-1, 0)   17 -> (0, 1, 1)  24 -> (1, 1,-1)
    4 -> (-1, 0, 0)  11 -> (0,-1, 1)   18 -> (1,-1,-1)  25 -> (1, 1, 0)
    5 -> (-1, 0, 1)  12 -> (0, 0,-1)   19 -> (1,-1, 0)  26 -> (1, 1, 1)
    6 -> (-1, 1,-1)  13 -> (0, 0, 0)   20 -> (1,-1, 1)

Fields§

§cartesian_shift_matrix: [[f64; 3]; 27]

The cartesian vectors for every combination of lattice vector.

§to_fractional: [[f64; 3]; 3]

Transformation matrix for converting to fractional coordinates.

§to_cartesian: [[f64; 3]; 3]

Transformation matrix for converting to cartesian coordinates.

§reduced_cartesian_shift_matrix: [[f64; 3]; 27]

The cartesian vectors for every combination of reduced lattice vector.

§reduced_grid_shift_matrix: Vec<Vec<usize>>

The conversion of the reduced shift matrix to the individual steps in the crate::grid::Grid

§reduced_to_fractional: [[f64; 3]; 3]

Transformation matrix for converting to fractional coordinates.

§reduced_to_cartesian: [[f64; 3]; 3]

Transformation matrix for converting to cartesian coordinates.

§volume: f64

Volume of the lattice.

Implementations§

source§

impl Lattice

source

pub fn new(lattice: [[f64; 3]; 3]) -> Self

Initialises the structure. Builds all the fields of the lattice structure from a 2d vector in the form:

[
    [ax, ay, az],
    [bx, by, bz],
    [cx, cy, cz],
]
source

pub fn fractional_to_reduced(&self, p: [f64; 3]) -> [f64; 3]

Turn fractional coordinates into Cartesian coordinates in the reduced basis.

source

pub fn cartesian_to_reduced(&self, p: [f64; 3]) -> [f64; 3]

Map Cartesian coordinates into the reduced basis.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

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

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

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

Performs the conversion.