Compiling LAMMPS
This page is for compiling LAMMPS for serial or parallel CPU computing.
Creating the Executable
- Obtain the source code following the instructions found here
- Navigate to the
lammps-DayMonthYear/src
directory. - Ensure USER-KNOTTS has been copied to the
lammps-DayMonthYear/src
directory if doing Go model simulations. See here for more information. - Load the desired compiler and MPI modules if on the supercomputer.
- Example 1:
module load gcc/14.1 openmpi/5.0
- Example 2:
module load gcc openmpi
(Load the current default packages for gcc and openmpi.) - The version of gcc and openmpi will change as new versions are released.
- Intel compilers and other MPI implementations could be tried.
- Example 1:
- Build the
colvars
packagemake lib-colvars args="-m mpi"
- Specify the additional packages you want (See below for descriptions)
- Repeat the following command for all desired packages
$ make yes-name_of_package
- Make sure to include the
colvars
package, but it must be built using the previous step.
- Repeat the following command for all desired packages
- Run the makefile needed for your situation using commands such as the following:
$ make serial
$ make mpi
- More pre-built makefiles are written in the src/MAKE/ directory. View their README to know when to use.
LAMMPS Packages
The following is a list of custom package commands used when making an executable. For different applications you will used different commands.
For further documentation visit: here.
General
$ make yes-gpu
This builds the LAMMPS executable with GPU support. This will speed up some simulations. If your simulation cannot use any gpu styles you will not see a performance increase by using GPU acceleration. You will first need to compile the GPU libraries by following the "Compiling LAMMPS for GPU" guide: http://knottsgroup.groups.et.byu.net/labbook/index.php?n=Main.CompilingLAMMPSForGPU
Protein (with CHARMM)
$ make yes-rigid
Import rigid package; This will import the package used for shaking fixes in big or many molecules$ make yes-replica
Import replica exchange package; This will import the package used for…??$ make yes-molecule
Import molecule package; This will import the package used for hydrogen bonding and water molecule simulations.- Used for all atom simulations???
$ make yes-class2
Import class 2 package ; This will import the package used for Quantum mechanical calculations, typically used in CHARMM.$ make yes-kspace
This adds "pair_style lj/cut/coul/long", which is used for some of the force fields investigated in this project.$ make yes-extra-dump
This adds the ability to write dcd files.$ make yes-colvars
This adds collective variable support needed for many umbrella sampling techniques and any outputs of charmm-gui.$ make yes-user-knotts
(Optional) Import Knotts Go-model Group package; Included in this package are customizations to LAMMPS needed for the models we run in this group. This package is not default included in a lammps download.- Don't use this package if doing all-atom protein simulations.
- Don't use the GPU package if using user-knotts.
Viscosity (Equilibrium MD)
These are the packages used for Viscosity prediction via EMD simulations.
$ make yes-user-misc
This adds the fourier dihedral style, which is used in some of the force fields investigated in this project.$ make yes-molecule
This adds "atom_style full", which adds support for atoms with both molecular properties and charges.$ make yes-kspace
This adds "pair_style lj/cut/coul/long", which is used for some of the force fields investigated in this project.$ make yes-misc
This adds the "fix viscosity" fix, which is used for RNEMD simulations.
LAMMPS File Descriptions
All following files are within the "~/lammps-latest_release_date/" file
src/
This file contains all the source c++ files used during compilation. Also included are c++ files used for task-specific operations. We use many of these for molecular, course-grain and other corrections. User-made c++ files are typically denoted with the "USER-" tag.
Commonly used directories include:
- src/MAKE/
- src/MOLECULE/
- src/RIGID/
- src/REPLICA/
examples/
This file contains some example input files, executable, and operating conditions for all-atom, course-grain and other simulation types.
bench/
This file contains benchmarking tools.
tools/
Contains various stand-alone conversion scripts and post-processing tools.
python/
Contains Python code which wraps LAMMPS as a library and allows the LAMMPS library interface to be invoked from python. Contains instructions on how to enable this.
src/USER-KNOTTS/
Knotts-Group Additions. All additions to the LAMMPS source code that enable Go-modeling are saved in one location and add additional modifications to generate a proper model appropriate for our research.
Code modifications are as follows:
- pair_lj_cut_eten.cpp and pair_lj_cut_eten.h
This code implements the Go-model modified Lennard-Jones interaction potential. - dihedral_eten.cpp and dihedral_eten.h
Resolved issues that arise when doing Go-model dihedral calculations in an mpi replica exchange. - fix_hwall.cpp and fix_hwall.h
This code creates a new type of fix where a surface hydropathy index can be read-in. - fix_hwall_hydro.cpp and fix_hwall_hydro.h
This code implements a Go-model hydrophobically interacting surfaces with amio acids.
Run a Simulation
Before you run a simulation, make the following are in the same directory:
- The executable: name_of_executable.exe
- The input file: Input_file_name.in
- Note you can daisy-chain input files together, but require special commands and is specified in the input file
- The data file: data_file_name.data (This file is sometimes optional, but frequently used)
- The submission script: submission_script_name.sbatch