biotite.structure.index_displacement

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

Measure the displacement, i.e. the vector difference, between pairs of atoms.

The pairs refer to indices of a given atom array, whose pairwise displacement 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.

Parameters
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. The displacement is measured from indices[x,0] to indices[x,1].

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.

Returns
dispndarray, shape=(k,) or shape=(m,k)

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

Warning

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

displacement