xnn.ffnn.models.amoeba_kernels.pairs_forward#

xnn.ffnn.models.amoeba_kernels.pairs_forward(i_, k_, r_vec, scales, keep, keep_d, per, q, d, Q, params, scalars, polar, expol, switch_modes, write_pairs=False, count=None, mixed=False, select=None, tangents=None)[source]#

Launch the pair kernel.

Parameters:
  • i (Tensor) – The pairs (M,) (int64).

  • k (Tensor) – The pairs (M,) (int64).

  • r_vec (Tensor) – r_k - r_i (M, 3) in the working dtype.

  • scales (Tensor) – The eight scale factors per pair (M, 8).

  • keep (Tensor) – Per pair: the Ewald real-space factor of the electrostatics and of the dispersion (one for pairs of molecules), and whether the pair belongs to a periodic cell. keep and keep_d may be None: the kernel then forms them from the distance and the real-space cutoffs of scalars.

  • keep_d (Tensor) – Per pair: the Ewald real-space factor of the electrostatics and of the dispersion (one for pairs of molecules), and whether the pair belongs to a periodic cell. keep and keep_d may be None: the kernel then forms them from the distance and the real-space cutoffs of scalars.

  • per (Tensor) – Per pair: the Ewald real-space factor of the electrostatics and of the dispersion (one for pairs of molecules), and whether the pair belongs to a periodic cell. keep and keep_d may be None: the kernel then forms them from the distance and the real-space cutoffs of scalars.

  • q (Tensor) – The global-frame multipoles (N,), (N, 3), (N, 3, 3).

  • d (Tensor) – The global-frame multipoles (N,), (N, 3), (N, 3, 3).

  • Q (Tensor) – The global-frame multipoles (N,), (N, 3), (N, 3, 3).

  • params (Tensor) – The per-atom parameter table (N, NP) (PARAMS plus the use flag).

  • scalars (Tensor) – The float64 scalars of the evaluation (SCALARS).

  • polar (bool) – Whether the fields and mutual ladders, and the exchange-polarization tensors, are computed.

  • expol (bool) – Whether the fields and mutual ladders, and the exchange-polarization tensors, are computed.

  • switch_modes (tuple of int) – The switch of the repulsion, the charge transfer and the dispersion: 0 none, 1 on the pairs of cells only, 2 on every pair.

  • write_pairs (bool, optional) – Also return the four energies per pair.

  • count (Tensor, optional) – The number of valid pairs as an int32 tensor (1,) on the device (a plan’s); the pairs after it (the padding of the list) are skipped. All M pairs by default.

  • mixed (bool, optional) – Evaluate the ladders in the working precision (Tinker9’s mixed precision) instead of float64; no effect on a float64 evaluation.

  • select (Tensor, optional) – The pairs to visit, increasing (select_pairs()); count is then their number. The others contribute nothing (pairs beyond the cutoff) and get zeros per pair.

  • tangents (tuple of Tensor, optional) – Directions of the pair vectors, charges, dipoles and quadrupoles: the generated tangent kernel (amoeba_tangents) also returns the outputs’ derivatives along them (<key>_t).

  • i_ (Tensor)

  • k_ (Tensor)

Returns:

e_node (N, 4), field_d / field_p (N, 3), du (M, 2), expol (N, 3, 3) (or None) and e_pair (M, 4) (or None).

Return type:

dict