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! 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
Free Learning
Arrow right icon
Extending and Modifying LAMMPS Writing Your Own Source Code
Extending and Modifying LAMMPS Writing Your Own Source Code

Extending and Modifying LAMMPS Writing Your Own Source Code: A pragmatic guide to extending LAMMPS as per custom simulation requirements

Arrow left icon
Profile Icon Dr. Shafat Mubin Profile Icon Li
Arrow right icon
$19.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6 (7 Ratings)
Paperback Feb 2021 394 pages 1st Edition
eBook
$9.99 $38.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
Arrow left icon
Profile Icon Dr. Shafat Mubin Profile Icon Li
Arrow right icon
$19.99 per month
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6 (7 Ratings)
Paperback Feb 2021 394 pages 1st Edition
eBook
$9.99 $38.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m
eBook
$9.99 $38.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing
Table of content icon View table of contents Preview book icon Preview Book

Extending and Modifying LAMMPS Writing Your Own Source Code

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.

Left arrow icon Right arrow icon
Download code icon Download Code

Key benefits

  • 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 features

Description

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

Who is this book for?

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

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 LAMMPS

Product Details

Country selected
Publication date, Length, Edition, Language, ISBN-13
Publication date : Feb 19, 2021
Length: 394 pages
Edition : 1st
Language : English
ISBN-13 : 9781800562264
Vendor :
Google
Category :
Languages :
Tools :

What do you get with a Packt Subscription?

Free for first 7 days. $19.99 p/m after that. Cancel any time!
Product feature icon Unlimited ad-free access to the largest independent learning library in tech. Access this title and thousands more!
Product feature icon 50+ new titles added per month, including many first-to-market concepts and exclusive early access to books as they are being written.
Product feature icon Innovative learning tools, including AI book assistants, code context explainers, and text-to-speech.
Product feature icon Thousands of reference materials covering every tech concept you need to stay up to date.
Subscribe now
View plans & pricing

Product Details

Publication date : Feb 19, 2021
Length: 394 pages
Edition : 1st
Language : English
ISBN-13 : 9781800562264
Vendor :
Google
Category :
Languages :
Tools :

Packt Subscriptions

See our plans and pricing
Modal Close icon
$19.99 billed monthly
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Simple pricing, no contract
$199.99 billed annually
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts
$279.99 billed in 18 months
Feature tick icon Unlimited access to Packt's library of 7,000+ practical books and videos
Feature tick icon Constantly refreshed with 50+ new titles a month
Feature tick icon Exclusive Early access to books as they're written
Feature tick icon Solve problems while you work with advanced search and reference features
Feature tick icon Offline reading on the mobile app
Feature tick icon Choose a DRM-free eBook or Video every month to keep
Feature tick icon PLUS own as many other DRM-free eBooks or Videos as you like for just $5 each
Feature tick icon Exclusive print discounts

Frequently bought together


Stars icon
Total $ 193.97
Dancing with Qubits
$94.99
Extending and Modifying LAMMPS Writing Your Own Source Code
$54.99
Visual Studio 2019 Tricks and Techniques
$43.99
Total $ 193.97 Stars icon
Banner background image

Table of Contents

16 Chapters
Section 1: Getting Started with LAMMPS Chevron down icon Chevron up icon
Chapter 1: MD Theory and Simulation Practices Chevron down icon Chevron up icon
Chapter 2: LAMMPS Syntax and Source Code Hierarchy Chevron down icon Chevron up icon
Section 2: Understanding the Source Code Structure Chevron down icon Chevron up icon
Chapter 3: Source Code Structure and Stages of Execution Chevron down icon Chevron up icon
Chapter 4: Accessing Information by Variables, Arrays, and Methods Chevron down icon Chevron up icon
Chapter 5: Understanding Pair Styles Chevron down icon Chevron up icon
Chapter 6: Understanding Computes Chevron down icon Chevron up icon
Chapter 7: Understanding Fixes Chevron down icon Chevron up icon
Chapter 8: Exploring Supporting Classes Chevron down icon Chevron up icon
Section 3: Modifying the Source Code Chevron down icon Chevron up icon
Chapter 9: Modifying Pair Potentials Chevron down icon Chevron up icon
Chapter 10: Modifying Force Applications Chevron down icon Chevron up icon
Chapter 11: Modifying Thermostats Chevron down icon Chevron up icon
Assessments Chevron down icon Chevron up icon
Other Books You May Enjoy Chevron down icon Chevron up icon

