# Troubles compiling GROMACS 2022 with CP2K 9.1

**URL:** <https://gromacs.bioexcel.eu/t/troubles-compiling-gromacs-2022-with-cp2k-9-1/3958>\
**Category:** User discussions\
**Tags:** installation-error\
**Created:** [April 5, 2022, 10:45pm UTC](https://gromacs.bioexcel.eu/t/troubles-compiling-gromacs-2022-with-cp2k-9-1/3958 "2022-04-05T22:45:42Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MarioMoser](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@MarioMoser](https://gromacs.bioexcel.eu/u/MarioMoser)\
**Post date:** [April 5, 2022, 10:45pm UTC](https://gromacs.bioexcel.eu/t/troubles-compiling-gromacs-2022-with-cp2k-9-1/3958/1 "2022-04-05T22:45:42Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dmorozov](https://avatars.discourse-cdn.com/v4/letter/d/dec6dc/32.png) [@dmorozov](https://gromacs.bioexcel.eu/u/dmorozov)\
**Post date:** [April 7, 2022, 4:33pm UTC](https://gromacs.bioexcel.eu/t/troubles-compiling-gromacs-2022-with-cp2k-9-1/3958/2 "2022-04-07T16:33:56Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![dmorozov](https://avatars.discourse-cdn.com/v4/letter/d/dec6dc/32.png) [@dmorozov](https://gromacs.bioexcel.eu/u/dmorozov)\
**Post date:** [April 7, 2022, 4:38pm UTC](https://gromacs.bioexcel.eu/t/troubles-compiling-gromacs-2022-with-cp2k-9-1/3958/3 "2022-04-07T16:38:12Z")

</div>

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"`

---

<div class="post-metadata">

**Author:** ![MarioMoser](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@MarioMoser](https://gromacs.bioexcel.eu/u/MarioMoser)\
**Post date:** [April 7, 2022, 10:58pm UTC](https://gromacs.bioexcel.eu/t/troubles-compiling-gromacs-2022-with-cp2k-9-1/3958/4 "2022-04-07T22:58:18Z")

</div>

Hello, thank you for your answer.  
Here is the output after the cmake command:  
[make\_output.log](https://gromacs.bioexcel.eu/uploads/short-url/3P8bwMwRMGZPgYrHUyMt3Pdz7Sd.log) (12.3 KB)

 ![gmx_cp2k_command](https://europe1.discourse-cdn.com/flex017/uploads/bioexcel1/original/2X/9/9c37e169328dbad611bd1f1ab67e276185c34412.png)

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

---

<div class="post-metadata">

**Author:** ![dmorozov](https://avatars.discourse-cdn.com/v4/letter/d/dec6dc/32.png) [@dmorozov](https://gromacs.bioexcel.eu/u/dmorozov)\
**Post date:** [April 8, 2022, 5:59am UTC](https://gromacs.bioexcel.eu/t/troubles-compiling-gromacs-2022-with-cp2k-9-1/3958/5 "2022-04-08T05:59:16Z")

</div>

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

```auto
-- 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

---

<div class="post-metadata">

**Author:** ![MarioMoser](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@MarioMoser](https://gromacs.bioexcel.eu/u/MarioMoser)\
**Post date:** [April 9, 2022, 6:38pm UTC](https://gromacs.bioexcel.eu/t/troubles-compiling-gromacs-2022-with-cp2k-9-1/3958/6 "2022-04-09T18:38:02Z")

</div>

Thank you it worked.
