Software - Application programs: CP2K

CP2K

Policy

CP2K is freely available to users at HPC2N.

General

CP2K is a freely available program to perform atomistic and molecular simulations of solid state, liquid, molecular and biological systems.

Description

CP2K is a freely available (GPL) program, written in Fortran 95, to perform atomistic and molecular simulations of solid state, liquid, molecular and biological systems. It provides a general framework for different methods such as e.g. density functional theory (DFT) using a mixed Gaussian and plane waves approach (GPW), and classical pair and many-body potentials.

CP2K provides state-of-the-art methods for efficient and accurate atomistic simulations, sources are freely available and actively improved.

It can be compiled for different platforms and compilers, and for serial, MPI, OpenMP, and hybrid MPI/OpenMP jobs. 

Availability

On HPC2N we have CP2K available as a module on Akka. Binaries are compiled for serial, MPI, and OpenMP, and hybrid OpenMP/MPI.

Usage at HPC2N

To use the cp2k module, add it to your environment:

module add cp2k

Loading the module should set any needed environmental variables as well as the path. 

In order to run a case, you should stand inside the case directory in order to be able to read any data files (parameters etc.) associated with the input-file.

Examples can be found in $CP2K_EXAMPLES.

Serial

While standing in your case directory, run

cp2k.sopt <yourfile.inp>.

MPI

MPI-jobs should be run as batch-jobs. The executable is named

cp2k.popt

Make a batch-script similar to this example:

#!/bin/bash
# Project to run under
#PBS -A SNICXXX-YY-ZZ
# Name of job script 
#PBS -N My_CP2K_job
# name of the output file
#PBS -o My_CP2K_job.out
# name of the error file
#PBS -e My_CP2K_job.err
# when to send email
#PBS -m ae

# asking for 1 node, 8 processors 
#PBS -l nodes=1:ppn=8
# the job may to use up to 30 minutes to run
#PBS -l walltime=00:30:00

# change to the directory the job was submitted from
cd $PBS_O_WORKDIR

# Load the CP2K module 
module load cp2k 

# run the job
mpiexec cp2k.popt <yourfile.inp>

Submit it with

qsub <jobscript>

where <jobscript> is the name you give your batch-script. Remember to submit from your case-directory.

OpenMP

The executable is named

cp2k.ssmp

You should use a jobscript to run the program. Write a script similar to this example:

#!/bin/bash
# Project to run under. Change to actual project number; delete if not needed 
#PBS -A SNICXXX-YY-ZZ
# Job name - makes it easier to find in the list of running jobs
#PBS -N My_OpenMP_Job 
# name of the output file
#PBS -o myjob.out
# name of the error file
#PBS -e myjob.err
# when to send email
#PBS -m ae

# asking for 1 node (and thus all processors on it)
#PBS -l nodes=1
# the job can run for up to 1 hour
#PBS -l walltime=1:00:00

# memory requirements, physical memory (pmem) >= 1900 mb and <= 15900/(#processors)mb 
# virtual + physical memory  (pvmem) >= 2000 mb and <= 16000/(#processors)mb
# defaults to pmem=1900 and pvmem=2000
#PBS -l pmem=15800mb
#PBS -l pvmem=16000mb

# change to the directory the job was submitted from 
cd $PBS_O_WORKDIR

# load the CP2K module
module load cp2k 

# set the number of threads for the OpenMP script (set threads to between 1 and 8)
export OMP_NUM_THREADS=4
 
# run the job
cp2k.ssmp <yourfile.inp> 

Submit the job-script with

qsub <jobscript>

Remember to submit from your case-directory.

Hybrid OpenMP/MPI

Hybrid jobs should be run as batch-jobs. The executable is named

cp2k.psmp

Make a batch-script similar to this example:

#!/bin/bash
# Project to run under
#PBS -A SNICXXX-YY-ZZ
# Name of job script 
#PBS -N My_hybrid_CP2K_job
# name of the output file
#PBS -o My_hybrid_CP2K_job.out
# name of the error file
#PBS -e My_hybrid_CP2K_job.err
# when to send email
#PBS -m ae

# asking for 1 node (and so all processors on it)
#PBS -l nodes=1
# the job may to use up to 30 minutes to run
#PBS -l walltime=00:30:00

# memory requirements, physical memory (pmem) >= 1900 mb and <= 15900/(#processors)mb 
# virtual + physical memory  (pvmem) >= 2000 mb and <= 16000/(#processors)mb
# defaults to pmem=1900 and pvmem=2000
#PBS -l pmem=15800mb
#PBS -l pvmem=16000mb

# change to the directory the job was submitted from
cd $PBS_O_WORKDIR

# Load the CP2K module 
module load cp2k 

# set the number of threads for the OpenMP script (set threads to between 1 and 8)
export OMP_NUM_THREADS=4

# run the job
mpiexec cp2k.psmp <yourfile.inp>

Submit it with

qsub <jobscript>

where <jobscript> is the name you give your batch-script. Remember to submit from your case-directory.

Additional info

You can get more information about various flags (for instances, setting input and output files), by running

$ cp2k.sopt -help
$ cp2k.popt -help
$ cp2k.ssmp -help
$ cp2k.psmp -help

There are some examples and tutorials to be found on the CP2K homepage.

There is a discussion forum and some User (self) support under Google groups (requires a Google account to login).