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
impl Lattice
Sourcepub fn diamond(
z: u8,
a_m: f64,
temperature_k: f64,
) -> Result<Self, CrystalError>
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).
Sourcepub fn zincblende(
z_a: u8,
z_b: u8,
a_m: f64,
temperature_k: f64,
) -> Result<Self, CrystalError>
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).
Sourcepub fn wurtzite(
z_a: u8,
z_b: u8,
a_m: f64,
c_m: f64,
u: f64,
temperature_k: Option<f64>,
) -> Result<Self, CrystalError>
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).
Sourcepub 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>
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.
Sourcepub fn silicon() -> Self
pub fn silicon() -> Self
Diamond-structure Si with SI_LATTICE_CONSTANT.
Sourcepub fn germanium() -> Self
pub fn germanium() -> Self
Diamond-structure Ge with GE_LATTICE_CONSTANT.
Sourcepub fn gallium_arsenide() -> Self
pub fn gallium_arsenide() -> Self
Zincblende GaAs (Ga on 4a, As on 4c) with GAAS_LATTICE_CONSTANT.
Sourcepub fn silicon_carbide_3c() -> Self
pub fn silicon_carbide_3c() -> Self
Zincblende 3C-SiC (Si on 4a, C on 4c) with
SIC_3C_LATTICE_CONSTANT.
Sourcepub fn gallium_nitride() -> Self
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.
Sourcepub fn silicon_carbide_4h() -> Self
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.
Sourcepub fn silicon_carbide_6h() -> Self
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.
Sourcepub fn is_hexagonal(&self) -> bool
pub fn is_hexagonal(&self) -> bool
Whether the lattice is hexagonal (wurtzite or a polytype).
Sourcepub fn lattice_constant(&self) -> f64
pub fn lattice_constant(&self) -> f64
Lattice constant a, metres: the cubic cell edge, or the hexagonal
basal parameter.
Sourcepub fn lattice_constant_c(&self) -> f64
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).
Sourcepub fn temperature_k(&self) -> Option<f64>
pub fn temperature_k(&self) -> Option<f64>
Temperature the lattice parameters refer to, kelvin, or None if the
cited record does not state it.
Sourcepub fn primitive_vectors(&self) -> [[f64; 3]; 3]
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).
Sourcepub fn conventional_vectors(&self) -> [[f64; 3]; 3]
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.
Sourcepub fn basis_positions(&self) -> Vec<(u8, [f64; 3])>
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.
Sourcepub fn conventional_cell_sites(&self) -> Vec<(u8, [f64; 3])>
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.
Sourcepub fn orthogonal_cell(&self) -> ([f64; 3], Vec<(u8, [f64; 3])>)
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.
Sourcepub fn primitive_cell_volume(&self) -> f64
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).
Sourcepub fn atom_number_density(&self) -> f64
pub fn atom_number_density(&self) -> f64
Atom number density, atoms per m³: basis sites per primitive cell volume.
Sourcepub fn number_density_of(&self, z: u8) -> f64
pub fn number_density_of(&self, z: u8) -> f64
Number density of element z, atoms per m³ (zero if absent).
Sourcepub fn plane_normal(&self, hkl: [i32; 3]) -> Result<[f64; 3], CrystalError>
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]|.
Sourcepub fn direction(&self, uvw: [i32; 3]) -> Result<[f64; 3], CrystalError>
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.
Sourcepub fn plane_normal_hkil(
&self,
hkil: [i32; 4],
) -> Result<[f64; 3], CrystalError>
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.
Sourcepub fn direction_uvtw(&self, uvtw: [i32; 4]) -> Result<[f64; 3], CrystalError>
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§
impl StructuralPartialEq for Lattice
Auto Trait Implementations§
impl Freeze for Lattice
impl RefUnwindSafe for Lattice
impl Send for Lattice
impl Sync for Lattice
impl Unpin for Lattice
impl UnsafeUnpin for Lattice
impl UnwindSafe for Lattice
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
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