exatomic.algorithms.neighbors module

Neighbor Selection Algorithms

This module provides algoirthms for selecting nearest neighbors, e.g. nearest solvent molecules to a solute molecule. Because two body properties do not always represent the desired molecules (i.e. bonds appear where they are not desired), these algorithms are not completely black box.

Before performing a search, check that the molecule table is computed as desired and classified (if necessary): see compute_bonds() and classify().

exatomic.algorithms.neighbors.periodic_nearest_neighbors_by_atom(uni, source, a, sizes, **kwargs)[source]

Determine nearest neighbor molecules to a given source (or sources) and return the data as a dataframe.

Warning

For universes with more than about 250 atoms, consider using the slower but more memory efficient periodic_nearest_neighbors_by_atom_large().

For a simple cubic periodic system with unit cell dimension a, clusters can be generated as follows. In the example below, additional keyword arguments have been included as they are almost always required in order to correctly identify molecular units semi-empirically.

periodic_nearest_neighbors_by_atom(u, [0], 40.0, [0, 5, 10, 50],
                                   dmax=40.0, C=1.6, O=1.6)

Argument descriptions can be found below. The additional keyword arguments, dmax, C, O, are passed directly to the two body computation used to determine (semi-empirically) molecular units. Note that although molecules are computed, neighboring molecular units are determine by an atom to atom criteria.

Parameters:
  • uni (Universe) – Universe

  • source (int, str, list) – Integer label or string symbol of source atom

  • a (float) – Cubic unit cell dimension

  • sizes (list) – List of slices to create

  • kwargs – Additional keyword arguments to be passed to atom two body calculation

Returns:

dct (dict) – Dictionary of sliced universes and nearest neighbor table

See also

Sliced universe construction can be facilitated by construct().

exatomic.algorithms.neighbors.periodic_nearest_neighbors_by_atom_large(uni, source, a, sizes, **kwargs)[source]

Determine nearest neighbor molecules to a given source (or sources) and return the data as a dataframe.

Tip

This function performs the same operation as periodic_nearest_neighbors_by_atom(), but is meant for universes containing more than about 250 atoms per frame (the referenced function will be faster for smaller universes).

For a simple cubic periodic system with unit cell dimension a, clusters can be generated as follows. In the example below, additional keyword arguments have been included as they are almost always required in order to correctly identify molecular units semi-empirically.

periodic_nearest_neighbors_by_atom_ooc(u, [0], 40.0, [0, 5, 10, 50],
                                   dmax=40.0, C=1.6, O=1.6)

Argument descriptions can be found below. The additional keyword arguments, dmax, C, O, are passed directly to the two body computation used to determine (semi-empirically) molecular units. Note that although molecules are computed, neighboring molecular units are determine by an atom to atom criteria.

Parameters:
  • uni (Universe) – Universe

  • source (int, str, list) – Integer label or string symbol of source atom

  • a (float) – Cubic unit cell dimension

  • sizes (iterable) – List of slices to create

  • kwargs – Additional keyword arguments to be passed to atom two body calculation

Returns:

dct (dict) – Dictionary of sliced universes and nearest neighbor table

See also

Sliced universe construction can be facilitated by construct().