structuretoolkit.analyse.distance.get_distances_array

structuretoolkit.analyse.distance.get_distances_array#

structuretoolkit.analyse.distance.get_distances_array(structure: Atoms, p1: ndarray | None = None, p2: ndarray | None = None, mic: bool = True, vectors: bool = False) ndarray[source]#

Return distance matrix of every position in p1 with every position in p2. If p2 is not set, it is assumed that distances between all positions in p1 are desired. p2 will be set to p1 in this case. If both p1 and p2 are not set, the distances between all atoms in the box are returned.

Parameters:
  • structure (ase.atoms.Atoms) – The structure object

  • p1 (numpy.ndarray/list, optional) – Nx3 array of positions. Defaults to None.

  • p2 (numpy.ndarray/list, optional) – Nx3 array of positions. Defaults to None.

  • mic (bool, optional) – Minimum image convention. Defaults to True.

  • vectors (bool, optional) – Return vectors instead of distances. Defaults to False.

Returns:

NxN if vector=False and NxNx3 if vector=True

Return type:

numpy.ndarray