# Lammps on BC4 ## 1. Clone lammps from github to BC4: git clone -b stable https://github.com/lammps/lammps.git mylammps This will create a directory called mylammps with all of the lammps source code in it. ## 2. Load required modules Before building lammps you may need to load up some modules if you have not done so already, the relevant ones for this are: - languages/gcc/9.3.0 - tools/cmake/3.20.0 - module load OpenMPI/3.0.0-GCC-7.2.0-2.29 The first two you need to build LAMMPS. Open MPI can be added in your shell submission script. These are added using: module add languages/gcc/9.3.0 ## 3. Build LAMMPS There are two options for this: make and cmake. I prefer make but I have done both so I will explain both methods in case you have a preference. ### make Move into the source directory : cd mylammps/src/ add any modules you'd like included in the build (for example the dipole package) make yes-dipole Build lammps executables: both the serial and mpi versions. make serial make mpi These can then be added to your path and used as normal. ### cmake set up the build directory: ``` cd mylammps mkdir build cd build ``` Add lammps packaged (eg. the dipole package) ``` cmake -D PKG_DIPOLE=on ../cmake ``` Now build: ``` cmake --build . ``` - This will create the `lmp` executable in the `mylammps/build` directory. You can install this executable to your system with: ``` make install ```