Verlet Integration¶
Authors: Dou Du
Source code: https://github.com/osscar-org/quantum-mechanics/blob/master/notebook/molecular-dynamics/verlet_integration.ipynb
Goals¶
- Background theory: familiarize yourself with the main features of the Verlet integration scheme employed in molecular dynamics simulations.
- Background theory: acquaint yourself with the finite-differences approach to solving differential equations governing motion of a system.
- Appreciate the dependence of the accuracy of the Verlet integration scheme on the size of the timestep used in the method.
Background theory¶
Tasks and exercises¶
Choose a small time step (say $\Delta t=1$), observe how the earth orbits the sun, and check how the total energy and angular momentum evolves in time.
Solution
The earth is moving in an elliptical orbit. The earth moves slowly at the end of the ellipse farthest from the sun, whilst it moves quickest at the end of the ellipse nearest the sun. However, the total energy and angular momentum remain constant. With a sufficiently small timestep, the Earth shall remain in this orbit for a very long time.Does the earth still remain in the same orbit when a large time step is used? Try to explain your observations.
Solution
When choosing a large time step, the earth no longer maintains the same elliptical orbital. You can observe that the ellipses traced out by the Earth shift during each circuit around the sun (subsequent orbits are no longer superimposed on the first). The reason for this discrepancy can intuitively be traced back to a deficiency of the Verlet method that becomes more pronounced the larger the timestep becomes. In the Verlet method, we approximate the velocities as being constant over a short time interval $\Delta t$. However, this is of course not true in reality. When using an overly large time step, significant accumulative errors will be introduced into the calculations.In molecular dynamics simulations, what are the problems associated with choosing (1) a very small timestep, (2) a very large timestep.
Solution
As we have seen in the previous exercises, choosing a small timestep in MD simulations can improve the accuracy of the results. However, a small timestep means taking a larger amount of computing time to obtain the same total simulation time. Practically, we cannot afford a very small timestep for the MD simulations. On the other hand, a large time step will introduce large errors. For example, for too large a timestep, particles can assume configurations in which they are too close to each other (in the real world, the nuclear-nuclear repulsion energy is considerable at short distances and prohibits this). Hence, it is crucial to choose a reasonable compromise for our timestep in MD simulations so that they are sufficiently accurate but simultaneously do not require a prohibitively large amount of computer time.
Interactive visualization¶
(be patient, it might take a few seconds to load)
Legend¶
(How to use the interactive visualization)
Interactive figures¶
The left figure shows the sun and earth system in two dimensions. The sun is in the center of the figure as shown in the yellow color. The earth is represented as a red dot. The trace of the earth's orbit is shown in the plot as the black line. The directions of the velocity and acceleration of the earth are shown as two vectors. The lengths of the vectors indicate the values of the velocity and acceleration.
The top right figure shows how the energies change with time. The total energy is a summation of kinetic energy and potential energy. The plot is used to monitor the energy conservation of the system.
The bottom right figure shows angular momentum as a function of time.
Controls¶
You can click the "Play & Pause" button to run or stop the simulation. The slider is used to choose the time step $\Delta t$. The "Clear trace" button can be used to remove the trace of the earth's orbit.