diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index f7e9b314bd..8833e55443 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -662,9 +662,14 @@ foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH MC MISC PHONON QEQ OPENMP KOKKOS OPT endif() endforeach() -if(PKG_PLUGIN) - target_compile_definitions(lammps PRIVATE -DLMP_PLUGIN) -endif() +###################################################################### +# packages with defines to disable package specific code +###################################################################### +foreach(PKG_WITH_DEF BPM PLUGIN) + if(PKG_${PKG_WITH_DEF}) + target_compile_definitions(lammps PRIVATE -DLMP_${PKG_WITH_DEF}) + endif() +endforeach() # link with -ldl or equivalent for plugin loading; except on Windows if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows") diff --git a/src/BPM/Install.sh b/src/BPM/Install.sh new file mode 100755 index 0000000000..7f3791a702 --- /dev/null +++ b/src/BPM/Install.sh @@ -0,0 +1,49 @@ +# Install/unInstall package files in LAMMPS +# mode = 0/1/2 for uninstall/install/update + +mode=$1 + +# enforce using portable C locale +LC_ALL=C +export LC_ALL + +# arg1 = file, arg2 = file it depends on + +action () { + if (test $mode = 0) then + rm -f ../$1 + elif (! cmp -s $1 ../$1) then + if (test -z "$2" || test -e ../$2) then + cp $1 .. + if (test $mode = 2) then + echo " updating src/$1" + fi + fi + elif (test -n "$2") then + if (test ! -e ../$2) then + rm -f ../$1 + fi + fi +} + +# all package files with no dependencies + +for file in *.cpp *.h; do + test -f ${file} && action $file +done + +# edit 2 Makefile.package files to include/exclude package info + +if (test $1 = 1) then + + if (test -e ../Makefile.package) then + sed -i -e 's|^PKG_INC =[ \t]*|&-DLMP_BPM |' ../Makefile.package + fi + +elif (test $1 = 0) then + + if (test -e ../Makefile.package) then + sed -i -e 's/[^ \t]*LMP_BPM[^ \t]* //' ../Makefile.package + fi + +fi diff --git a/src/delete_bonds.cpp b/src/delete_bonds.cpp index 1f8fe71bff..5a58da7905 100644 --- a/src/delete_bonds.cpp +++ b/src/delete_bonds.cpp @@ -19,12 +19,15 @@ #include "comm.h" #include "domain.h" #include "error.h" -#include "fix_bond_history.h" #include "force.h" #include "group.h" #include "modify.h" #include "special.h" +#if defined(LMP_BPM) +#include "fix_bond_history.h" +#endif + #include using namespace LAMMPS_NS; @@ -118,9 +121,11 @@ void DeleteBonds::command(int narg, char **arg) iarg++; } +#if defined(LMP_BPM) // find instances of bond history to delete data auto histories = modify->get_fix_by_style("BOND_HISTORY"); int n_histories = histories.size(); +#endif // border swap to ensure type and mask is current for off-proc atoms // enforce PBC before in case atoms are outside box @@ -337,11 +342,13 @@ void DeleteBonds::command(int narg, char **arg) n = atom->num_bond[i]; atom->bond_type[i][m] = atom->bond_type[i][n-1]; atom->bond_atom[i][m] = atom->bond_atom[i][n-1]; +#if defined(LMP_BPM) if (n_histories > 0) for (auto &ihistory: histories) { dynamic_cast(ihistory)->shift_history(i,m,n-1); dynamic_cast(ihistory)->delete_history(i,n-1); } +#endif atom->num_bond[i]--; } else m++; } else m++;