ipi 2.6.0__tar.gz → 3.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (181) hide show
  1. {ipi-2.6.0 → ipi-3.0}/PKG-INFO +42 -25
  2. {ipi-2.6.0 → ipi-3.0}/README.md +41 -24
  3. {ipi-2.6.0 → ipi-3.0}/bin/i-pi +5 -2
  4. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-committee-reweight +33 -17
  5. ipi-3.0/bin/i-pi-driver-py +244 -0
  6. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-planetary +0 -1
  7. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-py_driver +32 -6
  8. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-remdsort +9 -3
  9. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-tests +6 -6
  10. {ipi-2.6.0 → ipi-3.0}/drivers/py/driver.py +32 -6
  11. ipi-3.0/drivers/py/pes/__init__.py +36 -0
  12. ipi-3.0/drivers/py/pes/ase.py +85 -0
  13. ipi-3.0/drivers/py/pes/bath.py +74 -0
  14. ipi-3.0/drivers/py/pes/doubledoublewell.py +136 -0
  15. ipi-3.0/drivers/py/pes/doublewell.py +82 -0
  16. ipi-3.0/drivers/py/pes/doublewell_with_bath.py +101 -0
  17. ipi-3.0/drivers/py/pes/doublewell_with_friction.py +109 -0
  18. ipi-3.0/drivers/py/pes/driverdipole.py +269 -0
  19. {ipi-2.6.0 → ipi-3.0}/drivers/py/pes/dummy.py +13 -2
  20. ipi-3.0/drivers/py/pes/elphmod.py +32 -0
  21. ipi-3.0/drivers/py/pes/harmonic.py +51 -0
  22. ipi-3.0/drivers/py/pes/mace.py +40 -0
  23. ipi-3.0/drivers/py/pes/metatensor.py +94 -0
  24. ipi-3.0/drivers/py/pes/pet.py +103 -0
  25. {ipi-2.6.0 → ipi-3.0}/drivers/py/pes/rascal.py +12 -10
  26. ipi-3.0/drivers/py/pes/spline.py +119 -0
  27. ipi-3.0/ipi/__init__.py +19 -0
  28. {ipi-2.6.0 → ipi-3.0}/ipi/engine/atoms.py +29 -28
  29. {ipi-2.6.0 → ipi-3.0}/ipi/engine/barostats.py +174 -161
  30. {ipi-2.6.0 → ipi-3.0}/ipi/engine/beads.py +46 -28
  31. {ipi-2.6.0 → ipi-3.0}/ipi/engine/cell.py +8 -8
  32. {ipi-2.6.0 → ipi-3.0}/ipi/engine/ensembles.py +50 -31
  33. {ipi-2.6.0 → ipi-3.0}/ipi/engine/forcefields.py +224 -149
  34. {ipi-2.6.0 → ipi-3.0}/ipi/engine/forces.py +370 -255
  35. {ipi-2.6.0 → ipi-3.0}/ipi/engine/initializer.py +5 -13
  36. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/__init__.py +1 -0
  37. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/al6xxx_kmc.py +3 -3
  38. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/alchemy.py +10 -9
  39. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/atomswap.py +9 -8
  40. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/constrained_dynamics.py +25 -21
  41. ipi-3.0/ipi/engine/motion/driven_dynamics.py +408 -0
  42. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/dynamics.py +80 -92
  43. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/geop.py +11 -13
  44. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/instanton.py +803 -409
  45. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/motion.py +7 -8
  46. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/multi.py +6 -5
  47. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/phonons.py +6 -9
  48. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/planetary.py +4 -4
  49. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/replay.py +4 -3
  50. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/scphonons.py +9 -10
  51. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/stringmep.py +1 -1
  52. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/vscf.py +21 -21
  53. {ipi-2.6.0 → ipi-3.0}/ipi/engine/normalmodes.py +341 -233
  54. {ipi-2.6.0 → ipi-3.0}/ipi/engine/outputs.py +76 -32
  55. {ipi-2.6.0 → ipi-3.0}/ipi/engine/properties.py +284 -59
  56. {ipi-2.6.0 → ipi-3.0}/ipi/engine/simulation.py +41 -34
  57. {ipi-2.6.0 → ipi-3.0}/ipi/engine/smotion/metad.py +1 -2
  58. {ipi-2.6.0 → ipi-3.0}/ipi/engine/smotion/remd.py +2 -2
  59. {ipi-2.6.0 → ipi-3.0}/ipi/engine/smotion/smotion.py +1 -3
  60. {ipi-2.6.0 → ipi-3.0}/ipi/engine/system.py +3 -10
  61. {ipi-2.6.0 → ipi-3.0}/ipi/engine/thermostats.py +160 -147
  62. {ipi-2.6.0 → ipi-3.0}/ipi/external/importlib/bundledimportlib.py +1 -0
  63. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/__init__.py +1 -0
  64. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/atoms.py +0 -1
  65. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/barostats.py +0 -1
  66. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/beads.py +0 -1
  67. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/cell.py +16 -2
  68. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/ensembles.py +0 -1
  69. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/forcefields.py +57 -7
  70. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/forces.py +3 -5
  71. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/initializer.py +3 -16
  72. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/interface.py +12 -2
  73. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/alchemy.py +0 -1
  74. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/atomswap.py +0 -1
  75. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/constrained_dynamics.py +0 -1
  76. ipi-3.0/ipi/inputs/motion/driven_dynamics.py +217 -0
  77. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/dynamics.py +16 -3
  78. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/geop.py +0 -1
  79. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/instanton.py +63 -7
  80. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/motion.py +22 -5
  81. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/neb.py +0 -1
  82. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/phonons.py +1 -2
  83. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/planetary.py +1 -1
  84. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/scphonons.py +1 -1
  85. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/stringmep.py +0 -1
  86. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/vscf.py +1 -1
  87. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/normalmodes.py +79 -7
  88. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/outputs.py +1 -5
  89. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/prng.py +24 -48
  90. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/simulation.py +30 -6
  91. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/system.py +3 -4
  92. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/thermostats.py +3 -5
  93. {ipi-2.6.0 → ipi-3.0}/ipi/interfaces/sockets.py +151 -55
  94. {ipi-2.6.0 → ipi-3.0}/ipi/utils/__init__.py +1 -0
  95. {ipi-2.6.0 → ipi-3.0}/ipi/utils/constrtools.py +54 -46
  96. {ipi-2.6.0 → ipi-3.0}/ipi/utils/depend.py +66 -160
  97. ipi-3.0/ipi/utils/exchange.py +493 -0
  98. {ipi-2.6.0 → ipi-3.0}/ipi/utils/hesstools.py +77 -23
  99. {ipi-2.6.0 → ipi-3.0}/ipi/utils/inputvalue.py +5 -9
  100. {ipi-2.6.0 → ipi-3.0}/ipi/utils/instools.py +202 -12
  101. {ipi-2.6.0 → ipi-3.0}/ipi/utils/io/__init__.py +55 -2
  102. {ipi-2.6.0 → ipi-3.0}/ipi/utils/io/backends/io_ase.py +18 -2
  103. {ipi-2.6.0 → ipi-3.0}/ipi/utils/io/inputs/io_xml.py +0 -2
  104. {ipi-2.6.0 → ipi-3.0}/ipi/utils/io/io_units.py +6 -5
  105. {ipi-2.6.0 → ipi-3.0}/ipi/utils/mathtools.py +30 -1
  106. {ipi-2.6.0 → ipi-3.0}/ipi/utils/messages.py +1 -3
  107. {ipi-2.6.0 → ipi-3.0}/ipi/utils/mintools.py +5 -6
  108. {ipi-2.6.0 → ipi-3.0}/ipi/utils/nmtransform.py +71 -34
  109. ipi-3.0/ipi/utils/parsing.py +229 -0
  110. ipi-3.0/ipi/utils/prng.py +231 -0
  111. {ipi-2.6.0 → ipi-3.0}/ipi/utils/softexit.py +0 -1
  112. {ipi-2.6.0 → ipi-3.0}/ipi/utils/units.py +62 -2
  113. {ipi-2.6.0 → ipi-3.0}/ipi.egg-info/PKG-INFO +42 -25
  114. {ipi-2.6.0 → ipi-3.0}/ipi.egg-info/SOURCES.txt +16 -14
  115. {ipi-2.6.0 → ipi-3.0}/setup.cfg +1 -1
  116. {ipi-2.6.0 → ipi-3.0}/setup.py +3 -5
  117. ipi-2.6.0/drivers/py/pes/__init__.py +0 -14
  118. ipi-2.6.0/drivers/py/pes/harmonic.py +0 -30
  119. ipi-2.6.0/ipi/__init__.py +0 -7
  120. ipi-2.6.0/ipi/utils/exchange.py +0 -183
  121. ipi-2.6.0/ipi/utils/prng.py +0 -117
  122. ipi-2.6.0/ipi_tests/__init__.py +0 -3
  123. ipi-2.6.0/ipi_tests/regression_tests/__init__.py +0 -0
  124. ipi-2.6.0/ipi_tests/regression_tests/runstools.py +0 -245
  125. ipi-2.6.0/ipi_tests/regression_tests/test_run.py +0 -80
  126. ipi-2.6.0/ipi_tests/regression_tests/tests/NVE/NVE_1/harmonic_python/files_to_check.txt +0 -7
  127. ipi-2.6.0/ipi_tests/regression_tests/tests/NVE/NVE_1/harmonic_python/init.xyz +0 -3
  128. ipi-2.6.0/ipi_tests/regression_tests/tests/NVE/NVE_1/harmonic_python/input.xml +0 -40
  129. ipi-2.6.0/ipi_tests/regression_tests/tests/NVE/NVE_1/harmonic_python/ref_simulation.frc_c.xyz +0 -33
  130. ipi-2.6.0/ipi_tests/regression_tests/tests/NVE/NVE_1/harmonic_python/ref_simulation.mom_c.xyz +0 -33
  131. ipi-2.6.0/ipi_tests/regression_tests/tests/NVE/NVE_1/harmonic_python/ref_simulation.out +0 -16
  132. ipi-2.6.0/ipi_tests/regression_tests/tests/NVE/NVE_1/harmonic_python/ref_simulation.pos_c.xyz +0 -33
  133. ipi-2.6.0/ipi_tests/regression_tests/tests/NVE/NVE_1/harmonic_python/ref_simulation.vel_c.xyz +0 -33
  134. ipi-2.6.0/ipi_tests/regression_tests/tests/NVE/NVE_1/harmonic_python/test_settings.dat +0 -6
  135. ipi-2.6.0/ipi_tests/test_tools.py +0 -361
  136. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-contract-trajectory +0 -0
  137. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-get_Ascp +0 -0
  138. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-getacf +0 -0
  139. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-getproperty +0 -0
  140. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-gleacf +0 -0
  141. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-kinetic2tag +0 -0
  142. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-mergebeadspdb +0 -0
  143. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-mux-positions +0 -0
  144. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-paraweights +0 -0
  145. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-posforce2kinetic +0 -0
  146. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-style +0 -0
  147. {ipi-2.6.0 → ipi-3.0}/bin/i-pi-trimsim +0 -0
  148. {ipi-2.6.0 → ipi-3.0}/drivers/py/__init__.py +0 -0
  149. {ipi-2.6.0 → ipi-3.0}/ipi/engine/__init__.py +0 -0
  150. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/neb.py +0 -0
  151. {ipi-2.6.0 → ipi-3.0}/ipi/engine/motion/ramp.py +0 -0
  152. {ipi-2.6.0 → ipi-3.0}/ipi/engine/smotion/__init__.py +0 -0
  153. {ipi-2.6.0 → ipi-3.0}/ipi/engine/smotion/dmd.py +0 -0
  154. {ipi-2.6.0 → ipi-3.0}/ipi/engine/smotion/multi.py +0 -0
  155. {ipi-2.6.0 → ipi-3.0}/ipi/external/__init__.py +0 -0
  156. {ipi-2.6.0 → ipi-3.0}/ipi/external/importlib/__init__.py +0 -0
  157. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/__init__.py +0 -0
  158. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/al6xxx_kmc.py +0 -0
  159. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/motion/ramp.py +0 -0
  160. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/smotion/__init__.py +0 -0
  161. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/smotion/dmd.py +0 -0
  162. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/smotion/metad.py +0 -0
  163. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/smotion/remd.py +0 -0
  164. {ipi-2.6.0 → ipi-3.0}/ipi/inputs/smotion/smotion.py +0 -0
  165. {ipi-2.6.0 → ipi-3.0}/ipi/interfaces/__init__.py +0 -0
  166. {ipi-2.6.0 → ipi-3.0}/ipi/utils/decorators.py +0 -0
  167. {ipi-2.6.0 → ipi-3.0}/ipi/utils/distance.py +0 -0
  168. {ipi-2.6.0 → ipi-3.0}/ipi/utils/io/backends/__init__.py +0 -0
  169. {ipi-2.6.0 → ipi-3.0}/ipi/utils/io/backends/io_binary.py +0 -0
  170. {ipi-2.6.0 → ipi-3.0}/ipi/utils/io/backends/io_json.py +0 -0
  171. {ipi-2.6.0 → ipi-3.0}/ipi/utils/io/backends/io_pdb.py +0 -0
  172. {ipi-2.6.0 → ipi-3.0}/ipi/utils/io/backends/io_xyz.py +0 -0
  173. {ipi-2.6.0 → ipi-3.0}/ipi/utils/io/inputs/__init__.py +0 -0
  174. {ipi-2.6.0 → ipi-3.0}/ipi/utils/phonontools.py +0 -0
  175. {ipi-2.6.0 → ipi-3.0}/ipi/utils/sparse.py +0 -0
  176. {ipi-2.6.0 → ipi-3.0}/ipi.egg-info/dependency_links.txt +0 -0
  177. {ipi-2.6.0 → ipi-3.0}/ipi.egg-info/requires.txt +0 -0
  178. {ipi-2.6.0 → ipi-3.0}/ipi.egg-info/top_level.txt +0 -0
  179. {ipi-2.6.0 → ipi-3.0}/licenses/license_GPL.txt +0 -0
  180. {ipi-2.6.0 → ipi-3.0}/licenses/license_MIT.txt +0 -0
  181. {ipi-2.6.0 → ipi-3.0}/pyproject.toml +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ipi
