Copyright © 2025 Hanyu Liu.
AI2Pot is distributed under the GNU General Public License v3.0.
AI2Pot (Ab Initio and Artificial Intelligence POTential) is a machine-learning interatomic-potential framework for materials modeling. It integrates multiple potential models, including the Moment Tensor Potential (MTP) and Neuroevolution Potential (NEP), within a unified PyTorch-based training and simulation workflow.
AI2Pot provides:
- Unified implementations of MTP and NEP
- High-performance C++ and CUDA operators
- PyTorch-based training, inference, and evaluation pipelines
- Interoperability with pymatgen, ASE, and LAMMPS
- A companion CLI tool,
AI2Pot-cli, for data preprocessing, model training, and post-processing. (Repository: https://github.com/lhycms/AI2Pot-cli)
For a CUDA-enabled installation, set CUDA_HOME to the CUDA toolkit compatible with the installed PyTorch version:
$ export CUDA_HOME=/path/to/cuda
$ export PATH="${CUDA_HOME}/bin:${PATH}"
$ export LD_LIBRARY_PATH="${CUDA_HOME}/lib64:${LD_LIBRARY_PATH}"For example:
$ export CUDA_HOME=/usr/local/cuda-12.4Check the CUDA compiler:
$ nvcc --versionChoose either the CPU or CUDA version.
$ conda create -n ai2pot python=3.11.13$ python -m pip install torch==2.5.0 \
--index-url https://download.pytorch.org/whl/cpu$ python -m pip install torch==2.5.0 \
--index-url https://download.pytorch.org/whl/cu124Verify the PyTorch installation:
$ python -c "import torch; print(torch.__version__); print(torch.version.cuda)"AI2Pot currently needs to compile against the NumPy and PyTorch packages installed in the active Python environment. Therefore, build isolation must be disabled.
Install the build backend first:
$ python -m pip install -U pip setuptools wheel
$ python -m pip install \
scikit-build-core==0.12.2 \
cmake==4.3.2 \
pybind11==2.11.1
$ python -m pip install -r requirements-lock.txtThen install AI2Pot:
$ CMAKE_BUILD_PARALLEL_LEVEL=16 python -m pip install -v --no-build-isolation --no-deps .CMAKE_BUILD_PARALLEL_LEVEL controls the number of parallel compilation jobs. Reduce this value if compilation consumes too much memory.
To use specific C, C++, and CUDA host compilers:
$ CMAKE_BUILD_PARALLEL_LEVEL=16 \
CC=/path/to/gcc \
CXX=/path/to/g++ \
CUDAHOSTCXX=/path/to/g++ \
python -m pip install -v --no-build-isolation --no-deps .Developer installation and maintainer notes
$ export AI2POT_PATH=/path/to/AI2Pot$ cd "${AI2POT_PATH}/source"
$ mkdir -p build
$ cd buildConfigure the project:
$ cmake \
-DBUILD_TEST=ON \
-DTORCH_OP=ON \
-DUSE_CUDA=ON \
-DUSE_OPENMP=ON \
-DMAX_MTP_LEVEL=20 \
..Compile and install:
$ cmake --build . --parallel 16
$ cmake --install .Equivalent Make commands:
$ make -j16
$ make installInstall the Python package in editable mode:
$ cd "${AI2POT_PATH}"
$ CMAKE_BUILD_PARALLEL_LEVEL=16 \
CC=/data/app/gcc/11.3.0/bin/gcc \
CXX=/data/app/gcc/11.3.0/bin/g++ \
CUDAHOSTCXX=/data/app/gcc/11.3.0/bin/g++ \
python -m pip install --no-build-isolation --no-deps -v -e .-DCMAKE_C_COMPILER=/path/to/gcc
-DCMAKE_CXX_COMPILER=/path/to/g++
-DCMAKE_CUDA_HOST_COMPILER=/path/to/g++
-DCMAKE_INSTALL_PREFIX=$HOME/.ai2pot
C compiler: /data/app/gcc/11.3.0/bin/gcc
C++ compiler: /data/app/gcc/11.3.0/bin/g++
CUDA host compiler: /data/app/gcc/11.3.0/bin/g++
Equivalent installation command:
$ CMAKE_BUILD_PARALLEL_LEVEL=16 \
CC=/data/app/gcc/11.3.0/bin/gcc \
CXX=/data/app/gcc/11.3.0/bin/g++ \
CUDAHOSTCXX=/data/app/gcc/11.3.0/bin/g++ \
python -m pip install -v --no-build-isolation --no-deps .Add the repository path to .vscode/settings.json if Pylance cannot resolve the local package:
{
"python.analysis.extraPaths": [
"/path/to/AI2Pot"
]
}- Copy the AI2Pot interface files into the LAMMPS source directory:
$ cp AI2Pot/interface/lammps/AI2POT lammps/src
$ cp AI2Pot/interface/lammps/Makefile.mpi lammps/src/MAKE/- Build LAMMPS with the AI2POT package:
$ cd lammps/src
$ make yes-AI2POT
$ make -j 16 mpi \
TORCH_ROOT=$(python -c "import torch, os; print(os.path.dirname(torch.__file__))") \
AI2POT_ROOT=$(python -c "import ai2pot, os; print(os.path.dirname(ai2pot.__file__))")pair_style ai2pot ./ai2pot_libtorch.pt
pair_coeff * * Ge Sb Te[Liu2026] Hanyu Liu, Linggang Zhu, Xuanguang Zhang, Ning Yang, Jian Zhou, Zhimei Sun. AI2Pot: A scalable and unified framework for machine-learning interatomic potential development and large-scale molecular dynamics simulations, arXiv preprint arXiv:2607.06969 (2026).