1 / 11

TUTORIAL no. 2 Monte Carlo simulations: Lennard Jones gas

CECAM school on Numerical simulations F. Becca & G. Lattanzi SISSA. TUTORIAL no. 2 Monte Carlo simulations: Lennard Jones gas. G. Lattanzi Università degli studi di Bari “Aldo Moro”. Trieste, July 10 th , 2012. Metropolis Algorithm in a nutshell.

marla
Download Presentation

TUTORIAL no. 2 Monte Carlo simulations: Lennard Jones gas

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CECAM school on Numerical simulations F. Becca & G. Lattanzi SISSA TUTORIAL no. 2Monte Carlo simulations:Lennard Jones gas G. Lattanzi Università degli studi di Bari “Aldo Moro” Trieste, July 10th, 2012

  2. Metropolis Algorithm in a nutshell Select a particle at random and calculate its energy U(o), which is a function of the positions of all the particles. Attempt a displacement of the selected particle. Compute the new energy U(n) and ΔU=U(n)-U(o). Accept the move with probability: In this exercise, we will set up a Monte Carlo simulation of a gas of Lennard Jones particles. You can choose your favourite programming language.

  3. Lennard-Jones potential

  4. Reduced units • Unit of length: σ • Unit of energy, ε • Unit of mass, m • All the other units descend from these. • For instance, the unit of time is: • while the unit of temperature is: • In these units, the vdW interaction potential becomes:

  5. Periodic boundary conditions

  6. Truncation of interactions

  7. Initialization: parameters We start with a simple sytem of N=100 particles with Lennard-Jones interactions in a 3D cubic box. Number of particles: N=100 Density: ρ=0.5 particles/σ3 Simulation box: cubicSize of the box: L=(N/ρ)1/3 Cutoff: rC=L/2 Starting configuration. We may choose to place the N particles randomly, or on a cubic lattice. We are interested in equilibrium properties, hence our results MUST not depend on the initial configuration. If they do, our simulation is simply WRONG.

  8. Total energy and tricks of the trade The formula that computes the total configurational energy is: Trick 1. If we write the formula in this way, it is easier to code it in a double loop. Trck 2. It is also easy to calculate the difference in energy between the old and new configuration, by simply counting the interactions of the selected particle. Trick 3. It is advisable to calculate the distance squared between two particles, in order to avoid loosing time on the sqrt() operation, which is not needed for practical purposes.

  9. Trial moves We MUST select the particle for which we attempt the displacement RANDOMLY. We ensure in this way that the underlying Markov chain remains symmetric. Translational move: We need to calculate the energy difference now, in order to apply the Metropolis criterion and decide whether to accept the move or not.

  10. Metropolis Algorithm Select a particle at random. Attempt a displacement of the selected particle. Compute ΔU=U(n)-U(o). Accept the move with probability: Rule of thumb. Δ should be not too small or not too large: it should correspond to an acceptance rate of 30-50%.

  11. Exercise: the Lennard-Jones gas • Parameters: • Number of particles: N=100 • Density: ρ=0.5 particles/σ3 • Simulation box: cubicSize of the box: L=(N/ρ)1/3 • Cutoff: rC=L/2 • Temperature = 2.0 • Make a suitable test to check for periodic boundary conditions. • Acceptance: make sure that your acceptance rate is between 30 and 50%. • Equilibrate the system: calculate the total energy U for each configuration, its average <U> and the correlation function <U(t)U(t’)>. • Obtain <U(T)> for different temperatures and the specific heat • Check your result with the specific heat evaluated from the fluctuation analysis:

More Related