VASPml library: Difference between revisions
No edit summary |
No edit summary |
||
Line 11: | Line 11: | ||
= Build instructions = | = Build instructions = | ||
The VASPml library is automatically built alongside {{VASP}} if <code>-Dlibvaspml</code> is added to the <code>CPP_OPTIONS</code> [[Precompiler 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#Archetypical files|makefile.include templates]] provided in {{VASP}}'s <code>arch</code> directory contain pre-filled blocks corresponding to the VASPml build. Uncomment the VASPml-related lines and fill | The VASPml library is automatically built alongside {{VASP}} if <code>-Dlibvaspml</code> is added to the <code>CPP_OPTIONS</code> [[Precompiler 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#Archetypical files|makefile.include templates]] provided in {{VASP}}'s <code>arch</code> directory contain pre-filled blocks corresponding to the VASPml build. Uncomment the VASPml-related lines and fill with values according to your [[Toolchains|toolchain]]: | ||
... | ... | ||
# For machine learning library vaspml (experimental) | # For machine learning library vaspml (experimental) | ||
CPP_OPTIONS += -Dlibvaspml | |||
CPP_OPTIONS += -DVASPML_USE_CBLAS | |||
#CPP_OPTIONS += -DVASPML_DEBUG_LEVEL=3 | #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 | |||
... | ... | ||
Apart from the mandatory <code>-Dlibvaspml</code> flag there are the following possible <code>CPP_OPTIONS</code>: | |||
* <code>-DVASPML_DEBUG_LEVEL</code>: If set to 1, 2 or 3 enables various sanity checks during runtime with low, medium and high impact on performance, respectively. | |||
* <code>-DVASPML_USE_CBLAS</code>: Use CBLAS (C interface for BLAS routines) for linear algebra. This is the default and should always be used. | |||
* <code>-DVASPML_USE_MKL</code>: Use Intel MKL for linear algebra. | |||
In addition, VASPml requires to set its own compiler, flags and include path: | |||
* <code>CXX_ML</code>: This should be a C++17-compatible C++ compiler with MPI support. | |||
* <code>CXXFLAGS_ML</code>: Specifies the flags for the C++ compiler. | |||
* <code>INCLUDE_ML</code>: Paths in which to look for headers of required libraries. Here the include directory of BLAS should be listed. |
Revision as of 15:23, 22 January 2025
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 with values according to your toolchain:
... # 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 ...
Apart from the mandatory -Dlibvaspml
flag there are the following possible CPP_OPTIONS
:
-DVASPML_DEBUG_LEVEL
: If set to 1, 2 or 3 enables various sanity checks during runtime with low, medium and high impact on performance, respectively.-DVASPML_USE_CBLAS
: Use CBLAS (C interface for BLAS routines) for linear algebra. This is the default and should always be used.-DVASPML_USE_MKL
: Use Intel MKL for linear algebra.
In addition, VASPml requires to set its own compiler, flags and include path:
CXX_ML
: This should be a C++17-compatible C++ compiler with MPI support.CXXFLAGS_ML
: Specifies the flags for the C++ compiler.INCLUDE_ML
: Paths in which to look for headers of required libraries. Here the include directory of BLAS should be listed.