Public interface
Minimization
ClassicalDFT.solve — Functionsolve(functional::AbstractFunctional, Vext::Union{Array,Function}, T::Number=1; <keyword arguments>)Solve the DFT Euler-Lagrange equation
$\rho(\vec{r}) = A \exp\left(-\beta V_\mathrm{ext}(\vec{r}) + c_1(\vec{r}; [\rho])\right)$
and return the density profile $\rho(\vec{r})$. The direct correlation function $c_1(\vec{r}; [\rho])$ is evaluated via the given functional, the external potential $V_\mathrm{ext}(\vec{r})$ is expected in Vext and $\beta = 1 / (k_B T)$ follows from the given temperature T. The prefactor $A$ is determined either from the chemical potential $\mu$ according to $A = \exp(\beta \mu)$ or from the target mean density $\rho_b$, in which case A sets the normalization of the density profile. Specify either μ or ρb as a keyword argument.
Vext can be given as a discretized array or as a function. In both cases, compatibility with the geometry of the functional must be ensured.
Arguments
μ::Union{Number, Nothing}: Chemical potentialρb::Union{Number, Nothing}: Mean densitysolver::AbstractSolver=PicardIterationSolver(): Solve methodtol::Number=1e-5: Value of $\Vert \Delta \rho \Vert_\infty$ for which convergence is declared. $\Delta \rho$ is determined from the difference of right and left hand side of the DFT Euler-Lagrange equation.maxiter::Integer=1000: Maximum number of iterationscallbacks::Vector{<:AbstractCallback}=AbstractCallback[]: Callbacks that are invoked in each iteration
See also Geometries, Functionals, Callbacks.
ClassicalDFT.PicardIterationSolver — TypePicardIterationSolver(; α=0.05, adaptive=false, αmin=0.001)Construct a solver that uses Picard iteration with mixing parameter α.
One iteration step has the form
$\rho \leftarrow (1 - \alpha) \rho + \alpha \rho_\mathrm{EL}$
where $\rho_\mathrm{EL}$ is determined by evaluating the right hand side of the DFT Euler-Lagrange equation with $\rho$.
If adaptive is true, the solver will reduce α based on the value of $\Vert \rho_\mathrm{EL} - \rho \Vert_\infty$ (but no lower than αmin) to ensure stability, especially during the first few iterations.
Geometries
ClassicalDFT.PlanarGeometry — TypePlanarGeometry(L::Number, dz::Rational; boundary=:periodic, fftconv=true)Construct a planar coordinate system with length L and discretization dz with boundary conditions boundary (one of :periodic, :walls).
fftconv determines if convolutions are evaluated in Fourier space. All quantities are assumed to depend only on the direction $z$ and to be integrated out over the lateral directions $x$ and $y$.
ClassicalDFT.SphericalGeometry — TypeSphericalGeometry(R::Number, dr::Rational, Rsolute::Number=1; boundary=:walls, fftconv=true)Construct a spherical coordinate system with maximum radius R+Rsolute and discretization dr around a solute of radius Rsolute with boundary conditions boundary (one of :walls).
fftconv determines if convolutions are evaluated in Fourier space. All quantities are assumed to depend only on the radial distance $r$ and to be integrated out over the solid angle $\Omega$.
ClassicalDFT.coordinates — Methodcoordinates(geom::AbstractGeometry)Return an array with the coordinates of geom.
Functionals
Constructors of functionals might add padding to the coordinates of the provided geometry. Therefore, use coordinates(geom) only after the construction of a functional with the geometry geom.
ClassicalDFT.CompositeFunctional — TypeCompositeFunctional(geom::AbstractGeometry, functionals...)Construct a functional that is a sum of other functionals in the geometry geom.
A popular example is the hard-sphere + mean-field functional $F_\mathrm{exc}[\rho] = F_\mathrm{exc}^\mathrm{HS}[\rho] + F_\mathrm{exc}^\mathrm{MF}[\rho]$.
The elements of functionals can be Type{<:AbstractFunctional}; in this case the respective functional is constructed with its default keyword arguments. Custom keyword arguments can be passed by providing a NamedTuple that contains the Type of the functional as the first element and suitable keyword arguments in the remaining entries.
Examples
# Pass only the type of the functional to use default keyword arguments
CompositeFunctional(geom, RosenfeldFMTFunctional, LennardJonesMeanFieldFunctional)
# Pass a NamedTuple to provide custom keyword arguments
CompositeFunctional(geom, RosenfeldFMTFunctional, (LennardJonesMeanFieldFunctional, rcut=3.0))Fundamental measure theory
ClassicalDFT.RosenfeldFMTFunctional — TypeRosenfeldFMTFunctional(geom::AbstractGeometry; R::Number=0.5)Construct the Rosenfeld FMT functional [Y. Rosenfeld, Phys. Rev. Lett. 63, 980 (1989)] for hard spheres with radius R in the geometry geom.
ClassicalDFT.WhiteBearFMTFunctional — TypeWhiteBearFMTFunctional(geom::AbstractGeometry; R::Number=0.5)Construct the White Bear FMT functional [R. Roth et. al., J. Phys. Condens. Matter 14, 12063 (2002)] for hard spheres with radius R in the geometry geom.
ClassicalDFT.WhiteBearMkIIFMTFunctional — TypeWhiteBearMkIIFMTFunctional(geom::AbstractGeometry; R::Number=0.5)Construct the White Bear MkII FMT functional [H. Hansen-Goos and R. Roth, J. Phys. Condens. Matter 18, 8413 (2006)] for hard spheres with radius R in the geometry geom.
Mean-field
ClassicalDFT.LennardJonesMeanFieldFunctional — TypeLennardJonesMeanFieldFunctional(geom::AbstractGeometry; rcut::Number=2.5)Construct the Lennard-Jones mean-field functional in the geometry geom with a pair potential cutoff distance of rcut.
The Lennard-Jones pair potential has the form $\phi(r) = 4 (r^{-12} - r^{-6})$ for an inter-particle distance $r = \vert\vec{r} - \vec{r}'\vert < r_\mathrm{cut}$ and is $0$ for $r \geq r_\mathrm{cut}$.
Callbacks
ClassicalDFT.PlotCallback — TypePlotCallback(layout::Plotly.Layout=Plotly.Layout(); every::Int=1)Show an interactive plot of the density profile.
every sets the interval in terms of the iteration count to update the plot.
ClassicalDFT.PrintInfoCallback — TypePrintInfoCallback(quantities::Vector{Symbol}=[:iteration, :Δρ]; every::Int=10)Print various quantities during minimization.
Possible symbols are :iteration, :Δρ, :Ω. every sets the interval in terms of the iteration count to print output.
ClassicalDFT.SleepCallback — TypeSleepCallback(seconds)Sleep for a time of seconds after each iteration step.