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

eBook
$9.99 $38.99
Paperback
$54.99
Subscription
Free Trial
Renews at $19.99p/m

What do you get with Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
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
Estimated delivery fee Deliver to Argentina

Standard delivery 10 - 13 business days

$12.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

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 Print?

Product feature icon Instant access to your digital eBook copy whilst your Print order is Shipped
Product feature icon Paperback book shipped to your preferred address
Product feature icon Download this book in EPUB and PDF formats
Product feature icon Access this title in our online reader with advanced features
Product feature icon DRM FREE - Read whenever, wherever and however you want
Product feature icon AI Assistant (beta) to help accelerate your learning
OR
Modal Close icon
Payment Processing...
tick Completed

Shipping Address

Billing Address

Shipping Methods
Estimated delivery fee Deliver to Argentina

Standard delivery 10 - 13 business days

$12.95

Premium delivery 3 - 6 business days

$40.95
(Includes tracking information)

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 the delivery time and cost of print book? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela
What is custom duty/charge? Chevron down icon Chevron up icon

Customs duty are charges levied on goods when they cross international borders. It is a tax that is imposed on imported goods. These duties are charged by special authorities and bodies created by local governments and are meant to protect local industries, economies, and businesses.

Do I have to pay customs charges for the print book order? Chevron down icon Chevron up icon

The orders shipped to the countries that are listed under EU27 will not bear custom charges. They are paid by Packt as part of the order.

List of EU27 countries: www.gov.uk/eu-eea:

A custom duty or localized taxes may be applicable on the shipment and would be charged by the recipient country outside of the EU27 which should be paid by the customer and these duties are not included in the shipping charges been charged on the order.

How do I know my custom duty charges? Chevron down icon Chevron up icon

The amount of duty payable varies greatly depending on the imported goods, the country of origin and several other factors like the total invoice amount or dimensions like weight, and other such criteria applicable in your country.

For example:

  • If you live in Mexico, and the declared value of your ordered items is over $ 50, for you to receive a package, you will have to pay additional import tax of 19% which will be $ 9.50 to the courier service.
  • Whereas if you live in Turkey, and the declared value of your ordered items is over € 22, for you to receive a package, you will have to pay additional import tax of 18% which will be € 3.96 to the courier service.
How can I cancel my order? Chevron down icon Chevron up icon

Cancellation Policy for Published Printed Books:

You can cancel any order within 1 hour of placing the order. Simply contact [email protected] with your order details or payment transaction id. If your order has already started the shipment process, we will do our best to stop it. However, if it is already on the way to you then when you receive it, you can contact us at [email protected] using the returns and refund process.

Please understand that Packt Publishing cannot provide refunds or cancel any order except for the cases described in our Return Policy (i.e. Packt Publishing agrees to replace your printed book because it arrives damaged or material defect in book), Packt Publishing will not accept returns.

What is your returns and refunds policy? Chevron down icon Chevron up icon

Return Policy:

We want you to be happy with your purchase from Packtpub.com. We will not hassle you with returning print books to us. If the print book you receive from us is incorrect, damaged, doesn't work or is unacceptably late, please contact Customer Relations Team on [email protected] with the order number and issue details as explained below:

  1. If you ordered (eBook, Video or Print Book) incorrectly or accidentally, please contact Customer Relations Team on [email protected] within one hour of placing the order and we will replace/refund you the item cost.
  2. Sadly, if your eBook or Video file is faulty or a fault occurs during the eBook or Video being made available to you, i.e. during download then you should contact Customer Relations Team within 14 days of purchase on [email protected] who will be able to resolve this issue for you.
  3. You will have a choice of replacement or refund of the problem items.(damaged, defective or incorrect)
  4. Once Customer Care Team confirms that you will be refunded, you should receive the refund within 10 to 12 working days.
  5. If you are only requesting a refund of one book from a multiple order, then we will refund you the appropriate single item.
  6. Where the items were shipped under a free shipping offer, there will be no shipping costs to refund.

On the off chance your printed book arrives damaged, with book material defect, contact our Customer Relation Team on [email protected] within 14 days of receipt of the book with appropriate evidence of damage and we will work with you to secure a replacement copy, if necessary. Please note that each printed book you order from us is individually made by Packt's professional book-printing partner which is on a print-on-demand basis.

What tax is charged? Chevron down icon Chevron up icon

Currently, no tax is charged on the purchase of any print book (subject to change based on the laws and regulations). A localized VAT fee is charged only to our European and UK customers on eBooks, Video and subscriptions that they buy. GST is charged to Indian customers for eBooks and video purchases.

What payment methods can I use? Chevron down icon Chevron up icon

You can pay with the following card types:

  1. Visa Debit
  2. Visa Credit
  3. MasterCard
  4. PayPal
What is the delivery time and cost of print books? Chevron down icon Chevron up icon

Shipping Details

USA:

'

Economy: Delivery to most addresses in the US within 10-15 business days

Premium: Trackable Delivery to most addresses in the US within 3-8 business days

UK:

Economy: Delivery to most addresses in the U.K. within 7-9 business days.
Shipments are not trackable

Premium: Trackable delivery to most addresses in the U.K. within 3-4 business days!
Add one extra business day for deliveries to Northern Ireland and Scottish Highlands and islands

EU:

Premium: Trackable delivery to most EU destinations within 4-9 business days.

Australia:

Economy: Can deliver to P. O. Boxes and private residences.
Trackable service with delivery to addresses in Australia only.
Delivery time ranges from 7-9 business days for VIC and 8-10 business days for Interstate metro
Delivery time is up to 15 business days for remote areas of WA, NT & QLD.

Premium: Delivery to addresses in Australia only
Trackable delivery to most P. O. Boxes and private residences in Australia within 4-5 days based on the distance to a destination following dispatch.

India:

Premium: Delivery to most Indian addresses within 5-6 business days

Rest of the World:

Premium: Countries in the American continent: Trackable delivery to most countries within 4-7 business days

Asia:

Premium: Delivery to most Asian addresses within 5-9 business days

Disclaimer:
All orders received before 5 PM U.K time would start printing from the next business day. So the estimated delivery times start from the next day as well. Orders received after 5 PM U.K time (in our internal systems) on a business day or anytime on the weekend will begin printing the second to next business day. For example, an order placed at 11 AM today will begin printing tomorrow, whereas an order placed at 9 PM tonight will begin printing the day after tomorrow.


Unfortunately, due to several restrictions, we are unable to ship to the following countries:

  1. Afghanistan
  2. American Samoa
  3. Belarus
  4. Brunei Darussalam
  5. Central African Republic
  6. The Democratic Republic of Congo
  7. Eritrea
  8. Guinea-bissau
  9. Iran
  10. Lebanon
  11. Libiya Arab Jamahriya
  12. Somalia
  13. Sudan
  14. Russian Federation
  15. Syrian Arab Republic
  16. Ukraine
  17. Venezuela