Download presentation
Presentation is loading. Please wait.
Published byEmma Ellis Modified over 9 years ago
1
Monte Carlo Methods H. Rieger, Saarland University, Saarbrücken, Germany Summerschool on Computational Statistical Physics, 4.-11.8.2010 NCCU Taipei, Taiwan
2
Monte Carlo Methods = Stochastic evaluation of physical quantities using random numbers Example: Pebble game on the beach of Monaco = computation of using random events Kid‘s game: Adult‘s game: „Direct sampling“„Markov chain sampling“ [after W. Krauth, Statistical Mechanics, Algorithms and Computation, Oxford Univ. Press]
3
Direct sampling easy „hard spheres in 2d“ – hard! No direct sampling algorithm for hard spheres (NOT random sequantial adsorption!)
4
What to do, when a stone from the lady lands here? 1)Simply move on 2)Climb over the fence, and continue until, by accident, she will reenter the heliport 3) ….? Move a pebble in a 3x3 lattice probabilistically such that each site a is visited with the same probability p(a) = 1/9 w(a b) = ¼ b a w(a a) = 0w(a a) = 1/4w(a a) = 1/2 Markov chain sampling
5
Detailled Balance ab c Together with This yields: The following condition for p(a) must hold: This condition is fulfilled when etc. This is called „detailled balance condition“ – and leads here to w(a b,c)=1/4, w(a a)=1/2
6
More or less large piles close to the boundary due to „rejections“ Adult‘s pebbel game – solution: if a stone lands outside the heliport, stay there put a stone on top of the present stone and continue, i.e. reject move outside the square! Rejections
7
Master equation Markov chain described by „Master equation“ (t = time step) The time independent probability distribution p(a) is a solution of this equation, if the transition probabilities w(a b) etc. fulfill For a given p(a) one can, for instance, choose Which is the „Metropolis“ rule detailed balance:
8
Monte Carlo for Thermodynamic Equilibrium a are configurations of a many particle system, E(a) the energy of configuration a. Thermodynamic equilibrium at temperature T is then described by the Boltzman distribution is the normalization, called partition function Thus the Metropolis rule for setting up a Markov chain leading to The Boltzmann distribution is = 1/k B T inverse temperature
9
Hard spheres a = (r 1,r 2, …, r N ) - configurations = coordinates of all N spheres in d dimension All spheres have radius , they are not allowed to overlap, otherwise all configurations have the same energy (no interactions): H(a) = if there is a pair (i,j) with |r i -r j |<2 H(a) = 0 otherwise Define w(a b) in the following way: In configuration a choose randomly a particle i and displace it by a random vector - this constitutes configuration b. w(a b) = 1 if b is allowed (no overlaps), w(a b) = 0 (reject) if displaced particle overlaps with some other particle i.e.:
10
Hard spheres (2) Tagged particle Iteration:t t
11
Soft spheres / interacting particles a = {(r 1,p 1 ),(r 2,p 2 ),…,(r N,p N )} - configurations = coordinates and momenta of all N particles in d dimension Partition function Example: LJ (Lennard-Jones) Energy: L = box size Peforming the momentum integral (Gaussian) Left with the configuration integral I
12
MC simulation for soft spheres: Metropolis if otherwise Choose randomly particle i, its position is r i Define new position by r i ‘=r i + , a random displacement vector, [- , ] 3 All othe rparticle remain fixed. Acceptance probability for the new postion: Measurements: Energy, specific heat, spatial correlation functions, structure function Equlibration! Note: Gives the same results as molecular dynamics Repeat many times
13
Discrete systems: Ising spins System of N interacting Ising spins S i {+1,-1}, placed on the nodes of a d-dimensional lattice a = (S 1,S 2,…,S N ): spin configurations Energy: J ij = coupling strengths, e.g. J ij = J > 0 for all (i,j) ferromagnet h = external field strength For instance 1d: with periodic poundary conditions (i,j)
14
Quantities of interest / Measurements Magnetization Susceptibility Average energy Specific heat How to compute: where a t are the configurations generated by the Markov chain (the simulation) at time step t.
15
Ising spins: Metropolis update for Procedure Ising Metropolis: Initialize S = (S 1,…,S N ) labelGenerate new configuration S‘ Calculate H= H(S,S‘) if H 0 accept S‘ (i.e. S‘ S) else generate random numer x [0,1] if x<exp(- H) accept S‘ (i.e. S‘ S) compute O(S) goto label H(S,S‘) = H(S‘)-H(S)
16
Single spin flip Metropolis for 2d Ising Procedure single spin flip Input L, T, N=L*L Define arrays: S[i], i=1,…,N, h[i], i=1,…,N, etc. Initialize S[i], nxm[i], nxp[i],…., h[i] step = 0 while (step<max_step) choose random site i calculate dE = 2*h[i]*S[i] if ( dE <= 0 ) S[i]=-S[i]; update h[nxm[i]], h[nxp[i]],… else p = exp(-dE/T) x = rand() if ( x<p) S[i]=-S[i]; update h[nxm[i]], h[nxp[i]],… compute M(S), E(S), … accumulate M, E, … step++ Output m, e, …
17
Implementation issues Periodic boundary conditionsNeighbor tables if e.g.:
18
Implementation issues (2) With single spin flip E(S) and E(S‘) differ only by 4 terms in 2d (6 terms in 3d): Flip spin i means S i ‘ = -S i, all other spins fixed, i.e. S j ‘=S j for all j i Tabulate exponentials exp(-4 ), exp(-8 ) to avoid transcendental functions in the innermost loop Use array h[i] for local fields, if move (flip is rejected nothing to be done, if flip accepted update S i and h nxm[i], h nxp[i], etc.
19
Study of phase transitions with MC Ising model in d>1 has a 2nd order phase transition at h=0, T=T c Magnetization (order parameter): Phase diagram T<T c m h h0h0 h=0 1st order phase transition as a function of h! 2nd order phase transition as a function of T at h=0!
20
Critical behavior Magnetization: Susceptibility: Specific heat: Correlation function: Correlation length: Scaling relations: Singularities at T c in the thermodynamic limit (N ):
21
Finite size behavior w. Periodic b.c.
22
Finite Size Scaling FSS forms: 4th order cumulant: Dimensionless (no L-dependent prefactor) - Good for the localization of the critical point
23
Critical exponents of the d-dim. Ising model
24
Slowing down at the critical point Quality of the MC estimats of therodynamic expectation values depends on the number of uncorrelated configurations – Need an estimate for the correlation time of the Markov process! Autocorrelation- function Schematically: for T T c Configurations should decorrelate faster than with single spin-flip! Solution: Cluster Moves
25
Cluster Algorithms Construction process of the clusters in the Wolff algorith: Start from an initial + site, include other + sites with prbability p (left). The whole cluster (gray) is then flipped p(b) Here c 1 =10, c 2 =14 Detailled balance condition: p(a) A(a b) w(a b) = p(b) A(b a) w(b a) p(a) „A priori“ or construction probability:
26
Wolff algorithm (cont.) Once the cluster is constructed with given p, one gets c 1 and c 2, with which one can compute the acceptance probability w(a b) But with p = 1-e -2 the acceptance probability w(a b) becomes 1! Thus with p=1-e -2 the constructed cluster is always flipped! Remarkable speed up, no critical slowing down at the critical point!
27
Wolff cluster flipping for Ising (1)Randomly choose a site i (2)Draw bonds to all nearest neighbors j with probability (3)If bonds have been drawn to any site j draw bonds to all nearest neighbors k of j with probability (4)Repeat step (3) until no more bonds are created (5)Flip all spins in the cluster (6)Got to (1) (Note for S=S‘, and = 0 for S S‘, such that p=0 for S j S k )
28
Swendsen-Wang algorithm Similar to Wolff, but (1)Draw bonds between ALL nearest neighbors with probability (2)Identify connected clusters (3)Flip each individual cluster with probability 1/2
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.