1 CE 530 Molecular Simulation Lecture 11 Molecular Dynamics Simulation David A. Kofke Department of Chemical Engineering SUNY Buffalo

Slides:



Advertisements
Similar presentations
Time averages and ensemble averages
Advertisements

Simulazione di Biomolecole: metodi e applicazioni giorgio colombo
Statistical mechanics
Molecular dynamics in different ensembles
Sect. 8.2: Cyclic Coordinates & Conservation Theorems
Advanced Molecular Dynamics Velocity scaling Andersen Thermostat Hamiltonian & Lagrangian Appendix A Nose-Hoover thermostat.
Molecular Dynamics at Constant Temperature and Pressure Section 6.7 in M.M.
Transfer FAS UAS SAINT-PETERSBURG STATE UNIVERSITY COMPUTATIONAL PHYSICS Introduction Physical basis Molecular dynamics Temperature and thermostat Numerical.
Lecture 13: Conformational Sampling: MC and MD Dr. Ronald M. Levy Contributions from Mike Andrec and Daniel Weinstock Statistical Thermodynamics.
LINCS: A Linear Constraint Solver for Molecular Simulations Berk Hess, Hemk Bekker, Herman J.C.Berendsen, Johannes G.E.M.Fraaije Journal of Computational.
1 CE 530 Molecular Simulation Lecture 8 Markov Processes David A. Kofke Department of Chemical Engineering SUNY Buffalo
Lagrangian and Hamiltonian Dynamics
Symmetry. Phase Continuity Phase density is conserved by Liouville’s theorem.  Distribution function D  Points as ensemble members Consider as a fluid.
UNC Chapel Hill S. Redon - M. C. Lin Rigid body dynamics II Solving the dynamics problems.
Mechanics.
Hamiltonian Dynamics. Cylindrical Constraint Problem  A particle of mass m is attracted to the origin by a force proportional to the distance.  The.
1 CE 530 Molecular Simulation Lecture 16 Dielectrics and Reaction Field Method David A. Kofke Department of Chemical Engineering SUNY Buffalo
Molecular Dynamics Classical trajectories and exact solutions
1 CE 530 Molecular Simulation Lecture 2 David A. Kofke Department of Chemical Engineering SUNY Buffalo
Joo Chul Yoon with Prof. Scott T. Dunham Electrical Engineering University of Washington Molecular Dynamics Simulations.
1 CE 530 Molecular Simulation Lecture 7 David A. Kofke Department of Chemical Engineering SUNY Buffalo
1 Statistical Mechanics and Multi- Scale Simulation Methods ChBE Prof. C. Heath Turner Lecture 11 Some materials adapted from Prof. Keith E. Gubbins:
Introduction to (Statistical) Thermodynamics
1 Physical Chemistry III Molecular Simulations Piti Treesukol Chemistry Department Faculty of Liberal Arts and Science Kasetsart University :
STATIC EQUILIBRIUM [4] Calkin, M. G. “Lagrangian and Hamiltonian Mechanics”, World Scientific, Singapore, 1996, ISBN Consider an object having.
Room 2032 China Canada Winnipeg Manitoba.
Central Force Motion Chapter 8
GENERAL PRINCIPLES OF BRANE KINEMATICS AND DYNAMICS Introduction Strings, branes, geometric principle, background independence Brane space M (brane kinematics)
Revision Previous lecture was about Generating Function Approach Derivation of Conservation Laws via Lagrangian via Hamiltonian.
SMA5233 Particle Methods and Molecular Dynamics Lecture 4: Integration Methods A/P Chen Yu Zong Tel:
Javier Junquera Molecular dynamics in the microcanonical (NVE) ensemble: the Verlet algorithm.
A PPLIED M ECHANICS Lecture 02 Slovak University of Technology Faculty of Material Science and Technology in Trnava.
Molecular Dynamics Simulation Solid-Liquid Phase Diagram of Argon ZCE 111 Computational Physics Semester Project by Gan Sik Hong (105513) Hwang Hsien Shiung.
1 CE 530 Molecular Simulation Lecture 17 Beyond Atoms: Simulating Molecules David A. Kofke Department of Chemical Engineering SUNY Buffalo
Advanced mechanics Physics 302. Instructor: Dr. Alexey Belyanin Office: MIST 426 Office Phone: (979)
Basics of molecular dynamics. Equations of motion for MD simulations The classical MD simulations boil down to numerically integrating Newton’s equations.
1 CE 530 Molecular Simulation Lecture 6 David A. Kofke Department of Chemical Engineering SUNY Buffalo
MATH4248 Weeks Topics: review of rigid body motion, Legendre transformations, derivation of Hamilton’s equations of motion, phase space and Liouville’s.
Chapter 3: Central Forces Introduction Interested in the “2 body” problem! Start out generally, but eventually restrict to motion of 2 bodies interacting.
Statistical Mechanics and Multi-Scale Simulation Methods ChBE
Final review Help sessions scheduled for Dec. 8 and 9, 6:30 pm in MPHY 213 Your hand-written notes allowed No numbers, unless you want a problem with numbers.
Advanced Computer Graphics Rigid Body Simulation Spring 2002 Professor Brogan.
Ch. 8: Hamilton Equations of Motion Sect. 8.1: Legendre Transformations Lagrange Eqtns of motion: n degrees of freedom (d/dt)[(∂L/∂q i )] - (∂L/∂q i )
1 CE 530 Molecular Simulation Lecture 23 Symmetric MD Integrators David A. Kofke Department of Chemical Engineering SUNY Buffalo
Molecular Modelling - Lecture 2 Techniques for Conformational Sampling Uses CHARMM force field Written in C++
Chapter 11 Angular Momentum. Angular momentum plays a key role in rotational dynamics. There is a principle of conservation of angular momentum.  In.
1 CE 530 Molecular Simulation Lecture 12 David A. Kofke Department of Chemical Engineering SUNY Buffalo
Sect. 1.2: Mechanics of a System of Particles Generalization to many (N) particle system: –Distinguish External & Internal Forces. –Newton’s 2 nd Law.
Phy 303: Classical Mechanics (2) Chapter 3 Lagrangian and Hamiltonian Mechanics.
Interacting Molecules in a Dense Fluid
Schrödinger’s Equation in a Central Potential Field
MSc in High Performance Computing Computational Chemistry Module Parallel Molecular Dynamics (i) Bill Smith CCLRC Daresbury Laboratory
1 Statistical Mechanics and Multi- Scale Simulation Methods ChBE Prof. C. Heath Turner Lecture 17 Some materials adapted from Prof. Keith E. Gubbins:
Canonical Equations of Motion -- Hamiltonian Dynamics
Central Force Umiatin,M.Si. The aim : to evaluate characteristic of motion under central force field.
Statistical Mechanics and Multi-Scale Simulation Methods ChBE
Sect. 2.6: Conservation Theorems & Symmetry Properties Lagrange Method: A method to get the eqtns of motion. Solving them = math! n degrees of freedom.
Equivalence of Lagrange’s & Newton’s Equations Section 7.6 The Lagrangian & the Newtonian formulations of mechanics are 100% equivalent! –As we know,
Molecular dynamics (MD) simulations  A deterministic method based on the solution of Newton’s equation of motion F i = m i a i for the ith particle; the.
Computational Physics (Lecture 11) PHY4061. Variation quantum Monte Carlo the approximate solution of the Hamiltonian Time Independent many-body Schrodinger’s.
Advanced Computer Graphics Rigid Body Simulation
Classical Mechanics Lagrangian Mechanics.
Canonical Quantization
Overview of Molecular Dynamics Simulation Theory
Fundamentals of Molecular Dynamics Simulations
Quantum One.
Astronomy before computers!.
Quantum Two.
Advanced Molecular Dynamics
Physics 451/551 Theoretical Mechanics
Presentation transcript:

