[−][src]Struct lib3dmol::structures::atom::Atom
An Atom
is a sub-structure linked to a [Residue
].
It stores the following properties
- atom name;
- a_type, the type of the Atom according to the
AtomType
enum - atom number (atomid);
- Coordinates x, y and z
- if the atom is a constituant of the backbone of the protein
- occupancy
- temp_factor
- element
- charge
Parameters occupancy, temp_factor, element and charge are often not taken into account in softwares. They are store in an Option
structure: None if missing and Ok if present.
If a PDB is written using the write_pdb function with missing elements, they will be replaced with blank spaces.
Fields
name: String
a_type: AtomType
number: u64
coord: [f32; 3]
is_backbone: bool
occupancy: Option<f32>
temp_factor: Option<f32>
element: Option<String>
charge: Option<String>
Methods
impl Atom
[src]
pub fn new(
name: String,
atom_type: AtomType,
number: u64,
coord: [f32; 3]
) -> Atom
[src]
name: String,
atom_type: AtomType,
number: u64,
coord: [f32; 3]
) -> Atom
Create a new structure Atom
. An atom have a name, a type, a number and x, y, z coordinates
If the atom name is "C", "CA", "N", "O", "OT1" or "OT2", it will be consider as backbone
This function set to None
the parameters for occupancy, tempFactor, element and charge. If these informations are needed, use the Atom
structure directly or use the Atom::new_complete
function.
This function should not be used for real usage and just for tests
Examples
use lib3dmol::structures::atom; let hydrogen = atom::Atom::new(String::from("HT1"), atom::AtomType::Hydrogen, 1, [0.0, 0.0, 0.0]); assert_eq!(hydrogen.occupancy, None);
pub fn new_complete(
name: String,
number: u64,
coord: [f32; 3],
a_type: AtomType,
occupancy: Option<f32>,
temp_factor: Option<f32>,
element: Option<String>,
charge: Option<String>
) -> Atom
[src]
name: String,
number: u64,
coord: [f32; 3],
a_type: AtomType,
occupancy: Option<f32>,
temp_factor: Option<f32>,
element: Option<String>,
charge: Option<String>
) -> Atom
Create a new complete structure Atom
with all parameters
pub fn name(&self) -> String
[src]
Get the name of the Atom
pub fn compute_distance(&self, a: &Atom) -> f32
[src]
Compute the distance between 2 Atom
Examples
use lib3dmol::structures::atom; let h1 = atom::Atom::new(String::from("HT1"), atom::AtomType::Hydrogen, 1, [1.0, 5.0, 2.0]); let h2 = atom::Atom::new(String::from("HT1"), atom::AtomType::Hydrogen, 1, [11.0, 17.0, 5.0]); assert_eq!(15.905973, h1.compute_distance(&h2));
pub fn get_weight(&self) -> f32
[src]
Get the weight of the Atom
in g/mol based on its AtomType
Examples
use lib3dmol::structures::atom::{Atom, AtomType}; let hydrogen = Atom::new(String::from("H"), AtomType::Hydrogen, 1, [0., 0., 0.]); assert_eq!(1.008, hydrogen.get_weight());
pub fn get_symbol(&self) -> &str
[src]
Get the 1 or 2 letters code of the Atom
based on its AtomType
Examples
use lib3dmol::structures::atom::{Atom, AtomType}; let alpha_carbon = Atom::new(String::from("CA"), AtomType::Carbon, 1, [0., 0., 0.]); assert_eq!("C", alpha_carbon.get_symbol());
pub fn get_fullname(&self) -> &str
[src]
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Atom
impl Send for Atom
impl Sync for Atom
impl Unpin for Atom
impl UnwindSafe for Atom
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,