monte carlo methods in statistical...

35
Multidimensional integrals Multidimensional integrals in statistical mechanics Symmetric and asymmetric algorithms Biasing Monte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic Simulation Centre School of Mathematics and Physics Queen’s University Belfast Belfast Mario G. Del Pópolo Statistical Mechanics 1 / 35

Upload: phunganh

Post on 18-Mar-2018

220 views

Category:

Documents


3 download

TRANSCRIPT

Page 1: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Monte Carlo Methods in Statistical Mechanics

Mario G. Del Pópolo

Atomistic Simulation CentreSchool of Mathematics and Physics

Queen’s University BelfastBelfast

Mario G. Del Pópolo Statistical Mechanics 1 / 35

Page 2: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Quadrature vs. random samplingImportance sampling

Outline

1 Multidimensional integralsQuadrature vs. random samplingImportance sampling

2 Multidimensional integrals in statistical mechanicsEnsemble averagesMarkov chainsDetailed balance

3 Symmetric and asymmetric algorithmsMetropolis methodCanonical simulationsOther ensembles

4 Biasing

Mario G. Del Pópolo Statistical Mechanics 2 / 35

Page 3: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Quadrature vs. random samplingImportance sampling

Integrals as averages

Standard numerical quadrature:

I =

Z b

af (x)dx ≈ δx

NXi=1

f (xi)

Random sampling with distribution functionρ(x):

I =

Z b

af (x)dx =

Z b

a

„f (x)

ρ(x)

«ρ(x)dx

≈ 1M

MXi=1

f (xi)

ρ(xi)

=

fif (xi)

ρ(xi)

flρ

Mario G. Del Pópolo Statistical Mechanics 3 / 35

Page 4: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Quadrature vs. random samplingImportance sampling

Uniform sampling

Use a random variable X uniformly distributed on [a, b]. Then

ρ(x) =1

b − a

and

I =

Z b

af (x)dx = (b − a)

Z b

af (x)ρ(x)dx = 〈f (x)〉ρ

with variance σ2I =

˙I2¸

− 〈I〉2 given by:

σ2I = (b − a)2

Df (x)2

Eρ− 〈f (x)〉2

ρ

Using N random numbers, x1, · · · , xN , the integral and its variance areestimated by:

iN ≈ b − aN

NXj=1

f (xj) and s2I =

1N

0@ (b − a)2

N

NXj=1

f 2(xj)− i2N

1AMario G. Del Pópolo Statistical Mechanics 4 / 35

Page 5: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Quadrature vs. random samplingImportance sampling

Statistical error

The standard error in iN is given by:

Standard error:

σiN =σI√N

Decreasing the error by one order of magnitude impliesincreasing the sample size, N, in two orders of magnitude

Mario G. Del Pópolo Statistical Mechanics 5 / 35

Page 6: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Quadrature vs. random samplingImportance sampling

Outline

1 Multidimensional integralsQuadrature vs. random samplingImportance sampling

2 Multidimensional integrals in statistical mechanicsEnsemble averagesMarkov chainsDetailed balance

3 Symmetric and asymmetric algorithmsMetropolis methodCanonical simulationsOther ensembles

4 Biasing

Mario G. Del Pópolo Statistical Mechanics 6 / 35

Page 7: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Quadrature vs. random samplingImportance sampling

Importance sampling

In the most general case:

I =

Z b

af (x)dx =

Z b

a

„f (x)

ρ(x)

«ρ(x)dx =

fif (xi)

ρ(xi)

flρ

the variance of I is:

σ2I =

Z b

a

f 2(x)

ρ(x)dx − I2

and the corresponding estimators are:

iN ≈ 1N

NXj=1

f (xj)

ρ(xj)and s2

I =1N

0@ 1N

NXj=1

f 2(xj)

ρ(xj)− i2

N

1A

Mario G. Del Pópolo Statistical Mechanics 7 / 35

Page 8: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Quadrature vs. random samplingImportance sampling

Importance sampling

