Interaction Potentials

This package defines several potentials that can be used out of the box. It is straightforward to implement your own potential, see Defining your own potentials. To evaluate the potential, call OrnsteinZernike.evaluate_potential(potential, r). For example:

using OrnsteinZernike, Plots
r = 0.9:0.01:4.0
potential = LennardJones(1.0, 1.0)
u = OrnsteinZernike.evaluate_potential(potential, r)
plot(r, u, xlabel="r", ylabel="u(r)", ylims=(-1,1), label=nothing)
Example block output

Implemented interaction potentials

Below is a list of implemented closures. We use the notation shown in the Theory section.

OrnsteinZernike.CustomPotentialType
CustomPotential

Implements a potential that evaluates a user defined function.

Expects values f, and p, which respecively are a callable and a list of parameters. The function should be called f(r::Number, p) and it should produce either a Number, in the case of a single-component system, or an SMatrix, in the case of a multicomponent system.

Example:

f = (r, p) -> 4*p[1]*((p[2]/r)^12 -  (p[2]/r)^6)
potential = CustomPotential(f, (1.0, 1.0))
source
OrnsteinZernike.GaussianCoreType
GaussianCore

Gaussian core (ultrasoft) pair interaction

u(r) = ϵ * exp(-(r/σ)^2)

Constructors:

  • GaussianCore(ϵ::Number, σ::Number) — single-component
  • GaussianCore(ϵ::AbstractVector, σ::AbstractVector) — mixture with σij = (σi + σj)/2 (additive), ϵij = √(ϵi ϵj) (geometric mean)
  • GaussianCore(ϵij::AbstractMatrix, σij::AbstractMatrix) — explicit pair tables

Example:

potential = GaussianCore(1.0, 1.5)

Example (mixture with mixing rules):

eps = [1.0, 0.8]
sig = [1.0, 1.2]
potential = GaussianCore(eps, sig)
source
OrnsteinZernike.HardSpheresType
HardSpheres

Implements the hard-sphere pair interaction for single component systems $ u(r) = \infty$ for $r < 1$ and $u(r) = 0$ for $r > 1$, or $u_{ij}(r) = \infty$ for $r < D_{ij}$ and $u_{ij}(r) = 0$ for $r > D_{ij}$ for mixtures.

For mixtures expects either a vector $D_i$ of diameters for each of the species in which case an additive mixing rule is used $\left(D_{ij} = (D_{i}+D_{j})/2\right)$ or a matrix $D_ij$ of pair diameters.

Example:

potential = HardSpheres(1.0)

Example:

potential = HardSpheres([0.8, 0.9, 1.0])
Dij = rand(3,3)
potential = HardSpheres(Dij)
source
OrnsteinZernike.LennardJonesType
LennardJones

Implements the Lennard-Jones pair interaction $u(r) = 4\epsilon [(\sigma/r)^{12} - (\sigma/r)^6]$.

Expects values ϵ and σ, which respecively are the strength of the potential and particle size.

Example:

potential = LennardJones(1.0, 2.0)
source
OrnsteinZernike.MorseType
Morse

Morse potential:

u(r) = ϵ * (exp(-2α(r-σ)) - 2 exp(-α(r-σ)))

Constructors:

  • Morse(ϵ::Number, σ::Number, α::Number) — single-component
  • Morse(ϵ::AbstractVector, σ::AbstractVector, α::AbstractVector) — mixture with σij = (σi + σj)/2, ϵij = √(ϵi ϵj), αij = (αi + α_j)/2
  • Morse(ϵij::AbstractMatrix, σij::AbstractMatrix, αij::AbstractMatrix) — explicit pair tables

Example:

potential = Morse(1.0, 1.0, 2.0)

Example (mixture with mixing rules):

eps = [1.0, 0.8]
sig = [1.0, 1.2]
alp = [2.0, 1.5]
potential = Morse(eps, sig, alp)
source
OrnsteinZernike.PowerLawType
PowerLaw

Implements the power law pair interaction $u(r) = \epsilon (\sigma/r)^{n}$.

Expects values ϵ, σ, and n, which respecively are the strength of the potential and particle size.

Example:

potential = PowerLaw(1.0, 2.0, 8)
source
OrnsteinZernike.SquareWellType
SquareWell

Square-well pair interaction:

u(r) = ∞                     if r < σ
     = -ϵ                    if σ ≤ r ≤ λσ
     = 0                     if r > λσ

Constructors:

  • SquareWell(σ::Number, ϵ::Number, λ::Number) — single-component
  • SquareWell(σ::AbstractVector, ϵ::AbstractVector, λ::Number) — mixture with σij = (σi + σj)/2, ϵij = √(ϵi ϵj)
  • SquareWell(σij::AbstractMatrix, ϵij::AbstractMatrix, λ::Number) — explicit pair tables

Example:

potential = SquareWell(1.0, 1.0, 1.5)

Example (mixture with mixing rules):

sig = [0.9, 1.1, 1.0]
eps = [1.0, 0.8, 1.2]
potential = SquareWell(sig, eps, 1.5)
source
OrnsteinZernike.TabulatedPotentialType
TabulatedPotential

Piecewise-linear potential defined on a sorted grid r_grid with values u_grid.

  • Linear interpolation within tabulated range.
  • Extrapolation behavior controlled by extrapolation:
    • :error (default) — throw if r is outside [rmin, rmax]
    • :flat — clamp to end values
    • :linear — extend linearly using end slope

Example:

r = range(0.8, 6.0; length=500) |> collect
u = @. 4.0*((1.0/r)^12 - (1.0/r)^6)  # LJ shape as a table
pot = TabulatedPotential(r, u, :flat)
source
OrnsteinZernike.WCADivisionType
WCADivision{P<:Potential, T, UC}

fields

  • potential::Potential
  • cutoff : ($r_{c}$)
  • U_c : $U(r=r_c)$

Splits the potential at the cutoff point using the WCA splitting rule. This means

\[u(r) = u_{SR}(r) + U_{LR}(r),\]

where $U_{LR}(r) = u(r)$ for $r > r_{c}$, and $U(r_{c})$ for $r < r_{c}$, and $USR(r) = 0$ for $r > r_{c}$, and $U(r) - U(r_{c})$ for $r < r_{c}$.

source
OrnsteinZernike.YukawaType
Yukawa

Screened-Coulomb / Yukawa pair interaction

u(r) = A * exp(-κ r) / r

Constructors:

  • Yukawa(A::Number, κ::Number) — single-component
  • Yukawa(q::AbstractVector, κ::Number) — mixture from "charges": Aij = qi q_j
  • Yukawa(Aij::AbstractMatrix, κ::Number) — mixture with explicit pair amplitudes

Example (single component):

potential = Yukawa(1.0, 2.0)  # A=1, κ=2

Example (mixture from charges):

q  = [1.0, -1.0, 2.0]
pot = Yukawa(q, 1.5)

Example (mixture with explicit A_ij):

Aij = [1.0 0.2; 0.2 0.5]
pot = Yukawa(Aij, 1.0)
source