Bio.PDB.Atom module

Atom class, used in Structure objects.

class Bio.PDB.Atom.Atom(name, coord, bfactor, occupancy, altloc, fullname, serial_number, element=None, pqr_charge=None, radius=None)

Bases: object

Define Atom class.

The Atom object stores atom name (both with and without spaces), coordinates, B factor, occupancy, alternative location specifier and (optionally) anisotropic B factor and standard deviations of B factor and positions.

In the case of PQR files, B factor and occupancy are replaced by atomic charge and radius.

__init__(self, name, coord, bfactor, occupancy, altloc, fullname, serial_number, element=None, pqr_charge=None, radius=None)

Initialize Atom object.

  • name (string) – atom name (eg. “CA”). Note that spaces are normally stripped.

  • coord (Numeric array (Float0, size 3)) – atomic coordinates (x,y,z)

  • bfactor (number) – isotropic B factor

  • occupancy (number) – occupancy (0.0-1.0)

  • altloc (string) – alternative location specifier for disordered atoms

  • fullname (string) – full atom name, including spaces, e.g. ” CA “. Normally these spaces are stripped from the atom name.

  • element (uppercase string (or None if unknown)) – atom element, e.g. “C” for Carbon, “HG” for mercury,

  • pqr_charge (number) – atom charge

  • radius (number) – atom radius

__eq__(self, other)

Test equality.

__ne__(self, other)

Test inequality.

__gt__(self, other)

Test greater than.

__ge__(self, other)

Test greater or equal.

__lt__(self, other)

Test less than.

__le__(self, other)

Test less or equal.


Return atom full identifier.


Print Atom object as <Atom atom_name>.

__sub__(self, other)

Calculate distance between two atoms.


other (L{Atom}) – the other atom


This is an incomplete but illustrative example:

distance = atom1 - atom2
set_serial_number(self, n)

Set serial number.

set_bfactor(self, bfactor)

Set isotroptic B factor.

set_coord(self, coord)

Set coordinates.

set_altloc(self, altloc)

Set alternative location specifier.

set_occupancy(self, occupancy)

Set occupancy.

set_sigatm(self, sigatm_array)

Set standard deviation of atomic parameters.

The standard deviation of atomic parameters consists of 3 positional, 1 B factor and 1 occupancy standard deviation.


sigatm_array (Numeric array (length 5)) – standard deviations of atomic parameters.

set_siguij(self, siguij_array)

Set standard deviations of anisotropic temperature factors.


siguij_array (Numeric array (length 6)) – standard deviations of anisotropic temperature factors.

set_anisou(self, anisou_array)

Set anisotropic B factor.


anisou_array (Numeric array (length 6)) – anisotropic B factor.

set_charge(self, pqr_charge)

Set charge.

set_radius(self, radius)

Set radius.


Set the disordered flag to 1.

The disordered flag indicates whether the atom is disordered or not.


Return the disordered flag (1 if disordered, 0 otherwise).

set_parent(self, parent)

Set the parent residue.

  • parent - Residue object


Remove reference to parent.


Return standard deviation of atomic parameters.


Return standard deviations of anisotropic temperature factors.


Return anisotropic B factor.


Return parent residue.


Return the serial number.


Return atom name.


Return the id of the atom (which is its atom name).


Return the full id of the atom.

The full id of an atom is a tuple used to uniquely identify the atom and consists of the following elements: (structure id, model id, chain id, residue id, atom name, altloc)


Return atomic coordinates.


Return B factor.


Return occupancy.


Return the atom name, including leading and trailing spaces.


Return alternative location specifier.


Return level.


Return charge.


Return radius.

transform(self, rot, tran)

Apply rotation and translation to the atomic coordinates.

  • rot (3x3 Numeric array) – A right multiplying rotation matrix

  • tran (size 3 Numeric array) – the translation vector


This is an incomplete but illustrative example:

from numpy import pi, array
from Bio.PDB.vectors import Vector, rotmat
rotation = rotmat(pi, Vector(1, 0, 0))
translation = array((0, 0, 1), 'f')
atom.transform(rotation, translation)

Return coordinates as Vector.


coordinates as 3D vector

Return type

Bio.PDB.Vector class


Create a copy of the Atom.

Parent information is lost.

class Bio.PDB.Atom.DisorderedAtom(id)

Bases: Bio.PDB.Entity.DisorderedEntityWrapper

Contains all Atom objects that represent the same disordered atom.

One of these atoms is “selected” and all method calls not caught by DisorderedAtom are forwarded to the selected Atom object. In that way, a DisorderedAtom behaves exactly like a normal Atom. By default, the selected Atom object represents the Atom object with the highest occupancy, but a different Atom object can be selected by using the disordered_select(altloc) method.

__init__(self, id)

Create DisorderedAtom.

  • id - string, atom name


Iterate through disordered atoms.


Return disordered atom identifier.


Return the center of mass of the DisorderedAtom as a numpy array.

Assumes all child atoms have the same mass (same element).


Return list of atom instances.

Sorts children by altloc (empty, then alphabetical).

disordered_add(self, atom)

Add a disordered atom.

disordered_remove(self, altloc)

Remove a child atom altloc from the DisorderedAtom.

  • altloc - name of the altloc to remove, as a string.

transform(self, rot, tran)

Apply rotation and translation to all children.

See the documentation of Atom.transform for details.