This guide is prepared in order to provide the instructions on how to install LAMMPS on Mac machine with M1 chip.
Be sure that you installed these software before:
- Install Xcode Command Line Tools. Type
xcode-select --install
in a command line - Install CMake (latest)
- Install Homebrew (latest)
- Install Anaconda (latest)
- Install VMD (latest). Type
omz update
in a command line before to lunch the VMD for the first time. - Install Chimera (latest) or Ovito (latest). These tools are usefool to visualize the initial conformation of atoms
- Install ffmpeg library.
- [Install OpenMPI]: either
brew install openmpi
orbrew install mpich
I would also suggest to create the separate Anaconda environment for the future LAMMPS experiments.
I would suggest first to install the LAMMPS as an executable (homebrew or anaconda). The reason is that it is simplier than to build LAMMPS from source, and you can anytime delete it and switch to the most 'powerful' way of working with LAMMPS, by building it from the source (keeping the recent updates). But if you plan to work with CLI and/or Python, than I would suggest to download LAMMPS as an executable for Anaconda:
Follow the instructions here. Make sure you install LAMMPS in a separate environment (it is highly recommended).
conda config --add channels conda-forge
conda activate my-lammps-env
conda install lammps
conda install openkim-models
Clone (or pull) the latest lammps release:
cd ~/Tools
git clone -b stable --depth 1 https://github.com/lammps/lammps.git lammps
Prepare build folder:
cd lammps
mkdir build
cd build
Build basic lammps pre-sets (with BPM package):
cmake -C ../cmake/presets/basic.cmake -C ../cmake/presets/nolib.cmake -D FFMPEG_EXECUTABLE=~/Tools/ffmpeg -D PKG_BPM=yes -D LAMMPS_MACHINE=mpi ../cmake
If you want to work with lammps by scripting on python, you may need to re-build with this:
cmake -D PKG_PYTHON=yes -D BUILD_SHARED_LIBS=yes -D LAMMPS_MACHINE=name . # name = mpi, serial, mybox, titan, laptop, etc
If you want to have in your build some auxiliary tool, you may need to re-build with this:
cmake -D BUILD_TOOLS=yes -D BUILD_LAMMPS_SHELL=yes .
If you have some troubles with JPEG, PNG and/or MPEG, try to adjust the previous configuration with these options (where path
should be the path to the corresponding .h
and .a
(.so
) files):
cmake -D JPEG_INCLUDE_DIR=path -D JPEG_LIBRARY=path -D PNG_INCLUDE_DIR=path -D PNG_LIBRARY=path -D ZLIB_INCLUDE_DIR=path -D ZLIB_LIBRARY=path -D FFMPEG_EXECUTABLE=path .
After this, type:
make # perform make after CMake command
make install # perform the installation into prefix
After that, symlinc lammps executable into the path:
sudo ln -s /Users/nbykov/Tools/lammps/build/lmp_mpi /usr/local/bin
Try this example and compare it with the logs: lmp_serial -in in.min
.