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  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.
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 = cp2kwhich specifies the engine we will use (here: cp2k).
cp2k = cp2kwhich specifies the CP2K executable. On your system, this might be named differently.
input_path = cp2k_inputwhich 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:
timestep = 0.5which is the time step to use in the CP2K simulations.
subcycles = 1which 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
/usr/share/cp2k). PyRETIS expects that all the files you list here are included in the
This specifies and selects the CP2K engine for use with PyRETIS. The full input file for the RETIS simulation is given below:
Retis 1D example ================ Simulation ---------- 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] System ------ 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 Initial-path ------------ method = kick kick-from = previous Orderparameter -------------- class = Distance index = (0, 1) periodic = True Output ------ order-file = 1 restart-file = 1 trajectory-file = 10
In order to run the RETIS simulation, the following steps are suggested:
Create a new folder for the simulation named
cp2k-hydrogenand enter this directory.
Create a new file
retis.rstwith the input settings for the simulation.
Download the input files given above and store them in a new directory named
Copy the extra files
GTH_POTENTIALSfrom your CP2K distribution and place them in the
Run the RETIS simulation using:
pyretisrun -i retis.rst -p