an introduction to monte carlo methods in statistical physics

32
An Introduction to Monte Carlo Methods in Statistical Physics Kristen A. Fichthorn The Pennsylvania State University University Park, PA 16803

Upload: steven-hartman

Post on 03-Jan-2016

23 views

Category:

Documents


2 download

DESCRIPTION

An Introduction to Monte Carlo Methods in Statistical Physics. Kristen A. Fichthorn The Pennsylvania State University University Park, PA 16803. 1. C. B. Algorithm: Generate uniform, random x and y between 0 and 1 Calculate the distance d from the origin - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: An Introduction to Monte Carlo Methods in Statistical Physics

An Introduction toMonte Carlo Methodsin Statistical Physics

Kristen A. FichthornThe Pennsylvania State University

University Park, PA 16803

Page 2: An Introduction to Monte Carlo Methods in Statistical Physics

Monte Carlo Methods: A New Way to SolveIntegrals (in the 1950’s)

“Hit or Miss” Method: What is ?

Algorithm:•Generate uniform, random x and y between 0 and 1•Calculate the distance d from the origin

•If d ≤ 1, hit = hit + 1

•Repeat for tot trials

22 yxd

tot

hit

4

OABC Square of Area

CA Curve Under Area x 4

A1

CB

y

x0

1

Page 3: An Introduction to Monte Carlo Methods in Statistical Physics

Monte Carlo Sample Mean Integration

2

1

)( x

x

xfdxF

2

1

)((x)

)(

x

x

xxf

dxF

trials

fF

)(

)(

To Solve:

We Write:

Then: When on Each TrialWe RandomlyChoose from

Page 4: An Introduction to Monte Carlo Methods in Statistical Physics

Monte Carlo Sample Mean Integration:Uniform Sampling to Estimate

21,12

1)( xxx

xxx

10,1 )12(2

1

2/12

tot

tot

xx

12

01

2/12)1( 2x

x

xdxπFTo Estimate

Using a Uniform Distribution

Generate tot Uniform, Random Numbers

Page 5: An Introduction to Monte Carlo Methods in Statistical Physics

Monte Carlo Sample Mean Integrationin Statistical Physics: Uniform Sampling

)(exp rUrdZNVT

Quadraturee.g., with N=100 Molecules3N=300 Coordinates10 Points per Coordinate to Span (-L/2,L/2)10300 Integration Points!!!!

L

LL

tot

UV

Ztot

N

NVT

1

)(exp

Uniform Sample Mean Integration•Generate 300 uniform random coordinates in (-L/2,L/2)•Calculate U•Repeat tot times…

Page 6: An Introduction to Monte Carlo Methods in Statistical Physics

Problems with Uniform Sampling…

L

LL

tot

UV

Ztot

N

NVT

1

)(exp

Too Many Configurations Where

0)(exp rU

Especially for a DenseFluid!!

Page 7: An Introduction to Monte Carlo Methods in Statistical Physics

What is the Average Depth of the Nile?

Integration Using…

Adapted from Frenkel and Smit, “Understanding Molecular Simulation”,Academic Press (2002).

Quadrature vs. Importance Samplingor Uniform Sampling

else , 0

Nile in the if , 1)(

max

1

max

1

w

dw

wd

Page 8: An Introduction to Monte Carlo Methods in Statistical Physics

Importance Sampling for Ensemble Averages

NVT

NVT

NVTNVT

Z

rUr

rArrdA

)(exp)(

)()(

trialsNVT

trials

NVTNVT

AA

AA

If We Want to Estimatean Ensemble AverageEfficiently…

We Just Need toSample It With NVT !!

Page 9: An Introduction to Monte Carlo Methods in Statistical Physics

Importance Sampling: Monte Carloas a Solution to the Master Equation

)'(

),(

),'()'(),()'(),(

''

rr

trP

trPrrtrPrrdt

trdP

rr

: Probability to be at State at Time tr

: Transition Probability per Unit Time from to 'r

r

r

'r

