uf3.representation.distances.compute_direction_cosines

compute_direction_cosines(sup_positions: numpy.ndarray, distance_matrix: numpy.ndarray, i_where: numpy.ndarray, j_where: numpy.ndarray, n_atoms: int) numpy.ndarray[source]

Intermediate function for computing derivatives for forces.

Parameters
  • sup_positions – atom positions in supercell.

  • distance_matrix – output of spatial.distance.cdist(sup_positions, sup_positions).

  • i_where – indices of i-th atom based on distance mask.

  • j_where – indices of j-th atom based on distance mask.

  • n_atoms – number of atoms in original unit cell.

Returns

np.ndarray of shape (n_atoms, 3, n_distances)

and the second dimension corresponds to x, y, and z directions. Used to evaluate forces.

Return type

drij_dR