How to Modify LAMMPS: From the Prospective of a Particle Method Researcher
Abstract
1. Introduction
2. LAMMPS Structure
- The private members, defined before the keyword public, cannot be accessed from outside the class. They can only be accessed by class or “friend” functions, which are declared as having access to class members, without themselves being members. All the class members are private by default.
- The public members can be accessed from outside the class anywhere within the scope of the class object.
- The protected members are similar to private members but they can be accessed by derived classes or child classes while private members cannot.
2.1. Inheritance

2.2. Virtual Function
2.3. LAMMPS Inheritance and Class Syntax
- namestyle.hThe header of the style, where the class style is defined and all the objects, methods and constructors are declared.
- namestyle.cppWhere all the objects, methods and constructors declared in the class of style are defined.

2.3.1. Constructor

2.3.2. Destructor

2.3.3. compute




2.3.4. settings
- No arguments pair style: sph/taitwaterAs described in the SPH for LAMMPS manual [6], the command line to invoke the sph/taitwater pair style is shown in Listing 6.In this pair style there is just a string defining the pair style, sph/taitwater, with no arguments. For this reason in settings, Listing 7, when the if statement is true (number of arguments other than zero) an error is produced.
- Arguments pair syle: sph/rhosumAs described in the SPH for LAMMPS manual [6], the command line to invoke the sph/rhosum pair style is shown in Listing 8.In this pair style there is a string defining the pair style, sph/rhosum, plus one argument, Nstep. For this reason in settings, Listing 9, when the if statement is true (number of arguments other than one) an error is produced. When the if statement is false settings assigns the value of Nstep in the variable nstep, line 5, by using the inumeric function defined in the force class.

2.3.5. coeff
- sph/taitwaterAs described in the SPH for LAMMPS manual [6], the command line to invoke sph/taitwater pair coeff is shown in Listing 10.In total there are six arguments. Thus, in coeff, Listing 11, when if statement is true (number of arguments other than six) an error is produced. When the if statement is false coeff assigns the type of particles I and J plus the value of rho_0, c_0, alpha and h in from the string to the variables by using the numeric function defined in force class. At last, within the double for loop from line 19 to 32, the variables are assigned for each particles.
- sph/rhosumAs described in the SPH for LAMMPS manual [6], the syntax to invoke the command is shown in Listing 12.In this case there are three arguments. Thus, in the coeff, Listing 13, when the if statement is true (number of arguments other than six) an error is produced. When the error is not produced function assigns the type of particles I and J plus the value of h in the string to the variable cut_one, line 11, by using bounds and numeric function defined in force class. At last, within the double for loop from line 14 to 20, the variables are assigned for each particles.
2.3.6. init_one

2.3.7. single

2.3.8. allocate

3. Kelvin–Voigt Bond Style
3.1. Validation
3.2. bond_kv.cpp

















3.3. bond_kv.h



3.4. Invoking kv Pair Style

4. Noble–Abel Stiffened-Gas Pair Style
4.1. Validation
4.2. pair_sph_nasgliquid.cpp


















4.3. pair_sph_nasgliquid.h



4.4. Invoking Sph/Nasgliquid Pair Style

5. Multiphase (Liquid–Gas) Heat Exchange Pair Style
5.1. Validation
5.2. pair_sph_heatgasliquid.cpp















5.3. pair_sph_heatgasliquid.h


5.4. Invoking Sph/Heatgasliquid Pair Style

6. Full Stationary Fix Style
6.1. Validation
6.2. fix_meso_fullstationary.cpp







6.3. fix_mes_fullstationary.h



6.4. Invoking Meso/Fullstationary Fix

7. Viscosity Class
7.1. Temperature Dependant Viscosity
- 1.
- Andrade’s equation [54]where is the viscosity in [Kg m−1 s−1], T is the static temperature in Kelvin, A, B, C and D are fluid-dependent dimensional coefficients available in literature.
- 2.
- 3.
- Sutherland’s law can be expressed as:where is the viscosity in [Kg m−1 s−1], T is the static temperature in Kelvin, and are dimensional coefficients.
- 4.
- Power-Law viscosity law [57] for gas phaseA power-law viscosity law with two coefficients has the form:where is the viscosity in [Kg m−1 s−1], T is the static temperature in Kelvin, and B is a dimensional coefficient.
- 5.
- Constant viscosityWith constant viscosity both dissipation factor and dynamic viscosity will be constant during the simulation.
7.2. Validation
7.3. New Abstract Class: Viscosity



