polymerist.molfiles.pdb

PDB file atom line formatting tools

Submodules

Classes

SerialAtomLabeller

For assigning unique numbered atom names based on their

Package Contents

class polymerist.molfiles.pdb.SerialAtomLabeller[source]

For assigning unique numbered atom names based on their order of appearance within a molecule and elemental class

Useful, for example, in generating unique atom names for a PDB file

Parameters:
  • atom_label_width (int , default 4) – Exact length alloted for any generated atom label Labels shorter than this are right-padded with spaces, while labels longer than this are truncated

    Default of 4 is the chosen to be compatible with the PDB specification (“Atom name: lines 13-16, left-justified”) https://www.cgl.ucsf.edu/chimera/docs/UsersGuide/tutorials/pdbintro.html

  • include_elem_idx (bool, default True) – Whether to attach a numerical element-index postfix to atom labels

    E.g. with atom_label_width=4, the fifth carbon in a topology will be labelled as “C004” with include_elem_idx=True, while labelled as “C “ with include_elem_idx=False,

  • default_elem_idx (int, default 0) – Starting index for each element category By default, is 0-indexed; MUST BE POSITIVE

atom_label_width: int = 4
include_elem_idx: bool = True
default_elem_idx: int = 0
element_counter: collections.Counter
get_atom_label(elem_symbol: str) str[source]

Obtain a numbered atom label for an atom based on its element, updating the underlying element context in the process