Revert "make delete_bonds command code compatible with BPM package not being installed"

This reverts commit 715b030bd6.
This commit is contained in:
Axel Kohlmeyer
2024-01-17 15:46:03 -05:00
parent f78f596d9d
commit b47ad7acf4
3 changed files with 4 additions and 65 deletions

View File

@ -662,14 +662,9 @@ foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH MC MISC PHONON QEQ OPENMP KOKKOS OPT
endif()
endforeach()
######################################################################
# 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()
if(PKG_PLUGIN)
target_compile_definitions(lammps PRIVATE -DLMP_PLUGIN)
endif()
# link with -ldl or equivalent for plugin loading; except on Windows
if(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "Windows")

View File

@ -1,49 +0,0 @@
# 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

View File

@ -19,15 +19,12 @@
#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 <cstring>
using namespace LAMMPS_NS;
@ -121,11 +118,9 @@ 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
@ -342,13 +337,11 @@ 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<FixBondHistory *>(ihistory)->shift_history(i,m,n-1);
dynamic_cast<FixBondHistory *>(ihistory)->delete_history(i,n-1);
}
#endif
atom->num_bond[i]--;
} else m++;
} else m++;