VASPml library

From VASP Wiki
Revision as of 14:53, 22 January 2025 by Singraber (talk | contribs)

VASPml is a C++ library accompanying VASP, providing functionality related to machine-learned force fields. It is supposed to extend, and eventually replace, the original Fortran machine learning code inside VASP. Currently, it does not yet offer any training capabilities but rather focuses on inference. At this point VASPml is in a beta-testing stage and provides its first application, an interface to the popular molecular dynamics (MD) software LAMMPS. This allows users to combine VASP-generated machine-learned force fields with the large amount of MD-related features provided by LAMMPS, some of which may not be offered in VASP directly.

Warning: As of VASP 6.5.0 the VASPml library is experimental and results should be carefully checked against the standard Fortran code (compile without -Dlibvaspml or set ML_LIB = .FALSE.).

Supported features

  • Fast prediction-only mode in VASP (ML_MODE = run)
  • Running VASP machine-learned force fields in LAMMPS

If VASP is compiled with the VASPml library and a requested feature is supported by both, the original Fortran code and the C++ VASPml implementation, then the latter code path is used by default. To override this behavior and explicitly avoid the use of the VASPml library set ML_LIB = .FALSE. in the INCAR file.

Build instructions

The VASPml library is automatically built alongside VASP if -Dlibvaspml is added to the CPP_OPTIONS precompiler option in the makefile.include file. In addition, a few more compiler settings regarding the C++ compiler, include paths and VASPml options may be required. The makefile.include templates provided in VASP's arch directory contain pre-filled blocks corresponding to the VASPml build. Uncomment the VASPml-related lines and fill and This may look like this:

...
# For machine learning library vaspml (experimental)
#CPP_OPTIONS += -Dlibvaspml
#CPP_OPTIONS += -DVASPML_USE_CBLAS
#CPP_OPTIONS += -DVASPML_DEBUG_LEVEL=3
#CXX_ML      = mpic++
#CXXFLAGS_ML = -O3 -std=c++17 -pedantic-errors -Wall -Wextra
#INCLUDE_ML  = -I$(OPENBLAS_ROOT)/include
...