1: % ****** 10/25/2000 12:00AM Update -O ********
2: \documentstyle[prl,aps,floats,twocolumn]{revtex}
3: %\documentstyle[preprint,aps]{revtex}
4:
5: \begin{document}
6: \draft
7: \twocolumn[\hsize\textwidth\columnwidth\hsize\csname @twocolumnfalse\endcsname
8: % \preprint{PRL, submitted}
9:
10:
11: \title{An efficient, multiple range random walk algorithm to calculate the
12: density of states}
13: \author{Fugao Wang and D. P. Landau}
14: \address{Center for Simulational Physics, The University of Georgia, Athens,
15: Georgia 30602}
16: \date{\today }
17: \maketitle
18:
19: \begin{abstract}
20: We present a new Monte Carlo algorithm that produces results of high
21: accuracy with reduced simulational effort. Independent random walks are
22: performed (concurrently or serially) in different, restricted ranges of
23: energy , and the resultant density of states is modified continuously to
24: produce locally flat histograms. This method permits us to directly access
25: the free energy and entropy, is independent of temperature, and is efficient
26: for the study of both 1st order and 2nd order phase transitions. It should
27: also be useful for the study of complex systems with a rough energy
28: landscape.
29: \end{abstract}
30:
31: \pacs{64.60.Cn, 05.50.+q, 02.70.Lq}
32:
33: % ***** for twoColummn style ********
34: ]
35:
36: Computer simulation has become an essential tool in condensed matter physics
37: \cite{landaubinder}, particularly for the study of phase transitions and
38: critical phenomena. The workhorse for the past half-century has been the
39: Metropolis importance sampling algorithm, but more recently new, efficient
40: algorithms have begun to play a role in allowing simulation to achieve the
41: resolution which is needed to accurately locate and characterize phase
42: transitions. For example, cluster flip algorithms, beginning with the
43: seminal work of Swendsen and Wang ~\cite{Swendsen_Wang}, have been used to
44: reduce critical slowing down near 2nd order transitions. Similarly, the
45: multicanonical ensemble method~\cite{berg} was introduced to overcome the
46: tunneling barrier between coexisting phases at 1st order transitions, and
47: this approach also has utility for systems with a rough energy landscape
48: \cite{janke_kappler,berg_sg,alves}. In both situations, histogram
49: re-weighting techniques~\cite{ferrenberg} can be applied in the analysis to
50: increase the amount of information that can be gleaned from simulational
51: data, but the applicability of reweighting is severely limited in large
52: systems by the statistical quality of the ``wings'' of the histogram. This
53: latter effect is quite important in systems with competing interactions for
54: which short range order effects might occur over very broad temperature
55: ranges or even give rise to frustration that produces a very complicated
56: energy landscape and limit the efficiency of other methods.
57:
58: In this paper, we introduce a new, general, efficient Monte Carlo algorithm
59: that offers substantial advantages over existing approaches. Unlike
60: conventional Monte Carlo methods that directly generate a canonical
61: distribution at a given temperature $g(E)e^{-E/K_{\text{B}}T}$, our approach is to
62: estimate the density of states $g(E)$ accurately via a random walk which
63: produces a flat histogram in energy space. The method can be further
64: enhanced by performing multiple random walks, each for a different range of
65: energy, either serially or in parallel fashion. The resultant pieces of
66: the density of states can be joined together and used to produce canonical
67: averages for the calculation of thermodynamic quantities at essentially any
68: temperature. We will apply our algorithm to the 2-dim ten state Potts model
69: and Ising model which have 1st- and 2nd-order phase transitions,
70: respectively, to demonstrate the efficiency and accuracy of the method.
71:
72: Our algorithm is based on the observation that if we perform a random walk
73: in energy space with a probability proportional to the reciprocal of the
74: density of states ${\frac{1}{g(E)}}$, then a flat histogram is generated for
75: the energy distribution. This is accomplished by modifying the estimated
76: density of states in a systematic way to produce a ``flat'' histogram over
77: the allowed range of energy and simultaneously making the density of states
78: converge to the true value. At the very beginning of the random walk, the
79: density of states is {\it a priori} unknown, so we simply set all densities
80: of states $g(E)$ for all energies $E$ to $g(E)=1$. Then we begin our random
81: walk in energy space by flipping spins randomly. In general, if $E_{1}$ and $
82: E_{2}$ are energies before and after a spin is flipped, the transition
83: probability from energy level $E_{1}$ to $E_{2}$ is simply:
84: \begin{equation}
85: p(E_{1}\rightarrow E_{2})=\min ({\frac{g(E_{1})}{g(E_{2})}},1)
86: \end{equation}
87: This is also the probability to flip the spin.
88: Each time an energy level $E$ is visited, we update the corresponding
89: density of states by multiplying the existing value by a modification
90: factor $f>1$, i.e. $g(E)\rightarrow g(E)\ast f$. The initial modification
91: factor can be as large as $f=f_{0}=e^{1}\simeq 2.71828...$ which allows us
92: to reach all possible energy levels very quickly, even for large systems. We
93: keep walking randomly in energy space and modifying the density of states
94: until the accumulated histogram $H(E)$ is ``flat''. At this point, the
95: density of states converges to the true value with an accuracy proportion to $\ln (f)$
96: . We then reduce the modification factor to a finer one according to some
97: recipe like $f_{1}=\sqrt{f_{0}}$ (any function that monotonically decreases
98: to $1$ will do) and reset the histogram $H(E)=0$. Then we begin the next
99: level random walk with a finer modification factor $f=f_{1}$ , continuing
100: until the histogram is again ``flat'' after which we stop and reduce the
101: modification factor as before, i.e. $f_{i+1}=\sqrt{f_{i}}$. We stop the
102: simulation process when the modification factor is smaller than some predefined
103: final value (such as $f_{\text{final}}=\exp(10^{-8})\simeq 1.00000001$).
104: It is very clear that
105: the modification factor $f$ in our random walk acts as a control parameter
106: for the accuracy of the density of states during the simulation and also
107: determines how many MC sweeps are necessary for the whole simulation. It is
108: impossible to obtain a perfectly flat histogram and the phrase ``flat
109: histogram'' in this paper means that histogram $H(E)$ for all possible $E$
110: is not less than $80\%$ of the average histogram $\langle
111: H(E)\rangle $.
112: Since the density of states is modified every time the state
113: is visited, we only obtain a relative density of states at the end of the
114: simulation. To calculate the absolute values, we use the condition that the
115: number of ground states for the Ising model is 2 (all spins are up or down)
116: to re-scale the density of states; and if multiple walks are performed within
117: different energy ranges, they must be matched up at the boundaries in energy.
118:
119: Because of the exponential growth of the density of states in energy space,
120: it is not efficient to simply update the density of states until enough
121: histogram entries are accumulated. All methods based on the accumulation of
122: entries, such as the histogram method \cite{ferrenberg}, Lee's version of
123: the multicanonical method (entropic sampling)~\cite{berg}, the broad
124: histogram method~\cite{oliveira} and the flat histogram
125: method~\cite{jswang_fh,jswang} have the problem of scalability
126: for large systems.
127: These methods suffer from systematic errors and substantial deviations which
128: increase rapidly for large system size. The algorithm proposed in this
129: paper is of both high efficiency and accuracy over wide ranges of
130: temperature for sizes that are beyond those that are tractable by other
131: approaches.
132:
133: We should point out here that during the random walk (especially for the
134: early stage of iteration), the algorithm does not exactly satisfy the
135: detailed balance condition, since the density of states is modified
136: constantly during the random walk in energy space; however, after many
137: iterations, the density of states converges to the true value very quickly
138: as the modification factor approaches $1$. From eq. (1), we have:
139: \begin{equation}
140: {\frac{1}{g(E_{1})}} p(E_{1}\rightarrow E_{2})={\frac{1}{g(E_{2})}} {
141: p(E_{2}\rightarrow E_{1})}
142: \end{equation}
143: where ${\frac{1}{g(E_{1})}}$ is the probability at the energy level $E_{1}$
144: and $p(E_{1}\rightarrow E_{2})$ is the transition probability from $E_{1}$
145: to $E_{2}$ for the random walk. We can thus conclude that the detailed
146: balance condition is satisfied to within the accuracy proportion to $\ln (f)$.
147:
148: The convergence and accuracy of our algorithm may be tested for a system with a
149: 2nd order transition, the $L\times L$ Ising square lattice
150: with nearest neighbor coupling which is generally perceived as an
151: ideal benchmark for new theories~\cite{landau_ising} and simulation
152: algorithms~\cite{ferrenberg,jswang_prl}. We simulated both small lattices
153: for which exact results are available as well as $L=256$ for which exact
154: enumeration is impossible.
155: In Fig. 1, the densities of states
156: estimated by our algorithm are shown along with
157: the exact results obtained by the method proposed
158: by Beale~\cite{beale}.
159: We only show the density for systems up to $L=50$ which
160: is the maximum size we can calculate with
161: the Mathematica program used in the reference ~\cite{beale}.
162: Since no difference is visible, we show the relative
163: error $\varepsilon (\log(g(E)))$, which is defined as
164: $\varepsilon (X) \equiv {{|(X_{\text{sim}}-X_{\text{exact}})}/{X_{\text{exact}}}|}$
165: for a general quantity $X$ in this paper.
166: With our algorithm we obtain an average error as small as 0.035 \%
167: on the $32\times 32$ lattice with $7\times 10^{5}$ sweeps.
168: It is possible to estimate
169: the density of states for small systems
170: with the broad histogram method~\cite{oliveira}.
171: Recent broad histogram simulational
172: data~\cite{lima} for the 2D Ising model on a $32\times 32$ lattice with
173: $10^{6}$ MC sweeps yielded an average deviation of the microcanonical entropy
174: from about 0.08 \% from the exact solution~\cite{beale}.
175:
176: \begin{figure}[h]
177: \special{psfile=fig1.ps hoffset=-30 voffset=30 hscale=40 vscale=40 angle= 270}
178: \vspace{2.7in}
179: \caption{
180: Comparison of the density of states obtained by our algorithm for
181: 2D Ising model and the exact results calculated by the method in
182: reference [13]. %??
183: Relative errors
184: ($\varepsilon (\log(g(E)))$ are shown in the inset.
185: } %??
186: \end{figure}
187:
188: With the Monte Carlo algorithm proposed in this paper,
189: we can estimate the density of states efficiently even for large systems.
190: Because of the symmetry of the density of states for Ising model $g(E)=g(-E)$,
191: we only need to estimate the density of states in the region $E/N \in [-2, 0]$,
192: where $N$ is total lattice sites.
193: To speed up the simulation for $L=256$,
194: we perform 15 independent random walks, each for a different region
195: of energy from $E/N=-2$ to $E/N=0.2$ using
196: $f_{\text{final}}=\exp(10^{-8})$.
197: To reduce the ``boundary effect",
198: random walks over adjacent energy regions overlap by
199: $\Delta E/N=0.06$.
200: The density of states
201: for $E/N\in[-2,0.2]$ is obtained by joining 15 densities of
202: states from random walks on different energy regions using a
203: total simulational effort of only $6.1\times10^6$ MC sweeps.
204:
205: One advantage of our algorithm is that we can readily calculate the
206: Gibbs free energy and the entropy, quantities which are not directly
207: available in conventional Monte Carlo simulations.
208: With the density of states,
209: the Gibbs free energy can be calculated by
210: \begin{equation}
211: F(T)=-k_{\text{B}}T\ln (Z)=-k_{\text{B}}T\ln (\sum\limits_{E}g(E)e^{-\beta E}).
212: \end{equation}
213: Although it is impossible to calculate the exact density of states
214: of Ising model on a lattice as large as $L=256$ with the method proposed by Beale~\cite{beale},
215: the free energy and specific heat were calculated exactly
216: by Ferdinand and Fisher~\cite{ferdinand_fisher} on finite-size lattices.
217: In Fig. 2, we compare simulational data and exact solutions for the Gibbs free energy
218: as a function of temperature.
219: The agreement is excellent and a
220: more stringent test of the accuracy shows that the relative error
221: $\varepsilon (F)$
222: is smaller than 0.0008\% for temperature region $T\in[0,8]$.
223:
224: \begin{figure}[h]
225: \special{psfile=fig2.ps hoffset=-30 voffset=30 hscale=40 vscale=40 angle= 270}
226: \vspace{2.7in}
227: \caption{
228: Comparison of the
229: Gibbs free energy per lattice site calculated directly from the
230: density of states from our simulation for the $L=256$ Ising model
231: and the exact solutions from reference [15]. %??
232: The relative errors $\varepsilon (F)$
233: are shown in the inset.
234: The density of states was obtained by random walks
235: with only $6.1 \times 10^6$ MC sweeps totally.
236: }
237: \end{figure}
238:
239: The entropy is a very important thermodynamic quantity that cannot be
240: calculated directly in conventional Monte Carlo simulations.
241: It can be estimated by integrating over other thermodynamic quantities,
242: such as specific heat,
243: but such calculations are not so reliable since the specific heat itself is not
244: so easy to estimate accurately.
245: With an accurate density of states estimated by our method, the entropy can be calculated
246: easily by $S(T)={\frac{{U(T)-F(T)}}{T}}$
247: where $U(T)=\langle E\rangle _{T}\equiv {{\sum\limits_{E}Eg(E)e^{-\beta E}}/
248: {\sum\limits_{E}g(E)e^{-\beta E}}}$ is the internal energy.
249: According to our calculation, the errors for $L=256$ are smaller than 1.2\% in
250: all temperature region $T\in[0,8]$.~\cite{fgwang}
251: Very recently, with the flat histogram
252: method~\cite{jswang_fh} and the broad histogram method~\cite{oliveira}, the
253: entropy was estimated with $10^{7}$ MC sweeps for the same model on
254: $32\times 32$ lattice; however, the errors
255: in reference ~\cite{jswang}
256: are even much bigger than our errors for $256\times 256$!
257:
258: A more stringent test of the accuracy of the density of states is
259: calculation of the specific heat defined by the fluctuation expression:
260: \begin{equation}
261: C(T)={\frac{{\langle E^{2}\rangle _{T}-{\langle E\rangle _{T}}^{2}}}{{T^{2}}}
262: }
263: \end{equation}
264: Our simulational data on the finite-size lattice are
265: compared with the exact solution obtained by Ferdinand and
266: Fisher~\cite{ferdinand_fisher} in Fig.3.
267: A stringent test of
268: the accuracy is provided by the inset which shows the relative error
269: $\varepsilon (C)$.
270: The average error over the entire range $T\in [0.4,8]$
271: only used a total of $6.1\times 10^{6}$ MC sweeps is 0.39\%.
272: The relative errors are not bigger than 4.5\% even with fine
273: scale near $T_{\text{c}}$. Recently,
274: Wang, Tay and Swendsen ~\cite{jswang_prl} estimated the specific
275: heat of the same model on a $64\times 64$ lattice by the transition matrix
276: Monte Carlo re-weighting method~\cite{swendsen}, and for a simulation with
277: $2.5\times 10^{7}$ MC sweeps, the maximum error in temperature region $T\in
278: \lbrack 0,8]$ was about 1\%. When we apply our algorithm to the same model
279: on the $64\times 64$ lattice, with a final modification factor of
280: $1.000000001$ and a total of $2\times 10^{7}$ MC sweeps on single processor,
281: the errors of the
282: specific heat are reduced below 0.7\% for all temperature ~\cite{fgwang}.
283: The relatively large errors at low
284: temperature reflect the small values for the specific heat at low
285: temperature.
286: The errors in specific heat estimated from the density of states with
287: broad histogram method are obviously visible even for
288: systems as small as $32 \times 32$~\cite{oliveira}
289: whereas with our method, such differences
290: are invisible even for a system as large as $256 \times 256$.
291:
292: \begin{figure}[h]
293: \special{psfile=fig3.ps hoffset=-30 voffset=30 hscale=40 vscale=40 angle= 270}
294: \vspace{2.7in}
295: \caption{Specific heat for the 2-dim Ising model on a $256
296: \times 256$ lattice in a wide temperature region.
297: The relative error $\protect\epsilon(C)$ are
298: shown in the inset in the figure.
299: }
300: \end{figure}
301:
302: With our algorithm, we not only dramatically reduce the computational effort
303: by avoiding multiple simulations for different temperatures close to the
304: transition, but also overcome the slow kinetics at low temperature or near
305: $T_{c}$ for both first-order and second-order phase transitions since the
306: random walk does not depend on the temperature. To show how our
307: simulation method overcomes the tunneling barrier between order and disorder
308: phases at a 1st-order phase transition, we perform random walks to calculate
309: the density of states for the 2D ten state Potts model~\cite{fywu} with
310: nearest neighbor interactions on square lattices of size $60 \leq L \leq 200 $.
311: In Fig.4, we show
312: the canonical distributions at the temperatures at which the peaks are of
313: equal height. Because of the double peak
314: structure of strongly 1st-order phase transitions~\cite{landau_potts},
315: conventional Monte Carlo simulations are not efficient since it takes an
316: extremely long time to tunnel from one peak to the other.
317: Considering the valley which we find for $L=200$ is as deep as
318: $9\times 10^{-10}$, it is impossible for conventional Monte Carlo algorithms
319: to overcome such a tunneling barrier with available computational resources.
320:
321: \begin{figure}[h]
322: \special{psfile=fig4.ps hoffset=-30 voffset=30 hscale=40 vscale=40 angle= 270}
323: \vspace{2.7in}
324: \caption{ The canonical distributions for the 2-dim ten state Potts model
325: on $L \times L$ lattice at
326: the transition temperature $P(E,T_{\text{c}}) \equiv g(E)e^{-E/K_{\text{B}}T_{\text{c}}}$.
327: For $L=150$ and 200, multiple random walks
328: were performed in different energy regions with locally flat histograms.
329: The distributions at peaks are normalized to 1. The
330: transition temperature $T_{\text{c}}(L)$ is 0.701243 for $L=200$; $T_{\text{c}}(
331: \infty)=0.701232....$(exact solution). In the
332: inset, we show the overall histograms of the random walks for $L=100$ and 200.
333: $3.1 \times 10^7$
334: visits per energy level were used for $L=100$ with a single random walk.
335: With multiple random walks,
336: the density of states for $L=200$ was
337: obtained with only $9.8 \times 10^6$ visits per energy level. }
338: \end{figure}
339:
340: All thermodynamic quantities we discussed so far are directly related to
341: energy. It is also possible to calculate any quantities which may not
342: directly relate to energy.~\cite{fgwang} As an example, the order-parameter
343: for the 2D Ising model can be calculated by $|M(T)|={{\sum\limits_{E
344: }|M(E)|g(E)e^{-\beta E}}/{\sum\limits_{E}g(E)e^{-\beta E}}}$ where
345: $M(E)$ is the average value of the order-parameter at energy level $E$ during
346: the random walk. The random walk is not restricted to energy space, and our
347: algorithm can be applied to any other parameter space.
348: To apply our algorithm to a new system, the only thing we need to
349: know is the Hamiltonian. The algorithm can be optimized to
350: estimate the relevant density of states to
351: the property and temperature range of interest.
352: This new Monte Carlo
353: algorithm should be extremely useful for the study of the complex systems
354: such as spin glass models~\cite{berg_sg} and protein folding problems~\cite{alves}
355: where the energy landscape is very rough and where it is already
356: known that there are problems with other optimization algorithms.
357:
358: We would like to thank C. K. Hu, N. Hatano, P. D. Beale,
359: S. P. Lewis and H-B Schuttler for helpful
360: comments and suggestions. The research project was supported by the National
361: Science Foundation under Grant No. DMR-9727714.
362:
363: \begin{references}
364: \bibitem{landaubinder} D. P. Landau and K. Binder, {\it A Guide to Monte Carlo
365: Methods in Statistical Physics}, (Cambridge U. Press, Cambridge, 2000).
366:
367: \bibitem{Swendsen_Wang} R. H. Swendsen and J.-S. Wang, Phys. Rev. Lett. {\bf
368: 58}, 86 (1987), U. Wolff, Phys. Rev. Lett. {\bf 62}, 361 (1989).
369:
370: \bibitem{berg} B. A. Berg and T. Neuhaus, Phys. Rev. Lett. {\bf 68}, 9
371: (1992), Phys. Lett. B {\bf 267}, 249 (1991), J. Lee, Phys. Rev. Lett. {\bf 71
372: }, 211 (1993). B. A. Berg J. Stat. Phys. {\bf 82}, 323 (1996), B. A. Berg,
373: Nucl. Phys. B, {\bf 63}, 982 (1998).
374:
375: \bibitem{janke_kappler} W. Janke and S. Kappler, Phys. Rev. Lett. {\bf 74},
376: 212 (1995).
377:
378: \bibitem{berg_sg} B. A. Berg and T. Celik, Phys. Rev. Lett. {\bf 69}, 2292
379: (1992), B. A. Berg and W. Janke, Phys. Rev. Lett. {\bf 80}, 4771 (1998), N.
380: Hatano and J. E. Gubernatis in {\it Computer Simulation Studies in Condensed
381: Matter Physics} XII, D. P. Landau, S. P. Lewis and H.-B. Schuttler (eds)
382: (Springer, Berlin, Heidelberg, 2000).
383:
384: \bibitem{alves} N. S. Alves and U. Hansmann, Phys. Rev. Lett. {\bf 84}, 1836
385: (2000).
386:
387: \bibitem{ferrenberg} A. M. Ferrenberg and R. H. Swendsen, Phys. Rev. Lett.
388: {\bf 61}, 2635 (1988), {\bf 63}, 1195 (1989).
389:
390: \bibitem{oliveira} P. M. C. de Oliveira, T. J. P. Penna and H. J. Herrmann,
391: Eur. Phys. J. B. {\bf 1}, 205 (1998), P. M. C. de Oliveira, Eur. Phys. J. B.
392: {\bf 6}, 111 (1998).
393:
394: \bibitem{jswang_fh} Jian-Sheng Wang, Eur. Phys. J. B. {\bf 8}, 287 (1998),
395: Cond-matt-9909177.
396:
397: \bibitem{jswang} Jian-Sheng Wang and Lik Wee Lee, Comput. Phys. Commun. {\bf
398: 127}, 131, (2000).
399:
400: \bibitem{landau_ising} D. P. Landau, Phys Rev. {\bf B 13}, 2997 (1976).
401:
402: \bibitem{jswang_prl} Jian-Sheng Wang, T. K. Tay and R. H. Swendsen, Phys.
403: Rev. Lett. {\bf 82}, 476 (1999).
404:
405: \bibitem{beale} P. D. Beale, Phys. Rev. Lett. {\bf 76}, 78 (1996).
406:
407: \bibitem{lima} A. R. Lima, P. M. C. de Oliveira and T. J. P. Penna, J. Stat.
408: Phys. {\bf 99}, 691, (2000).
409:
410: \bibitem{ferdinand_fisher} A. E. Ferdinand and M. E. Fisher, Phys. Rev. {\bf
411: 185}, 832 (1969).
412:
413: \bibitem{fgwang} Fugao Wang and D. P. Landau, unpublished data.
414:
415: \bibitem{swendsen} R. H. Swendsen, J. S. Wang, S. T Li, B. Diggs, C.
416: Genovese and J. B. Kadane, Cond-matt-9908461.
417:
418: \bibitem{fywu} F. Y. Wu, Rev. Mod. Phys. {\bf 54}, 235 (1982).
419:
420: \bibitem{landau_potts} M. S. S. Challa, D. P. Landau and K. Binder Phys.
421: Rev. B {\bf 34}, 1841, (1986).
422: \end{references}
423:
424: \newpage
425:
426:
427:
428: \end{document}
429:
430: