## 1. Download LAMMPS
Follow the instructions at [LAMMPS GitHub Installation Guide](https://docs.lammps.org/Install_git.html).
```bash
git clone -b release https://github.com/lammps/lammps.git mylammps
```
## 2. Install Open MPI
Follow the quickstart guide at [Open MPI Installation Guide](https://docs.open-mpi.org/en/v5.0.x/installing-open-mpi/quickstart.html). Ensure you add the installed directory to your `PATH`.
## 3. Build and Install LAMMPS
### Build LAMMPS
1. Use CMake to generate a build environment in a new directory.
2. Compile and link all objects, libraries, and executables using the selected build tool.
```bash
cd lammps # Change to the LAMMPS distribution directory
mkdir build; cd build # Create and use a build directory
# Configuration reading CMake scripts from ../cmake
cmake -D BUILD_MPI=yes -D LAMMPS_MACHINE=mpi -D PKG_MANYBODY=yes -D PKG_REPLICA=yes -D PKG_H5MD=yes -C ../cmake/presets/most.cmake ../cmake
cmake --build . # Compilation (or type "make")
```
> **Note:** If you encounter an error during the build process, remove `CMakeCache.txt` before building again.
### Install LAMMPS
After compilation, install the LAMMPS executable:
```bash
make install # Optional, copies compiled files into the installation location
```
## 4. Test LAMMPS
Run a test simulation to ensure LAMMPS is installed correctly:
```bash
cd lammps/examples/indent/
lmp_mpi -in ./in.indent
```
To test MPI,
```bash
mpirun -np <number_of_processors> lmp_mpi -in ./in.indent
```
Replace `<number_of_processors>` with the number of processors you want to use for the test.