1 modern monte carlo methods: (2) histogram reweighting (3) transition matrix monte carlo jian-sheng...

39
1 Modern Monte Carlo Methods: Modern Monte Carlo Methods: (2) Histogram Reweighting (2) Histogram Reweighting (3) Transition Matrix Monte Carlo (3) Transition Matrix Monte Carlo Jian-Sheng Wang Jian-Sheng Wang National University of Singapore National University of Singapore

Upload: douglas-dawson

Post on 17-Dec-2015

229 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

1

Modern Monte Carlo Modern Monte Carlo Methods: Methods:

(2) Histogram Reweighting(2) Histogram Reweighting(3) Transition Matrix Monte Carlo(3) Transition Matrix Monte Carlo

Jian-Sheng WangJian-Sheng WangNational University of SingaporeNational University of Singapore

Modern Monte Carlo Modern Monte Carlo Methods: Methods:

(2) Histogram Reweighting(2) Histogram Reweighting(3) Transition Matrix Monte Carlo(3) Transition Matrix Monte Carlo

Jian-Sheng WangJian-Sheng WangNational University of SingaporeNational University of Singapore

Page 2: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

2

Outline• Histogram reweighting• Transition matrix Monte Carlo• Binary-tree summation Monte

Carlo

Page 3: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

3

Methods for Computing Density of States

• Reweighting methods (Salsburg et al, 1959, Ferrenberg-Swendsen, 1988)

• Multi-canonical simulation (Berg et al, 1992)

• Broad Histogram (de Oliveira et al, 1996)• TMMC and flat-histogram (Wang,

Swendsen, et al, 1999)• F.Wang-Landau method (2001)

Micheletti, Laio, and Parrinello, Phys Rev Lett, Apr (2004)

Page 4: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

4

Density of States• The density of states n(E) is the

count of the number of (microscopic) states with energy E, assuming discrete energy levels.

( )

( ) 1E X E

n E

Page 5: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

5

Partition Function in n(E)

• We can express partition function in terms of density of states:

( ) ( )

( )

( )

E X E X

X E E X E

E

E

Z e e

n E e

Thus, if n(E) is calculated, we effectively solved the statistical-mechanics problem.

Page 6: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

6

4. Reweighting 4. Reweighting Methods Methods

4. Reweighting 4. Reweighting Methods Methods

Page 7: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

7

Ferrenberg-Swendsen Histogram Reweighting• Do a canonical ensemble simulation at

temperature T=1/(kBβ), and collect energy histogram, i.e., the counts of occurrence of energy E.

• Thus, density of states can be determined up to a constant:

( ) ( ) EH E n E e

( ) ( ) En E H E e

Page 8: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

8

Calculate Moments of Energy

• From the density of states, we can calculate moments of energy at any other temperature,

