Wang and Landau algorithm

Last updated

The Wang and Landau algorithm, proposed by Fugao Wang and David P. Landau, [1] is a Monte Carlo method designed to estimate the density of states of a system. The method performs a non-Markovian random walk 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.

Contents

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 [2] and the folding of proteins. [3] [4] The Wang–Landau sampling is related to the metadynamics algorithm. [5]

Overview

The Wang and Landau algorithm is used to obtain an estimate for the density of states of a system characterized by a cost function. It uses a non-Markovian stochastic process which asymptotically converges to a multicanonical ensemble. [1] (I.e. to a Metropolis–Hastings algorithm 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. [6]

Algorithm

Consider a system defined on a phase space , and a cost function, E, (e.g. the energy), bounded on a spectrum , which has an associated density of states , which is to be estimated. The estimator is . Because Wang and Landau algorithm works in discrete spectra, [1] the spectrum is divided in N discrete values with a difference between them of , such that

.

Given this discrete spectrum, the algorithm is initialized by:

The algorithm then performs a multicanonical ensemble simulation: [1] a Metropolis–Hastings random walk in the phase space of the system with a probability distribution given by and a probability of proposing a new state given by a probability distribution . A histogram 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):

  1. proposing a state according to the arbitrary proposal distribution
  2. accept/refuse the proposed state according to
where and .

After each proposal-acceptance step, the system transits to some value , is incremented by one and the following update is performed:

.

