11
For a new configuration of the same volume V and number of molecules N, displace a randomly selected atom to a point chosen with uniform probability inside a cubic volume of edge 2 centered on the current position of the atom. Examine underlying transition probability to formulate the Displacement trial move. 1. Specification ? Select an atom at random. Consider a region centered at it. Move atom to a point chosen uniformly in region. Consider acceptance of new configuration. 2 Step 1 Step 2 Step 3 Step 4 general hitherto David A. Kofke, SUNY Buffalo

For a new configuration of the same volume V and number of molecules N, displace a randomly selected atom to a point chosen with uniform probability inside

Embed Size (px)

Citation preview

For a new configuration of the same volume V and number of molecules N,displace a randomly selected atom to a point chosen with uniform probability inside a cubic volume of edge 2 centered on the current position of the atom.

Examine underlying transition

probability to formulate the acceptance

criterion

Displacement trial move. 1. Specification

?

Select an atom at random.

Consider a region centered

at it.

Move atom to a point chosen

uniformly in region.

Consider acceptance of

new configuration.

2

Step 1 Step 2 Step 3 Step 4

general hitherto

David A. Kofke, SUNY Buffalo

Displacement trial move. 4. Pseudo Code (Louis)

Rule of thumb: Size of the step is adjusted to reach a target acceptance rate of displacement trials, which is typically 50%.

Large step leads to less acceptance but bigger moves.

Small step leads to less movement but more acceptance.

Displacement trial move. 6. Step size tuning

Error analysis in Metropolis Monte Carlo:Example of data correlation.

1D Harmonic oscillator (~NVT)

assumes that the N measurements of x are all independent.

in a sense of constant kinetic energy T (=0)

i.e., E(x)=V(x)

Example of data correlation: 1D harmonic oscillator

First 1000 steps in MC time history of x for three different step sizes or = 1; 10; 200 (corresponding acceptance rate = 0.70; 0.35; 0.02)

Richard T. Scalettar

rejectedcorrelated

xi

Example of data correlation: 1D harmonic oscillator

where (fluctuation around the average),

which measure whether the fluctuations are related for x values l measurement apart.

Autocorrelation functions for the complete data sets (400,000 steps) of x

for three different step sizes = 1; 10; 200 (acceptance rate = 0.70; 0.35; 0.02)

e-1

correlation time (short)correlation time (long) correlation time (long)

In generating these results so far, x was measured every MC step.

cm(l) = correlation function when measurements are only every m-th MC step = c1(ml)

If one choose m>, then the measurements all become independent.

For correct error bar, measurements should be separated by awaiting time m larger than . Advantage: We don’t waste time making measurements when they are not independent.

Disadvantage: We need longer (by m times) MC simulations to achieve the same accuracy.

assumes that the N measurements of x are all independent.

(Statistical) Error analysis in Metropolis Monte Carlo

What happens if one instead measures only every m-th MC step?

MC step: m m+1 m+2 m+3 Measurement: 1

MC step: 2mMeasurement: 2

1 2 3 m mm

MC step 3Measurement 3

steps) MC ofnumber ts,measuremen ofnumber (/

error MNmMN

(Statistical) Error analysis in Metropolis Monte Carlo:

Rebinning data. Block averages.Choose a bin size Mb and average x over each of the L (= N/Mb) bins (N = total number of measurements) to create L “binned” “independent” measurements {m1, m2, , mj, , mL}.

Error bars for different bin sizes m based on the same data sets (400,000 steps) of x

for three different step sizes = 1; 10; 200 (acceptance rate = 0.70; 0.35; 0.02)

increase with Mb (L) flat out to a correct

asymptotic value

(L,<m2><m>2)

jM

jMii

b

j

b

b

xM

m1)1(

1xx

Nm

Lm

N

ii

L

jj

11

11

1of instead

1

2222

N

xx

L

mm&

too small 1 (Mb=1)(assume independenceof each measurement)

Mb Mb Mb

Initialization

Reset block sums

Compute block average

Compute final results

“cycle” or “sweep”

“block”

Move each atom once (on average) 100’s or 1000’s

of cycles

Independent “measurement”

moves per cycle

cycles per block

Add to block sum

blocks per simulation

New configuration

New configuration

Entire SimulationMonte Carlo Move

Select type of trial moveeach type of move has fixed probability of being selected

Perform selected trial move

Decide to accept trial configuration, or keep original

David A. Kofke, SUNY Buffalo

Displacement trial move. 5. Implementation

Systematic errors of MC simulations

Equilibrium error•averages taken before the system has reached equilibrium Monitor the variables you are interested in. Take averages only after they have stopped drifting.

•system stuck in a local minimum of the energy landscapeThe system may appear to equilibrate nicely inside the local well.However, it is not sampling phase-space correctly. an “ergodicity” problem Perform a simulation with several different starting configurations, if you can. Otherwise, use one of the methods devised to get out of this problem. e.g. simulated annealing (T), parallel tempering (T), metadynamics (PE), etc.

Finite size error•Thermodynamic averages defined for infinite (impossible to simulate) system Run on several different system sizes and extrapolate to N = .

•properties which depend on fluctuations with wavelengths larger than the smallest length of your simulation box Test on several different system sizes until the property you study no longer varies.