contact_map.NearestAtoms

class contact_map.NearestAtoms(trajectory, cutoff, frame_number=0, excluded=None)[source]

Identify nearest atoms (within a cutoff) to an atom.

This was primarily written to quickly look for atoms that are nearly overlapping, but should be extendable to have other uses.

Parameters
  • trajectory (mdtraj.Trajectory) – trajectory to be analyzed

  • cutoff (float) – cutoff distance (in nm)

  • frame_number (int) – frame number within the trajectory (counting from 0), default 0

  • excluded (dict) – a dict of {atom_index: [excluded_atom_indices]}, where the excluded atom indices are atoms that should not be counted when considering the atom for the key atom_index. Default is None, which ignores all atoms in the same residue. Passing an empty dict, {}, will result in all atom pairs being considered

nearest

dictionary mapping atom index to the atom index of the nearest atom to this one

Type

dict

nearest_distance

dictionary mapping atom index to the distance to the nearest atom

Type

dict

__init__(trajectory, cutoff, frame_number=0, excluded=None)[source]

Initialize self. See help(type(self)) for accurate signature.

Methods

__init__(trajectory, cutoff[, frame_number, …])

Initialize self.

Attributes

sorted_distances

list: 3-tuple (atom_index, nearest_atom_index, nearest_distance) for each atom, sorted by distance.