From a48da5b1e4f7c82f485e92912960b4813b159b86 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 13 Feb 2024 08:02:32 -0500 Subject: [PATCH 1/3] move ewald_const.h to src and apply it to a few more files --- src/CLASS2/pair_lj_class2_coul_long.cpp | 10 ++-------- src/EXTRA-PAIR/pair_lj_cut_coul_dsf.cpp | 9 ++------- src/GPU/pair_coul_dsf_gpu.cpp | 9 ++------- src/GPU/pair_lj_cut_coul_dsf_gpu.cpp | 9 ++------- src/KOKKOS/pair_coul_dsf_kokkos.cpp | 9 ++------- src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp | 9 ++------- src/OPENMP/pair_coul_dsf_omp.cpp | 18 ++++++++---------- src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp | 9 ++------- src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp | 17 +++++++++-------- src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp | 15 ++++++++------- src/OPENMP/pair_tip4p_long_omp.cpp | 15 ++++++++------- src/{KSPACE => }/ewald_const.h | 0 src/pair_coul_dsf.cpp | 9 ++------- 13 files changed, 49 insertions(+), 89 deletions(-) rename src/{KSPACE => }/ewald_const.h (100%) diff --git a/src/CLASS2/pair_lj_class2_coul_long.cpp b/src/CLASS2/pair_lj_class2_coul_long.cpp index 2a3d7a706ef..965810c8f7b 100644 --- a/src/CLASS2/pair_lj_class2_coul_long.cpp +++ b/src/CLASS2/pair_lj_class2_coul_long.cpp @@ -16,6 +16,7 @@ #include "atom.h" #include "comm.h" #include "error.h" +#include "ewald_const.h" #include "force.h" #include "kspace.h" #include "math_const.h" @@ -29,16 +30,9 @@ #include using namespace LAMMPS_NS; +using namespace EwaldConst; using namespace MathConst; -static constexpr double EWALD_F = 1.12837917; -static constexpr double EWALD_P = 0.3275911; -static constexpr double A1 = 0.254829592; -static constexpr double A2 = -0.284496736; -static constexpr double A3 = 1.421413741; -static constexpr double A4 = -1.453152027; -static constexpr double A5 = 1.061405429; - /* ---------------------------------------------------------------------- */ PairLJClass2CoulLong::PairLJClass2CoulLong(LAMMPS *lmp) : Pair(lmp) diff --git a/src/EXTRA-PAIR/pair_lj_cut_coul_dsf.cpp b/src/EXTRA-PAIR/pair_lj_cut_coul_dsf.cpp index 93560629145..6ac0c1cdaeb 100644 --- a/src/EXTRA-PAIR/pair_lj_cut_coul_dsf.cpp +++ b/src/EXTRA-PAIR/pair_lj_cut_coul_dsf.cpp @@ -22,6 +22,7 @@ #include "atom.h" #include "comm.h" #include "error.h" +#include "ewald_const.h" #include "force.h" #include "math_const.h" #include "memory.h" @@ -32,15 +33,9 @@ #include using namespace LAMMPS_NS; +using namespace EwaldConst; using namespace MathConst; -static constexpr double EWALD_P = 0.3275911; -static constexpr double A1 = 0.254829592; -static constexpr double A2 = -0.284496736; -static constexpr double A3 = 1.421413741; -static constexpr double A4 = -1.453152027; -static constexpr double A5 = 1.061405429; - /* ---------------------------------------------------------------------- */ PairLJCutCoulDSF::PairLJCutCoulDSF(LAMMPS *lmp) : Pair(lmp) diff --git a/src/GPU/pair_coul_dsf_gpu.cpp b/src/GPU/pair_coul_dsf_gpu.cpp index a3ac4542e8c..86f104d2e86 100644 --- a/src/GPU/pair_coul_dsf_gpu.cpp +++ b/src/GPU/pair_coul_dsf_gpu.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "domain.h" #include "error.h" +#include "ewald_const.h" #include "force.h" #include "gpu_extra.h" #include "math_const.h" @@ -29,14 +30,8 @@ #include -static constexpr double EWALD_P = 0.3275911; -static constexpr double A1 = 0.254829592; -static constexpr double A2 = -0.284496736; -static constexpr double A3 = 1.421413741; -static constexpr double A4 = -1.453152027; -static constexpr double A5 = 1.061405429; - using namespace LAMMPS_NS; +using namespace EwaldConst; using MathConst::MY_PIS; // External functions from cuda library for atom decomposition diff --git a/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp b/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp index d389425e6ac..32a4008defd 100644 --- a/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp +++ b/src/GPU/pair_lj_cut_coul_dsf_gpu.cpp @@ -20,6 +20,7 @@ #include "atom.h" #include "domain.h" #include "error.h" +#include "ewald_const.h" #include "force.h" #include "gpu_extra.h" #include "math_const.h" @@ -30,15 +31,9 @@ #include using namespace LAMMPS_NS; +using namespace EwaldConst; using MathConst::MY_PIS; -static constexpr double EWALD_P = 0.3275911; -static constexpr double A1 = 0.254829592; -static constexpr double A2 = -0.284496736; -static constexpr double A3 = 1.421413741; -static constexpr double A4 = -1.453152027; -static constexpr double A5 = 1.061405429; - // External functions from cuda library for atom decomposition int ljd_gpu_init(const int ntypes, double **cutsq, double **host_lj1, double **host_lj2, diff --git a/src/KOKKOS/pair_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_coul_dsf_kokkos.cpp index 936b6b1d8c6..5184c420967 100644 --- a/src/KOKKOS/pair_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_coul_dsf_kokkos.cpp @@ -21,6 +21,7 @@ #include "atom_kokkos.h" #include "atom_masks.h" #include "error.h" +#include "ewald_const.h" #include "force.h" #include "kokkos.h" #include "math_const.h" @@ -32,15 +33,9 @@ #include using namespace LAMMPS_NS; +using namespace EwaldConst; using namespace MathConst; -static constexpr double EWALD_P = 0.3275911; -static constexpr double A1 = 0.254829592; -static constexpr double A2 = -0.284496736; -static constexpr double A3 = 1.421413741; -static constexpr double A4 = -1.453152027; -static constexpr double A5 = 1.061405429; - /* ---------------------------------------------------------------------- */ template diff --git a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp index 628cb29b0e6..0e415819c66 100644 --- a/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp +++ b/src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp @@ -21,6 +21,7 @@ #include "atom_kokkos.h" #include "atom_masks.h" #include "error.h" +#include "ewald_const.h" #include "force.h" #include "kokkos.h" #include "math_const.h" @@ -35,15 +36,9 @@ #include using namespace LAMMPS_NS; +using namespace EwaldConst; using MathConst::MY_PIS; -static constexpr double EWALD_P = 0.3275911; -static constexpr double A1 = 0.254829592; -static constexpr double A2 = -0.284496736; -static constexpr double A3 = 1.421413741; -static constexpr double A4 = -1.453152027; -static constexpr double A5 = 1.061405429; - /* ---------------------------------------------------------------------- */ template diff --git a/src/OPENMP/pair_coul_dsf_omp.cpp b/src/OPENMP/pair_coul_dsf_omp.cpp index 64f4c1ce8d4..d19263c3bbf 100644 --- a/src/OPENMP/pair_coul_dsf_omp.cpp +++ b/src/OPENMP/pair_coul_dsf_omp.cpp @@ -13,26 +13,24 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "pair_coul_dsf_omp.h" -#include + #include "atom.h" #include "comm.h" +#include "ewald_const.h" #include "force.h" #include "neigh_list.h" +#include "math_const.h" +#include "omp_compat.h" #include "suffix.h" -#include "math_const.h" + +#include + using namespace LAMMPS_NS; +using namespace EwaldConst; using MathConst::MY_PIS; -static constexpr double EWALD_P = 0.3275911; -static constexpr double A1 = 0.254829592; -static constexpr double A2 = -0.284496736; -static constexpr double A3 = 1.421413741; -static constexpr double A4 = -1.453152027; -static constexpr double A5 = 1.061405429; - /* ---------------------------------------------------------------------- */ PairCoulDSFOMP::PairCoulDSFOMP(LAMMPS *lmp) : diff --git a/src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp b/src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp index d05d49f277d..d43c161d07a 100644 --- a/src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp +++ b/src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp @@ -17,6 +17,7 @@ #include "atom.h" #include "comm.h" +#include "ewald_const.h" #include "force.h" #include "math_const.h" #include "neigh_list.h" @@ -27,15 +28,9 @@ #include "omp_compat.h" using namespace LAMMPS_NS; +using namespace EwaldConst; using MathConst::MY_PIS; -static constexpr double EWALD_P = 0.3275911; -static constexpr double A1 = 0.254829592; -static constexpr double A2 = -0.284496736; -static constexpr double A3 = 1.421413741; -static constexpr double A4 = -1.453152027; -static constexpr double A5 = 1.061405429; - /* ---------------------------------------------------------------------- */ PairLJCutCoulDSFOMP::PairLJCutCoulDSFOMP(LAMMPS *lmp) : diff --git a/src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp b/src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp index 2654ac17fed..8f824ca272b 100644 --- a/src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp +++ b/src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp @@ -13,23 +13,24 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" #include "pair_lj_cut_tip4p_long_omp.h" -#include + #include "atom.h" -#include "domain.h" #include "comm.h" -#include "ewald_const.h" -#include "force.h" -#include "neighbor.h" +#include "domain.h" #include "error.h" #include "ewald_const.h" +#include "force.h" #include "memory.h" #include "neigh_list.h" - +#include "neighbor.h" #include "suffix.h" -using namespace LAMMPS_NS; +#include + +#include "omp_compat.h" + +using namespace LAMMPS_NS; using namespace EwaldConst; /* ---------------------------------------------------------------------- */ diff --git a/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp b/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp index e1c668202a3..a646a2dec1f 100644 --- a/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp +++ b/src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp @@ -13,22 +13,23 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_lj_cut_tip4p_long_soft_omp.h" + #include "atom.h" -#include "domain.h" #include "comm.h" -#include "ewald_const.h" -#include "force.h" -#include "neighbor.h" +#include "domain.h" #include "error.h" #include "ewald_const.h" +#include "force.h" #include "memory.h" #include "neigh_list.h" - +#include "neighbor.h" #include "suffix.h" +#include + +#include "omp_compat.h" + using namespace LAMMPS_NS; using namespace EwaldConst; diff --git a/src/OPENMP/pair_tip4p_long_omp.cpp b/src/OPENMP/pair_tip4p_long_omp.cpp index 96e063d1104..186549a9996 100644 --- a/src/OPENMP/pair_tip4p_long_omp.cpp +++ b/src/OPENMP/pair_tip4p_long_omp.cpp @@ -13,22 +13,23 @@ Contributing author: Axel Kohlmeyer (Temple U) ------------------------------------------------------------------------- */ -#include "omp_compat.h" -#include #include "pair_tip4p_long_omp.h" + #include "atom.h" -#include "domain.h" #include "comm.h" -#include "ewald_const.h" -#include "force.h" -#include "neighbor.h" +#include "domain.h" #include "error.h" #include "ewald_const.h" +#include "force.h" #include "memory.h" #include "neigh_list.h" - +#include "neighbor.h" #include "suffix.h" +#include + +#include "omp_compat.h" + using namespace LAMMPS_NS; using namespace EwaldConst; diff --git a/src/KSPACE/ewald_const.h b/src/ewald_const.h similarity index 100% rename from src/KSPACE/ewald_const.h rename to src/ewald_const.h diff --git a/src/pair_coul_dsf.cpp b/src/pair_coul_dsf.cpp index b384946e861..44dc9a75247 100644 --- a/src/pair_coul_dsf.cpp +++ b/src/pair_coul_dsf.cpp @@ -21,6 +21,7 @@ #include "atom.h" #include "comm.h" #include "error.h" +#include "ewald_const.h" #include "force.h" #include "math_const.h" #include "memory.h" @@ -31,15 +32,9 @@ #include using namespace LAMMPS_NS; +using namespace EwaldConst; using namespace MathConst; -static constexpr double EWALD_P = 0.3275911; -static constexpr double A1 = 0.254829592; -static constexpr double A2 = -0.284496736; -static constexpr double A3 = 1.421413741; -static constexpr double A4 = -1.453152027; -static constexpr double A5 = 1.061405429; - /* ---------------------------------------------------------------------- */ PairCoulDSF::PairCoulDSF(LAMMPS *lmp) : Pair(lmp) {} From 0273fb4ad496cc7c6d8ba280da398b12d1fa914b Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 13 Feb 2024 08:22:05 -0500 Subject: [PATCH 2/3] flag as update 1 version --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index 76ede29b688..ffee4352d49 100644 --- a/src/version.h +++ b/src/version.h @@ -1,2 +1,2 @@ #define LAMMPS_VERSION "7 Feb 2024" -#define LAMMPS_UPDATE "Development" +#define LAMMPS_UPDATE "Update 1" From 5b645b631b56449e007396cecc2fb2bf18c32fa2 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 13 Feb 2024 11:09:25 -0500 Subject: [PATCH 3/3] add detection for CrayClang to the OpenMP compatibility check --- cmake/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index 835a54f382f..c387d00f7c2 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -428,6 +428,7 @@ if(BUILD_OMP) (CMAKE_CXX_COMPILER_ID STREQUAL "IntelLLVM") OR (CMAKE_CXX_COMPILER_ID STREQUAL "XLClang") OR ((CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR ((CMAKE_CXX_COMPILER_ID STREQUAL "Clang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR + ((CMAKE_CXX_COMPILER_ID STREQUAL "CrayClang") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 10.0)) OR ((CMAKE_CXX_COMPILER_ID STREQUAL "Intel") AND (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 19.0))) # GCC 9.x and later plus Clang 10.x and later implement strict OpenMP 4.0 semantics for consts. # Intel 18.0 was tested to support both, so we switch to OpenMP 4+ from 19.x onward to be safe.