Updated 2020-07-23

Run CP2K on the Cluster (Currently Hive Only)

Overview

  • 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.
  • This guide will cover how to run CP2K with a batch script on the cluster.
  • Here is a link to CP2K's homepage that can provide more information.

Tips

  • Here is a link to the manual provided by CP2K to give more information on different functions.
  • You can find more exercises and examples other than the one covered in this guide here.

Walkthrough: Run CP2K on the Cluster

  • In this example, we will illustrate how to relax the structure of a system (without changing the cell dimensions) using the relaxation of a water molecule as an example.
  • This example is directly taken from an exercise posted on CP2K's website. You can visit the link for more information about what each section in the input file means.
  • Some of the files needed for this example are stored inside the cp2k module. You can copy those files to your current directory with the following command after first loading the cp2k module:
module load cp2k
cp $(dirname $(which cp2k.popt))/../share/data/{BASIS_SET,POTENTIAL} .
  • A basic H2O.inp input file can be found here
  • The PBS Script can be found here
  • You can transfer the files to your account on the cluster to follow along. The file transfer guide may be helpful.

Part 1: The PBS Script

#!/bin/bash
#PBS -N cp2kTest
#PBS -l nodes=1:ppn=24
#PBS -l walltime=15:00
#PBS -q hive-all
#PBS -j oe
#PBS -o cp2kTest.out

cd $PBS_O_WORKDIR

module load cp2k/6.1-mva2

mpirun cp2k.popt -o H2O.out H2O.inp

  • The #PBS directives request 15 minutes of walltime with 1 node and 24 cores. More on #PBS directives can be found in the PBS guide
  • $PBS_O_WORKDIR is a variable that represents the directory you submit the PBS script from. Make sure the files you want to use are in the same directory you put the PBS script.
  • Output Files will also show up in this directory as well.
  • module load cp2k/6.1-mva2 loads the 6.1 version of CP2K. To see what CP2K versions are available, run module spider cp2k, and load the one you want. The other modules are dependencies for the cp2k module and must be loaded prior to loading the cp2k module.
  • cp2k.popt -o H2O.out H2O.inp & passes the H2O.inp input file to the cp2k.popt function to run the program.

Part 2: Submit Job and Check Status

  • Make sure you're in the dir that contains the PBS Script as well as the CP2K program
  • Submit as normal, with qsub <pbs script name>. In this case qsub cp2kTest.pbs
  • Check job status with qstat -t 22182721, replacing the number with the job id returned after running qsub.
  • You can delete the job with qdel 22182721, again replacing the number with the jobid returned after running qsub.

Part 3: Collecting Results

  • In the directory where you submitted the PBS script, you should see the following files generated from the job:

    • H2O.out
    • H2O-pos-1.xyz
    • H2O-1.restart
    • H2O-1.restart.bak-1
    • H2O-1.restart.bak-2
    • H2O-1.restart.bak-3
  • Use cat or open the file in a text editor to take a look.

  • You can compare your copies of the files to the ones found here
  • After the result files are produced, you can move the files off the cluster, refer to the file transfer guide for help.
  • Congratulations! You successfully ran CP2K on the cluster.