3
- Version: 2.6.0
3
+ Version: 3.0
4
4
  Summary: A Python interface for ab initio path integral molecular dynamics simulations
5
5
  Home-page: http://ipi-code.org
6
6
  Author: The i-PI developers
@@ -29,11 +29,11 @@ Requires-Dist: numpy
29
29
  i-PI: a Universal Force Engine
30
30
  ==============================
31
31
 
32
- A Python interface for ab initio path integral molecular dynamics simulations.
33
- i-PI is composed of a Python server (i-pi itself, that does not need to be
34
- compiled but only requires a relatively recent version of Python and Numpy)
35
- that apply an algorithm that updates the positions of the nuclei, and of an external
36
- code that acts as a client and computes the electronic energy and forces.
32
+ A Python interface for ab initio path integral molecular dynamics simulations (and more).
33
+ i-PI is a Python server (that does not need to be compiled and only requires a relatively
34
+ recent version of Python and Numpy) that applies an algorithm to update the positions of
35
+ the nuclei. One of many compatible external codes acts as client, and computes the
36
+ electronic energy and forces.
37
37
 
38
38
  This is typically a patched version of an electronic structure code, but a
39
39
  simple self-contained Fortran driver that implements several simple interatomic
@@ -45,29 +45,40 @@ and it implements most of the state-of-the-art methods to accelerate this kind o
45
45
  calculations. It has since grown to also provide all sorts of simulation
