Struct chemfiles::Residue [] [src]

pub struct Residue { /* fields omitted */ }

A Residue is a group of atoms belonging to the same logical unit. They can be small molecules, amino-acids in a protein, monomers in polymers, etc.

Methods

impl Residue
[src]

[src]

Create a new residue with the given name

Example

let residue = Residue::new("ALA").unwrap();
assert_eq!(residue.name(), Ok(String::from("ALA")));

[src]

Create a new residue with the given name and id as identifier.

Example

let residue = Residue::with_id("ALA", 67).unwrap();
assert_eq!(residue.name(), Ok(String::from("ALA")));
assert_eq!(residue.id(), Ok(67));

[src]

Get the number of atoms in this residue.

Example

let mut residue = Residue::new("water").unwrap();
assert_eq!(residue.natoms(), Ok(0));

residue.add_atom(0);
residue.add_atom(1);
residue.add_atom(2);
assert_eq!(residue.natoms(), Ok(3));

[src]

Get the identifier of this residue in the initial topology file.

Example

let residue = Residue::with_id("", 42).unwrap();
assert_eq!(residue.id(), Ok(42));

[src]

Get the name of this residue.

Example

let residue = Residue::new("water").unwrap();
assert_eq!(residue.name(), Ok(String::from("water")));

[src]

Add the atom at index i in this residue.

Example

let mut residue = Residue::new("water").unwrap();
assert_eq!(residue.contains(56), Ok(false));

residue.add_atom(56).unwrap();
assert_eq!(residue.contains(56), Ok(true));

[src]

Check if the atom at index i is in this residue

Example

let mut residue = Residue::new("water").unwrap();
assert_eq!(residue.contains(56), Ok(false));

residue.add_atom(56).unwrap();
assert_eq!(residue.contains(56), Ok(true));

Trait Implementations

impl Clone for Residue
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Drop for Residue
[src]

[src]

Executes the destructor for this type. Read more