/mlforce

A PyTorch OpenMM plugin to generate forces for Flexible Topology simulations

Primary LanguageC++

OpenMM Machine Learning Plugin (MLForce)

flexibletopology.jpg

This is an OpenMM plugin that generates forces from the TorchANI model. These forces are used to change the attributes and positions of particles referred to as “Ghost Particles” in the Flexible Topology simultaions. For more details read FLEXIBLE TOPOLOGY: A NEW METHOD FOR DYNAMIC DRUG DESIGN paper on Chemrxiv.

Installation

There are three ways to install dependencies of this package.

  • Install PyTorch from source and use the libtorch from it.
  • Install LibTorch from its binary CXX ABI files or build it from its source following instruction at here.
  • Install all the packages from Conda-forge channel via conda.

Here we provide instructions uisng the third method, follow these instructions to install MLForce

1- clone MLforce from its repositiry

git clone https://github.com/ADicksonLab/mlforce.git

2- You should use conda to make a new virtual environment using the environment.yml

conda env create -n myenv -f environment.yml
conda activate myenv

3- Create build directory to install MLForce in it

cd mlforce
mkdir build && cd build

4- Run the cmake command by passing the installed Libtorch path to it

cmake -DCMAKE_PREFIX_PATH="$(python -c 'import torch.utils; print(torch.utils.cmake_prefix_path)')" ..

5- Run the ccmake command to set up the configuration for bulding MLForce

ccmake -i ..

6-Make sure that the path to OPENMM_DIR and CMAKE_INSTALL_PREFIX set to the OpenMM path you installed

7- If you want to build the CUDA platform set the NN_BUILD_CUDA_LIB to on and if you want to build the OpenCL platform set the NN_BUILD_OPENCL_LIB to on as well

8- Press “c” to configure the plugin then press “g” to generate it

9- Install the MLForce plugin

make install

10- Install the Python wrapper

make PythonInstall

11- Add Libtorch libraray path to the environmental variable LD_LIBRARY_PATH

export LIBTORCH_LIBRARY_PATH="path/to/libtorch/lib"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$LIBTORCH_LIBRARY_PATH"

you can get the path to LibTorch by doing

python -c 'import torch.utils; print(torch.utils.cmake_prefix_path)'

12- Test if the installation works

python -c "import mlforce"

Authors

Donyapour N, Roussey N, Bose S, Dickson A.