Search icon CANCEL
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

Understanding the dynamics of point particles

The trajectory of a point particle over time t is calculated from its mass m and net force using Newton's equation, as illustrated here:

is determined from the sum of all forces acting on the particle. In a system of interacting particles, the force acting between one pair of particles can be determined from the gradient of the potential energy function . Here, is the displacement vector that points to the particle for which we are calculating (using the following equation) and originates from the other particle in the pair (shown in Figure 1.1):

This gives us the three components of . The (x) force component is given as follows:

The (y) force component is calculated by the following formula:

The (z) force component is given by the following formula:

Here, is the distance between the pair of particles. By Newton's third law, it follows that the force components acting on the other particle in the pair have the same magnitudes, with the opposite sign.

The following diagram illustrates this concept, using two particles interacting via a 12-6 Lennard-Jones potential of the form , where represents the well depth and represents the position at which the potential is zero:

Figure 1.1 – Two particles in 1D interact via a Lennard-Jones potential

Figure 1.1 – Two particles in 1D interact via a Lennard-Jones potential

In this diagram, if we want to calculate the force from particle 2 (located at ) acting on particle 1 (located at ), then we use . Subsequently, the reaction force acting on particle 2 is given by .

Since potential energy functions are commonly expressed as functions of r, the expressions we saw earlier make it more convenient to calculate the force components. The sum of forces acting on a single particle by its interaction with all particles in the system gives the net force, as illustrated here:

Altogether, we obtain three equations to solve for , and . The x(t) equation is given as follows:

The y(t) equation is given by the following formula:

The z(t) equation is given by the following formula:

These values are used to generate the complete trajectory of the particle over a desired time interval. This process is repeated for all particles in the system to yield the complete system time evolution in the same time interval.

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 $19.99/month. Cancel anytime