diff --git a/src/USER-DPD/npair_half_bin_newton_ssa.cpp b/src/USER-DPD/npair_half_bin_newton_ssa.cpp index e41b9d4276180b4f9e58e60723d00b64c417ab57..fa000233a90bbd6cd59ae66109bcc314031f4eb0 100644 --- a/src/USER-DPD/npair_half_bin_newton_ssa.cpp +++ b/src/USER-DPD/npair_half_bin_newton_ssa.cpp @@ -18,6 +18,7 @@ #include "npair_half_bin_newton_ssa.h" #include "neighbor.h" +#include "nstencil_ssa.h" #include "nbin_ssa.h" #include "neigh_list.h" #include "atom.h" @@ -79,6 +80,11 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) int **firstneigh = list->firstneigh; MyPage<int> *ipage = list->ipage; + NStencilSSA *ns_ssa = dynamic_cast<NStencilSSA*>(ns); + if (!ns_ssa) error->one(FLERR, "NStencil wasn't a NStencilSSA object"); + int nstencil_half = ns_ssa->nstencil_half; + int nstencil_full = ns_ssa->nstencil; + NBinSSA *nb_ssa = dynamic_cast<NBinSSA*>(nb); if (!nb_ssa) error->one(FLERR, "NBin wasn't a NBinSSA object"); int *bins_ssa = nb_ssa->bins_ssa; @@ -140,7 +146,7 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) // loop over all local atoms in other bins in "half" stencil - for (k = 0; k < nstencil; k++) { + for (k = 0; k < nstencil_half; k++) { for (j = binhead_ssa[ibin+stencil[k]]; j >= 0; j = bins_ssa[j]) { @@ -176,7 +182,7 @@ void NPairHalfBinNewtonSSA::build(NeighList *list) // That is a significant time savings because of the "full" stencil // Note2: only non-pure locals can have ghosts as neighbors - if (ssaAIR[i] == 1) for (k = 0; k < nstencil_ssa; k++) { + if (ssaAIR[i] == 1) for (k = 0; k < nstencil_full; k++) { for (j = gbinhead_ssa[ibin+stencil[k]]; j >= 0; j = bins_ssa[j]) { diff --git a/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.cpp b/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.cpp index 8c53abfe80d02de2be676804ae945a0b9a8a9120..4c548c783c701cd999c4805f8f84b7a50cb00d53 100644 --- a/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.cpp +++ b/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ NStencilHalfBin2dNewtonSSA::NStencilHalfBin2dNewtonSSA(LAMMPS *lmp) : - NStencil(lmp) {} + NStencilSSA(lmp) {} /* ---------------------------------------------------------------------- create stencil based on bin geometry and cutoff @@ -49,7 +49,7 @@ void NStencilHalfBin2dNewtonSSA::create() if (bin_distance(i,j,0) < cutneighmaxsq) stencil[pos++] = j*mbinx + i; - nstencil = pos; // record where normal half stencil ends + nstencil_half = pos; // record where normal half stencil ends // include additional bins for AIR ghosts only @@ -60,5 +60,5 @@ void NStencilHalfBin2dNewtonSSA::create() stencil[pos++] = j*mbinx + i; } - nstencil_ssa = pos; // record where full stencil ends + nstencil = pos; // record where full stencil ends } diff --git a/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.h b/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.h index 319a8ce6705301d9c3a24a6236b31407d4b116de..30901bb3e264870d60bd8557ffd21b27764d974c 100644 --- a/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.h +++ b/src/USER-DPD/nstencil_half_bin_2d_newton_ssa.h @@ -22,11 +22,11 @@ NStencilStyle(half/bin/2d/newton/ssa, #ifndef LMP_NSTENCIL_HALF_BIN_2D_NEWTON_SSA_H #define LMP_NSTENCIL_HALF_BIN_2D_NEWTON_SSA_H -#include "nstencil.h" +#include "nstencil_ssa.h" namespace LAMMPS_NS { -class NStencilHalfBin2dNewtonSSA : public NStencil { +class NStencilHalfBin2dNewtonSSA : public NStencilSSA { public: NStencilHalfBin2dNewtonSSA(class LAMMPS *); ~NStencilHalfBin2dNewtonSSA() {} diff --git a/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.cpp b/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.cpp index 1ac15fe61e6b81d20e527e187f4dfeb5bff9d483..4b8bd27016bdbc8ec37c319b19024d8f559b9ec1 100644 --- a/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.cpp +++ b/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.cpp @@ -25,7 +25,7 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- */ NStencilHalfBin3dNewtonSSA::NStencilHalfBin3dNewtonSSA(LAMMPS *lmp) : - NStencil(lmp) {} + NStencilSSA(lmp) {} /* ---------------------------------------------------------------------- create stencil based on bin geometry and cutoff @@ -50,7 +50,7 @@ void NStencilHalfBin3dNewtonSSA::create() if (bin_distance(i,j,k) < cutneighmaxsq) stencil[pos++] = k*mbiny*mbinx + j*mbinx + i; - nstencil = pos; // record where normal half stencil ends + nstencil_half = pos; // record where normal half stencil ends // include additional bins for AIR ghosts only @@ -70,5 +70,5 @@ void NStencilHalfBin3dNewtonSSA::create() stencil[pos++] = k*mbiny*mbinx + j*mbinx + i; } - nstencil_ssa = pos; // record where full stencil ends + nstencil = pos; // record where full stencil ends } diff --git a/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.h b/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.h index 8cb130a712441340e289ca30dc73bd432c59689e..7765b256d30d3a2dcfd27e3a3c8cfb5614a05e28 100644 --- a/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.h +++ b/src/USER-DPD/nstencil_half_bin_3d_newton_ssa.h @@ -22,11 +22,11 @@ NStencilStyle(half/bin/3d/newton/ssa, #ifndef LMP_NSTENCIL_HALF_BIN_3D_NEWTON_SSA_H #define LMP_NSTENCIL_HALF_BIN_3D_NEWTON_SSA_H -#include "nstencil.h" +#include "nstencil_ssa.h" namespace LAMMPS_NS { -class NStencilHalfBin3dNewtonSSA : public NStencil { +class NStencilHalfBin3dNewtonSSA : public NStencilSSA { public: NStencilHalfBin3dNewtonSSA(class LAMMPS *); ~NStencilHalfBin3dNewtonSSA() {} diff --git a/src/USER-DPD/nstencil_ssa.h b/src/USER-DPD/nstencil_ssa.h new file mode 100644 index 0000000000000000000000000000000000000000..9fcd19ee26d9f40abf3d53923af4de6e7082e3fa --- /dev/null +++ b/src/USER-DPD/nstencil_ssa.h @@ -0,0 +1,36 @@ +/* -*- c++ -*- ---------------------------------------------------------- + LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator + http://lammps.sandia.gov, Sandia National Laboratories + Steve Plimpton, sjplimp@sandia.gov + + 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. +------------------------------------------------------------------------- */ + +#ifndef LMP_NSTENCIL_SSA_H +#define LMP_NSTENCIL_SSA_H + +#include "nstencil.h" + +namespace LAMMPS_NS { + +class NStencilSSA : public NStencil { + public: + NStencilSSA(class LAMMPS *lmp) : NStencil(lmp) { } + ~NStencilSSA() {} + virtual void create() = 0; + + int nstencil_half; // where the half stencil ends +}; + +} + +#endif + +/* ERROR/WARNING messages: + +*/ diff --git a/src/npair.cpp b/src/npair.cpp index 20522cde485d665e867a190fe91d6bf34dde6b6a..6ea4e62550904b7dbc2d9e2a07c755fe2b5e59ae 100644 --- a/src/npair.cpp +++ b/src/npair.cpp @@ -113,7 +113,6 @@ void NPair::copy_bin_info() void NPair::copy_stencil_info() { nstencil = ns->nstencil; - nstencil_ssa = ns->nstencil_ssa; stencil = ns->stencil; stencilxyz = ns->stencilxyz; nstencil_multi = ns->nstencil_multi; diff --git a/src/npair.h b/src/npair.h index aba7256d73dc62cf77c0c853a6017229ccef33c2..70fcc5c4527d7781d14cf73768aaf5269a62e6d9 100644 --- a/src/npair.h +++ b/src/npair.h @@ -81,7 +81,6 @@ class NPair : protected Pointers { // data from NStencil class int nstencil; - int nstencil_ssa; int *stencil; int **stencilxyz; int *nstencil_multi; diff --git a/src/nstencil.h b/src/nstencil.h index c0ecfe2754dd40d6a545016e2ee31e87e3ac4151..b9c6dd58fbd97fbbce65fc8d7087bfa8dd73f759 100644 --- a/src/nstencil.h +++ b/src/nstencil.h @@ -28,7 +28,6 @@ class NStencil : protected Pointers { bigint last_copy_bin; int nstencil; // # of bins in stencil - int nstencil_ssa; // # of total bins in SSA stencil int *stencil; // list of bin offsets int **stencilxyz; // bin offsets in xyz dims int *nstencil_multi; // # bins in each type-based multi stencil