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 ──┐
└── AtomThe atom_to_residue and residue_to_chain segmentations provide O(1)
range queries and O(log n) reverse lookups.
Fields§
§atoms: AtomsTablePer-atom topology data.
residues: ResiduesTablePer-residue topology data.
chains: ChainsTablePer-chain topology data.
atom_to_residue: SegmentationSegmentation 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: SegmentationSegmentation mapping residue index → chain index.
residue_to_chain.segment(chain_idx) gives the range of residue indices
belonging to chain chain_idx.
bonds: BondsBond connectivity.
Implementations§
Source§impl AtomicHierarchy
impl AtomicHierarchy
Sourcepub fn n_residues(&self) -> usize
pub fn n_residues(&self) -> usize
Total number of residues.
Sourcepub fn atoms_in_residue(&self, res_idx: usize) -> Range<usize>
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().
Sourcepub fn residues_in_chain(&self, chain_idx: usize) -> Range<usize>
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().
Sourcepub fn residue_of_atom(&self, atom_idx: usize) -> usize
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().
Sourcepub fn chain_of_residue(&self, res_idx: usize) -> usize
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
impl Clone for AtomicHierarchy
Source§fn clone(&self) -> AtomicHierarchy
fn clone(&self) -> AtomicHierarchy
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for AtomicHierarchy
impl RefUnwindSafe for AtomicHierarchy
impl Send for AtomicHierarchy
impl Sync for AtomicHierarchy
impl Unpin for AtomicHierarchy
impl UnsafeUnpin for AtomicHierarchy
impl UnwindSafe for AtomicHierarchy
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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