xnn.common.models.charge_solve.gaussian_coulomb_matrix#

xnn.common.models.charge_solve.gaussian_coulomb_matrix(pos, sigma, cell=None, accuracy=1e-10, background=True)[source]#

A with E = 1/2 q^T A q the Coulomb energy of Gaussian charges, one structure.

Charge i is a normalized Gaussian of standard deviation sigma_i (0: a point charge). Two of them interact through erf(r / (sqrt(2) gamma_ij)) / r with gamma_ij = sqrt(sigma_i^2 + sigma_j^2), and each with itself through 1 / (2 sigma_i sqrt(pi)), so the diagonal is 1 / (sigma_i sqrt(pi)) (zero for a point charge). This is the electrostatic matrix of charge equilibration with Gaussian charges (Ko et al., Nat. Commun. 12, 398, 2021, eq. 3 and 6 without the hardness; the EEQ of D4 with radius sqrt(2) sigma).

For a periodic cell the lattice sum is split the Ewald way at alpha: [erf(r / (sqrt(2) gamma_ij)) - erf(alpha r)] / r over the images within the real-space cutoff, 4 pi / V sum_k exp(-k^2 / 4 alpha^2) / k^2 cos(k . (r_i - r_j)) over k != 0, -2 alpha / sqrt(pi) on the diagonal and, with background, -pi / (V alpha^2) in every element (the neutralizing background of a charged cell). Both tails are cut where they fall below accuracy. Dense and differentiable in pos, sigma and cell; memory O(N^2) times the number of real-space images.

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

  • sigma (Tensor) – Gaussian widths (N,) in the length unit of pos.

  • cell (Tensor or None) – Row-vector cell (3, 3) of a periodic structure (periodic along all three axes); None for a molecule.

  • accuracy (float, optional) – Relative truncation of the Ewald tails, by default 1e-10.

  • background (bool, optional) – Include the neutralizing background of a charged cell, by default True (no effect on a neutral one).

Returns:

(N, N) symmetric, in e^2 per length unit (multiply by the Coulomb constant for an energy).

Return type:

Tensor