Prototyping new nstencil/npair classes

This commit is contained in:
jtclemm
2022-08-04 14:05:18 -06:00
parent 5bd86a05b2
commit fb2cf0c32a
132 changed files with 349 additions and 10531 deletions

66
src/nstencil_bin.cpp Normal file
View File

@ -0,0 +1,66 @@
// clang-format off
/* ----------------------------------------------------------------------
LAMMPS - Large-scale Atomic/Molecular Massively Parallel Simulator
https://www.lammps.org/, 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.
------------------------------------------------------------------------- */
#include "nstencil_bin.h"
using namespace LAMMPS_NS;
/* ---------------------------------------------------------------------- */
template<int HALF, int DIM_3D, int TRI>
NStencilBin<HALF, DIM_3D, TRI>::NStencilBin(LAMMPS *lmp) : NStencil(lmp) {}
/* ----------------------------------------------------------------------
create stencil based on bin geometry and cutoff
------------------------------------------------------------------------- */
template<int HALF, int DIM_3D, int TRI>
void NStencilBin<HALF, DIM_3D, TRI>::create()
{
int i,j,k;
bool bin_include;
// For half stencils, only the upper plane is needed
int sy_min = sy;
int sz_min = sz;
if (HALF && (!DIM_3D)) sy_min = 0;
if (HALF && DIM_3D) sz_min = 0;
nstencil = 0;
for (k = -sz_min; k <= sz; k++) {
for (j = -sy_min; j <= sy; j++) {
for (i = -sx; i <= sx; i++) {
// Half and ortho stencils only include own and "upper right" bins
if (HALF && (!DIM_3D) && (!TRI))
if (! (j > 0 || (j == 0 && i >= 0))) continue;
if (HALF && DIM_3D && (!TRI))
if (! (k > 0 || j > 0 || (j == 0 && i >= 0))) continue;
if (bin_distance(i,j,k) < cutneighmaxsq)
stencil[nstencil++] = k*mbiny*mbinx + j*mbinx + i;
}
}
}
}
namespace LAMMPS_NS {
template class NStencilBin<0,0,0>;
template class NStencilBin<0,1,0>;
template class NStencilBin<1,0,0>;
template class NStencilBin<1,0,1>;
template class NStencilBin<1,1,0>;
template class NStencilBin<1,1,1>;
}