1 CE 530 Molecular Simulation Lecture 11 Molecular Dynamics Simulation David A. Kofke Department of Chemical Engineering SUNY Buffalo

2 Review and Preview  MD of hard disks intuitive collision detection and impulsive dynamics  Monte Carlo convenient sampling of ensembles no dynamics biasing possible to improve performance  Molecular dynamics equations of motion integration schemes evaluation of dynamical properties extensions to other ensembles focus on atomic systems for now

3 Classical Equations of Motion  Several formulations are in use Newtonian Lagrangian Hamiltonian  Advantages of non-Newtonian formulations more general, no need for “fictitious” forces better suited for multiparticle systems better handling of constraints can be formulated from more basic postulates  Assume conservative forces Gradient of a scalar potential energy

4 Newtonian Formulation  Cartesian spatial coordinates r i = (x i,y i,z i ) are primary variables for N atoms, system of N 2nd-order differential equations  Sample application: 2D motion in central force field Polar coordinates are more natural and convenient r constant angular momentum fictitious (centrifugal) force

5 Generalized Coordinates  Any convenient coordinates for description of particular system use q i as symbol for general coordinate examples  diatomic {q 1,…,q 6 } = {x com, y com, z com, r 12, ,  }  2-D motion in central field {q 1, q 2 } = {r,  }  Kinetic energy general quadratic form examples úrotating diatomic ú2-D central motion r   usually vanish

