pwtools.crys.min_image_convention

pwtools.crys.min_image_convention(sij, copy=False)[source]

Apply minimum image convention to differences of fractional coords.

Handles also cases where coordinates are separated by an arbitrary number of periodic images.

Parameters:
  • sij (ndarray) – Differences of fractional coordinates, usually (natoms, natoms, 3), i.e. a, “matrix” of distance vectors, obtained by smth like sij = coords_frac[:,None,:] - coords_frac[None,:,:] where coords_frac.shape = (natoms,3).

  • copy (bool, optional)

Return type:

sij in-place modified or copy