This is the crucial step of the algorithm, and it is what makes the Wang and Landau algorithm non-Markovian: the stochastic process now depends on the history of the process. Hence the next time there is a proposal to a state with that particular energy , that proposal is now more likely refused; in this sense, the algorithm forces the system to visit all of the spectrum equally. [1] The consequence is that the histogram 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. [7] To better and better approximate the exact entropy (and thus histogram's flatness), f is decreased after M proposal-acceptance steps:

.

It was later shown that updating the f by constantly dividing by two can lead to saturation errors. [7] A small modification to the Wang and Landau method to avoid this problem is to use the f factor proportional to , where is proportional to the number of steps of the simulation. [7]

Test system

We want to obtain the DOS for the harmonic oscillator potential.

The analytical DOS is given by,

by performing the last integral we obtain

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 obtained by the Wang–Landau algorithm with .

Sample code

The following is a sample code of the Wang–Landau algorithm in Python, where we assume that a symmetric proposal distribution g is used:

The code considers a "system" which is the underlying system being studied.

currentEnergy=system.randomConfiguration()# A random initial configurationwhilef>epsilon:system.proposeConfiguration()# A proposed configuration is proposedproposedEnergy=system.proposedEnergy()# The energy of the proposed configuration computedifrandom()<exp(entropy[currentEnergy]-entropy[proposedEnergy]):# If accepted, update the energy and the system:currentEnergy=proposedEnergysystem.acceptProposedConfiguration()else:# If rejectedsystem.rejectProposedConfiguration()H[currentEnergy]+=1entropy[currentEnergy]+=fifisFlat(H):# isFlat tests whether the histogram is flat (e.g. 95% flatness)H[:]=0f*=0.5# Refine the f parameter

Wang and Landau molecular dynamics: Statistical Temperature Molecular Dynamics (STMD)

Molecular dynamics (MD) is usually preferable to Monte Carlo (MC), so it is desirable to have a MD algorithm incorporating the basic WL idea for flat energy sampling. That algorithm is Statistical Temperature Molecular Dynamics (STMD), developed [8] by Jaegil Kim et al at Boston University.

An essential first step was made with the Statistical Temperature Monte Carlo (STMC) algorithm. WLMC requires an extensive increase in the number of energy bins with system size, caused by working directly with the density of states. STMC is centered on an intensive quantity, the statistical temperature, , where E is the potential energy. When combined with the relation, , where we set , the WL rule for updating the density of states gives the rule for updating the discretized statistical temperature,

where where is the energy bin size, and denotes the running estimate. We define f as in [1] , a factor >1 that multiplies the estimate of the DOS for the i'th energy bin when the system visits an energy in that bin.

The details are given in Ref [8] . With an initial guess for and the range restricted to lie between and , the simulation proceeds as in WLMC, with significant numerical differences. An interpolation of gives a continuum expression of the estimated upon integration of its inverse, allowing the use of larger energy bins than in WL. Different values of are available within the same energy bin when evaluating the acceptance probability. When histogram fluctuations are less than 20% of the mean, is reduced according to .

STMC was compared with WL for the Ising model and the Lennard-Jones liquid. Upon increasing energy bin size, STMC gets the same results over a considerable range, while the performance of WL deteriorates rapidly. STMD can use smaller initial values of for more rapid convergence. In sum, STMC needs fewer steps to obtain the same quality of results.

Now consider the main result, STMD. It is based on the observation that in a standard MD simulation at temperature with forces derived from the potential energy , where denotes all the positions, the sampling weight for a configuration is . Furthermore, if the forces are derived from a function , the sampling weight is .

For flat energy sampling, let the effective potential be - entropic molecular dynamics. Then the weight is . Since the density of states is , their product gives flat energy sampling.

The forces are calculated as

where denotes the usual force derived from the potential energy. Scaling the usual forces by the factor produces flat energy sampling.

STMD starts with an ordinary MD algorithm at constant and V. The forces are scaled as indicated, and the statistical temperature is updated every time step, using the same procedure as in STMC. As the simulation converges to flat energy sampling, the running estimate converges to the true . Technical details including steps to speed convergence are described in [8] and [9] .

In STMD is called the kinetic temperature as it controls the velocities as usual, but does not enter the configurational sampling, which is unusual. Thus STMD can probe low energies with fast particles. Any canonical average can be calculated with reweighting, but the statistical temperature, , is immediately available with no additional analysis. It is extremely valuable for studying phase transitions. In finite nanosystems has a feature corresponding to every “subphase transition”. For a sufficiently strong transition, an equal-area construction on an S-loop in gives the transition temperature.

STMD has been refined by the BU group [9] , and applied to several systems by them and others. It was recognized by D. Stelter that despite our emphasis on working with intensive quantities, is extensive. However is intensive, and the procedure based on histogram flatness is replaced by cutting in half every fixed number of time steps. This simple change makes STMD entirely intensive and substantially improves performance for large systems [9] . Furthermore, the final value of the intensive is a constant that determines the magnitude of error in the converged , and is independent of system size. STMD is implemented in LAMMPS as fix stmd.

STMD is particularly useful for phase transitions. Equilibrium information is impossible to obtain with a canonical simulation, as supercooling or superheating is necessary to cause the transition. However an STMD run obtains flat energy sampling with a natural progression of heating and cooling, without getting trapped in the low energy or high energy state. Most recently it has been applied to the fluid/gel transition [9] in lipid-wrapped nanoparticles.

Replica exchange STMD [10] has also been presented by the BU group.

Related Research Articles

<span class="mw-page-title-main">Entropy (information theory)</span> Expected amount of information needed to specify the output of a stochastic data source

In information theory, the entropy of a random variable is the average level of "information", "surprise", or "uncertainty" inherent to the variable's possible outcomes. Given a discrete random variable , which takes values in the alphabet and is distributed according to :

<span class="mw-page-title-main">Least squares</span> Approximation method in statistics

The method of least squares is a standard approach in regression analysis to approximate the solution of overdetermined systems by minimizing the sum of the squares of the residuals made in the results of each individual equation.

<span class="mw-page-title-main">Moment of inertia</span> Scalar measure of the rotational inertia with respect to a fixed axis of rotation

The moment of inertia, otherwise known as the mass moment of inertia, angular mass, second moment of mass, or most accurately, rotational inertia, of a rigid body is a quantity that determines the torque needed for a desired angular acceleration about a rotational axis, akin to how mass determines the force needed for a desired acceleration. It depends on the body's mass distribution and the axis chosen, with larger moments requiring more torque to change the body's rate of rotation.

In chemistry, the standard molar entropy is the entropy content of one mole of pure substance at a standard state of pressure and any temperature of interest. These are often chosen to be the standard temperature and pressure.

In the calculus of variations, a field of mathematical analysis, the functional derivative relates a change in a functional to a change in a function on which the functional depends.

<span class="mw-page-title-main">Density of states</span> Number of available physical states per energy unit

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 , where is the number of states in the system of volume whose energies lie in the range from to . It is mathematically represented as a distribution by a probability density function, and it is generally an average over the space and time domains of the various states occupied by the system. The density of states is directly related to the dispersion relations of the properties of the system. High DOS at a specific energy level means that many states are available for occupation.

In mathematics and computing, the Levenberg–Marquardt algorithm, also known as the damped least-squares (DLS) method, is used to solve non-linear least squares problems. These minimization problems arise especially in least squares curve fitting. The LMA interpolates between the Gauss–Newton algorithm (GNA) and the method of gradient descent. The LMA is more robust than the GNA, which means that in many cases it finds a solution even if it starts very far off the final minimum. For well-behaved functions and reasonable starting parameters, the LMA tends to be slower than the GNA. LMA can also be viewed as Gauss–Newton using a trust region approach.

<span class="mw-page-title-main">Boltzmann machine</span> Type of stochastic recurrent neural network

A Boltzmann machine is a stochastic spin-glass model with an external field, i.e., a Sherrington–Kirkpatrick model, that is a stochastic Ising model. It is a statistical physics technique applied in the context of cognitive science. It is also classified as a Markov random field.

In mathematics, a symplectic integrator (SI) is a numerical integration scheme for Hamiltonian systems. Symplectic integrators form the subclass of geometric integrators which, by definition, are canonical transformations. They are widely used in nonlinear dynamics, molecular dynamics, discrete element methods, accelerator physics, plasma physics, quantum physics, and celestial mechanics.

<span class="mw-page-title-main">Hamilton's principle</span> Formulation of the principle of stationary action

In physics, Hamilton's principle is William Rowan Hamilton's formulation of the principle of stationary action. It states that the dynamics of a physical system are determined by a variational problem for a functional based on a single function, the Lagrangian, which may contain all physical information concerning the system and the forces acting on it. The variational problem is equivalent to and allows for the derivation of the differential equations of motion of the physical system. Although formulated originally for classical mechanics, Hamilton's principle also applies to classical fields such as the electromagnetic and gravitational fields, and plays an important role in quantum mechanics, quantum field theory and criticality theories.

<span class="mw-page-title-main">Fundamental thermodynamic relation</span>

In thermodynamics, the fundamental thermodynamic relation are four fundamental equations which demonstrate how four important thermodynamic quantities depend on variables that can be controlled and measured experimentally. Thus, they are essentially equations of state, and using the fundamental equations, experimental data can be used to determine sought-after quantities like G or H (enthalpy). The relation is generally expressed as a microscopic change in internal energy in terms of microscopic changes in entropy, and volume for a closed system in thermal equilibrium in the following way.

The cross-entropy (CE) method is a Monte Carlo method for importance sampling and optimization. It is applicable to both combinatorial and continuous problems, with either a static or noisy objective.

Uncertainty quantification (UQ) is the science of quantitative characterization and estimation of uncertainties in both computational and real world applications. It tries to determine how likely certain outcomes are if some aspects of the system are not exactly known. An example would be to predict the acceleration of a human body in a head-on crash with another car: even if the speed was exactly known, small differences in the manufacturing of individual cars, how tightly every bolt has been tightened, etc., will lead to different results that can only be predicted in a statistical sense.

Monte Carlo in statistical physics refers to the application of the Monte Carlo method to problems in statistical physics, or statistical mechanics.

Non-linear least squares is the form of least squares analysis used to fit a set of m observations with a model that is non-linear in n unknown parameters (m ≥ n). It is used in some forms of nonlinear regression. The basis of the method is to approximate the model by a linear one and to refine the parameters by successive iterations. There are many similarities to linear least squares, but also some significant differences. In economic theory, the non-linear least squares method is applied in (i) the probit regression, (ii) threshold regression, (iii) smooth regression, (iv) logistic link regression, (v) Box–Cox transformed regressors ().

The Bennett acceptance ratio method (BAR) is an algorithm for estimating the difference in free energy between two systems . It was suggested by Charles H. Bennett in 1976.

<span class="mw-page-title-main">Metadynamics</span>

Metadynamics 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 the form of the system's energy landscape. It was first suggested by Alessandro Laio and Michele Parrinello in 2002 and is usually applied within molecular dynamics simulations. MTD closely resembles a number of recent methods such as adaptively biased molecular dynamics, adaptive reaction coordinate forces and local elevation umbrella sampling. More recently, both the original and well-tempered metadynamics were derived in the context of importance sampling and shown to be a special case of the adaptive biasing potential setting. MTD is related to the Wang–Landau sampling.

In statistics and physics, multicanonical ensemble is a Markov chain Monte Carlo sampling technique that uses the Metropolis–Hastings algorithm to compute integrals where the integrand has a rough landscape with multiple local minima. It samples states according to the inverse of the density of states, which has to be known a priori or be computed using other techniques like the Wang and Landau algorithm. Multicanonical sampling is an important technique for spin systems like the Ising model or spin glasses.

<span class="mw-page-title-main">Phonovoltaic</span>

A phonovoltaic (pV) cell converts vibrational (phonons) energy into a direct current much like the photovoltaic effect in a photovoltaic (PV) cell converts light (photon) into power. That is, it uses a p-n junction to separate the electrons and holes generated as valence electrons absorb optical phonons more energetic than the band gap, and then collects them in the metallic contacts for use in a circuit. The pV cell is an application of heat transfer physics and competes with other thermal energy harvesting devices like the thermoelectric generator.

Powell's dog leg method, also called Powell's hybrid method, is an iterative optimisation algorithm for the solution of non-linear least squares problems, introduced in 1970 by Michael J. D. Powell. Similarly to the Levenberg–Marquardt algorithm, it combines the Gauss–Newton algorithm with gradient descent, but it uses an explicit trust region. At each iteration, if the step from the Gauss–Newton algorithm is within the trust region, it is used to update the current solution. If not, the algorithm searches for the minimum of the objective function along the steepest descent direction, known as Cauchy point. If the Cauchy point is outside of the trust region, it is truncated to the boundary of the latter and it is taken as the new solution. If the Cauchy point is inside the trust region, the new solution is taken at the intersection between the trust region boundary and the line joining the Cauchy point and the Gauss-Newton step.

References

  1. 1 2 3 4 5 6 Wang, Fugao & Landau, D. P. (Mar 2001). "Efficient, Multiple-Range Random Walk Algorithm to Calculate the Density of States". Phys. Rev. Lett. 86 (10): 2050–2053. arXiv: cond-mat/0011174 . Bibcode:2001PhRvL..86.2050W. doi:10.1103/PhysRevLett.86.2050. PMID   11289852. S2CID   2941153.
  2. R. E. Belardinelli and S. Manzi and V. D. Pereyra (Dec 2008). "Analysis of the convergence of the 1/t and Wang–Landau algorithms in the calculation of multidimensional integrals". Phys. Rev. E. 78 (6): 067701. arXiv: 0806.0268 . Bibcode:2008PhRvE..78f7701B. doi:10.1103/PhysRevE.78.067701. PMID   19256982. S2CID   8645288.
  3. P. Ojeda and M. Garcia and A. Londono and N.Y. Chen (Feb 2009). "Monte Carlo Simulations of Proteins in Cages: Influence of Confinement on the Stability of Intermediate States". Biophys. J. 96 (3): 1076–1082. arXiv: 0711.0916 . Bibcode:2009BpJ....96.1076O. doi:10.1529/biophysj.107.125369. PMC   2716574 . PMID   18849410.
  4. P. Ojeda & M. Garcia (Jul 2010). "Electric Field-Driven Disruption of a Native beta-Sheet Protein Conformation and Generation of alpha-Helix-Structure". Biophys. J. 99 (2): 595–599. Bibcode:2010BpJ....99..595O. doi:10.1016/j.bpj.2010.04.040. PMC   2905109 . PMID   20643079.
  5. 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. doi:10.1021/ct500077d
  6. Berg, B.; Neuhaus, T. (1992). "Multicanonical ensemble: A new approach to simulate first-order phase transitions". Physical Review Letters. 68 (1): 9–12. arXiv: hep-lat/9202004 . Bibcode:1992PhRvL..68....9B. doi:10.1103/PhysRevLett.68.9. PMID   10045099. S2CID   19478641.
  7. 1 2 3 Belardinelli, R. E. & Pereyra, V. D. (2007). "Wang–Landau algorithm: A theoretical analysis of the saturation of the error". The Journal of Chemical Physics. 127 (18): 184105. arXiv: cond-mat/0702414 . Bibcode:2007JChPh.127r4105B. doi:10.1063/1.2803061. PMID   18020628. S2CID   25162388.
  8. 1 2 3 Kim, Jaegil; Straub, John & Keyes, Tom (Aug 2006). "Statistical-Temperature Monte Carlo and Molecular Dynamics Algorithms". Phys. Rev. Lett. 97 (5): 50601–50604. doi:10.1103/PhysRevLett.97.050601.
  9. 1 2 3 4 Stelter, David & Keyes, Tom (2019). "Simulation of fluid/gel phase equilibrium in lipid vesicles". Soft Matter. 15: 8102–8112. doi:10.1039/c9sm00854c.
  10. Kim, Jaegil; Straub, John & Keyes, Tom (Apr 2012). "Replica Exchange Statistical-Temperature Molecular Dynamics Algorithm". Journal of Physical Chemistry B. 116: 8646–8653. doi:10.1021/jp300366j.