Skip to content

Commit

Permalink
Added a README file to explain how to add a driver PES
Browse files Browse the repository at this point in the history
  • Loading branch information
ceriottm committed Dec 10, 2023
1 parent 46aa134 commit d5e165a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 2 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ You need to have the `pytest` package installed
i-pi-test
```

See more details in the README file inside the ipi_tests folder.
See more details in the README file inside the `ipi_tests` folder.

Contributing
------------
Expand Down
27 changes: 27 additions & 0 deletions drivers/py/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
i-PI driver - Python version
============================

This is a Python version of a simple driver code that computes energy and forces and communicates
them with i-PI using TCP/IP or Unix sockets.
Run `i-pi-py_driver -h` to see a list of options and a brief explanation.

Adding a new PES
----------------

Besides a couple of demonstrative potential energy evaluators, this driver is useful to add
potential-energy surface calculator that facilitate interfacing from any Python-based potential.

Adding a new PES to the driver is easy: take `pes/dummy.py` as a template and add a new
file to the `pes/` folder. You can look at some of the other drivers to understand how to
process the command line parameters passed through the `-o` option to the driver.

It is important to set the following global variables in the new file:

```python
__DRIVER_NAME__ = "pes"
__DRIVER_CLASS__ = "PES_class"
```

`__DRIVER_NAME__` is the name that will be used to identify the pes in the `-m` option.
`__DRIVER_CLASS__` is the name you use for the class contained in the new PES file.

7 changes: 6 additions & 1 deletion drivers/py/pes/pet.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,12 @@ def check_arguments(self):
)

def __call__(self, cell, pos):
"""Get energies, forces, and stresses from the PET model"""
"""Get energies, forces, and stresses from the MACE model
This routine assumes that the client will take positions
in angstrom, and return energies in electronvolt, and forces
in ev/ang.
"""

pos_pet = unit_to_user("length", "angstrom", pos)
# librascal expects ASE-format, cell-vectors-as-rows
cell_pet = unit_to_user("length", "angstrom", cell.T)
Expand Down

0 comments on commit d5e165a

Please sign in to comment.