Skip to main content

Lattice

Struct Lattice 

Source
pub struct Lattice { /* private fields */ }
Expand description

A crystal: a Bravais lattice with a basis. Cubic (face-centred cubic Bravais lattice) or hexagonal; see the module docs.

Implementations§

Source§

impl Lattice

Source

pub fn diamond( z: u8, a_m: f64, temperature_k: f64, ) -> Result<Self, CrystalError>

Diamond structure of element z with lattice constant a_m (metres) stated at temperature_k. Basis as printed by Mehl et al. (2017), p. 616: (1/8, 1/8, 1/8) and (7/8, 7/8, 7/8).

Source

pub fn zincblende( z_a: u8, z_b: u8, a_m: f64, temperature_k: f64, ) -> Result<Self, CrystalError>

Zincblende structure with z_a on the Zn (4a) site (0, 0, 0) and z_b on the S (4c) site (1/4, 1/4, 1/4) (Mehl et al. 2017, p. 543).

Source

pub fn wurtzite( z_a: u8, z_b: u8, a_m: f64, c_m: f64, u: f64, temperature_k: Option<f64>, ) -> Result<Self, CrystalError>

Wurtzite with z_a on the Zn sites and z_b on the S sites (Mehl et al. 2017, p. 425, Wyckoff 2b): z_a at (1/3, 2/3, 0) and (2/3, 1/3, 1/2), z_b at (1/3, 2/3, u) and (2/3, 1/3, 1/2 + u), in that order. a_m, c_m in metres; temperature_k is the temperature the parameters refer to, if known.

§Errors

Invalid lengths or temperature, an unknown atomic number, or u outside (0, 1/2) (CrystalError::InvalidInternalParameter).

Source

pub fn polytype( z_a: u8, z_b: u8, stacking: &str, a_m: f64, c_m: f64, u: f64, temperature_k: Option<f64>, ) -> Result<Self, CrystalError>

The ideal tetrahedral polytype with the close-packed stacking stacking (letters A, B, C, one per bilayer, e.g. "ABCB" for 4H or "ABCACB" for 6H), cation z_a and anion z_b.

With n letters, bilayer k (from 0) has its cation at the column of letter k and height k c / n, and its anion straight above it at height k c / n + 2 u c / n. So u is the bond length along [0001] in units of the two-bilayer height 2 c / n: the wurtzite u for n = 2, and 3/8 for the ideal tetrahedron at any n (the bond is three quarters of the bilayer spacing, as in the ideal wurtzite). This generalisation is ours; the measured 4H and 6H presets use the printed sites instead (Self::silicon_carbide_4h, Self::silicon_carbide_6h). Sites are listed per bilayer, cation then anion, in stacking order.

The Ramsdell number is n (Mehl et al. 2017, p. 423: “The 4H refers to the fact that there are 4 CSi dimers in a hexagonal unit cell”). The stacking "BC" with the same u gives the sites of Self::wurtzite (listed in a different order).

§Errors

CrystalError::InvalidStacking for a sequence shorter than 2 or longer than MAX_POLYTYPE_LAYERS (64) letters, a letter other than A, B, C, or two equal neighbours (cyclically: the last letter is followed by the first); CrystalError::InvalidInternalParameter for u outside (0, 1/2); and the errors of Self::wurtzite.

Source

pub fn silicon() -> Self

Diamond-structure Si with SI_LATTICE_CONSTANT.

Source

pub fn germanium() -> Self

Diamond-structure Ge with GE_LATTICE_CONSTANT.

Source

pub fn gallium_arsenide() -> Self

Zincblende GaAs (Ga on 4a, As on 4c) with GAAS_LATTICE_CONSTANT.

Source

pub fn silicon_carbide_3c() -> Self

Zincblende 3C-SiC (Si on 4a, C on 4c) with SIC_3C_LATTICE_CONSTANT.

Source

pub fn gallium_nitride() -> Self

Wurtzite GaN (Ga on the Zn sites, N on the S sites) with GAN_LATTICE_CONSTANTS.

Placeholder u. No measured u for GaN could be opened (see docs/data-provenance.md, open questions), so this preset uses the geometric equal_bond_wurtzite_u of the cited a and c, not a measurement. Build with Self::wurtzite to supply a measured u.

Source

pub fn silicon_carbide_4h() -> Self

4H-SiC with SIC_4H_LATTICE_CONSTANTS and the measured sites SIC_4H_Z of Bauer et al. (2001) as printed by Mehl et al. (2017), p. 423: Si I on 2a (z1), C I on 2a (z2), Si II on 2b (z3), C II on 2b (z4), in that order. The stacking is ABAC, which is ABCB relabelled.

Source

pub fn silicon_carbide_6h() -> Self

6H-SiC with SIC_6H_LATTICE_CONSTANTS and the measured sites SIC_6H_Z of Bauer et al. (2001) as printed by Mehl et al. (2017), p. 427: Si I, C I on 2a (z1, z2); Si II, C II, Si III, C III on 2b (z3..z6), in that order. The stacking is ABCACB.

