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

Extending and Modifying LAMMPS Writing Your Own Source Code

Dr. Shafat Mubin, Jichen Li, Dr. Steven Plimpton

Share book
  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

Dr. Shafat Mubin, Jichen Li, Dr. Steven Plimpton

Book details
Book preview
Table of contents
Citations

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

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
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.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
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.
Do you support text-to-speech?
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.
Is Extending and Modifying LAMMPS Writing Your Own Source Code an online PDF/ePUB?
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 Informatique & Programmation. We have over one million books available in our catalogue for you to explore.

Information

Year
2021
ISBN
9781800567238
Edition
1

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