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)
Implemented interaction potentials
Below is a list of implemented closures. We use the notation shown in the Theory section.
OrnsteinZernike.CustomPotential
— TypeCustomPotential
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))
OrnsteinZernike.HardSpheres
— TypeHardSpheres
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)
OrnsteinZernike.LennardJones
— TypeLennardJones
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)
OrnsteinZernike.PowerLaw
— TypePowerLaw
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)
OrnsteinZernike.WCADivision
— TypeWCADivision{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}$.