Solvers

Having defined a SimpleLiquid and a Closure, one may choose a method by which to solve the equations. The implemented methods are Exact, FourierIteration, NgIteration. If no method is given the solve function, it will use the default NgIteration.

All solvers in some way need to define a grid on which to solve the equations. This is done using the keyword arguments for M and dr, which represent respectively the number of grid points, and the spacing between them. Some solvers have additional settings, such as a tolerance. It is important to ensure that dr is small compared to the features of the interaction potential, and that M*dr is sufficiently large. For $N$ dimensional systems, the grid is constructed such that all M points lie below M*dr, but dr may not be the exact grid spacing between all points.

For the implemented cases, Exact solves the system exactly, or throws an error if the method is not implemented.

OrnsteinZernike.ExactType
Exact <: Method

Solves the system exactly. This is only implemented for specific systems.

Right now, the implemented exact methods are

  • three-dimensional single-component system of hard spheres with the Percus Yevick closure [1]
  • three-dimensional multi-component system of additive hard spheres with the Percus Yevick closure [2]
  • one-dimensional single-component system of hard spheres with the Percus Yevick closure [3]
  • five-dimensional single-component system of hard spheres with the Percus Yevick closure [3]

Construct using

Exact(; M=1000, dr = 10.0/M)

Here, M is the number of points that the exact solution is evaluated on, and dr is the grid spacing. These are used to perform Fourier transformations.

Examples

method = Exact()

method = Exact(M=1000)

method = Exact(M=1000, dr=0.01)

References:

  1. Wertheim, M. S. "Exact solution of the Percus-Yevick integral equation for hard spheres." Physical Review Letters 10.8 (1963): 321.
  2. Baxter, R. J. "Ornstein–Zernike relation and Percus–Yevick approximation for fluid mixtures." The Journal of Chemical Physics 52.9 (1970): 4559-4562.
  3. Leutheusser, E. "Exact solution of the Percus-Yevick equation for a hard-core fluid in odd dimensions." Physica A: Statistical Mechanics and its Applications 127.3 (1984): 667-676.
source

The methods FourierIteration and NgIteration both use recursive iteration to find improved estimates of the solution using Fourier Transforms. NgIteration uses a scheme to accelerate convergence, see Ref. [1].

OrnsteinZernike.FourierIterationType
FourierIteration <: Method

Solves the system by recursive iteration in Fourier Space. Essentially, the algorithm is:

  1. guess an initial γ(r)
  2. find c(r) using the closure relation
  3. fourier transform to get ĉ(k)
  4. find γ(k) using the OZ-eq in k-space
  5. compute γ(r) with a inverse fourier transform
  6. compare with previous value, if not converged go to 2.

Optionally, a mixing rule is used to mix the new and previous iteration of c(r) in step 2.

Arguments:

  • M::Int: number of points discretize the solution on
  • dr::Float64: grid spacing in real space
  • mixing_parameter::Float64: mixing parameter for iteration mixing. A value of 1 is no mixing. Must be between 0 and 1.
  • max_iterations::Int64: maximal number of iterations
  • tolerance::Float64: tolerance to be reached
  • verbose::Bool: whether or not to print convergence information

Default: FourierIteration(; mixing_parameter=0.5, max_iterations=10^5, tolerance=10^-6, verbose=true, M=1000, dr=10.0/M)

source
OrnsteinZernike.NgIterationType
NgIteration <: Method

Solves the system by recursive iteration in Fourier Space, and uses the Ng acceleration method. Essentially, the algorithm is:

  1. guess an initial γ(r)
  2. find c(r) using the closure relation
  3. fourier transform to get ĉ(k)
  4. find γ(k) using the OZ-eq in k-space
  5. compute γ(r) with a inverse fourier transform
  6. use Ng's method to provide a next guess for γ
  7. compare with previous value, if not converged go to 2.

Arguments:

  • M::Int: number of points discretize the solution on
  • dr::Float64: grid spacing in real space
  • N_stages::Int: Number of previous values to take into account for step 6. A higher number should lead to faster convergence, yet more computation time per iteration.
  • max_iterations::Int64: maximal number of iterations
  • tolerance::Float64: tolerance to be reached
  • verbose::Bool: whether or not to print convergence information

Default: NgIteration(; N_stages=3, max_iterations=10^3, tolerance=10^-6, verbose=true, M=1000, dr=10.0/M)

References: Ng, K. C. (1974). Hypernetted chain solutions for the classical one‐component plasma up to Γ= 7000. The Journal of Chemical Physics, 61(7), 2680-2689.

source

Meta-solvers

OrnsteinZernike.DensityRampType
DensityRamp <: Method

Solves the system by iteratively solving systems of increasing density, using the previous solution as initial guess at a higher density. This may help deal with convergence issues.

Arguments

  • method: method by which to solve the system for individual densities.
  • densities: densities to consider. Must be a vector of increasing values.
  • verbose: whether to print information.

Example: DensityRamp(NgIteration(), [0.1, 0.3, 0.4]; verbose=false)

source

References

[1] Ng, K. C. (1974). Hypernetted chain solutions for the classical one‐component plasma up to Γ= 7000. The Journal of Chemical Physics, 61(7), 2680-2689.