Skip to content

ADicksonLab/mlforce_ft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OpenMM Machine Learning Plugin (MLForce)

This is an OpenMM plugin that makes possible the PyTorch models to be used for creating external forces.

Installation

There are three ways to install dependencies of this package.

  • Installing PyTorch from source and use the libtorch from it.
  • Installing LibTorch from its binary CXX ABI files or build it from its source following instruction at here.
  • Installing all 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 repository

https://github.com/ADicksonLab/mlforce_ft.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 in which to install MLForce

cd mlforce
mkdir build && cd build

4- Run the cmake command while passing the installed Libtorch path

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 library path to the environment 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"

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages