This module implements the interface between PLUMED and metatomic, allowing to use arbitrary machine learning models as collective variables. These machine learning models are defined using custom Python code — following the metatomic interface — and then exported to TorchScript. The exported model is then loaded inside PLUMED and executed during the simulation.
This module requires two main dependencies: the C++ torch library (i.e. libtorch); and the C++ metatomic_torch library. There are multiple ways of installing both libraries, which are discussed below.
pip)The easiest way to get all dependencies on your system is to download the pre-built Python wheels with pip. This is the same set of wheels you will need to define custom models.
That's it, you can now jump to the last part of the installation instructions.
You can also use conda with the conda-forge channel to install all dependencies:
That's it, you can now jump to the last part of the installation instructions.
You can also compile all required libraries from source. To this end, please follow the corresponding instructions:
Once everything is compiled and installed, you should set the corresponding preprocessor flags in CPPFLAGS and the corresponding linker flags in LDFLAGS.
Once you installed all dependencies with one of the methods above, you can now configure PLUMED:
checking libtorch and a line about checking libmetatomic, both ending with ...yes. If this is not the case, you'll get a warning about cannot enable __PLUMED_HAS_LIBTORCH or cannot enable __PLUMED_HAS_LIBMETATOMIC. config.log to know more about what's going on and why these libraries can't be found.This module defines the following actions:
| METATOMIC | Use arbitrary machine learning models as collective variables. |