In the importance sampling method ρ(x) is chosen to be largewhere f (x) is large and small where f (x) is smallA significant random sample is concentrated in the region wheref (x) is large, and contributes more to the integral, instead ofbeing distributed uniformly over the whole interval [a, b]

Under such conditions the following inequality is fulfilled:∫ b

a

f 2(x)

ρ(x)dx < (b − a)

∫ b

af 2(x)dx

The use of ρ(x) reduces the variance, σ2I , with respect to uniform

sampling and leads to a lower standard error: σiN = σI√N

Mario G. Del Pópolo Statistical Mechanics 8 / 35

Page 9: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Quadrature vs. random samplingImportance sampling

Importance vs. uniform sampling

f (x) =

πexp (−σx2) and ρ(x) =

11 + x2

Mario G. Del Pópolo Statistical Mechanics 9 / 35

Page 10: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Ensemble averagesMarkov chainsDetailed balance

Outline

1 Multidimensional integralsQuadrature vs. random samplingImportance sampling

2 Multidimensional integrals in statistical mechanicsEnsemble averagesMarkov chainsDetailed balance

3 Symmetric and asymmetric algorithmsMetropolis methodCanonical simulationsOther ensembles

4 Biasing

Mario G. Del Pópolo Statistical Mechanics 10 / 35

Page 11: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Ensemble averagesMarkov chainsDetailed balance

Calculating ensemble averages

In classical statistical mechanics the ensemble average of B(rN , pN)is calculated as:

〈B〉e =

∫ ∫B(rN , pN)f [N]

0 (rN , pN)drNdpN

with, for example,

f [N]0 (rN , pN) =

1h3NN!

exp (−βH)

QN,V ,Tor f0(rN , pN ; N) =

exp (−β(H− Nµ))

Ξµ,V ,T

How to evaluate 〈B〉e numerically ?

6N-dimensional integral → quadrature and uniform samplingunfeasible

Mario G. Del Pópolo Statistical Mechanics 11 / 35

Page 12: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Ensemble averagesMarkov chainsDetailed balance

Calculating ensemble averages

Solution → Importance sampling: generate random configurationsaccording to a distribution W (rN) so:

〈B〉ce =

RB(rN)f c

0 (rN)drNRf c0 (rN)drN

=

RB(rN) ρ(rN )

ρ(rN )f c0 (rN)drNR ρ(rN )

ρ(rN )f c0 (rN)drN

where we have focused on the configurational contribution to 〈B〉e. Clearly:

〈B〉ce =

〈B/ρ〉ρ〈1/ρ〉ρ

where 〈 〉ρ signifies averages over the distribution:

W (rN) = ρ(rN)× f c0 (rN)

Mario G. Del Pópolo Statistical Mechanics 12 / 35

Page 13: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Ensemble averagesMarkov chainsDetailed balance

Ensemble averages

Challenge: What is the most convenient form of ρ(rN) ?

ρ(rN)must be similar to Bc(rN)f c0 (rN)

Ideal choice → ρ(rN) = f c0 (rN)

The problem has been rephrased: How to generate a series ofrandom configurations so that each state occurs with probabilityρ(rN) = f c

0 (rN) ?Generate a Markov chain of sates, Γn ≡ (rN

n ), with a limitingdistribution f c

0 (rN)

Mario G. Del Pópolo Statistical Mechanics 13 / 35

Page 14: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Ensemble averagesMarkov chainsDetailed balance

Outline

1 Multidimensional integralsQuadrature vs. random samplingImportance sampling

2 Multidimensional integrals in statistical mechanicsEnsemble averagesMarkov chainsDetailed balance

3 Symmetric and asymmetric algorithmsMetropolis methodCanonical simulationsOther ensembles

4 Biasing

Mario G. Del Pópolo Statistical Mechanics 14 / 35

Page 15: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Ensemble averagesMarkov chainsDetailed balance

Markov chains

Markov chain: sequence of random configurations (states or trials)satisfying the following two conditions:

1 The outcome of each trial belongs to a finite set of outcomesΓ1, Γ2, · · · , Γm, called the state space

