This a short tutorial on how to run I-PI with CP2K. i-PI is a Python interface for ab initio path integral molecular dynamics simulations. i-PI is composed of a Python server (i-pi itself, that does not need to be compiled but only requires a relatively recent version of Python and Numpy) that propagates the (path integral) dynamics of the nuclei, and of an external code that acts as a client and computes the electronic energy and forces. The i-PI manual can be found in {{:howto:i-pi-manual.pdf | i-PI Manual}} Please cite [[https://www.sciencedirect.com/science/article/abs/pii/S0010465518303436|Computer Physics Communications 236 (2019) 214–223]] and [[https://aip.scitation.org/doi/10.1063/1.4941091|J. Chem. Phys. 144, 054111 (2016)]] if you use I-PI with CP2K. Published work using I-PI with CP2K: [[https://pubs.acs.org/doi/10.1021/acs.jpclett.0c01025|J. Phys. Chem. Lett. 2020, 11, 9, 3724–3730]] [[https://www.pnas.org/content/116/4/1110.short | PNAS 01, 22, 2019 116 (4) 1110-1115 ]] [[https://www.nature.com/articles/s41467-021-20914-0 | Nature Communications 12, 766 (2021) ]] ===== Download i-PI from Github ===== git clone https://github.com/i-pi/i-pi.git To run i-PI, one need to source the environment file from the i-PI directory source ${PATH_TO_IPI}/env.sh Then one can run i-PI by using i-pi input.xml > log & There are many input examples in i-pi/examples/ folder, which contains different methods, e.g. NVE, NVT, NPT, PIMD, REMP, etc. ===== Run i-PI with INET socket ===== To use CP2K as the client code using an **internet** domain socket on the host address “host_address” and on the port number “port” the following lines must be added to its input file: &MOTION ... &DRIVER HOST host_address PORT port &END DRIVER ... &END MOTION In the **input.xml**, one need to use the same host_address and port to CP2K input.
host_address
port 0.01 5000
===== Run i-PI with UNIX socket ===== If instead a **unix** domain socket is required then the following modification is necessary: &MOTION ... &DRIVER HOST host_address PORT port UNIX &END DRIVER ... &END MOTION In the **input.xml**, one to specify the mode=unix to enable the communication via UNIX socket.
host_address
port 0.01 5000
===== Run I-PI with CP2K on a supercomputer ===== To run I-PI with CP2K on a supercomputer is also straightforward, one needs to get the hostname where the i-PI is executed, and then replace this variable in the CP2K input files. Here is an example script one can use to run I-PI with CP2K on the Daint machine (CSCS). HOST=$(hostname) source ~/i-pi/env.sh if [ -e simulation.restart ]; then sed -i "s/address>[^<]*$HOST> log.ipi 2>&1 & else sed -i "s/address>[^<]*$HOST log.ipi & fi sleep 5 sed -i "s/HOST.*/HOST $HOST/" cp2k.inp srun cp2k.psmp -i cp2k.inp -o cp2k.out wait