Page 10: An Introduction to Monte Carlo Methods in Statistical Physics

The Detailed Balance Criterion

)'(),'( );(),( rrPrrP NVTNVT

xx

rPrrrPrrdt

rdP

),'()'(),()'(0

),(

After a Long Time, the System Reaches Equilibrium

)()'(exp)(

)'(

)'(

)'(

)()'()'()'(

rUrUr

r

rr

rr

rrrrrr

NVT

NVT

NVTNVT

At Equilibrium, We Have:

This Will Occur if the Transition Probabilities Satisfy Detailed Balance

Page 11: An Introduction to Monte Carlo Methods in Statistical Physics

Metropolis Monte Carlo

)()'( if ,

)()'( if , )(

)'(

)'(

rr')rrα(

rrr

r')rrα(

rr

NVTNVT

NVTNVTNVT

NVT

Nrrrr /1)'()'(

Use:

With:

)'()'()'( rraccrrrr

Let Take the Form:

= Probability to Choose a Particular Moveacc = Probability to Accept the Move

N. Metropolis et al. J. Chem. Phys. 21, 1087 (1953).

Page 12: An Introduction to Monte Carlo Methods in Statistical Physics

Metropolis Monte Carlo

Detailed Balance is Satisfied:

' if , N

1

' if , )'(exp1

)'(

UU

UUUUN

rr

Use:

)'(exp)'(

)'(UU

rr

rr

Page 13: An Introduction to Monte Carlo Methods in Statistical Physics

Metropolis MC Algorithm

Finished?

Yes

No

Give the Particle a RandomDisplacement, Calculate theNew Energy ')'( UrU

Accept the Move with

'exp

1min)'(

UUrr

Select a Particle at Random,Calculate the Energy UrU )(

1

)(

tottot

tottot rAAA

Calculate the Ensemble Average

tot

totAA

Initialize the Positions 0 ;0 tottotA

Page 14: An Introduction to Monte Carlo Methods in Statistical Physics

Periodic Boundary Conditions

L

Ld

If d>L/2 then d=L-d

It’s Like Doing aSimulation on a Torus!

Page 15: An Introduction to Monte Carlo Methods in Statistical Physics

Nearest-Neighbor, Square Lattice Gas

A

B

InteractionsAA

BB

AB

0.0 -1.0kT

0.0 0.0

-1.0kT 0.0

Page 16: An Introduction to Monte Carlo Methods in Statistical Physics

When Is Enough Enough?

0 100000 200000 300000 400000Trials

800

700

600

500

400

300

200

100

ygrenE

Run it Long...

…and Longer!

Page 17: An Introduction to Monte Carlo Methods in Statistical Physics

When Is Enough Enough?

0 2500 5000 7500 10000 12500 15000Trials

1

0.9

0.8

0.7

0.6

0.5

0.4

0.3

ygrenE

0 100000 200000 300000 400000Trials

0.7

0.6

0.5

0.4

0.3

0.2

0.1

ygrenE

Run it Big… …and Bigger!

2/1

1

2

1in Error

tottot

tot

xxx

Estimate the Error

Page 18: An Introduction to Monte Carlo Methods in Statistical Physics

When Is Enough Enough?

Make a Picture!

Page 19: An Introduction to Monte Carlo Methods in Statistical Physics

When Is Enough Enough?

Try DifferentInitial Conditions!

Page 20: An Introduction to Monte Carlo Methods in Statistical Physics

Phase Behavior in Two-DimensionalRod and Disk Systems

E. coli

TMV and spheres

Electronic circuitsBottom-up assembly of spheres

Nature 393, 349 (1998).

Page 21: An Introduction to Monte Carlo Methods in Statistical Physics

Use MC Simulation to Understandthe Phase Behavior of

Hard Rod and Disk Systems

Lamellar Nematic

Isotropic

MiscibleNematic

Smectic

MiscibleIsotropic

Page 22: An Introduction to Monte Carlo Methods in Statistical Physics

A = U – TS

Hard Core Interactions

U = 0 if particles do not overlap

U = ∞ if particles do overlap

Maximize Entropy to Minimize Helmholtz Free Energy

Overlap

Volume

Depletion

Zones

Ordering Can Increase Entropy!

Hard Systems: It’s All About Entropy

Page 23: An Introduction to Monte Carlo Methods in Statistical Physics

Perform Move at Random

Metropolis Monte Carlo

Old Configuration

0)( rUold

0exp

exp

oldnewnewold UUP

)'(rUnew

