Skip to content

Commit

Permalink
Added some docs for ffdirect
Browse files Browse the repository at this point in the history
  • Loading branch information
ceriottm committed Nov 12, 2024
1 parent 651c3ca commit 5112132
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 7 deletions.
3 changes: 2 additions & 1 deletion docs/scripts/help.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,8 @@
"h0": cell.InputCell(),
"forcefield": forcefields.InputForceField(),
"ffsocket": forcefields.InputFFSocket(),
"fflj": forcefields.InputFFLennardJones(),
"ffdirect": forcefields.InputFFDirect(),
"fflj": forcefields.InputFFLennardJones(),
"ffdebye": forcefields.InputFFDebye(),
"ffplumed": forcefields.InputFFPlumed(),
"ffyaff": forcefields.InputFFYaff(),
Expand Down
8 changes: 7 additions & 1 deletion docs/src/contributing.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _contributing:

Contributing
============

Expand Down Expand Up @@ -89,7 +91,11 @@ If your new development in i-PI is directly related to a specific client code or
We very much welcome new interfaces and we will be happy to answer your questions.

If you want to enable the communication of a new client code with i-PI, it is not difficult: Please check an example of how it was done in ``fortran`` and ``python`` in the `drivers` folder in the repository.

It is especially simple to add a new potential energy that is evaluated in Python: it is sufficient to add a file in the `ipi/pes` folder, specifying
`__DRIVER_NAME__` (a string that will be used to refer to the PES from the i-PI input or the command line) and `__DRIVER_CLASS__`, the name of the
actual class, that should provide, directly or through inheritance, a `__call__(self, cell, pos)` function and return a tuple with
`(potential, forces, virial, extras)`. See any of the existing PES files to use as templates - it is particularly simple to create a class that
piggybacs on an existing ASE-style calculator.


Getting recognition for your contribution
Expand Down
26 changes: 23 additions & 3 deletions docs/src/getting-started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,29 @@ The built-in driver requires a FORTRAN compiler, and can be built as
make
cd ../..
Python driver and PES
^^^^^^^^^^^^^^^^^^^^^

In addition to the FORTRAN drive, the i-PI distribution contains also a Python
driver, available in `drivers/py` and through the command-line command
`i-pi-py_driver`, which evaluates potential energy surfaces evaluated by simple
driver classes, that can be found in `ipi/pes`.

These classes are particularly suitable to perform inference with machine-learning
potentials implemented in Python, and it is reasonably simple to add your own,
if you need to (see also the :ref:`contributing` section).

These PES files can also be used directly, without the need to go through a
client-server interface, using a :ref:`ffdirect` forcefield, including in the
XML input a block similar to

.. code-block::
<ffdirect name="ff_name">
<pes> harmonic </pes>
<parameters> { k1: 1.0} </parameters>
</ffdirect>
There is also a Python driver available in `drivers/py`, which however has limited
functionalities.
Alternative installation using the setup.py module
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Expand Down Expand Up @@ -266,7 +286,7 @@ The flags do the following:

-S:
Optional parameter. If given, overwrite the default socket prefix used in the creation of files for the socket communication.
(default "/tmp/ipi_")
(default "/tmp/ipi\_")

This code should be fairly simple to extend to other pair-wise
interaction potentials, and examples of its use can be seen in the
Expand Down
4 changes: 2 additions & 2 deletions docs/src/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ This documentation is structured as follows:
:maxdepth: 2

introduction
onlinereso
features
getting-started
features
units
input-files
input-tags
output-files
output-tags
distributed
tutorials
onlinereso
faq
troubleshooting
contributing
Expand Down

0 comments on commit 5112132

Please sign in to comment.