Kernels

Pair kernels are translation-invariant, isotropic functions $K : \mathbb{R}^D \to \mathbb{R}$. Each kernel is a plain Julia type with two methods:

  • (K::MyKernel)(r::SVector{D,T}) — evaluate $K(r)$.
  • grad(K::MyKernel, r::SVector{D,T}) — evaluate $\nabla K(r)$.

The package currently ships two families of concrete kernels; the interface is duck-typed, so user-defined kernels work without inheriting from any abstract type.

MultilevelSummation.InversePowerType
InversePower{N,T}()

The scalar isotropic pair kernel K(r) = 1 / |r|^N. The exponent N is a compile-time type parameter so that ^N becomes a literal integer power; T is the working floating-point type.

Coulomb{T} is provided as the alias InversePower{1,T}.

Singular at r = 0. Callers must ensure non-coincident particles.

source
MultilevelSummation.RationalDecayType
RationalDecay{N,T}(r₀)

The scalar isotropic pair kernel K(r) = 1 / (1 + (|r|/r₀)^N).

Smooth at the origin (equals 1 there), decays like (r₀/|r|)^N for |r| ≫ r₀. N is a compile-time type parameter; r₀::T sets the transition length.

source

Coulomb{T} is provided as the alias InversePower{1,T}.

MultilevelSummation.gradFunction
grad(K, r::SVector{D,T}) -> SVector{D,T}

Gradient of the pair kernel K evaluated at displacement vector r. Each shipped kernel (InversePower{N,T}, RationalDecay{N,T}) implements its own method; user-defined kernels must provide one if they need force evaluation through the MSM pipeline.

source