Customer reviews

Top Reviews
Rating distribution
Full star icon Full star icon Full star icon Full star icon Half star icon 4.6
(7 Ratings)
5 star 57.1%
4 star 42.9%
3 star 0%
2 star 0%
1 star 0%
Filter icon Filter
Top Reviews

Filter reviews by




Cindy Mar 09, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
In general, I think this book could serve as a good guide for starters to get familiar with molecular dynamics conceptions and LAMMPS, a powerful MD simulation software, along with its source command.What I like about this book:This book provides C++ source codes with detailed explanations, and explains how the source code works when LAMMPS commands are deployed. The authors also explained the hierarchy of LAMMPS source code. With all the screenshots and examples, this book is quite straightforward to understand, and is very helpful to students to understand how to program the formulas into code, especially for those who does not have much coding experience. You could get some hand-on experience by following the illustrations, even if you have never used C++ before.What I feel uncertain about this book:Given that readers of this book may be students who major in STEM programs and are likely to be pursuing advanced degrees in this field, the physics seems to be quite simple for readers. It would be better if there are more examples with complicated situations (multi-body potential, for instance).
Amazon Verified review Amazon
Pablo Piaggi Feb 22, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
This book is an excellent guide for beginner developers that wish to learn how to modify LAMMPS and is also a good reference for more experienced developers. The explanations are thorough and there are many examples.
Amazon Verified review Amazon
Deepika Mar 06, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
Highly recommend for MD LAMMPS users to understand each and every line of program, physics behind and enhance the lammps calculation capabilities according to need.
Amazon Verified review Amazon
Betim Mar 31, 2021
Full star icon Full star icon Full star icon Full star icon Full star icon 5
It is an extremely helpful book for everybody who wants to implement new things in the LAMMPS code
Amazon Verified review Amazon
Amazon Customer Feb 21, 2021
Full star icon Full star icon Full star icon Full star icon Empty star icon 4
This book is a bit of an odd-ball, but not in a negative sense. While there are good books that focus extensively on molecular dynamics theory that in addition sometimes provide small snippets of example code, this book is the first that I know of that dedicates itself, in detail, to how the internals of such an engine work and on how to modify it to your own needs. Because of its design, LAMMPS is especially well-suited for modifications and extensions by end users, so it is an obvious choice for this book.One down-side of this is that LAMMPS is always changing, sometimes quite extensively, so some parts of the book are likely to become out-dated at some point. For this reason, the authors choose to focus on the “stable” version of LAMMPS from March 3, 2020. Still, a lot of the skills obtained by going through this book should transfer well to later versions even if some of the details have changed, and for changes that occurred during the writing of this book the authors provide notes detailing the changes.It starts with a small chapter on the basics of molecular dynamics (MD) simulations where very briefly some concepts that appear in LAMMPS are explained, but for extensive treatment of the details the authors defer to the classical books by Computer Simulation of Liquids by Allen and Tildesley and Understanding Molecular Simulation by Frenkel and Smit. In short, they explain forces arising from a potential, updating positions and velocities with the velocity Verlet scheme and briefly explain rotational motion.They then discuss periodic boundary conditions and neighbor lists, which is pretty standard, but also explain the distributed memory parallelization through spatial decomposition.The second chapter of the first section is where the focus on LAMMPS really takes of. The authors introduce LAMMPS' scripting language, the structure of the source code and the hierarchy of the various classes. Most importantly, it highlights a selection of the special member functions that a lot of the LAMMPS classes (“styles”) possess that are called at specific steps of the time integration loop. These functions are important because virtually all LAMMPS functionality makes use of these functions to ensure that everything happens at the correct time.For some reason the chapter does not go into the compilation process itself, that is deferred to an appendix where it is explained in great detail. Perhaps this is done because the exact way to compile is subject to more change than the source code hierarchy itself.Chapter 4 explains how one can access various internal data structures that hold positions, velocities, forces, atom IDs, atom types, etc. It also explains how global and local atom IDs work, which is good because this can be a bit unintuitive for the uninitiated. Neighbor lists are discussed next, which are a requirement for calculating forces efficiently but are also very useful for any type of computation that requires information about which atoms are in proximity of the others, a prime being the computation of the radial distribution function.The various unit systems in LAMMPS are also explained, which is important because LAMMPS supports various unit systems (SI, Lennard-Jones, “metal”) whose reference units make sense for the system under consideration. For example, for simulations involving metals, energy expressed in electronvolts (eV) makes more sense than kcal/mol which is customary for biophysical simulations.This chapter lastly focuses on how the LAMMPS engine reads and parses input scripts, which is essential to know because all extensions to LAMMPS have to be invoked through the scripting language, and hence some parsing of these commands is required.At Chapters 5 to 8 we really dive deep into the inner workings of LAMMPS, and the authors explore in detail how pair styles (LAMMPS terminology for pairwise forces), compute styles (styles that compute physical quantities not necessarily related to the dynamics of the atoms themselves) and fix styles work.Fixes are classes that modify atom positions, velocities, forces, etc. to somehow modify the dynamics of the system. For example, the simple velocity Verlet time integrator is implemented as a fix, as is the Langevin thermostat, the SHAKE constraint algorithm, walls, etc. While at a first glance it seems somewhat strange to decouple time integration from the conceptual velocity Verlet loop of (update position –> calculate new forces –> update velocity), setting it up this way allows one to use a lot of different fixes together to create new functionality.The authors do a good job of thoroughly studying the pair styles, including memory allocation, initial setup, parsing of the lines from the input script and the actual force and energy computation. In particular, it is good that the authors refer back to the initial chapter because some of the internals in LAMMPS might be counter-intuitive at first (like the fact that the internal “fpair” variable has units of force per distance).While computes are conceptually similar or perhaps simpler than pair styles, one complication they have over pair styles is dealing with the distributed memory parallelization. A pair style only has to compute local forces and LAMMPS takes care of the proper communication between processors, but computes require some additional synchronization between processors by the programmer. Do not be intimidated though, often a couple of MPI_Allreduce suffice, and the authors walk you through it for compute styles for the total kinetic energy, collective interaction energies and forces between specified groups of atoms, the radial distribution function, and the heat flux. For more involved MPI-related information there is a dedicated appendix.Chapter 7 focuses on a handful of fix styles in increasing degrees of complexity, making sure to explain along the way the flag that indicates which member functions of the fixes need calling, starting from a fix that simply adds an external force to atoms to culminating in a time integration method for rigid bodies.In chapters 5 to 7, some of the styles explored made use of supporting classes, which are explored in more detail here.Section 3 gets to the heart of this book: Explaining how to modify LAMMPS to add new functionality. The examples they use are fairly simple so that one does not get lost into the details of what is being implemented and instead can focus on how it is implemented. The described methods naturally generalize to more complex functionality. The authors also go into detail about sanity checks to verify the implemented modifications. They describe in detail various custom fixes and pair styles to add custom forces, potentials and thermostats, such that they touch upon various kinds of different functionality. The selection the authors made should provide good starting points for most custom pair styles and/or fixes, so that one does not have to start from scratch.I think the book definitely achieves its goal of providing a very thorough description on how LAMMPS works and how to modify it to suit your own needs. While for small modifications it might be overkill, it will definitely help the reader form a much better understanding of how LAMMPS works and how to do things properly than by just copying a similar style and modifying it.I do have some criticisms not directly related to the content but that do detriment the quality of the book somewhat:The type-setting of equations is a little shoddy, with some stand-alone formulas having different font sizes.The code snippets and even some tables are screenshots which means that in the e-book, the text is not highlightable or selectable.Still, I would recommend the book to anyone that is serious about diving into LAMMPS to implement their own features.Full disclosure: I got a free ebook copy of this book from the publisher for review.
Amazon Verified review Amazon
Get free access to Packt library with over 7500+ books and video courses for 7 days!
Start Free Trial

