Troubles compiling GROMACS 2022 with CP2K 9.1

Hello dear GROMACS users,
my name is Mario Moser, i just joined this site, im having trouble compiling gromacs 2022 with cp2k.

im trying to compile gromacs 2022 with CP2K support.
I already compiled the cp2k library with sudo ./install_cp2k_toolchain.sh --with-openblas --with-openmpi --with-fftw --with-scalapack and
make -j 16 ARCH=local VERSION="ssmp sdbg psmp pdbg" libcp2k, then i entered the cmake

command below :
cmake .. \ -DGMX_MPI=on \ -DCMAKE_INSTALL_PREFIX=/home/moser/software/gromacs/ \ -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ \ -DBUILD_SHARED_LIBS=OFF -DGMXAPI=OFF -DGMX_INSTALL_NBLIB_API=OFF \ -DGMX_DOUBLE=OFF \ -DGMX_FFT_LIBRARY=fftw3 \ -DFFTWF_LIBRARY=/home/moser/cp2k-9.1/tools/toolchain/install/fftw-3.3.10/lib/libfftw3f.a \ -DFFTWF_INCLUDE_DIR=/home/moser/cp2k-9.1/tools/toolchain/install/fftw-3.3.10/include \ -DGMX_EXTERNAL_BLAS=ON -DGMX_EXTERNAL_LAPACK=ON \ -DCMAKE_PREFIX_PATH=/home/moser/cp2k-9.1/tools/toolchain/install/openblas-0.3.19 \ -DCP2K_DIR=/home/moser/cp2k-9.1/lib/local/psmp \ -DCP2K_LINKER_FLAGS="-lgfortran"

and i got this error message after typing make :
/usr/bin/ld : /home/moser/cp2k-9.1/tools/toolchain/install/openblas-0.3.19/lib/libopenblas.a(sormql.o):/home/moser/cp2k-9.1/tools/toolchain/build/OpenBLAS-0.3.19/lapack-netlib/SRC/sormql.f:277 : encore plus de références indéfinies suivent vers « _gfortran_concat_string » collect2: error: ld returned 1 exit status make[2]: [src/programs/CMakeFiles/gmx.dir/build.make:102 : bin/gmx_mpi] Erreur 1 make[1]: [CMakeFiles/Makefile2:6200 : src/programs/CMakeFiles/gmx.dir/all] Erreur 2 make: *** [Makefile:166 : all] Erreur 2

Im also not sure what flags to put in :-DCP2K_LINKER_FLAGS in the cmake command.

Im looking forward for your help and advices.

Best regards.

Mario Moser

What happens if you just remove -DCP2K_LINKER_FLAGS from the cmake? For CP2K 9.1 it is not required.

Also could you share local.psmp ARCH file from CP2K?

I would also suggest to set -DGMX_DOUBLE=ON,
remove -DFFTWF_LIBRARY=/home/moser/cp2k-9.1/tools/toolchain/install/fftw-3.3.10/lib/libfftw3f.a \ -DFFTWF_INCLUDE_DIR=/home/moser/cp2k-9.1/tools/toolchain/install/fftw-3.3.10/include \
and set -DCMAKE_PREFIX_PATH="/home/moser/cp2k-9.1/tools/toolchain/install/openblas-0.3.19;/home/moser/cp2k-9.1/tools/toolchain/install/fftw-3.3.10"

Hello, thank you for your answer.
Here is the output after the cmake command:
make_output.log (12.3 KB)

I managed to install gromacs with the cmake command but when i try to use gm_cp2k command, the prompt tells me it does not exist.(i couldn’t attach the local.psmp file so here is a link of a google drive to download it, i will send it to you in private).

Best regards.

Mario

Please search for the executable file, that you have compiled. From your cmake log:

-- Using default binary suffix: "_mpi_d"
-- Using default library suffix: "_mpi_d"

Meaning that GROMACS executable should be gmx_mpi_d and not gmx_cp2k.
So you should add gmx_mpi_d path into the PATH environmental variable and use this name instead of gmx_cp2k everywhere

Thank you it worked.