The Monte Carlo Algorithm

Size: px
Start display at page:

Download "The Monte Carlo Algorithm"

Transcription

1 The Monte Carlo Algorithm This algorithm was invented by N. Metropolis, A.W. Rosenbluth, M.N. Rosenbluth, A.H. Teller, and E. Teller, J. Chem. Phys., 21, 1087 (1953). It was listed as one of the The Top 10 Algorithms of the 20th Century in a recent issue of Computing in Science and Engineering. Suppose we wish to generate random numbers distributed according to a positive definite function in one dimension, for example P (x) = e x2 /2. The function need not be normalized for the algorithm to work, and the same algorithm works just as easily in a many dimensional space. The random number sequence x i, i = 0, 1, 2,... is generated by a random walk as follows: Choose a starting point x 0. Choose a fixed maximum step size δ. Given an x i, generate the next random number as follows: Choose x trial uniformly and randomly in the interval [x i δ, x i + δ]. Compute the ratio w = P (x trial). P (x i ) Note that P need not be normalized to compute this ratio. PHY Computational Physics 2 1 Wednesday, February 12

2 If w > 1 the trial step is in the right direction, i.e., towards a region of higher probability. Accept the step x i+1 = x trial. If w < 1 the trial step is in the wrong direction, i.e., towards a region of lower probability. We should not unconditionally reject this step! (Why?) So accept the step conditionally if the decrease in probability is smaller than a random amount: Generate a random number r in the interval [0, 1]. If r < w accept the trial step x i+1 = x trial. If w r reject the step x i+1 = x i. Note that we don t discard this step! The two steps have the same value. This algorithm is implemented in the following program metropolis.cpp to compute the same Gaussian integral as previously. # estimate Gaussian integral using the Monte Carlo algorithm metropolis.py from math import exp, pi, sqrt from random import random def P(x): return exp(- x**2 / 2) / sqrt(2 * pi) PHY Computational Physics 2 2 Wednesday, February 12

3 def f_over_w(x): return x**2 x = 0.0 delta = 1.0 accepts = 0 # initial position of walker # step size # number of steps accepted def MetropolisStep(): global x, accepts # updated the global value xtrial = x + (2 * random() - 1) * delta w = P(xTrial) / P(x) if w >= 1: # uphill x = xtrial # accept the step accepts += 1 else: # downhill if random() < w: # but not too far x = xtrial # accept the step accepts += 1 # get input parameters from user delta = float(input(" Enter step size delta: ")) PHY Computational Physics 2 3 Wednesday, February 12

4 M = int(input(" Enter number of trials: ")) N = int(input(" Enter steps per trial: ")) fsum = 0.0 sqdsum = 0.0 errsum = 0.0 for i in range(m): avg = 0.0 var = 0.0 for j in range(n): MetropolisStep() fx = f_over_w(x) avg += fx var += fx**2 avg /= N var /= N var = var - avg**2 err = sqrt(var / N) fsum += avg sqdsum += avg**2 errsum += err ans = fsum / M # accumulator for <f> # accumulator for <f> * <f> # accumulator error estimates # accumulator for f(x) # accumulator for f(x) * f(x) PHY Computational Physics 2 4 Wednesday, February 12

5 stddev = sqrt(sqdsum / M - ans**2) stddev /= sqrt(float(m)) err = errsum / M err /= sqrt(float(m)) print("\n Exact answer: " + str(1.0)) print(" Integral: " + str(ans) + " +- " + str(err)) print(" Std. Dev.: " + str(stddev)) print(" Accept ratio: " + str(accepts / float(n * M))) // estimate Gaussian integral using the Monte Carlo algorithm metropolis.cpp #include <cmath> #include <cstdlib> #include <iostream> using namespace std; const double pi = 4 * atan(1.0); inline double std_rand() { PHY Computational Physics 2 5 Wednesday, February 12

