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.Exact
— TypeExact <: 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:
- Wertheim, M. S. "Exact solution of the Percus-Yevick integral equation for hard spheres." Physical Review Letters 10.8 (1963): 321.
- Baxter, R. J. "Ornstein–Zernike relation and Percus–Yevick approximation for fluid mixtures." The Journal of Chemical Physics 52.9 (1970): 4559-4562.
- 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.
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.FourierIteration
— TypeFourierIteration <: Method
Solves the system by recursive iteration in Fourier Space. Essentially, the algorithm is:
- guess an initial γ(r)
- find c(r) using the closure relation
- fourier transform to get ĉ(k)
- find γ(k) using the OZ-eq in k-space
- compute γ(r) with a inverse fourier transform
- 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 ondr::Float64
: grid spacing in real spacemixing_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 iterationstolerance::Float64
: tolerance to be reachedverbose::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)
OrnsteinZernike.NgIteration
— TypeNgIteration <: Method
Solves the system by recursive iteration in Fourier Space, and uses the Ng acceleration method. Essentially, the algorithm is:
- guess an initial γ(r)
- find c(r) using the closure relation
- fourier transform to get ĉ(k)
- find γ(k) using the OZ-eq in k-space
- compute γ(r) with a inverse fourier transform
- use Ng's method to provide a next guess for γ
- compare with previous value, if not converged go to 2.
Arguments:
M::Int
: number of points discretize the solution ondr::Float64
: grid spacing in real spaceN_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 iterationstolerance::Float64
: tolerance to be reachedverbose::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.
Meta-solvers
OrnsteinZernike.DensityRamp
— TypeDensityRamp <: 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)
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.