Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Extending and Modifying LAMMPS Writing Your Own Source Code

You're reading from   Extending and Modifying LAMMPS Writing Your Own Source Code A pragmatic guide to extending LAMMPS as per custom simulation requirements

Arrow left icon
Product type Paperback
Published in Feb 2021
Publisher Packt
ISBN-13 9781800562264
Length 394 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Authors (2):
Arrow left icon
Jichen Li Jichen Li
Author Profile Icon Jichen Li
Jichen Li
Dr. Shafat Mubin Dr. Shafat Mubin
Author Profile Icon Dr. Shafat Mubin
Dr. Shafat Mubin
Arrow right icon
View More author details
Toc

Table of Contents (21) Chapters Close

Preface 1. Section 1: Getting Started with LAMMPS
2. Chapter 1: MD Theory and Simulation Practices FREE CHAPTER 3. Chapter 2: LAMMPS Syntax and Source Code Hierarchy 4. Section 2: Understanding the Source Code Structure
5. Chapter 3: Source Code Structure and Stages of Execution 6. Chapter 4: Accessing Information by Variables, Arrays, and Methods 7. Chapter 5: Understanding Pair Styles 8. Chapter 6: Understanding Computes 9. Chapter 7: Understanding Fixes 10. Chapter 8: Exploring Supporting Classes 11. Section 3: Modifying the Source Code
12. Chapter 9: Modifying Pair Potentials 13. Chapter 10: Modifying Force Applications 14. Chapter 11: Modifying Thermostats 15. Assessments 16. Other Books You May Enjoy Appendix A: Building LAMMPS with CMake 1. Appendix B: Debugging Programs 2. Appendix C: Getting Familiar with MPI 3. Appendix D: Compatibility with Version 29Oct20

Performing iterative updates using the Velocity Verlet algorithm

As particles move in a system over time, the separation between each pair of particles changes accordingly, resulting in a change of the derivatives described in the previous section—that is, the force becomes time-dependent. Therefore, the trajectory is updated over a small increment of time called the timestep , and by iteratively updating the trajectory over a large number of timesteps, a complete trajectory can be obtained.

The purpose of keeping the timestep small is to ensure that the particles do not undergo drastic changes in position and therefore conserve energy in the system. For atomic masses, especially in the presence of forces from molecular bonds, angles, and dihedrals, a timestep of approximately 1 femtosecond is typically employed.

An advantage of using a small timestep is that the net force acting on a particle can be approximated to remain constant in the duration of the timestep. Therefore, the equations of motion that iteratively update the trajectory at timestep increments become the following:

Here, represents the velocity vector of the particle, and its components are iteratively updated by the following:

Here, the terms within the [ ] represent the average acceleration in each dimension, calculated using the accelerations at time t and the following iteration, . This is known as the Velocity Verlet algorithm, which considerably reduces errors over a long simulation period as compared to algorithms that use the acceleration at a single point in time (for example, the Euler algorithm). Furthermore, the Velocity Verlet algorithm is able to conserve energy and momentum within rounding errors with a sufficiently small timestep, unlike the Euler algorithm, which can lead to an indefinite increase in energy over time.

In effect, the position and velocity of each particle are tabulated at each iteration, as illustrated in the following table:

Table 1.1 – Table showing sequence of iterative update of position and velocity vectors of each particle

Table 1.1 – Table showing sequence of iterative update of position and velocity vectors of each particle

This table shows the sequence of iterative update of point particles that undergo a linear motion without any rotational component. In the case of a non-point object such as a rigid body, both linear and rotational motion must be incorporated for a proper treatment of its dynamics. Similar to linear motion, rotational motion of rigid bodies can be iteratively updated using a similar algorithm, as discussed next.

You have been reading a chapter from
Extending and Modifying LAMMPS Writing Your Own Source Code
Published in: Feb 2021
Publisher: Packt
ISBN-13: 9781800562264
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at £16.99/month. Cancel anytime