6 return rand() / (RAND_MAX + 1.0); double P(double x) { return exp(- x * x / 2) / sqrt(2 * pi); double f_over_w(double x) { return x * x; double x = 0; double delta = 1.0; int accepts = 0; // initial position of walker // step size // number of steps accepted void MetropolisStep() { double xtrial = x + (2 * std_rand() - 1) * delta; double w = P(xTrial) / P(x); if (w >= 1) { // uphill x = xtrial; // accept the step ++accepts; PHY Computational Physics 2 6 Wednesday, February 12

7 else { // downhill if (std_rand() < w) { // but not too far x = xtrial; // accept the step ++accepts; int main() { // get input parameters from user cout << "Enter step size delta: "; cin >> delta; cout << "Enter number of trials: "; int M; cin >> M; cout << "Enter steps per trial: "; int N; cin >> N; double sum = 0; double sqdsum = 0; // accumulator for <f> // accumulator for <f> * <f> PHY Computational Physics 2 7 Wednesday, February 12

8 double errsum = 0; // accumulator error estimates for (int i = 0; i < M; i++) { double avg = 0; // accumulator for f(x) double var = 0; // accumulator for f(x) * f(x) for (int j = 0; j < N; j++) { MetropolisStep(); double fx = f_over_w(x); avg += fx; var += fx * fx; avg /= N; var /= N; var = var - avg * avg; double err = sqrt(var / N); sum += avg; sqdsum += avg * avg; errsum += err; double ans = sum / M; double stddev = sqrt(sqdsum / M - ans * ans); stddev /= sqrt(double(m)); double err = errsum / M; PHY Computational Physics 2 8 Wednesday, February 12

9 err /= sqrt(double(m)); cout << "\n Exact answer: " << 1.0 << endl; cout << " Integral: " << ans << " +- " << err << endl; cout << " Std. Dev.: " << stddev << endl; cout << " Accept ratio: " << accepts / double(n * M) << endl; There are essentially two important choices to be made: The initial point x 0 must be chosen carefully. A good choice is close to the maximum of the desired probability distribution. If this maximum is not known (as is usually the case in multi dimensional problems), then the random walker must be allowed to thermalize i.e., to find a good starting configuration: the algorithm is run for some large number of steps which are then discarded. The step size δ must be carefully chosen. If δ is too small, then most of the trial steps will be accepted, which will tend to give a uniform distribution that converges very slowly to P (x). If δ is too large the random walker will step right over and not see important peaks in the probability distribution. If the walker is at a peak, too many steps will be rejected. PHY Computational Physics 2 9 Wednesday, February 12

10 A rough criterion for choosing the step size is for the to be around 0.5. Acceptance ratio = Number of steps accepted Total number of trial steps Hard Disk Gas: Equation of State Calculations by Fast Computing Machine The classic article by N. Metropolis, A.W. Rosenbluth, M.N. Rosenbluth, A.H. Teller, J. Chem. Phys. 21, 1087 (1953), was the first computer simulation of a physical system. Along with the Fermi-Pasta-Ulam Report, it marked the beginning of computational science as a third way of studying the physical world in addition to experiment and theory. Maxwell Boltzmann Kinetic Theory The system of hard disks was treated as a Maxwell-Boltzmann gas at fixed volume and temperature. The energy of gas of disks is given by E = K.E. + P.E. = m 2 v 2 i + U(r ij ), i pairs ij PHY Computational Physics 2 10 Wednesday, February 12

11 with a pairwise potential energy function where σ is the disk diameter. U(r) = { 0 if r > σ if r σ, Thermal Equilibrium Consider an ensemble of systems. At absolute temperature T the probability that a system has energy E is given by the Boltzmann distribution [ W exp E ] [ = exp E T S ] [ = exp F ], k B T k B T k B T where W is the number of microscopic configurations with energy E, k B is Boltzmann s constant, S = k B log W is the entropy, and F = E T S is the free energy. The partition function is given by Z = E W (E) exp [ E ] k B T. The equation of state of the gas relates pressure p, volume V, and absolute temperature T pv = Nk B T log Z log V. T,N PHY Computational Physics 2 11 Wednesday, February 12

12 Monte Carlo Simulation of Hard Disks Metropolis et al. designed a volume to close-pack N = 224 disks of diameter d 0 as shown in the figures below from their article. PHY Computational Physics 2 12 Wednesday, February 12

13 The placed 14 particles per row 16 per column on a triangular lattice. They chose to fix A 0 = 3d 2 0N/2 = 1 and vary d 0, hence the number of disks N. Periodic boundary conditions were used to approximate an infinite volume and avoid having to apply boundary conditions at the walls of the container. Radial distribution histogram The Radial distribution function measures the correlations between particles separated a distances r. PHY Computational Physics 2 13 Wednesday, February 12

14 It can be measured experimentally and in computer simulations. It can be used to distinguish the solid, liquid and gaseous states. The equation of state p(n, V, T ) was deduced from the radial distribution function n(r) shown in the figures below. PHY Computational Physics 2 14 Wednesday, February 12

15 They showed that P A = Nk B T using the Virial Theorem of Clausius. ( ) 1 + πd2 0n 2, where n = n(d), The Virial theorem states K.E. = N 1 2 mv2 = pa i r i X int i The derivation is based on the figure below, which defines the variables involved in a collision between two disks.. PHY Computational Physics 2 15 Wednesday, February 12

16 The result of this derivation is r i X int i i = 1 2 r ij F ij = N 1 2 mv2 πd 2 0n. i j i The Monte Carlo simulation measured the radial distribution function as a histogram: For each Monte Carlo configuration Consider any disk Divide the region from r = d to r = r max into 64 annular zones of equal area Count number of disks in each zone and store in histogram with 64 bins Repeat for all other disks and accumulate in histogram Average over configurations Fit histogram to a model function and extrapolate to r = d PHY Computational Physics 2 16 Wednesday, February 12

Cluster Algorithms to Reduce Critical Slowing Down

Cluster Algorithms to Reduce Critical Slowing Down Cluster Algorithms to Reduce Critical Slowing Down Monte Carlo simulations close to a phase transition are affected by critical slowing down. In the 2-D Ising system, the correlation length ξ becomes very

More information

In this approach, the ground state of the system is found by modeling a diffusion process.

In this approach, the ground state of the system is found by modeling a diffusion process. The Diffusion Monte Carlo (DMC) Method In this approach, the ground state of the system is found by modeling a diffusion process. Diffusion and random walks Consider a random walk on a lattice with spacing

More information

Computer simulation methods (1) Dr. Vania Calandrini

Computer simulation methods (1) Dr. Vania Calandrini Computer simulation methods (1) Dr. Vania Calandrini Why computational methods To understand and predict the properties of complex systems (many degrees of freedom): liquids, solids, adsorption of molecules

More information

2 2 mω2 x 2 ψ(x) = Eψ(x),

2 2 mω2 x 2 ψ(x) = Eψ(x), Topic 5 Quantum Monte Carlo Lecture 1 Variational Quantum Monte Carlo for the Harmonic Oscillator In this topic, we will study simple quantum mechanical systems of particles which have bound states. The

More information

Monte Caro simulations

Monte Caro simulations Monte Caro simulations Monte Carlo methods - based on random numbers Stanislav Ulam s terminology - his uncle frequented the Casino in Monte Carlo Random (pseudo random) number generator on the computer

More information

Chapter 5 - Systems under pressure 62

Chapter 5 - Systems under pressure 62 Chapter 5 - Systems under pressure 62 CHAPTER 5 - SYSTEMS UNDER PRESSURE 5.1 Ideal gas law The quantitative study of gases goes back more than three centuries. In 1662, Robert Boyle showed that at a fixed

More information

Markov Processes. Stochastic process. Markov process

Markov Processes. Stochastic process. Markov process Markov Processes Stochastic process movement through a series of well-defined states in a way that involves some element of randomness for our purposes, states are microstates in the governing ensemble

More information

Molecular Dynamics Simulation of Argon

Molecular Dynamics Simulation of Argon Molecular Dynamics Simulation of Argon The fundamental work on this problem was done by A. Rahman, Phys. Rev. 136, A405 (1964). It was extended in many important ways by L. Verlet, Phys. Rev. 159, 98 (1967),

More information

Metropolis/Variational Monte Carlo. Microscopic Theories of Nuclear Structure, Dynamics and Electroweak Currents June 12-30, 2017, ECT*, Trento, Italy

Metropolis/Variational Monte Carlo. Microscopic Theories of Nuclear Structure, Dynamics and Electroweak Currents June 12-30, 2017, ECT*, Trento, Italy Metropolis/Variational Monte Carlo Stefano Gandolfi Los Alamos National Laboratory (LANL) Microscopic Theories of Nuclear Structure, Dynamics and Electroweak Currents June 12-30, 2017, ECT*, Trento, Italy

More information

Computational Physics Lectures: Variational Monte Carlo methods

Computational Physics Lectures: Variational Monte Carlo methods Computational Physics Lectures: Variational Monte Carlo methods Morten Hjorth-Jensen 1,2 Department of Physics, University of Oslo 1 Department of Physics and Astronomy and National Superconducting Cyclotron

More information

Understanding Molecular Simulation 2009 Monte Carlo and Molecular Dynamics in different ensembles. Srikanth Sastry

Understanding Molecular Simulation 2009 Monte Carlo and Molecular Dynamics in different ensembles. Srikanth Sastry JNCASR August 20, 21 2009 Understanding Molecular Simulation 2009 Monte Carlo and Molecular Dynamics in different ensembles Srikanth Sastry Jawaharlal Nehru Centre for Advanced Scientific Research, Bangalore

More information

The Monte Carlo Method An Introduction to Markov Chain MC

The Monte Carlo Method An Introduction to Markov Chain MC The Monte Carlo Method An Introduction to Markov Chain MC Sachin Shanbhag Department of Scientific Computing, Florida State University Sources. Introduction to Monte Carlo Algorithms : Werner Krauth. Available

More information

ICCP Project 2 - Advanced Monte Carlo Methods Choose one of the three options below

ICCP Project 2 - Advanced Monte Carlo Methods Choose one of the three options below ICCP Project 2 - Advanced Monte Carlo Methods Choose one of the three options below Introduction In statistical physics Monte Carlo methods are considered to have started in the Manhattan project (1940

More information

Multi-Ensemble Markov Models and TRAM. Fabian Paul 21-Feb-2018

Multi-Ensemble Markov Models and TRAM. Fabian Paul 21-Feb-2018 Multi-Ensemble Markov Models and TRAM Fabian Paul 21-Feb-2018 Outline Free energies Simulation types Boltzmann reweighting Umbrella sampling multi-temperature simulation accelerated MD Analysis methods

More information

Markov Chain Monte Carlo

Markov Chain Monte Carlo Chapter 5 Markov Chain Monte Carlo MCMC is a kind of improvement of the Monte Carlo method By sampling from a Markov chain whose stationary distribution is the desired sampling distributuion, it is possible

More information

Random Walks A&T and F&S 3.1.2

Random Walks A&T and F&S 3.1.2 Random Walks A&T 110-123 and F&S 3.1.2 As we explained last time, it is very difficult to sample directly a general probability distribution. - If we sample from another distribution, the overlap will

More information

Monte Carlo integration (naive Monte Carlo)

Monte Carlo integration (naive Monte Carlo) Monte Carlo integration (naive Monte Carlo) Example: Calculate π by MC integration [xpi] 1/21 INTEGER n total # of points INTEGER i INTEGER nu # of points in a circle REAL x,y coordinates of a point in

More information

From Random Numbers to Monte Carlo. Random Numbers, Random Walks, Diffusion, Monte Carlo integration, and all that

From Random Numbers to Monte Carlo. Random Numbers, Random Walks, Diffusion, Monte Carlo integration, and all that From Random Numbers to Monte Carlo Random Numbers, Random Walks, Diffusion, Monte Carlo integration, and all that Random Walk Through Life Random Walk Through Life If you flip the coin 5 times you will

More information

Multiple time step Monte Carlo

Multiple time step Monte Carlo JOURNAL OF CHEMICAL PHYSICS VOLUME 117, NUMBER 18 8 NOVEMBER 2002 Multiple time step Monte Carlo Balázs Hetényi a) Department of Chemistry, Princeton University, Princeton, NJ 08544 and Department of Chemistry

More information

C++ For Science and Engineering Lecture 17

C++ For Science and Engineering Lecture 17 C++ For Science and Engineering Lecture 17 John Chrispell Tulane University Monday October 4, 2010 Functions and C-Style Strings Three methods for representing the C-style string: An array of char A quoted

More information

5. Simulated Annealing 5.1 Basic Concepts. Fall 2010 Instructor: Dr. Masoud Yaghini

5. Simulated Annealing 5.1 Basic Concepts. Fall 2010 Instructor: Dr. Masoud Yaghini 5. Simulated Annealing 5.1 Basic Concepts Fall 2010 Instructor: Dr. Masoud Yaghini Outline Introduction Real Annealing and Simulated Annealing Metropolis Algorithm Template of SA A Simple Example References

More information

Computational Simulations of Magnets at High Temperatures Utilizing the Ising Model and the Monte Carlo Technique

Computational Simulations of Magnets at High Temperatures Utilizing the Ising Model and the Monte Carlo Technique Computational Simulations of Magnets at High Temperatures Utilizing the Ising Model and the Monte Carlo Technique Project SEED Dr. Ken Ahn Mayrolin Garcia Introduction How does the property of magnetism

More information

Monte Carlo (MC) Simulation Methods. Elisa Fadda

Monte Carlo (MC) Simulation Methods. Elisa Fadda Monte Carlo (MC) Simulation Methods Elisa Fadda 1011-CH328, Molecular Modelling & Drug Design 2011 Experimental Observables A system observable is a property of the system state. The system state i is

More information

3.320 Lecture 18 (4/12/05)

3.320 Lecture 18 (4/12/05) 3.320 Lecture 18 (4/12/05) Monte Carlo Simulation II and free energies Figure by MIT OCW. General Statistical Mechanics References D. Chandler, Introduction to Modern Statistical Mechanics D.A. McQuarrie,

More information

CS 7B - Fall Final Exam (take-home portion). Due Wednesday, 12/13 at 2 pm

CS 7B - Fall Final Exam (take-home portion). Due Wednesday, 12/13 at 2 pm CS 7B - Fall 2017 - Final Exam (take-home portion). Due Wednesday, 12/13 at 2 pm Write your responses to following questions on separate paper. Use complete sentences where appropriate and write out code

More information

C++ For Science and Engineering Lecture 10

C++ For Science and Engineering Lecture 10 C++ For Science and Engineering Lecture 10 John Chrispell Tulane University Wednesday 15, 2010 Introducing for loops Often we want programs to do the same action more than once. #i n c l u d e

More information

Two simple lattice models of the equilibrium shape and the surface morphology of supported 3D crystallites

Two simple lattice models of the equilibrium shape and the surface morphology of supported 3D crystallites Bull. Nov. Comp. Center, Comp. Science, 27 (2008), 63 69 c 2008 NCC Publisher Two simple lattice models of the equilibrium shape and the surface morphology of supported 3D crystallites Michael P. Krasilnikov

More information

Computer simulations as concrete models for student reasoning

Computer simulations as concrete models for student reasoning Computer simulations as concrete models for student reasoning Jan Tobochnik Department of Physics Kalamazoo College Kalamazoo MI 49006 In many thermal physics courses, students become preoccupied with

More information

Basics of Statistical Mechanics

Basics of Statistical Mechanics Basics of Statistical Mechanics Review of ensembles Microcanonical, canonical, Maxwell-Boltzmann Constant pressure, temperature, volume, Thermodynamic limit Ergodicity (see online notes also) Reading assignment:

More information

There are self-avoiding walks of steps on Z 3

There are self-avoiding walks of steps on Z 3 There are 7 10 26 018 276 self-avoiding walks of 38 797 311 steps on Z 3 Nathan Clisby MASCOS, The University of Melbourne Institut für Theoretische Physik Universität Leipzig November 9, 2012 1 / 37 Outline

More information

Jackson, Classical Electrodynamics, Section 14.8 Thomson Scattering of Radiation

Jackson, Classical Electrodynamics, Section 14.8 Thomson Scattering of Radiation High Energy Cross Sections by Monte Carlo Quadrature Thomson Scattering in Electrodynamics Jackson, Classical Electrodynamics, Section 14.8 Thomson Scattering of Radiation Jackson Figures 14.17 and 14.18:

More information

Modeling & Simulation of Glass Structure

Modeling & Simulation of Glass Structure Modeling & Simulation of Glass Structure VCG Lecture 19 John Kieffer Department of Materials Science and Engineering University of Michigan 1 Overview Historical perspective Simulation methodologies Theoretical

More information

THE DETAILED BALANCE ENERGY-SCALED DISPLACEMENT MONTE CARLO ALGORITHM

THE DETAILED BALANCE ENERGY-SCALED DISPLACEMENT MONTE CARLO ALGORITHM Molecular Simulation, 1987, Vol. 1, pp. 87-93 c Gordon and Breach Science Publishers S.A. THE DETAILED BALANCE ENERGY-SCALED DISPLACEMENT MONTE CARLO ALGORITHM M. MEZEI Department of Chemistry, Hunter

More information

Lecture 25 Goals: Chapter 18 Understand the molecular basis for pressure and the idealgas

Lecture 25 Goals: Chapter 18 Understand the molecular basis for pressure and the idealgas Lecture 5 Goals: Chapter 18 Understand the molecular basis for pressure and the idealgas law. redict the molar specific heats of gases and solids. Understand how heat is transferred via molecular collisions

More information

André Schleife Department of Materials Science and Engineering

André Schleife Department of Materials Science and Engineering André Schleife Department of Materials Science and Engineering Length Scales (c) ICAMS: http://www.icams.de/cms/upload/01_home/01_research_at_icams/length_scales_1024x780.png Goals for today: Background

More information

Enrico Fermi and the FERMIAC. Mechanical device that plots 2D random walks of slow and fast neutrons in fissile material

Enrico Fermi and the FERMIAC. Mechanical device that plots 2D random walks of slow and fast neutrons in fissile material Monte Carlo History Statistical sampling Buffon s needles and estimates of π 1940s: neutron transport in fissile material Origin of name People: Ulam, von Neuman, Metropolis, Teller Other areas of use:

More information

Advanced Monte Carlo Methods Problems

Advanced Monte Carlo Methods Problems Advanced Monte Carlo Methods Problems September-November, 2012 Contents 1 Integration with the Monte Carlo method 2 1.1 Non-uniform random numbers.......................... 2 1.2 Gaussian RNG..................................

More information

Monte Carlo. Lecture 15 4/9/18. Harvard SEAS AP 275 Atomistic Modeling of Materials Boris Kozinsky

Monte Carlo. Lecture 15 4/9/18. Harvard SEAS AP 275 Atomistic Modeling of Materials Boris Kozinsky Monte Carlo Lecture 15 4/9/18 1 Sampling with dynamics In Molecular Dynamics we simulate evolution of a system over time according to Newton s equations, conserving energy Averages (thermodynamic properties)

More information

2. Verification of the Boltzmann distribution

2. Verification of the Boltzmann distribution Exercises Lecture VIII Macrostates and microstates: equilibrium and entropy. Metropolis algorithm in the canonical ensemble: verifying Boltzmann s distribution 1. MC simulation of a simple N-particles

More information

Statistical Mechanics

Statistical Mechanics Statistical Mechanics Newton's laws in principle tell us how anything works But in a system with many particles, the actual computations can become complicated. We will therefore be happy to get some 'average'

More information

April 20th, Advanced Topics in Machine Learning California Institute of Technology. Markov Chain Monte Carlo for Machine Learning

April 20th, Advanced Topics in Machine Learning California Institute of Technology. Markov Chain Monte Carlo for Machine Learning for for Advanced Topics in California Institute of Technology April 20th, 2017 1 / 50 Table of Contents for 1 2 3 4 2 / 50 History of methods for Enrico Fermi used to calculate incredibly accurate predictions

More information

15 Monte Carlo methods

15 Monte Carlo methods 15 Monte Carlo methods 15.1 The Monte Carlo method The Monte Carlo method is simple, robust, and useful. It was invented by Enrico Fermi and developed by Metropolis (Metropolis et al., 1953). It has many

More information

TSTC Lectures: Theoretical & Computational Chemistry

TSTC Lectures: Theoretical & Computational Chemistry TSTC Lectures: Theoretical & Computational Chemistry Rigoberto Hernandez May 2009, Lecture #2 Statistical Mechanics: Structure S = k B log W! Boltzmann's headstone at the Vienna Zentralfriedhof.!! Photo

More information

Simulations with MM Force Fields. Monte Carlo (MC) and Molecular Dynamics (MD) Video II.vi

Simulations with MM Force Fields. Monte Carlo (MC) and Molecular Dynamics (MD) Video II.vi Simulations with MM Force Fields Monte Carlo (MC) and Molecular Dynamics (MD) Video II.vi Some slides taken with permission from Howard R. Mayne Department of Chemistry University of New Hampshire Walking

More information

Sampling Methods (11/30/04)

Sampling Methods (11/30/04) CS281A/Stat241A: Statistical Learning Theory Sampling Methods (11/30/04) Lecturer: Michael I. Jordan Scribe: Jaspal S. Sandhu 1 Gibbs Sampling Figure 1: Undirected and directed graphs, respectively, with

More information

Computational Physics (6810): Session 13

Computational Physics (6810): Session 13 Computational Physics (6810): Session 13 Dick Furnstahl Nuclear Theory Group OSU Physics Department April 14, 2017 6810 Endgame Various recaps and followups Random stuff (like RNGs :) Session 13 stuff

More information

C++ For Science and Engineering Lecture 14

C++ For Science and Engineering Lecture 14 C++ For Science and Engineering Lecture 14 John Chrispell Tulane University Monday September 27, 2010 File Input and Output Recall writing text to standard out You must include the iostream header file.

More information

12 The Laws of Thermodynamics

12 The Laws of Thermodynamics June 14, 1998 12 The Laws of Thermodynamics Using Thermal Energy to do Work Understanding the laws of thermodynamics allows us to use thermal energy in a practical way. The first law of thermodynamics

More information

The XY-Model. David-Alexander Robinson Sch th January 2012

The XY-Model. David-Alexander Robinson Sch th January 2012 The XY-Model David-Alexander Robinson Sch. 08332461 17th January 2012 Contents 1 Introduction & Theory 2 1.1 The XY-Model............................... 2 1.2 Markov Chains...............................

More information

MD Thermodynamics. Lecture 12 3/26/18. Harvard SEAS AP 275 Atomistic Modeling of Materials Boris Kozinsky

MD Thermodynamics. Lecture 12 3/26/18. Harvard SEAS AP 275 Atomistic Modeling of Materials Boris Kozinsky MD Thermodynamics Lecture 1 3/6/18 1 Molecular dynamics The force depends on positions only (not velocities) Total energy is conserved (micro canonical evolution) Newton s equations of motion (second order

More information

Wang-Landau Monte Carlo simulation. Aleš Vítek IT4I, VP3

Wang-Landau Monte Carlo simulation. Aleš Vítek IT4I, VP3 Wang-Landau Monte Carlo simulation Aleš Vítek IT4I, VP3 PART 1 Classical Monte Carlo Methods Outline 1. Statistical thermodynamics, ensembles 2. Numerical evaluation of integrals, crude Monte Carlo (MC)

More information

Melting line of the Lennard-Jones system, infinite size, and full potential

Melting line of the Lennard-Jones system, infinite size, and full potential THE JOURNAL OF CHEMICAL PHYSICS 127, 104504 2007 Melting line of the Lennard-Jones system, infinite size, and full potential Ethan A. Mastny a and Juan J. de Pablo b Chemical and Biological Engineering

More information

C H E M 1 CHEM 101-GENERAL CHEMISTRY CHAPTER 5 GASES INSTR : FİLİZ ALSHANABLEH

C H E M 1 CHEM 101-GENERAL CHEMISTRY CHAPTER 5 GASES INSTR : FİLİZ ALSHANABLEH C H E M 1 CHEM 101-GENERAL CHEMISTRY CHAPTER 5 GASES 0 1 INSTR : FİLİZ ALSHANABLEH CHAPTER 5 GASES Properties of Gases Pressure History and Application of the Gas Laws Partial Pressure Stoichiometry of

More information

ACM-ICPC South Western European Regional SWERC 2008

ACM-ICPC South Western European Regional SWERC 2008 ACM-ICPC South Western European Regional SWERC 2008 FAU Contest Team icpc@i2.informatik.uni-erlangen.de Friedrich-Alexander Universität Erlangen-Nürnberg November, 23 2008 FAU Contest Team ACM-ICPC South

More information

Physics 132- Fundamentals of Physics for Biologists II

Physics 132- Fundamentals of Physics for Biologists II Physics 132- Fundamentals of Physics for Biologists II Statistical Physics and Thermodynamics A confession Temperature Object A Object contains MANY atoms (kinetic energy) and interactions (potential energy)

More information

Ideal Gas Behavior. NC State University

Ideal Gas Behavior. NC State University Chemistry 331 Lecture 6 Ideal Gas Behavior NC State University Macroscopic variables P, T Pressure is a force per unit area (P= F/A) The force arises from the change in momentum as particles hit an object

More information

Markov Chain Monte Carlo (MCMC)

Markov Chain Monte Carlo (MCMC) School of Computer Science 10-708 Probabilistic Graphical Models Markov Chain Monte Carlo (MCMC) Readings: MacKay Ch. 29 Jordan Ch. 21 Matt Gormley Lecture 16 March 14, 2016 1 Homework 2 Housekeeping Due

More information

Minicourse on: Markov Chain Monte Carlo: Simulation Techniques in Statistics

Minicourse on: Markov Chain Monte Carlo: Simulation Techniques in Statistics Minicourse on: Markov Chain Monte Carlo: Simulation Techniques in Statistics Eric Slud, Statistics Program Lecture 1: Metropolis-Hastings Algorithm, plus background in Simulation and Markov Chains. Lecture

More information

MCMC notes by Mark Holder

MCMC notes by Mark Holder MCMC notes by Mark Holder Bayesian inference Ultimately, we want to make probability statements about true values of parameters, given our data. For example P(α 0 < α 1 X). According to Bayes theorem:

More information

Physics 132- Fundamentals of Physics for Biologists II

Physics 132- Fundamentals of Physics for Biologists II Physics 132- Fundamentals of Physics for Biologists II Statistical Physics and Thermodynamics It s all about energy Classifying Energy Kinetic Energy Potential Energy Macroscopic Energy Moving baseball

More information

Introduction Statistical Thermodynamics. Monday, January 6, 14

Introduction Statistical Thermodynamics. Monday, January 6, 14 Introduction Statistical Thermodynamics 1 Molecular Simulations Molecular dynamics: solve equations of motion Monte Carlo: importance sampling r 1 r 2 r n MD MC r 1 r 2 2 r n 2 3 3 4 4 Questions How can

More information

Stochastic optimization Markov Chain Monte Carlo

Stochastic optimization Markov Chain Monte Carlo Stochastic optimization Markov Chain Monte Carlo Ethan Fetaya Weizmann Institute of Science 1 Motivation Markov chains Stationary distribution Mixing time 2 Algorithms Metropolis-Hastings Simulated Annealing

More information

Numerical solution of the time-independent 1-D Schrödinger equation. Matthias E. Möbius. September 24, 2010

Numerical solution of the time-independent 1-D Schrödinger equation. Matthias E. Möbius. September 24, 2010 Numerical solution of the time-independent 1-D Schrödinger equation Matthias E. Möbius September 24, 2010 1 Aim of the computational lab Numerical solution of the one-dimensional stationary Schrödinger

More information

Markov chain Monte Carlo

Markov chain Monte Carlo Markov chain Monte Carlo Probabilistic Models of Cognition, 2011 http://www.ipam.ucla.edu/programs/gss2011/ Roadmap: Motivation Monte Carlo basics What is MCMC? Metropolis Hastings and Gibbs...more tomorrow.

More information

If the position of a molecule is measured after increments of 10, 100, 1000 steps, what will the distribution of measured steps look like?

If the position of a molecule is measured after increments of 10, 100, 1000 steps, what will the distribution of measured steps look like? If the position of a molecule is measured after increments of 10, 100, 1000 steps, what will the distribution of measured steps look like? (1) No longer Gaussian (2) Identical Gaussians (3) Gaussians with

More information

C++ For Science and Engineering Lecture 13

C++ For Science and Engineering Lecture 13 C++ For Science and Engineering Lecture 13 John Chrispell Tulane University Wednesday September 22, 2010 Logical Expressions: Sometimes you want to use logical and and logical or (even logical not) in

More information

Data Analysis I. Dr Martin Hendry, Dept of Physics and Astronomy University of Glasgow, UK. 10 lectures, beginning October 2006

Data Analysis I. Dr Martin Hendry, Dept of Physics and Astronomy University of Glasgow, UK. 10 lectures, beginning October 2006 Astronomical p( y x, I) p( x, I) p ( x y, I) = p( y, I) Data Analysis I Dr Martin Hendry, Dept of Physics and Astronomy University of Glasgow, UK 10 lectures, beginning October 2006 4. Monte Carlo Methods

More information

( ) ( ) ( ) ( ) Simulated Annealing. Introduction. Pseudotemperature, Free Energy and Entropy. A Short Detour into Statistical Mechanics.

( ) ( ) ( ) ( ) Simulated Annealing. Introduction. Pseudotemperature, Free Energy and Entropy. A Short Detour into Statistical Mechanics. Aims Reference Keywords Plan Simulated Annealing to obtain a mathematical framework for stochastic machines to study simulated annealing Parts of chapter of Haykin, S., Neural Networks: A Comprehensive

More information

fiziks Institute for NET/JRF, GATE, IIT-JAM, JEST, TIFR and GRE in PHYSICAL SCIENCES

fiziks Institute for NET/JRF, GATE, IIT-JAM, JEST, TIFR and GRE in PHYSICAL SCIENCES Content-Thermodynamics & Statistical Mechanics 1. Kinetic theory of gases..(1-13) 1.1 Basic assumption of kinetic theory 1.1.1 Pressure exerted by a gas 1.2 Gas Law for Ideal gases: 1.2.1 Boyle s Law 1.2.2

More information

Introduction to Statistics and Error Analysis

Introduction to Statistics and Error Analysis Introduction to Statistics and Error Analysis Physics116C, 4/3/06 D. Pellett References: Data Reduction and Error Analysis for the Physical Sciences by Bevington and Robinson Particle Data Group notes

More information

Convergence Rate of Markov Chains

Convergence Rate of Markov Chains Convergence Rate of Markov Chains Will Perkins April 16, 2013 Convergence Last class we saw that if X n is an irreducible, aperiodic, positive recurrent Markov chain, then there exists a stationary distribution

More information

A New Method to Determine First-Order Transition Points from Finite-Size Data

A New Method to Determine First-Order Transition Points from Finite-Size Data A New Method to Determine First-Order Transition Points from Finite-Size Data Christian Borgs and Wolfhard Janke Institut für Theoretische Physik Freie Universität Berlin Arnimallee 14, 1000 Berlin 33,

More information

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 License.

This work is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 4.0 License. University of Rhode Island DigitalCommons@URI Equilibrium Statistical Physics Physics Course Materials 2015 07. Kinetic Theory I Gerhard Müller University of Rhode Island, gmuller@uri.edu Creative Commons

More information

A simple algorithm that will generate a sequence of integers between 0 and m is:

A simple algorithm that will generate a sequence of integers between 0 and m is: Using the Pseudo-Random Number generator Generating random numbers is a useful technique in many numerical applications in Physics. This is because many phenomena in physics are random, and algorithms

More information

Thermodynamics and Statistical Physics Exam

Thermodynamics and Statistical Physics Exam Thermodynamics and Statistical Physics Exam You may use your textbook (Thermal Physics by Schroeder) and a calculator. 1. Short questions. No calculation needed. (a) Two rooms A and B in a building are

More information

The Kinetic Theory of Gases (1)

The Kinetic Theory of Gases (1) Chapter 4 The Kinetic Theory of Gases () Topics Motivation and assumptions for a kinetic theory of gases Joule expansion The role of collisions Probabilities and how to combine them The velocity distribution

More information

Brief introduction to Markov Chain Monte Carlo

Brief introduction to Markov Chain Monte Carlo Brief introduction to Department of Probability and Mathematical Statistics seminar Stochastic modeling in economics and finance November 7, 2011 Brief introduction to Content 1 and motivation Classical

More information

Classical Monte-Carlo simulations

Classical Monte-Carlo simulations Classical Monte-Carlo simulations Graduate Summer Institute Complex Plasmas at the Stevens Insitute of Technology Henning Baumgartner, A. Filinov, H. Kählert, P. Ludwig and M. Bonitz Christian-Albrechts-University

More information

Intermediate Lab PHYS 3870

Intermediate Lab PHYS 3870 Intermediate Lab PHYS 3870 Lecture 3 Distribution Functions References: Taylor Ch. 5 (and Chs. 10 and 11 for Reference) Taylor Ch. 6 and 7 Also refer to Glossary of Important Terms in Error Analysis Probability

More information

Simulation of the two-dimensional square-lattice Lenz-Ising model in Python

Simulation of the two-dimensional square-lattice Lenz-Ising model in Python Senior Thesis Simulation of the two-dimensional square-lattice Lenz-Ising model in Python Author: Richard Munroe Advisor: Dr. Edward Brash 2012-10-17 Abstract A program to simulate the the two-dimensional

More information

LATTICE 4 BEGINNERS. Guillermo Breto Rangel May 14th, Monday, May 14, 12

LATTICE 4 BEGINNERS. Guillermo Breto Rangel May 14th, Monday, May 14, 12 LATTICE 4 BEGINNERS Guillermo Breto Rangel May 14th, 2012 1 QCD GENERAL 2 QCD GENERAL 3 QCD vs QED QCD versus QED Quantum Electrodynamics (QED): The interaction is due to the exchange of photons. Every

More information

Teaching Statistical and Thermal Physics Using Computer Simulations

Teaching Statistical and Thermal Physics Using Computer Simulations Teaching Statistical and Thermal Physics Using Computer Simulations Tutorial T2, 4 March 2007 Harvey Gould, Clark University Collaborators: Wolfgang Christian, Davidson College Jan Tobochnik,

More information

Advanced Sampling Algorithms

Advanced Sampling Algorithms + Advanced Sampling Algorithms + Mobashir Mohammad Hirak Sarkar Parvathy Sudhir Yamilet Serrano Llerena Advanced Sampling Algorithms Aditya Kulkarni Tobias Bertelsen Nirandika Wanigasekara Malay Singh

More information

Columbia University Department of Physics QUALIFYING EXAMINATION

Columbia University Department of Physics QUALIFYING EXAMINATION Columbia University Department of Physics QUALIFYING EXAMINATION Friday, January 17, 2014 1:00PM to 3:00PM General Physics (Part I) Section 5. Two hours are permitted for the completion of this section

More information

Metropolis Monte Carlo simulation of the Ising Model

Metropolis Monte Carlo simulation of the Ising Model Metropolis Monte Carlo simulation of the Ising Model Krishna Shrinivas (CH10B026) Swaroop Ramaswamy (CH10B068) May 10, 2013 Modelling and Simulation of Particulate Processes (CH5012) Introduction The Ising

More information

Langevin Methods. Burkhard Dünweg Max Planck Institute for Polymer Research Ackermannweg 10 D Mainz Germany

Langevin Methods. Burkhard Dünweg Max Planck Institute for Polymer Research Ackermannweg 10 D Mainz Germany Langevin Methods Burkhard Dünweg Max Planck Institute for Polymer Research Ackermannweg 1 D 55128 Mainz Germany Motivation Original idea: Fast and slow degrees of freedom Example: Brownian motion Replace

More information

Numerical Analysis of 2-D Ising Model. Ishita Agarwal Masters in Physics (University of Bonn) 17 th March 2011

Numerical Analysis of 2-D Ising Model. Ishita Agarwal Masters in Physics (University of Bonn) 17 th March 2011 Numerical Analysis of 2-D Ising Model By Ishita Agarwal Masters in Physics (University of Bonn) 17 th March 2011 Contents Abstract Acknowledgment Introduction Computational techniques Numerical Analysis

More information

2. Thermodynamics. Introduction. Understanding Molecular Simulation

2. Thermodynamics. Introduction. Understanding Molecular Simulation 2. Thermodynamics Introduction Molecular Simulations Molecular dynamics: solve equations of motion r 1 r 2 r n Monte Carlo: importance sampling r 1 r 2 r n How do we know our simulation is correct? Molecular

More information

A simple technique to estimate partition functions and equilibrium constants from Monte Carlo simulations

A simple technique to estimate partition functions and equilibrium constants from Monte Carlo simulations A simple technique to estimate partition functions and equilibrium constants from Monte Carlo simulations Michal Vieth Department of Chemistry, The Scripps Research Institute, 10666 N. Torrey Pines Road,

More information

Thus, the volume element remains the same as required. With this transformation, the amiltonian becomes = p i m i + U(r 1 ; :::; r N ) = and the canon

Thus, the volume element remains the same as required. With this transformation, the amiltonian becomes = p i m i + U(r 1 ; :::; r N ) = and the canon G5.651: Statistical Mechanics Notes for Lecture 5 From the classical virial theorem I. TEMPERATURE AND PRESSURE ESTIMATORS hx i x j i = kt ij we arrived at the equipartition theorem: * + p i = m i NkT

More information

Introduction to Machine Learning CMU-10701

Introduction to Machine Learning CMU-10701 Introduction to Machine Learning CMU-10701 Markov Chain Monte Carlo Methods Barnabás Póczos Contents Markov Chain Monte Carlo Methods Sampling Rejection Importance Hastings-Metropolis Gibbs Markov Chains

More information

Kinetic Monte Carlo modelling of semiconductor growth

Kinetic Monte Carlo modelling of semiconductor growth Kinetic Monte Carlo modelling of semiconductor growth Peter Kratzer Faculty of Physics, University Duisburg-Essen, Germany Time and length scales morphology Ga As 2D islands surface reconstruction Methods

More information

SC7/SM6 Bayes Methods HT18 Lecturer: Geoff Nicholls Lecture 2: Monte Carlo Methods Notes and Problem sheets are available at http://www.stats.ox.ac.uk/~nicholls/bayesmethods/ and via the MSc weblearn pages.

More information

Stochastic Simulation

Stochastic Simulation Stochastic Simulation Idea: probabilities samples Get probabilities from samples: X count x 1 n 1. x k total. n k m X probability x 1. n 1 /m. x k n k /m If we could sample from a variable s (posterior)

More information

Kinetic Theory 1 / Probabilities

Kinetic Theory 1 / Probabilities Kinetic Theory 1 / Probabilities 1. Motivations: statistical mechanics and fluctuations 2. Probabilities 3. Central limit theorem 1 Reading check Main concept introduced in first half of this chapter A)Temperature

More information

Linear Algebra Section 2.6 : LU Decomposition Section 2.7 : Permutations and transposes Wednesday, February 13th Math 301 Week #4

Linear Algebra Section 2.6 : LU Decomposition Section 2.7 : Permutations and transposes Wednesday, February 13th Math 301 Week #4 Linear Algebra Section. : LU Decomposition Section. : Permutations and transposes Wednesday, February 1th Math 01 Week # 1 The LU Decomposition We learned last time that we can factor a invertible matrix

More information

CS 7B - Fall Assignment 4: Exploring Wumpus (Linked Rooms). Due 12/13/18

CS 7B - Fall Assignment 4: Exploring Wumpus (Linked Rooms). Due 12/13/18 CS 7B - Fall 2018 - Assignment 4: Exploring Wumpus (Linked Rooms). Due 12/13/18 In this project we ll build, investigate and augment the the game Hunt the Wumpus, as described in exercise 12 or PPP2, Chapter

More information

MatSci 331 Homework 4 Molecular Dynamics and Monte Carlo: Stress, heat capacity, quantum nuclear effects, and simulated annealing

MatSci 331 Homework 4 Molecular Dynamics and Monte Carlo: Stress, heat capacity, quantum nuclear effects, and simulated annealing MatSci 331 Homework 4 Molecular Dynamics and Monte Carlo: Stress, heat capacity, quantum nuclear effects, and simulated annealing Due Thursday Feb. 21 at 5pm in Durand 110. Evan Reed In this homework,

More information

Simulated Annealing. Local Search. Cost function. Solution space

Simulated Annealing. Local Search. Cost function. Solution space Simulated Annealing Hill climbing Simulated Annealing Local Search Cost function? Solution space Annealing Annealing is a thermal process for obtaining low energy states of a solid in a heat bath. The

More information

Temperature and Heat. Ken Intriligator s week 4 lectures, Oct 21, 2013

Temperature and Heat. Ken Intriligator s week 4 lectures, Oct 21, 2013 Temperature and Heat Ken Intriligator s week 4 lectures, Oct 21, 2013 This week s subjects: Temperature and Heat chapter of text. All sections. Thermal properties of Matter chapter. Omit the section there

More information