CP2K on Ubuntu
This guide will help the user understand how to compile, install, and use CP2K on their own Ubuntu workstation. If you are using another platform, please refer to the appropriate documentation or contact Benjamin Alldritt for assistance.
Step-by-step guide
Package Installation
Ubuntu 14.04 (version 2.4)
Install CP2K
sudo apt-get install cp2kRun CP2K
cp2k.popt <input_file>
Ubuntu 12.04 and 14.04 (version 2.5.1)
Edit the APT sources file:
nano /etc/apt/sources.list
# Append this text to the bottom of the sources.list file
deb http://se.archive.ubuntu.com/ubuntu utopic main universeUpdate the repository cache
sudo apt-get updateInstall CP2K
sudo apt-get install cp2kRun CP2K
cp2k.popt <input_file>
Compile Installation
To compile CP2K, you will need the following software:
- FORTRAN compiler (gfortran)
- C compiler (gcc)
- MPI
- ATLAS
- BLAS
- FFTW
- SSM
- Scalapack
- Python
- Libxc
- Libint
Ubuntu 12.04
Install the required packages:
sudo apt-get install gfortran libfftw3-dev libatlas-base-dev libmpich2-dev python libssm-dev libscalapack-mpi-devDownload the latest version of the CP2K source and unpack into a new directory.
mkdir ${HOME}/software
mkdir ${HOME}/software/cp2k
cd ${HOME}/software/cp2k
wget http://sourceforge.net/projects/cp2k/files/latest/download
tar -xvjf cp2k-X.X.X.tar.bz2
cd cp2k-X.X.X/makefilesCreate a Linux-x86-64-gfortran.popt file.
CC = cc
CPP =
FC = mpif90
LD = mpif90
AR = ar -r
FFTW_INC = /usr/include
FFTW_LIB = /usr/lib
DFLAGS = -D__GFORTRAN -D__FFTSG -D__FFTW3\
-D__MAX_CONTR=4\
-D__parallel -D__BLACS -D__SCALAPACK
CPPFLAGS =
FCFLAGS = $(DFLAGS) -O2 -ffast-math -ffree-form -ffree-line-length-none\
-ftree-vectorize -funroll-loops\
-mtune=native\
-I$(FFTW_INC)
LDFLAGS = $(FCFLAGS) -static-libgfortran
LIBS = -lscalapack-openmpi \
-lblacsF77init-openmpi -lblacs-openmpi \
-lfftw3 \
-llapack \
-lblasCompile CP2K.
make -j 4 ARCH=Linux-x86-64-gfortran VERSION=poptRun CP2K after the tests pass.
./exe/cp2k.popt <input_file>
Ubuntu 14.04
Install the required packages:
sudo apt-get install gfortran libfftw3-dev libatlas-base-dev libmpich2-dev python libxc-dev libint-dev libssm-dev libscalapack-mpi-devDownload the latest version of the CP2K source and unpack into a new directory.
mkdir ${HOME}/software
mkdir ${HOME}/software/cp2k
cd ${HOME}/software/cp2k
wget http://sourceforge.net/projects/cp2k/files/latest/download
tar -xvjf cp2k-X.X.X.tar.bz2
cd cp2k-X.X.X/makefilesCreate a Linux-x86-64-gfortran.popt file.
CC = cc
CPP =
FC = mpif90
LD = mpif90
AR = ar -r
FFTW_INC = /usr/include
FFTW_LIB = /usr/lib
LIBINT_INC = /usr/include
LIBINT_LIB = /usr/lib
LIBXC_INC = /usr/include
LIBXC_LIB = /usr/lib
DFLAGS = -D__GFORTRAN -D__FFTSG -D__FFTW3 -D__LIBINT -D__LIBXC2\
-D__LIBINT_MAX_AM=7 -D__LIBDERIV_MAX_AM1=6 -D__MAX_CONTR=4\
-D__parallel -D__BLACS -D__SCALAPACK
CPPFLAGS =
FCFLAGS = $(DFLAGS) -O2 -ffast-math -ffree-form -ffree-line-length-none\
-ftree-vectorize -funroll-loops\
-mtune=native\
-I$(FFTW_INC) -I$(LIBINT_INC) -I$(LIBXC_INC)
LDFLAGS = $(FCFLAGS) -static-libgfortran
LIBS = -lscalapack-openmpi \
-lblacsF77init-openmpi -lblacs-openmpi \
-lfftw3 \
-llapack \
-lblas \
-lxc \
-lderiv \
-lintCompile CP2K.
make -j 4 ARCH=Linux-x86-64-gfortran VERSION=poptRun CP2K after the tests pass.
./exe/cp2k.popt <input_file>
Related articles
Reference instructions for Ubuntu 12.04 - https://groups.google.com/forum/#!topic/cp2k/fwY_KCZ2JNY
Unknown macro: contentbylabel. Click on this message for details.