Building neighbor-lists

The ase.calculators.emt.EMT potential and the GPAW DFT calculator both make use of ASE’s built-in neighbor-list class:

class ase.neighborlist.NeighborList(cutoffs, skin=0.3, sorted=False, self_interaction=True, bothways=False)[source]

Neighbor list object.

cutoffs: list of float
List of cutoff radii - one for each atom. If the spheres (defined by their cutoff radii) of two atoms overlap, they will be counted as neighbors.
skin: float
If no atom has moved more than the skin-distance since the last call to the update() method, then the neighbor list can be reused. This will save some expensive rebuilds of the list, but extra neighbors outside the cutoff will be returned.
self_interaction: bool
Should an atom return itself as a neighbor?
bothways: bool
Return all neighbors. Default is to return only “half” of the neighbors.

Example:

nl = NeighborList([2.3, 1.7])
nl.update(atoms)
indices, offsets = nl.get_neighbors(0)