File: i-pi.md

package info (click to toggle)
cp2k 2025.2-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 372,060 kB
  • sloc: fortran: 963,262; ansic: 64,495; f90: 21,676; python: 14,419; sh: 11,382; xml: 2,173; makefile: 996; pascal: 845; perl: 492; cpp: 345; lisp: 297; csh: 16
file content (123 lines) | stat: -rw-r--r-- 3,220 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# i-PI

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 documentation can be found at <https://ipi-code.org>.

Please cite [](#Kapil2016) and [Kapil2018](https://doi.org/10.1016/j.cpc.2018.09.020) if you use
i-PI with CP2K.

Published work using i-PI with CP2K:

- [J. Phys. Chem. Lett. 2020, 11, 9, 3724–3730](https://doi.org/10.1021/acs.jpclett.0c01025)
- [PNAS 01, 22, 2019 116 (4) 1110-1115](https://doi.org/10.1073/pnas.1815117116)
- [Nature Communications 12, 766 (2021)](https://doi.org/10.1038/s41467-021-20914-0)

## Download i-PI from Github

```none
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

```none
source ${PATH_TO_IPI}/env.sh
```

Then one can run i-PI by using

```none
i-pi input.xml > log &
```

There are many input examples in
[i-pi examples folder](https://github.com/i-pi/i-pi/tree/master/examples), 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](#CP2K_INPUT.MOTION.DRIVER.HOST) address “host_address” and on the
[PORT](#CP2K_INPUT.MOTION.DRIVER.PORT) number “port” the following lines must be added to its input
file:

```none
&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.

```none
<ffsocket mode='inet' name='driver'>
  <address>host_address</address>
  <port>port</port>
  <latency>0.01</latency>
  <timeout>5000</timeout>
</ffsocket>
```

## Run i-PI with UNIX socket

If instead a [UNIX](#CP2K_INPUT.MOTION.DRIVER.UNIX) domain socket is required then the following
modification is necessary:

```none
&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.

```none
<ffsocket mode='unix' name='driver'>
  <address>host_address</address>
  <port>port</port>
  <latency>0.01</latency>
  <timeout>5000</timeout>
</ffsocket>
```

## 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).

```bash
HOST=$(hostname)

source ~/i-pi/env.sh

if [ -e simulation.restart ]; then
   sed -i "s/address>[^<]*</address>$HOST</" simulation.restart
   i-pi simulation.restart  >> log.ipi 2>&1 &
else
   sed -i "s/address>[^<]*</address>$HOST</" input.xml
   i-pi input.xml &> log.ipi &
fi
sleep 5

sed -i "s/HOST.*/HOST $HOST/" cp2k.inp

srun cp2k.psmp -i cp2k.inp -o cp2k.out

wait
```