QM/MM with new CP2K 2026.1

GROMACS version:2026
GROMACS modification: CP2k interface
Good evening,

I am attempting to compile CP2K 2026.1 on an HPC cluster. While I am familiar with compiling older versions of the code, the newer versions now require CMake. I managed to compile CP2K 2026.1 using the ./make_cp2k.sh script.

Nevertheless, I have not been able to replicate the behavior of the old make -j 128 ARCH=local VERSION=“psmp” libcp2k command, which was necessary for the GROMACS/CP2K interface. Moreover, the libcp2k.a file is not produced by the current CP2K compilation—only libcp2k.so is generated.

Maybe the guide on how to compile the GROMACS/CP2K interface might be updated?

@dmorozov Could you look into this?

Hi, have you been able to build GROMACS with CP2K in that case?

I checked, it actually works completely fine for GROMACS, you should just change CP2K_DIR in GROMACS CMake command to: -DCP2K_DIR=”<your CP2K installation directory>/lib"

P.S. will update installation instructions for CP2K>=2026.1

Actually, since you are using make_cp2k.sh, which builds CP2K using spack. Then I suggest you to try installing everything with spack install gromacs+cp2k it should build the whole toolchain for the latest GROMACS and CP2K versions

Thanks for the kind reply. I actually attempted to compile GROMACS, but it didn’t work; the build process complained that it couldn’t find libcp2k.h.

Could you please share your compilation procedure for both CP2K and GROMACS so that I can try to replicate it? I’m especially interested in how you compiled CP2K (using the toolchain or make_cp2k.sh) and your cmake flags for GROMACS. I will try the suggestion to use -DCP2K_DIR=“/lib”.

I used toolchain script, but it depends on your system (which libraries are available and which not).

CMake command for GROMACS:

cmake .. -DGMX_MPI=ON -DGMX_FFT_LIBRARY=fftw3 -DCMAKE_INSTALL_PREFIX=“/scratch/project_2001312/gromacs_cp2k/install” -DGMX_CP2K=ON -DCP2K_DIR=“/scratch/project_2001312/gromacs_cp2k/cp2k-v2026.1/install/lib” -DGMX_EXTERNAL_BLAS=ON -DGMX_EXTERNAL_LAPACK=ON

After toolchain script, you compiled CP2K with cmake (as suggested by cp2k website)?
In case I’ll try a “custom” version to fit my setup of already installed packages

cd <CP2K_REPOSITORY>

mkdir build/

cmake -S . -B build
-GNinja
-DCP2K_USE_LIBXC=ON
-DCP2K_USE_LIBINT2=ON
-DCP2K_USE_SPGLIB=ON
-DCP2K_USE_ELPA=ON
-DCP2K_USE_SPLA=ON
-DCP2K_USE_SIRIUS=ON
-DCP2K_USE_COSMA=ON

cmake --build build -j 32

Yes but also added -DCMAKE_INSTALL_PREFIX=./install and MPI -DCP2K_USE_MPI=ON -DCP2K_USE_MPI_F08=ON

I also combined build and install commands:

cmake --build build --target install -j 32