From 88ac09a8c04e266e6e1c0d3dc6df26fdca56dbf7 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 13 Dec 2022 16:29:12 -0500 Subject: [PATCH] build system support: fix sgcmc may only be compiled if EAM is available --- cmake/CMakeLists.txt | 2 +- cmake/Modules/Packages/MC.cmake | 9 +++++ src/.gitignore | 2 ++ src/MC/Install.sh | 63 +++++++++++++++++++++++++++++++++ 4 files changed, 75 insertions(+), 1 deletion(-) create mode 100644 cmake/Modules/Packages/MC.cmake create mode 100755 src/MC/Install.sh diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index c96f5576a5..ec142af426 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -668,7 +668,7 @@ endif() # packages which selectively include variants based on enabled styles # e.g. accelerator packages ###################################################################### -foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH MISC PHONON QEQ OPENMP KOKKOS OPT INTEL GPU) +foreach(PKG_WITH_INCL CORESHELL DPD-SMOOTH MC MISC PHONON QEQ OPENMP KOKKOS OPT INTEL GPU) if(PKG_${PKG_WITH_INCL}) include(Packages/${PKG_WITH_INCL}) endif() diff --git a/cmake/Modules/Packages/MC.cmake b/cmake/Modules/Packages/MC.cmake new file mode 100644 index 0000000000..f162254558 --- /dev/null +++ b/cmake/Modules/Packages/MC.cmake @@ -0,0 +1,9 @@ +# fix sgcmc may only be installed if also the EAM pair style from MANYBODY is installed +if(NOT PKG_MANYBODY) + get_property(LAMMPS_FIX_HEADERS GLOBAL PROPERTY FIX) + list(REMOVE_ITEM LAMMPS_FIX_HEADERS ${LAMMPS_SOURCE_DIR}/MC/fix_sgcmc.h) + set_property(GLOBAL PROPERTY FIX "${LAMMPS_FIX_HEADERS}") + get_target_property(LAMMPS_SOURCES lammps SOURCES) + list(REMOVE_ITEM LAMMPS_SOURCES ${LAMMPS_SOURCE_DIR}/MC/fix_sgcmc.cpp) + set_property(TARGET lammps PROPERTY SOURCES "${LAMMPS_SOURCES}") +endif() diff --git a/src/.gitignore b/src/.gitignore index 0fbd54afcd..19f4d924b0 100644 --- a/src/.gitignore +++ b/src/.gitignore @@ -920,6 +920,8 @@ /fix_rigid_nvt_small.h /fix_rigid_small.cpp /fix_rigid_small.h +/fix_sgcmc.cpp +/fix_sgcmc.h /fix_shake.cpp /fix_shake.h /fix_shardlow.cpp diff --git a/src/MC/Install.sh b/src/MC/Install.sh new file mode 100755 index 0000000000..ccf6767c4d --- /dev/null +++ b/src/MC/Install.sh @@ -0,0 +1,63 @@ +# Install/unInstall package files in LAMMPS +# mode = 0/1/2 for uninstall/install/update + +# this is default Install.sh for all packages +# if package has an auxiliary library or a file with a dependency, +# then package dir has its own customized Install.sh + +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 + + +action fix_atom_swap.cpp +action fix_atom_swap.h +action fix_bond_break.cpp +action fix_bond_break.h +action fix_bond_create_angle.cpp +action fix_bond_create_angle.h +action fix_bond_create.cpp +action fix_bond_create.h +action fix_bond_swap.cpp +action fix_bond_swap.h +action fix_charge_regulation.cpp +action fix_charge_regulation.h +action fix_gcmc.cpp +action fix_gcmc.h +action fix_mol_swap.cpp +action fix_mol_swap.h +action fix_sgcmc.cpp pair_eam.cpp +action fix_sgcmc.h pair_eam.h +action fix_tfmc.cpp +action fix_tfmc.h +action fix_widom.cpp +action fix_widom.h +action pair_dsmc.cpp +action pair_dsmc.h