46
46
  strategies, from replica exchange to geometry optimization.
47
47
 
48
- Quick Setup and Test
49
- --------------------
48
+ If you use i-PI in your research, please cite the accompanying publication:
49
+ for version 3, the relevant paper is
50
+ [Litman et al., *J. Chem. Phys.* 161, 062504 (2024)](https://doi.org/10.1063/5.0215869)
50
51
 
51
- To use i-PI with an existing driver, install and update using Pip:
52
+ ```
53
+ @article{litman2024ipi,
54
+ title={i-PI 3.0: a flexible and efficient framework for advanced atomistic simulations},
55
+ author={Yair Litman and Venkat Kapil and Yotam M. Y. Feldman and Davide Tisi and Tomislav Begušić and Karen Fidanyan and Guillaume Fraux and Jacob Higer and Matthias Kellner and Tao E. Li and Eszter S. Pós and Elia Stocco and George Trenins and Barak Hirshberg and Mariana Rossi and Michele Ceriotti},
56
+ journal = {J. Chem. Phys.},
57
+ pages = {062505},
58
+ volume = {161},
59
+ year = {2024}
60
+ }
61
+ ```
62
+
63
+ Quick Setup
64
+ -----------
65
+
66
+ To use i-PI with an existing driver, install and update using `pip`:
67
+
68
+ Last version:
52
69
 
53
- Last version::
54
70
  ```bash
55
71
  python -m pip install git+https://github.com/i-pi/i-pi.git
56
72
  ```
57
73
 
58
- Last Release::
59
- ```bash
60
- pip install -U i-PI
61
- ```
74
+ Last Release:
62
75
 
63
- Test with Pytest::
64
76
  ```bash
65
- pip install pytest
66
- pytest --pyargs ipi.tests
77
+ pip install -U ipi
67
78
  ```
68
79
 
69
- Full installation
70
- -----------------
80
+ Source installation
81
+ -------------------
71
82
 
72
83
  To develop i-PI or test it with the self-contained driver, follow these
73
84
  instructions. It is assumed that i-PI will
@@ -86,12 +97,17 @@ you always want to have i-PI available.
86
97
 
87
98
  ### Compile the driver code
88
99
 
100
+ The built-in driver requires a FORTRAN compiler, and can be built as
101
+
89
102
  ```bash
90
103
  cd drivers/f90
91
104
  make
92
105
  cd ../..
93
106
  ```
94
107
 
108
+ There is also a Python driver available in `drivers/py`, which however has limited
109
+ functionalities.
110
+
95
111
  ### Examples and demos
96
112
 
97
113
  The `examples` and `demos` folders contain inputs for many different types of
@@ -110,24 +126,25 @@ else if you want to keep the i-PI directory clean. For example
110
126
  ```bash
111
127
  cd demos/para-h2-tutorial/tutorial-1/
112
128
  i-pi tutorial-1.xml > log &
113
- i-pi-driver -h localhost -p 31415 -m sg -o 15 &
114
- i-pi-driver -h localhost -p 31415 -m sg -o 15 &
129
+ i-pi-driver -a localhost -p 31415 -m sg -o 15 &
130
+ i-pi-driver -a localhost -p 31415 -m sg -o 15 &
115
131
  tail -f log
116
132
  ```
117
133
 
118
134
  The monitoring can be interrupted with CTRL+C when the run has finished (5000 steps).
119
135
 
120
-
121
136
  ### Run the automatic test suite
122
137
 
123
- The automatic test suite can be run by calling the i-pi-test script.
138
+ The automatic test suite can be run by calling the i-pi-tests script.
124
139
  You need to have the `pytest` package installed
125
140
 
126
141
  ```
127
- i-pi-test
142
+ i-pi-tests
128
143
  ```
129
144
 
130
- See more details in the README file inside the ipi_tests folder.
145
+ You may also need to install some dependencies, listed in `requirements.txt`.
146
+
147
+ See more details in the README file inside the `ipi_tests` folder.
131
148
 
132
149
  Contributing
133
150
  ------------
@@ -1,11 +1,11 @@
1
1
  i-PI: a Universal Force Engine
2
2
  ==============================
3
3
 
4
- A Python interface for ab initio path integral molecular dynamics simulations.
5
- i-PI is composed of a Python server (i-pi itself, that does not need to be
6
- compiled but only requires a relatively recent version of Python and Numpy)
7
- that apply an algorithm that updates the positions of the nuclei, and of an external
8
- code that acts as a client and computes the electronic energy and forces.
4
+ A Python interface for ab initio path integral molecular dynamics simulations (and more).
5
+ i-PI is a Python server (that does not need to be compiled and only requires a relatively
6
+ recent version of Python and Numpy) that applies an algorithm to update the positions of
7
+ the nuclei. One of many compatible external codes acts as client, and computes the
8
+ electronic energy and forces.
9
9
 
10
10
  This is typically a patched version of an electronic structure code, but a
11
11
  simple self-contained Fortran driver that implements several simple interatomic
@@ -17,29 +17,40 @@ and it implements most of the state-of-the-art methods to accelerate this kind o
17
17
  calculations. It has since grown to also provide all sorts of simulation
18
18
  strategies, from replica exchange to geometry optimization.
19
19
 
20
- Quick Setup and Test
21
- --------------------
20
+ If you use i-PI in your research, please cite the accompanying publication:
21
+ for version 3, the relevant paper is
22
+ [Litman et al., *J. Chem. Phys.* 161, 062504 (2024)](https://doi.org/10.1063/5.0215869)
22
23
 
23
- To use i-PI with an existing driver, install and update using Pip:
24
+ ```
25
+ @article{litman2024ipi,
26
+ title={i-PI 3.0: a flexible and efficient framework for advanced atomistic simulations},
27
+ author={Yair Litman and Venkat Kapil and Yotam M. Y. Feldman and Davide Tisi and Tomislav Begušić and Karen Fidanyan and Guillaume Fraux and Jacob Higer and Matthias Kellner and Tao E. Li and Eszter S. Pós and Elia Stocco and George Trenins and Barak Hirshberg and Mariana Rossi and Michele Ceriotti},
28
+ journal = {J. Chem. Phys.},
29
+ pages = {062505},
30
+ volume = {161},
31
+ year = {2024}
32
+ }
33
+ ```
34
+
35
+ Quick Setup
36
+ -----------
37
+
38
+ To use i-PI with an existing driver, install and update using `pip`:
39
+
40
+ Last version:
24
41
 
25
- Last version::
26
42
  ```bash
27
43
  python -m pip install git+https://github.com/i-pi/i-pi.git
28
44
  ```
29
45
 
30
- Last Release::
31
- ```bash
32
- pip install -U i-PI
33
- ```
46
+ Last Release:
34
47
 
35
- Test with Pytest::
36
48
  ```bash
37
- pip install pytest
38
- pytest --pyargs ipi.tests
49
+ pip install -U ipi
39
50
  ```
40
51
 
41
- Full installation
42
- -----------------
52
+ Source installation
53
+ -------------------
43
54
 
44
55
  To develop i-PI or test it with the self-contained driver, follow these
45
56
  instructions. It is assumed that i-PI will
@@ -58,12 +69,17 @@ you always want to have i-PI available.
58
69
 
59
70
  ### Compile the driver code
60
71
 
72
+ The built-in driver requires a FORTRAN compiler, and can be built as
73
+
61
74
  ```bash
62
75
  cd drivers/f90
63
76
  make
64
77
  cd ../..
65
78
  ```
66
79
 
80
+ There is also a Python driver available in `drivers/py`, which however has limited
81
+ functionalities.
82
+
67
83
  ### Examples and demos
68
84
 
69
85
  The `examples` and `demos` folders contain inputs for many different types of
@@ -82,24 +98,25 @@ else if you want to keep the i-PI directory clean. For example
82
98
  ```bash
83
99
  cd demos/para-h2-tutorial/tutorial-1/
84
100
  i-pi tutorial-1.xml > log &
85
- i-pi-driver -h localhost -p 31415 -m sg -o 15 &
86
- i-pi-driver -h localhost -p 31415 -m sg -o 15 &
101
+ i-pi-driver -a localhost -p 31415 -m sg -o 15 &
102
+ i-pi-driver -a localhost -p 31415 -m sg -o 15 &
87
103
  tail -f log
88
104
  ```
89
105
 
90
106
  The monitoring can be interrupted with CTRL+C when the run has finished (5000 steps).
91
107
 
92
-
93
108
  ### Run the automatic test suite
94
109
 
95
- The automatic test suite can be run by calling the i-pi-test script.
110
+ The automatic test suite can be run by calling the i-pi-tests script.
96
111
  You need to have the `pytest` package installed
97
112
 
98
113
  ```
99
- i-pi-test
114
+ i-pi-tests
100
115
  ```
101
116
 
102
- See more details in the README file inside the ipi_tests folder.
117
+ You may also need to install some dependencies, listed in `requirements.txt`.
118
+
119
+ See more details in the README file inside the `ipi_tests` folder.
103
120
 
104
121
  Contributing
105
122
  ------------
@@ -34,7 +34,7 @@ def profile_exit(prefix="profile"):
34
34
  # write out the outputs of the profiler
35
35
  import yappi
36
36
  yappi.stop()
37
- yappi.get_thread_stats().print_all()
37
+ #yappi.get_thread_stats().print_all()
38
38
  yfs = yappi.get_func_stats()
39
39
  yfs.save(prefix+".kgrind", type="callgrind")
40
40
  ypo = open(prefix+".yappi", "w")
@@ -58,7 +58,7 @@ def main(fn_input, options):
58
58
  raise ImportError('Profiling requires the `yappi` package.')
59
59
 
60
60
  # construct simulation based on input file
61
- simulation = Simulation.load_from_xml(fn_input, request_banner=True, custom_verbosity=options.verbosity)
61
+ simulation = Simulation.load_from_xml(fn_input, request_banner=True, custom_verbosity=options.verbosity, sockets_prefix=options.sockets_prefix)
62
62
 
63
63
  # run the simulation
64
64
  simulation.run()
@@ -96,6 +96,9 @@ if __name__ == '__main__':
96
96
  choices=['quiet', 'low', 'medium', 'high', 'debug'],
97
97
  help='Define the verbosity level.')
98
98
 
99
+ parser.add_option('-S', '--sockets_prefix', dest='sockets_prefix', default=None,
100
+ help='Prefix for profiler files.')
101
+
99
102
  options, args = parser.parse_args()
100
103
 
101
104
  # make sure that we have exactly one input file and it exists
@@ -23,6 +23,7 @@ def direct_reweight(pot, obs, kbT):
23
23
  obs_avg_rew : the observable reweighted for each potential
24
24
  weights : the weights computed for each model and frame
25
25
  """
26
+
26
27
  beta = 1.0 / kbT
27
28
  num_pot_frames = pot.shape[0]
28
29
  num_obs_frames = obs.shape[0]
@@ -133,7 +134,7 @@ def uncertainty_CEA_multiple_models(pot, obs, kbT):
133
134
 
134
135
 
135
136
  def commitee_reweight(
136
- path2ixml, pot_file, obs_file, stride=1, index=-1, direct=False, multi_models=False
137
+ pot_file, obs_file, kt, stride=1, index=-1, direct=False, multi_models=False
137
138
  ):
138
139
  """
139
140
  Parameters
@@ -145,6 +146,8 @@ def commitee_reweight(
145
146
  A file containing the value of the observable for each frame.
146
147
  It is assumed that lines correspond to frames, while columns to properties.
147
148
  Multiple properties can be reweighted at the same time.
149
+ kt : float, mandatory
150
+ The thermal energy, in the same units as pot_file
148
151
  stride : integer, [1]
149
152
  The frequency of sampling of pot_file, if different from that of prop_file (e.g. --stride 10 if
150
153
  the potential was printed 10 times more often than the observable. --stride -10 must be used if
@@ -175,15 +178,9 @@ def commitee_reweight(
175
178
  else:
176
179
  raise ValueError("Stride value cannot be zero")
177
180
 
178
- # Load kbT from i-PI, we could make it into a small function
179
- simul = Simulation.load_from_xml(
180
- path2ixml, custom_verbosity="quiet", read_only=True
181
- )
182
- kbT = float(simul.syslist[0].ensemble.temp)
183
-
184
181
  if multi_models:
185
182
  mean_value, sigma2_a, sigma2_aV, sigma2_tilde = uncertainty_CEA_multiple_models(
186
- potentials, obs, kbT
183
+ potentials, obs, kt
187
184
  )
188
185
  print("# Mean Error sigma_a sigma_aV")
189
186
  print(
@@ -194,9 +191,9 @@ def commitee_reweight(
194
191
  else:
195
192
  # CEA is the default choice. The weights or h_matrix are
196
193
  if direct:
197
- rw_obs, _weights = direct_reweight(potentials, obs, kbT)
194
+ rw_obs, _weights = direct_reweight(potentials, obs, kt)
198
195
  else:
199
- rw_obs, _h_matrix = CEA(potentials, obs, kbT)
196
+ rw_obs, _h_matrix = CEA(potentials, obs, kt)
200
197
  print(
201
198
  "# Mean Error <committee_1> .... <committee_N>"
202
199
  )
@@ -215,21 +212,28 @@ if __name__ == "__main__":
215
212
  The full methodology is described in: https://doi.org/10.1063/5.0036522"""
216
213
  )
217
214
 
218
- parser.add_argument(
219
- "input_xml",
220
- type=str,
221
- help="The path to the input file used to run the simulation (usually input.xml)",
222
- )
223
215
  parser.add_argument(
224
216
  "pot_file",
225
217
  type=str,
226
- help="The file containing the potentials. Rows = frames, columns = potentials",
218
+ help="The file containing the potentials, in units of kT (default: Hartree). Rows = frames, columns = potentials",
227
219
  )
228
220
  parser.add_argument(
229
221
  "obs_file",
230
222
  type=str,
231
223
  help="The file containing the properties. Rows = frames, columns = property/ies",
232
224
  )
225
+ parser.add_argument(
226
+ "--kt",
227
+ type=float,
228
+ default=0.0,
229
+ help="The thermal energy. Should be in the same units of the potentials, typically Hartree",
230
+ )
231
+ parser.add_argument(
232
+ "--input",
233
+ type=str,
234
+ default="",
235
+ help="The path to the input file used to run the simulation (usually input.xml). Used just to extract kT.",
236
+ )
233
237
  parser.add_argument(
234
238
  "--stride",
235
239
  type=int,
@@ -254,11 +258,23 @@ if __name__ == "__main__":
254
258
  )
255
259
 
256
260
  args = parser.parse_args()
261
+
262
+ # Load kbT from i-PI, we could make it into a small function
263
+ if args.input != "":
264
+ simul = Simulation.load_from_xml(
265
+ args.input, custom_verbosity="quiet", read_only=True
266
+ )
267
+ kt = float(simul.syslist[0].ensemble.temp)
268
+ else:
269
+ kt = args.kt
270
+ if kt <= 0:
271
+ raise ValueError("Must specify either --kt or --input")
272
+
257
273
  sys.exit(
258
274
  commitee_reweight(
259
- args.input_xml,
260
275
  args.pot_file,
261
276
  args.obs_file,
277
+ kt,
262
278
  args.stride,
263
279
  args.index,
264
280
  args.direct,
@@ -0,0 +1,244 @@
1
+ #!/usr/bin/env python3
2
+ import socket
3
+ import argparse
4
+ import numpy as np
5
+
6
+
7
+ try:
8
+ from pes import *
9
+ except ImportError:
10
+ # when in an installed i-PI package
11
+ from ipi._driver.pes import *
12
+
13
+ description = """
14
+ Minimal example of a Python driver connecting to i-PI and exchanging energy, forces, etc.
15
+ """
16
+
17
+
18
+ def recv_data(sock, data):
19
+ """Fetches binary data from i-PI socket."""
20
+ blen = data.itemsize * data.size
21
+ buf = np.zeros(blen, np.byte)
22
+
23
+ bpos = 0
24
+ while bpos < blen:
25
+ timeout = False
26
+ try:
27
+ bpart = 1
28
+ bpart = sock.recv_into(buf[bpos:], blen - bpos)
29
+ except socket.timeout:
30
+ print(" @SOCKET: Timeout in status recvall, trying again!")
31
+ timeout = True
32
+ pass
33
+ if not timeout and bpart == 0:
34
+ raise RuntimeError("Socket disconnected!")
35
+ bpos += bpart
36
+ if np.isscalar(data):
37
+ return np.frombuffer(buf[0:blen], data.dtype)[0]
38
+ else:
39
+ return np.frombuffer(buf[0:blen], data.dtype).reshape(data.shape)
40
+
41
+
42
+ def send_data(sock, data):
43
+ """Sends binary data to i-PI socket."""
44
+
45
+ if np.isscalar(data):
46
+ data = np.array([data], data.dtype)
47
+ buf = data.tobytes()
48
+ sock.send(buf)
49
+
50
+
51
+ HDRLEN = 12 # number of characters of the default message strings
52
+
53
+
54
+ def Message(mystr):
55
+ """Returns a header of standard length HDRLEN."""
56
+
57
+ # convert to bytestream since we'll be sending this over a socket
58
+ return str.ljust(str.upper(mystr), HDRLEN).encode()
59
+
60
+
61
+ def run_driver(
62
+ unix=False,
63
+ address="",
64
+ port=12345,
65
+ driver=Dummy_driver(),
66
+ f_verbose=False,
67
+ sockets_prefix="/tmp/ipi_",
68
+ ):
69
+ """Minimal socket client for i-PI."""
70
+
71
+ # Opens a socket to i-PI
72
+ if unix:
73
+ sock = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
74
+ sock.connect(sockets_prefix + address)
75
+ else:
76
+ sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
77
+ # this reduces latency for the small messages passed by the i-PI protocol
78
+ sock.setsockopt(socket.IPPROTO_TCP, socket.TCP_NODELAY, 1)
79
+ sock.connect((address, port))
80
+
81
+ f_init = False
82
+ f_data = False
83
+
84
+ # initializes structure arrays
85
+ cell = np.zeros((3, 3), float)
86
+ icell = np.zeros((3, 3), float)
87
+ pos = np.zeros(0, float)
88
+
89
+ # initializes return arrays
90
+ pot = 0.0
91
+ force = np.zeros(0, float)
92
+ vir = np.zeros((3, 3), float)
93
+ while True: # ah the infinite loop!
94
+ header = sock.recv(HDRLEN)
95
+ if f_verbose:
96
+ print("Received ", header)
97
+ if header == Message("STATUS"):
98
+ # responds to a status request
99
+ if not f_init:
100
+ sock.sendall(Message("NEEDINIT"))
101
+ elif f_data:
102
+ sock.sendall(Message("HAVEDATA"))
103
+ else:
104
+ sock.sendall(Message("READY"))
105
+ elif header == Message("INIT"):
106
+ # initialization
107
+ rid = recv_data(sock, np.int32())
108
+ initlen = recv_data(sock, np.int32())
109
+ initstr = recv_data(sock, np.chararray(initlen))
110
+ if f_verbose:
111
+ print(rid, initstr)
112
+ f_init = True # we are initialized now
113
+ elif header == Message("POSDATA"):
114
+ # receives structural information
115
+ cell = recv_data(sock, cell)
116
+ icell = recv_data(
117
+ sock, icell
118
+ ) # inverse of the cell. mostly useless legacy stuff
119
+ nat = recv_data(sock, np.int32())
120
+ if len(pos) == 0:
121
+ # shapes up the position array
122
+ pos.resize((nat, 3))
123
+ force.resize((nat, 3))
124
+ else:
125
+ if len(pos) != nat:
126
+ raise RuntimeError("Atom number changed during i-PI run")
127
+ pos = recv_data(sock, pos)
128
+
129
+ ##### THIS IS THE TIME TO DO SOMETHING WITH THE POSITIONS!
130
+ pot, force, vir, extras = driver(cell, pos)
131
+ f_data = True
132
+ elif header == Message("GETFORCE"):
133
+ sock.sendall(Message("FORCEREADY"))
134
+
135
+ # sanity check in the returned values (catches bugs and inconsistencies in the implementation)
136
+ if not isinstance(force, np.ndarray) and force.dtype == np.float64:
137
+ raise ValueError(
138
+ "driver returned forces with the wrong type: we need a "
139
+ "numpy.ndarray containing 64-bit floating points values"
140
+ )
141
+
142
+ if not isinstance(vir, np.ndarray) and vir.dtype == np.float64:
143
+ raise ValueError(
144
+ "driver returned virial with the wrong type: we need a "
145
+ "numpy.ndarray containing 64-bit floating points values"
146
+ )
147
+
148
+ if len(force.flatten()) != len(pos.flatten()):
149
+ raise ValueError(
150
+ "driver returned forces with the wrong size: number of "
151
+ "atoms and dimensions must match positions"
152
+ )
153
+
154
+ if len(vir.flatten()) != 9:
155
+ raise ValueError(
156
+ "driver returned a virial tensor which does not have 9 components"
157
+ )
158
+
159
+ send_data(sock, np.float64(pot))
160
+ send_data(sock, np.int32(nat))
161
+ send_data(sock, force)
162
+ send_data(sock, vir)
163
+ send_data(sock, np.int32(len(extras)))
164
+ sock.sendall(extras.encode("utf-8"))
165
+
166
+ f_data = False
167
+ elif header == Message("EXIT"):
168
+ print("Received exit message from i-PI. Bye bye!")
169
+ return
170
+
171
+
172
+ if __name__ == "__main__":
173
+ parser = argparse.ArgumentParser(description=description)
174
+
175
+ parser.add_argument(
176
+ "-u",
177
+ "--unix",
178
+ action="store_true",
179
+ default=False,
180
+ help="Use a UNIX domain socket.",
181
+ )
182
+ parser.add_argument(
183
+ "-a",
184
+ "--address",
185
+ type=str,
186
+ default="localhost",
187
+ help="Host name (for INET sockets) or name of the UNIX domain socket to connect to.",
188
+ )
189
+ parser.add_argument(
190
+ "-S",
191
+ "--sockets_prefix",
192
+ type=str,
193
+ default="/tmp/ipi_",
194
+ help="Prefix used for the unix domain sockets. Ignored when using TCP/IP sockets.",
195
+ )
196
+ parser.add_argument(
197
+ "-p",
198
+ "--port",
199
+ type=int,
200
+ default=12345,
201
+ help="TCP/IP port number. Ignored when using UNIX domain sockets.",
202
+ )
203
+ parser.add_argument(
204
+ "-m",
205
+ "--mode",
206
+ type=str,
207
+ default="dummy",
208
+ help="""Type of potential to be used to compute the potential and its derivatives.
209
+ Currently implemented: [dummy, harmonic]
210
+ """,
211
+ )
212
+ parser.add_argument(
213
+ "-o",
214
+ "--param",
215
+ type=str,
216
+ default="",
217
+ help="""Parameters required to run the driver. Comma-separated list of values
218
+ """,
219
+ )
220
+ parser.add_argument(
221
+ "-v",
222
+ "--verbose",
223
+ action="store_true",
224
+ default=False,
225
+ help="Verbose output.",
226
+ )
227
+
228
+ args = parser.parse_args()
229
+
230
+ if args.mode in __drivers__:
231
+ d_f = __drivers__[args.mode](args.param, args.verbose)
232
+ elif args.mode == "dummy":
233
+ d_f = Dummy_driver(args.param, args.verbose)
234
+ else:
235
+ raise ValueError("Unsupported driver mode ", args.mode)
236
+
237
+ run_driver(
238
+ unix=args.unix,
239
+ address=args.address,
240
+ port=args.port,
241
+ driver=d_f,
242
+ f_verbose=args.verbose,
243
+ sockets_prefix=args.sockets_prefix,
244
+ )
@@ -189,7 +189,6 @@ def simple_corr(A, B, **kwargs):
189
189
 
190
190
 
191
191
  class Planets(object):
192
-
193
192
  """
194
193
  Stores relevant trajectory info for planetary model simulation, calculates
195
194
  planetary dynamics and evaluates estimators and TCFs.