pygen_structures.mol_containers.atom module¶
Module containing the Atom class, used to store PDB/PSF data and represent it directly as a PSF/PDB atom line.
This is in a separate, dependency free class to encourage re-use.
-
class
pygen_structures.mol_containers.atom.
Atom
(record: str = 'ATOM', atom_serial: int = 0, atom_name: str = 'OH2', alt_locator: str = ' ', residue_name: str = 'TIP3', chain: str = ' ', residue_number: int = 0, insertion_code: str = ' ', x: float = 0.0, y: float = 0.0, z: float = 0.0, occupancy: float = 1.0, beta_factor: float = 0.0, segment_id: str = '0', element_symbol: (<class 'str'>, None) = None, formal_charge: int = 0, atom_type: str = '', partial_charge: float = 0.0, mass: float = 0.0)¶ Bases:
object
A class to hold the information present in a PDB/PSF atom. Atom objects are directly representable as an atom line from a PDB or PSF file.
- Parameters
record – “ATOM” or “HETATM” (PDB field)
atom_serial – the atom number (PDB and PSF field)
atom_name – the name of the atom in the residue (PDB & PSF field)
alt_locator – alternate location indicator (PDB field)
residue_name – name of the residue the atom is in (PDB & PSF field)
chain – identifier for chain (PDB field)
residue_number – residue sequence number (PDB & PSF field)
insertion_code – code for insertion of residues. This allows for branches, to a limited degree. e.g. 52 -> 52A -> 53. Not widely used (PDB field)
x – x position of atom /Angstroms (PDB field)
y – y position of atom /Angstroms (PDB field)
z – z position of atom /Angstroms (PDB field)
occupancy – occupancy of position from crystal structure. Generally used to indicate presence of multiple conformations (PDB field)
beta_factor – temperature factor. Indicates how much the position of the atom fluctuates with temperature (PDB field)
segment_id – segment identifier. Used by MD simulation programs to keep track of multiple molecules/groups of molecules. (PDB & PSF field)
element_symbol – chemical element in capitals (PDB field)
formal_charge – the formal charge on the atom (PDB field)
atom_type – the type of the atom. To be used by the forcefield when calculating bond/NB terms (PSF field)
partial_charge – the charge of the atom. To be used by the forcefield when calculating electrostatics (PSF field)
mass – mass of the atom. To be used by the forcefield to calculated acceleration from given force (PSF field)
-
classmethod
from_pdb_line
(line: str)¶ Instantiate the class from a line in a PDB file. This will not have the atom_type, partial_charge or mass.
- Parameters
line – an ATOM/HETATM record from a pdb file.
-
to_pdb_line
() → str¶ Create a PDB formatted atom record from the
Atom
. The fields are described in the class docstring.Where atom serials exceed the 5 character limit, these are converted to hexadecimal.
Where residue numbers exceed the 4 character limit, these are wrapped around to 0.
-
to_psf_line
() → str¶ Create a PDB formatted atom record from the
Atom
. The fields are described in the class docstring.