pub struct Basis { /* private fields */ }Implementations§
Source§impl Basis
impl Basis
Sourcepub fn new(basis: BasisMatrix) -> Self
pub fn new(basis: BasisMatrix) -> Self
Examples found in repository?
examples/construct2.rs (line 7)
6fn main() {
7 let basis = Basis::new(BasisMatrix::from_row_slice(1, 1, &[1.0]));
8
9 let mut unitcell = Unitcell::new(1);
10 unitcell.add_site(CoordinateVector::from_element(1, 0.0), 0);
11 unitcell.add_bond(0, 0, OffsetVector::from_element(1, 1), 0);
12
13 let extent = ExtentVector::from_element(1, 16);
14 let boundary = vec![Boundary::Periodic; 1];
15 let graph = Graph::from_basis_unitcell_extent(&basis, &unitcell, &extent, &boundary);
16 support::print_graph(&graph);
17}More examples
examples/construct4.rs (line 7)
6fn main() {
7 let basis = Basis::new(BasisMatrix::from_row_slice(2, 2, &[1.0, 0.0, 0.0, 1.0]));
8
9 let mut unitcell = Unitcell::new(2);
10 unitcell.add_site(CoordinateVector::from_vec(vec![0.0, 0.0]), 0);
11 unitcell.add_bond(0, 0, OffsetVector::from_vec(vec![1, 0]), 0);
12 unitcell.add_bond(0, 0, OffsetVector::from_vec(vec![0, 1]), 0);
13
14 let extent = ExtentVector::from_vec(vec![4, 4]);
15 let boundary = vec![Boundary::Periodic; 2];
16 let graph = Graph::from_basis_unitcell_extent(&basis, &unitcell, &extent, &boundary);
17 support::print_graph(&graph);
18}pub fn simple(dim: usize) -> Self
pub fn dimension(&self) -> usize
pub fn basis_vectors(&self) -> &BasisMatrix
pub fn volume(&self) -> f64
Trait Implementations§
impl StructuralPartialEq for Basis
Auto Trait Implementations§
impl Freeze for Basis
impl RefUnwindSafe for Basis
impl Send for Basis
impl Sync for Basis
impl Unpin for Basis
impl UnsafeUnpin for Basis
impl UnwindSafe for Basis
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.