# `cells`

Cell list to facilitate neighbor searching.

class pdb2pqr.cells.Cells(cellsize)

  Accelerate the search for nearby atoms.

  A pure all versus all search is O(n^2) - for every atom, every other atom must be searched. This is rather inefficient, especially for large biomolecules where cells may be tens of angstroms apart. The cell class breaks down the xyz biomolecule space into several 3-D cells of desired size - then by simply examining atoms that fall into the adjacent cells one can quickly find nearby cells.

  __init__(cellsize)

    Initialize the cells.

    Parameters:

      cellsize (int) – the size of each cell (in Angstroms)

  add_cell(atom)

    Add an atom to the cell.

    Parameters:

      atom (Atom) – the atom to add

  assign_cells(biomolecule)

    Place each atom in a virtual cell for easy neighbor comparison.

    Parameters:

      biomolecule (Biomolecule) – biomolecule with atoms to assign to cells

  get_near_cells(atom)

    Find all atoms in cells bordering an atom.

    Parameters:

      atom (Atom) – the atom to test

    Returns:

      a list of nearby atoms

    Return type:

      [Atom]

  remove_cell(atom)

    Remove an atom from a cell.

    Parameters:

      atom (Atom) – the atom to remove