KLIFF: A framework to develop physics-based and machine learning interatomic potentials

Abstract Interatomic potentials (IPs) are reduced-order models for calculating the potential energy of a system of atoms given their positions in space and species. IPs treat atoms as classical particles without explicitly modeling electrons and thus are computationally far less expensive than first-principles methods, enabling molecular simulations of significantly larger systems over longer times. Developing an IP is a complex iterative process involving multiple steps: assembling a training set, designing a functional form, optimizing the function parameters, testing model quality, and deployment to molecular simulation packages. This paper introduces the KIM-based learning-integrated fitting framework (KLIFF), a package that facilitates the entire IP development process. KLIFF supports both physics-based and machine learning IPs. It adopts a modular approach whereby various components in the fitting process, such as atomic environment descriptors, functional forms, loss functions, optimizers, quality analyzers, and so on, work seamlessly with each other. This provides a flexible framework for the rapid design of new IP forms. Trained IPs are compatible with the Knowledgebase of Interatomic Models (KIM) application programming interface (API) and can be readily used in major materials simulation packages compatible with KIM, including ASE, DL_POLY, GULP, LAMMPS, and QC. KLIFF is written in Python with computationally intensive components implemented in C++. It is parallelized over data and supports both shared-memory multicore desktop machines and high-performance distributed memory computing clusters. We demonstrate the use of KLIFF by fitting a physics-based Stillinger–Weber potential and a machine learning neural network potential for silicon. The KLIFF package, together with its documentation, is publicly available at: https://github.com/openkim/kliff . Program summary Program Title: KIM-based Learning-integrated Fitting Framework (KLIFF) Licensing provisions: LGPL 2.1 Programming language: Python, C++ Supplementary material: Example scripts for the demonstrations, which are compatible with KLIFF v0.3.0. Nature of problem: Development of a model called an interatomic potential (IP) representing the potential energy of a system of atoms based on their positions in space and species. This is a complex iterative process involving multiple steps: assembling a training set, designing a functional form, optimizing the function parameters, testing IP quality, and deployment of the fitted IP to molecular simulation packages. Solution method: The fitting process is formulated as an optimization problem where a loss function characterizing the IP error over a training set is minimized to obtain the optimal fitting parameters. KLIFF is designed in a modular fashion providing the user with flexible access to different functional forms, loss functions, optimization algorithms, and analyzers for testing the quality of the fitted IP. KLIFF is built on the Knowledgebase of Interatomic Models (KIM) API standard, which enables immediate deployment of fitted IPs to major materials simulation packages that are compatible with KIM.