Issue with installing n2p2

Dear LAMMPS developers,

I’m trying to build the latest version of lammps on my workstation, but I get the following error. I appreciate it if you could help me how to resolve this issue.

Thanks a lot!

Reza.

cmake -D PKG_BROWNIAN=on .
cmake -D PKG_COLVARS=on .
cmake -D PKG_COMPRESS=on .
cmake -D PKG_DIFFRACTION=on .
cmake -D PKG_EXTRA-COMPUTE=on .
cmake -D PKG_EXTRA-DUMP=on .
cmake -D PKG_EXTRA-FIX=on .
cmake -D PKG_EXTRA-PAIR=on .
cmake -D PKG_KSPACE=on .
cmake -D PKG_MANYBODY=on .
cmake -D PKG_MC=on .
cmake -D PKG_MEAM=on .
cmake -D PKG_MISC=on .
cmake -D DOWNLOAD_N2P2=on .
cmake -D PKG_ML-HDNNP=on .
cmake -D PKG_ML-SNAP=on .
cmake -D PKG_ML-IAP=on .
cmake -D PKG_ML-PACE=on .
cmake -D PKG_ML-RANN=on .
cmake -D PKG_OPENMP=on .
cmake -D PKG_OPT=on .
cmake -D PKG_ORIENT=on .
cmake -D PKG_PHONON=on .
cmake -D PKG_PTM=on .
cmake -D PKG_PYTHON=on .
cmake -D PKG_REAXFF=on .
cmake -D PKG_REPLICA=on .
cmake -D PKG_RIGID=on .
cmake -D PKG_SHOCK=on .
cmake -D DOWNLOAD_VORO=on .
cmake -D PKG_VORONOI=on .

make -j 40

CMake Error at /home/cauchy/Desktop/LAMMPS/lammps-23Jun2022/build/n2p2_build-prefix/src/n2p2_build-stamp/n2p2_build-build-RelWithDebInfo.cmake:49 (message):
Command failed: 2

‘/usr/bin/make’ ‘-f’ ‘makefile’ ‘libnnpif’ ‘INTERFACES=LAMMPS’ ‘COMP=gnu’ ‘PROJECT_OPTIONS=-I/usr/lib/x86_64-linux-gnu/openmpi/include/openmpi’ ‘/usr/lib/x86_64-linux-gnu/openmpi/include’ ‘PROJECT_DEBUG=’ ‘PROJECT_CC=/usr/bin/c++’ ‘PROJECT_MPICC=/usr/bin/c++’ ‘PROJECT_CFLAGS=-fPIC -O2 -g -DNDEBUG -std=gnu++11’ ‘PROJECT_AR=/usr/bin/gcc-ar-9’ ‘APP_CORE=nnp-convert’ ‘APP_TRAIN=nnp-train’ ‘APP=nnp-convert’

See also

/home/cauchy/Desktop/LAMMPS/lammps-23Jun2022/build/n2p2_build-prefix/src/n2p2_build-stamp/n2p2_build-build-*.log

make[2]: *** [CMakeFiles/n2p2_build.dir/build.make:115: n2p2_build-prefix/src/n2p2_build-stamp/n2p2_build-build] Error 1
make[1]: *** [CMakeFiles/Makefile2:1021: CMakeFiles/n2p2_build.dir/all] Error 2
make: *** [Makefile:130: all] Error 2

This is incomplete information (no OS, no compiler, incomplete command line, no information about LAMMPS was downloaded etc.), so it is impossible to provide accurate advice. I have only seen this when you still have an outdated copy of the n2p2 library in your build folder or outdated settings in your CMakeCache.txt file that have been updated in the CMake scripts but must be removed from the cache to be applied.

Thus please make sure you use a new build folder and try again. Best also avoid parallel compilation if you still run into problems (at least for the external libraries, not all have build system that were written with being executed in parallel in mind).

Also what is the point of trying to speed things up with a parallel compilation when you first waste massive amounts of time by running cmake n+1 times instead of just combining all cmake commands into a single command? You can further improve/simplify this by using a preset like most.cmake and then just add the packages you want to enable in addition (or disable what you don’t like).

Hi Axel,

Thanks for the suggestions. I didn’t have any success following your suggestions. I apologize for not providing enough details. I attached a bunch of log files, and hopeful they may provide some useful information.

n2p2_build-build-RelWithDebInfo.cmake (2.4 KB)

CMakeError.log (5.4 KB)

CMakeOutput.log (99.7 KB)

No, they don’t.

I enabled only ML-HDNNP package, but I still can’t build LAMMPS. It gives an error like this in one of the log files:

make[3]: warning: jobserver unavailable: using -j1. Add ‘+’ to parent make rule.
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
fatal: not a git repository (or any of the parent directories): .git
LAMMPS/InterfaceLammps.cpp:18:10: fatal error: mpi.h: No such file or directory
18 | #include <mpi.h>
| ^~~~~~~
compilation terminated.
make[4]: *** [makefile:137: LAMMPS/InterfaceLammps.o] Error 1
make[3]: *** [makefile:136: libnnpif] Error 2

This looks like a problem with your MPI library installation not providing the correct include path. Since you now repeatedly have failed to provide the information I have asked for, I will not do any further followup.

Please note, that you can always download and compile the n2p2 library separately and then address any compilation issues directly rather than depend on the “cmake scripting magic” that LAMMPS uses. For external libraries, we have little control over the details of their configuration, compilation, and quality and compatibility of their build system with what LAMMPS uses. The automatic download/compilation works for all systems that I have checked it on and that I regularly use. I have no way to update/correct something, if I don’t have a way to reproduce it.