Struct AtomRecord

Source
pub struct AtomRecord {
Show 15 fields pub serial: u32, pub name: String, pub alt_loc: Option<char>, pub res_name: String, pub chain_id: Option<char>, pub res_seq: i16, pub i_code: Option<char>, pub x: f32, pub y: f32, pub z: f32, pub occupancy: f32, pub temp_factor: f32, pub element: Option<String>, pub charge: Option<String>, pub entry: Option<String>,
}
Expand description

Represents an ATOM or HETATM record from a PDB file.

This structure contains all the information for an atom coordinate record, including position, occupancy, temperature factors, and identification data.

§PDB Format

ATOM records contain atomic coordinate data for standard amino acid and nucleic acid residues. HETATM records contain atomic coordinate data for non-standard residues, water molecules, and other hetero-compounds.

§Fields

  • serial: Atom serial number (1-99999, or hexadecimal for >99999)
  • name: Atom name (e.g., “CA”, “N”, “O”)
  • alt_loc: Alternative location indicator
  • res_name: Residue name (e.g., “ALA”, “GLY”, “HOH”)
  • chain_id: Chain identifier
  • res_seq: Residue sequence number
  • i_code: Insertion code for residues
  • x, y, z: Atomic coordinates in Ångströms
  • occupancy: Occupancy value (0.0-1.0)
  • temp_factor: Temperature factor (B-factor)
  • element: Element symbol
  • charge: Formal charge
  • entry: PDB entry identifier

§Example

use knuckles_parse::records::atom::AtomRecord;

let line = "ATOM      1  N   ALA A   1      20.154  16.967  27.462  1.00 11.18           N";
let atom = AtomRecord::from(line);

assert_eq!(atom.serial, 1);
assert_eq!(atom.name, "N");
assert_eq!(atom.res_name, "ALA");
assert_eq!(atom.x, 20.154);

Fields§

§serial: u32

Atom serial number (1-99999, or hexadecimal for larger values)

§name: String

Atom name (e.g., “CA”, “N”, “O”)

§alt_loc: Option<char>

Alternative location indicator

§res_name: String

Residue name (e.g., “ALA”, “GLY”, “HOH”)

§chain_id: Option<char>

Chain identifier

§res_seq: i16

Residue sequence number

§i_code: Option<char>

Insertion code for residues

§x: f32

X coordinate in Ångströms

§y: f32

Y coordinate in Ångströms

§z: f32

Z coordinate in Ångströms

§occupancy: f32

Occupancy value (0.0-1.0)

§temp_factor: f32

Temperature factor (B-factor)

§element: Option<String>

Element symbol

§charge: Option<String>

Formal charge

§entry: Option<String>

PDB entry identifier

Implementations§

Source§

impl AtomRecord

Source

pub fn new(str: &str) -> AtomRecord

Create a new AtomRecord by parsing a PDB ATOM or HETATM line.

This method parses fixed-width fields according to the PDB format specification. It handles both decimal and hexadecimal serial numbers (for atoms > 99999).

§Arguments
  • str - A single ATOM or HETATM line from a PDB file
§Returns

A new AtomRecord with all fields parsed from the input line.

§Panics

Panics if required numeric fields cannot be parsed (coordinates, occupancy, etc.)

§Example
use knuckles_parse::records::atom::AtomRecord;

let line = "ATOM      1  N   ALA A   1      20.154  16.967  27.462  1.00 11.18           N";
let atom = AtomRecord::new(line);
assert_eq!(atom.name, "N");

Trait Implementations§

Source§

impl Clone for AtomRecord

Source§

fn clone(&self) -> AtomRecord

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 AtomRecord

Source§

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

Formats the value using the given formatter. Read more
Source§

impl From<&str> for AtomRecord

Source§

fn from(str: &str) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for AtomRecord

Source§

fn eq(&self, other: &AtomRecord) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for AtomRecord

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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. 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.