Skip to main content

Rings

Struct Rings 

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

Owned primitive-ring set.

let (xyz, edge) = seams::diamond8();
let mut system = seams::System::new()?;
system.set_ortho(&xyz, edge, edge, edge)?;
let rings = system.rings(&seams::RingOptions::default())?;
assert!(rings.size() > 0);
assert!(!rings.vertices(0)?.is_empty());

Implementations§

Source§

impl Rings

Source

pub fn size(&self) -> i32

Number of primitive rings.

let (xyz, edge) = seams::diamond8();
let mut system = seams::System::new()?;
system.set_ortho(&xyz, edge, edge, edge)?;
let rings = system.rings(&seams::RingOptions::default())?;
assert_eq!(rings.iter().count(), rings.size() as usize);
Source

pub fn vertices(&self, index: i32) -> Result<Vec<i32>, Error>

Atom indices of one ring.

let (xyz, edge) = seams::diamond8();
let mut system = seams::System::new()?;
system.set_ortho(&xyz, edge, edge, edge)?;
let rings = system.rings(&seams::RingOptions::default())?;
assert!(!rings.vertices(0)?.is_empty());
Source

pub fn histogram(&self, up_to: i32) -> Result<Vec<i32>, Error>

Histogram of ring size. counts[k] is the number of rings of size k.

let (xyz, edge) = seams::diamond8();
let mut system = seams::System::new()?;
system.set_ortho(&xyz, edge, edge, edge)?;
let rings = system.rings(&seams::RingOptions::default())?;
let hist = rings.histogram(6)?;
assert_eq!(hist.len(), 7);
Source

pub fn fraction(&self, ring_size: i32) -> Result<f64, Error>

Fraction of atoms that sit on a ring of one size. Zero counts every ring.

let (xyz, edge) = seams::diamond8();
let mut system = seams::System::new()?;
system.set_ortho(&xyz, edge, edge, edge)?;
let rings = system.rings(&seams::RingOptions::default())?;
assert!(rings.fraction(6)?.is_finite());
Source

pub fn iter(&self) -> RingIter<'_> ⓘ

Walk the rings. Each item is the vertex list of one ring.

let (xyz, edge) = seams::diamond8();
let mut system = seams::System::new()?;
system.set_ortho(&xyz, edge, edge, edge)?;
let rings = system.rings(&seams::RingOptions::default())?;
assert!(rings.iter().all(|ring| ring.is_ok()));

Trait Implementations§

Source§

impl Drop for Rings

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl Send for Rings

Auto Trait Implementations§

§

impl !Sync for Rings

§

impl Freeze for Rings

§

impl RefUnwindSafe for Rings

§

impl Unpin for Rings

§

impl UnsafeUnpin for Rings

§

impl UnwindSafe for Rings

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