xnn.common.models.pme.spread_charges#

xnn.common.models.pme.spread_charges(charges, pos, cell, mesh, order)[source]#

Charges on the mesh by B-spline assignment (paper eq 4.6).

Parameters:
  • charges (Tensor) – (N,) or (N, C) for several channels.

  • pos (Tensor) – Positions (N, 3).

  • cell (Tensor) – Lattice vectors as rows (3, 3).

  • mesh (list of int) – Mesh dimensions (K_1, K_2, K_3).

  • order (int) – B-spline order p.

Returns:

The charge grid (C, K_1 K_2 K_3) (C = 1 for (N,) charges), the flat grid indices (N, p^3) and the weights (N, p^3) of every atom, for the back-interpolation.

Return type:

tuple of Tensor