2 The outcome of each trial depends only on the outcome of theimmediately preceding one

Conditional probability for sequence of steps:

Pr (j, t + 1|i, t ; kt−1, t − 1; · · · ; k0, 0)

Statement 2 implies:

Pr (j, t + 1|i, t ; kt−1, t − 1; · · · ; k0, 0) = Pr (j, t + 1|i, t) Markov process

Pr (j, t + 1|i, t) = Πij are the elements of a transition matrix Π linking states Γi

and Γj

Mario G. Del Pópolo Statistical Mechanics 15 / 35

Page 16: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Ensemble averagesMarkov chainsDetailed balance

Markov chainsBe ρi(t) the probability of being in state i at time t . Then:

ρj(t) =X

i

ρi(t − 1)Πij

or using the row vector ρ(t) = (ρ1(t), ρ2(t), · · · ) and then transition matrix:

ρ(t) = ρ(t − 1)Π

The solution can be written in terms of the left eigenvalues (λi ) and lefteigenvectors (Φi ) of Π:

ρ(t) =X

i

Φiλti and ΦiΠ = λiΦi

Π is an stochastic matrix soP

j Πij = 1 ∀ i . It can be proofed that:1 λi ≤ 1 ∀ i2 There is at least one eigenvalue equal to unity, let us say λ1 = 13 If the Markov chain is irreducible, there is only one eigenvalue equal to

unity

Mario G. Del Pópolo Statistical Mechanics 16 / 35

Page 17: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Ensemble averagesMarkov chainsDetailed balance

Markov chainsAccording to the previous considerations:

limt→∞

ρ(t) = limt→∞

Xi

Φiλti = Φ1

Φ1 is the unique limiting distribution of the Markov chainThe stationary distribution satisfies:

Φ1Π = Φ1 or ρ0Π = ρ0

In statistical mechanics:

ρ0: vector with elements ρ0(Γn) (Γn = position in phase space)

Need to determine the elements of Π satisfying:

Πi,j ≥ 0 ∀ i ;X

j

Πi,j = 1 ∀ i andX

i

ρiΠij = ρj

Πi,j must not depend on the normalisation constant (partition function) ofρ0

Mario G. Del Pópolo Statistical Mechanics 17 / 35

Page 18: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Ensemble averagesMarkov chainsDetailed balance

Outline

1 Multidimensional integralsQuadrature vs. random samplingImportance sampling

2 Multidimensional integrals in statistical mechanicsEnsemble averagesMarkov chainsDetailed balance

3 Symmetric and asymmetric algorithmsMetropolis methodCanonical simulationsOther ensembles

4 Biasing

Mario G. Del Pópolo Statistical Mechanics 18 / 35

Page 19: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Ensemble averagesMarkov chainsDetailed balance

Condition of detailed balance

A useful trick in searching for a solution of the previous equations isto replace:∑

i

ρiΠij = ρj → ρiΠij = ρjΠji Detailed balance

Summing over all states i :∑i

ρiΠij =∑

i

ρjΠji = ρj

∑i

Πji = ρj

In the practice:

Need to generate a sequence of configurations (states, Γn)according to the specified equilibrium distribution ρ0(Γ)

Use ρiΠij = ρjΠji and∑

j Πi,j = 1 to build the transition matrixelements in terms of ρ0

Mario G. Del Pópolo Statistical Mechanics 19 / 35

Page 20: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Outline

1 Multidimensional integralsQuadrature vs. random samplingImportance sampling

2 Multidimensional integrals in statistical mechanicsEnsemble averagesMarkov chainsDetailed balance

3 Symmetric and asymmetric algorithmsMetropolis methodCanonical simulationsOther ensembles

4 Biasing

Mario G. Del Pópolo Statistical Mechanics 20 / 35

Page 21: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Metropolis algorithm

This is an asymmetrical solution to the previous problem:

Metropolis method

Πij = αij for ρj ≥ ρi and i 6= jΠij = αij(ρj/ρi) for ρj < ρi and i 6= j

Πii = 1−∑

j 6=i Πij