6 Lagrangian Formulation  Independent of coordinate system  Define the Lagrangian  Equations of motion N second-order differential equations  Central-force example

7 Hamiltonian Formulation 1. Motivation  Appropriate for application to statistical mechanics and quantum mechanics  Newtonian and Lagrangian viewpoints take the q i as the fundamental variables N-variable configuration space appears only as a convenient shorthand for dq/dt working formulas are 2nd-order differential equations  Hamiltonian formulation seeks to work with 1st-order differential equations 2N variables treat the coordinate and its time derivative as independent variables appropriate quantum-mechanically

8 Hamiltonian Formulation 2. Preparation  Mathematically, Lagrangian treats q and as distinct identify the generalized momentum as e.g. Lagrangian equations of motion  We would like a formulation in which p is an independent variable p i is the derivative of the Lagrangian with respect to, and we’re looking to replace with p i we need …?

9 Hamiltonian Formulation 3. Defintion  …a Legendre transform!  Define the Hamiltonian, H  H equals the total energy (kinetic plus potential)

10 Hamiltonian Formulation 4. Dynamics  Hamilton’s equations of motion From Lagrangian equations, written in terms of momentum Lagrange’s equation of motion Definition of momentum Differential change in L Legendre transform Hamilton’s equations of motion Conservation of energy

11 Hamiltonian Formulation 5. Example  Particle motion in central force field  Equations no simpler, but theoretical basis is better r Lagrange’s equations

12 Phase Space (again)  Return to the complete picture of phase space full specification of microstate of the system is given by the values of all positions and all momenta of all atoms   = (p N,r N ) view positions and momenta as completely independent coordinates úconnection between them comes only through equation of motion  Motion through phase space helpful to think of dynamics as “simple” movement through the high- dimensional phase space úfacilitate connection to quantum mechanics úbasis for theoretical treatments of dynamics úunderstanding of integrators 

13 Integration Algorithms  Equations of motion in cartesian coordinates  Desirable features of an integrator minimal need to compute forces (a very expensive calculation) good stability for large time steps good accuracy conserves energy and momentum time-reversible area-preserving (symplectic) pairwise additive forces 2-dimensional space (for example) More on these later F

14 Verlet Algorithm 1. Equations  Very simple, very good, very popular algorithm  Consider expansion of coordinate forward and backward in time  Add these together  Rearrange update without ever consulting velocities!

15 Verlet Algorithm 2. Flow diagram Configuration r(t) Previous configuration r(t-  t) Compute forces F(t) on all atoms using r(t) Advance all positions according to r(t+  t) = 2r(t)-r(t-  t)+F(t)/m  t 2 Add to block sum End of block? No Block averages Yes Initialization Reset block sums Compute block average Compute final results blocks per simulation Entire Simulation 1 move per cycle New configuration cycles per block Add to block sum One MD Cycle One force evaluation per time step

16 Verlet Algorithm 2. Flow Diagram rvFrvF t-  t t t+  t Given current position and position at end of previous time step Schematic from Allen & Tildesley, Computer Simulation of Liquids

17 Verlet Algorithm 2. Flow Diagram rvFrvF t-  t t t+  t Compute the force at the current position Schematic from Allen & Tildesley, Computer Simulation of Liquids

18 Verlet Algorithm 2. Flow Diagram rvFrvF t-  t t t+  t Compute new position from present and previous positions, and present force Schematic from Allen & Tildesley, Computer Simulation of Liquids