7.4. Implementing a New Viscosity Class


7.5. Processing the Viscosity in the Atom Class




- It checks which type of viscosity is asked to be created using the function strcmp on arg[0] (for Andrade’s viscosity it corresponds to line 3 of Listing 87)
- It checks if the number of arguments is coherent with the number of parameter of the viscosity type (line 4–5)
- It scans the coefficients of that viscosity type (line 6–10)
- It creates the appropriate viscosity and initializes the Viscosity attribute (line 11).







7.6. Using compute_Visc in SPH Pair Styles: Tait Water Implementation













7.7. Running the New Software with Mpirun





7.8. Invoking, Selecting and Computing a Viscosity Object


- FourParameterExp: the four parameter exponential viscosity law.
- SutherlandViscosityLaw: the Sutherland viscosity law.
- PowerLawGas: the power viscosity law for gases.
- Arrhenius: the Arrhenius viscosity law.
- Constant: a constant viscosity.

8. Conclusions
Supplementary Materials
Author Contributions
Funding
Acknowledgments
Conflicts of Interest
Abbreviations
| MS | Molecular Dynamics |
| DMP | Discrete MultiPhysics |
| SPH | Smoothed Particle Hydrodynamics |
| LAMMPS | Large-scale Atomic/Molecular Massively Parallel Simulator |
| EOS | Equation Of State |
| LSM | Lattice Spring Model |
Appendix A. An Example of Discrete Multiphysics Simulation in LAMMPS









