Presentation is loading. Please wait.

Presentation is loading. Please wait.

Systematic errors of MC simulations Equilibrium error averages taken before the system has reached equilibrium  Monitor the variables you are interested.

Similar presentations


Presentation on theme: "Systematic errors of MC simulations Equilibrium error averages taken before the system has reached equilibrium  Monitor the variables you are interested."— Presentation transcript:

1 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 landscape The 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.

2 Lab 5. Metropolis NVT Monte Carlo simulation of a particle moving in x  [-1,4] with a double-well potential U(x) = x 4 -6x 3 +8x 2 (-1 < x < 4) (still a 1B1D problem) ~ 9.91 ~ 3.23 U (x) A B X 0 = 0 : metastable state i.e. local minimum X max = 1.22 : unstable state, i.e. maximum (TS) X min = 3.28 : stable state, i.e. global minimum

3 1-Dimensional motion of a single particle (constant N = 1) moving on a potential landscape defined by U(x) = x 4 – 6 x 3 + 8 x 2 confined within x  [-1, 4] (constant V = 5) at a constant temperature T (= 0.1, 0.25, 2.0, etc.)  NVT ensemble Let’s calculate the mean position (observable = x) of the particle. with 1. Modify the main program of exercise 4 to input the temperature (  temp  ). 2. Modify  atom_move.c  to sample a distribution proportional to e -  U(x) with k B = 1. 3. Run the program for M = 10 7 MC cycles for the following cases with  = 0.8 (maximum displacement for MC move). [Case A] Initial microstate defined by the particle at x 0 =  0.5 (What is U?) at two different temperatures: (A1) T = 0.10, (A2) T = 0.25 [Case B] Initial microstate defined by the particle at x 0 = +3.8 (What is U?) at two different temperatures: (B1) T = 0.25, (B2) T = 2.00 4. Conclusion

4 Almost always involves a Markov process Move to a new configuration from an existing one according to a well-defined transition probability Simulation procedure 1. Generate a new “trial” configuration by making a perturbation to the present configuration. 2. Accept the new configuration based on the ratio of the probabilities for the new and old configurations, according to the Metropolis algorithm. 3. If the trial is rejected, the present configuration is taken as the next one in the Markov chain. 4. Repeat this many times, accumulating sums for averages. state k state k+1 Metropolis Monte Carlo Molecular Simulation (Review) David A. Kofke, SUNY Buffalo

5 Choices of Metropolis for canonical ensembles (review) N. Metropolis et al. J. Chem. Phys. 21, 1087 (1953) 1. Detailed balance condition 2.Symmetric  : 3.Limiting probability distribution for canonical ensemble = Boltzmann  Transition probability  & acceptance probability acc should satisfy: 4. Define the acceptance probability as:  Accept all the downhill moves.  Accept uphill moves only when not too uphill. naturally satisfies this condition.

6 /* generates a trial displacement of an interaction atom and accepts it based on the Metropolis criterion. Output: the return value is 1 if the move was accepted and 0 otherwise. */ #include "test.h" #include "atom_move.h" #include "ran3.h" #define XX_MIN-1.0 #define XX_MAX 4.0 double U(double x) { double x2, x3; x2 = x * x; x3 = x2 * x; return(8 * x2 - 6 * x3 + x2 * x2); } int atom_move(double *x, double displ_max, double temp, double k, long *seed, double *u_pot) { int accept; double U_old, U_new, delta_U; double displ, x_old; x_old = *x; U_old = U(x_old);

7 /* Generate random displacement within hypercube of size displ_max. */ displ = displ_max * (ran3(seed) - 0.5); *x += displ; /* Compute change in potential energy and accept move using Metropolis criterion. */ if (*x > XX_MAX || *x < XX_MIN) accept = 0; else{ //p_new = (*x) * exp(-(*x)); U_new = U(*x); delta_U = U_new - U_old; if (delta_U <= 0.0) accept = 1; else accept = ran3(seed) < exp(-delta_U/temp); } /* Update system potential energy if trial move is accepted. Otherwise, reset variables. */ if (!accept) { *x = x_old; } /* Return 1 if trial move is accepted, 0 otherwise. */ return accept; }

8 Case A: x 0 = -0.5 Case B: x 0 = 3.8 Remark: Lottery chance to find the 6 numbers drawn from a pool of 49 number: 1 chance / 13 983 816 M = 10 7 MC steps


Download ppt "Systematic errors of MC simulations Equilibrium error averages taken before the system has reached equilibrium  Monitor the variables you are interested."

Similar presentations


Ads by Google