[][src]Struct pdbtbx::Atom

pub struct Atom { /* fields omitted */ }

A struct to represent a single Atom in a protein

Implementations

impl Atom[src]

pub fn new(
    serial_number: usize,
    atom_name: [char; 4],
    x: f64,
    y: f64,
    z: f64,
    occupancy: f64,
    b_factor: f64,
    element: [char; 2],
    charge: isize
) -> Option<Atom>
[src]

Create a new Atom

pub fn pos(&self) -> (f64, f64, f64)[src]

Get the position of the atom as a tuple of f64, in the following order: (x, y, z) Returned in the units of the PDB file, which is defined to be orthogonal coordinate system in Å

pub fn set_pos(&mut self, new_pos: (f64, f64, f64)) -> Result<(), String>[src]

Set the position of the atom as a tuple of f64, in the following order: (x, y, z)

Panics

It panics if one or more of the numbers are not finite (f64.is_finite())

pub fn x(&self) -> f64[src]

Get the X position of the atom Returned in the units of the PDB file, which is defined to be orthogonal coordinate system in Å

pub fn set_x(&mut self, new_pos: f64) -> Result<(), String>[src]

Set the X position of the atom

Panics

It panics if new_pos is not finite (f64.is_finite())

pub fn y(&self) -> f64[src]

Get the Y position of the atom Returned in the units of the PDB file, which is defined to be orthogonal coordinate system in Å

pub fn set_y(&mut self, new_pos: f64) -> Result<(), String>[src]

Set the Y position of the atom

Panics

It panics if new_pos is not finite (f64.is_finite())

pub fn z(&self) -> f64[src]

Get the Z position of the atom Returned in the units of the PDB file, which is defined to be orthogonal coordinate system in Å

pub fn set_z(&mut self, new_pos: f64) -> Result<(), String>[src]

Set the Z position of the atom

Panics

It panics if new_pos is not finite (f64.is_finite())

pub fn serial_number(&self) -> usize[src]

Get the serial number of the atom This number is defined to be unique in the containing model, which is not enforced

pub fn set_serial_number(&mut self, new_serial_number: usize)[src]

Set the serial number of the atom This number is defined to be unique in the containing model, which is not enforced

pub fn name(&self) -> String[src]

Get the name of the atom The name is max 4 characters and is trimmed

pub fn set_name(&mut self, new_name: &str) -> Result<(), String>[src]

Set the name of the atom If the name is invalid an error message is provided

Errors

The name should at max contain 4 characters (ASCII) The name can only contain valid characters, the ASCII graphic characters (char.is_ascii_graphic() || char == ' ')

pub fn occupancy(&self) -> f64[src]

Get the occupancy of the atom

pub fn set_occupancy(&mut self, new_occupancy: f64) -> Result<(), String>[src]

Set the occupancy of the atom

Panics

It panics if new_occupancy is not finite (f64.is_finite())

pub fn b_factor(&self) -> f64[src]

Get the b-factor or temperature factor of the atom

pub fn set_b_factor(&mut self, new_b_factor: f64) -> Result<(), String>[src]

Set the b-factor of the atom

Panics

It panics if new_b_factor is not finite (f64.is_finite())

pub fn element(&self) -> String[src]

Get the element of this atom

pub fn atomic_number(&self) -> Option<usize>[src]

Get the atomic number of this atom. If defined it uses self.element(), otherwise it uses self.name() of the atom.

Fails

It fails when the element() or name() is not a valid element name.

pub fn atomic_radius(&self) -> Option<f64>[src]

Get the atomic radius of this Atom in Å. The radius is defined up to Cm. Source: Martin Rahm, Roald Hoffmann, and N. W. Ashcroft. Atomic and Ionic Radii of Elements 1-96. Chemistry - A European Journal, 22(41):14625–14632, oct 2016. URL: http://doi.wiley.com/10.1002/chem.201602949, doi:10.1002/chem.201602949.

Fails

It fails if the element name if this Atom is not defined (see self.atomic_number()). It also fails when the atomic radius is not defined for the given atomic number, so if the atomic number is higher than 96.

pub fn set_element(&mut self, new_element: &str) -> Result<(), String>[src]

Set the element of this atom

Fails

It fails if the element contains invalid characters (only ASCII graphic and space is allowed). It also fails if the string is too ling, the max length is 2 characters.

pub fn charge(&self) -> isize[src]

Get the charge of the atom

pub fn pdb_charge(&self) -> String[src]

Get the charge in the PDB format [0-9][-+]

pub fn set_charge(&mut self, new_charge: isize) -> Result<(), String>[src]

Set the charge of this atom

Fails

It fails if the charge contains invalid characters (only ASCII graphic and space is allowed). It also fails if the string is too ling, the max length is 2 characters.

pub fn anisotropic_temperature_factors(&self) -> Option<[[f64; 3]; 2]>[src]

Get the anisotropic temperature factors, if available

pub fn set_anisotropic_temperature_factors(&mut self, factors: [[f64; 3]; 2])[src]

Set the anisotropic temperature factors

pub fn backbone(&self) -> bool[src]

Get if this atom is likely to be a part of the backbone of a protein

pub fn apply_transformation(&mut self, transformation: &TransformationMatrix)[src]

Apply a transformation to the position of this atom, the new position is immediately set.

pub fn corresponds(&self, other: &Atom) -> bool[src]

See if the other Atom corresponds with this Atom. Which means that the Atoms are equal except for the position, occupancy, and b_factor. Used to validate that multiple models contain the same atoms, but with different positional data.

pub fn distance_wrapping(&self, other: &Atom, cell: &UnitCell) -> f64[src]

Gives the distance between the centers of two atoms. Wrapping around the unit cell if needed.

pub fn distance(&self, other: &Atom) -> f64[src]

Gives the distance between the centers of two atoms.

pub fn overlaps(&self, other: &Atom) -> Option<bool>[src]

Checks if this Atom overlaps with the given atom. It overlaps if the sphere defined as sitting at the atom position with a radius of the atomic radius (atom.atomic_radius()) intersect with this sphere from the other Atom.

Fails

It fails if any one of the two radii are not defined.

pub fn overlaps_wrapping(&self, other: &Atom, cell: &UnitCell) -> Option<bool>[src]

Checks if this Atom overlaps with the given atom. It overlaps if the sphere defined as sitting at the atom position with a radius of the atomic radius (atom.atomic_radius()) intersect with this sphere from the other Atom. Wrapping around the unit cell if needed.

Fails

It fails if any one of the two radii are not defined.

Trait Implementations

impl Clone for Atom[src]

impl Debug for Atom[src]

impl Display for Atom[src]

impl PartialEq<Atom> for Atom[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.