Skip to content

Commit

Permalink
Merge pull request lammps#4077 from akohlmey/fix_ewald_const_issue
Browse files Browse the repository at this point in the history
Fix compilation issue for some pair styles using ewald_const.h
  • Loading branch information
akohlmey authored Feb 13, 2024
2 parents c6a8f1f + 5b645b6 commit 254a849
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 90 deletions.
1 change: 1 addition & 0 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
10 changes: 2 additions & 8 deletions src/CLASS2/pair_lj_class2_coul_long.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -29,16 +30,9 @@
#include <cstring>

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)
Expand Down
9 changes: 2 additions & 7 deletions src/EXTRA-PAIR/pair_lj_cut_coul_dsf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -32,15 +33,9 @@
#include <cstring>

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)
Expand Down
9 changes: 2 additions & 7 deletions src/GPU/pair_coul_dsf_gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -29,14 +30,8 @@

#include <cmath>

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
Expand Down
9 changes: 2 additions & 7 deletions src/GPU/pair_lj_cut_coul_dsf_gpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -30,15 +31,9 @@
#include <cmath>

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,
Expand Down
9 changes: 2 additions & 7 deletions src/KOKKOS/pair_coul_dsf_kokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -32,15 +33,9 @@
#include <cmath>

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<class DeviceType>
Expand Down
9 changes: 2 additions & 7 deletions src/KOKKOS/pair_lj_cut_coul_dsf_kokkos.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -35,15 +36,9 @@
#include <cstring>

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<class DeviceType>
Expand Down
18 changes: 8 additions & 10 deletions src/OPENMP/pair_coul_dsf_omp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,26 +13,24 @@
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */

#include "omp_compat.h"
#include "pair_coul_dsf_omp.h"
#include <cmath>

#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 <cmath>

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) :
Expand Down
9 changes: 2 additions & 7 deletions src/OPENMP/pair_lj_cut_coul_dsf_omp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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) :
Expand Down
17 changes: 9 additions & 8 deletions src/OPENMP/pair_lj_cut_tip4p_long_omp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,23 +13,24 @@
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */

#include "omp_compat.h"
#include "pair_lj_cut_tip4p_long_omp.h"
#include <cmath>

#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 <cmath>

#include "omp_compat.h"

using namespace LAMMPS_NS;
using namespace EwaldConst;

/* ---------------------------------------------------------------------- */
Expand Down
15 changes: 8 additions & 7 deletions src/OPENMP/pair_lj_cut_tip4p_long_soft_omp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,23 @@
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */

#include "omp_compat.h"
#include <cmath>
#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 <cmath>

#include "omp_compat.h"

using namespace LAMMPS_NS;
using namespace EwaldConst;

Expand Down
15 changes: 8 additions & 7 deletions src/OPENMP/pair_tip4p_long_omp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,23 @@
Contributing author: Axel Kohlmeyer (Temple U)
------------------------------------------------------------------------- */

#include "omp_compat.h"
#include <cmath>
#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 <cmath>

#include "omp_compat.h"

using namespace LAMMPS_NS;
using namespace EwaldConst;

Expand Down
File renamed without changes.
9 changes: 2 additions & 7 deletions src/pair_coul_dsf.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -31,15 +32,9 @@
#include <cstring>

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) {}
Expand Down
2 changes: 1 addition & 1 deletion src/version.h
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#define LAMMPS_VERSION "7 Feb 2024"
#define LAMMPS_UPDATE "Development"
#define LAMMPS_UPDATE "Update 1"

0 comments on commit 254a849

Please sign in to comment.