An Introduction to Monte Carlo Methods in Statistical Physics Kristen A. Fichthorn The Pennsylvania...

Post on 19-Jan-2016

223 views 3 download

Tags:

Transcript of An Introduction to Monte Carlo Methods in Statistical Physics Kristen A. Fichthorn The Pennsylvania...

An Introduction toMonte Carlo Methodsin Statistical Physics

Kristen A. FichthornThe Pennsylvania State University

University Park, PA 16803

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

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

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

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…

Problems with Uniform Sampling…

L

LL

tot

UV

Ztot

N

NVT

1

)(exp

Too Many Configurations Where

0)(exp rU

Especially for a DenseFluid!!

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

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 !!

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

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

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).

Metropolis Monte Carlo

Detailed Balance is Satisfied:

' if , N

1

' if , )'(exp1

)'(

UU

UUUUN

rr

Use:

)'(exp)'(

)'(UU

rr

rr

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

Periodic Boundary Conditions

L

Ld

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

It’s Like Doing aSimulation on a Torus!

Nearest-Neighbor, Square Lattice Gas

A

B

InteractionsAA

BB

AB

0.0 -1.0kT

0.0 0.0

-1.0kT 0.0

When Is Enough Enough?

0 100000 200000 300000 400000Trials

800

700

600

500

400

300

200

100

ygrenE

Run it Long...

…and Longer!

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

When Is Enough Enough?

Make a Picture!

When Is Enough Enough?

Try DifferentInitial Conditions!

Phase Behavior in Two-DimensionalRod and Disk Systems

E. coli

TMV and spheres

Electronic circuitsBottom-up assembly of spheres

Nature 393, 349 (1998).

Use MC Simulation to Understandthe Phase Behavior of

Hard Rod and Disk Systems

Lamellar Nematic

Isotropic

MiscibleNematic

Smectic

MiscibleIsotropic

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

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…

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

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

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

800 rodsρ = 3.5 L-2

Snapshots

1257 rodsρ = 5.5 L-2

6213 rodsρ = 6.75 L-2

Snapshots

8055 rodsρ = 8.75 L-2

Accelerating Monte Carlo SamplingE

nerg

y

x

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

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).

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).

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).