HOME

TheInfoList



OR:

The Wang and Landau algorithm, proposed by Fugao Wang and David P. Landau, is a
Monte Carlo method Monte Carlo methods, or Monte Carlo experiments, are a broad class of computational algorithms that rely on repeated random sampling to obtain numerical results. The underlying concept is to use randomness to solve problems that might be determi ...
designed to
estimate Estimation (or estimating) is the process of finding an estimate or approximation, which is a value that is usable for some purpose even if input data may be incomplete, uncertain, or unstable. The value is nonetheless usable because it is der ...
the
density of states In solid state physics and condensed matter physics, the density of states (DOS) of a system describes the number of modes per unit frequency range. The density of states is defined as D(E) = N(E)/V , where N(E)\delta E is the number of states i ...
of a system. The method performs a non-Markovian
random walk In mathematics, a random walk is a random process that describes a path that consists of a succession of random steps on some mathematical space. An elementary example of a random walk is the random walk on the integer number line \mathbb Z ...
to build the density of states by quickly visiting all the available energy spectrum. The Wang and Landau algorithm is an important method to obtain the density of states required to perform a multicanonical simulation. The Wang–Landau algorithm can be applied to any system which is characterized by a cost (or energy) function. For instance, it has been applied to the solution of numerical integrals and the folding of proteins. The Wang–Landau sampling is related to the
metadynamics Metadynamics (MTD; also abbreviated as METAD or MetaD) is a computer simulation method in computational physics, chemistry and biology. It is used to estimate the free energy and other state functions of a system, where ergodicity is hindered by ...
algorithm.Christoph Junghans, Danny Perez, and Thomas Vogel. "Molecular Dynamics in the Multicanonical Ensemble: Equivalence of Wang–Landau Sampling, Statistical Temperature Molecular Dynamics, and Metadynamics." Journal of Chemical Theory and Computation 10.5 (2014): 1843-1847. doibr>10.1021/ct500077d
/ref>


Overview

The Wang and Landau algorithm is used to obtain an
estimate Estimation (or estimating) is the process of finding an estimate or approximation, which is a value that is usable for some purpose even if input data may be incomplete, uncertain, or unstable. The value is nonetheless usable because it is der ...
for the
density of states In solid state physics and condensed matter physics, the density of states (DOS) of a system describes the number of modes per unit frequency range. The density of states is defined as D(E) = N(E)/V , where N(E)\delta E is the number of states i ...
of a system characterized by a cost function. It uses a non-Markovian
stochastic process In probability theory and related fields, a stochastic () or random process is a mathematical object usually defined as a family of random variables. Stochastic processes are widely used as mathematical models of systems and phenomena that appea ...
which asymptotically converges to a
multicanonical ensemble In statistics and physics, multicanonical ensemble (also called multicanonical sampling or flat histogram) is a Markov chain Monte Carlo sampling technique that uses the Metropolis–Hastings algorithm to compute integrals where the integrand has a ...
. (I.e. to a
Metropolis–Hastings algorithm In statistics and statistical physics, the Metropolis–Hastings algorithm is a Markov chain Monte Carlo (MCMC) method for obtaining a sequence of random samples from a probability distribution from which direct sampling is difficult. This sequ ...
with sampling distribution inverse to the density of states) The major consequence is that this sampling distribution leads to a simulation where the energy barriers are invisible. This means that the algorithm visits all the accessible states (favorable and less favorable) much faster than a Metropolis algorithm.


Algorithm

