The goal of this project is to promote the use of neural network potentials (NNPs) by providing highly optimized, open source implementations of bottleneck operations that appear in popular potentials. These are the core design principles.
-
Each operation is entirely self contained, consisting of only a few source files that can easily be incorporated into any code that needs to use it.
-
Each operation has a simple, clearly documented API allowing it to be easily used in any context.
-
We provide both CPU (pure C++) and CUDA implementations of all operations.
-
The CUDA implementations are highly optimized. The CPU implementations are written in a generally efficient way, but no particular efforts have been made to tune them for optimum performance.
-
This code is designed for inference (running simulations), not training (creating new potential functions). It computes gradients with respect to particle positions, not model parameters.
A conda package can be installed from the conda-forge channel:
conda install -c conda-forge nnpopsIf you don't have conda, we recommend installing Miniconda.
- CUDA Toolkit (https://developer.nvidia.com/cuda-downloads)
- Miniconda (https://docs.conda.io/en/latest/miniconda.html)
- Get the source code
$ git clone https://github.com/openmm/NNPOps.git- Create and activate a Conda environment
$ cd NNPOps
$ conda env create -n nnpops -f environment.yml
$ conda activate nnpops- Configure, build, and install (note: for some older PyTorch versions, you may
need to add
-DTorch_DIR=$(python -c 'import torch.utils; print(torch.utils.cmake_prefix_path)')/Torchas an argument tocmake; for newer PyTorch versions, this is unnecessary, and may actually cause CMake configuration to fail)
$ mkdir build && cd build
$ cmake .. -DCMAKE_INSTALL_PREFIX=$CONDA_PREFIX
$ make install- Run the tests
$ ctest --verboseThe following optimized operations are present in NNPOps and accessible from Python using the listed classes or functions:
- ANI symmetry functions:
NNPOps.SymmetryFunctions.ANISymmetryFunctions - Continuous filter convolution (CFConv):
NNPOps.CFConv.CFConv,NNPOps.CFConv.CFConvNeighbors - Neighbor pair enumeration:
NNPOps.neighbors.getNeighborPairs() - Particle mesh Ewald (PME):
NNPOps.pme.PME