Skip to content

Quantum-for-Life/SymmetryFunctions

Repository files navigation

Symmetry Functions

This library calculates symmetry functions and their derivatives for machine learning potentials. For a short introduction see:

J. Behler, J. Chem. Phys. 134, 074106 (2011) (https://doi.org/10.1063/1.3553717)

The implementation is based on the concept of symmetry groups, as introduced in

A. Singraber, J, Behler, C. Dellago, J. Chem. Theory Comput. 15, 1827 (2019) (https://pubs.acs.org/doi/full/10.1021/acs.jctc.8b00770)

Supported Symmetry Functions

Requirements

Main Library

  • Git.
  • OpenMP.
  • cmake 3.22 (or later).
  • GCC/G++ 11.4, C++ 17 standard (other compilers may work but are not tested; there are/were known compatibility problems between Torch and GCC < 9, GCC >= 12. You can try setting -DWARNINGS_AS_ERRORS=OFF to avoid compiler errors caused by warnings from this issue).

Python Bindings

  • Pybind11 (installed automatically if not available).

Unit Tests

  • GTest (installed automatically if not available).
  • Boost/filesystem (1.74.0 or later).

Torch Bindings (available in Python)

Installation

Method 1: Manual Build and Install

git submodule init
git submodule update
mkdir build
cd build
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../inst -DCMAKE_PREFIX_PATH="$(python -c 'import torch.utils; print(torch.utils.cmake_prefix_path)')" ..
make -j10
make install

After calling make install, your installation directory will include the header files (include), and a directory lib containing the shared library for the Python bindings (SymFuncPy.cpython-<version-specification>.so), the static library with the main implementation (libSymmetryFunctions.a), and the Torch bindings libSymFuncTorch.so. Export the path to the lib directory in your PYTHON_PATH to access the Python bindings.

Other optional CMake flags:

  • -DSYM_PYTHON_BINDINGS=ON/OFF, default ON.
  • -DSYM_ENABLE_TESTS=ON/OFF, default ON.
  • -DSYMMETRY_FUNCTIONS_MARCH=<march-flag>, default native.
  • -DPYTHON_EXECUTABLE=<path to Python interpreter>.
  • -DSYM_TORCH_BINDINGS=ON/OFF, default ON.
  • -D_GLIBCXX_USE_CXX11_ABI=0 to use pre CXX11 ABI (REQUIRED by some torch versions.).
  • -DWARNINGS_AS_ERRORS=ON/OFF, default ON. Compile with the -Werror.

Required CMake flags for Torch bindings:

  • Add -DCMAKE_PREFIX_PATH="$(python -c 'import torch.utils; print(torch.utils.cmake_prefix_path)')" to the cmake call.

Method 2: Install Python Bindings via pip

git submodule init
git submodule update
python3 -m pip install .

You can pass arguments to cmake by exporting the variable CMAKE_ARGS, e.g., CMAKE_ARGS=-DSYM_ENABLE_TESTS=OFF to disable compiling the tests. Note that installing with pip will also change the directory of the Torch bindings shared library to your python-environment site-package directory.

Tests

After compiling (installation not required), the test executable SymmetryFunctions_tests will be in the directory build/bin. You can run the tests by executing ./SymmetryFunctions_tests.

Python Bindings

See src/Tests/python_bindings_test.py for an example.

Torch Bindings

See src/Tests/torch_bindings_test.py for an example.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •