Skip to content

CP2K

CP2K is a quantum chemistry and solid-state physics package specializing in atomistic simulations with DFT (mixed Gaussian and plane-wave approach), ab initio molecular dynamics, and classical force field methods.

Loading the module

module load CP2K/2024.3-foss-2024a

To see all installed versions across clusters, check the software catalog or run module spider CP2K.

Expand to see all available modules on each cluster
CP2K/2023.1-foss-2022b CP2K/2023.2-foss-2022b CP2K/2024.1-foss-2023a
CP2K/2024.3-foss-2023a CP2K/9.1-foss-2022a
CP2K/2023.1-intel-2022a CP2K/2023.2-foss-2022b CP2K/6.1-intel-2020a
CP2K/7.1-intel-2020a CP2K/9.1-intel-2021a CP2K/9.1-intel-2021a-CUDA-11.2.1
CP2K/9.1-intel-2021a-CUDA-11.3.1
CP2K/2023.2-foss-2022b CP2K/2023.2-foss-2022b-kovaltasha CP2K/2024.3-foss-2023a
CP2K/4.1-intel-2017a CP2K/5.1-intel-2017b CP2K/9.1-intel-2021a

Batch job example

cp2k.slurm
#!/bin/bash
#SBATCH --qos=regular
#SBATCH --job-name=cp2k
#SBATCH --nodes=2
#SBATCH --ntasks-per-node=48
#SBATCH --cpus-per-task=1
#SBATCH --mem=200G
#SBATCH --time=24:00:00
#SBATCH --output=%x.%j.out
#SBATCH --error=%x.%j.err

module load CP2K/2024.3-foss-2024a

srun cp2k.popt -i input.inp

Hybrid MPI+OpenMP

For calculations with large grids or many atoms, hybrid parallelism can improve performance. Set --cpus-per-task to the desired number of threads and adjust --ntasks-per-node accordingly:

#SBATCH --ntasks-per-node=12
#SBATCH --cpus-per-task=4

export OMP_NUM_THREADS=${SLURM_CPUS_PER_TASK}
srun cp2k.psmp -i input.inp

Use cp2k.psmp (MPI+OpenMP) instead of cp2k.popt (MPI-only) for hybrid runs.

Restarting calculations

CP2K writes restart files (.restart) automatically during a run. To continue an interrupted calculation:

  1. Ensure the .restart and wavefunction (.wfn) files from the previous run are in the working directory.

  2. In your input file, enable restart in the relevant sections:

    &MOTION
      &MD
        RESTART .TRUE.
      &END MD
    &END MOTION
    
    &EXT_RESTART
      RESTART_FILE_NAME my_calculation-1.restart
    &END EXT_RESTART
    
  3. For electronic structure restarts, point the SCF section to the saved wavefunction:

    &SCF
      SCF_GUESS RESTART
    &END SCF
    

Tip

Test a restart with a short run before committing to a long job to verify all file paths are correct.

See also