added mliap_enable_ace to opt in/out of ace functionality in mliap
This commit is contained in:
@ -10,6 +10,15 @@ endif()
|
||||
|
||||
option(MLIAP_ENABLE_PYTHON "Build ML-IAP package with Python support" ${MLIAP_ENABLE_PYTHON_DEFAULT})
|
||||
|
||||
# if ML-PACE package is included we may also include ML-PACE support in ML-IAP
|
||||
set(MLIAP_ENABLE_ACE_DEFAULT OFF)
|
||||
if(PKG_ML-PACE)
|
||||
set(MLIAP_ENABLE_PYTHON_DEFAULT ON)
|
||||
endif()
|
||||
|
||||
option(MLIAP_ENABLE_PYTHON "Build ML-IAP package with Python support" ${MLIAP_ENABLE_PYTHON_DEFAULT})
|
||||
option(MLIAP_ENABLE_ACE "Build ML-IAP package with ACE support" ${MLIAP_ENABLE_ACE_DEFAULT})
|
||||
|
||||
if(MLIAP_ENABLE_PYTHON)
|
||||
find_package(Cythonize REQUIRED)
|
||||
find_package(Python COMPONENTS NumPy REQUIRED)
|
||||
@ -19,6 +28,12 @@ if(MLIAP_ENABLE_PYTHON)
|
||||
if(Python_VERSION VERSION_LESS 3.6)
|
||||
message(FATAL_ERROR "Python support in ML-IAP requires Python 3.6 or later")
|
||||
endif()
|
||||
if(MLIAP_ENABLE_ACE)
|
||||
if(NOT PKG_ML-PACE)
|
||||
message(FATAL_ERROR "Must enable PYTHON package and ML-PACE package for including ACE support in ML-IAP")
|
||||
endif()
|
||||
target_compile_definitions(lammps PRIVATE -DMLIAP_ACE)
|
||||
endif()
|
||||
|
||||
set(MLIAP_BINARY_DIR ${CMAKE_BINARY_DIR}/cython)
|
||||
file(GLOB MLIAP_CYTHON_SRC CONFIGURE_DEPENDS ${LAMMPS_SOURCE_DIR}/ML-IAP/*.pyx)
|
||||
|
||||
@ -23,7 +23,9 @@
|
||||
#include "mliap_model_quadratic.h"
|
||||
#include "mliap_descriptor_snap.h"
|
||||
#include "mliap_descriptor_so3.h"
|
||||
#ifdef MLIAP_ACE
|
||||
#include "mliap_descriptor_ace.h"
|
||||
#endif
|
||||
#ifdef MLIAP_PYTHON
|
||||
#include "mliap_model_python.h"
|
||||
#endif
|
||||
@ -95,11 +97,15 @@ ComputeMLIAP::ComputeMLIAP(LAMMPS *lmp, int narg, char **arg) :
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command");
|
||||
descriptor = new MLIAPDescriptorSO3(lmp,arg[iarg+2]);
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg+1],"ace") == 0) {
|
||||
}
|
||||
#ifdef MLIAP_ACE
|
||||
else if (strcmp(arg[iarg+1],"ace") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command");
|
||||
descriptor = new MLIAPDescriptorACE(lmp,arg[iarg+2]);
|
||||
iarg += 3;
|
||||
} else error->all(FLERR,"Illegal compute mliap command");
|
||||
}
|
||||
#endif
|
||||
else error->all(FLERR,"Illegal compute mliap command");
|
||||
descriptorflag = 1;
|
||||
} else if (strcmp(arg[iarg],"gradgradflag") == 0) {
|
||||
if (iarg+1 > narg) error->all(FLERR,"Illegal compute mliap command");
|
||||
|
||||
@ -14,6 +14,7 @@
|
||||
/* ----------------------------------------------------------------------
|
||||
Contributing author: James Goff (SNL)
|
||||
------------------------------------------------------------------------- */
|
||||
#ifdef MLIAP_ACE
|
||||
|
||||
#include "mliap_descriptor_ace.h"
|
||||
|
||||
@ -427,3 +428,5 @@ double MLIAPDescriptorACE::memory_usage()
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -21,7 +21,9 @@
|
||||
#include "mliap_data.h"
|
||||
#include "mliap_descriptor_snap.h"
|
||||
#include "mliap_descriptor_so3.h"
|
||||
#ifdef MLIAP_ACE
|
||||
#include "mliap_descriptor_ace.h"
|
||||
#endif
|
||||
#include "mliap_model_linear.h"
|
||||
#include "mliap_model_nn.h"
|
||||
#include "mliap_model_quadratic.h"
|
||||
@ -182,10 +184,15 @@ void PairMLIAP::settings(int narg, char ** arg)
|
||||
if (iarg+3 > narg) utils::missing_cmd_args(FLERR, "pair_style mliap descriptor so3", error);
|
||||
descriptor = new MLIAPDescriptorSO3(lmp,arg[iarg+2]);
|
||||
iarg += 3;
|
||||
} else if (strcmp(arg[iarg+1],"ace") == 0) {
|
||||
}
|
||||
#ifdef MLIAP_ACE
|
||||
else if (strcmp(arg[iarg+1],"ace") == 0) {
|
||||
if (iarg+3 > narg) error->all(FLERR,"Illegal pair_style mliap command");
|
||||
descriptor = new MLIAPDescriptorACE(lmp,arg[iarg+2]);
|
||||
iarg += 3;
|
||||
} else error->all(FLERR,"Illegal pair_style mliap command");
|
||||
}
|
||||
#endif
|
||||
else error->all(FLERR,"Illegal pair_style mliap command");
|
||||
} else if (strcmp(arg[iarg], "unified") == 0) {
|
||||
#ifdef MLIAP_PYTHON
|
||||
if (model != nullptr) error->all(FLERR,"Illegal multiple pair_style mliap model definitions");
|
||||
|
||||
Reference in New Issue
Block a user