pwtools.crys.distances

pwtools.crys.distances(struct, pbc=False, squared=False, fullout=False)[source]

Wrapper for _flib.distsq_frac(). Calculate distances of all atoms in struct.

Parameters:
  • struct (Structure instance)

  • pbc (bool, optional) – Apply PBC wrapping to distances (minimum image distances)

  • squared (bool, optional) – Return squared distances

  • fullout (bool) – See below

Returns:

  • dists (if fullout=False)

  • dists, distvecs, distvecs_frac (if fullout=True)

  • dists (2d array (natoms, natoms)) – (Squared, see squared arg) distances. Note that dists[i,j] == dists[j,i].

  • distvecs ((natoms,natoms,3)) – Cartesian distance vectors.

  • distvecs_frac ((natoms,natoms,3)) – Fractional distance vectors.