( ' )

( ' )'

( )

( )

n E

n EE

E

E H E eE

H E e

Page 9: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

9

Reweighting Result

Result from a single simulation of 2D Ising model at Tc, extrapolated to other temperatures by reweighting

From Ferrenberg and Swendsen, Phys Rev Lett 61 (1988) 2635.

Page 10: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

10

Range of Validity of n(E)

Red curve marked FS is from Ferrenberg-Swendsen method

Relative error of density of states |nMC/nexact-1| from Ferrenberg-Swendsen method and transition matrix Monte Carlo, 3232 Ising at Tc.

From J S Wang and R H Swendsen, J Stat Phys 106 (2002) 245.

Page 11: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

11

Multiple Histogram Method

• Conduct several simulations at different temperatures Ti

• How to combine histogram results Hi(E) properly at different temperatures?

Page 12: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

12

Minimize error at each E

• We do a weighted average from M simulations

• The optimal weight is

( ) ( ) ( ) iEii i i i

i i i

Zn E wn E w H E e

N

( ) /iEi i i iw H E N e Z

Where the proportionality constant is fixed by normalization Σwi = 1, and Zi= ΣE n(E) exp(-βiE)

Page 13: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

13

Multiple Histogram Example

Multiple histogram calculation of the specific heat of the 3D three-state anti-ferromagnetic Potts model, using a cluster algorithm

From J S Wang, R H Swendsen, and R Kotecký, Phys Rev Lett 63 (1989) 109.

Page 14: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

14

5. Transition Matrix 5. Transition Matrix Monte Carlo (TMMC) Monte Carlo (TMMC) 5. Transition Matrix 5. Transition Matrix

Monte Carlo (TMMC) Monte Carlo (TMMC)

Page 15: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

15

Transition Matrix (in energy)

• We define transition matrix

which has the propertyh(E) T(E->E ’) = h(E ’) T(E ’->E)

( ) , ( ' ) '

( ' ) '

1( -> ') ( -> ')

( )

( -> ')

E X E E X E

EE X E

T E E W X Xn E

W X X

h(E) = n(E) e-E/(kT) is energy distribution or exact energy histogram.

Page 16: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

16

Transition Matrix Monte Carlo

• Compute T(E->E ’) with any valid MC algorithms that have micro-canonical property

• Obtain h(E), or equivalently n(E) from energy detailed balance equationSee J.-S. Wang and R. H. Swendsen, J Stat Phys 106 (2002) 245.

Page 17: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

17

Example for Ising Model

• Using single-spin-flip dynamics, the transition matrix W in spin configuration space is

0, if and ' diff er more than 1 spin

1( -> ') min(1, ), diff er by exactly 1 spin

( -> ), diagonal term by normalization

EW eNW

N = Ld is the number of sites.

Page 18: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

18

Transition Matrix for Ising model

where <N (σ,E ’-E )>E is micro-canonical average of number of ways that the system goes to a state with energy E ’, given the current energy is E.

( ' )1( -> ') ( , ' ) min(1, )E E

ET E E N E E e

N

Page 19: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

19

The Ising Model

- +

+

+

+

++

+

++

++

+

++

+

+-

---

-- -

- --

- ----

---- Total energy is

E(σ) = - J ∑<ij> σi σj

sum over nearest neighbors, σ = ±1

NE) is the number of sites, such that flip spin costs energy E.

σ = {σ1, σ2, …, σi, … }

E=0

E=-8J

Page 20: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

20

Broad Histogram Equation (Oliveira)

n(E)<N(σ,E ’-E)>E = n(E ’)<N(σ’,E-E ’)>E ’

• This equation is used to determine density of states as well as to construct a “flat-histogram” algorithm

Page 21: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

21

Flat Histogram Algorithm

1. Pick a site at random2. Flip the spin with probability

3. Where E is current and E ’ is new energy

4. Accumulate statistics for <N(σ,E ’-E)>E

'( ' , ' ) ( )

min 1, min 1,( , ' ) ( ' )

E

E

N E E n EN E E n E

Page 22: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

22

HistogramsHistograms for 2D Ising 32x32 with 107 Monte Carlo steps. Insert is a blow-up of the flat-histogram.

From J-S Wang and L W Lee, Computer Phys Comm 127 (2000) 131.

Flat-histogram

Canonical

Broad histogram

Page 23: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

23

2D Ising ResultSpecific heat of a 256x256 Ising model, using flat-histogram/multi-canonical method. Insert shows relative error. 3 x 107 Monte Carlo sweeps are used.

From J-S Wang, “Monte Carlo and Quasi-Monte Carlo Methods 2000,” K-T Fang et al, eds.

Page 24: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

24

5. Binary Tree 5. Binary Tree Summation Monte Summation Monte

Carlo Carlo

5. Binary Tree 5. Binary Tree Summation Monte Summation Monte

Carlo Carlo

Page 25: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

25

Newman-Ziff Method for Percolation

Start with an empty lattice, compute Q(Γ0)

Page 26: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

26

Newman-Ziff MethodRandomly occupy a bond, compute Q(Γ1)

Page 27: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

27

Newman-Ziff MethodRandomly occupy an unoccupied bond, compute Q(Γ2)

Page 28: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

28

Newman-Ziff MethodAnd so on and compute Q(Γb) with b number of bonds

Page 29: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

29

Newman-Ziff MethodUntil all bonds are occupied, compute Q(ΓM)

Page 30: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

30

Newman-Ziff Method• Any quantity as a function of p is

computed as (for percolation, q = 1)

• Each sweep takes time of O(N)

0

!(1 )

!( )!

Mb M b

bb

MQ p p Q

b M b

Page 31: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

31

Binary Tree Summation• Work in the Fortuin-Kasteleyn

representation, P(Γ) pb(1-p)M-bqNc

• Putting bonds of β-type only (i.e. always merge two clusters into one)

• The steps that do no merge cluster are not explicitly simulated

• Compute weights w(b,i)

See J.-S. Wang, O. Kozan, and R. Swendsen, `Computer Simulation Studies in Condensed Matter Physics XV', p.189, Eds. D. P. Landau, et al (Springer-Verlag, Heidelberg, 2002).

Page 32: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

32

BTS algorithm1. Start with an empty lattice, n0=0,

n1=M, i=0, compute Q(0)2. Pick a type-β bond at random,

merge the clusters A and B3. n0 n0+ nAB – 1, n1 n1-nAB, i i+14. Compute Q(i), goto 2 if i < N-15. Compute weight w(b,i)Where M is total number of bonds, N is number of sites, n0 is number of γ-type bonds and n1 is number of β-type bonds. nAB is number of unoccupied bonds connecting clusters A and B.

Page 33: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

33

Compute Weight• w(0,i) = δi,0

• w(b+1,i) = w(b,i) (n0(i)-b+i) +

w(b,i-1)n1(i-1)/q

Page 34: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

34

Simulated and Re-constructed

Configurations

111 2 N-1 N Mb (bonds)0

1

N-1

22

i (merge sequence)

n1/qn0

simulated path

reconstructed path

fully occupied lattice

Page 35: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

35

Statistical Average at Fixed p

11

0

1

0

0

( , ) ( )

( , )

(1 )

N

b bi

N

bi

Mb M b

b bb

Q W w b i Q i

W w b i

Q p p c Q

Page 36: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

36

cb play the rule of density of states

• We compute cb from

0 1 1

0 1

/ ( 1)( )

bb

b

n n q b cn n M b c

Page 37: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

37

Comparison

Relative error for density of states (or cb for BTS) after 106 Monte Carlo steps.

Note: |n(E)/nex(E)-1| |S(E) – Sex(E)| ] where S(E) = ln n(E).

Page 38: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

38

Some features of BTS• Independent sample in each sweep• Any real values of p can be used

(including negative p)• It is not an importance sampling

method (similar to Sequential MC)• Each sweep takes O(N2)

Page 39: 1 Modern Monte Carlo Methods: (2) Histogram Reweighting (3) Transition Matrix Monte Carlo Jian-Sheng Wang National University of Singapore

39

Summary• Cluster algorithms are best at Tc

• TMMC produces n(E) and uses more information from the samples

• BTS is an interesting variation