qimpy.grid.Coulomb

class Coulomb(grid, n_ions)

Bases: object

Coulomb interactions between fields and point charges. TODO: support non-periodic geometries (truncation).

Parameters
  • grid (Grid) –

  • n_ions (int) –

__init__(grid, n_ions)

Initialize coulomb interactions.

Parameters
  • grid (Grid) – Fields for coulomb interaction will be on this grid.

  • n_ions (int) – Number of point charges to optimize Ewald sums for.

Return type

None

Methods

__init__

Initialize coulomb interactions.

ewald

Compute Ewald energy, and optionally accumulate gradients.

stress

Return stress due to Coulomb interaction between rho1 and rho2.

update_lattice_dependent

Update all members that depend on lattice vectors.

Attributes

grid

Grid associated with fields for coulomb interaction

ion_width

Ion-charge gaussian width for embedding and solvation

sigma

Ewald range-separation parameter

iR

Ewald real-space mesh points

iG

Ewald reciprocal-space mesh points

ewald(positions, Z)

Compute Ewald energy, and optionally accumulate gradients. Each gradient contribution is accumulated to a grad attribute, only if the corresponding requires_grad is enabled. Force contributions are collected in positions.grad. Stress contributions are collected in self.grid.lattice.grad.

Parameters
  • positions (Tensor) – Positions (fractional coordinates) of point charges

  • Z (Tensor) – Charges of each point charge

Return type

float

stress(rho1, rho2)

Return stress due to Coulomb interaction between rho1 and rho2. The result has dimensions of energy, appropriate for adding to lattice.grad.

Parameters
Return type

Tensor

update_lattice_dependent(n_ions)

Update all members that depend on lattice vectors.

Parameters

n_ions (int) –

Return type

None

grid: Grid

Grid associated with fields for coulomb interaction

iG: Tensor

Ewald reciprocal-space mesh points

iR: Tensor

Ewald real-space mesh points

ion_width: float

Ion-charge gaussian width for embedding and solvation

sigma: float

Ewald range-separation parameter