Source

pub fn structure(&self) -> Structure

The structure type.

Source

pub fn is_hexagonal(&self) -> bool

Whether the lattice is hexagonal (wurtzite or a polytype).

Source

pub fn lattice_constant(&self) -> f64

Lattice constant a, metres: the cubic cell edge, or the hexagonal basal parameter.

Source

pub fn lattice_constant_c(&self) -> f64

Lattice constant c, metres: the hexagonal [0001] period, or the cubic cell edge (equal to Self::lattice_constant).

Source

pub fn temperature_k(&self) -> Option<f64>

Temperature the lattice parameters refer to, kelvin, or None if the cited record does not state it.

Source

pub fn primitive_vectors(&self) -> [[f64; 3]; 3]

The primitive (Bravais) vectors a1, a2, a3, metres, in the crystal frame: face-centred cubic, or hexagonal (hexagonal_vectors).

Source

pub fn conventional_vectors(&self) -> [[f64; 3]; 3]

The conventional cell vectors, metres: the cube a x, a y, a z, or for a hexagonal lattice the primitive a1, a2, c. Miller and direction indices refer to this cell.

Source

pub fn basis(&self) -> &[Site]

The basis sites, in the order the constructor lists them.

Source

pub fn basis_positions(&self) -> Vec<(u8, [f64; 3])>

Cartesian positions (metres, crystal frame) of the basis sites in the primitive cell, with their atomic numbers.

Source

pub fn conventional_cell_sites(&self) -> Vec<(u8, [f64; 3])>

The atoms of one conventional cell, as fractional coordinates of that cell wrapped into [0, 1).

Cubic: each basis site plus the three face-centring translations (0, 1/2, 1/2), (1/2, 0, 1/2), (1/2, 1/2, 0); eight atoms for both structures, in basis order then translation order. Hexagonal: the basis itself (the hexagonal cell is primitive), in basis order.

Source

pub fn orthogonal_cell(&self) -> ([f64; 3], Vec<(u8, [f64; 3])>)

A rectangular cell aligned with the crystal axes that tiles the crystal: its edge lengths (metres, along x, y, z) and its atoms as fractions of those edges, wrapped into [0, 1). The lattice neighbour search (super::search) walks these cells.

Cubic: the conventional cube, edges (a, a, a), and Self::conventional_cell_sites. Hexagonal: the orthohexagonal cell spanned by a1 + a2 = (a, 0, 0), a2 - a1 = (0, sqrt(3) a, 0) and a3 = (0, 0, c), which are lattice vectors spanning a sublattice of index 2 (determinant of [[1, 1, 0], [-1, 1, 0], [0, 0, 1]]), so the cell holds every basis site twice: at its own position and shifted by a2, which is not in the sublattice. A site at lattice coordinates (f1, f2, f3) has the fractions ((f1 + f2)/2, (f2 - f1)/2, f3) (derived here from the vectors above). Basis order, then the shift.

Source

pub fn primitive_cell_volume(&self) -> f64

Primitive cell volume a1 . (a2 x a3), m³ (Mehl et al. 2017, eq. (6)): a³/4 (cubic) or (sqrt(3)/2) a² c (hexagonal).

Source

pub fn atom_number_density(&self) -> f64

Atom number density, atoms per m³: basis sites per primitive cell volume.

Source

pub fn number_density_of(&self, z: u8) -> f64

Number density of element z, atoms per m³ (zero if absent).

Source

pub fn plane_normal(&self, hkl: [i32; 3]) -> Result<[f64; 3], CrystalError>

Unit normal (crystal frame) of the lattice planes (hkl), indexed on the conventional cell: g = h b1 + k b2 + l b3 normalised. For a cubic cell this is [hkl] / |[hkl]|.

Source

pub fn direction(&self, uvw: [i32; 3]) -> Result<[f64; 3], CrystalError>

Unit vector (crystal frame) along the lattice direction [uvw], indexed on the conventional cell: u c1 + v c2 + w c3 normalised.

Source

pub fn plane_normal_hkil( &self, hkil: [i32; 4], ) -> Result<[f64; 3], CrystalError>

Unit normal of the Miller-Bravais planes (hkil) of a hexagonal lattice: Self::plane_normal of plane_from_hkil.

§Errors

CrystalError::NotHexagonal for a cubic lattice, and the errors of the two functions named.

Source

pub fn direction_uvtw(&self, uvtw: [i32; 4]) -> Result<[f64; 3], CrystalError>

Unit vector along the Miller-Bravais direction [uvtw] of a hexagonal lattice: Self::direction of direction_from_uvtw.

§Errors

CrystalError::NotHexagonal for a cubic lattice, and the errors of the two functions named.

Trait Implementations§

Source§

impl Clone for Lattice

Source§

fn clone(&self) -> Lattice

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Lattice

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Lattice

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Lattice

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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 T
where 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<T> Pointable for T

§

const ALIGN: usize

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

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

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

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

Source§

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 T
where U: TryFrom<T>,

Source§

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V