API Index

WangLandau.FixedFractionalCatchupType
FixedFractionalCatchup(f) <: CatchupStrategy

When a new state is visited for the first time, the density of states is set to a fixed fraction of the smallest current non-zero value.

source
WangLandau.FractionOfMeanType
FractionOfMean(tol)

Define the histogram flatness criterion to be when the smallest non-zero value is greater than tol times the mean, which is calculated from states that have at least min visits.

source
WangLandau.ReduceByFactorType
ReduceByFactor(; kwargs...)

A DosIncrementStrategy to control parameter $\log f$ by multiplying by a constant factor every time a flat histogram occurs, until a desired minimum value is achieved.

Keyword arguments and their default values are:

  • initial = 1.0
  • factor = 0.5: must be less than 1
  • final = 1e-6
source
WangLandau.StableNumVisitsType
StableNumVisits(min, checksteps)

Define the histogram flatness criterion to be when the number of visited states remains constant for a number of steps checksteps. A state is considered visited if it has been sampled at least minvisits times.

This strategy may be more effective for two-dimensional state spaces (i.e. energy and order parameter), see e.g. Tsai, Wang & Landau, Braz. J. Phys. 38 2008 .

Suggested parameters are min = 2000 and check = N * 10^6 for system size N.

source
WangLandau.WangLandauProblemType
WangLandauProblem(statedefn::D)

This is a simple wrapper for the user-defined statedefn that enables the CommonSolve.jl interface. It can be overloaded so that statedefn does not have to be instantiated directly first.

source
WangLandau.WangLandauSimulationType
WangLandauSimulation()

Keyword arguments:

  • check_sweeps = 100: The number of sweeps to perform before checking for flatness. A sweep is N steps where N is the size of the system. See system_size.
  • max_total_steps = Inf:
  • final_logf = 1e-6: when $\log f$ reaches this value the simulation ends.
  • logf_strategy = ReduceByFactor(; final = final_logf): Controls how $f$ is updated. Overrides final_logf.
  • tol = 0.8: Set tolerance for the flatness of the histogram.
  • flat_strategy = FractionOfMean(tol): Define the flatness criterion for the histogram. Overrides tol.
  • tasks_per_thread = 4: a multiplier for determining the number of tasks to @spawn. Set to 0 to disable concurrent threads even if more than one thread is running.
source
CommonSolve.solve!Method
CommonSolve.solve!(sim::WangLandauSimulation; kwargs...)

Run WangLandau algorithm on sim.

source
CommonSolve.step!Method
CommonSolve.step!(sim::WangLandauSimulation, histogram)

Run sim for a single iteration until the histogram is flat.

source
WangLandau.histogram_indexFunction
histogram_index(state::S, statedefn::D, trial::T, old_index::I) -> new_index::I

Calculate the new_index for accessing the density of states, using statedefn, trial or old_index, if necessary.

See also random_trial!.

source
WangLandau.histogram_sizeFunction
histogram_size(statedefn::D)

Return a Tuple of integers that specify the size of the histograms. The first is canonically the number of possible energy levels accessible by statedefn.

source
WangLandau.initialise_stateFunction
initialise_state(statedefn::D) -> (state::S, index::I)

Initialise a new state::S for use in a WangLandauSimulation based on the definition statedefn::D provided to WangLandauProblem. D and S are defined by the user and D should be immutable. This function could copy a configuration that is stored in statedefn, but ideally it should reseed a new configuration. Called from CommonSolve.solve! to seed multiple threads.

source
WangLandau.random_trial!Function
random_trial!(state::S, statedefn::D) -> trial::T, balance_factor::Real

Calculate a random trial move for state based on statedefn.

If a trial move cannot be found returns nothing.

Also returns a balance_factor for altering the acceptance probability; a good choice is the ratio of the number of possible moves from the old state to number of possible moves from the new state, which is typically needed in order to maintain detailed balance.

See also commit_trial!, revert_trial!.

source
WangLandau.revert_trial!Method
revert_trial!(state::S, statedefn::D, trial::T, old_index::I, new_index::I)

Returns state to before trial move was performed, using information from old_index and new_index, if necessary.

By default this returns state unaltered. Alternatively, if this method is defined, then it should be sufficient to define amethod for commit_trial! that returns state unaltered.

See also random_trial!, commit_trial!.

source
WangLandau.system_sizeFunction
system_size(statedefn::D)

Get the canonical size of statedefn, e.g. the number of lattice sites. Used to determine the size of a Monte Carlo sweep.

source
WangLandau.update!Method
update!(strat, sim)

Optionally update strat with information from the simulation sim. Returns nothing.

source
WangLandau.wl_trial!Method
wl_trial!(state, old_index, statedefn, logdos, temp_hist, logf, catchup) -> new_index

Obtain a single trial move, compare to current state and commit or reject. Then increment the density of states logdos and histogram temp_hist, with logf and 1, respectively.

source