soprano.measure

soprano.measure#

measure.py

Contains utility functions for measuring distances and other quantities at the level of a single ase.Atoms object.

Functions

bondDistance(s, i, j[, bond_matrix])

Return the distance in number of bonds between two atoms.

euclideanDistance(s, i, j[, periodic])

Return the distance between two atoms, in Angstroms.

soprano.measure.bondDistance(s, i, j, bond_matrix=None)[source]#

Return the distance in number of bonds between two atoms. Returns -1 if the two atoms are not connected. Requires NetworkX to be installed to work.

Parameters:
s (ase.Atoms): the structure on which to compute the distance
i (int): index of the first atom
j (int): index of the second atom
bond_matrix (np.ndarray): pre-computed bond matrix to use. If not
provided, will be calculated with default
parameters
Returns:
r (int): computed bond distance
soprano.measure.euclideanDistance(s, i, j, periodic=True)[source]#

Return the distance between two atoms, in Angstroms.

Parameters:
s (ase.Atoms): the structure on which to compute the distance
i (int): index of the first atom
j (int): index of the second atom
periodic (bool): whether to account for periodic boundaries when
computing the distance; default is True
Returns:
r (float): computed distance