User Tools

Site Tools


howto:install_with_plumed

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
howto:install_with_plumed [2014/09/30 12:44] – bugfix 130.60.136.214howto:install_with_plumed [2019/01/13 11:24] oschuett
Line 1: Line 1:
 ====== How to Compile and Install CP2K with PLUMED ====== ====== How to Compile and Install CP2K with PLUMED ======
  
 +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.
  
-The current svn version of cp2k is already prepared for compilation with PLUMED and contains all the relevant interface code (see www.cp2k.org) +To use plumed, insert the following in the FREE_ENERGY section of cp2k input file: 
-A modified version of PLUMED as well as some test input files can be found at: [[https://drive.google.com/folderview?id=0B2fydPxv8acJY0Noc3ZZVlR0ek0&usp=sharing]] +<code> 
-The files ''metadyn.h'' and ''metadyn.c'' are modified from the official plumed-1.3 release in order to provide additional routines called by cp2k, and a ''plumedpatch_cp2k'' script is added for easy installation.+&METADYN 
 +     USE_PLUMED .TRUE. 
 +     PLUMED_INPUT_FILE ./filename.inp 
 +&END METADYN 
 +</code>      
 + 
 +===== PLUMED 2.x ===== 
 + 
 +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: 
 + 
 +  * Download the PLUMED library from [[http://www.plumed.org/]], build and install following the instructions in the PLUMED documentation. 
 + 
 +  * Modify your CP2K arch file to include the following: 
 + 
 +<code> 
 +include /path/to/your/plumed2.0/installation/lib/plumed/src/lib/Plumed.inc 
 +EXTERNAL_OBJECTS=$(PLUMED_STATIC_DEPENDENCIES) 
 +</code> 
 + 
 +  * ''-D<nowiki>__</nowiki>PLUMED2'' should be added to your DFLAGS and ''-lz -ldl -lstdc++'' to your LIBS variable 
 +<note> 
 +If using OpenMPI, you will also need to add ''-lmpi_cxx -lrt'' to LIBS 
 +</note> 
 + 
 +  * It is also possible to build PLUMED as a shared library, in which case instead of using ''EXTERNAL_OBJECTS'' simply add ''-lplumed'' to the LIBS above. 
 + 
 +  * Finally, build the CP2K binaries as normal: 
 + 
 +<code> 
 +make -j ARCH=Linux-x86-64-gfortran VERSION=popt 
 +</code> 
 + 
 +===== PLUMED 1.3 ===== 
 + 
 +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/]]. 
 +The files ''metadyn.h'' and ''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. These files are also provided separately and can simply be copied into an existing plumed distribution.
  
Line 10: Line 47:
  
  
-get the latest version (newer than Sept. 2014) of cp2k from the svn repository+Get a version (between revisions 14363 / 30-Sep-2014 and 16584 / 04-Feb-2016) of cp2k from the git repository.
  
-    svn checkout svn://svn.code.sf.net/p/cp2k/code/trunk cp2k-code+<code> 
 +git clone https://github.com/cp2k/cp2k.git 
 +</code>
  
 +Unpack the modified plumed-1.3 archive somewhere (the metadyn.c/.h are already updated in that archive).
  
-unpack the modified plumed-1.3 archive somewhere (the metadyn.c/.h are already updated in that archive) +<code> 
-    tar xjfv plumed-1.3.tar.bz2+tar xjfv plumed-1.3.tar.bz2 
 +</code>
      
-set the environment variable $plumedir to the root directory of the plumed distribution +Set the environment variable ''$plumedir'' to the root directory of the plumed distribution.
-    export plumedir=/users/xyz/plumed-1.3        +
-   +
-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 +<code> 
-    ./plumedpatch_cp2k.sh -patch+export plumedir=/users/xyz/plumed-1.3        
 +</code>   
 + 
 +Change into the cp2k root directory and symlink the plumed/patches/plumedpatch_cp2k.sh there. 
 + 
 +<code> 
 +cd /users/xyz/cp2k-code/cp2k 
 +ln -s $plumedir/patches/plumedpatch_cp2k.sh ./ 
 +</code> 
 + 
 +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 
 + 
 +<code> 
 +./plumedpatch_cp2k.sh -patch 
 +</code>
                  
-Change into the src-plumed subdirectory; in the file ''makefile_for_plumed'' 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/popt. The directory 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. +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/ +<code> 
-    make -f makefile_for_cp2k+cd src-plumed/ 
 +make -f makefile_for_cp2k 
 +</code>
          
 Make sure the following lines are present in your ''ARCH'' file: Make sure the following lines are present in your ''ARCH'' file:
-    PLUMEDDIR            $(PWD)/../src-plumed +<code> 
-    PLUMEDINC            $(PLUMEDDIR)/plumed.inc +PLUMEDDIR            $(PWD)/../src-plumed 
-    include $(PLUMEDINC) +PLUMEDINC            $(PLUMEDDIR)/plumed.inc 
-    EXTERNAL_OBJECTS=$(OBJ_PLUMED) +include $(PLUMEDINC) 
-and ''-D__PLUMED_CP2K'' is specified among the ''DFLAGS''.+EXTERNAL_OBJECTS=$(OBJ_PLUMED) 
 +</code> 
 + 
 +''-D__PLUMED_CP2K'' should be specified among the ''DFLAGS'' and ''-lstdc++'' in the ''LIBS''
    
-Compile cp2k [only cp2k, not the other binaries of the package] as usual on your system    +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 +<code> 
-   +make -j ARCH=Linux-x86-64-gfortran-plumed VERSION=popt cp2k 
 +</code>    
 test (e.g. using the provided testinput) and run test (e.g. using the provided testinput) and run
  
-To use plumed, insert the following in the FREE_ENERGY section of a cp2k input file: +<note important>
-     &METADYN +
-          USE_PLUMED .TRUE. +
-          PLUMED_INPUT_FILE ./filename.inp +
-     &END METADYN +
- +
-<WRAP center round tip 60%>+
 Every time you want to rebuild cp2k you will have to go through the two-step procedure of making the plumed objects first, and then building cp2k. Every time you want to rebuild cp2k you will have to go through the two-step procedure of making the plumed objects first, and then building cp2k.
 When running the regtest scripts, be sure to use the option -nobuild, to avoid deleting the plumed objects before running the tests. When running the regtest scripts, be sure to use the option -nobuild, to avoid deleting the plumed objects before running the tests.
-</WRAP> +</note>
howto/install_with_plumed.txt · Last modified: 2020/08/21 10:15 by 127.0.0.1