FAQs

What is included in a Packt subscription? Chevron down icon Chevron up icon

A subscription provides you with full access to view all Packt and licnesed content online, this includes exclusive access to Early Access titles. Depending on the tier chosen you can also earn credits and discounts to use for owning content

How can I cancel my subscription? Chevron down icon Chevron up icon

To cancel your subscription with us simply go to the account page - found in the top right of the page or at https://subscription.packtpub.com/my-account/subscription - From here you will see the ‘cancel subscription’ button in the grey box with your subscription information in.

What are credits? Chevron down icon Chevron up icon

Credits can be earned from reading 40 section of any title within the payment cycle - a month starting from the day of subscription payment. You also earn a Credit every month if you subscribe to our annual or 18 month plans. Credits can be used to buy books DRM free, the same way that you would pay for a book. Your credits can be found in the subscription homepage - subscription.packtpub.com - clicking on ‘the my’ library dropdown and selecting ‘credits’.

What happens if an Early Access Course is cancelled? Chevron down icon Chevron up icon

Projects are rarely cancelled, but sometimes it's unavoidable. If an Early Access course is cancelled or excessively delayed, you can exchange your purchase for another course. For further details, please contact us here.

Where can I send feedback about an Early Access title? Chevron down icon Chevron up icon

If you have any feedback about the product you're reading, or Early Access in general, then please fill out a contact form here and we'll make sure the feedback gets to the right team. 

