Skip to main content

Structure

Struct Structure 

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

A crystal structure.

Implementations§

Source§

impl Structure

Source

pub fn bond_graph(&self) -> Result<BondGraph, Error>

Perceives bonds with the default rules.

§Errors

Returns the errors of perceive_bonds.

Source§

impl Structure

Source

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

Source

pub fn p1(&self) -> Result<P1Cell, Error>

Expands this structure to P1 with the default tolerance.

§Errors

Returns the errors of P1Cell::expand.

Source§

impl Structure

Source

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

Source

pub fn formula(&self) -> String

Formula string, for example Fe2 O3 or C0.5.

Source

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.

Source

pub fn molar_mass(&self) -> Result<f64, Error>

Molar mass of the cell contents in g/mol.

§Errors

Returns the errors of Structure::cell_mass.

Source

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.

Source

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.

Source

pub fn total_charge(&self) -> f64

Sum of occupancy * charge over the atoms of the whole cell.

Source

pub fn charge_balance(&self) -> f64

Charge balance, the same as Structure::total_charge.

Source§

impl Structure

Source

pub fn name(&self) -> &str

Structure name.

Source

pub fn lattice(&self) -> &Lattice

Unit cell.

Source

pub fn hall(&self) -> &str

Hall symbol of the space group; P 1 for a P1 structure.

Source

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

Asymmetric-unit sites.

Source

pub fn operations(&self) -> &[SymOp]

Explicit symmetry operations; empty means identity only.

Source

pub fn explicit_bonds(&self) -> &[ExplicitBond]

User bonds and removals applied after perception.

Source

pub fn topology_bonds(&self) -> &[TopologyBond]

Topology edges, kept separate from chemical bonds.

Source

pub fn metadata(&self) -> &BTreeMap<String, Value>

Open structure metadata.

Source

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.

Source

pub fn cart_sites(&self) -> Vec<[f64; 3]>

Cartesian coordinates of the asymmetric sites.

Source

pub fn warnings(&self) -> Vec<StructureWarning>

Structured warnings collected from the structure metadata.

Source

pub fn summary(&self) -> Result<StructureSummary, Error>

Summary used by the CLI, Python and WASM info surfaces.

§Errors

Returns the errors of Structure::density.

Source

pub fn with_name(self, name: impl Into<String>) -> Self

Copy with a new name.

Source

pub fn with_lattice(self, lattice: Lattice) -> Self

Copy with a new lattice.

Source

pub fn with_site(self, site: Site) -> Self

Copy with one more site.

Source

pub fn molecule( name: impl Into<String>, points: &[(String, [f64; 3])], padding: f64, ) -> Result<Self, Error>

A non-periodic molecule in a padded P1 box.

§Errors

Returns Error::InvalidInput for no points, a non-positive padding, or a point whose element is unknown.

Source§

impl Structure

Source

pub fn to_document(&self) -> StructureDocument

Wraps this structure in the versioned document envelope.

Source§

impl Structure

Source

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.

Source

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.

Source

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.

Source

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.

Source

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

Source

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 Clone for Structure

Source§

fn clone(&self) -> Self

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 Structure

Source§

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

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

impl<'de> Deserialize<'de> for Structure

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Structure

Source§

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

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

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

Inequality operator !=. Read more
Source§

impl Serialize for Structure

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Structure

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
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> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

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

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

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

Initializes a with the given initializer. Read more
Source§

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

Dereferences the given pointer. Read more
Source§

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

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = !

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

fn try_from(value: U) -> Result<T, !>

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.