API Index
WangLandau.WangLandau — ModuleWangLandauThis is WangLandau 0.1.0.
WangLandau.CatchupStrategy — TypeCatchupStrategy{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 — TypeDosIncrementStrategyWangLandau.DynamicFractionalCatchup — TypeDynamicFractionalCatchup() <: CatchupStrategyWhen a new state is visited for the first time, the density of states is set to a fraction of the smallest current non-zero value. The fraction is determined from the current value of \log f.
WangLandau.FixedFractionalCatchup — TypeFixedFractionalCatchup(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 — TypeFlatHistogramStrategyWangLandau.FractionOfMean — TypeFractionOfMean(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 — TypeNoCatchup() <: CatchupStrategy{false}The default strategy, does nothing.
WangLandau.ReduceByFactor — TypeReduceByFactor(; 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 — TypeStableNumVisits(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 — TypeWangLandauProblem(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 — TypeWangLandauSimulation()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 — MethodCommonSolve.init(problem::WangLandauProblem; kwargs...) -> WangLandauSimulationInitialise a WangLandauSimulation based on problem.
CommonSolve.solve — FunctionCommonSolve.solve(::WangLandauProblem)::WangLandauSimulationCommonSolve.solve! — MethodCommonSolve.solve!(sim::WangLandauSimulation; kwargs...)Run WangLandau algorithm on sim.
CommonSolve.step! — MethodCommonSolve.step!(sim::WangLandauSimulation, histogram)Run sim for a single iteration until the histogram is flat.
WangLandau.catchup_enabled — Methodcatchup_enabled(strat)WangLandau.catchup_value — Functioncatchup_value(strat)WangLandau.commit_trial! — Functioncommit_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 — Functioncurrent_value(strat)Return the current value of $\log f$ from the strat.
WangLandau.expected_iterations — Functionexpected_iterations(strat)WangLandau.final_value — Functionfinal_value(strat)Return the final value of $\log f$ from the strat.
WangLandau.histogram_index — Functionhistogram_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 — Functionhistogram_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 — Functioninitialise_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 — Functionisconverged(strat)WangLandau.isflat — Functionisflat(strat, hist)::BoolChecks if histogram hist is flat according to the FlatHistogramStrategy.
WangLandau.random_trial! — Functionrandom_trial!(state::S, statedefn::D) -> trial::TCalculate a random trial move for state based on statedefn.
If a trial move cannot be found returns nothing.
See also commit_trial!, revert_trial!.
WangLandau.revert_trial! — Methodrevert_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 — Functionsystem_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! — Functionupdate!(strat)WangLandau.update! — Methodupdate!(strat, sim)WangLandau.update! — Methodupdate!(strat, sim)Optionally update strat with information from the simulation sim. Returns nothing.
WangLandau.wl_trial! — Methodwl_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.