Internals
Solvers
ClassicalDFT.step! — Method
step!(ρ::NTuple{Nspecies,A}, solver::AbstractSolver, ρEL::NTuple{Nspecies,A}, ΔρEL::NTuple{Nspecies,A}) where {Nspecies,A<:AbstractArray}Perform an iteration step which updates the species-resolved density profiles ρ according to the solve method solver. The right-hand sides of the species-resolved Euler-Lagrange equations ρEL and the residuals ΔρEL are provided.
Geometries
ClassicalDFT.conv!_func — Method
conv!_func(geom::AbstractGeometry; kwargs...)Return the convolution function of the geometry geom.
Geometry-specific settings can be given in kwargs.
ClassicalDFT.ensure_padding! — Method
ensure_padding!(geom::AbstractGeometry, pad::Real)Ensure that the geometry geom has at least a padding pad at the boundaries. If there is already sufficient padding, do nothing.
ClassicalDFT.floattype — Method
floattype(::Type{<:AbstractGeometry})
floattype(geom::AbstractGeometry)Return the type used for floating-point data and calculations.
ClassicalDFT.integrate_func — Method
integrate_func(geom::AbstractGeometry)Return the integration function of the geometry geom.
ClassicalDFT.isboundary — Method
isboundary(geom::AbstractGeometry, r⃗)Check if the coordinate r⃗ is within a region controlled by the boundary conditions of the geometry geom.
ClassicalDFT.set_boundary! — Method
set_boundary!(ρ::AbstractArray, geom::AbstractGeometry)
set_boundary!(a::AbstractArray, geom::AbstractGeometry, value::Real)
set_boundary!(boundary_func::Function, a::AbstractArray, geom::AbstractGeometry)Set elements of the density profile ρ according to the boundary conditions of geometry geom if only those two arguments are provided.
To set all elements of some array a to the same value, provide the desired value as the third argument. For more fine-grained control, a function boundary_func can be provided as the first argument, which sets elements of a according to this function, which should map from a coordinate r⃗ within the boundary to a desired value.
ClassicalDFT.sum_without_boundary — Method
sum_without_boundary(geom::AbstractGeometry, a::AbstractArray)Sum all elements of a which are not in the boundary of geometry geom.
ClassicalDFT.volume — Method
volume(geom::AbstractGeometry)Return the volume of the system with geometry geom, thereby excluding regions within the boundary as determined by isboundary.
Functionals
ClassicalDFT.floattype — Method
floattype(::Type{<:AbstractFunctional})
floattype(functional::AbstractFunctional)Return the type used for floating-point data and calculations.
ClassicalDFT.lengthscales — Method
lengthscales(functional::AbstractFunctional)Return the length scales (usually the particle sizes) for the given functional.
ClassicalDFT.nspecies — Method
nspecies(::Type{<:AbstractFunctional})
nspecies(functional::AbstractFunctional)Return the number of species that the functional handles.
ClassicalDFT.FMTWeights — Type
Class of FMT weights for use in FMTFunctionals.
ClassicalDFT.weight_functions_Fourier — Method
weight_functions_Fourier(k⃗s::AbstractArray{<:SVector}, R::Real=0.5; p_lanczos::Real=1)Construct weight functions in Fourier space for the given $\vec{k}$-coordinate mesh k⃗s and particle radius R.
ClassicalDFT.weight_functions_projected — Function
weight_functions_projected(zs::AbstractVector{<:Real}, dz::Real, R::Real=0.5)Construct projected weight functions for the uniaxial grid zs with discretization interval dz and particle radius R.
ClassicalDFT.weight_functions_radial — Function
weight_functions_radial(rs::AbstractVector{<:Real}, dr::Real, R::Real=0.5; weight_construction=:from_Fourier, kwargs...)Construct weight functions for the given radial grid rs with discretization interval dr and particle radius R. weight_construction can be:
:from_projected: return the radially symmetric weight functionsω, ω⃗constructed from a backtransform ofω̃, iω̃⃗, which in turn is obtained fromω̄, ω̄⃗using the projection-slice theorem.:from_Fourier: return the radially symmetric weight functionsω, ω⃗constructed from a backtransform ofω̃, iω̃⃗evaluated analytically in Fourier space.
kwargs are forwarded to the low-level functions weight_functions_projected or weight_functions_Fourier which evaluate the weight functions.
Callbacks
ClassicalDFT.init — Method
init(callback::AbstractCallback)Initialize callback. Called once in solve before the start of the iteration. Does nothing by default but can be specialized for subtypes.
Types
ClassicalDFT.AbstractCallback — Type
AbstractCallbackAbstract base type of callbacks
ClassicalDFT.AbstractFunctional — Type
AbstractFunctional{T<:Real,Geom<:AbstractGeometry,Nspecies}Abstract base type of functionals
ClassicalDFT.AbstractGeometry — Type
AbstractGeometry{T<:Real}Abstract base type of geometries
ClassicalDFT.AbstractSolver — Type
AbstractSolver{T<:Real}Abstract base type of solve methods
Convolutions
The low-level convolution functions accept a convolution plan in the keyword argument convplan, which contains preallocated buffers and FFT plans for better performance of repeated evaluations.
ClassicalDFT.Convplan — Type
Convplan(fs::AbstractArray, dims=1:ndims(fs))Plan a convolution along dimensions dims for functions matching the shape and type of fs. The returned struct contains FFT plans and preallocated buffers required for evaluating the convolution in Fourier space.
See also conv!, conv_1d_fft!.
ClassicalDFT.conv! — Method
conv!(result::AbstractVector, ::Type{<:SphericalShellGeometry}, fs::AbstractVector, ḡs::AbstractVector, rs::AbstractVector; kwargs...)Evaluate the convolution of fs, a spherically symmetric function given on a radial grid rs, with ḡs, a spherically symmetric function integrated out over two of the three Cartesian axes, i.e. projected onto rs. The projection-slice theorem is used, which allows a reformulation in terms of conventional (one-dimensional) convolutions. An advantage of convolutions in SphericalShellGeometry over those in SphericalGeometry is that rs does not need to start at the origin.
Elements of fs can be scalar (for scalar functions $f(r)$) or SVectors (for vectorial functions $\vec{f}(r) = f(r) \hat{e}_r$). Similarly, for ḡs, elements can be scalar ($\bar{g}(z)$) or SVectors ($\bar{\vec{g}}(z) = \bar{g}(z) \hat{e}_z$).
kwargs are forwarded to the one-dimensional convolution method.
See also SphericalShellGeometry.
ClassicalDFT.conv! — Method
conv!(result::AbstractVector, ::Type{<:SphericalGeometry}, fs::AbstractVector, gs::AbstractVector, rs::AbstractVector; kwargs...)Evaluate the convolution of spherically symmetric functions fs and gs that are given on the radial grid rs at half-bin sample points starting at the origin (dr/2, 3dr/2, ..., R-dr/2, with discretization dr and outer radius R). The convolution is evaluated in Fourier space using the convolution theorem.
Elements of both fs and gs can be scalar (for scalar functions $a(r)$) or SVectors (for vectorial functions $\vec{a}(r) = a(r) \hat{e}_r$).
See also SphericalGeometry.
ClassicalDFT.conv! — Method
conv!(result::AbstractVector, ::Type{<:CartesianGeometry{1}}, fs::AbstractVector, gs::AbstractVector, dx::Real=1; mode::Symbol=:fft, kwargs...)Evaluate a one-dimensional convolution in real or Fourier space (depending on the value of mode, which can be :direct or :fft).
Elements of fs and gs can be scalar or SVectors. kwargs are forwarded to the low-level convolution methods.
See also conv_1d_direct!, conv_1d_fft!.
ClassicalDFT.conv! — Method
conv!(result::AbstractArray, ::Type{<:CartesianGeometry{D}}, fs::AbstractArray, gs::AbstractArray, dr::Real=1)Evaluate the convolution of the functions fs and gs given on a uniform D-dimensional Cartesian grid with discretization volume dr.
Elements of fs and gs can be scalar or SVectors.
ClassicalDFT.conv — Method
conv(::Type{<:AbstractGeometry}, fs::AbstractArray, gs::AbstractArray, args...; kwargs...)Non-mutating convolution function. Allocates an appropriate output array which is populated via conv!.
ClassicalDFT.conv_1d_direct! — Function
conv_1d_direct!(result::AbstractVector{<:AbstractFloat}, fs::AbstractVector{<:AbstractFloat}, gs::AbstractVector{<:AbstractFloat}, dx::Real=1)Evaluate a one-dimensional convolution via explicit integration in real space.
fs and gs are assumed to be given on a grid of discretization dx and to be periodic, so suitable padding has to be applied before calling this function.
ClassicalDFT.conv_1d_fft! — Function
conv_1d_fft!(result::AbstractVector{<:AbstractFloat}, fs::AbstractVector{<:AbstractFloat}, gs::AbstractVector{<:AbstractFloat}, dx::Real=1; convplan=Convplan(fs))Evaluate a one-dimensional convolution via the convolution theorem in Fourier space.
fs and gs are assumed to be given on a grid of discretization dx and to be periodic, so suitable padding has to be applied before calling this function. For performance, a convplan can be provided.
See also Convplan.
ClassicalDFT.fft — Function
fft(::Type{<:SphericalGeometry}, fs::AbstractVector, rs::AbstractVector, ks::AbstractVector=ks_axes(SphericalGeometry, rs))Evaluate the Fourier transform of the spherically symmetric function fs given on the radial grid rs starting at the origin at half-bin intervals (dr/2, 3dr/2, ..., R-dr/2, with discretization dr and outer radius R). The result is given on the corresponding radial grid in Fourier space, see ks_axes. This transform is also known as: spherical Bessel transform, Fourier-Bessel transform, Hankel transform of order 1/2
Elements of fs can be scalar (for scalar functions $f(r)$) or SVectors (for vectorial functions $\vec{f}(r) = f(r) \hat{e}_r$).
ClassicalDFT.ks_axes — Method
ks_axes(::Type{<:SphericalGeometry}, rs::AbstractVector{<:Real})Return the radial grid in Fourier space that corresponds to the radial real-space grid rs = dr/2:dr:R, where dr is the discretization interval and R is the outer radius.
ClassicalDFT.ks_axes — Method
ks_axes(::Type{<:CartesianGeometry{D}}, rs_axes::NTuple{D,<:AbstractVector})Return the Cartesian axes in Fourier space, which correspond to the D-dimensional Cartesian real-space axes rs_axes.
ClassicalDFT.k⃗s_mesh — Method
k⃗s_mesh(::Type{<:CartesianGeometry{D}}, rs_axes::NTuple{D,<:AbstractVector})Return an iterator over the Cartesian mesh of $\vec{k}$ vectors in Fourier space, which correspond to the D-dimensional Cartesian real-space axes rs_axes.
Utils
ClassicalDFT.iterable_to_tuple — Method
iterable_to_tuple(a; Nspecies, order, name)Convert a to a NTuple{Nspecies}, which may be nested depending on the value of order. a must have a sensible iterable structure.