Extending and Modifying LAMMPS Writing Your Own Source Code
eBook - ePub

Extending and Modifying LAMMPS Writing Your Own Source Code

  1. 394 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Extending and Modifying LAMMPS Writing Your Own Source Code

About this book

Understand the LAMMPS source code and modify it to meet your research needs, and run simulations for bespoke applications involving forces, thermostats, pair potentials and more with easeKey Features• Understand the structure of the LAMMPS source code• Implement custom features in the LAMMPS source code to meet your research needs• Run example simulations involving forces, thermostats, and pair potentials based on implemented featuresBook DescriptionLAMMPS is one of the most widely used tools for running simulations for research in molecular dynamics. While the tool itself is fairly easy to use, more often than not you'll need to customize it to meet your specific simulation requirements. Extending and Modifying LAMMPS bridges this learning gap and helps you achieve this by writing custom code to add new features to LAMMPS source code. Written by ardent supporters of LAMMPS, this practical guide will enable you to extend the capabilities of LAMMPS with the help of step-by-step explanations of essential concepts, practical examples, and self-assessment questions. This LAMMPS book provides a hands-on approach to implementing associated methodologies that will get you up and running and productive in no time. You'll begin with a short introduction to the internal mechanisms of LAMMPS, and gradually transition to an overview of the source code along with a tutorial on modifying it. As you advance, you'll understand the structure, syntax, and organization of LAMMPS source code, and be able to write your own source code extensions to LAMMPS that implement features beyond the ones available in standard downloadable versions. By the end of this book, you'll have learned how to add your own extensions and modifications to the LAMMPS source code that can implement features that suit your simulation requirements.What you will learn• Identify how LAMMPS input script commands are parsed within the source code• Understand the architecture of the source code• Relate source code elements to simulated quantities• Learn how stored quantities are accessed within the source code• Explore the mechanisms controlling pair styles, computes, and fixes• Modify the source code to implement custom features in LAMMPSWho this book is forThis book is for students, faculty members, and researchers who are currently using LAMMPS or considering switching to LAMMPS, have a basic knowledge of how to use LAMMPS, and are looking to extend LAMMPS source code for research purposes. This book is not a tutorial on using LAMMPS or writing LAMMPS scripts, and it is assumed that the reader is comfortable with the basic LAMMPS syntax. The book is geared toward users with little to no experience in source code editing. Familiarity with C++ programming is helpful but not necessary.

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription.
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Yes! You can use the Perlego app on both iOS or Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Yes, you can access Extending and Modifying LAMMPS Writing Your Own Source Code by Dr. Shafat Mubin,Jichen Li,Dr. Steven Plimpton in PDF and/or ePUB format, as well as other popular books in Computer Science & Bioinformatics. We have over one million books available in our catalogue for you to explore.

Information

Section 1: Getting Started with LAMMPS

A LAMMPS input script performs molecular dynamics simulations according to the input commands provided. But what happens behind the scenes as each command is parsed and executed? How are these commands processed and how are relevant calculations invoked within the source code?
This section introduces you to molecular dynamics theory and standard simulation practices that are implemented in LAMMPS, along with the corresponding syntax. The theory and practices will be revisited in later sections when the LAMMPS source code is analyzed.
This section comprises the following chapters:
  • Chapter 1, MD Theory and Simulation Practices
  • Chapter 2, LAMMPS Syntax and Source Code Repository

Chapter 1: MD Theory and Simulation Practices

This chapter introduces the theory behind molecular dynamics (MD) and some common simulation practices. Starting from Newton's laws, we outline the physics behind the dynamics of point particles and rigid bodies, discuss iterative updating and the relevance of temperature, and end by listing computational practices.
In this chapter, we will cover the follow topics:
  • Introducing MD theory
  • Understanding the dynamics of point particles
  • Performing iterative updates using the Velocity Verlet algorithm
  • Understanding rotational motion
  • Examining temperature and velocity distribution of particles
  • Implementing MD simulation practices including cutoff, periodic boundaries, and neighbor lists
By the end of this chapter, you will have grasped an understanding of the theoretical fundamentals implemented in MD software.

Technical requirements

You can find the full source code used in this book here: https://github.com/PacktPublishing/Extending-and-Modifying-LAMMPS-Writing-Your-Own-Source-Code

Introducing MD theory

MD is based on simulating individual particle trajectories over a desired time period to analyze the time evolution of an entire system of particles in a solid, liquid, or gaseous state. Each particle (usually an atom) is allowed to traverse in space as determined by Newton's laws of classical dynamics, where the atomic positions, velocities, and accelerations at one point in time are used to calculate the corresponding kinematics quantities at a different point in time. This process is repeated over a sufficiently long-time interval for every atom in a system, and the final configuration of the atoms indicates the time evolution of the system over the said time interval.
Typical MD simulations are limited to the study of atomistic systems consisting of atoms in the range of
to
, occupying a simulation box with a length in the order of nanometers, over a regular timescale of nanoseconds. MD simulations of such microscopic systems are relevant when the systems are able to represent the time evolution of corresponding macroscopic systems.
The theory behind MD is described briefly in the following sections. For a more detailed understanding, you are advised to refer to the dedicated literature on MD theory (Computer Simulation of Liquids by Michael P. Allen and Dominic J. Tildesley, and Understanding Molecular Simulation by Daan Frenkel and Berend Smit).

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...

Table of contents

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