Recompile after changing some files in src

Hello,

I have made some changes to some files in the src directory to do some tests. The documentation says that I will have to re-compile and relink the LAMMPS executable with make. While the initial build was successful with an executable created in the bin directory, recompilation failed to update this executable. Have I missed any key commands in the cmake settings?

I have attached my initial build installation and recompilation script below. I have also tried by simply loading the required modules and running cmake -DCMAKE_INSTALL_PREFIX=/home/lammps_new ../cmake and the make and make install in the build directory, this failed to update the executable too. No error arose in the initial build and all recompilation attempts.

Thank you
Jean

  1. Initial build:
mkdir ./lammps_new
cd ./lammps_new
wget https://download.lammps.org/tars/lammps-23Jun2022.tar.gz
tar -xzvf lammps-23Jun2022.tar.gz
cd lammps-23Jun2022
mkdir build && cd build

module purge
module load cmake intel/20.0.4 mvapich2/2.3.6 fftw/3.3.10-mva2-lghh6f

cmake -D CMAKE_INSTALL_PREFIX=/home/lammps_new \
-D CMAKE_BUILD_TYPE=Release \
-D LAMMPS_MACHINE=intel \
-D ENABLE_TESTING=no \
-D BUILD_OMP=yes \
-D BUILD_MPI=yes \
-D CMAKE_C_COMPILER=icc \
-D CMAKE_CXX_COMPILER=icpc \
-D PKG_MOLECULE=yes \
-D PKG_EXTRA-MOLECULE=yes \
-D PKG_RIGID=yes \
-D PKG_MISC=yes \
-D PKG_KSPACE=yes \
-D PKG_EXTRA-PAIR=yes \
-D PKG_EXTRA-FIX=yes \
-D PKG_EXTRA-COMPUTE=yes \
-D PKG_CLASS2=yes \
-D PKG_REACTION=yes \
-D PKG_MC=yes \
-D FFT=MKL \
-D FFT_SINGLE=yes \
-D PKG_INTEL=yes \
-D INTEL_ARCH=cpu \
-D INTEL_LRT_MODE=threads ../cmake

make
make install 
  1. Recompilation
cd ./lammps_new/lammps-23Jun2022/build

module purge
module load cmake intel/20.0.4 mvapich2/2.3.6-z2duuy fftw/3.3.10-mva2-lghh6f

cmake -D CMAKE_INSTALL_PREFIX=/home/lammps_new \
-D CMAKE_BUILD_TYPE=Release \
-D LAMMPS_MACHINE=intel \
-D ENABLE_TESTING=no \
-D BUILD_OMP=yes \
-D BUILD_MPI=yes \
-D CMAKE_C_COMPILER=icc \
-D CMAKE_CXX_COMPILER=icpc \
-D PKG_MOLECULE=yes \
-D PKG_EXTRA-MOLECULE=yes \
-D PKG_RIGID=yes \
-D PKG_MISC=yes \
-D PKG_KSPACE=yes \
-D PKG_EXTRA-PAIR=yes \
-D PKG_EXTRA-FIX=yes \
-D PKG_EXTRA-COMPUTE=yes \
-D PKG_CLASS2=yes \
-D PKG_REACTION=yes \
-D PKG_MC=yes \
-D FFT=MKL \
-D FFT_SINGLE=yes \
-D PKG_INTEL=yes \
-D INTEL_ARCH=cpu \
-D INTEL_LRT_MODE=threads ../cmake

make
make install 

With your LAMMPS version and CMake version 3.12 or later, you do not even need to re-run cmake.

Instead of “make; make install”, you should do “make && make install”, so that there will be no attempt at installation if compilation stops on an error.

When you modify sources, it is easy to have an oversight and then compilation fails and you may not even notice.

To provide more specific advice, I would need to see your entire output of the recompile and/or need to see the modifications. If you are familiar with git, you could do:

git clone -b maintenance --depth 1000 https://github.com/lammps/lammps.git lammps

That would make it easy to track your modifications. Just do:

git checkout -b customization maintenance

modify away and commit your changes. Then it is easy to create a diff to see the changes and also switch between the original and the customized version.