Dissociation of Hydrogen with CP2K

In this example, we are going to study dissociation of hydrogen using CP2K. The goal of this example is to show how CP2K can be interfaced with PyRETIS for a relatively simple system.

In this example, we will make use of CP2K [1] for running the dynamics. The example is structured as follows:

The order parameter we will consider in this example will just be given by the distance between the two hydrogen atoms.

Creating the PyRETIS input file

The input file for PyRETIS follows the structure we have used in the previous examples and we will not go into details about all sections here. In the following, we will just describe the section for using the CP2K engine in more detail. The full input file for the RETIS simulation is given at the end of this section.

In order to make use of CP2K, we add the following engine section to the input file:

Engine settings
class = cp2k
cp2k = cp2k
input_path = cp2k_input
timestep = 0.5
subcycles = 1
extra_files = ['BASIS_SET', 'GTH_POTENTIALS']

Here, we make use of the following keywords:

  • class = cp2k which specifies the engine we will use (here: cp2k).
  • cp2k = cp2k which specifies the CP2K executable. On your system, this might be named differently.
  • input_path = cp2k_input which specifies the directory where PyRETIS will look for the input files for CP2K. PyRETIS assumes that, at least, the following files are in this folder:
    1. initial.xyz which contain the initial configuration. This file can be downloaded here: initial.xyz.
    2. cp2k.inp which contains the settings for the CP2K simulation. This file can be downloaded here: cp2k.inp.
  • timestep = 0.5 which is the time step to use in the CP2K simulations.
  • subcycles = 1 which is the number of subcycles CP2K will complete before PyRETIS re-calculates the order parameter.
  • extra_files = ['BASIS_SET', 'GTH_POTENTIALS'] which contain extra files CP2K will need in order to execute. Here, we are using two files to define the basis set and the potential functions. These files are part of the CP2K distribution and can be found in the folder $CP2K_HOME/data/ (or /usr/share/cp2k). PyRETIS expects that all the files you list here are included in the cp2k_input directory.

This specifies and selects the CP2K engine for use with PyRETIS. The full input file for the RETIS simulation is given below:

Show/hide the input file for the CP2K simulation. »

Retis 1D example

task = retis
steps = 100
interfaces = [0.78, 0.80, 0.82, 0.84, 0.86, 0.87, 0.88, 0.90, 0.92, 0.95]

units = cp2k

Engine settings
class = cp2k
cp2k = cp2k
input_path = cp2k_input
timestep = 0.5
subcycles = 1
extra_files = ['BASIS_SET', 'GTH_POTENTIALS']

TIS settings
freq = 0.5
maxlength = 20000
aimless = True
allowmaxlength = False
zero_momentum = False
rescale_energy = False
sigma_v = -1
seed = 0

RETIS settings
swapfreq = 0.5
relative_shoots = None
nullmoves = True
swapsimul = True

method = kick
kick-from = previous

class = Distance
index = (0, 1)
periodic = True

order-file = 1
restart-file = 1
trajectory-file = 10

Running the RETIS simulation with PyRETIS

In order to run the RETIS simulation, the following steps are suggested:

  1. Create a new folder for the simulation named cp2k-hydrogen and enter this directory.

  2. Create a new file retis.rst with the input settings for the simulation.

  3. Download the input files given above and store them in a new directory named cp2k_input.

  4. Copy the extra files BASIS_SET and GTH_POTENTIALS from your CP2K distribution and place them in the cp2k_input folder.

  5. Run the RETIS simulation using:

    pyretisrun -i retis.rst -p