α is a symmetrical matrix often called the underlying matrix ofthe Markov chainSince we use (ρj/ρi) we circumvent the problem of calculatingthe normalisation factor (partition function)

Mario G. Del Pópolo Statistical Mechanics 21 / 35

Page 22: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Barker algorithm

Symmetrical solution:

Barker method

Πij = αijρj/(ρi + ρj) for i 6= j

Πii = 1−∑j 6=i

Πij

In both the Metropolis and the Barker method the Markov chain willbe irreducible provided ρi > 0 ∀ i and the underlying symmetricMarkov chain is irreducible.

Mario G. Del Pópolo Statistical Mechanics 22 / 35

Page 23: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Ensemble averages

The calculation of ensemble average of B(rN , pN) :

〈B〉e =

∫ ∫B(rN , pN)f [N]

0 (rN , pN)drNdpN

= 〈B〉ide +

∫B(rN)ρ0(rN)(rN)drN

is achieved by averaging over M successive states of the Markovchain. The average converges to the desired value as M →∞.

〈B〉M =1M

M∑t=1

B(rNt ) =

∑rN∈Γ

B(rN)ρ0(rN)+O(M−1/2) ≡ 〈B〉e+O(M−1/2)

Non-ergodicity can be a serious problem

Mario G. Del Pópolo Statistical Mechanics 23 / 35

Page 24: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Outline

1 Multidimensional integralsQuadrature vs. random samplingImportance sampling

2 Multidimensional integrals in statistical mechanicsEnsemble averagesMarkov chainsDetailed balance

3 Symmetric and asymmetric algorithmsMetropolis methodCanonical simulationsOther ensembles

4 Biasing

Mario G. Del Pópolo Statistical Mechanics 24 / 35

Page 25: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Sampling the canonical ensemble

Aim: Generate a series of particleconfigurations distributed according to:

ρ0(rN) =exp (−βVN )

Zwith

Z =

ZdrN exp (−βVN )

In order to implement the Metropolisalgorithm we need to specify α, whichsatisfies:

αij = αji

For particle n at position rn, αij is defined as:

αij = 1/NR rin ∈ R

αij = 0 rin /∈ R

Mario G. Del Pópolo Statistical Mechanics 25 / 35

Page 26: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Sampling the canonical ensemble

Metropolis algorithm:

Πij = αij for ρj ≥ ρi and i 6= j

Πij = αij (ρj/ρi ) for ρj ≥ ρi and i < j

Πii = 1−Xj 6=i

Πij for i = j

with

ρj

ρi=

exp (−βVN(rNj ))

exp (−βVN(rNi ))

= exp (−βδV jiN)

A randomly chosen particle is movedaccording to α→ Trial move

If δV jiN < 0 then ρj ≥ ρi and the new

configuration is accepted

If δV jiN > 0 the new configuration is accepted

with probability exp (−βδV jiN)

Mario G. Del Pópolo Statistical Mechanics 26 / 35

Page 27: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Organisation of a simulation

Ising H = −JX<ij>

si sj −NX

i=1

Hsi

Read input

?

Initialise

?Markovchain

?��

��Accumulate

averages

?

���

@@@

���

@@@

End ofrun ?

N Y - Write outputvalues

-

Mario G. Del Pópolo Statistical Mechanics 27 / 35

Page 28: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Boundary conditions

Periodic boundary conditions:

Avoid surface effectsPeriodicity introducescorrelations

System size N:

Finite size effects depend oncorrelation length and range ofinteractionsDependence on cell symmetryand shape

Configurational energy:

The Ewald method (trulyperiodic b.c.)Truncation of the intermolecularforces: Minimum image pluscutoff

L

x

Mario G. Del Pópolo Statistical Mechanics 28 / 35

Page 29: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Assessment of the results

The main advantage of Monte Carlo methods is the great flexibility inthe choice of the stochastic matrix Π

When designing a new MC algorithm or running a MC simulations one must:

Ensure the algorithm samples the desired ensemble distribution →detailed balance condition

Ensure every state can eventually be reached from any other ( Markovchain must be irreducible or ergodic)

