From 718cfc4562150ad87dc1def13003f0060ce8de39 Mon Sep 17 00:00:00 2001 From: Stan Moore Date: Thu, 16 Nov 2023 14:31:50 -0700 Subject: [PATCH 1/7] Fix indexing bug --- src/npair_trim.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/npair_trim.cpp b/src/npair_trim.cpp index a4b6c1c6a1d..f026466f927 100644 --- a/src/npair_trim.cpp +++ b/src/npair_trim.cpp @@ -63,7 +63,7 @@ void NPairTrim::build(NeighList *list) neighptr = ipage->vget(); const int i = ilist_copy[ii]; - ilist[i] = i; + ilist[ii] = i; xtmp = x[i][0]; ytmp = x[i][1]; ztmp = x[i][2]; From 6f366b8c74a4eb2aa3ddd7718f6ffa4666e2dd62 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Thu, 16 Nov 2023 16:21:59 -0700 Subject: [PATCH 2/7] Fix issues with sorting neigh list by cutoff distance --- src/neighbor.cpp | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 8d12edeef2b..20d63065720 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -1123,15 +1123,14 @@ int Neighbor::init_pair() } /* ---------------------------------------------------------------------- - sort NeighRequests by cutoff distance - to find smallest list for trimming + sort NeighRequests by cutoff distance for trimming ------------------------------------------------------------------------- */ void Neighbor::sort_requests() { - NeighRequest *jrq; + NeighRequest *irq,*jrq; int i,j,jmin; - double jcut; + double icut,jcut; delete[] j_sorted; j_sorted = new int[nrequest]; @@ -1139,20 +1138,24 @@ void Neighbor::sort_requests() for (i = 0; i < nrequest; i++) j_sorted[i] = i; - for (i = 0; i < nrequest; i++) { - double cutoff_min = cutneighmax; + for (i = 0; i < nrequest-1; i++) { + irq = requests[j_sorted[i]]; + if (irq->cut) icut = irq->cutoff; + else icut = cutneighmax; + double cutoff_min = icut; jmin = i; - for (j = i; j < nrequest-1; j++) { + for (j = i+1; j < nrequest; j++) { jrq = requests[j_sorted[j]]; if (jrq->cut) jcut = jrq->cutoff; else jcut = cutneighmax; - if (jcut <= cutoff_min) { + if (jcut < cutoff_min) { cutoff_min = jcut; jmin = j; } } + int tmp = j_sorted[i]; j_sorted[i] = j_sorted[jmin]; j_sorted[jmin] = tmp; From 4608444ada642a4d31a32a2d54454f57cabb6949 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Thu, 16 Nov 2023 16:23:09 -0700 Subject: [PATCH 3/7] Add trim option to skip neighbor list build styles --- src/KOKKOS/npair_skip_kokkos.cpp | 44 +++-- src/KOKKOS/npair_skip_kokkos.h | 42 ++++- src/neighbor.cpp | 56 +++--- src/npair_skip_respa_trim.cpp | 193 ++++++++++++++++++++ src/npair_skip_respa_trim.h | 40 ++++ src/npair_skip_size_off2on_oneside_trim.cpp | 185 +++++++++++++++++++ src/npair_skip_size_off2on_oneside_trim.h | 40 ++++ src/npair_skip_size_off2on_trim.cpp | 112 ++++++++++++ src/npair_skip_size_off2on_trim.h | 40 ++++ src/npair_skip_size_trim.cpp | 102 +++++++++++ src/npair_skip_size_trim.h | 39 ++++ src/npair_skip_trim.cpp | 118 ++++++++++++ src/npair_skip_trim.h | 46 +++++ 13 files changed, 1019 insertions(+), 38 deletions(-) create mode 100644 src/npair_skip_respa_trim.cpp create mode 100644 src/npair_skip_respa_trim.h create mode 100644 src/npair_skip_size_off2on_oneside_trim.cpp create mode 100644 src/npair_skip_size_off2on_oneside_trim.h create mode 100644 src/npair_skip_size_off2on_trim.cpp create mode 100644 src/npair_skip_size_off2on_trim.h create mode 100644 src/npair_skip_size_trim.cpp create mode 100644 src/npair_skip_size_trim.h create mode 100644 src/npair_skip_trim.cpp create mode 100644 src/npair_skip_trim.h diff --git a/src/KOKKOS/npair_skip_kokkos.cpp b/src/KOKKOS/npair_skip_kokkos.cpp index 4492a3794a0..15c0487010f 100644 --- a/src/KOKKOS/npair_skip_kokkos.cpp +++ b/src/KOKKOS/npair_skip_kokkos.cpp @@ -23,8 +23,8 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -template -NPairSkipKokkos::NPairSkipKokkos(LAMMPS *lmp) : NPair(lmp) { +template +NPairSkipKokkos::NPairSkipKokkos(LAMMPS *lmp) : NPair(lmp) { atomKK = (AtomKokkos *) atom; execution_space = ExecutionSpaceFromDevice::space; d_inum = typename AT::t_int_scalar("npair_skip:inum"); @@ -38,13 +38,18 @@ NPairSkipKokkos::NPairSkipKokkos(LAMMPS *lmp) : NPair(lmp) { if ghost, also store neighbors of ghost atoms & set inum,gnum correctly ------------------------------------------------------------------------- */ -template -void NPairSkipKokkos::build(NeighList *list) +template +void NPairSkipKokkos::build(NeighList *list) { atomKK->sync(execution_space,TYPE_MASK); type = atomKK->k_type.view(); nlocal = atom->nlocal; + if (TRIM) { + x = atomKK->k_x.view(); + atomKK->sync(execution_space,X_MASK); + cutsq_custom = cutoff_custom*cutoff_custom; + } NeighListKokkos* k_list_skip = static_cast*>(list->listskip); d_ilist_skip = k_list_skip->d_ilist; @@ -100,13 +105,20 @@ void NPairSkipKokkos::build(NeighList *list) copymode = 0; } -template +template KOKKOS_INLINE_FUNCTION -void NPairSkipKokkos::operator()(TagNPairSkipCompute, const int &ii, int &inum, const bool &final) const { +void NPairSkipKokkos::operator()(TagNPairSkipCompute, const int &ii, int &inum, const bool &final) const { const int i = d_ilist_skip(ii); const int itype = type(i); + F_FLOAT xtmp,ytmp,ztmp; + if (TRIM) { + xtmp = x(i,0); + ytmp = x(i,1); + ztmp = x(i,2); + } + if (!d_iskip(itype)) { if (final) { @@ -123,6 +135,15 @@ void NPairSkipKokkos::operator()(TagNPairSkipCompute, const int &ii, const int joriginal = d_neighbors_skip(i,jj); int j = joriginal & NEIGHMASK; if (d_ijskip(itype,type(j))) continue; + + if (TRIM) { + const double delx = xtmp - x(j,0); + const double dely = ytmp - x(j,1); + const double delz = ztmp - x(j,2); + const double rsq = delx*delx + dely*dely + delz*delz; + if (rsq > cutsq_custom) continue; + } + neighbors_i(n++) = joriginal; } @@ -139,16 +160,17 @@ void NPairSkipKokkos::operator()(TagNPairSkipCompute, const int &ii, } } -template +template KOKKOS_INLINE_FUNCTION -void NPairSkipKokkos::operator()(TagNPairSkipCountLocal, const int &i, int &num) const { +void NPairSkipKokkos::operator()(TagNPairSkipCountLocal, const int &i, int &num) const { if (d_ilist[i] < nlocal) num++; } - namespace LAMMPS_NS { -template class NPairSkipKokkos; +template class NPairSkipKokkos; +template class NPairSkipKokkos; #ifdef LMP_KOKKOS_GPU -template class NPairSkipKokkos; +template class NPairSkipKokkos; +template class NPairSkipKokkos; #endif } diff --git a/src/KOKKOS/npair_skip_kokkos.h b/src/KOKKOS/npair_skip_kokkos.h index fd1217bef44..7672a2c36ce 100644 --- a/src/KOKKOS/npair_skip_kokkos.h +++ b/src/KOKKOS/npair_skip_kokkos.h @@ -13,33 +13,62 @@ #ifdef NPAIR_CLASS // clang-format off -typedef NPairSkipKokkos NPairKokkosSkipDevice; +typedef NPairSkipKokkos NPairKokkosSkipDevice; NPairStyle(skip/kk/device, NPairKokkosSkipDevice, NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_KOKKOS_DEVICE); -typedef NPairSkipKokkos NPairKokkosSkipGhostDevice; +typedef NPairSkipKokkos NPairKokkosSkipGhostDevice; NPairStyle(skip/ghost/kk/device, NPairKokkosSkipGhostDevice, NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_GHOST | NP_KOKKOS_DEVICE); -typedef NPairSkipKokkos NPairKokkosSkipHost; +typedef NPairSkipKokkos NPairKokkosSkipHost; NPairStyle(skip/kk/host, NPairKokkosSkipHost, NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_KOKKOS_HOST); -typedef NPairSkipKokkos NPairKokkosSkipGhostHost; +typedef NPairSkipKokkos NPairKokkosSkipGhostHost; NPairStyle(skip/ghost/kk/host, NPairKokkosSkipGhostHost, NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_GHOST | NP_KOKKOS_HOST); + +typedef NPairSkipKokkos NPairKokkosSkipTrimDevice; +NPairStyle(skip/kk/device, + NPairKokkosSkipTrimDevice, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM |NP_KOKKOS_DEVICE); + +typedef NPairSkipKokkos NPairKokkosSkipTrimGhostDevice; +NPairStyle(skip/ghost/kk/device, + NPairKokkosSkipTrimGhostDevice, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_GHOST | NP_KOKKOS_DEVICE); + +typedef NPairSkipKokkos NPairKokkosSkipTrimHost; +NPairStyle(skip/kk/host, + NPairKokkosSkipTrimHost, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_KOKKOS_HOST); + +typedef NPairSkipKokkos NPairKokkosSkipTrimGhostHost; +NPairStyle(skip/ghost/kk/host, + NPairKokkosSkipTrimGhostHost, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_GHOST | NP_KOKKOS_HOST); + // clang-format on #else @@ -55,7 +84,7 @@ namespace LAMMPS_NS { struct TagNPairSkipCompute{}; struct TagNPairSkipCountLocal{}; -template +template class NPairSkipKokkos : public NPair { public: typedef DeviceType device_type; @@ -72,8 +101,9 @@ class NPairSkipKokkos : public NPair { void operator()(TagNPairSkipCountLocal, const int&, int&) const; private: - int nlocal,num_skip; + int nlocal,num_skip,cutsq_custom; + typename AT::t_x_array_randomread x; typename AT::t_int_1d_randomread type; typename AT::t_int_scalar d_inum; diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 20d63065720..b6f3363b0c3 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -852,6 +852,7 @@ int Neighbor::init_pair() // morph requests in various ways // purpose is to avoid duplicate or inefficient builds + // also sort requests by cutoff distance for trimming // may add new requests if a needed request to derive from does not exist // methods: // (1) unique = create unique lists if cutoff is explicitly set @@ -868,15 +869,9 @@ int Neighbor::init_pair() int nrequest_original = nrequest; morph_unique(); + sort_requests(); morph_skip(); morph_granular(); // this method can change flags set by requestor - - // sort requests by cutoff distance for trimming, used by - // morph_halffull and morph_copy_trim. Must come after - // morph_skip() which change the number of requests - - sort_requests(); - morph_halffull(); morph_copy_trim(); @@ -1210,11 +1205,15 @@ void Neighbor::morph_unique() void Neighbor::morph_skip() { - int i,j,inewton,jnewton; + int i,j,jj,inewton,jnewton,icut,jcut; NeighRequest *irq,*jrq,*nrq; - for (i = 0; i < nrequest; i++) { - irq = requests[i]; + // loop over irq from largest to smallest cutoff + // to prevent adding unecessary neighbor lists + + for (i = nrequest-1; i >= 0; i--) { + irq = requests[j_sorted[i]]; + int trim_flag = irq->trim; // only processing skip lists @@ -1229,7 +1228,9 @@ void Neighbor::morph_skip() // check all other lists - for (j = 0; j < nrequest; j++) { + for (jj = 0; jj < nrequest; jj++) { + j = j_sorted[jj]; + if (i == j) continue; jrq = requests[j]; @@ -1252,10 +1253,20 @@ void Neighbor::morph_skip() if (jnewton == 0) jnewton = force->newton_pair ? 1 : 2; if (inewton != jnewton) continue; + // trim a list with longer cutoff + + if (irq->cut) icut = irq->cutoff; + else icut = cutneighmax; + + if (jrq->cut) jcut = jrq->cutoff; + else jcut = cutneighmax; + + if (icut > jcut) continue; + else if (icut != jcut) trim_flag = 1; + // these flags must be same, // else 2 lists do not store same pairs // or their data structures are different - // this includes custom cutoff set by requestor // NOTE: need check for 2 Kokkos flags? if (irq->ghost != jrq->ghost) continue; @@ -1267,8 +1278,6 @@ void Neighbor::morph_skip() if (irq->kokkos_host != jrq->kokkos_host) continue; if (irq->kokkos_device != jrq->kokkos_device) continue; if (irq->ssa != jrq->ssa) continue; - if (irq->cut != jrq->cut) continue; - if (irq->cutoff != jrq->cutoff) continue; // 2 lists are a match @@ -1282,8 +1291,10 @@ void Neighbor::morph_skip() // note: parents of skip lists do not have associated history // b/c child skip lists have the associated history - if (j < nrequest) irq->skiplist = j; - else { + if (jj < nrequest) { + irq->skiplist = j; + irq->trim = trim_flag; + } else { int newrequest = request(this,-1); irq->skiplist = newrequest; @@ -1293,6 +1304,8 @@ void Neighbor::morph_skip() nrq->neigh = 1; nrq->skip = 0; if (irq->unique) nrq->unique = 1; + + sort_requests(); } } } @@ -1394,8 +1407,7 @@ void Neighbor::morph_halffull() // check all other lists for (jj = 0; jj < nrequest; jj++) { - if (irq->cut) j = j_sorted[jj]; - else j = jj; + j = j_sorted[jj]; jrq = requests[j]; @@ -1473,8 +1485,7 @@ void Neighbor::morph_copy_trim() // check all other lists for (jj = 0; jj < nrequest; jj++) { - if (irq->cut) j = j_sorted[jj]; - else j = jj; + j = j_sorted[jj]; if (i == j) continue; jrq = requests[j]; @@ -1786,7 +1797,10 @@ void Neighbor::print_pairwise_info() else out += fmt::format(", half/full from ({})",rq->halffulllist+1); else if (rq->skip) - out += fmt::format(", skip from ({})",rq->skiplist+1); + if (rq->trim) + out += fmt::format(", skip trim from ({})",rq->skiplist+1); + else + out += fmt::format(", skip from ({})",rq->skiplist+1); out += "\n"; // list of neigh list attributes diff --git a/src/npair_skip_respa_trim.cpp b/src/npair_skip_respa_trim.cpp new file mode 100644 index 00000000000..64b1c4d7165 --- /dev/null +++ b/src/npair_skip_respa_trim.cpp @@ -0,0 +1,193 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "npair_skip_respa_trim.h" + +#include "atom.h" +#include "error.h" +#include "my_page.h" +#include "neigh_list.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +NPairSkipRespaTrim::NPairSkipRespaTrim(LAMMPS *lmp) : NPair(lmp) {} + +/* ---------------------------------------------------------------------- + build skip list for subset of types from parent list + iskip and ijskip flag which atom types and type pairs to skip + this is for respa lists, copy the inner/middle values from parent +------------------------------------------------------------------------- */ + +void NPairSkipRespaTrim::build(NeighList *list) +{ + int i,j,ii,jj,n,itype,jnum,joriginal,n_inner,n_middle; + int *neighptr,*jlist,*neighptr_inner,*neighptr_middle; + + int *type = atom->type; + + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; + MyPage *ipage = list->ipage; + + int *ilist_skip = list->listskip->ilist; + int *numneigh_skip = list->listskip->numneigh; + int **firstneigh_skip = list->listskip->firstneigh; + int inum_skip = list->listskip->inum; + + int *iskip = list->iskip; + int **ijskip = list->ijskip; + + int *ilist_inner = list->ilist_inner; + int *numneigh_inner = list->numneigh_inner; + int **firstneigh_inner = list->firstneigh_inner; + MyPage *ipage_inner = list->ipage_inner; + int *numneigh_inner_skip = list->listskip->numneigh_inner; + int **firstneigh_inner_skip = list->listskip->firstneigh_inner; + + int *ilist_middle,*numneigh_middle,**firstneigh_middle; + MyPage *ipage_middle; + int *numneigh_middle_skip,**firstneigh_middle_skip; + int respamiddle = list->respamiddle; + if (respamiddle) { + ilist_middle = list->ilist_middle; + numneigh_middle = list->numneigh_middle; + firstneigh_middle = list->firstneigh_middle; + ipage_middle = list->ipage_middle; + numneigh_middle_skip = list->listskip->numneigh_middle; + firstneigh_middle_skip = list->listskip->firstneigh_middle; + } + + int inum = 0; + ipage->reset(); + ipage_inner->reset(); + if (respamiddle) ipage_middle->reset(); + + double **x = atom->x; + double xtmp, ytmp, ztmp; + double delx, dely, delz, rsq; + double cutsq_custom = cutoff_custom * cutoff_custom; + + // loop over atoms in other list + // skip I atom entirely if iskip is set for type[I] + // skip I,J pair if ijskip is set for type[I],type[J] + + for (ii = 0; ii < inum_skip; ii++) { + i = ilist_skip[ii]; + itype = type[i]; + if (iskip[itype]) continue; + + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + + n = n_inner = 0; + neighptr = ipage->vget(); + neighptr_inner = ipage_inner->vget(); + if (respamiddle) { + n_middle = 0; + neighptr_middle = ipage_middle->vget(); + } + + // loop over parent outer rRESPA list + + jlist = firstneigh_skip[i]; + jnum = numneigh_skip[i]; + + for (jj = 0; jj < jnum; jj++) { + joriginal = jlist[jj]; + j = joriginal & NEIGHMASK; + if (ijskip[itype][type[j]]) continue; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cutsq_custom) continue; + + neighptr[n++] = joriginal; + } + + // loop over parent inner rRESPA list + + jlist = firstneigh_inner_skip[i]; + jnum = numneigh_inner_skip[i]; + + for (jj = 0; jj < jnum; jj++) { + joriginal = jlist[jj]; + j = joriginal & NEIGHMASK; + if (ijskip[itype][type[j]]) continue; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cutsq_custom) continue; + + neighptr_inner[n_inner++] = joriginal; + } + + // loop over parent middle rRESPA list + + if (respamiddle) { + jlist = firstneigh_middle_skip[i]; + jnum = numneigh_middle_skip[i]; + + for (jj = 0; jj < jnum; jj++) { + joriginal = jlist[jj]; + j = joriginal & NEIGHMASK; + if (ijskip[itype][type[j]]) continue; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cutsq_custom) continue; + + neighptr_middle[n_middle++] = joriginal; + } + } + + ilist[inum] = i; + firstneigh[i] = neighptr; + numneigh[i] = n; + ipage->vgot(n); + if (ipage->status()) + error->one(FLERR,"Neighbor list overflow, boost neigh_modify one"); + + ilist_inner[inum] = i; + firstneigh_inner[i] = neighptr_inner; + numneigh_inner[i] = n_inner; + ipage_inner->vgot(n); + if (ipage_inner->status()) + error->one(FLERR,"Neighbor list overflow, boost neigh_modify one"); + + if (respamiddle) { + ilist_middle[inum] = i; + firstneigh_middle[i] = neighptr_middle; + numneigh_middle[i] = n_middle; + ipage_middle->vgot(n); + if (ipage_middle->status()) + error->one(FLERR,"Neighbor list overflow, boost neigh_modify one"); + } + + inum++; + } + + list->inum = inum; + list->inum_inner = inum; + if (respamiddle) list->inum_middle = inum; +} diff --git a/src/npair_skip_respa_trim.h b/src/npair_skip_respa_trim.h new file mode 100644 index 00000000000..f10b726cbe8 --- /dev/null +++ b/src/npair_skip_respa_trim.h @@ -0,0 +1,40 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef NPAIR_CLASS +// clang-format off +NPairStyle(skip/half/respa/trim, + NPairSkipRespaTrim, + NP_SKIP | NP_RESPA | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM); +// clang-format on +#else + +#ifndef LMP_NPAIR_SKIP_RESPA_TRIM_H +#define LMP_NPAIR_SKIP_RESPA_TRIM_H + +#include "npair.h" + +namespace LAMMPS_NS { + +class NPairSkipRespaTrim : public NPair { + public: + NPairSkipRespaTrim(class LAMMPS *); + void build(class NeighList *) override; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/npair_skip_size_off2on_oneside_trim.cpp b/src/npair_skip_size_off2on_oneside_trim.cpp new file mode 100644 index 00000000000..91940d31353 --- /dev/null +++ b/src/npair_skip_size_off2on_oneside_trim.cpp @@ -0,0 +1,185 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "npair_skip_size_off2on_oneside_trim.h" + +#include "atom.h" +#include "domain.h" +#include "error.h" +#include "my_page.h" +#include "neigh_list.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +NPairSkipSizeOff2onOnesideTrim::NPairSkipSizeOff2onOnesideTrim(LAMMPS *lmp) : + NPair(lmp) {} + +/* ---------------------------------------------------------------------- + build skip list for subset of types from parent list + iskip and ijskip flag which atom types and type pairs to skip + parent non-skip list used newton off and was not onesided, + this skip list is newton on and onesided +------------------------------------------------------------------------- */ + +void NPairSkipSizeOff2onOnesideTrim::build(NeighList *list) +{ + int i,j,ii,jj,itype,jnum,joriginal,flip,tmp; + int *surf,*jlist; + + int *type = atom->type; + int nlocal = atom->nlocal; + + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; + MyPage *ipage = list->ipage; + + int *ilist_skip = list->listskip->ilist; + int *numneigh_skip = list->listskip->numneigh; + int **firstneigh_skip = list->listskip->firstneigh; + int inum_skip = list->listskip->inum; + + int *iskip = list->iskip; + int **ijskip = list->ijskip; + + if (domain->dimension == 2) surf = atom->line; + else surf = atom->tri; + + int inum = 0; + ipage->reset(); + + double **x = atom->x; + double xtmp, ytmp, ztmp; + double delx, dely, delz, rsq; + double cutsq_custom = cutoff_custom * cutoff_custom; + + // two loops over parent list required, one to count, one to store + // because onesided constraint means pair I,J may be stored with I or J + // so don't know in advance how much space to alloc for each atom's neighs + + // first loop over atoms in other list to count neighbors + // skip I atom entirely if iskip is set for type[I] + // skip I,J pair if ijskip is set for type[I],type[J] + + for (i = 0; i < nlocal; i++) numneigh[i] = 0; + + for (ii = 0; ii < inum_skip; ii++) { + i = ilist_skip[ii]; + itype = type[i]; + if (iskip[itype]) continue; + + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + + // loop over parent non-skip size list + + jlist = firstneigh_skip[i]; + jnum = numneigh_skip[i]; + + for (jj = 0; jj < jnum; jj++) { + joriginal = jlist[jj]; + j = joriginal & NEIGHMASK; + if (ijskip[itype][type[j]]) continue; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cutsq_custom) continue; + + // flip I,J if necessary to satisfy onesided constraint + // do not keep if I is now ghost + + if (surf[i] >= 0) { + if (j >= nlocal) continue; + tmp = i; + i = j; + j = tmp; + flip = 1; + } else flip = 0; + + numneigh[i]++; + if (flip) i = j; + } + } + + // allocate all per-atom neigh list chunks + + for (i = 0; i < nlocal; i++) { + if (numneigh[i] == 0) continue; + firstneigh[i] = ipage->get(numneigh[i]); + if (ipage->status()) + error->one(FLERR,"Neighbor list overflow, boost neigh_modify one"); + } + + // second loop over atoms in other list to store neighbors + // skip I atom entirely if iskip is set for type[I] + // skip I,J pair if ijskip is set for type[I],type[J] + + for (i = 0; i < nlocal; i++) numneigh[i] = 0; + + for (ii = 0; ii < inum_skip; ii++) { + i = ilist_skip[ii]; + itype = type[i]; + if (iskip[itype]) continue; + + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + + // loop over parent non-skip size list and optionally its history info + + jlist = firstneigh_skip[i]; + jnum = numneigh_skip[i]; + + for (jj = 0; jj < jnum; jj++) { + joriginal = jlist[jj]; + j = joriginal & NEIGHMASK; + if (ijskip[itype][type[j]]) continue; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cutsq_custom) continue; + + // flip I,J if necessary to satisfy onesided constraint + // do not keep if I is now ghost + + if (surf[i] >= 0) { + if (j >= nlocal) continue; + tmp = i; + i = j; + j = tmp; + flip = 1; + } else flip = 0; + + // store j in neigh list, not joriginal, like other neigh methods + // OK, b/c there is no special list flagging for surfs + + firstneigh[i][numneigh[i]] = j; + numneigh[i]++; + if (flip) i = j; + } + + // only add atom I to ilist if it has neighbors + + if (numneigh[i]) ilist[inum++] = i; + } + + list->inum = inum; +} diff --git a/src/npair_skip_size_off2on_oneside_trim.h b/src/npair_skip_size_off2on_oneside_trim.h new file mode 100644 index 00000000000..236b886fe41 --- /dev/null +++ b/src/npair_skip_size_off2on_oneside_trim.h @@ -0,0 +1,40 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef NPAIR_CLASS +// clang-format off +NPairStyle(skip/size/off2on/oneside/trim, + NPairSkipSizeOff2onOnesideTrim, + NP_SKIP | NP_SIZE | NP_OFF2ON | NP_ONESIDE | NP_HALF | + NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF | + NP_ORTHO | NP_TRI | NP_TRIM); +// clang-format on +#else + +#ifndef LMP_NPAIR_SKIP_SIZE_OFF2ON_ONESIDE_TRIM_H +#define LMP_NPAIR_SKIP_SIZE_OFF2ON_ONESIDE_TRIM_H + +#include "npair.h" + +namespace LAMMPS_NS { + +class NPairSkipSizeOff2onOnesideTrim : public NPair { + public: + NPairSkipSizeOff2onOnesideTrim(class LAMMPS *); + void build(class NeighList *) override; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/npair_skip_size_off2on_trim.cpp b/src/npair_skip_size_off2on_trim.cpp new file mode 100644 index 00000000000..9591bbc4eb5 --- /dev/null +++ b/src/npair_skip_size_off2on_trim.cpp @@ -0,0 +1,112 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "npair_skip_size_off2on_trim.h" + +#include "atom.h" +#include "error.h" +#include "my_page.h" +#include "neigh_list.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +NPairSkipSizeOff2onTrim::NPairSkipSizeOff2onTrim(LAMMPS *lmp) : NPair(lmp) {} + +/* ---------------------------------------------------------------------- + build skip list for subset of types from parent list + iskip and ijskip flag which atom types and type pairs to skip + parent non-skip list used newton off, this skip list is newton on +------------------------------------------------------------------------- */ + +void NPairSkipSizeOff2onTrim::build(NeighList *list) +{ + int i, j, ii, jj, n, itype, jnum, joriginal; + tagint itag, jtag; + int *neighptr, *jlist; + + tagint *tag = atom->tag; + int *type = atom->type; + int nlocal = atom->nlocal; + + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; + MyPage *ipage = list->ipage; + + int *ilist_skip = list->listskip->ilist; + int *numneigh_skip = list->listskip->numneigh; + int **firstneigh_skip = list->listskip->firstneigh; + int inum_skip = list->listskip->inum; + + int *iskip = list->iskip; + int **ijskip = list->ijskip; + + int inum = 0; + ipage->reset(); + + double **x = atom->x; + double xtmp, ytmp, ztmp; + double delx, dely, delz, rsq; + double cutsq_custom = cutoff_custom * cutoff_custom; + + // loop over atoms in other list + // skip I atom entirely if iskip is set for type[I] + // skip I,J pair if ijskip is set for type[I],type[J] + + for (ii = 0; ii < inum_skip; ii++) { + i = ilist_skip[ii]; + itype = type[i]; + if (iskip[itype]) continue; + itag = tag[i]; + + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + + n = 0; + neighptr = ipage->vget(); + + // loop over parent non-skip size list and optionally its history info + + jlist = firstneigh_skip[i]; + jnum = numneigh_skip[i]; + + for (jj = 0; jj < jnum; jj++) { + joriginal = jlist[jj]; + j = joriginal & NEIGHMASK; + if (ijskip[itype][type[j]]) continue; + + // only keep I,J when J = ghost if Itag < Jtag + + jtag = tag[j]; + if (j >= nlocal && jtag < itag) continue; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cutsq_custom) continue; + + neighptr[n++] = joriginal; + } + + ilist[inum++] = i; + firstneigh[i] = neighptr; + numneigh[i] = n; + ipage->vgot(n); + if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); + } + list->inum = inum; +} diff --git a/src/npair_skip_size_off2on_trim.h b/src/npair_skip_size_off2on_trim.h new file mode 100644 index 00000000000..e471ddd2cc0 --- /dev/null +++ b/src/npair_skip_size_off2on_trim.h @@ -0,0 +1,40 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef NPAIR_CLASS +// clang-format off +NPairStyle(skip/size/off2on/trim, + NPairSkipSizeOff2onTrim, + NP_SKIP | NP_SIZE | NP_OFF2ON | NP_HALF | + NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM); +// clang-format on +#else + +#ifndef LMP_NPAIR_SKIP_SIZE_OFF2ON_TRIM_H +#define LMP_NPAIR_SKIP_SIZE_OFF2ON_TRIM_H + +#include "npair.h" + +namespace LAMMPS_NS { + +class NPairSkipSizeOff2onTrim : public NPair { + public: + NPairSkipSizeOff2onTrim(class LAMMPS *); + void build(class NeighList *) override; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/npair_skip_size_trim.cpp b/src/npair_skip_size_trim.cpp new file mode 100644 index 00000000000..3fd8f912f97 --- /dev/null +++ b/src/npair_skip_size_trim.cpp @@ -0,0 +1,102 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "npair_skip_size_trim.h" + +#include "atom.h" +#include "error.h" +#include "my_page.h" +#include "neigh_list.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +NPairSkipSizeTrim::NPairSkipSizeTrim(LAMMPS *lmp) : NPair(lmp) {} + +/* ---------------------------------------------------------------------- + build skip list for subset of types from parent list + iskip and ijskip flag which atom types and type pairs to skip +------------------------------------------------------------------------- */ + +void NPairSkipSizeTrim::build(NeighList *list) +{ + int i, j, ii, jj, n, itype, jnum, joriginal; + int *neighptr, *jlist; + + int *type = atom->type; + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; + MyPage *ipage = list->ipage; + + int *ilist_skip = list->listskip->ilist; + int *numneigh_skip = list->listskip->numneigh; + int **firstneigh_skip = list->listskip->firstneigh; + int inum_skip = list->listskip->inum; + + int *iskip = list->iskip; + int **ijskip = list->ijskip; + + int inum = 0; + ipage->reset(); + + double **x = atom->x; + double xtmp, ytmp, ztmp; + double delx, dely, delz, rsq; + double cutsq_custom = cutoff_custom * cutoff_custom; + + // loop over atoms in other list + // skip I atom entirely if iskip is set for type[I] + // skip I,J pair if ijskip is set for type[I],type[J] + + for (ii = 0; ii < inum_skip; ii++) { + i = ilist_skip[ii]; + itype = type[i]; + if (iskip[itype]) continue; + + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + + n = 0; + neighptr = ipage->vget(); + + // loop over parent non-skip size list + + jlist = firstneigh_skip[i]; + jnum = numneigh_skip[i]; + + for (jj = 0; jj < jnum; jj++) { + joriginal = jlist[jj]; + j = joriginal & NEIGHMASK; + if (ijskip[itype][type[j]]) continue; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cutsq_custom) continue; + + neighptr[n++] = joriginal; + } + + ilist[inum++] = i; + firstneigh[i] = neighptr; + numneigh[i] = n; + ipage->vgot(n); + if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); + } + + list->inum = inum; +} diff --git a/src/npair_skip_size_trim.h b/src/npair_skip_size_trim.h new file mode 100644 index 00000000000..e94b2f5f296 --- /dev/null +++ b/src/npair_skip_size_trim.h @@ -0,0 +1,39 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef NPAIR_CLASS +// clang-format off +NPairStyle(skip/half/size/trim, + NPairSkipSizeTrim, + NP_SKIP | NP_SIZE | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM); +// clang-format on +#else + +#ifndef LMP_NPAIR_SKIP_SIZE_TRIM_H +#define LMP_NPAIR_SKIP_SIZE_TRIM_H + +#include "npair.h" + +namespace LAMMPS_NS { + +class NPairSkipSizeTrim : public NPair { + public: + NPairSkipSizeTrim(class LAMMPS *); + void build(class NeighList *) override; +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/npair_skip_trim.cpp b/src/npair_skip_trim.cpp new file mode 100644 index 00000000000..a286a7e19e1 --- /dev/null +++ b/src/npair_skip_trim.cpp @@ -0,0 +1,118 @@ +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#include "npair_skip_trim.h" + +#include "atom.h" +#include "error.h" +#include "my_page.h" +#include "neigh_list.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +NPairSkipTrim::NPairSkipTrim(LAMMPS *lmp) : NPair(lmp) {} + +/* ---------------------------------------------------------------------- + build skip list for subset of types from parent list + works for half and full lists + works for owned (non-ghost) list, also for ghost list + iskip and ijskip flag which atom types and type pairs to skip + if ghost, also store neighbors of ghost atoms & set inum,gnum correctly +------------------------------------------------------------------------- */ + +void NPairSkipTrim::build(NeighList *list) +{ + int i, j, ii, jj, n, itype, jnum, joriginal; + int *neighptr, *jlist; + + int *type = atom->type; + int nlocal = atom->nlocal; + + int *ilist = list->ilist; + int *numneigh = list->numneigh; + int **firstneigh = list->firstneigh; + MyPage *ipage = list->ipage; + + int *ilist_skip = list->listskip->ilist; + int *numneigh_skip = list->listskip->numneigh; + int **firstneigh_skip = list->listskip->firstneigh; + int num_skip = list->listskip->inum; + if (list->ghost) num_skip += list->listskip->gnum; + + int *iskip = list->iskip; + int **ijskip = list->ijskip; + + int inum = 0; + ipage->reset(); + + double **x = atom->x; + double xtmp, ytmp, ztmp; + double delx, dely, delz, rsq; + double cutsq_custom = cutoff_custom * cutoff_custom; + + // loop over atoms in other list + // skip I atom entirely if iskip is set for type[I] + // skip I,J pair if ijskip is set for type[I],type[J] + + for (ii = 0; ii < num_skip; ii++) { + i = ilist_skip[ii]; + itype = type[i]; + if (iskip[itype]) continue; + + xtmp = x[i][0]; + ytmp = x[i][1]; + ztmp = x[i][2]; + + n = 0; + neighptr = ipage->vget(); + + // loop over parent non-skip list + + jlist = firstneigh_skip[i]; + jnum = numneigh_skip[i]; + + for (jj = 0; jj < jnum; jj++) { + joriginal = jlist[jj]; + j = joriginal & NEIGHMASK; + if (ijskip[itype][type[j]]) continue; + + delx = xtmp - x[j][0]; + dely = ytmp - x[j][1]; + delz = ztmp - x[j][2]; + rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cutsq_custom) continue; + + neighptr[n++] = joriginal; + } + + ilist[inum++] = i; + firstneigh[i] = neighptr; + numneigh[i] = n; + ipage->vgot(n); + if (ipage->status()) error->one(FLERR, "Neighbor list overflow, boost neigh_modify one"); + } + + list->inum = inum; + if (list->ghost) { + int num = 0; + for (i = 0; i < inum; i++) + if (ilist[i] < nlocal) + num++; + else + break; + list->inum = num; + list->gnum = inum - num; + } +} diff --git a/src/npair_skip_trim.h b/src/npair_skip_trim.h new file mode 100644 index 00000000000..f2a26d654ef --- /dev/null +++ b/src/npair_skip_trim.h @@ -0,0 +1,46 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef NPAIR_CLASS +// clang-format off +NPairStyle(skip/trim, + NPairSkipTrim, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM); + +NPairStyle(skip/ghost/trim, + NPairSkipTrim, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_GHOST | NP_TRIM); +// clang-format on +#else + +#ifndef LMP_NPAIR_SKIP_TRIM_H +#define LMP_NPAIR_SKIP_TRIM_H + +#include "npair.h" + +namespace LAMMPS_NS { + +class NPairSkipTrim : public NPair { + public: + NPairSkipTrim(class LAMMPS *); + void build(class NeighList *) override; +}; + +} // namespace LAMMPS_NS + +#endif +#endif From 0083cc9e26d2ad3dcb6f19d069502ce4c630d5b7 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Fri, 17 Nov 2023 09:12:43 -0700 Subject: [PATCH 4/7] Port changes to OPENMP and INTEL packages --- src/INTEL/npair_skip_trim_intel.cpp | 271 ++++++++++++++++++++++++++++ src/INTEL/npair_skip_trim_intel.h | 62 +++++++ src/INTEL/npair_trim_intel.cpp | 5 +- src/OPENMP/npair_skip_omp.h | 12 +- src/neigh_request.h | 1 + 5 files changed, 341 insertions(+), 10 deletions(-) create mode 100644 src/INTEL/npair_skip_trim_intel.cpp create mode 100644 src/INTEL/npair_skip_trim_intel.h diff --git a/src/INTEL/npair_skip_trim_intel.cpp b/src/INTEL/npair_skip_trim_intel.cpp new file mode 100644 index 00000000000..e16e1bc4132 --- /dev/null +++ b/src/INTEL/npair_skip_trim_intel.cpp @@ -0,0 +1,271 @@ +// clang-format off +/* ---------------------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +/* ---------------------------------------------------------------------- + Contributing author: Stan Moore (SNL) +------------------------------------------------------------------------- */ + +#include "npair_skip_trim_intel.h" + +#include "atom.h" +#include "comm.h" +#include "error.h" +#include "modify.h" +#include "my_page.h" +#include "neigh_list.h" +#include "neigh_request.h" +#include "neighbor.h" + +using namespace LAMMPS_NS; + +/* ---------------------------------------------------------------------- */ + +NPairSkipTrimIntel::NPairSkipTrimIntel(LAMMPS *lmp) : NPair(lmp) { + _fix = static_cast(modify->get_fix_by_id("package_intel")); + if (!_fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); + _inum_starts = new int[comm->nthreads]; + _inum_counts = new int[comm->nthreads]; + _full_props = nullptr; +} + +/* ---------------------------------------------------------------------- */ + +NPairSkipTrimIntel::~NPairSkipTrimIntel() { + delete []_inum_starts; + delete []_inum_counts; + delete[] _full_props; +} + +/* ---------------------------------------------------------------------- */ + +void NPairSkipTrimIntel::copy_neighbor_info() +{ + NPair::copy_neighbor_info(); + // Only need to set _full_props once; npair object deleted for changes + if (_full_props) return; + _full_props = new int[neighbor->nrequest]; + for (int i = 0; i < neighbor->nrequest; i++) + _full_props[i] = neighbor->requests[i]->full; +} + +/* ---------------------------------------------------------------------- + build skip list for subset of types from parent list + works for half and full lists + works for owned (non-ghost) list, also for ghost list + iskip and ijskip flag which atom types and type pairs to skip + if ghost, also store neighbors of ghost atoms & set inum,gnum correctly +------------------------------------------------------------------------- */ + +template +void NPairSkipTrimIntel::build_t(NeighList *list, int *numhalf, int *cnumneigh, + int *numhalf_skip, IntelBuffers *buffers) +{ + const int nlocal = atom->nlocal; + const int e_nall = nlocal + atom->nghost; + const ATOM_T * _noalias const x = buffers->get_x(); + const int * _noalias const type = atom->type; + int * _noalias const ilist = list->ilist; + int * _noalias const numneigh = list->numneigh; + int ** _noalias const firstneigh = (int ** const)list->firstneigh; // NOLINT + const int * _noalias const ilist_skip = list->listskip->ilist; + const int * _noalias const numneigh_skip = list->listskip->numneigh; + const int ** _noalias const firstneigh_skip = (const int ** const)list->listskip->firstneigh; // NOLINT + const int * _noalias const iskip = list->iskip; + const int ** _noalias const ijskip = (const int ** const)list->ijskip; // NOLINT + + const flt_t cutsq_custom = cutoff_custom * cutoff_custom; + int num_skip = list->listskip->inum; + if (list->ghost) num_skip += list->listskip->gnum; + + int packthreads; + if (comm->nthreads > INTEL_HTHREADS && THREE==0) + packthreads = comm->nthreads; + else + packthreads = 1; + + #if defined(_OPENMP) + #pragma omp parallel if (packthreads > 1) + #endif + { + int tid, ifrom, ito; + IP_PRE_omp_range_id(ifrom, ito, tid, num_skip, packthreads); + + // each thread has its own page allocator + MyPage &ipage = list->ipage[tid]; + ipage.reset(); + + int my_inum = ifrom; + _inum_starts[tid] = ifrom; + + // loop over parent full list + for (int ii = ifrom; ii < ito; ii++) { + const int i = ilist_skip[ii]; + const int itype = type[i]; + if (iskip[itype]) continue; + + const flt_t xtmp = x[i].x; + const flt_t ytmp = x[i].y; + const flt_t ztmp = x[i].z; + + int n = 0; + int *neighptr = ipage.vget(); + + // loop over parent non-skip list + + const int * _noalias const jlist = firstneigh_skip[i]; + const int jnum = numneigh_skip[i]; + + if (THREE) { + const int jnumhalf = numhalf_skip[ii]; + for (int jj = 0; jj < jnumhalf; jj++) { + const int joriginal = jlist[jj]; + const int j = joriginal & NEIGHMASK; + + int addme = 1; + if (ijskip[itype][type[j]]) addme = 0; + + // trim to shorter cutoff + + const flt_t delx = xtmp - x[j].x; + const flt_t dely = ytmp - x[j].y; + const flt_t delz = ztmp - x[j].z; + const flt_t rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cutsq_custom) addme = 0; + + if (addme) + neighptr[n++] = joriginal; + } + numhalf[my_inum] = n; + + for (int jj = jnumhalf; jj < jnum; jj++) { + const int joriginal = jlist[jj]; + const int j = joriginal & NEIGHMASK; + + int addme = 1; + if (ijskip[itype][type[j]]) addme = 0; + + // trim to shorter cutoff + + const flt_t delx = xtmp - x[j].x; + const flt_t dely = ytmp - x[j].y; + const flt_t delz = ztmp - x[j].z; + const flt_t rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cutsq_custom) addme = 0; + + if (addme) + neighptr[n++] = joriginal; + } + } else { + #if defined(LMP_SIMD_COMPILER) + #pragma vector aligned + #pragma ivdep + #endif + for (int jj = 0; jj < jnum; jj++) { + const int joriginal = jlist[jj]; + const int j = joriginal & NEIGHMASK; + + int addme = 1; + if (ijskip[itype][type[j]]) addme = 0; + + // trim to shorter cutoff + + const flt_t delx = xtmp - x[j].x; + const flt_t dely = ytmp - x[j].y; + const flt_t delz = ztmp - x[j].z; + const flt_t rsq = delx * delx + dely * dely + delz * delz; + if (rsq > cutsq_custom) addme = 0; + + if (addme) + neighptr[n++] = joriginal; + } + } + + ilist[my_inum++] = i; + firstneigh[i] = neighptr; + numneigh[i] = n; + + int pad_end = n; + IP_PRE_neighbor_pad(pad_end, 0); + #if defined(LMP_SIMD_COMPILER) + #pragma vector aligned + #pragma loop_count min=1, max=INTEL_COMPILE_WIDTH-1, \ + avg=INTEL_COMPILE_WIDTH/2 + #endif + for ( ; n < pad_end; n++) + neighptr[n] = e_nall; + + ipage.vgot(n); + if (ipage.status()) + error->one(FLERR,"Neighbor list overflow, boost neigh_modify one"); + } + + int last_inum = 0, loop_end; + _inum_counts[tid] = my_inum; + } + int inum = _inum_counts[0]; + for (int tid = 1; tid < packthreads; tid++) { + for (int i = _inum_starts[tid]; i < _inum_counts[tid]; i++) { + if (THREE) numhalf[inum] = numhalf[i]; + ilist[inum++] = ilist[i]; + } + } + list->inum = inum; + + if (THREE && num_skip > 0) { + int * const list_start = firstneigh[ilist[0]]; + for (int ii = 0; ii < inum; ii++) { + int i = ilist[ii]; + cnumneigh[ii] = static_cast(firstneigh[i] - list_start); + } + } + if (list->ghost) { + int num = 0; + int my_inum = list->inum; + for (int i = 0; i < my_inum; i++) + if (ilist[i] < nlocal) num++; + else break; + list->inum = num; + list->gnum = my_inum - num; + } +} + +/* ---------------------------------------------------------------------- */ + +void NPairSkipTrimIntel::build(NeighList *list) +{ + if (_fix->three_body_neighbor()==0 || + _full_props[list->listskip->index] == 0) { + if (_fix->precision() == FixIntel::PREC_MODE_MIXED) + build_t(list, nullptr, nullptr, nullptr, _fix->get_mixed_buffers()); + else if (_fix->precision() == FixIntel::PREC_MODE_DOUBLE) + build_t(list, nullptr, nullptr, nullptr, _fix->get_double_buffers()); + else + build_t(list, nullptr, nullptr, nullptr, _fix->get_single_buffers()); + } else { + int *nhalf, *cnumneigh, *nhalf_skip, *u; + if (_fix->precision() == FixIntel::PREC_MODE_MIXED) { + _fix->get_mixed_buffers()->get_list_data3(list->listskip,nhalf_skip,u); + _fix->get_mixed_buffers()->grow_data3(list, nhalf, cnumneigh); + build_t(list, nhalf, cnumneigh, nhalf_skip, _fix->get_mixed_buffers()); + } else if (_fix->precision() == FixIntel::PREC_MODE_DOUBLE) { + _fix->get_double_buffers()->get_list_data3(list->listskip,nhalf_skip,u); + _fix->get_double_buffers()->grow_data3(list, nhalf, cnumneigh); + build_t(list, nhalf, cnumneigh, nhalf_skip, _fix->get_double_buffers()); + } else { + _fix->get_single_buffers()->get_list_data3(list->listskip,nhalf_skip,u); + _fix->get_single_buffers()->grow_data3(list,nhalf,cnumneigh); + build_t(list, nhalf, cnumneigh, nhalf_skip, _fix->get_single_buffers()); + } + } +} diff --git a/src/INTEL/npair_skip_trim_intel.h b/src/INTEL/npair_skip_trim_intel.h new file mode 100644 index 00000000000..f0018e5df45 --- /dev/null +++ b/src/INTEL/npair_skip_trim_intel.h @@ -0,0 +1,62 @@ +// clang-format off +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +#ifdef NPAIR_CLASS +// clang-format off +NPairStyle(skip/trim/intel, + NPairSkipTrimIntel, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_INTEL); + +NPairStyle(skip/trim/ghost/intel, + NPairSkipTrimIntel, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_GHOST | NP_INTEL); +// clang-format on +#else + +#ifndef LMP_NPAIR_SKIP_TRIM_INTEL_H +#define LMP_NPAIR_SKIP_TRIM_INTEL_H + +#include "fix_intel.h" +#include "npair.h" + +#if defined(_OPENMP) +#include +#endif + +namespace LAMMPS_NS { + +class NPairSkipTrimIntel : public NPair { + public: + NPairSkipTrimIntel(class LAMMPS *); + ~NPairSkipTrimIntel() override; + void copy_neighbor_info() override; + void build(class NeighList *) override; + + protected: + FixIntel *_fix; + int *_inum_starts, *_inum_counts, *_full_props; + + template + void build_t(NeighList *, int *numhalf, int *cnumneigh, int *numhalf_skip, + IntelBuffers *); +}; + +} // namespace LAMMPS_NS + +#endif +#endif diff --git a/src/INTEL/npair_trim_intel.cpp b/src/INTEL/npair_trim_intel.cpp index d377419f1b2..dcf10a3c87d 100644 --- a/src/INTEL/npair_trim_intel.cpp +++ b/src/INTEL/npair_trim_intel.cpp @@ -88,7 +88,6 @@ void NPairTrimIntel::build_t(NeighList *list, for (int jj = 0; jj < jnum; jj++) { const int joriginal = jlist[jj]; const int j = joriginal & NEIGHMASK; - int addme = 1; // trim to shorter cutoff @@ -97,9 +96,7 @@ void NPairTrimIntel::build_t(NeighList *list, const flt_t delz = ztmp - x[j].z; const flt_t rsq = delx * delx + dely * dely + delz * delz; - if (rsq > cutsq_custom) addme = 0; - - if (addme) + if (rsq <= cutsq_custom) neighptr[n++] = joriginal; } diff --git a/src/OPENMP/npair_skip_omp.h b/src/OPENMP/npair_skip_omp.h index ce61968c175..a733308ccb5 100644 --- a/src/OPENMP/npair_skip_omp.h +++ b/src/OPENMP/npair_skip_omp.h @@ -20,36 +20,36 @@ NPairStyle(skip/omp, NPairSkip, NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | - NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP); + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); NPairStyle(skip/half/respa/omp, NPairSkipRespa, NP_SKIP | NP_RESPA | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | - NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP); + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); NPairStyle(skip/half/size/omp, NPairSkipSize, NP_SKIP | NP_SIZE | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | - NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP); + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); NPairStyle(skip/size/off2on/omp, NPairSkipSizeOff2on, NP_SKIP | NP_SIZE | NP_OFF2ON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_MULTI_OLD | - NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP); + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); NPairStyle(skip/size/off2on/oneside/omp, NPairSkipSizeOff2onOneside, NP_SKIP | NP_SIZE | NP_OFF2ON | NP_ONESIDE | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF | - NP_ORTHO | NP_TRI | NP_OMP); + NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); NPairStyle(skip/ghost/omp, NPairSkip, NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | - NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP | NP_GHOST); + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP | NP_GHOST); // clang-format off #endif diff --git a/src/neigh_request.h b/src/neigh_request.h index a3114dff821..fa57922c936 100644 --- a/src/neigh_request.h +++ b/src/neigh_request.h @@ -26,6 +26,7 @@ class NeighRequest : protected Pointers { friend class NStencil; friend class NeighborKokkos; friend class NPairSkipIntel; + friend class NPairSkipTrimIntel; friend class FixIntel; protected: From 06b962fc339312ef471f6e6fe12b038cb2c9ff9e Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Fri, 17 Nov 2023 09:50:03 -0700 Subject: [PATCH 5/7] Bugfix: port missed changes from #3846 --- src/OPENMP/npair_halffull_newton_trim_omp.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/OPENMP/npair_halffull_newton_trim_omp.cpp b/src/OPENMP/npair_halffull_newton_trim_omp.cpp index 14461750134..9fdd4957af1 100644 --- a/src/OPENMP/npair_halffull_newton_trim_omp.cpp +++ b/src/OPENMP/npair_halffull_newton_trim_omp.cpp @@ -38,6 +38,8 @@ NPairHalffullNewtonTrimOmp::NPairHalffullNewtonTrimOmp(LAMMPS *lmp) : NPair(lmp) void NPairHalffullNewtonTrimOmp::build(NeighList *list) { const int inum_full = list->listfull->inum; + const double delta = 0.01 * force->angstrom; + const int triclinic = domain->triclinic; NPAIR_OMP_INIT; #if defined(_OPENMP) @@ -86,8 +88,17 @@ void NPairHalffullNewtonTrimOmp::build(NeighList *list) for (jj = 0; jj < jnum; jj++) { joriginal = jlist[jj]; j = joriginal & NEIGHMASK; + if (j < nlocal) { if (i > j) continue; + } else if (triclinic) { + if (fabs(x[j][2]-ztmp) > delta) { + if (x[j][2] < ztmp) continue; + } else if (fabs(x[j][1]-ytmp) > delta) { + if (x[j][1] < ytmp) continue; + } else { + if (x[j][0] < xtmp) continue; + } } else { if (x[j][2] < ztmp) continue; if (x[j][2] == ztmp) { From 6fc7f5689b06362181677ea7fb7394fa3f726742 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Fri, 17 Nov 2023 10:04:11 -0700 Subject: [PATCH 6/7] Port changes to OPENMP package --- src/OPENMP/npair_skip_omp.h | 12 +++---- src/OPENMP/npair_skip_trim_omp.h | 55 ++++++++++++++++++++++++++++++++ 2 files changed, 61 insertions(+), 6 deletions(-) create mode 100644 src/OPENMP/npair_skip_trim_omp.h diff --git a/src/OPENMP/npair_skip_omp.h b/src/OPENMP/npair_skip_omp.h index a733308ccb5..ce61968c175 100644 --- a/src/OPENMP/npair_skip_omp.h +++ b/src/OPENMP/npair_skip_omp.h @@ -20,36 +20,36 @@ NPairStyle(skip/omp, NPairSkip, NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | - NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP); NPairStyle(skip/half/respa/omp, NPairSkipRespa, NP_SKIP | NP_RESPA | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | - NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP); NPairStyle(skip/half/size/omp, NPairSkipSize, NP_SKIP | NP_SIZE | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | - NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP); NPairStyle(skip/size/off2on/omp, NPairSkipSizeOff2on, NP_SKIP | NP_SIZE | NP_OFF2ON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_MULTI_OLD | - NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP); NPairStyle(skip/size/off2on/oneside/omp, NPairSkipSizeOff2onOneside, NP_SKIP | NP_SIZE | NP_OFF2ON | NP_ONESIDE | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF | - NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); + NP_ORTHO | NP_TRI | NP_OMP); NPairStyle(skip/ghost/omp, NPairSkip, NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | - NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP | NP_GHOST); + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_OMP | NP_GHOST); // clang-format off #endif diff --git a/src/OPENMP/npair_skip_trim_omp.h b/src/OPENMP/npair_skip_trim_omp.h new file mode 100644 index 00000000000..aba6f50e17c --- /dev/null +++ b/src/OPENMP/npair_skip_trim_omp.h @@ -0,0 +1,55 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + https://www.lammps.org/, Sandia National Laboratories + LAMMPS development team: developers@lammps.org + + Copyright (2003) Sandia Corporation. Under the terms of Contract + DE-AC04-94AL85000 with Sandia Corporation, the U.S. Government retains + certain rights in this software. This software is distributed under + the GNU General Public License. + + See the README file in the top-level LAMMPS directory. +------------------------------------------------------------------------- */ + +// There is no benefit from multi-threading for skip lists, so we +// just forward the requests to the corresponding non-omp versions. + +#ifdef NPAIR_CLASS +// clang-format off +NPairStyle(skip/trim/omp, + NPairSkipTrim, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); + +NPairStyle(skip/trim/half/respa/omp, + NPairSkipTrimRespa, + NP_SKIP | NP_RESPA | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); + +NPairStyle(skip/trim/half/size/omp, + NPairSkipTrimSize, + NP_SKIP | NP_SIZE | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); + +NPairStyle(skip/trim/size/off2on/omp, + NPairSkipTrimSizeOff2on, + NP_SKIP | NP_SIZE | NP_OFF2ON | NP_HALF | + NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_MULTI_OLD | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); + +NPairStyle(skip/trim/size/off2on/oneside/omp, + NPairSkipTrimSizeOff2onOneside, + NP_SKIP | NP_SIZE | NP_OFF2ON | NP_ONESIDE | NP_HALF | + NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF | + NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); + +NPairStyle(skip/trim/ghost/omp, + NPairSkipTrim, + NP_SKIP | NP_HALF | NP_FULL | + NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | + NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP | NP_GHOST); +// clang-format off +#endif + From be19b5c210c08988da430db330bb72a2b7c73703 Mon Sep 17 00:00:00 2001 From: Stan Gerald Moore Date: Fri, 17 Nov 2023 12:46:45 -0700 Subject: [PATCH 7/7] Make naming consistent --- ....h => npair_halffull_trim_newtoff_intel.h} | 22 +++++++------- ...p => npair_halffull_trim_newton_intel.cpp} | 10 +++---- ...l.h => npair_halffull_trim_newton_intel.h} | 16 +++++----- src/KOKKOS/npair_skip_kokkos.h | 8 ++--- ...pp => npair_halffull_trim_newtoff_omp.cpp} | 6 ++-- ...mp.h => npair_halffull_trim_newtoff_omp.h} | 18 +++++------ ...cpp => npair_halffull_trim_newton_omp.cpp} | 8 +++-- ...omp.h => npair_halffull_trim_newton_omp.h} | 16 +++++----- ...im.cpp => npair_halffull_trim_newtoff.cpp} | 6 ++-- ...f_trim.h => npair_halffull_trim_newtoff.h} | 30 +++++++++---------- ...rim.cpp => npair_halffull_trim_newton.cpp} | 6 ++-- ...on_trim.h => npair_halffull_trim_newton.h} | 18 +++++------ ...spa_trim.cpp => npair_skip_trim_respa.cpp} | 6 ++-- ...p_respa_trim.h => npair_skip_trim_respa.h} | 12 ++++---- ...size_trim.cpp => npair_skip_trim_size.cpp} | 6 ++-- ...kip_size_trim.h => npair_skip_trim_size.h} | 12 ++++---- ...im.cpp => npair_skip_trim_size_off2on.cpp} | 6 ++-- ...n_trim.h => npair_skip_trim_size_off2on.h} | 12 ++++---- ...> npair_skip_trim_size_off2on_oneside.cpp} | 6 ++-- ... => npair_skip_trim_size_off2on_oneside.h} | 12 ++++---- 20 files changed, 119 insertions(+), 117 deletions(-) rename src/INTEL/{npair_halffull_newtoff_trim_intel.h => npair_halffull_trim_newtoff_intel.h} (72%) rename src/INTEL/{npair_halffull_newton_trim_intel.cpp => npair_halffull_trim_newton_intel.cpp} (97%) rename src/INTEL/{npair_halffull_newton_trim_intel.h => npair_halffull_trim_newton_intel.h} (81%) rename src/OPENMP/{npair_halffull_newtoff_trim_omp.cpp => npair_halffull_trim_newtoff_omp.cpp} (94%) rename src/OPENMP/{npair_halffull_newtoff_trim_omp.h => npair_halffull_trim_newtoff_omp.h} (72%) rename src/OPENMP/{npair_halffull_newton_trim_omp.cpp => npair_halffull_trim_newton_omp.cpp} (94%) rename src/OPENMP/{npair_halffull_newton_trim_omp.h => npair_halffull_trim_newton_omp.h} (76%) rename src/{npair_halffull_newtoff_trim.cpp => npair_halffull_trim_newtoff.cpp} (94%) rename src/{npair_halffull_newtoff_trim.h => npair_halffull_trim_newtoff.h} (66%) rename src/{npair_halffull_newton_trim.cpp => npair_halffull_trim_newton.cpp} (95%) rename src/{npair_halffull_newton_trim.h => npair_halffull_trim_newton.h} (74%) rename src/{npair_skip_respa_trim.cpp => npair_skip_trim_respa.cpp} (97%) rename src/{npair_skip_respa_trim.h => npair_skip_trim_respa.h} (82%) rename src/{npair_skip_size_trim.cpp => npair_skip_trim_size.cpp} (95%) rename src/{npair_skip_size_trim.h => npair_skip_trim_size.h} (82%) rename src/{npair_skip_size_off2on_trim.cpp => npair_skip_trim_size_off2on.cpp} (95%) rename src/{npair_skip_size_off2on_trim.h => npair_skip_trim_size_off2on.h} (80%) rename src/{npair_skip_size_off2on_oneside_trim.cpp => npair_skip_trim_size_off2on_oneside.cpp} (96%) rename src/{npair_skip_size_off2on_oneside_trim.h => npair_skip_trim_size_off2on_oneside.h} (78%) diff --git a/src/INTEL/npair_halffull_newtoff_trim_intel.h b/src/INTEL/npair_halffull_trim_newtoff_intel.h similarity index 72% rename from src/INTEL/npair_halffull_newtoff_trim_intel.h rename to src/INTEL/npair_halffull_trim_newtoff_intel.h index d8594ce3b8d..5e8b01cd09d 100644 --- a/src/INTEL/npair_halffull_newtoff_trim_intel.h +++ b/src/INTEL/npair_halffull_trim_newtoff_intel.h @@ -21,24 +21,24 @@ #ifdef NPAIR_CLASS // clang-format off -NPairStyle(halffull/newtoff/trim/intel, - NPairHalffullNewtoffTrim, +NPairStyle(halffull/trim/newtoff/intel, + NPairHalffullTrimNewtoff, NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_HALF | NP_ORTHO | NP_TRI | NP_TRIM | NP_INTEL); -NPairStyle(halffull/newtoff/skip/trim/intel, - NPairHalffullNewtoffTrim, +NPairStyle(halffull/trim/newtoff/skip/intel, + NPairHalffullTrimNewtoff, NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_HALF | - NP_ORTHO | NP_TRI | NP_SKIP | NP_TRIM | NP_INTEL); + NP_ORTHO | NP_TRI | NP_TRIM | NP_SKIP | NP_INTEL); -NPairStyle(halffull/newtoff/ghost/trim/intel, - NPairHalffullNewtoffTrim, +NPairStyle(halffull/trim/newtoff/ghost/intel, + NPairHalffullTrimNewtoff, NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_HALF | - NP_ORTHO | NP_TRI | NP_GHOST | NP_TRIM | NP_INTEL); + NP_ORTHO | NP_TRI | NP_TRIM | NP_GHOST | NP_INTEL); -NPairStyle(halffull/newtoff/skip/ghost/trim/intel, - NPairHalffullNewtoffTrim, +NPairStyle(halffull/trim/newtoff/skip/ghost/intel, + NPairHalffullTrimNewtoff, NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_HALF | - NP_ORTHO | NP_TRI | NP_SKIP | NP_GHOST | NP_TRIM | NP_INTEL); + NP_ORTHO | NP_TRI | NP_TRIM | NP_SKIP | NP_GHOST | NP_INTEL); // clang-format on #endif diff --git a/src/INTEL/npair_halffull_newton_trim_intel.cpp b/src/INTEL/npair_halffull_trim_newton_intel.cpp similarity index 97% rename from src/INTEL/npair_halffull_newton_trim_intel.cpp rename to src/INTEL/npair_halffull_trim_newton_intel.cpp index 34b9b20e9cb..b1b69734a44 100644 --- a/src/INTEL/npair_halffull_newton_trim_intel.cpp +++ b/src/INTEL/npair_halffull_trim_newton_intel.cpp @@ -16,7 +16,7 @@ Contributing author: Stan Moore (SNL) ------------------------------------------------------------------------- */ -#include "npair_halffull_newton_trim_intel.h" +#include "npair_halffull_trim_newton_intel.h" #include "atom.h" #include "comm.h" @@ -31,7 +31,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairHalffullNewtonTrimIntel::NPairHalffullNewtonTrimIntel(LAMMPS *lmp) : NPair(lmp) { +NPairHalffullTrimNewtonIntel::NPairHalffullTrimNewtonIntel(LAMMPS *lmp) : NPair(lmp) { _fix = static_cast(modify->get_fix_by_id("package_intel")); if (!_fix) error->all(FLERR, "The 'package intel' command is required for /intel styles"); } @@ -44,7 +44,7 @@ NPairHalffullNewtonTrimIntel::NPairHalffullNewtonTrimIntel(LAMMPS *lmp) : NPair( ------------------------------------------------------------------------- */ template -void NPairHalffullNewtonTrimIntel::build_t(NeighList *list, +void NPairHalffullTrimNewtonIntel::build_t(NeighList *list, IntelBuffers *buffers) { const int inum_full = list->listfull->inum; @@ -182,7 +182,7 @@ void NPairHalffullNewtonTrimIntel::build_t(NeighList *list, ------------------------------------------------------------------------- */ template -void NPairHalffullNewtonTrimIntel::build_t3(NeighList *list, int *numhalf, +void NPairHalffullTrimNewtonIntel::build_t3(NeighList *list, int *numhalf, IntelBuffers *buffers) { const int inum_full = list->listfull->inum; @@ -272,7 +272,7 @@ void NPairHalffullNewtonTrimIntel::build_t3(NeighList *list, int *numhalf, /* ---------------------------------------------------------------------- */ -void NPairHalffullNewtonTrimIntel::build(NeighList *list) +void NPairHalffullTrimNewtonIntel::build(NeighList *list) { if (_fix->three_body_neighbor() == 0 || domain->triclinic) { if (_fix->precision() == FixIntel::PREC_MODE_MIXED) diff --git a/src/INTEL/npair_halffull_newton_trim_intel.h b/src/INTEL/npair_halffull_trim_newton_intel.h similarity index 81% rename from src/INTEL/npair_halffull_newton_trim_intel.h rename to src/INTEL/npair_halffull_trim_newton_intel.h index 0ca551d682e..dfce63e93d9 100644 --- a/src/INTEL/npair_halffull_newton_trim_intel.h +++ b/src/INTEL/npair_halffull_trim_newton_intel.h @@ -18,20 +18,20 @@ #ifdef NPAIR_CLASS // clang-format off -NPairStyle(halffull/newton/trim/intel, - NPairHalffullNewtonTrimIntel, +NPairStyle(halffull/trim/newton/intel, + NPairHalffullTrimNewtonIntel, NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_ORTHO | NP_TRI| NP_TRIM | NP_INTEL); -NPairStyle(halffull/newton/skip/trim/intel, - NPairHalffullNewtonTrimIntel, +NPairStyle(halffull/trim/newton/skip/intel, + NPairHalffullTrimNewtonIntel, NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_ORTHO | NP_TRI | NP_SKIP | NP_TRIM | NP_INTEL); // clang-format on #else -#ifndef LMP_NPAIR_HALFFULL_NEWTON_TRIM_INTEL_H -#define LMP_NPAIR_HALFFULL_NEWTON_TRIM_INTEL_H +#ifndef LMP_NPAIR_HALFFULL_TRIM_NEWTON_INTEL_H +#define LMP_NPAIR_HALFFULL_TRIM_NEWTON_INTEL_H #include "fix_intel.h" #include "npair.h" @@ -42,9 +42,9 @@ NPairStyle(halffull/newton/skip/trim/intel, namespace LAMMPS_NS { -class NPairHalffullNewtonTrimIntel : public NPair { +class NPairHalffullTrimNewtonIntel : public NPair { public: - NPairHalffullNewtonTrimIntel(class LAMMPS *); + NPairHalffullTrimNewtonIntel(class LAMMPS *); void build(class NeighList *) override; protected: diff --git a/src/KOKKOS/npair_skip_kokkos.h b/src/KOKKOS/npair_skip_kokkos.h index 7672a2c36ce..293c53677b2 100644 --- a/src/KOKKOS/npair_skip_kokkos.h +++ b/src/KOKKOS/npair_skip_kokkos.h @@ -42,28 +42,28 @@ NPairStyle(skip/ghost/kk/host, NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_GHOST | NP_KOKKOS_HOST); typedef NPairSkipKokkos NPairKokkosSkipTrimDevice; -NPairStyle(skip/kk/device, +NPairStyle(skip/trim/kk/device, NPairKokkosSkipTrimDevice, NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM |NP_KOKKOS_DEVICE); typedef NPairSkipKokkos NPairKokkosSkipTrimGhostDevice; -NPairStyle(skip/ghost/kk/device, +NPairStyle(skip/trim/ghost/kk/device, NPairKokkosSkipTrimGhostDevice, NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_GHOST | NP_KOKKOS_DEVICE); typedef NPairSkipKokkos NPairKokkosSkipTrimHost; -NPairStyle(skip/kk/host, +NPairStyle(skip/trim/kk/host, NPairKokkosSkipTrimHost, NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM | NP_KOKKOS_HOST); typedef NPairSkipKokkos NPairKokkosSkipTrimGhostHost; -NPairStyle(skip/ghost/kk/host, +NPairStyle(skip/trim/ghost/kk/host, NPairKokkosSkipTrimGhostHost, NP_SKIP | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | diff --git a/src/OPENMP/npair_halffull_newtoff_trim_omp.cpp b/src/OPENMP/npair_halffull_trim_newtoff_omp.cpp similarity index 94% rename from src/OPENMP/npair_halffull_newtoff_trim_omp.cpp rename to src/OPENMP/npair_halffull_trim_newtoff_omp.cpp index d35b3b2ee83..d0c5c1ab860 100644 --- a/src/OPENMP/npair_halffull_newtoff_trim_omp.cpp +++ b/src/OPENMP/npair_halffull_trim_newtoff_omp.cpp @@ -12,7 +12,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "npair_halffull_newtoff_trim_omp.h" +#include "npair_halffull_trim_newtoff_omp.h" #include "atom.h" #include "error.h" @@ -26,7 +26,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairHalffullNewtoffTrimOmp::NPairHalffullNewtoffTrimOmp(LAMMPS *lmp) : NPair(lmp) {} +NPairHalffullTrimNewtoffOmp::NPairHalffullTrimNewtoffOmp(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- build half list from full list and trim to shorter cutoff @@ -35,7 +35,7 @@ NPairHalffullNewtoffTrimOmp::NPairHalffullNewtoffTrimOmp(LAMMPS *lmp) : NPair(lm works if full list is a skip list ------------------------------------------------------------------------- */ -void NPairHalffullNewtoffTrimOmp::build(NeighList *list) +void NPairHalffullTrimNewtoffOmp::build(NeighList *list) { const int inum_full = list->listfull->inum; diff --git a/src/OPENMP/npair_halffull_newtoff_trim_omp.h b/src/OPENMP/npair_halffull_trim_newtoff_omp.h similarity index 72% rename from src/OPENMP/npair_halffull_newtoff_trim_omp.h rename to src/OPENMP/npair_halffull_trim_newtoff_omp.h index 19e1c55eeb0..c86c132b692 100644 --- a/src/OPENMP/npair_halffull_newtoff_trim_omp.h +++ b/src/OPENMP/npair_halffull_trim_newtoff_omp.h @@ -13,28 +13,28 @@ #ifdef NPAIR_CLASS // clang-format off -NPairStyle(halffull/newtoff/trim/omp, - NPairHalffullNewtoffTrimOmp, +NPairStyle(halffull/trim/newtoff/omp, + NPairHalffullTrimNewtoffOmp, NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_HALF | NP_ORTHO | NP_TRI | NP_TRIM | NP_OMP); -NPairStyle(halffull/newtoff/skip/trim/omp, - NPairHalffullNewtoffTrimOmp, +NPairStyle(halffull/trim/newtoff/skip/omp, + NPairHalffullTrimNewtoffOmp, NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_HALF | - NP_ORTHO | NP_TRI | NP_SKIP | NP_TRIM | NP_OMP); + NP_ORTHO | NP_TRI | NP_TRIM | NP_SKIP | NP_OMP); // clang-format on #else -#ifndef LMP_NPAIR_HALFFULL_NEWTOFF_TRIM_OMP_H -#define LMP_NPAIR_HALFFULL_NEWTOFF_TRIM_OMP_H +#ifndef LMP_NPAIR_HALFFULL_TRIM_NEWTOFF_OMP_H +#define LMP_NPAIR_HALFFULL_TRIM_NEWTOFF_OMP_H #include "npair.h" namespace LAMMPS_NS { -class NPairHalffullNewtoffTrimOmp : public NPair { +class NPairHalffullTrimNewtoffOmp : public NPair { public: - NPairHalffullNewtoffTrimOmp(class LAMMPS *); + NPairHalffullTrimNewtoffOmp(class LAMMPS *); void build(class NeighList *) override; }; diff --git a/src/OPENMP/npair_halffull_newton_trim_omp.cpp b/src/OPENMP/npair_halffull_trim_newton_omp.cpp similarity index 94% rename from src/OPENMP/npair_halffull_newton_trim_omp.cpp rename to src/OPENMP/npair_halffull_trim_newton_omp.cpp index 9fdd4957af1..bd9d553eb90 100644 --- a/src/OPENMP/npair_halffull_newton_trim_omp.cpp +++ b/src/OPENMP/npair_halffull_trim_newton_omp.cpp @@ -12,10 +12,12 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "npair_halffull_newton_trim_omp.h" +#include "npair_halffull_trim_newton_omp.h" #include "atom.h" +#include "domain.h" #include "error.h" +#include "force.h" #include "my_page.h" #include "neigh_list.h" #include "npair_omp.h" @@ -26,7 +28,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairHalffullNewtonTrimOmp::NPairHalffullNewtonTrimOmp(LAMMPS *lmp) : NPair(lmp) {} +NPairHalffullTrimNewtonOmp::NPairHalffullTrimNewtonOmp(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- build half list from full list and trim to shorter cutoff @@ -35,7 +37,7 @@ NPairHalffullNewtonTrimOmp::NPairHalffullNewtonTrimOmp(LAMMPS *lmp) : NPair(lmp) works if full list is a skip list ------------------------------------------------------------------------- */ -void NPairHalffullNewtonTrimOmp::build(NeighList *list) +void NPairHalffullTrimNewtonOmp::build(NeighList *list) { const int inum_full = list->listfull->inum; const double delta = 0.01 * force->angstrom; diff --git a/src/OPENMP/npair_halffull_newton_trim_omp.h b/src/OPENMP/npair_halffull_trim_newton_omp.h similarity index 76% rename from src/OPENMP/npair_halffull_newton_trim_omp.h rename to src/OPENMP/npair_halffull_trim_newton_omp.h index 4cb84f1b3a5..c6950dfa45e 100644 --- a/src/OPENMP/npair_halffull_newton_trim_omp.h +++ b/src/OPENMP/npair_halffull_trim_newton_omp.h @@ -13,28 +13,28 @@ #ifdef NPAIR_CLASS // clang-format off -NPairStyle(halffull/newton/trim/omp, - NPairHalffullNewtonTrimOmp, +NPairStyle(halffull/trim/newton/omp, + NPairHalffullTrimNewtonOmp, NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_ORTHO | NP_TRI| NP_TRIM | NP_OMP); -NPairStyle(halffull/newton/skip/trim/omp, - NPairHalffullNewtonTrimOmp, +NPairStyle(halffull/trim/newton/skip/omp, + NPairHalffullTrimNewtonOmp, NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_ORTHO | NP_TRI | NP_SKIP | NP_TRIM | NP_OMP); // clang-format on #else -#ifndef LMP_NPAIR_HALFFULL_NEWTON_TRIM_OMP_H -#define LMP_NPAIR_HALFFULL_NEWTON_TRIM_OMP_H +#ifndef LMP_NPAIR_HALFFULL_TRIM_NEWTON_OMP_H +#define LMP_NPAIR_HALFFULL_TRIM_NEWTON_OMP_H #include "npair.h" namespace LAMMPS_NS { -class NPairHalffullNewtonTrimOmp : public NPair { +class NPairHalffullTrimNewtonOmp : public NPair { public: - NPairHalffullNewtonTrimOmp(class LAMMPS *); + NPairHalffullTrimNewtonOmp(class LAMMPS *); void build(class NeighList *) override; }; diff --git a/src/npair_halffull_newtoff_trim.cpp b/src/npair_halffull_trim_newtoff.cpp similarity index 94% rename from src/npair_halffull_newtoff_trim.cpp rename to src/npair_halffull_trim_newtoff.cpp index 8ed392da2fc..db97bf185aa 100644 --- a/src/npair_halffull_newtoff_trim.cpp +++ b/src/npair_halffull_trim_newtoff.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "npair_halffull_newtoff_trim.h" +#include "npair_halffull_trim_newtoff.h" #include "atom.h" #include "error.h" @@ -22,7 +22,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairHalffullNewtoffTrim::NPairHalffullNewtoffTrim(LAMMPS *lmp) : NPair(lmp) {} +NPairHalffullTrimNewtoff::NPairHalffullTrimNewtoff(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- build half list from full list @@ -33,7 +33,7 @@ NPairHalffullNewtoffTrim::NPairHalffullNewtoffTrim(LAMMPS *lmp) : NPair(lmp) {} if ghost, also store neighbors of ghost atoms & set inum,gnum correctly ------------------------------------------------------------------------- */ -void NPairHalffullNewtoffTrim::build(NeighList *list) +void NPairHalffullTrimNewtoff::build(NeighList *list) { int i, j, ii, jj, n, jnum, joriginal; int *neighptr, *jlist; diff --git a/src/npair_halffull_newtoff_trim.h b/src/npair_halffull_trim_newtoff.h similarity index 66% rename from src/npair_halffull_newtoff_trim.h rename to src/npair_halffull_trim_newtoff.h index 0fe730f9c18..ca7726c8374 100644 --- a/src/npair_halffull_newtoff_trim.h +++ b/src/npair_halffull_trim_newtoff.h @@ -13,38 +13,38 @@ #ifdef NPAIR_CLASS // clang-format off -NPairStyle(halffull/newtoff/trim, - NPairHalffullNewtoffTrim, +NPairStyle(halffull/trim/newtoff, + NPairHalffullTrimNewtoff, NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_HALF | NP_ORTHO | NP_TRI | NP_TRIM); -NPairStyle(halffull/newtoff/skip/trim, - NPairHalffullNewtoffTrim, +NPairStyle(halffull/trim/newtoff/skip, + NPairHalffullTrimNewtoff, NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_HALF | - NP_ORTHO | NP_TRI | NP_SKIP | NP_TRIM); + NP_ORTHO | NP_TRI | NP_TRIM | NP_SKIP); -NPairStyle(halffull/newtoff/ghost/trim, - NPairHalffullNewtoffTrim, +NPairStyle(halffull/trim/newtoff/ghost, + NPairHalffullTrimNewtoff, NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_HALF | - NP_ORTHO | NP_TRI | NP_GHOST | NP_TRIM); + NP_ORTHO | NP_TRI | NP_TRIM | NP_GHOST); -NPairStyle(halffull/newtoff/skip/ghost/trim, - NPairHalffullNewtoffTrim, +NPairStyle(halffull/trim/newtoff/skip/ghost, + NPairHalffullTrimNewtoff, NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_HALF | - NP_ORTHO | NP_TRI | NP_SKIP | NP_GHOST | NP_TRIM); + NP_ORTHO | NP_TRI | NP_TRIM | NP_SKIP | NP_GHOST); // clang-format on #else -#ifndef LMP_NPAIR_HALFFULL_NEWTOFF_TRIM_H -#define LMP_NPAIR_HALFFULL_NEWTOFF_TRIM_H +#ifndef LMP_NPAIR_HALFFULL_TRIM_NEWTOFF_H +#define LMP_NPAIR_HALFFULL_TRIM_NEWTOFF_H #include "npair.h" namespace LAMMPS_NS { -class NPairHalffullNewtoffTrim : public NPair { +class NPairHalffullTrimNewtoff : public NPair { public: - NPairHalffullNewtoffTrim(class LAMMPS *); + NPairHalffullTrimNewtoff(class LAMMPS *); void build(class NeighList *) override; }; diff --git a/src/npair_halffull_newton_trim.cpp b/src/npair_halffull_trim_newton.cpp similarity index 95% rename from src/npair_halffull_newton_trim.cpp rename to src/npair_halffull_trim_newton.cpp index e758c042844..56cef00b250 100644 --- a/src/npair_halffull_newton_trim.cpp +++ b/src/npair_halffull_trim_newton.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "npair_halffull_newton_trim.h" +#include "npair_halffull_trim_newton.h" #include "atom.h" #include "domain.h" @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairHalffullNewtonTrim::NPairHalffullNewtonTrim(LAMMPS *lmp) : NPair(lmp) {} +NPairHalffullTrimNewton::NPairHalffullTrimNewton(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- build half list from full list @@ -33,7 +33,7 @@ NPairHalffullNewtonTrim::NPairHalffullNewtonTrim(LAMMPS *lmp) : NPair(lmp) {} works if full list is a skip list ------------------------------------------------------------------------- */ -void NPairHalffullNewtonTrim::build(NeighList *list) +void NPairHalffullTrimNewton::build(NeighList *list) { int i, j, ii, jj, n, jnum, joriginal; int *neighptr, *jlist; diff --git a/src/npair_halffull_newton_trim.h b/src/npair_halffull_trim_newton.h similarity index 74% rename from src/npair_halffull_newton_trim.h rename to src/npair_halffull_trim_newton.h index aad3edcbfb2..5eb5aa3cd36 100644 --- a/src/npair_halffull_newton_trim.h +++ b/src/npair_halffull_trim_newton.h @@ -13,28 +13,28 @@ #ifdef NPAIR_CLASS // clang-format off -NPairStyle(halffull/newton/trim, - NPairHalffullNewtonTrim, +NPairStyle(halffull/trim/newton, + NPairHalffullTrimNewton, NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_ORTHO | NP_TRI | NP_TRIM); -NPairStyle(halffull/newton/skip/trim, - NPairHalffullNewtonTrim, +NPairStyle(halffull/trim/newton/skip, + NPairHalffullTrimNewton, NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | - NP_ORTHO | NP_TRI | NP_SKIP | NP_TRIM); + NP_ORTHO | NP_TRI | NP_TRIM | NP_SKIP); // clang-format on #else -#ifndef LMP_NPAIR_HALFFULL_NEWTON_TRIM_H -#define LMP_NPAIR_HALFFULL_NEWTON_TRIM_H +#ifndef LMP_NPAIR_HALFFULL_TRIM_NEWTON_H +#define LMP_NPAIR_HALFFULL_TRIM_NEWTON_H #include "npair.h" namespace LAMMPS_NS { -class NPairHalffullNewtonTrim : public NPair { +class NPairHalffullTrimNewton : public NPair { public: - NPairHalffullNewtonTrim(class LAMMPS *); + NPairHalffullTrimNewton(class LAMMPS *); void build(class NeighList *) override; }; diff --git a/src/npair_skip_respa_trim.cpp b/src/npair_skip_trim_respa.cpp similarity index 97% rename from src/npair_skip_respa_trim.cpp rename to src/npair_skip_trim_respa.cpp index 64b1c4d7165..7dd040ca0a8 100644 --- a/src/npair_skip_respa_trim.cpp +++ b/src/npair_skip_trim_respa.cpp @@ -12,7 +12,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "npair_skip_respa_trim.h" +#include "npair_skip_trim_respa.h" #include "atom.h" #include "error.h" @@ -23,7 +23,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairSkipRespaTrim::NPairSkipRespaTrim(LAMMPS *lmp) : NPair(lmp) {} +NPairSkipTrimRespa::NPairSkipTrimRespa(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- build skip list for subset of types from parent list @@ -31,7 +31,7 @@ NPairSkipRespaTrim::NPairSkipRespaTrim(LAMMPS *lmp) : NPair(lmp) {} this is for respa lists, copy the inner/middle values from parent ------------------------------------------------------------------------- */ -void NPairSkipRespaTrim::build(NeighList *list) +void NPairSkipTrimRespa::build(NeighList *list) { int i,j,ii,jj,n,itype,jnum,joriginal,n_inner,n_middle; int *neighptr,*jlist,*neighptr_inner,*neighptr_middle; diff --git a/src/npair_skip_respa_trim.h b/src/npair_skip_trim_respa.h similarity index 82% rename from src/npair_skip_respa_trim.h rename to src/npair_skip_trim_respa.h index f10b726cbe8..dcfe71c28d0 100644 --- a/src/npair_skip_respa_trim.h +++ b/src/npair_skip_trim_respa.h @@ -13,24 +13,24 @@ #ifdef NPAIR_CLASS // clang-format off -NPairStyle(skip/half/respa/trim, - NPairSkipRespaTrim, +NPairStyle(skip/trim/half/respa, + NPairSkipTrimRespa, NP_SKIP | NP_RESPA | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM); // clang-format on #else -#ifndef LMP_NPAIR_SKIP_RESPA_TRIM_H -#define LMP_NPAIR_SKIP_RESPA_TRIM_H +#ifndef LMP_NPAIR_SKIP_TRIM_RESPA_H +#define LMP_NPAIR_SKIP_TRIM_RESPA_H #include "npair.h" namespace LAMMPS_NS { -class NPairSkipRespaTrim : public NPair { +class NPairSkipTrimRespa : public NPair { public: - NPairSkipRespaTrim(class LAMMPS *); + NPairSkipTrimRespa(class LAMMPS *); void build(class NeighList *) override; }; diff --git a/src/npair_skip_size_trim.cpp b/src/npair_skip_trim_size.cpp similarity index 95% rename from src/npair_skip_size_trim.cpp rename to src/npair_skip_trim_size.cpp index 3fd8f912f97..fab70a78b51 100644 --- a/src/npair_skip_size_trim.cpp +++ b/src/npair_skip_trim_size.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "npair_skip_size_trim.h" +#include "npair_skip_trim_size.h" #include "atom.h" #include "error.h" @@ -22,14 +22,14 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairSkipSizeTrim::NPairSkipSizeTrim(LAMMPS *lmp) : NPair(lmp) {} +NPairSkipTrimSize::NPairSkipTrimSize(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- build skip list for subset of types from parent list iskip and ijskip flag which atom types and type pairs to skip ------------------------------------------------------------------------- */ -void NPairSkipSizeTrim::build(NeighList *list) +void NPairSkipTrimSize::build(NeighList *list) { int i, j, ii, jj, n, itype, jnum, joriginal; int *neighptr, *jlist; diff --git a/src/npair_skip_size_trim.h b/src/npair_skip_trim_size.h similarity index 82% rename from src/npair_skip_size_trim.h rename to src/npair_skip_trim_size.h index e94b2f5f296..3b536860caf 100644 --- a/src/npair_skip_size_trim.h +++ b/src/npair_skip_trim_size.h @@ -13,23 +13,23 @@ #ifdef NPAIR_CLASS // clang-format off -NPairStyle(skip/half/size/trim, - NPairSkipSizeTrim, +NPairStyle(skip/trim/half/size, + NPairSkipTrimSize, NP_SKIP | NP_SIZE | NP_HALF | NP_FULL | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM); // clang-format on #else -#ifndef LMP_NPAIR_SKIP_SIZE_TRIM_H -#define LMP_NPAIR_SKIP_SIZE_TRIM_H +#ifndef LMP_NPAIR_SKIP_TRIM_SIZE_H +#define LMP_NPAIR_SKIP_TRIM_SIZE_H #include "npair.h" namespace LAMMPS_NS { -class NPairSkipSizeTrim : public NPair { +class NPairSkipTrimSize : public NPair { public: - NPairSkipSizeTrim(class LAMMPS *); + NPairSkipTrimSize(class LAMMPS *); void build(class NeighList *) override; }; diff --git a/src/npair_skip_size_off2on_trim.cpp b/src/npair_skip_trim_size_off2on.cpp similarity index 95% rename from src/npair_skip_size_off2on_trim.cpp rename to src/npair_skip_trim_size_off2on.cpp index 9591bbc4eb5..3e9a1e5f633 100644 --- a/src/npair_skip_size_off2on_trim.cpp +++ b/src/npair_skip_trim_size_off2on.cpp @@ -11,7 +11,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "npair_skip_size_off2on_trim.h" +#include "npair_skip_trim_size_off2on.h" #include "atom.h" #include "error.h" @@ -22,7 +22,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairSkipSizeOff2onTrim::NPairSkipSizeOff2onTrim(LAMMPS *lmp) : NPair(lmp) {} +NPairSkipTrimSizeOff2on::NPairSkipTrimSizeOff2on(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- build skip list for subset of types from parent list @@ -30,7 +30,7 @@ NPairSkipSizeOff2onTrim::NPairSkipSizeOff2onTrim(LAMMPS *lmp) : NPair(lmp) {} parent non-skip list used newton off, this skip list is newton on ------------------------------------------------------------------------- */ -void NPairSkipSizeOff2onTrim::build(NeighList *list) +void NPairSkipTrimSizeOff2on::build(NeighList *list) { int i, j, ii, jj, n, itype, jnum, joriginal; tagint itag, jtag; diff --git a/src/npair_skip_size_off2on_trim.h b/src/npair_skip_trim_size_off2on.h similarity index 80% rename from src/npair_skip_size_off2on_trim.h rename to src/npair_skip_trim_size_off2on.h index e471ddd2cc0..6e520823296 100644 --- a/src/npair_skip_size_off2on_trim.h +++ b/src/npair_skip_trim_size_off2on.h @@ -13,24 +13,24 @@ #ifdef NPAIR_CLASS // clang-format off -NPairStyle(skip/size/off2on/trim, - NPairSkipSizeOff2onTrim, +NPairStyle(skip/trim/size/off2on, + NPairSkipTrimSizeOff2on, NP_SKIP | NP_SIZE | NP_OFF2ON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM); // clang-format on #else -#ifndef LMP_NPAIR_SKIP_SIZE_OFF2ON_TRIM_H -#define LMP_NPAIR_SKIP_SIZE_OFF2ON_TRIM_H +#ifndef LMP_NPAIR_SKIP_TRIM_SIZE_OFF2ON_H +#define LMP_NPAIR_SKIP_TRIM_SIZE_OFF2ON_H #include "npair.h" namespace LAMMPS_NS { -class NPairSkipSizeOff2onTrim : public NPair { +class NPairSkipTrimSizeOff2on : public NPair { public: - NPairSkipSizeOff2onTrim(class LAMMPS *); + NPairSkipTrimSizeOff2on(class LAMMPS *); void build(class NeighList *) override; }; diff --git a/src/npair_skip_size_off2on_oneside_trim.cpp b/src/npair_skip_trim_size_off2on_oneside.cpp similarity index 96% rename from src/npair_skip_size_off2on_oneside_trim.cpp rename to src/npair_skip_trim_size_off2on_oneside.cpp index 91940d31353..9d43ac80872 100644 --- a/src/npair_skip_size_off2on_oneside_trim.cpp +++ b/src/npair_skip_trim_size_off2on_oneside.cpp @@ -12,7 +12,7 @@ See the README file in the top-level LAMMPS directory. ------------------------------------------------------------------------- */ -#include "npair_skip_size_off2on_oneside_trim.h" +#include "npair_skip_trim_size_off2on_oneside.h" #include "atom.h" #include "domain.h" @@ -24,7 +24,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ -NPairSkipSizeOff2onOnesideTrim::NPairSkipSizeOff2onOnesideTrim(LAMMPS *lmp) : +NPairSkipTrimSizeOff2onOneside::NPairSkipTrimSizeOff2onOneside(LAMMPS *lmp) : NPair(lmp) {} /* ---------------------------------------------------------------------- @@ -34,7 +34,7 @@ NPairSkipSizeOff2onOnesideTrim::NPairSkipSizeOff2onOnesideTrim(LAMMPS *lmp) : this skip list is newton on and onesided ------------------------------------------------------------------------- */ -void NPairSkipSizeOff2onOnesideTrim::build(NeighList *list) +void NPairSkipTrimSizeOff2onOneside::build(NeighList *list) { int i,j,ii,jj,itype,jnum,joriginal,flip,tmp; int *surf,*jlist; diff --git a/src/npair_skip_size_off2on_oneside_trim.h b/src/npair_skip_trim_size_off2on_oneside.h similarity index 78% rename from src/npair_skip_size_off2on_oneside_trim.h rename to src/npair_skip_trim_size_off2on_oneside.h index 236b886fe41..27861123ddb 100644 --- a/src/npair_skip_size_off2on_oneside_trim.h +++ b/src/npair_skip_trim_size_off2on_oneside.h @@ -13,24 +13,24 @@ #ifdef NPAIR_CLASS // clang-format off -NPairStyle(skip/size/off2on/oneside/trim, - NPairSkipSizeOff2onOnesideTrim, +NPairStyle(skip/trim/size/off2on/oneside, + NPairSkipTrimSizeOff2onOneside, NP_SKIP | NP_SIZE | NP_OFF2ON | NP_ONESIDE | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_TRIM); // clang-format on #else -#ifndef LMP_NPAIR_SKIP_SIZE_OFF2ON_ONESIDE_TRIM_H -#define LMP_NPAIR_SKIP_SIZE_OFF2ON_ONESIDE_TRIM_H +#ifndef LMP_NPAIR_SKIP_TRIM_SIZE_OFF2ON_ONESIDE_H +#define LMP_NPAIR_SKIP_TRIM_SIZE_OFF2ON_ONESIDE_H #include "npair.h" namespace LAMMPS_NS { -class NPairSkipSizeOff2onOnesideTrim : public NPair { +class NPairSkipTrimSizeOff2onOneside : public NPair { public: - NPairSkipSizeOff2onOnesideTrim(class LAMMPS *); + NPairSkipTrimSizeOff2onOneside(class LAMMPS *); void build(class NeighList *) override; };