19 Verlet Algorithm 2. Flow Diagram rvFrvF t-2  t t-  t t t+  t Advance to next time step, repeat Schematic from Allen & Tildesley, Computer Simulation of Liquids

20 Verlet Algorithm 3. Java Code

21 Verlet Algorithm 3. Relevant Methods in Java Code //Performs one timestep increment in the Verlet algorithm public void doStep(double tStep) { atomIterator.reset(); while(atomIterator.hasNext()) { //zero forces on all atoms ((Agent)atomIterator.next().ia).force.E(0.0); //integratorVerlet.Agent keeps a force Vector } pairIterator.allPairs(forceSum); //sum forces on all pairs double t2 = tStep*tStep; atomIterator.reset(); while(atomIterator.hasNext()) { //loop over all atoms, moving according to Verlet Atom a = atomIterator.next(); Agent agent = (Agent)a.ia; Space.Vector r = a.position(); //current position of the atom temp.E(r); //save it r.TE(2.0); //2*r r.ME(agent.rLast); //2*r-rLast agent.force.TE(a.rm()*t2); // f/m dt^2 r.PE(agent.force); //2*r - rLast + f/m dt^2 agent.rLast.E(temp); //rLast gets present r } return; } public class IntegratorVerlet extends Integrator

22 Verlet Algorithm 3. Relevant Methods in Java Code //(anonymous) class for incrementing the sum of the forces on each atom forceSum = new AtomPair.Action() { private Space.Vector f = simulation().space.makeVector(); public void action(AtomPair pair) { PotentialSoft potential = (PotentialSoft)simulation().getPotential(pair) //identify pot’l f.E(potential.force(pair)); //compute force of atom1 on atom2 ((Agent)pair.atom1().ia).force.PE(f); //increment atom1 force ((Agent)pair.atom2().ia).force.ME(f); //increment atom2 force } }; //Agent class for IntegratorVerlet; stores useful quantities in each Atom public final static class Agent implements Integrator.Agent { public Atom atom; public Space.Vector force; //used to accumulate the force on the atom public Space.Vector rLast; //holds the position of the atom at the last step public Agent(Atom a) { //constructor atom = a; force = atom.parentMolecule().parentPhase().parentSimulation.space.makeVector(); rLast = atom.parentMolecule().parentPhase().parentSimulation.space.makeVector(); } public class IntegratorVerlet extends Integrator

23 Forces 1. Formalism  Force is the gradient of the potential 2 1 r 12 x 12 y 12 Force on 1, due to 2

24 Forces 2. LJ Model  Force is the gradient of the potential 2 1 r 12 x 12 y 12 e.g., Lennard-Jones model

25 Forces 3. Java Code

26 Forces 3. Relevant Methods from Java Code public class PotentialLJ implements PotentialSoft //Space.Vector used to compute and return a force private Space.Vector force = Simulation.space.makeVector(); public Space.Vector force(AtomPair pair) { double r2 = pair.r2(); //squared distance between pair of atoms if(r2 > cutoffDiameterSquared) {force.E(0.0);} //outside cutoff; no interaction else { double s2 = sigmaSquared/r2; // (sigma/r)^2 double s6 = s2*s2*s2; // (sigma/r)^6 force.E(pair.dr()); // f = (x12 ex + y12 ey) (vector) force.TE(-48*s2*s6*(s6-0.5)/sigmaSquared); // f *= -48*(sigma/r)^8 * [(sigma/r)^6 - 1/2] / sigma^2 } return force; }

27 Verlet Algorithm. 4. Loose Ends  Initialization how to get position at “previous time step” when starting out? simple approximation  Obtaining the velocities not evaluated during normal course of algorithm needed to compute some properties, e.g. útemperature údiffusion constant finite difference

28 Verlet Algorithm 5. Performance Issues  Time reversible forward time step replace  t with  t same algorithm, with same positions and forces, moves system backward in time  Numerical imprecision of adding large/small numbers O(  t 0 ) O(  t 1 ) O(  t 2 ) O(  t 1 )

29 Initial Velocities (from Lecture 3)  Random direction randomize each component independently randomize direction by choosing point on spherical surface  Magnitude consistent with desired temperature. Choices: Maxwell-Boltzmann: Uniform over (-1/2,+1/2), then scale so that Constant at Same for y, z components  Be sure to shift so center-of-mass momentum is zero

