API
MuTuner.MuTunerLogger
MuTuner.MuTunerLogger
MuTuner.replay
MuTuner.save
MuTuner.update!
MuTuner.update_forgetful_mean
MuTuner.update_forgetful_mv
MuTuner.update_forgetful_var
MuTuner.MuTunerLogger
— TypeMuTunerLogger{T<:AbstractFloat, S<:Number}
Type to assist with dynamically tuning the chemical potential $mu$ to achieve a target particle density $\langle n \rangle = n_0$.
Fields
n₀::T
: Target filling as intensive value $\langle n \rangle = n_0$.N₀::T
: Target filling as exensive quantity $\langle N \rangle = N_0 = V \cdot n_0$.β::T
: Inverse temperature.V::Int
: System size.u₀::T
: Intensive energy scale.α::T
: Extensive energy scale $\alpha = N / U_0$.c::T
: Fraction of history to discard when calculating averages.μ_tp1::T
: Next chemical potential value for timet+1
.μ_bar::T
: Forgetful mean of the chemical potential.μ_var::T
: Forgetful variance of the chemical potential.N_bar::S
: Forgetful mean of the total particle number, accounting for the sign.N_var::T
: Forgetful variance of the total particle number, accounting for the sign.s_bar::T
: Forgetful mean of the sign.s_var::T
: Forgetful variance of the sign.N²_bar::S
: Forgetful mean of the square of total particle number, accounting for the sign.κ_bar::T
: Forgetful mean of the compressibility.μ_traj::Vector{T}
: Timeseries of chemical potential values, $\mu_t.$N_traj::Vector{S}
: Timeseries of total particle number values accounting for the sign, $s_t \cdot N_t.$s_traj::Vector{S}
: Timeseries of the sign, $s_t.$N²_traj::Vector{S}
: Timeseries of total particle number square values accounting for the sign, $s_t \cdot N^2_t.$
MuTuner.MuTunerLogger
— MethodMuTunerLogger(n₀::T, β::T, V::Int, u₀::T=1.0, μ₀::T=0.0, c::T=0.5,
s::S=zero(T)) where {T<:AbstractFloat, S<:Number}
Constructs an instance of MuTunerLogger
.
Arguments
n₀::T
: Target particle density $\langle n \rangle$.β::T
: Inverse temperature.V::Int
: System size.u₀::T=1.0
: Characteristic intensive energy scale.μ₀::T=0.0
: Initial guess for chemical potential.c::T=0.5
: Fraction of history to discard when calculating forgetful averages and variances.s::S=zero(T)
: An example of the sign, to determine whether the type of the sign if real or complex.
MuTuner.replay
— Methodreplay(μtuner::MuTunerLogger{T}) where {T<:AbstractFloat}
Replay the chemical potential tuner to its current state, returning the time series for all relevant quantities. Note that this functions allocates all new arrays when it returns the time series for various quantities.
MuTuner.save
— Methodsave(μtuner::MuTunerLogger{T,S}, filename::String, filepath::String = "")
Replay the chemical potential tuner to its current state, writing the time series of relevant values to a space-delimited CSV file.
MuTuner.update!
— Methodupdate!(μtuner::MuTunerLogger{T}, n::T, N²::T,
s::S=one(S)) where {T<:AbstractFloat, S<:Number}
Update the chemical potential given new measurements of the particle density n
, the total particle number squared N²
, and the sign s
.
MuTuner.update_forgetful_mean
— Methodupdate_forgetful_mean(x::AbstractVector{T}, x̄ₜ::T, c::E) where {T<:Number, E<:AbstractFloat}
Given the previous value of the forgetful mean x̄ₜ
, calculate its updated value x̄ₜ₊₁
assuming that x[end] = xₜ₊₁
has already been appended to x
. The oldest c
fraction of values is discarded when calculating the forgetful mean.
MuTuner.update_forgetful_mv
— Methodupdate_forgetful_mv(x::AbstractVector{T}, V̄ₜ::T, x̄ₜ::T, c::E) where {T<:Number, E<:AbstractFloat}
Given the previous value of the forgetful variance V̄ₜ
and foregetul mean x̄ₜ
, calculate their updated values V̄ₜ₊₁
and x̄ₜ₊₁
, assuming that x[end] = xₜ₊₁
has already been appended to x
. The oldest c
fraction of values is discarded when calculating the forgetful mean and variance.
MuTuner.update_forgetful_var
— Methodupdate_forgetful_var(x::AbstractVector{T}, V̄ₜ::T, x̄ₜ₊₁::T, x̄ₜ::T, c::E) where {T<:Number, E<:AbstractFloat}
Given the previous value for the forgetful variance V̄ₜ
and foregetul mean x̄ₜ
, and the updated value for the forgetful mean x̄ₜ₊₁
, calculate the updated value V̄ₜ₊₁
, assuming that x[end] = xₜ₊₁
has already been appended to x
. The oldest c
fraction of values is discarded when calculating the forgetful variance.