xnn.krnn.featurizers.inverse_distance.InverseDistances#

class xnn.krnn.featurizers.inverse_distance.InverseDistances(n_atoms)[source]#

Bases: Module

Inverse interatomic distances 1 / |r_a - r_b| of all pairs a > b.

The pairs are ordered row by row through the strictly lower triangle of the distance matrix: (1, 0), (2, 0), (2, 1), (3, 0), .... In a periodic cell every pair takes its minimum image.

Parameters:

n_atoms (int) – Number of atoms of the molecule.

differences(pos, cell=None)[source]#

(B, D, 3) vectors r_a - r_b of every pair (minimum images in a cell).

Parameters:
Return type:

Tensor

forward(pos, cell=None)[source]#

(B, D) descriptors of (B, N, 3) positions (and (B, 3, 3) cells, rows as vectors).

Parameters:
Return type:

Tensor

pair_gradients(pos, cell=None)[source]#

(B, D, 3) derivatives u = d (1 / r_ab) / d r_a (the derivative by r_b is -u).

They are the only nonzero blocks of the Jacobian: row d of it is u_d on atom a_d and -u_d on atom b_d.

Parameters:
Return type:

Tensor

jacobian(pos, cell=None)[source]#

(B, D, 3N) derivatives of the descriptors by the Cartesian positions.

Parameters:
Return type:

Tensor

permutation_index(perms)[source]#

(Q, D) index of the descriptor of each atom permutation.

For a permutation p of the atoms, x[index[q]] is the descriptor with atom a replaced by atom p[a].

Parameters:

perms (Sequence[Sequence[int]])

Return type:

Tensor