13.2.3. Neighbor Search wrapper for MDAnalysis — MDAnalysis.lib.NeighborSearch¶
This module contains classes that allow neighbor searches directly with AtomGroup objects from MDAnalysis.
-
class
MDAnalysis.lib.NeighborSearch.AtomNeighborSearch(atom_group, box=None)[source]¶ This class can be used to find all atoms/residues/segments within the radius of a given query position.
For the neighbor search, this class is a wrapper around
capped_distance.Parameters: - atom_list (AtomGroup) – list of atoms
- box (array-like or
None, optional, defaultNone) – Simulation cell dimensions in the form ofMDAnalysis.trajectory.base.Timestep.dimensionswhen periodic boundary conditions should be taken into account for the calculation of contacts.
-
search(atoms, radius, level='A')[source]¶ Return all atoms/residues/segments that are within radius of the atoms in atoms.
Parameters: - atoms (AtomGroup, MDAnalysis.core.groups.AtomGroup) – AtomGroup object
- radius (float) – Radius for search in Angstrom.
- level (str) – char (A, R, S). Return atoms(A), residues(R) or segments(S) within radius of atoms.
Returns: - AtomGroup (
AtomGroup) – Whenlevel='A', AtomGroup is being returned. - ResidueGroup (
ResidueGroup) – Whenlevel='R', ResidueGroup is being returned. - SegmentGroup (
SegmentGroup) – Whenlevel='S', SegmentGroup is being returned.
Changed in version 2.0.0: Now returns
AtomGroup(when empty this is now an emptyAtomGroupinstead of an empty list),ResidueGroup, or aSegmentGroup