Skip to content

Commit

Permalink
Merge pull request #265 from osscar-org/verlet_review
Browse files Browse the repository at this point in the history
Modifications to the text of Verlet nb. Added author list.
  • Loading branch information
Taylor-96 authored May 9, 2023
2 parents cdf09b2 + 7ad255c commit 2471fe6
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 31 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@
"\n",
"In molecular dynamics (MD) simulations, the program needs to compute the evolution of \n",
"the atoms' coordinates, velocities, and accelerations. The atoms' coordinates contain the information \n",
"about the structure of the molecular or material systems. Trajectory files containing a time series of atomic position, position, and force data are typically outputted from an MD simulation. Researchers can use visualization programs like \n",
"about the structure of the molecular or material system. Trajectory files containing a time series of atomic positions, velocities, and forces are typically outputted from an MD simulation. Researchers can use visualization programs like \n",
"[Visual Moleuclar Dyanmics](https://www.ks.uiuc.edu/Research/vmd/) to view the evolution \n",
"of the system and make scientific conclusions based on the results. Hence, it is critical \n",
"of the system and make draw conclusions based on the results. Hence, it is critical \n",
"to calculate the atoms' position, velocity, and acceleration accurately.\n",
"\n",
"In classic molecular dynamics simulations, the molecular motions are computed by \n",
"solving the Newton equation. A numerical approximation is employed, wherein one treats the \n",
"velocities of the atoms as constant during a tiny period $\\Delta t$. Here, we used a two-body \n",
"solving Newtons equation. A numerical approximation is employed, wherein one treats the \n",
"velocities of the atoms as constant during a small period $\\Delta t$. Here, we used a two-body \n",
"system (sun and earth) to demonstrate this numerical method.\n",
"\n",
"<details open>\n",
Expand All @@ -47,14 +47,14 @@
"[J. Chem. Phys. 76, 637 (1982)]</a>. There are three equations to demonstrate \n",
"the velocity Verlet algorithm.\n",
" \n",
"$$\\normalsize V(t+\\frac{1}{2} \\Delta t)=v(t)+\\frac{1}{2}\\Delta a(t) \\quad (1)$$\n",
"$$\\normalsize v(t+\\frac{1}{2} \\Delta t)=v(t)+\\frac{1}{2}\\Delta a(t) \\quad (1)$$\n",
"$$\\normalsize r(t+\\Delta t)=r(t)+\\Delta tv(t+\\frac{1}{2}\\Delta t) \\quad (2)$$ \n",
"$$\\normalsize v(t+\\Delta t)=v(t+\\frac{1}{2}\\Delta t)+\\frac{1}{2}\\Delta t a(t+\\Delta t) \\quad (3)$$\n",
" \n",
"Eq. (1) shows that the velocities of the atoms advance half of the time\n",
"step $\\Delta t$. The new positions of the atoms are updated from previous\n",
"positions with constant velocities $v(t+\\frac{1}{2}\\Delta t)$ as shown\n",
"in Eq. (2). The velocities are updating from the middle of the time step\n",
"in Eq. (2). The velocities are updated from the middle of the time step\n",
"$v(t+\\frac{1}{2}\\Delta t)$.\n",
"\n",
"In the original implementation of the Verlet algorithm, the positions of\n",
Expand All @@ -68,7 +68,7 @@
"$$\\normalsize r(t+\\Delta t)=2r(t)-r(t-\\Delta t) + \\Delta t^2a(t) + O(\\Delta t^4)$$\n",
" \n",
"The velocities are not needed to compute the trajectories of the atoms.\n",
"However, the velocities are useful to estimate the kinetic energy. They\n",
"However, the atomic velocities are useful to estimate the kinetic energy of the system. They\n",
"can be approximated as:\n",
" \n",
"$$v(t) = \\frac{r(t+\\Delta t)-r(t-\\Delta t)}{2\\Delta t}$$\n",
Expand All @@ -95,7 +95,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.8"
"version": "3.10.6"
}
},
"nbformat": 4,
Expand Down
43 changes: 20 additions & 23 deletions notebook/molecular-dynamics/verlet_integration.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"metadata": {},
"source": [
"# **Verlet Integration**\n",
"**Authors**: Dou Du\n",
"\n",
"<i class=\"fa fa-home fa-2x\"></i><a href=\"../index.ipynb\" style=\"font-size: 20px\"> Go back to index</a>\n",
"\n",
Expand All @@ -18,11 +19,9 @@
"metadata": {},
"source": [
"## Goals\n",
"* Familiarize yourself with the main features of the Verlet integration scheme employed in the molecular dynamics simulations.\n",
"* Know the relationship between position, velocity, and acceleration.\n",
"* Acquaint yourself with the numerical technique of finite-differences.\n",
"* Appreciate the consequences of the order of the error of the Verlet algorithm.\n",
"* Master the mathematics of Verlet integration."
"* Background theory: familiarize yourself with the main features of the Verlet integration scheme employed in molecular dynamics simulations.\n",
"* Background theory: acquaint yourself with the finite-differences approach to solving differential equations governing motion of a system.\n",
"* Appreciate the dependence of the accuracy of the Verlet integration scheme on the size of the timestep used in the method."
]
},
{
Expand All @@ -44,39 +43,37 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"1. Choose a small time step, see how the earth orbits the sun, and check how \n",
"the total energy and angular momentum evolutes with time.\n",
"1. Choose a small time step (say $\\Delta t=1$), observe how the earth orbits the sun, and check how \n",
"the total energy and angular momentum evolves in time.\n",
"\n",
" <details>\n",
" <summary style=\"color: red\">Solution</summary>\n",
" 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 \n",
" and angular momentum remain constant. With a sufficiently small time step the Earth shall remain in this orbit for a very long time.\n",
" 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 \n",
" and angular momentum remain constant. With a sufficiently small timestep, the Earth shall remain in this orbit for a very long time.\n",
" </details>\n",
" \n",
"2. Does the earth still remain in the same orbit when a large time step is used? And why?\n",
"2. Does the earth still remain in the same orbit when a large time step is used? Try to explain your observations.\n",
"\n",
" <details>\n",
" <summary style=\"color: red\">Solution</summary>\n",
" When choosing a large time step, the earth is not keeping on the same \n",
" ellipse orbital anymore. The ellipse orbitals are shifting for each \n",
" circle. In the numerical method, we treat the velocities as constant \n",
" in a short time. But this is not true in the real physical world. When \n",
" using a large time step, large errors will be introduced into the \n",
" When choosing a large time step, the earth no longer maintains the same \n",
" 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 \n",
" using an overly large time step, significant accumulative errors will be introduced into the \n",
" calculations.\n",
" </details>\n",
" \n",
"3. In molecular dynamics simulations, what are the problems associated with choosing (1) a very small timestep, (2) a very large timestep.\n",
"\n",
" <details>\n",
" <summary style=\"color: red\">Solution</summary>\n",
" In MD simulations, choosing a small time step can improve the \n",
" accuracy of the results. However, a small time step means taking a \n",
" longer computing time to obtain the results. Practically, we cannot \n",
" afford a very small time step for the MD simulations.\n",
" As we have seen in the previous exercises, choosing a small timestep in MD simulations can improve the \n",
" accuracy of the results. However, a small timestep means taking a \n",
" larger amount of computing time to obtain the same total simulation time. Practically, we cannot \n",
" afford a very small timestep for the MD simulations.\n",
" On the other hand, a large time step will introduce large errors. \n",
" For example, particles can be too close to each other (in the \n",
" real world, the nuclear-nuclear repulsion energy is considerable at short distances). Hence, it is crucial to choose a reasonable compromise for our \n",
" time step in MD simulations.\n",
" For example, for too large a timestep, particles can assume configurations in which they are too close to each other (in the \n",
" 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 \n",
" timestep in MD simulations so that they are sufficiently accurate but simultaneously do not require a prohibitively large amount of computer time.\n",
" </details>\n",
" \n",
"<hr style=\"height:1px;border:none;color:#cccccc;background-color:#cccccc;\" />"
Expand Down Expand Up @@ -400,7 +397,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.9.7"
"version": "3.10.6"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 2471fe6

Please sign in to comment.