def get_inverse_distance_matrix(self):
"""Calculates the inverse distance matrix A defined as:
A_ij = 1/|r_i - r_j|
For periodic systems the distance of an atom from itself is the
smallest displacement of an atom from one of it's periodic copies, and
the distance of two different atoms is the distance of two closest
copies.
Returns:
np.array: Symmetric 2D matrix containing the pairwise inverse
distances.
"""
if self._inverse_distance_matrix is None:
distance_matrix = self.get_distance_matrix()
with np.errstate(divide='ignore'):
inv_distance_matrix = np.reciprocal(distance_matrix)
self._inverse_distance_matrix = inv_distance_matrix
return self._inverse_distance_matrix
评论列表
文章目录