Skip to main content

AtomicHierarchy

Struct AtomicHierarchy 

Source
pub struct AtomicHierarchy {
    pub atoms: AtomsTable,
    pub residues: ResiduesTable,
    pub chains: ChainsTable,
    pub atom_to_residue: Segmentation,
    pub residue_to_chain: Segmentation,
    pub bonds: Bonds,
}
Expand description

Topology layer: all structural data that is constant across trajectory frames.

Wrap in Arc<AtomicHierarchy> so multiple Models (frames) share one topology without duplication.

§Hierarchy

Chain  ──┐
          ├── Residue ──┐
                         └── Atom

The atom_to_residue and residue_to_chain segmentations provide O(1) range queries and O(log n) reverse lookups.

Fields§

§atoms: AtomsTable

Per-atom topology data.

§residues: ResiduesTable

Per-residue topology data.

§chains: ChainsTable

Per-chain topology data.

§atom_to_residue: Segmentation

Segmentation mapping atom index → residue index.

atom_to_residue.segment(res_idx) gives the range of atom indices belonging to residue res_idx.

§residue_to_chain: Segmentation

Segmentation mapping residue index → chain index.

residue_to_chain.segment(chain_idx) gives the range of residue indices belonging to chain chain_idx.

§bonds: Bonds

Bond connectivity.

Implementations§

Source§

impl AtomicHierarchy

Source

pub fn n_atoms(&self) -> usize

Total number of atoms.

Source

pub fn n_residues(&self) -> usize

Total number of residues.

Source

pub fn n_chains(&self) -> usize

Total number of chains.

Source

pub fn atoms_in_residue(&self, res_idx: usize) -> Range<usize>

Returns the range of atom indices belonging to residue res_idx.

§Panics

Panics if res_idx >= n_residues().

Source

pub fn residues_in_chain(&self, chain_idx: usize) -> Range<usize>

Returns the range of residue indices belonging to chain chain_idx.

§Panics

Panics if chain_idx >= n_chains().

Source

pub fn residue_of_atom(&self, atom_idx: usize) -> usize

Returns the residue index that contains atom atom_idx.

O(log n) binary search over residue boundaries.

§Panics

Panics if atom_idx >= n_atoms().

Source

pub fn chain_of_residue(&self, res_idx: usize) -> usize

Returns the chain index that contains residue res_idx.

O(log n) binary search over chain boundaries.

§Panics

Panics if res_idx >= n_residues().

Trait Implementations§

Source§

impl Clone for AtomicHierarchy

Source§

fn clone(&self) -> AtomicHierarchy

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AtomicHierarchy

Source§

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

Formats the value using the given formatter. 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. 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.