Appendix B. How to Compile LAMMPS
- 1.
- Download the file from here. Select the code you want, click the “Download Now” button, and your browser should download a gzipped tar file. Save the file in your directory on BlueBEAR
- 2.
- Unpack the file with the following command line command prompt:
- 3.
- Before compiling is important to set up the environment, with BlueBEAR
- 4.
- Enter in the /src directory in your new LAMMPS directory. The src directory directory contains the C++ source and header files for LAMMPS. It also contains a top-level Makefile and a MAKE sub-directory with low-level Makefile.* files for many systems and machines.
- 5.
- Type the following command to compile a serial version of LAMMPS:
or a multi-threaded (parallel) version of LAMMPS:
If you get no errors and an executable file lmp_mpi is produced. - 6.
- Depending on the features you need, you will have to install same packages in your compiled LAMMPS. Is possible to check which packages is installed in your compiled LAMMPS by typingIt is possible to install the packages you need with the command line
or un-install them with
More make commands are explained in LAMMPS user manual [41]. After the installation of the desired packages you need to compile it again (step 5).
References
- Plimpton, S. Fast Parallel Algorithms for Short-Range Molecular Dynamics; Technical Report; Sandia National Labs.: Albuquerque, NM, USA, 1993.
- Plimpton, S.; Pollock, R.; Stevens, M. Particle-Mesh Ewald and rRESPA for Parallel Molecular Dynamics Simulations. In Proceedings of the Eighth SIAM Conference on Parallel Processing for Scientific Computing, Minneapolis, MN, USA, 14–17 March 1997. [Google Scholar]
- Auhl, R.; Everaers, R.; Grest, G.S.; Kremer, K.; Plimpton, S.J. Equilibration of long chain polymer melts in computer simulations. J. Chem. Phys. 2003, 119, 12718–12728. [Google Scholar] [CrossRef] [Scilit]
- Parks, M.L.; Lehoucq, R.B.; Plimpton, S.J.; Silling, S.A. Implementing peridynamics within a molecular dynamics code. Comput. Phys. Commun. 2008, 179, 777–783. [Google Scholar] [CrossRef] [Scilit]
- Petersen, M.K.; Lechman, J.B.; Plimpton, S.J.; Grest, G.S.; Veld, P.J.; Schunk, P. Mesoscale hydrodynamics via stochastic rotation dynamics: Comparison with Lennard-Jones fluid. J. Chem. Phys. 2010, 132, 174106. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Ganzenmüller, G.C.; Steinhauser, M.O.; Van Liedekerke, P.; Leuven, K.U. The implementation of Smooth Particle Hydrodynamics in LAMMPS. Paul Van Liedekerke Kathol. Univ. Leuven 2011, 1, 1–26. [Google Scholar]
- Jaramillo-Botero, A.; Su, J.; Qi, A.; Goddard III, W.A. Large-scale, long-term nonadiabatic electron molecular dynamics for describing material properties and phenomena in extreme environments. J. Comput. Chem. 2011, 32, 497–512. [Google Scholar] [CrossRef] [Scilit]
- Coleman, S.; Spearot, D.; Capolungo, L. Virtual diffraction analysis of Ni [0 1 0] symmetric tilt grain boundaries. Model. Simul. Mater. Sci. Eng. 2013, 21, 055020. [Google Scholar] [CrossRef] [Scilit]
- Singraber, A.; Behler, J.; Dellago, C. Library-based LAMMPS implementation of high-dimensional neural network potentials. J. Chem. Theory Comput. 2019, 15, 1827–1840. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Ng, K.; Alexiadis, A.; Chen, H.; Sheu, T. A coupled Smoothed Particle Hydrodynamics-Volume Compensated Particle Method (SPH-VCPM) for Fluid Structure Interaction (FSI) modelling. Ocean Eng. 2020, 218, 107923. [Google Scholar] [CrossRef] [Scilit]
- Daraio, D.; Villoria, J.; Ingram, A.; Alexiadis, A.; Stitt, E.H.; Munnoch, A.L.; Marigo, M. Using Discrete Element method (DEM) simulations to reveal the differences in the γ-Al2O3 to α-Al2O3 mechanically induced phase transformation between a planetary ball mill and an attritor mill. Miner. Eng. 2020, 155, 106374. [Google Scholar] [CrossRef] [Scilit]
- Qiao, G.; Lasfargues, M.; Alexiadis, A.; Ding, Y. Simulation and experimental study of the specific heat capacity of molten salt based nanofluids. Appl. Therm. Eng. 2017, 111, 1517–1522. [Google Scholar] [CrossRef] [Scilit]
- Qiao, G.; Alexiadis, A.; Ding, Y. Simulation study of anomalous thermal properties of molten nitrate salt. Powder Technol. 2017, 314, 660–664. [Google Scholar] [CrossRef] [Scilit]
- Anagnostopoulos, A.; Navarro, H.; Alexiadis, A.; Ding, Y. Wettability of NaNO3 and KNO3 on MgO and Carbon Surfaces—Understanding the Substrate and the Length Scale Effects. J. Phys. Chem. C 2020, 124, 8140–8152. [Google Scholar] [CrossRef] [Scilit]
- Sahputra, I.H.; Alexiadis, A.; Adams, M.J. Effects of Moisture on the Mechanical Properties of Microcrystalline Cellulose and the Mobility of the Water Molecules as Studied by the Hybrid Molecular Mechanics–Molecular Dynamics Simulation Method. J. Polym. Sci. Part B Polym. Phys. 2019, 57, 454–464. [Google Scholar] [CrossRef] [Scilit]
- Sahputra, I.H.; Alexiadis, A.; Adams, M.J. Temperature dependence of the Young’s modulus of polymers calculated using a hybrid molecular mechanics–molecular dynamics method. J. Phys. Condens. Matter 2018, 30, 355901. [Google Scholar] [CrossRef] [Scilit]
- Mohammed, A.M.; Ariane, M.; Alexiadis, A. Using Discrete Multiphysics Modelling to Assess the Effect of Calcification on Hemodynamic and Mechanical Deformation of Aortic Valve. ChemEngineering 2020, 4, 48. [Google Scholar] [CrossRef] [Scilit]
- Ariane, M.; Vigolo, D.; Brill, A.; Nash, F.; Barigou, M.; Alexiadis, A. Using Discrete Multi-Physics for studying the dynamics of emboli in flexible venous valves. Comput. Fluids 2018, 166, 57–63. [Google Scholar] [CrossRef] [Scilit]
- Ariane, M.; Wen, W.; Vigolo, D.; Brill, A.; Nash, F.; Barigou, M.; Alexiadis, A. Modelling and simulation of flow and agglomeration in deep veins valves using discrete multi physics. Comput. Biol. Med. 2017, 89, 96–103. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Ariane, M.; Allouche, M.H.; Bussone, M.; Giacosa, F.; Bernard, F.; Barigou, M.; Alexiadis, A. Discrete multi-physics: A mesh-free model of blood flow in flexible biological valve including solid aggregate formation. PLoS ONE 2017, 12, e0174795. [Google Scholar] [CrossRef] [Scilit]
- Schütt, M.; Stamatopoulos, K.; Simmons, M.; Batchelor, H.; Alexiadis, A. Modelling and simulation of the hydrodynamics and mixing profiles in the human proximal colon using Discrete Multiphysics. Comput. Biol. Med. 2020, 121, 103819. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Alexiadis, A.; Stamatopoulos, K.; Wen, W.; Batchelor, H.; Bakalis, S.; Barigou, M.; Simmons, M. Using discrete multi-physics for detailed exploration of hydrodynamics in an in vitro colon system. Comput. Biol. Med. 2017, 81, 188–198. [Google Scholar] [CrossRef] [Scilit] [PubMed]
- Ariane, M.; Kassinos, S.; Velaga, S.; Alexiadis, A. Discrete multi-physics simulations of diffusive and convective mass transfer in boundary layers containing motile cilia in lungs. Comput. Biol. Med. 2018, 95, 34–42. [Google Scholar] [CrossRef] [Scilit]
- Ariane, M.; Sommerfeld, M.; Alexiadis, A. Wall collision and drug-carrier detachment in dry powder inhalers: Using DEM to devise a sub-scale model for CFD calculations. Powder Technol. 2018, 334, 65–75. [Google Scholar] [CrossRef] [Scilit]
- Albano, A.; Alexiadis, A. Interaction of Shock Waves with Discrete Gas Inhomogeneities: A Smoothed Particle Hydrodynamics Approach. Appl. Sci. 2019, 9, 5435. [Google Scholar] [CrossRef] [Scilit]
- Albano, A.; Alexiadis, A. A smoothed particle hydrodynamics study of the collapse for a cylindrical cavity. PLoS ONE 2020, 15, e0239830. [Google Scholar] [CrossRef] [Scilit]
- Albano, A.; Alexiadis, A. Non-Symmetrical Collapse of an Empty Cylindrical Cavity Studied with Smoothed Particle Hydrodynamics. Appl. Sci. 2021, 11, 3500. [Google Scholar] [CrossRef] [Scilit]
- Alexiadis, A. The discrete multi-hybrid system for the simulation of solid-liquid flows. PLoS ONE 2015, 10, e0124678. [Google Scholar] [CrossRef] [Scilit]
- Alexiadis, A. A new framework for modelling the dynamics and the breakage of capsules, vesicles and cells in fluid flow. Procedia IUTAM 2015, 16, 80–88. [Google Scholar] [CrossRef] [Scilit]
- Alexiadis, A. A smoothed particle hydrodynamics and coarse-grained molecular dynamics hybrid technique for modelling elastic particles and breakable capsules under various flow conditions. Int. J. Numer. Methods Eng. 2014, 100, 713–719. [Google Scholar] [CrossRef] [Scilit]
- Rahmat, A.; Barigou, M.; Alexiadis, A. Deformation and rupture of compound cells under shear: A discrete multiphysics study. Phys. Fluids 2019, 31, 051903. [Google Scholar] [CrossRef] [Scilit]
- Alexiadis, A.; Ghraybeh, S.; Qiao, G. Natural convection and solidification of phase-change materials in circular pipes: A SPH approach. Comput. Mater. Sci. 2018, 150, 475–483. [Google Scholar] [CrossRef] [Scilit]
- Rahmat, A.; Barigou, M.; Alexiadis, A. Numerical simulation of dissolution of solid particles in fluid flow using the SPH method. Int. J. Numer. Methods Heat Fluid Flow 2019, 30, 290–307. [Google Scholar] [CrossRef] [Scilit]
- Rahmat, A.; Meng, J.; Emerson, D.; Wu, C.Y.; Barigou, M.; Alexiadis, A. A practical approach for extracting mechanical properties of microcapsules using a hybrid numerical model. Microfluid. Nanofluidics 2021, 25, 1–17. [Google Scholar] [CrossRef] [Scilit]
- Ruiz-Riancho, I.N.; Alexiadis, A.; Zhang, Z.; Hernandez, A.G. A Discrete Multi-Physics Model to Simulate Fluid Structure Interaction and Breakage of Capsules Filled with Liquid under Coaxial Load. Processes 2021, 9, 354. [Google Scholar] [CrossRef] [Scilit]
- Sanfilippo, D.; Ghiassi, B.; Alexiadis, A.; Hernandez, A.G. Combined Peridynamics and Discrete Multiphysics to Study the Effects of Air Voids and Freeze-Thaw on the Mechanical Properties of Asphalt. Materials 2021, 14, 1579. [Google Scholar] [CrossRef] [Scilit]
- Alexiadis, A.; Albano, A.; Rahmat, A.; Yildiz, M.; Kefal, A.; Ozbulut, M.; Bakirci, N.; Garzón-Alvarado, D.; Duque-Daza, C.; Eslava-Schmalbach, J. Simulation of pandemics in real cities: Enhanced and accurate digital laboratories. Proc. R. Soc. A 2021, 477, 20200653. [Google Scholar] [CrossRef] [Scilit]
- Alexiadis, A. Deep Multiphysics and Particle–Neuron Duality: A Computational Framework Coupling (Discrete) Multiphysics and Deep Learning. Appl. Sci. 2019, 9, 5369. [Google Scholar] [CrossRef] [Scilit]
- Alexiadis, A. Deep multiphysics: Coupling discrete multiphysics with machine learning to attain self-learning in-silico models replicating human physiology. Artif. Intell. Med. 2019, 98, 27–34. [Google Scholar] [CrossRef] [Scilit]
- Alexiadis, A.; Simmons, M.; Stamatopoulos, K.; Batchelor, H.; Moulitsas, I. The duality between particle methods and artificial neural networks. Sci. Rep. 2020, 10, 1–7. [Google Scholar] [CrossRef] [Scilit]
- Sandia Corporation LAMMPS Users Manual. 2003. Available online: https://lammps.sandia.gov/doc/Developer.pdf (accessed on 11 January 2021).
- Plimpton. LAMMPS Developer Guide. Available online: https://lammps.sandia.gov/doc/Developer.pdf (accessed on 11 January 2021).
- Plimpton, S.J. Modifying & Extending LAMMPS; Technical Report; Sandia National Lab. (SNL-NM): Albuquerque, NM, USA, 2014.
- Flügge, W. Viscoelasticity; Springer Science & Business Media: Berlin/Heidelberg, Germany, 2013. [Google Scholar]
- Sahputra, I.H.; Alexiadis, A.; Adams, M.J. A Coarse Grained Model for Viscoelastic Solids in Discrete Multiphysics Simulations. ChemEngineering 2020, 4, 30. [Google Scholar] [CrossRef] [Scilit]
- Liu, M.; Liu, G. Smoothed particle hydrodynamics (SPH): An overview and recent developments. Arch. Comput. Methods Eng. 2010, 17, 25–76. [Google Scholar] [CrossRef] [Scilit]
- Le Métayer, O.; Saurel, R. The Noble-Abel stiffened-gas equation of state. Phys. Fluids 2016, 28, 046102. [Google Scholar] [CrossRef] [Scilit]
- Monaghan, J.J.; Gingold, R.A. Shock simulation by the particle method SPH. J. Comput. Phys. 1983, 52, 374–389. [Google Scholar] [CrossRef] [Scilit]
- Lattanzio, J.; Monaghan, J.; Pongracic, H.; Schwarz, M. Controlling penetration. SIAM J. Sci. Stat. Comput. 1986, 7, 591–598. [Google Scholar] [CrossRef] [Scilit]
- Morris, J.P.; Fox, P.J.; Zhu, Y. Modeling low Reynolds number incompressible flows using SPH. J. Comput. Phys. 1997, 136, 214–226. [Google Scholar] [CrossRef] [Scilit]
- Cornelissen, J.; Waterman, H. The viscosity temperature relationship of liquids. Chem. Eng. Sci. 1955, 4, 238–246. [Google Scholar] [CrossRef] [Scilit]
- Seeton, C.J. Viscosity–temperature correlation for liquids. Tribol. Lett. 2006, 22, 67–78. [Google Scholar] [CrossRef] [Scilit]
- Stanciu, I. A new viscosity-temperature relationship for vegetable oil. J. Pet. Technol. Altern. Fuels 2012, 3, 19–23. [Google Scholar] [CrossRef] [Scilit]
- Gutmann, F.; Simmons, L. The temperature dependence of the viscosity of liquids. J. Appl. Phys. 1952, 23, 977–978. [Google Scholar] [CrossRef] [Scilit]
- De Guzman, J. Relation between fluidity and heat of fusion. Anales Soc. Espan. Fis. Quim 1913, 11, 353–362. [Google Scholar]
- Raman, C. A theory of the viscosity of liquids. Nature 1923, 111, 532–533. [Google Scholar] [CrossRef] [Scilit]
- Chapman, S.; Cowling, T.G.; Burnett, D. The Mathematical Theory of Non-Uniform Gases: An Account of the Kinetic Theory of Viscosity, Thermal Conduction and Diffusion in Gases; Cambridge University Press: Cambridge, UK, 1990. [Google Scholar]
- Rathakrishnan, E. Theoretical Aerodynamics; John Wiley & Sons: Hoboken, NJ, USA, 2013. [Google Scholar]
- Sameen, A.; Govindarajan, R. The effect of wall heating on instability of channel flow. J. Fluid Mech. 2007, 577, 417–442. [Google Scholar] [CrossRef] [Scilit]
- Mubin, S.; Li, J. Extending and Modifying LAMMPS; Packt Publishing Ltd.: Birmingham, UK, 2021. [Google Scholar]
- Project, G. Make-GNU Project-Free Software Fondation. Available online: https://www.gnu.org/software/make/ (accessed on 14 October 2020).
- Martin, K.; Hoffman, B. Mastering CMake: A Cross-Platform Build System; Kitware: Clifton Park, NY, USA, 2010. [Google Scholar]










Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affiliations. |
© 2021 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https://creativecommons.org/licenses/by/4.0/).
Share and Cite
Albano, A.; le Guillou, E.; Danzé, A.; Moulitsas, I.; Sahputra, I.H.; Rahmat, A.; Duque-Daza, C.A.; Shang, X.; Ching Ng, K.; Ariane, M.; et al. How to Modify LAMMPS: From the Prospective of a Particle Method Researcher. ChemEngineering 2021, 5, 30. https://doi.org/10.3390/chemengineering5020030
Albano A, le Guillou E, Danzé A, Moulitsas I, Sahputra IH, Rahmat A, Duque-Daza CA, Shang X, Ching Ng K, Ariane M, et al. How to Modify LAMMPS: From the Prospective of a Particle Method Researcher. ChemEngineering. 2021; 5(2):30. https://doi.org/10.3390/chemengineering5020030
Chicago/Turabian StyleAlbano, Andrea, Eve le Guillou, Antoine Danzé, Irene Moulitsas, Iwan H. Sahputra, Amin Rahmat, Carlos Alberto Duque-Daza, Xiaocheng Shang, Khai Ching Ng, Mostapha Ariane, and et al. 2021. "How to Modify LAMMPS: From the Prospective of a Particle Method Researcher" ChemEngineering 5, no. 2: 30. https://doi.org/10.3390/chemengineering5020030
APA StyleAlbano, A., le Guillou, E., Danzé, A., Moulitsas, I., Sahputra, I. H., Rahmat, A., Duque-Daza, C. A., Shang, X., Ching Ng, K., Ariane, M., & Alexiadis, A. (2021). How to Modify LAMMPS: From the Prospective of a Particle Method Researcher. ChemEngineering, 5(2), 30. https://doi.org/10.3390/chemengineering5020030















