Skip to content

CP2K

CP2K is a quantum chemistry and solid state physics software package that can perform atomistic simulations of solid state, liquid, molecular, periodic, material, crystal, and biological systems.

CP2K is available as a module on Apocrita.

Use Spack for additional variants

Simple variants of CP2K have been installed by the Apocrita ITSR Apps Team. Advanced users may want to self-install their own additional variants via Spack.

Versions

Regular and GPU accelerated versions have been installed on Apocrita.

Usage

To run the required version, load one of the following modules:

  • For CP2K (non-GPU), load cp2k/<version>
  • For GPU accelerated CP2K versions, load cp2k-gpu/<version>

To run the default installed version of CP2K, simply load the cp2k module:

$ module load cp2k
$ cp2k.psmp -h
Usage:
cp2k.psmp -h

 cp2k.psmp [-c|--check] [-e|--echo] [-h|--help]
           [-i] <input_file>
           [-mpi-mapping|--mpi-mapping] <method>
           [-o] <output_file>
           [-r|-run] [-s|--shell] [--xml]

For full usage documentation, run cp2k.psmp -h.

Example jobs

Serial CPU jobs

Here is an example job running on 1 core and 1GB of memory:

#!/bin/bash
#$ -pe smp 1
#$ -l h_vmem=1G
#$ -cwd
#$ -j y
#$ -l h_rt=1:0:0

module load cp2k

cp2k.psmp -i myinput.inp -o myoutput.out

Here is an example job running on 4 cores and 4GB memory:

Core Usage

For serial multi-core jobs, the cp2k modules will automatically export the $OMP_NUM_THREADS environment variable to match your core request and automatically thread your job correctly using OpenMP. There is no need for any additional threading arguments.

#!/bin/bash
#$ -pe smp 4
#$ -l h_vmem=1G
#$ -cwd
#$ -j y
#$ -l h_rt=1:0:0

module load cp2k

cp2k.psmp -i myinput.inp -o myoutput.out

Parallel CPU job

Core Usage

To ensure that cp2k parallel jobs use the correct number of cores, you must use mpirun -n ${NSLOTS} in your job scripts as detailed below.

Here is an example job running on 96 cores across 2 ddy nodes with MPI:

#!/bin/bash
#$ -pe parallel 96
#$ -l infiniband=ddy-i
#$ -cwd
#$ -j y
#$ -l h_rt=240:0:0
#$ -l exclusive

module load cp2k

mpirun -n ${NSLOTS} cp2k.psmp -i myinput.inp -o myoutput.out

GPU job

Here is an example job running on 1 GPU:

Core Usage

For GPU jobs, the cp2k modules will automatically export the $OMP_NUM_THREADS environment variable to match your core request and automatically thread your job correctly using OpenMP. There is no need for any additional threading arguments.

#!/bin/bash
#$ -pe smp 8
#$ -l h_vmem=7.5G
#$ -l gpu=1
#$ -cwd
#$ -j y
#$ -l h_rt=240:0:0

# Load a GPU compatible version of CP2K
module load cp2k-gpu

cp2k.psmp -i myinput.inp -o myoutput.out

References