Struct Lattice

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

A lattice is a collection of sites and vertices.

For now it only supports rectangular lattices. This is Orthorombic, Tetragonal and Cubic Bravais lattices. We assume the lattice vectors are aligned with the cartesian axes. While you can choose the lattice parameters a, b, and c to be different.

Implementations§

Source§

impl Lattice

Source

pub fn try_new(size: (f64, f64, f64)) -> Result<Self>

Create a new lattice with the given size

Source

pub fn sc(a: f64) -> Self

Create a simple cubic lattice with the given size a

Source

pub fn bcc(a: f64) -> Self

Create a body centered cubic lattice with the given size a

Source

pub fn fcc(a: f64) -> Self

Create a face centered cubic lattice with lattice parameter a

Source

pub fn size(&self) -> (f64, f64, f64)

Get the size of the lattice

Source

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

Get the sites of the lattice

Source

pub fn vertices(&self) -> &[Vertex]

Get the vertices of the lattice

Source

pub fn try_with_size(self, size: (f64, f64, f64)) -> Result<Self>

Changes the size of the lattice

Source

pub fn try_with_sites(self, sites: Vec<Site>) -> Result<Self>

Changes the sites of the lattice

Source

pub fn try_with_vertices(self, vertices: Vec<Vertex>) -> Result<Self>

Changes the vertices of the lattice

Source

pub fn drop_x(self) -> Self

Drop periodic boundary conditions along the x axis

Source

pub fn drop_y(self) -> Self

Drop periodic boundary conditions along the y axis

Source

pub fn drop_z(self) -> Self

Drop periodic boundary conditions along the z axis

Source

pub fn drop_all(self) -> Self

Drop periodic boundary conditions along all axes

Source

pub fn expand_x(self, amount: usize) -> Self

Expand lattice along the x axis

Source

pub fn expand_y(self, amount: usize) -> Self

Expand lattice along the y axis

Source

pub fn expand_z(self, amount: usize) -> Self

Expand lattice along the z axis

Source

pub fn expand_all(self, amount: usize) -> Self

Expand lattice by the same ammount along all axes

Source

pub fn expand(self, x: usize, y: usize, z: usize) -> Self

Expand lattice by the given ammount along all axes

Source

pub fn apply_mask<R: Rng + ?Sized>(self, mask: Mask, rng: &mut R) -> Self

Removes sites from the lattice according to the given mask

TODO: This only removes points in the xy plane, and it should be generalized

Source

pub fn alloy_sites<R: Rng + ?Sized>( self, source: &str, target: Alloy, rng: &mut R, ) -> Self

Replaces the sites labeled as source with sites in the target alloy

Trait Implementations§

Source§

impl Debug for Lattice

Source§

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

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

impl<'de> Deserialize<'de> for Lattice

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 FromStr for Lattice

Source§

type Err = VegasLatticeError

The associated error which can be returned from parsing.
Source§

fn from_str(source: &str) -> Result<Lattice>

Parses a string s to return a value of this type. Read more
Source§

impl Serialize for Lattice

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

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

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

Source§

fn vzip(self) -> V

Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,