Can I download the code files for Early Access titles? Chevron down icon Chevron up icon

We try to ensure that all books in Early Access have code available to use, download, and fork on GitHub. This helps us be more agile in the development of the book, and helps keep the often changing code base of new versions and new technologies as up to date as possible. Unfortunately, however, there will be rare cases when it is not possible for us to have downloadable code samples available until publication.

When we publish the book, the code files will also be available to download from the Packt website.

How accurate is the publication date? Chevron down icon Chevron up icon

The publication date is as accurate as we can be at any point in the project. Unfortunately, delays can happen. Often those delays are out of our control, such as changes to the technology code base or delays in the tech release. We do our best to give you an accurate estimate of the publication date at any given time, and as more chapters are delivered, the more accurate the delivery date will become.

How will I know when new chapters are ready? Chevron down icon Chevron up icon

We'll let you know every time there has been an update to a course that you've bought in Early Access. You'll get an email to let you know there has been a new chapter, or a change to a previous chapter. The new chapters are automatically added to your account, so you can also check back there any time you're ready and download or read them online.

I am a Packt subscriber, do I get Early Access? Chevron down icon Chevron up icon

Yes, all Early Access content is fully available through your subscription. You will need to have a paid for or active trial subscription in order to access all titles.

How is Early Access delivered? Chevron down icon Chevron up icon

Early Access is currently only available as a PDF or through our online reader. As we make changes or add new chapters, the files in your Packt account will be updated so you can download them again or view them online immediately.

How do I buy Early Access content? Chevron down icon Chevron up icon

Early Access is a way of us getting our content to you quicker, but the method of buying the Early Access course is still the same. Just find the course you want to buy, go through the check-out steps, and you’ll get a confirmation email from us with information and a link to the relevant Early Access courses.

What is Early Access? Chevron down icon Chevron up icon

Keeping up to date with the latest technology is difficult; new versions, new frameworks, new techniques. This feature gives you a head-start to our content, as it's being created. With Early Access you'll receive each chapter as it's written, and get regular updates throughout the product's development, as well as the final course as soon as it's ready.We created Early Access as a means of giving you the information you need, as soon as it's available. As we go through the process of developing a course, 99% of it can be ready but we can't publish until that last 1% falls in to place. Early Access helps to unlock the potential of our content early, to help you start your learning when you need it most. You not only get access to every chapter as it's delivered, edited, and updated, but you'll also get the finalized, DRM-free product to download in any format you want when it's published. As a member of Packt, you'll also be eligible for our exclusive offers, including a free course every day, and discounts on new and popular titles.