pub struct Neighbours { /* private fields */ }Expand description
Owned neighbour list.
The handle is freed on drop. It is Send and not Sync.
let (xyz, edge) = seams::diamond8();
let mut system = seams::System::new()?;
system.set_ortho(&xyz, edge, edge, edge)?;
let list = system.neighbours(&seams::NeighbourOptions::default())?;
assert!(list.pairs().all(|pair| pair.atom != pair.neighbour));
assert!(list.degrees()?.iter().all(|degree| *degree == 4));Implementations§
Source§impl Neighbours
impl Neighbours
Sourcepub fn nnz(&self) -> Result<usize, Error>
pub fn nnz(&self) -> Result<usize, Error>
Number of neighbour pairs, omitting self.
let (xyz, edge) = seams::diamond8();
let mut system = seams::System::new()?;
system.set_ortho(&xyz, edge, edge, edge)?;
let list = system.knn(&seams::KnnOptions { k: 4, mutual: true, ..Default::default() })?;
assert!(list.nnz()? > 0);Sourcepub fn degrees(&self) -> Result<Vec<i32>, Error>
pub fn degrees(&self) -> Result<Vec<i32>, Error>
Degree of each atom. The self entry is not counted.
let (xyz, edge) = seams::diamond8();
let mut system = seams::System::new()?;
system.set_ortho(&xyz, edge, edge, edge)?;
let list = system.neighbours(&seams::NeighbourOptions::default())?;
assert_eq!(list.degrees()?.len(), 8);Sourcepub fn pairs(&self) -> NeighbourPairs<'_> ⓘ
pub fn pairs(&self) -> NeighbourPairs<'_> ⓘ
Directed pairs. Self is omitted.
let (xyz, edge) = seams::diamond8();
let mut system = seams::System::new()?;
system.set_ortho(&xyz, edge, edge, edge)?;
let list = system.neighbours(&seams::NeighbourOptions::default())?;
assert_eq!(list.pairs().count(), list.nnz()?);Trait Implementations§
Source§impl Drop for Neighbours
impl Drop for Neighbours
impl Send for Neighbours
Auto Trait Implementations§
impl !Sync for Neighbours
impl Freeze for Neighbours
impl RefUnwindSafe for Neighbours
impl Unpin for Neighbours
impl UnsafeUnpin for Neighbours
impl UnwindSafe for Neighbours
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