Consider a system defined on a phase space \Omega, and a cost function, E, (e.g. the energy), bounded on a spectrum E\in\Gamma = _\min,E_\max/math>, which has an associated density of states \rho(E), which is to be estimated. The
estimator In statistics, an estimator is a rule for calculating an estimate of a given quantity based on observed data: thus the rule (the estimator), the quantity of interest (the estimand) and its result (the estimate) are distinguished. For example, the ...
is \hat \rho(E) \equiv \exp(S(E)). Because Wang and Landau algorithm works in discrete spectra, the spectrum \Gamma is divided in N discrete values with a difference between them of \Delta, such that : N = \frac. Given this discrete spectrum, the algorithm is initialized by: *setting all entries of the microcanonical entropy to zero, S(E_i) = 0\ \ i=1,2,...,N *initializing f = 1 and *initializing the system randomly, by putting in a random configuration \boldsymbol\in\Omega. The algorithm then performs a
multicanonical ensemble In statistics and physics, multicanonical ensemble (also called multicanonical sampling or flat histogram) is a Markov chain Monte Carlo sampling technique that uses the Metropolis–Hastings algorithm to compute integrals where the integrand has a ...
simulation: a Metropolis–Hastings random walk in the phase space of the system with a probability distribution given by P(\boldsymbol) = 1/\hat(E(\boldsymbol)) = \exp (-S(E(\boldsymbol))) and a probability of proposing a new state given by a probability distribution g(\boldsymbol \rightarrow \boldsymbol'). A histogram H(E) of visited energies is stored. Like in the Metropolis–Hastings algorithm, a proposal-acceptance step is performed, and consists in (see Metropolis–Hastings algorithm overview): # proposing a state \boldsymbol'\in\Omega according to the arbitrary proposal distribution g(\boldsymbol \rightarrow \boldsymbol') # accept/refuse the proposed state according to :::A(\boldsymbol\rightarrow \boldsymbol') = \min\left(1,e^\frac\right) :::where S = S(E(\boldsymbol)) and S' = S(E(\boldsymbol')). After each proposal-acceptance step, the system transits to some value E_i, H(E_i) is incremented by one and the following update is performed: : S(E_i) \leftarrow S(E_i) + f. This is the crucial step of the algorithm, and it is what makes the Wang and Landau algorithm non-Markovian: the
stochastic process In probability theory and related fields, a stochastic () or random process is a mathematical object usually defined as a family of random variables. Stochastic processes are widely used as mathematical models of systems and phenomena that appea ...
now depends on the history of the process. Hence the next time there is a proposal to a state with that particular energy E_i, that proposal is now more likely refused; in this sense, the algorithm forces the system to visit all of the spectrum equally. The consequence is that the histogram H(E) is more and more flat. However, this flatness depends on how well-approximated the calculated entropy is to the exact entropy, which naturally depends on the value of f. To better and better approximate the exact entropy (and thus histogram's flatness), f is decreased after M proposal-acceptance steps: :f \leftarrow f/2. It was later shown that updating the f by constantly dividing by two can lead to saturation errors. A small modification to the Wang and Landau method to avoid this problem is to use the f factor proportional to 1/t, where t is proportional to the number of steps of the simulation.


Test system

We want to obtain the DOS for the harmonic oscillator potential. : E(x) = x^2, \, The analytical DOS is given by, : \rho(E) = \int \delta (E(x)-E) \, dx= \int \delta (x^2-E) \, dx, by performing the last integral we obtain : \rho(E) \propto \begin E^, \text x \in \mathbb^1 \\ \text, \text x \in \mathbb^2 \\ E^, \text x \in \mathbb^3 \\ \end In general, the DOS for a multidimensional harmonic oscillator will be given by some power of ''E'', the exponent will be a function of the dimension of the system. Hence, we can use a simple harmonic oscillator potential to test the accuracy of Wang–Landau algorithm because we know already the analytic form of the density of states. Therefore, we compare the estimated density of states \hat \rho(E) obtained by the Wang–Landau algorithm with \rho(E).


Sample code

The following is a sample code of the Wang–Landau algorithm in
Python Python may refer to: Snakes * Pythonidae, a family of nonvenomous snakes found in Africa, Asia, and Australia ** ''Python'' (genus), a genus of Pythonidae found in Africa and Asia * Python (mythology), a mythical serpent Computing * Python (pro ...
, where we assume that a symmetric proposal distribution g is used: :g(\boldsymbol'\rightarrow \boldsymbol)=g(\boldsymbol\rightarrow \boldsymbol') The code considers a "system" which is the underlying system being studied. currentEnergy = system.randomConfiguration() # A random initial configuration while (f > epsilon): system.proposeConfiguration() # A proposed configuration is proposed proposedEnergy = system.proposedEnergy() # The energy of the proposed configuration computed if (random() < exp(entropy urrentEnergyentropy roposedEnergy): # If accepted, update the energy and the system: currentEnergy = proposedEnergy system.acceptProposedConfiguration() else: # If rejected system.rejectProposedConfiguration() H urrentEnergy+= 1 entropy urrentEnergy+= f if (isFlat(H)): # isFlat tests whether the histogram is flat (e.g. 95% flatness) H = 0 f *= 0.5 # Refine the f parameter


Wang and Landau molecular dynamics

The Wang and Landau algorithm can be implemented not only in a Monte Carlo simulation but also in a molecular dynamics simulation. To do this would require an escalation of the temperature of the system as follows: : T'(E) \rightarrow \dfrac\cdot T(E), where S(E) is the entropy of the system, T(E) the micro-canonical temperature and T'(E) is the "scaled" temperature used in the simulation.


References

{{reflist, refs= {{cite journal , title = Efficient, Multiple-Range Random Walk Algorithm to Calculate the Density of States , author1=Wang, Fugao , author2=Landau, D. P. , name-list-style=amp , journal = Phys. Rev. Lett. , volume = 86 , issue = 10 , pages = 2050–2053 , date=Mar 2001 , pmid = 11289852 , doi = 10.1103/PhysRevLett.86.2050 , bibcode=2001PhRvL..86.2050W , arxiv = cond-mat/0011174 , s2cid=2941153 {{cite journal , title = Analysis of the convergence of the 1/t and Wang–Landau algorithms in the calculation of multidimensional integrals , author = R. E. Belardinelli and S. Manzi and V. D. Pereyra , journal = Phys. Rev. E , volume = 78 , page = 067701 , date=Dec 2008 , doi = 10.1103/PhysRevE.78.067701 , pmid = 19256982 , issue = 6 , arxiv = 0806.0268 , bibcode = 2008PhRvE..78f7701B , s2cid = 8645288 {{cite journal , title = Monte Carlo Simulations of Proteins in Cages: Influence of Confinement on the Stability of Intermediate States , author = P. Ojeda and M. Garcia and A. Londono and N.Y. Chen , journal = Biophys. J. , volume = 96 , issue = 3 , pages = 1076–1082 , date=Feb 2009 , doi = 10.1529/biophysj.107.125369 , pmid = 18849410 , pmc = 2716574 , bibcode=2009BpJ....96.1076O , arxiv = 0711.0916 {{cite journal , title = Electric Field-Driven Disruption of a Native beta-Sheet Protein Conformation and Generation of alpha-Helix-Structure , author1=P. Ojeda , author2=M. Garcia , name-list-style=amp , journal = Biophys. J. , volume = 99 , issue = 2 , pages = 595–599 , date=Jul 2010 , doi = 10.1016/j.bpj.2010.04.040 , bibcode=2010BpJ....99..595O , pmid=20643079 , pmc=2905109 {{Cite journal , last1 = Berg , first1 = B. , last2 = Neuhaus , first2 = T. , doi = 10.1103/PhysRevLett.68.9 , title = Multicanonical ensemble: A new approach to simulate first-order phase transitions , journal = Physical Review Letters , volume = 68 , issue = 1 , pages = 9–12 , year = 1992 , pmid = 10045099, arxiv = hep-lat/9202004 , bibcode = 1992PhRvL..68....9B , s2cid = 19478641 {{cite journal , title = Wang–Landau algorithm: A theoretical analysis of the saturation of the error , author1=Belardinelli, R. E. , author2=Pereyra, V. D. , name-list-style=amp , journal = The Journal of Chemical Physics , volume = 127 , issue = 18 , page = 184105 , year = 2007 , doi = 10.1063/1.2803061 , pmid=18020628 , arxiv = cond-mat/0702414 , bibcode = 2007JChPh.127r4105B , s2cid=25162388 Markov chain Monte Carlo Statistical algorithms Computational physics Articles with example Python (programming language) code