pub struct Structure { /* private fields */ }Expand description
A crystal structure.
Implementations§
Source§impl Structure
impl Structure
Sourcepub fn as_p1(&self) -> Result<Self, Error>
pub fn as_p1(&self) -> Result<Self, Error>
Returns this structure as an explicit P1 structure.
A structure that is already P1 is cloned. Otherwise the cell is
expanded with its operations, the operations are dropped and the
original site metadata (occupancy, displacement parameters, charge and
props) is kept. Structure::supercell uses this so a supercell of a
symmetric structure contains the whole cell, not only the asymmetric
unit.
§Errors
Returns the errors of the P1 expansion or of the rebuilt sites.
Source§impl Structure
impl Structure
Sourcepub fn cell_contents(&self) -> Vec<(String, f64)>
pub fn cell_contents(&self) -> Vec<(String, f64)>
Cell contents as (element, occupancy sum) in first-appearance order,
counted on the whole cell (the P1 expansion when the structure has
symmetry operations).
Sourcepub fn cell_mass(&self) -> Result<f64, Error>
pub fn cell_mass(&self) -> Result<f64, Error>
Mass of the whole cell contents in unified atomic mass units.
§Errors
Returns an error if a site element is missing from the element table.
Sourcepub fn molar_mass(&self) -> Result<f64, Error>
pub fn molar_mass(&self) -> Result<f64, Error>
Sourcepub fn density(&self) -> Result<f64, Error>
pub fn density(&self) -> Result<f64, Error>
Density in g/cm3 of the whole cell (the P1 expansion when the structure has symmetry operations).
§Errors
Returns the errors of Structure::cell_mass.
Sourcepub fn z(&self) -> u32
pub fn z(&self) -> u32
Number of formula units in the cell: the greatest common divisor of the element counts of the whole cell, or 1 when a count is not an integer.
Sourcepub fn total_charge(&self) -> f64
pub fn total_charge(&self) -> f64
Sum of occupancy * charge over the atoms of the whole cell.
Sourcepub fn charge_balance(&self) -> f64
pub fn charge_balance(&self) -> f64
Charge balance, the same as Structure::total_charge.
Source§impl Structure
impl Structure
Sourcepub fn operations(&self) -> &[SymOp]
pub fn operations(&self) -> &[SymOp]
Explicit symmetry operations; empty means identity only.
Sourcepub fn explicit_bonds(&self) -> &[ExplicitBond]
pub fn explicit_bonds(&self) -> &[ExplicitBond]
User bonds and removals applied after perception.
Sourcepub fn topology_bonds(&self) -> &[TopologyBond]
pub fn topology_bonds(&self) -> &[TopologyBond]
Topology edges, kept separate from chemical bonds.
Sourcepub fn is_p1(&self) -> bool
pub fn is_p1(&self) -> bool
Whether the structure is P1: the Hall symbol is P 1 (or empty) and
every operation is the identity. A CIF may carry an explicit operation
loop without a space-group symbol; such a file is not P1 even though
its Hall symbol defaults to P 1.
Sourcepub fn cart_sites(&self) -> Vec<[f64; 3]>
pub fn cart_sites(&self) -> Vec<[f64; 3]>
Cartesian coordinates of the asymmetric sites.
Sourcepub fn warnings(&self) -> Vec<StructureWarning>
pub fn warnings(&self) -> Vec<StructureWarning>
Structured warnings collected from the structure metadata.
Sourcepub fn summary(&self) -> Result<StructureSummary, Error>
pub fn summary(&self) -> Result<StructureSummary, Error>
Summary used by the CLI, Python and WASM info surfaces.
§Errors
Returns the errors of Structure::density.
Sourcepub fn with_lattice(self, lattice: Lattice) -> Self
pub fn with_lattice(self, lattice: Lattice) -> Self
Copy with a new lattice.
Source§impl Structure
impl Structure
Sourcepub fn to_document(&self) -> StructureDocument
pub fn to_document(&self) -> StructureDocument
Wraps this structure in the versioned document envelope.
Source§impl Structure
impl Structure
Sourcepub fn supercell(&self, na: u32, nb: u32, nc: u32) -> Result<Self, Error>
pub fn supercell(&self, na: u32, nb: u32, nc: u32) -> Result<Self, Error>
Builds an na x nb x nc supercell as a P1 structure.
§Errors
Returns Error::InvalidInput for zero repeats, or
Error::LimitExceeded when the estimate exceeds the hard limit.
Sourcepub fn supercell_with_limits(
&self,
na: u32,
nb: u32,
nc: u32,
limits: &Limits,
) -> Result<Self, Error>
pub fn supercell_with_limits( &self, na: u32, nb: u32, nc: u32, limits: &Limits, ) -> Result<Self, Error>
Builds an na x nb x nc supercell with an explicit limits profile.
§Errors
Returns Error::InvalidInput for zero repeats, or
Error::LimitExceeded when the estimate exceeds the profile’s hard
limit.
Sourcepub fn supercell_matrix(&self, p: [[f64; 3]; 3]) -> Result<Self, Error>
pub fn supercell_matrix(&self, p: [[f64; 3]; 3]) -> Result<Self, Error>
Builds a supercell from a positive integer transformation matrix.
Rows of p are the new vectors in units of the old ones.
§Errors
Returns Error::InvalidInput for non-integer, singular or negative
determinant matrices, or Error::LimitExceeded for a refused size.
Sourcepub fn supercell_matrix_with_limits(
&self,
p: [[f64; 3]; 3],
limits: &Limits,
) -> Result<Self, Error>
pub fn supercell_matrix_with_limits( &self, p: [[f64; 3]; 3], limits: &Limits, ) -> Result<Self, Error>
Builds a supercell with an explicit limits profile.
§Errors
Returns Error::InvalidInput for non-integer, singular or negative
determinant matrices, or Error::LimitExceeded for a refused size.
Sourcepub fn origin_shift(&self, delta: [f64; 3]) -> Result<Self, Error>
pub fn origin_shift(&self, delta: [f64; 3]) -> Result<Self, Error>
Shifts the origin by a fractional vector and rewraps the sites.
§Errors
Returns Error::InvalidInput for non-finite shifts.
Source§impl Structure
impl Structure
Sourcepub fn finite_cell(&self, tolerance: f64) -> Result<Self, Error>
pub fn finite_cell(&self, tolerance: f64) -> Result<Self, Error>
Atoms of one finite cell, including images on faces, edges and corners.
§Errors
Returns Error::InvalidInput for a negative tolerance.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Structure
impl<'de> Deserialize<'de> for Structure
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Structure
Auto Trait Implementations§
impl Forget for Structure
impl Freeze for Structure
impl Move for Structure
impl RefUnwindSafe for Structure
impl Send for Structure
impl Sync for Structure
impl Unpin for Structure
impl UnsafeUnpin for Structure
impl UnwindSafe for Structure
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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