Struct vegas_lattice::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 new(size: (f64, f64, f64)) -> 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 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 size_along(&self, axis: Axis) -> f64

Returns the size of the lattice along the given axis

source

pub fn with_size(self, size: (f64, f64, f64)) -> Self

Changes the size of the lattice

source

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

Changes the sites of the lattice

source

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

Changes the vertices of the lattice

source

pub fn validate(self) -> Result<Self, LatticeError>

Validates the lattice

source

pub fn drop(self, axis: Axis) -> Self

Drops all the vertices that are periodic along the given axis

source

pub fn expand_along(self, axis: Axis, amount: usize) -> Self

Expands the lattice along the given axis

source

pub fn apply_mask(self, mask: Mask) -> 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(self, source: &str, target: Alloy) -> 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

§

type Err = LatticeError

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

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

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.

§

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

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

§

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>,

§

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

source§

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