API Index
WangLandau.WangLandau — Module
WangLandauThis is WangLandau 0.1.1.
WangLandau.CatchupStrategy — Type
CatchupStrategy{B}Strategy for determining how to update the density of states when a new state is visited for the first time.
This occurs before the density of states is updated with parameter f.
API:
B == true
WangLandau.DosIncrementStrategy — Type
DosIncrementStrategyWangLandau.FixedFractionalCatchup — Type
FixedFractionalCatchup(f) <: CatchupStrategyWhen 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.
WangLandau.FlatHistogramStrategy — Type
FlatHistogramStrategyWangLandau.FractionOfMean — Type
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.
WangLandau.NoCatchup — Type
NoCatchup() <: CatchupStrategy{false}The default strategy, does nothing.
WangLandau.ReduceByFactor — Type
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.0factor = 0.5: must be less than 1final = 1e-6
WangLandau.StableNumVisits — Type
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.
WangLandau.WangLandauProblem — Type
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.
WangLandau.WangLandauSimulation — Type
WangLandauSimulation()Keyword arguments:
check_sweeps = 100: The number of sweeps to perform before checking for flatness. A sweep isNsteps whereNis the size of the system. Seesystem_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. Overridesfinal_logf.tol = 0.8: Set tolerance for the flatness of the histogram.flat_strategy = FractionOfMean(tol): Define the flatness criterion for the histogram. Overridestol.tasks_per_thread = 4: a multiplier for determining the number of tasks to@spawn. Set to0to disable concurrent threads even if more than one thread is running.
CommonSolve.init — Method
CommonSolve.init(problem::WangLandauProblem; kwargs...) -> WangLandauSimulationInitialise a WangLandauSimulation based on problem.
CommonSolve.solve — Function
CommonSolve.solve(::WangLandauProblem)::WangLandauSimulationCommonSolve.solve! — Method
CommonSolve.solve!(sim::WangLandauSimulation; kwargs...)Run WangLandau algorithm on sim.
CommonSolve.step! — Method
CommonSolve.step!(sim::WangLandauSimulation, histogram)Run sim for a single iteration until the histogram is flat.
WangLandau.catchup_enabled — Method
catchup_enabled(strat)WangLandau.catchup_value — Function
catchup_value(strat)WangLandau.commit_trial! — Function
commit_trial!(state::S, statedefn::D, trial::T, old_index::I, new_index::I)Update state by applying the trial move, using information from old_index and new_index, if necessary.
See also random_trial!, revert_trial!.
WangLandau.current_value — Function
current_value(strat)Return the current value of $\log f$ from the strat.
WangLandau.expected_iterations — Function
expected_iterations(strat)WangLandau.final_value — Function
final_value(strat)Return the final value of $\log f$ from the strat.
WangLandau.histogram_index — Function
histogram_index(state::S, statedefn::D, trial::T, old_index::I) -> new_index::ICalculate the new_index for accessing the density of states, using statedefn, trial or old_index, if necessary.
See also random_trial!.
WangLandau.histogram_size — Function
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.
WangLandau.initialise_state — Function
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.
WangLandau.isconverged — Function
isconverged(strat)WangLandau.isflat — Function
isflat(strat, hist)::BoolChecks if histogram hist is flat according to the FlatHistogramStrategy.
WangLandau.random_trial! — Function
random_trial!(state::S, statedefn::D) -> trial::T, balance_factor::RealCalculate 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!.
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!.
WangLandau.system_size — Function
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.
WangLandau.update! — Function
update!(strat)WangLandau.update! — Method
update!(strat, sim)WangLandau.update! — Method
update!(strat, sim)Optionally update strat with information from the simulation sim. Returns nothing.
WangLandau.wl_trial! — Method
wl_trial!(state, old_index, statedefn, logdos, temp_hist, logf, catchup) -> new_indexObtain 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.