Cmake doesn't find MPICH library

Installing a custom lmp version using cmake.
I load the mpich module - it appears in module list:
Currently Loaded Modulefiles:

  1. shared 5) matlab/R2018a
  2. sge/2011.11p1 6) gcc/10.2.0
  3. slurm/20.02.4 7) R/4.2.1
  4. cmsub 8) mpich/ge/open64/64/3.2

but when I use cmake to configure files
cmake -S ~/app/lammps-23Jun2022/cmake -B ~/app/lammps-23Jun2022/build -D PKG_MC=yes -D PKG_MISC=yes -D PKG_RIGID=yes

apparently does not find the MPICH library
– The following tools and libraries have been found and configured:

  • Git
  • OpenMP
  • JPEG
  • PNG
  • ZLIB

So when I go to build the configuration shown below:
– <<< Build configuration >>>
LAMMPS Version: #define LAMMPS_VERSION “23 Jun 2022-rev. n3 - RBS Sep 2023”-1#define LAMMPS_VERSION “23 Jun 2022-rev. n3 - RBS Sep 2023”
Operating System: Linux CentOS Linux 7
Build type: RelWithDebInfo
Install path: /home/richst/.local
Generator: Unix Makefiles using /usr/bin/gmake
– Enabled packages: MC;MISC;RIGID
– <<< Compilers and Flags: >>>
– C++ Compiler: /cm/shared/apps/gcc/10.2.0/bin/c++
Type: GNU
Version: 10.2.0
C++ Flags: -O2 -g -DNDEBUG
– <<< Linker flags: >>>
– Executable name: lmp_rbs-n3
– Static library flags:
– Configuring done

it has substituted MPI STUBS for the actual library:
MPI v1.0: LAMMPS MPI STUBS for LAMMPS version 23 Jun 2022-rev. n3 - RBS Sep 2023

Is there something more necessary to make the mpi library findable by cmake???

It looks like you modified the LAMMPS_VERSION define in src/version.h. Please do not do that. If you want to add a custom string, please modify LAMMPS_UPDATE instead.

When configuring with cmake, please make certain that you are using a new build folder.

Another item to consider is to add -D BUILD_MPI=on to your CMake configuration command to enforce building with MPI.

Please also make certain that after loading the MPI environment module, both mpicxx and mpicc are available.

Please also note that your version is outdated and has been superseded by the 2 Aug 2023 release.

True the version is outdated - I haven’t gotten to check whether my source changes need updating.
Moved my comments to update from version
Forced MPI using -D BUILD_MPI=on
cmake responded with
– Running check for auto-generated files from make-based build system
– Could NOT find MPI_CXX (missing: MPI_CXX_WORKS)
CMake Error at /usr/local/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find MPI (missing: MPI_CXX_FOUND)
Call Stack (most recent call first):
/usr/local/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-3.15/Modules/FindMPI.cmake:1684 (find_package_handle_standard_args)
CMakeLists.txt:318 (find_package)

That means that your MPI environment module cannot produce a usable C++ executable.
It is impossible to say from remote what the reason for that is. You need to work with the people managing the machine your are on to resolve this.

The Programmer Guide of the LAMMPS manual contains a section with notes for changes required to update source code written for older versions of LAMMPS to the current version:

You’ve homed in on the problem. Thanks for the (always) excellent analysis.