Test accuracy of random number generator

Standard checks on simulation results:

Steady-state distribution must be reached (discard initial relaxation)Same distribution must be reached starting from different initialconditionsEstimate statistical uncertainties and correlation timesFinite size effects

Mario G. Del Pópolo Statistical Mechanics 29 / 35

Page 30: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Quality of random number generator

Set of X-Y coordinatesproduced with a bad randomnumber generator

Coordinates produced with agood random number generator

Figure taken from Binder & Landau

Mario G. Del Pópolo Statistical Mechanics 30 / 35

Page 31: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Time scales

Evolution of the internal energy,U, and magentisation, M, in theIsing model in the absence ofmagentic field. Note:

Initial relaxation. The twoquantities evolve withdifferent characteristic timescalesIntermediate times. Seriesare stationary and showequilibrium fluctuationsLonger time scale. Globalspin inversion.

Figure taken from Binder & Landau

Mario G. Del Pópolo Statistical Mechanics 31 / 35

Page 32: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Outline

1 Multidimensional integralsQuadrature vs. random samplingImportance sampling

2 Multidimensional integrals in statistical mechanicsEnsemble averagesMarkov chainsDetailed balance

3 Symmetric and asymmetric algorithmsMetropolis methodCanonical simulationsOther ensembles

4 Biasing

Mario G. Del Pópolo Statistical Mechanics 32 / 35

Page 33: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Metropolis methodCanonical simulationsOther ensembles

Simulations in other ensembles

Isobaric-isothermal ensemble (N, P, T ) → allows fluctuations in thevolume

Grand canonical ensemble (µ, V , T ) → allows fluctuations in the numberof particles

etc, etc. · · ·

Example: In a Metropolis grand canonical simulation:

Particle displacements are accepted with probability:min [1, exp (−βδVij)]

Particles are destroyed with probability:min [1, exp (−βδVij + ln (N/zV ))], where z = exp (βµ)/∆3

Particles are created with probability:min [1, exp (−βδVij + ln (zV/(N + 1)))]

Mario G. Del Pópolo Statistical Mechanics 33 / 35

Page 34: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Comment on biasing and detailed balance

Condition of detailed balance:

ρ0(o)× α(o → n)× Pacc(o → n) = ρ0(n)× α(n → o)× Pacc(n → o)

Pacc is the probability that the trial move(o → n) will be accepted. For acanonical simulation it follows that:

Pacc(o → n)

Pacc(n → o)= exp (−βV)

α(n → o)

α(o → n)

Using Metropolis solution, the acceptance rule for a trial MC move is:

Pacc(o → n) = min„

1, exp (−βV)α(n → o)

α(o → n)

«By biasing the probability to generate a trial conformation, α, one couldmake the term on right hand side very close to one. In that case almost

every trial move will be accepted.

Mario G. Del Pópolo Statistical Mechanics 34 / 35

Page 35: Monte Carlo Methods in Statistical Mechanicstitus.phy.qub.ac.uk/members/mario/NSI_Lectures_files/chapter-4.pdfMonte Carlo Methods in Statistical Mechanics Mario G. Del Pópolo Atomistic

Multidimensional integralsMultidimensional integrals in statistical mechanics

Symmetric and asymmetric algorithmsBiasing

Bibliography

"Computer Simulations of Liquids" , by M. P. Allen, D. J. Tildesley.Oxford University Press, 1987" A guide to Monte Carlo simulations in Statistical Physics" , byD. P. Landau and K. Binder. Cambridge University Press, 2005"Modern Theoretical Chemistry", Volume 5, part A. Edited by B.Berne, Plenum Press, 1977."The Monte Carlo Methods in the Physical Sciences ", Edited byJ. E. Gubernatis, AIP Conference Proceedings, vol 690, 2003." Monte Carlo Methods in Chemical Physics ", Edited by D.Ferguson, J. I. Siepmann and D. G. Truhlar. Advances inChemical Physics, vol 105, Wiley, 1999.

Mario G. Del Pópolo Statistical Mechanics 35 / 35