Contact Identification

This module defines a class and function for identifying contacts.

class Contacts(atoms, unitcell=None)[source]

A class for contact identification. Contacts are identified using the coordinates of atoms at the time of instantiation.

atoms must be an Atomic instance.

Parameters:unitcell (ndarray) – orthorhombic unitcell dimension array with shape (3,) for KDTree. Default is None.
getAtoms()[source]

Returns atoms, or coordinate array, provided at instantiation..

getUnitcell()[source]

Returns unitcell array, or None if one was not provided.

select(radius, center)

Select atoms radius radius (Å) of center, which can be point(s) in 3-d space (numpy.ndarray with shape (n_atoms, 3)) or a set of atoms, e.g. Selection.

iterNeighbors(atoms, radius, atoms2=None, unitcell=None, seqsep=None)[source]

Yield pairs of atoms that are within radius of each other and the distance between them.

If atoms2 is also provided, one atom from atoms and another from atoms2 will be yielded. If one of atoms or atoms2 is a coordinate array, pairs of indices and distances will be yielded.

When orthorhombic unitcell dimensions are provided, periodic boundary conditions will be taken into account (see KDTree and also wrapAtoms() for details). If atoms is a Frame instance and unitcell is not provided, unitcell information from frame will be used if available.

If seqsep is provided, neighbors will be kept if the sequence separation >= seqsep. Note that seqsep will be ignored if atoms are not provided.

findNeighbors(atoms, radius, atoms2=None, unitcell=None, seqsep=None)[source]

Returns list of neighbors that are within radius of each other and the distance between them. See iterNeighbors() for more details.