30 Leapfrog Algorithm  Eliminates addition of small numbers O(  t 2 ) to differences in large ones O(  t 0 )  Algorithm

31 Leapfrog Algorithm  Eliminates addition of small numbers O(  t 2 ) to differences in large ones O(  t 0 )  Algorithm  Mathematically equivalent to Verlet algorithm

32 Leapfrog Algorithm  Eliminates addition of small numbers O(  t 2 ) to differences in large ones O(  t 0 )  Algorithm  Mathematically equivalent to Verlet algorithm r(t) as evaluated from previous time step

33 Leapfrog Algorithm  Eliminates addition of small numbers O(  t 2 ) to differences in large ones O(  t 0 )  Algorithm  Mathematically equivalent to Verlet algorithm r(t) as evaluated from previous time step

34 Leapfrog Algorithm  Eliminates addition of small numbers O(  t 2 ) to differences in large ones O(  t 0 )  Algorithm  Mathematically equivalent to Verlet algorithm r(t) as evaluated from previous time step original algorithm

35 Leapfrog Algorithm 2. Flow Diagram rvFrvF t-  t t t+  t Given current position, and velocity at last half-step Schematic from Allen & Tildesley, Computer Simulation of Liquids

36 Leapfrog Algorithm 2. Flow Diagram rvFrvF t-  t t t+  t Compute current force Schematic from Allen & Tildesley, Computer Simulation of Liquids

37 Leapfrog Algorithm 2. Flow Diagram rvFrvF t-  t t t+  t Compute velocity at next half-step Schematic from Allen & Tildesley, Computer Simulation of Liquids

38 Leapfrog Algorithm 2. Flow Diagram rvFrvF t-  t t t+  t Compute next position Schematic from Allen & Tildesley, Computer Simulation of Liquids

39 Leapfrog Algorithm 2. Flow Diagram rvFrvF t-2  t t-  t t t+  t Advance to next time step, repeat Schematic from Allen & Tildesley, Computer Simulation of Liquids

40 Leapfrog Algorithm. 3. Loose Ends  Initialization how to get velocity at “previous time step” when starting out? simple approximation  Obtaining the velocities interpolate

41 Velocity Verlet Algorithm  Roundoff advantage of leapfrog, but better treatment of velocities  Algorithm  Implemented in stages evaluate current force compute r at new time add current-force term to velocity (gives v at half-time step) compute new force add new-force term to velocity  Also mathematically equivalent to Verlet algorithm (in giving values of r)

42 Velocity Verlet Algorithm 2. Flow Diagram rvFrvF t-  t t t+  t Given current position, velocity, and force Schematic from Allen & Tildesley, Computer Simulation of Liquids

43 Velocity Verlet Algorithm 2. Flow Diagram rvFrvF t-  t t t+  t Compute new position Schematic from Allen & Tildesley, Computer Simulation of Liquids

44 Velocity Verlet Algorithm 2. Flow Diagram rvFrvF t-  t t t+  t Compute velocity at half step Schematic from Allen & Tildesley, Computer Simulation of Liquids

45 Velocity Verlet Algorithm 2. Flow Diagram rvFrvF t-  t t t+  t Compute force at new position Schematic from Allen & Tildesley, Computer Simulation of Liquids

46 Velocity Verlet Algorithm 2. Flow Diagram rvFrvF t-  t t t+  t Compute velocity at full step Schematic from Allen & Tildesley, Computer Simulation of Liquids

47 Velocity Verlet Algorithm 2. Flow Diagram rvFrvF t-2  t t-  t t t+  t Advance to next time step, repeat Schematic from Allen & Tildesley, Computer Simulation of Liquids

48 Other Algorithms  Predictor-Corrector not time reversible easier to apply in some instances úconstraints úrigid rotations  Beeman better treatment of velocities  Velocity-corrected Verlet

49 Summary  Several formulations of mechancs Hamiltonian preferred úindependence of choice of coordinates úemphasis on phase space  Integration algorithms Calculation of forces Simple Verlet algorithsm úVerlet úLeapfrog úVelocity Verlet  Next up: Calculation of dynamical properties