CP2K is a program 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.
Load the CP2K module corresponding to the version you want to use. For instance
module load cp2k/2.3
Then run the launcher script, giving the input file as the first (and only) argument and redirect the output to desired output file.
cp2k.run inputfile.inp > outputfile.out
The runscript is influenced by the environment variable OMP_NUM_THREADS, which by default is set to 4. Setting this variable to 1 turns off OpenMP parallelism off entirely, while setting it to 16 on Triolith will maximise OpenMP parallelism and minimise node memory usage. This is done at the expense of time of execution. The default of 4 is set with respect to execution time and memory footprint only. Changing the OMP_NUM_THREADS variable can be done like
and can be set in the batch job sumission file before invoking the CP2K run script.
A minimum batch script for running CP2K looks like this:
#!/bin/bash #SBATCH -N 4 #SBATCH -t 4:00:00 #SBATCH -J jobname #SBATCH --exclusive #SBATCH -A SNIC-xxx-yyy module load cp2k/2.3 cp2k.run inputfile.inp > outputfile.out # This example assumes you submit this script from your working directory
(Note that you should edit the jobname, account number, number of nodes and requested walltime before submitting.)
Running your CP2K simulation in this manner will make use of all CPU cores accessible within your job. In the above example running on Triolith 4 * 16 CPU cores would be used, 16 MPI tasks à 4 OpenMP threads.