biotite.structure.index_distance(atoms, indices, periodic=False, box=None)[source]

Measure the euclidian distance between pairs of atoms.

The pairs refer to indices of a given atom array, whose pairwise distances should be calculated. If an atom array stack is provided, the distances are calculated for each frame/model. In contrast to the distance() function, this function is able to take periodic boundary conditions into account.

atomsAtomArray or AtomArrayStack or ndarray, shape=(n,3) or shape=(m,n,3)

The atoms the indices parameter refers to. The pairwise distances are calculated for these pairs. Alternatively, the atom coordinates can be directly provided as ndarray.

indicesndarray, shape=(k,2)

Pairs of indices that point to atoms.

periodicbool, optional

If set to true, periodic boundary conditions are taken into account (minimum-image convention). The box attribute of the atoms parameter is used for calculation. An alternative box can be provided via the box parameter. By default, periodicity is ignored.

boxndarray, shape=(3,3) or shape=(m,3,3), optional

If this parameter is set, the given box is used instead of the box attribute of atoms.

distndarray, shape=(k,) or shape=(m,k)

The pairwise distances. If atoms is an atom array stack, The distances are calculated for each model.


In case periodic is set to true and if the box is not orthorhombic (at least one angle deviates from 90 degrees), the calculation requires approximately 8 times as long as in the orthorhombic case. Furthermore, it is not guaranteed, that the lowest-distance periodic copy is found for non-orthorhombic boxes; this is especially true for heavily skewed boxes.

See also