displacement#

biotite.structure.displacement(atoms1, atoms2, box=None)[source]#

Measure the displacement vector, i.e. the vector difference, from one array of atom coordinates to another array of coordinates.

Parameters:
atoms1, atoms2ndarray, shape=(m,n,3) or ndarray, shape=(n,3) or ndarray, shape=(3,) or Atom or AtomArray or AtomArrayStack

The atoms to measure the displacement between. The vector from atoms1 to atoms2 is measured. The dimensions may vary. Alternatively an ndarray containing the coordinates can be provided. Usual NumPy broadcasting rules apply.

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

If this parameter is set, periodic boundary conditions are taken into account (minimum-image convention), based on the box vectors given with this parameter. The shape (m,3,3) is only allowed, when the input coordinates comprise multiple models.

Returns:
dispndarray, shape=(m,n,3) or ndarray, shape=(n,3) or ndarray, shape=(3,)

The displacement vector(s). The shape is equal to the shape of the input atoms with the highest dimensionality.

See also

index_displacement

The same calculation, but using atom indices.