CoulombPotential

class torchpme.CoulombPotential(smearing: float | None = None, exclusion_radius: float | None = None)[source]

Smoothed electrostatic Coulomb potential \(1/r\).

Here \(r\) is the inter-particle distance

It can be used to compute:

  1. the full \(1/r\) potential

  2. its short-range (SR) and long-range (LR) parts, the split being determined by a length-scale parameter (called “Inverse” in the code)

  3. the Fourier transform of the LR part

Parameters:
  • smearing (float | None) – float or torch.Tensor containing the parameter often called “sigma” in publications, which determines the length-scale at which the short-range and long-range parts of the naive \(1/r\) potential are separated. The smearing parameter corresponds to the “width” of a Gaussian smearing of the particle density.

  • exclusion_radius (float | None) – A length scale that defines a local environment within which the potential should be smoothly zeroed out, as it will be described by a separate model.

from_dist(dist: Tensor) Tensor[source]

Full \(1/r\) potential as a function of \(r\).

Parameters:

dist (Tensor) – torch.tensor containing the distances at which the potential is to be evaluated.

Return type:

Tensor

lr_from_dist(dist: Tensor) Tensor[source]

Long range of the range-separated \(1/r\) potential.

Used to subtract out the interior contributions after computing the LR part in reciprocal (Fourier) space.

Parameters:

dist (Tensor) – torch.tensor containing the distances at which the potential is to be evaluated.

Return type:

Tensor

lr_from_k_sq(k_sq: Tensor) Tensor[source]

Fourier transform of the LR part potential in terms of \(\mathbf{k^2}\).

Parameters:

k_sq (Tensor) – torch.tensor containing the squared lengths (2-norms) of the wave vectors k at which the Fourier-transformed potential is to be evaluated

Return type:

Tensor

self_contribution() Tensor[source]

A correction that depends exclusively on the “charge” on every particle and on the range splitting parameter. Foe example, in the case of a Coulomb potential, this is the potential generated at the origin by the fictituous Gaussian charge density in order to split the potential into a SR and LR part.

Return type:

Tensor

background_correction() Tensor[source]

A correction designed to compensate for the presence of divergent terms. For instance, the energy of a periodic electrostatic system is infinite when the cell is not charge-neutral. This term then implicitly assumes that a homogeneous background charge of the opposite sign is present to make the cell neutral.

Return type:

Tensor