CP2K supports the current (2.x) versions of PLUMED. PLUMED 1.3 support is available in CP2K releases 2.4 up to 3.0. Please scroll down to the relevant set of instructions depending on which version you wish to use.
To use plumed, insert the following in the FREE_ENERGY section of a cp2k input file:
&METADYN USE_PLUMED .TRUE. PLUMED_INPUT_FILE ./filename.inp &END METADYN
CP2K may be used with PLUMED version 2.x without requiring source code patches - the interface to PLUMED is already included in CP2K in version 2.7 (rev 15615 or later). To build a version of CP2K with PLUMED 2 follow the instructions below:
include /path/to/your/plumed2.0/installation/lib/plumed/src/lib/Plumed.inc EXTERNAL_OBJECTS=$(PLUMED_STATIC_DEPENDENCIES)
-D__PLUMED2should be added to your DFLAGS and
-lz -ldl -lstdc++to your LIBS variable
-lmpi_cxx -lrtto LIBS
-lplumedto the LIBS above.
make -j ARCH=Linux-x86-64-gfortran VERSION=popt
CP2K is already prepared for compilation with PLUMED and contains all the relevant interface code.
A modified version of PLUMED as well as some test input files can be found at: http://www.cp2k.org/static/downloads/plumed/.
metadyn.c are modified from the official plumed-1.3 release in order to provide additional routines called by cp2k, and a
plumedpatch_cp2k.sh script is added for easy installation.
These files are also provided separately and can simply be copied into an existing plumed distribution.
The following instructions describe how to install/compile PLUMED with cp2k.
Get a version (between revisions 14363 / 30-Sep-2014 and 16584 / 04-Feb-2016) of cp2k from the git repository.
git clone https://github.com/cp2k/cp2k.git
Unpack the modified plumed-1.3 archive somewhere (the metadyn.c/.h are already updated in that archive).
tar xjfv plumed-1.3.tar.bz2
Set the environment variable
$plumedir to the root directory of the plumed distribution.
Change into the cp2k root directory and symlink the plumed/patches/plumedpatch_cp2k.sh there.
cd /users/xyz/cp2k-code/cp2k ln -s $plumedir/patches/plumedpatch_cp2k.sh ./
Run the plumedpatch_cp2k script with parameter -patch, it should create a subdirectory src-plumed containing a number of cpp files and a plumed.inc .
Change into the src-plumed subdirectory; in the file
makefile_for_cp2k change the parameter
OBJDIR to the directory where all the cp2k objects will be built. It should be something like
../obj/Linux-x86-64-gfortran. Also set the
VERSION to e.g.
popt. These variables should march the
ARCH file you will use to build cp2k. The directory
$(OBJDIR)/$(VERSION) has to exist, even before building cp2k, so you might have to create it. You may also have to change other makefile settings depending on your local set-up.
cd src-plumed/ make -f makefile_for_cp2k
Make sure the following lines are present in your
PLUMEDDIR = $(PWD)/../src-plumed PLUMEDINC = $(PLUMEDDIR)/plumed.inc include $(PLUMEDINC) EXTERNAL_OBJECTS=$(OBJ_PLUMED)
-D__PLUMED_CP2K should be specified among the
-lstdc++ in the
Compile cp2k [only cp2k, not the other binaries of the package] as usual on your system
make -j ARCH=Linux-x86-64-gfortran-plumed VERSION=popt cp2k
test (e.g. using the provided testinput) and run