New Configuration

Ouch!

A Lot of Infeasible Trials! Small Moves or…

Page 24: An Introduction to Monte Carlo Methods in Statistical Physics

k

jj

or bUnewW1

)(exp)(

k

jj

or )(bβUW(old)1

exp

Rosenbluth & Rosenbluth, J. Chem. Phys. 23, 356 (1955).

Move Center of Mass RandomlyGenerate k-1 New Orientations bj

New

Old

Configurational Bias Monte Carlo

Select a New Configurationwith

)(

)(exp )(

newW

bUbP n

or

n

)(

)(,1min

oldW

newWP newold

Accept the New Configurationwith

Final

Page 25: An Introduction to Monte Carlo Methods in Statistical Physics

Configurational Bias Monte Carlo andDetailed Balance

)(

)(exp)(

)(

)(exp)( )(

oW

oUon

nW

nUnobP n

)()(exp)(

)(oUnU

on

no

)()()( noaccnono

)(

)(

)(

)(

oW

nW

onacc

noacc

The Probability ofChoosing a Move:

Recall we Have of the Form:

The Acceptance Ratio:

Detailed Balance

Page 26: An Introduction to Monte Carlo Methods in Statistical Physics

Nematic Order Parameter

N

i

iuiuN

Q1

)()(21

Radial Distribution Function

Orientational CorrelationFunctions

rrg 02cos2

rrg 04cos4

N

i

N

jij

ji rrrN

Arg

1 1

22

Properties of Interest

Page 27: An Introduction to Monte Carlo Methods in Statistical Physics

800 rodsρ = 3.5 L-2

Snapshots

1257 rodsρ = 5.5 L-2

Page 28: An Introduction to Monte Carlo Methods in Statistical Physics

6213 rodsρ = 6.75 L-2

Snapshots

8055 rodsρ = 8.75 L-2

Page 29: An Introduction to Monte Carlo Methods in Statistical Physics

Accelerating Monte Carlo SamplingE

nerg

y

x

How Can We Overcome the HighFree-Energy Barriers to Sample Everything?

Page 30: An Introduction to Monte Carlo Methods in Statistical Physics

Accelerating Monte Carlo Sampling:Parallel Tempering

System N at TN

System 1 at T1

System 2 at T2

System 3 at T3

Metropolis Monte CarloTrials Within Each System

Swaps Between Systems i and j

TN >…>T3 >T2 >T1

))((exp

1min)(

ijji UUnoP

E. Marinari and and G. Parisi, Europhys. Lett. 19, 451 (1992).

Page 31: An Introduction to Monte Carlo Methods in Statistical Physics

Parallel Tempering in a Model Potential

2

275.1))2sin(1(5

75.175.0))2sin(1(4

75.025.0))2sin(1(3

25.025.1))2sin(1(2

25.12))2sin(1(1

2

)(

x

xx

xx

xx

xx

xx

x

xU

System 1 at kT1=0.05

System 2 at kT2=0.5

System 3 at kT3=5.0

90% Move Attempts within Systems10% Move Attempts are Swaps

Adapted from: F. Falcioniand M. Deem, J. Chem. Phys. 110, 1754 (1999).

Page 32: An Introduction to Monte Carlo Methods in Statistical Physics

Good Sources on Monte Carlo: D. Frenkel and B. Smit, “Understanding Molecular Simulation”, 2nd Ed., Academic Press (2002).

M. Allen and D. J. Tildesley, “Computer Simulation of Liquids”, Oxford (1987).