Problems with CP2K+PLUMED build

After successfully building local.psmp architecture of CP2K, I tried to install CP2K+PLUMED.  This failed, as I describe below.

1) I built PLUMED from source without errors, using the standard procedure:

     ./configure –prefix=/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe
     make
     make install

2) I created an architecture file local_PLUMED.psmp file by modifying local.psmp, with these changes , following the instructions on the cp2k.org website

a) lines added at the top

     include /storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/lib/plumed/src/lib/Plumed.inc
     EXTERNAL_OBJECTS=$(PLUMED_STATIC_DEPENDENCIES)

b) added  -D__PLUMED2 to DFLAGS

c) added  -lz -ldl -lstdc++ to LIBS

d) I am not using OPENMPI, so I did not add -lmpi_cxx -lrt to LIBS

3) Then the make command

     make ARCH=local_PLUMED VERSION=psmp

fails, with errors in which components of PLUMED are not found:

/storage/group/stm9/default/SOFTWARE/cp2k-2023.1-intel/lib/local_PLUMED/psmp/libcp2kmain.a(metadynamics.o): In function `metadynamics_mp_metadyn_finalise_plumed_’:
/storage/group/stm9/default/SOFTWARE/cp2k-2023.1-intel/src/metadynamics.F:208: undefined reference to `plumed_gfinalize’
/storage/group/stm9/default/SOFTWARE/cp2k-2023.1-intel/lib/local_PLUMED/psmp/libcp2kmain.a(metadynamics.o): In function `metadynamics_mp_metadyn_integrator_’:
/storage/group/stm9/default/SOFTWARE/cp2k-2023.1-intel/src/metadynamics.F:299: undefined reference to `plumed_gcmd’
/storage/group/stm9/default/SOFTWARE/cp2k-2023.1-intel/src/metadynamics.F:300: undefined reference to `plumed_gcmd’
/storage/group/stm9/default/SOFTWARE/cp2k-2023.1-intel/src/metadynamics.F:301: undefined reference to `plumed_gcmd’
/storage/group/stm9/default/SOFTWARE/cp2k-2023.1-intel/src/metadynamics.F:302: undefined reference to `plumed_gcmd’
/storage/group/stm9/default/SOFTWARE/cp2k-2023.1-intel/src/metadynamics.F:303: undefined reference to `plumed_gcmd’
/storage/group/stm9/default/SOFTWARE/cp2k-2023.1-intel/lib/local_PLUMED/psmp/libcp2kmain.a(metadynamics.o):/storage/group/stm9/default/SOFTWARE/cp2k-2023.1-intel/src/metadynamics.F:304: more undefined references to `plumed_gcmd’ follow

But the directory

/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/lib/plumed/src/lib/

does contain Plumed.inc, with the following contents:

PLUMED_RUNTIME_LOAD= “/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/lib/libplumedWrapper.a” -ldl
PLUMED_STATIC_LOAD= “/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/lib/libplumed.a” -ldl  -lstdc++ -lz -ldl   -rdynamic -Wl,-Bsymbolic -fopenmp
PLUMED_SHARED_LOAD= “/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/lib/libplumed.so” -ldl
PLUMED_RUNTIME_DEPENDENCIES=
PLUMED_STATIC_DEPENDENCIES= “/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/lib/libplumed.a”
PLUMED_SHARED_DEPENDENCIES= “/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/lib/libplumed.so”
PLUMED_FORTRAN= “/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/lib/plumed/fortran/plumed.f90”
PLUMED_FORTRAN08= “/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/lib/plumed/fortran/plumed_f08.f90”

And the directory 
/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/lib 

does contain the library libplumed.a;
and libplumed.a does contain the object PlumedStatic.o;
and PlumedStatic.o does contain the missing items:

(base) [stm9@submit03 lib]$ nm PlumedStatic.o | grep plumed_gcmd
0000000000000eb0 T plumed_gcmd
0000000000000ed0 T plumed_gcmd_safe
(base) [stm9@submit03 lib]$ nm PlumedStatic.o | grep plumed_gfinalize
0000000000000ee0 T plumed_gfinalize

I have tried modifying local_PLUMED.psmp, by
adding -L/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/lib to LIBS;
adding -I/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/include to CFLAGS and FCFLAGS;

and adding -L/storage/home/stm9/group/SOFTWARE/plumed-2.8.2/exe/lib to LDFLAGS;
with exactly the same errors resulting.

Read more here: Source link