Extending and Modifying LAMMPS Writing Your Own Source Code: A pragmatic guide to extending LAMMPS as per custom simulation requirements
Book information
Description
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 ease Key FeaturesUnderstand the structure of the LAMMPS source codeImplement custom features in the LAMMPS source code to meet your research needsRun example simulations involving forces, thermostats, and pair potentials based on implemented featuresBook 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. What you will learnIdentify how LAMMPS input script commands are parsed within the source codeUnderstand the architecture of the source codeRelate source code elements to simulated quantitiesLearn how stored quantities are accessed within the source codeExplore the mechanisms controlling pair styles, computes, and fixesModify the source code to implement custom features in LAMMPSWho this book is 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. Cover Title Page Copyright and Credits About Packt Foreword Contributors Table of Contents Preface Section 1: Getting Started with LAMMPS Chapter 1: MD Theory and Simulation Practices Technical requirements 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 Pair-potential cutoff Periodic boundary conditions Neighbor lists Processor communication Summary Questions Chapter 2: LAMMPS Syntax and Source Code Hierarchy Technical requirements Introducing the LAMMPS input script structure Introducing the source code repository Reviewing the source code hierarchy Summary Further reading Questions Section 2: Understanding the Source Code Structure Chapter 3: Source Code Structure and Stages of Execution Technical requirements Introducing parent and child classes fix.cpp and fix.h pair.cpp and pair.h compute.cpp and compute.h Stages of executing the simulation verlet.cpp min.cpp Role of pointers class Parsing input script commands by input.cpp Summary Further reading Questions Chapter 4: Accessing Information by Variables, Arrays, and Methods Technical requirements Accessing atom properties during simulation runs Mapping atom indices Requesting a neighbor list Accessing physical constants Reading parameters from the input script Incorporating new data types Summary Questions Chapter 5: Understanding Pair Styles Technical requirements Reviewing the general structure of pair styles Reviewing the Morse potential PairMorse::allocate() PairMorse::settings() PairMorse::coeff() PairMorse::init_one() PairMorse::compute() PairMorse::single() Reviewing the table potential PairTable::settings() PairTable::coeff() PairTable::compute() Reviewing the DPD potential PairDPD::settings() PairDPD::compute() Summary Questions Chapter 6: Understanding Computes Technical requirements Reviewing the general structure of computes Reviewing the compute KE class ComputeKE::ComputeKE() ComputeKE::init() ComputeKE::compute_scalar() Reviewing the compute group/group class ComputeGroupGroup::ComputeGroupGroup() ComputeGroupGroup::init() and init_list() ComputeGroupGroup::pair_contribution() ComputeGroupGroup::compute_scalar() and compute_vector() Reviewing the compute RDF class ComputeRDF::ComputeRDF() ComputeRDF::init() and init_list() ComputeRDF::init_norm() ComputeRDF::compute_array() Reviewing the compute heat flux class ComputeHeatFlux::ComputeHeatFlux() ComputeHeatFlux::init() ComputeHeatFlux::compute_vector() Summary Questions Chapter 7: Understanding Fixes Technical requirements Exploring the general structure of fixes Reviewing the Fix AddForce class FixAddForce::FixAddForce() FixAddForce::init() FixAddForce::setmask() FixAddForce::post_force() Studying the Fix NVE class FixNVE::initial_integrate() FixNVE::final_integrate() Studying the Fix NH class Studying the Fix Print class FixPrint::FixPrint() FixPrint::end_of_step() Reviewing the Fix Orient/FCC class FixOrientFCC::FixOrientFCC() FixOrientFCC::find_best_ref() FixOrientFCC::post_force() Analyzing the Fix Wall and Fix Wall/LJ126 classes Fix wall/lj126 Exploring the Fix Rigid class FixRigid::initial_integrate() FixRigid::set_xv() FixRigid::final_integrate() Summary Questions Chapter 8: Exploring Supporting Classes Technical requirements Discovering the Group class Exploring the Variable class Studying the Error class Error::all() Error::one() Error::warning() and message() Reviewing the Memory class Discussing the Angle and angle/harmonic classes The Angle class The angle/harmonic class Summary Questions Section 3: Modifying the Source Code Chapter 9: Modifying Pair Potentials Technical requirements Writing a harmonic potential Changing class names Changing variables and equations Parsing input parameters for Pair Harmonic Trial run (in.Test_PairHarmonic) Writing a height-dependent pair potential Changing the header file, pair_table.h Parsing input parameters for Pair TableZ Implementing height-dependence Trial run (in.Test_PairTableZ) Writing a friction-based pair style Modifying the compute() method Trial run (in.Test_PairCundallStrack) Summary Questions Chapter 10: Modifying Force Applications Technical requirements Writing a fix to apply a 2D spring force Theory (2D spring force) Modifying the header file – addforceXY.h Modifying the constructor in fix_addforceXY.cpp Modifying the init() method in fix_addforceXY.cpp Modifying the post_force() method in fix_addforceXY.cpp Trial run (in.Test_FixAddforceXY) Writing a fix to apply an active force Theory (active force on bonded atoms) Modifying the header file – fix_activeforce.h Modifying the constructor in fix_activeforce.cpp Modifying the post_force() method in fix_activeforce.cpp Trial run (in.Test_ActiveForce) Writing a fix to apply a custom wall force Theory (expanded Lennard–Jones wall force) Modifying the header file Modifying the constructor in fix_wall_region.cpp Modifying the init() method in fix_wall_region.cpp Adding the lj126Expanded() method Modifying the post_force() method Trial run (in.Test_WallRegion) Writing a fix to apply a bond-boost potential Theory (the bond-boost method) Modifying the header file – fix_addboost.h Modifying the constructor in fix_addboost.cpp Modifying the init() method in fix_addboost.cpp Modifying the post_force() method in fix_addboost.cpp Trial run (in.Test_FixAddboost) Summary Questions Chapter 11: Modifying Thermostats Technical requirements Writing a fix to apply the Andersen thermostat Theory – Andersen thermostat Modifying the header file – fix_temp_andersen.h Modifying the constructor in fix_temp_andersen.cpp Modifying the end_of_step() method of fix_temp_andersen.cpp Trial run – in.Test_Andersen Writing a fix to apply a non-linear temperature increment Theory – Exponential temperature increment Modifying the fix_nh.h header file Modifying the constructor in fix_nh.cpp Modifying the init() method in fix_nh.cpp Modifying the compute_temp_target() method in fix_nh.cpp Modifying the compute_scalar() method in fix_nh.cpp Trial run – in.Test_Addboost Writing a fix to print output at evaporation Theory – Evaporation region Modifying the header file – fix_printEvaporate.h Modifying the constructor and init() methods in fix_printEvaporate.cpp Modifying the end_of_step() method in fix_printEvaporate.cpp Trial run – in.Test_PrintEvaporate Summary Questions Appendix A: Building LAMMPS with CMake Technical requirements Prerequisites for working with LAMMPS Downloading the source code Installing the dependencies Downloading MPICH Building LAMMPS Including packages in the build Including modified codes Building with CMake Compiling LAMMPS in Windows Downloading Git for Windows Downloading the source code Downloading CMake for Windows Downloading Microsoft MPI Downloading Code::Blocks Building LAMMPS Building with Make Further reading Appendix B: Debugging Programs Technical requirements What is debugging? Prerequisites Method 1 – Debugging with GDB Method 2 – Debugging with VSCode Insight into sbmask() Further reading Appendix C: Getting Familiar with MPI Technical requirements What is MPI? MPI initialization MPI finalization MPI current process ID MPI (number of processes) MPI send message MPI receive message MPI message MPI in LAMMPS Example of evaluating  Data exchange between owned atoms and ghost atoms Appendix D: Compatibility with Version 29Oct20 Technical requirements Translating Fix Widom into the 3Mar20 version Incompatibility 1 – Parsing input parameters Incompatibility 2 – Atom class Incompatibility 3 – Function signatures in group.cpp Assessments Other Books You May Enjoy Index
Similar books
Extending and Modifying LAMMPS Writing Your Own Source Code: A pragmatic guide to extending LAMMPS as per custom simulation requirements
2021 · EPUB
MySQL® Notes for Professionals book
2018 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF
MrExcel 2022: Boosting Excel
2022 · PDF
Session C11: Ancient Cultural Landscapes in South Europe – their Ecological Setting and Evolution, Session C22: Gardeners from South America, Session S04: Agro-Pastoralism and Early Metallurgy Sessions, Session WS29: The Idea of Enclosure in Recent Iberian Prehistory, Session C88: Rhytmes et causalites des dynamiques de l'anthropisation en Europe entre 6500 ET 500 BC: Hypotheses socio-culturelles et/ou climatiques: Proceedings of the XV UISPP World Congress (Lisbon 4-9 September 2006) / Actes du XV Congrès Mondial (Lisbonne 4-9 Septembre 2006) Vol.36
2010 · PDF
THE BRITISH ARMY IN INDIA: ITS PRESERVATION BY AN APPROPRIATE CLOTHING, HOUSING, LOCATING, RECREATIVE EMPLOYMENT, AND HOPEFUL ENCOURAGEMENT OF THE TROOPS. with AN APPENDIX ON INDIA : THE CLIMATE OP ITS HILLS ; THE DEVELOPMENT OF ITS RESODRCBS, INDUSTRY, AND ARTS ; THE ADMINISTRATION OF JUSTICE ; THE BLACK ACT ; THE PROGRESS OF CHRISTIANITY ; THE TRAFFIC IN OPIUM ; THE VALUE OF INDIA ; PERMANENT CAUSES OF DISAFFECTION, AND OF THE RECENT REBELLION ; THE TRADITIONARY POLICY; MISGOVERNMENT BY NATIVE RULERS ; ANNEXATIONS OF THEIR TERRITORY, ETC.
1858 · PDF
Idries Shah 27 Books Collection : A Perfumed Scorpion, A Veiled Gazelle, Caravan of Dreams, Darkest England, Destination Mecca, Evenings with Idries Shah, Knowing How to Know, Learning How to Learn, Letters and Lectures of Idries Shah, Neglected aspects of Sufi study, Observations, Oriental Magic, Reflections, Seeker after Truth, Special Illumination, Special Problems in the study of Sufi ideas, Sufi thought and action, Tales of the Dervishes, The Dermis Probe, The Elephant in the Dark, The Englishman Handbook, Idries Shah Antology, The Magic Monastery, The natives are restless, wisdom of the Idiots PDF.
2022 · PDF
The travels of Capts. Lewis and Clarke from St. Louis, by way of the Missouri and Columbia rivers, to the Pacific ocean; performed in the years 1804, 1805 & 1806, by order of the government of the United States. Containing delineations of the manners, customs, religion, &c. of the Indians, comp. from various authentic sources, and original documents, and a summary of the Statistical view of the Indian nations, from the official communication of Meriwether Lewis. Illustrated with a map of the country, inhabited by the western tribes of Indians
1809 · PDF