Consolidating some skip npair classes
This commit is contained in:
@ -22,7 +22,8 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
NPairSkip::NPairSkip(LAMMPS *lmp) : NPair(lmp) {}
|
template<int SIZE, int TRIM>
|
||||||
|
NPairSkipTemp<SIZE, TRIM>::NPairSkipTemp(LAMMPS *lmp) : NPair(lmp) {}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
build skip list for subset of types from parent list
|
build skip list for subset of types from parent list
|
||||||
@ -32,7 +33,8 @@ NPairSkip::NPairSkip(LAMMPS *lmp) : NPair(lmp) {}
|
|||||||
if ghost, also store neighbors of ghost atoms & set inum,gnum correctly
|
if ghost, also store neighbors of ghost atoms & set inum,gnum correctly
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void NPairSkip::build(NeighList *list)
|
template<int SIZE, int TRIM>
|
||||||
|
void NPairSkipTemp<SIZE, TRIM>::build(NeighList *list)
|
||||||
{
|
{
|
||||||
int i, j, ii, jj, n, itype, jnum, joriginal;
|
int i, j, ii, jj, n, itype, jnum, joriginal;
|
||||||
int *neighptr, *jlist;
|
int *neighptr, *jlist;
|
||||||
@ -57,6 +59,11 @@ void NPairSkip::build(NeighList *list)
|
|||||||
int inum = 0;
|
int inum = 0;
|
||||||
ipage->reset();
|
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
|
// loop over atoms in other list
|
||||||
// skip I atom entirely if iskip is set for type[I]
|
// skip I atom entirely if iskip is set for type[I]
|
||||||
// skip I,J pair if ijskip is set for type[I],type[J]
|
// skip I,J pair if ijskip is set for type[I],type[J]
|
||||||
@ -66,6 +73,12 @@ void NPairSkip::build(NeighList *list)
|
|||||||
itype = type[i];
|
itype = type[i];
|
||||||
if (iskip[itype]) continue;
|
if (iskip[itype]) continue;
|
||||||
|
|
||||||
|
if (TRIM) {
|
||||||
|
xtmp = x[i][0];
|
||||||
|
ytmp = x[i][1];
|
||||||
|
ztmp = x[i][2];
|
||||||
|
}
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
neighptr = ipage->vget();
|
neighptr = ipage->vget();
|
||||||
|
|
||||||
@ -78,6 +91,15 @@ void NPairSkip::build(NeighList *list)
|
|||||||
joriginal = jlist[jj];
|
joriginal = jlist[jj];
|
||||||
j = joriginal & NEIGHMASK;
|
j = joriginal & NEIGHMASK;
|
||||||
if (ijskip[itype][type[j]]) continue;
|
if (ijskip[itype][type[j]]) continue;
|
||||||
|
|
||||||
|
if (TRIM) {
|
||||||
|
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;
|
neighptr[n++] = joriginal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -100,3 +122,10 @@ void NPairSkip::build(NeighList *list)
|
|||||||
list->gnum = inum - num;
|
list->gnum = inum - num;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
template class NPairSkipTemp<0,0>;
|
||||||
|
template class NPairSkipTemp<1,0>;
|
||||||
|
template class NPairSkipTemp<0,1>;
|
||||||
|
template class NPairSkipTemp<1,1>;
|
||||||
|
}
|
||||||
|
|||||||
@ -13,17 +13,46 @@
|
|||||||
|
|
||||||
#ifdef NPAIR_CLASS
|
#ifdef NPAIR_CLASS
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
typedef NPairSkipTemp<0, 0> NPairSkip;
|
||||||
NPairStyle(skip,
|
NPairStyle(skip,
|
||||||
NPairSkip,
|
NPairSkip,
|
||||||
NP_SKIP | NP_HALF | NP_FULL |
|
NP_SKIP | NP_HALF | NP_FULL |
|
||||||
NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
|
NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
|
||||||
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||||
|
|
||||||
|
typedef NPairSkipTemp<0, 0> NPairSkip;
|
||||||
NPairStyle(skip/ghost,
|
NPairStyle(skip/ghost,
|
||||||
NPairSkip,
|
NPairSkip,
|
||||||
NP_SKIP | NP_HALF | NP_FULL |
|
NP_SKIP | NP_HALF | NP_FULL |
|
||||||
NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
|
NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
|
||||||
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_GHOST);
|
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI | NP_GHOST);
|
||||||
|
|
||||||
|
typedef NPairSkipTemp<1, 0> NPairSkipSize;
|
||||||
|
NPairStyle(skip/half/size,
|
||||||
|
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);
|
||||||
|
|
||||||
|
typedef NPairSkipTemp<0, 1> NPairSkipTrim;
|
||||||
|
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);
|
||||||
|
|
||||||
|
typedef NPairSkipTemp<0, 1> NPairSkipTrim;
|
||||||
|
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);
|
||||||
|
|
||||||
|
typedef NPairSkipTemp<1, 1> NPairSkipTrimSize;
|
||||||
|
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
|
// clang-format on
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -34,9 +63,10 @@ NPairStyle(skip/ghost,
|
|||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
class NPairSkip : public NPair {
|
template<int SIZE, int TRIM>
|
||||||
|
class NPairSkipTemp : public NPair {
|
||||||
public:
|
public:
|
||||||
NPairSkip(class LAMMPS *);
|
NPairSkipTemp(class LAMMPS *);
|
||||||
void build(class NeighList *) override;
|
void build(class NeighList *) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -23,7 +23,8 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
NPairSkipRespa::NPairSkipRespa(LAMMPS *lmp) : NPair(lmp) {}
|
template<int TRIM>
|
||||||
|
NPairSkipRespaTemp<TRIM>::NPairSkipRespaTemp(LAMMPS *lmp) : NPair(lmp) {}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
build skip list for subset of types from parent list
|
build skip list for subset of types from parent list
|
||||||
@ -31,7 +32,8 @@ NPairSkipRespa::NPairSkipRespa(LAMMPS *lmp) : NPair(lmp) {}
|
|||||||
this is for respa lists, copy the inner/middle values from parent
|
this is for respa lists, copy the inner/middle values from parent
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void NPairSkipRespa::build(NeighList *list)
|
template<int TRIM>
|
||||||
|
void NPairSkipRespaTemp<TRIM>::build(NeighList *list)
|
||||||
{
|
{
|
||||||
int i, j, ii, jj, n, itype, jnum, joriginal, n_inner, n_middle;
|
int i, j, ii, jj, n, itype, jnum, joriginal, n_inner, n_middle;
|
||||||
int *neighptr, *jlist, *neighptr_inner, *neighptr_middle;
|
int *neighptr, *jlist, *neighptr_inner, *neighptr_middle;
|
||||||
@ -76,6 +78,11 @@ void NPairSkipRespa::build(NeighList *list)
|
|||||||
ipage_inner->reset();
|
ipage_inner->reset();
|
||||||
if (respamiddle) ipage_middle->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
|
// loop over atoms in other list
|
||||||
// skip I atom entirely if iskip is set for type[I]
|
// skip I atom entirely if iskip is set for type[I]
|
||||||
// skip I,J pair if ijskip is set for type[I],type[J]
|
// skip I,J pair if ijskip is set for type[I],type[J]
|
||||||
@ -85,6 +92,12 @@ void NPairSkipRespa::build(NeighList *list)
|
|||||||
itype = type[i];
|
itype = type[i];
|
||||||
if (iskip[itype]) continue;
|
if (iskip[itype]) continue;
|
||||||
|
|
||||||
|
if (TRIM) {
|
||||||
|
xtmp = x[i][0];
|
||||||
|
ytmp = x[i][1];
|
||||||
|
ztmp = x[i][2];
|
||||||
|
}
|
||||||
|
|
||||||
n = n_inner = 0;
|
n = n_inner = 0;
|
||||||
neighptr = ipage->vget();
|
neighptr = ipage->vget();
|
||||||
neighptr_inner = ipage_inner->vget();
|
neighptr_inner = ipage_inner->vget();
|
||||||
@ -102,6 +115,15 @@ void NPairSkipRespa::build(NeighList *list)
|
|||||||
joriginal = jlist[jj];
|
joriginal = jlist[jj];
|
||||||
j = joriginal & NEIGHMASK;
|
j = joriginal & NEIGHMASK;
|
||||||
if (ijskip[itype][type[j]]) continue;
|
if (ijskip[itype][type[j]]) continue;
|
||||||
|
|
||||||
|
if (TRIM) {
|
||||||
|
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;
|
neighptr[n++] = joriginal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -114,6 +136,15 @@ void NPairSkipRespa::build(NeighList *list)
|
|||||||
joriginal = jlist[jj];
|
joriginal = jlist[jj];
|
||||||
j = joriginal & NEIGHMASK;
|
j = joriginal & NEIGHMASK;
|
||||||
if (ijskip[itype][type[j]]) continue;
|
if (ijskip[itype][type[j]]) continue;
|
||||||
|
|
||||||
|
if (TRIM) {
|
||||||
|
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;
|
neighptr_inner[n_inner++] = joriginal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -127,6 +158,15 @@ void NPairSkipRespa::build(NeighList *list)
|
|||||||
joriginal = jlist[jj];
|
joriginal = jlist[jj];
|
||||||
j = joriginal & NEIGHMASK;
|
j = joriginal & NEIGHMASK;
|
||||||
if (ijskip[itype][type[j]]) continue;
|
if (ijskip[itype][type[j]]) continue;
|
||||||
|
|
||||||
|
if (TRIM) {
|
||||||
|
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;
|
neighptr_middle[n_middle++] = joriginal;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -158,3 +198,8 @@ void NPairSkipRespa::build(NeighList *list)
|
|||||||
list->inum_inner = inum;
|
list->inum_inner = inum;
|
||||||
if (respamiddle) list->inum_middle = inum;
|
if (respamiddle) list->inum_middle = inum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
template class NPairSkipRespaTemp<0>;
|
||||||
|
template class NPairSkipRespaTemp<1>;
|
||||||
|
}
|
||||||
|
|||||||
@ -13,11 +13,20 @@
|
|||||||
|
|
||||||
#ifdef NPAIR_CLASS
|
#ifdef NPAIR_CLASS
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
typedef NPairSkipRespaTemp<0> NPairSkipRespa;
|
||||||
NPairStyle(skip/half/respa,
|
NPairStyle(skip/half/respa,
|
||||||
NPairSkipRespa,
|
NPairSkipRespa,
|
||||||
NP_SKIP | NP_RESPA | NP_HALF | NP_FULL |
|
NP_SKIP | NP_RESPA | NP_HALF | NP_FULL |
|
||||||
NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
|
NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
|
||||||
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||||
|
|
||||||
|
typedef NPairSkipRespaTemp<0> NPairSkipTrimRespa;
|
||||||
|
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
|
// clang-format on
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -28,9 +37,10 @@ NPairStyle(skip/half/respa,
|
|||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
class NPairSkipRespa : public NPair {
|
template<int TRIM>
|
||||||
|
class NPairSkipRespaTemp : public NPair {
|
||||||
public:
|
public:
|
||||||
NPairSkipRespa(class LAMMPS *);
|
NPairSkipRespaTemp(class LAMMPS *);
|
||||||
void build(class NeighList *) override;
|
void build(class NeighList *) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,86 +0,0 @@
|
|||||||
/* ----------------------------------------------------------------------
|
|
||||||
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.h"
|
|
||||||
|
|
||||||
#include "atom.h"
|
|
||||||
#include "error.h"
|
|
||||||
#include "my_page.h"
|
|
||||||
#include "neigh_list.h"
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
NPairSkipSize::NPairSkipSize(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 NPairSkipSize::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<int> *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();
|
|
||||||
|
|
||||||
// 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;
|
|
||||||
|
|
||||||
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;
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
/* -*- 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,
|
|
||||||
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);
|
|
||||||
// clang-format on
|
|
||||||
#else
|
|
||||||
|
|
||||||
#ifndef LMP_NPAIR_SKIP_SIZE_H
|
|
||||||
#define LMP_NPAIR_SKIP_SIZE_H
|
|
||||||
|
|
||||||
#include "npair.h"
|
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
|
||||||
|
|
||||||
class NPairSkipSize : public NPair {
|
|
||||||
public:
|
|
||||||
NPairSkipSize(class LAMMPS *);
|
|
||||||
void build(class NeighList *) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace LAMMPS_NS
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
@ -22,7 +22,8 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
NPairSkipSizeOff2on::NPairSkipSizeOff2on(LAMMPS *lmp) : NPair(lmp) {}
|
template<int TRIM>
|
||||||
|
NPairSkipSizeOff2onTemp<TRIM>::NPairSkipSizeOff2onTemp(LAMMPS *lmp) : NPair(lmp) {}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
build skip list for subset of types from parent list
|
build skip list for subset of types from parent list
|
||||||
@ -30,7 +31,8 @@ NPairSkipSizeOff2on::NPairSkipSizeOff2on(LAMMPS *lmp) : NPair(lmp) {}
|
|||||||
parent non-skip list used newton off, this skip list is newton on
|
parent non-skip list used newton off, this skip list is newton on
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void NPairSkipSizeOff2on::build(NeighList *list)
|
template<int TRIM>
|
||||||
|
void NPairSkipSizeOff2onTemp<TRIM>::build(NeighList *list)
|
||||||
{
|
{
|
||||||
int i, j, ii, jj, n, itype, jnum, joriginal;
|
int i, j, ii, jj, n, itype, jnum, joriginal;
|
||||||
tagint itag, jtag;
|
tagint itag, jtag;
|
||||||
@ -56,6 +58,11 @@ void NPairSkipSizeOff2on::build(NeighList *list)
|
|||||||
int inum = 0;
|
int inum = 0;
|
||||||
ipage->reset();
|
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
|
// loop over atoms in other list
|
||||||
// skip I atom entirely if iskip is set for type[I]
|
// skip I atom entirely if iskip is set for type[I]
|
||||||
// skip I,J pair if ijskip is set for type[I],type[J]
|
// skip I,J pair if ijskip is set for type[I],type[J]
|
||||||
@ -66,6 +73,12 @@ void NPairSkipSizeOff2on::build(NeighList *list)
|
|||||||
if (iskip[itype]) continue;
|
if (iskip[itype]) continue;
|
||||||
itag = tag[i];
|
itag = tag[i];
|
||||||
|
|
||||||
|
if (TRIM) {
|
||||||
|
xtmp = x[i][0];
|
||||||
|
ytmp = x[i][1];
|
||||||
|
ztmp = x[i][2];
|
||||||
|
}
|
||||||
|
|
||||||
n = 0;
|
n = 0;
|
||||||
neighptr = ipage->vget();
|
neighptr = ipage->vget();
|
||||||
|
|
||||||
@ -84,6 +97,14 @@ void NPairSkipSizeOff2on::build(NeighList *list)
|
|||||||
jtag = tag[j];
|
jtag = tag[j];
|
||||||
if (j >= nlocal && jtag < itag) continue;
|
if (j >= nlocal && jtag < itag) continue;
|
||||||
|
|
||||||
|
if (TRIM) {
|
||||||
|
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;
|
neighptr[n++] = joriginal;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -95,3 +116,8 @@ void NPairSkipSizeOff2on::build(NeighList *list)
|
|||||||
}
|
}
|
||||||
list->inum = inum;
|
list->inum = inum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
template class NPairSkipSizeOff2onTemp<0>;
|
||||||
|
template class NPairSkipSizeOff2onTemp<1>;
|
||||||
|
}
|
||||||
|
|||||||
@ -13,11 +13,19 @@
|
|||||||
|
|
||||||
#ifdef NPAIR_CLASS
|
#ifdef NPAIR_CLASS
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
typedef NPairSkipSizeOff2onTemp<0> NPairSkipSizeOff2on;
|
||||||
NPairStyle(skip/size/off2on,
|
NPairStyle(skip/size/off2on,
|
||||||
NPairSkipSizeOff2on,
|
NPairSkipSizeOff2on,
|
||||||
NP_SKIP | NP_SIZE | NP_OFF2ON | NP_HALF |
|
NP_SKIP | NP_SIZE | NP_OFF2ON | NP_HALF |
|
||||||
NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
|
NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
|
||||||
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||||
|
|
||||||
|
typedef NPairSkipSizeOff2onTemp<0> NPairSkipTrimSizeOff2on;
|
||||||
|
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
|
// clang-format on
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -28,9 +36,10 @@ NPairStyle(skip/size/off2on,
|
|||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
class NPairSkipSizeOff2on : public NPair {
|
template<int TRIM>
|
||||||
|
class NPairSkipSizeOff2onTemp : public NPair {
|
||||||
public:
|
public:
|
||||||
NPairSkipSizeOff2on(class LAMMPS *);
|
NPairSkipSizeOff2onTemp(class LAMMPS *);
|
||||||
void build(class NeighList *) override;
|
void build(class NeighList *) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -24,7 +24,8 @@ using namespace LAMMPS_NS;
|
|||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
/* ---------------------------------------------------------------------- */
|
||||||
|
|
||||||
NPairSkipSizeOff2onOneside::NPairSkipSizeOff2onOneside(LAMMPS *lmp) :
|
template<int TRIM>
|
||||||
|
NPairSkipSizeOff2onOnesideTemp<TRIM>::NPairSkipSizeOff2onOnesideTemp(LAMMPS *lmp) :
|
||||||
NPair(lmp) {}
|
NPair(lmp) {}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -34,7 +35,8 @@ NPairSkipSizeOff2onOneside::NPairSkipSizeOff2onOneside(LAMMPS *lmp) :
|
|||||||
this skip list is newton on and onesided
|
this skip list is newton on and onesided
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void NPairSkipSizeOff2onOneside::build(NeighList *list)
|
template<int TRIM>
|
||||||
|
void NPairSkipSizeOff2onOnesideTemp<TRIM>::build(NeighList *list)
|
||||||
{
|
{
|
||||||
int i, j, ii, jj, itype, jnum, joriginal, flip, tmp;
|
int i, j, ii, jj, itype, jnum, joriginal, flip, tmp;
|
||||||
int *surf, *jlist;
|
int *surf, *jlist;
|
||||||
@ -61,6 +63,11 @@ void NPairSkipSizeOff2onOneside::build(NeighList *list)
|
|||||||
int inum = 0;
|
int inum = 0;
|
||||||
ipage->reset();
|
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
|
// 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
|
// 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
|
// so don't know in advance how much space to alloc for each atom's neighs
|
||||||
@ -76,6 +83,12 @@ void NPairSkipSizeOff2onOneside::build(NeighList *list)
|
|||||||
itype = type[i];
|
itype = type[i];
|
||||||
if (iskip[itype]) continue;
|
if (iskip[itype]) continue;
|
||||||
|
|
||||||
|
if (TRIM) {
|
||||||
|
xtmp = x[i][0];
|
||||||
|
ytmp = x[i][1];
|
||||||
|
ztmp = x[i][2];
|
||||||
|
}
|
||||||
|
|
||||||
// loop over parent non-skip size list
|
// loop over parent non-skip size list
|
||||||
|
|
||||||
jlist = firstneigh_skip[i];
|
jlist = firstneigh_skip[i];
|
||||||
@ -86,6 +99,14 @@ void NPairSkipSizeOff2onOneside::build(NeighList *list)
|
|||||||
j = joriginal & NEIGHMASK;
|
j = joriginal & NEIGHMASK;
|
||||||
if (ijskip[itype][type[j]]) continue;
|
if (ijskip[itype][type[j]]) continue;
|
||||||
|
|
||||||
|
if (TRIM) {
|
||||||
|
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
|
// flip I,J if necessary to satisfy onesided constraint
|
||||||
// do not keep if I is now ghost
|
// do not keep if I is now ghost
|
||||||
|
|
||||||
@ -121,6 +142,12 @@ void NPairSkipSizeOff2onOneside::build(NeighList *list)
|
|||||||
itype = type[i];
|
itype = type[i];
|
||||||
if (iskip[itype]) continue;
|
if (iskip[itype]) continue;
|
||||||
|
|
||||||
|
if (TRIM) {
|
||||||
|
xtmp = x[i][0];
|
||||||
|
ytmp = x[i][1];
|
||||||
|
ztmp = x[i][2];
|
||||||
|
}
|
||||||
|
|
||||||
// loop over parent non-skip size list and optionally its history info
|
// loop over parent non-skip size list and optionally its history info
|
||||||
|
|
||||||
jlist = firstneigh_skip[i];
|
jlist = firstneigh_skip[i];
|
||||||
@ -131,6 +158,14 @@ void NPairSkipSizeOff2onOneside::build(NeighList *list)
|
|||||||
j = joriginal & NEIGHMASK;
|
j = joriginal & NEIGHMASK;
|
||||||
if (ijskip[itype][type[j]]) continue;
|
if (ijskip[itype][type[j]]) continue;
|
||||||
|
|
||||||
|
if (TRIM) {
|
||||||
|
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
|
// flip I,J if necessary to satisfy onesided constraint
|
||||||
// do not keep if I is now ghost
|
// do not keep if I is now ghost
|
||||||
|
|
||||||
@ -157,3 +192,8 @@ void NPairSkipSizeOff2onOneside::build(NeighList *list)
|
|||||||
|
|
||||||
list->inum = inum;
|
list->inum = inum;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
namespace LAMMPS_NS {
|
||||||
|
template class NPairSkipSizeOff2onOnesideTemp<0>;
|
||||||
|
template class NPairSkipSizeOff2onOnesideTemp<1>;
|
||||||
|
}
|
||||||
|
|||||||
@ -13,11 +13,19 @@
|
|||||||
|
|
||||||
#ifdef NPAIR_CLASS
|
#ifdef NPAIR_CLASS
|
||||||
// clang-format off
|
// clang-format off
|
||||||
|
typedef NPairSkipSizeOff2onOnesideTemp<0> NPairSkipSizeOff2onOneside;
|
||||||
NPairStyle(skip/size/off2on/oneside,
|
NPairStyle(skip/size/off2on/oneside,
|
||||||
NPairSkipSizeOff2onOneside,
|
NPairSkipSizeOff2onOneside,
|
||||||
NP_SKIP | NP_SIZE | NP_OFF2ON | NP_ONESIDE | NP_HALF |
|
NP_SKIP | NP_SIZE | NP_OFF2ON | NP_ONESIDE | NP_HALF |
|
||||||
NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF |
|
NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF |
|
||||||
NP_ORTHO | NP_TRI);
|
NP_ORTHO | NP_TRI);
|
||||||
|
|
||||||
|
typedef NPairSkipSizeOff2onOnesideTemp<1> NPairSkipTrimSizeOff2onOneside;
|
||||||
|
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
|
// clang-format on
|
||||||
#else
|
#else
|
||||||
|
|
||||||
@ -28,9 +36,10 @@ NPairStyle(skip/size/off2on/oneside,
|
|||||||
|
|
||||||
namespace LAMMPS_NS {
|
namespace LAMMPS_NS {
|
||||||
|
|
||||||
class NPairSkipSizeOff2onOneside : public NPair {
|
template<int TRIM>
|
||||||
|
class NPairSkipSizeOff2onOnesideTemp : public NPair {
|
||||||
public:
|
public:
|
||||||
NPairSkipSizeOff2onOneside(class LAMMPS *);
|
NPairSkipSizeOff2onOnesideTemp(class LAMMPS *);
|
||||||
void build(class NeighList *) override;
|
void build(class NeighList *) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@ -1,118 +0,0 @@
|
|||||||
/* ----------------------------------------------------------------------
|
|
||||||
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<int> *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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
/* -*- 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
|
|
||||||
@ -1,193 +0,0 @@
|
|||||||
// 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_trim_respa.h"
|
|
||||||
|
|
||||||
#include "atom.h"
|
|
||||||
#include "error.h"
|
|
||||||
#include "my_page.h"
|
|
||||||
#include "neigh_list.h"
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
NPairSkipTrimRespa::NPairSkipTrimRespa(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 NPairSkipTrimRespa::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<int> *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<int> *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<int> *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;
|
|
||||||
}
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
/* -*- 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/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_TRIM_RESPA_H
|
|
||||||
#define LMP_NPAIR_SKIP_TRIM_RESPA_H
|
|
||||||
|
|
||||||
#include "npair.h"
|
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
|
||||||
|
|
||||||
class NPairSkipTrimRespa : public NPair {
|
|
||||||
public:
|
|
||||||
NPairSkipTrimRespa(class LAMMPS *);
|
|
||||||
void build(class NeighList *) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace LAMMPS_NS
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
@ -1,102 +0,0 @@
|
|||||||
/* ----------------------------------------------------------------------
|
|
||||||
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_size.h"
|
|
||||||
|
|
||||||
#include "atom.h"
|
|
||||||
#include "error.h"
|
|
||||||
#include "my_page.h"
|
|
||||||
#include "neigh_list.h"
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
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 NPairSkipTrimSize::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<int> *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;
|
|
||||||
}
|
|
||||||
@ -1,39 +0,0 @@
|
|||||||
/* -*- 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/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_TRIM_SIZE_H
|
|
||||||
#define LMP_NPAIR_SKIP_TRIM_SIZE_H
|
|
||||||
|
|
||||||
#include "npair.h"
|
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
|
||||||
|
|
||||||
class NPairSkipTrimSize : public NPair {
|
|
||||||
public:
|
|
||||||
NPairSkipTrimSize(class LAMMPS *);
|
|
||||||
void build(class NeighList *) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace LAMMPS_NS
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
@ -1,112 +0,0 @@
|
|||||||
/* ----------------------------------------------------------------------
|
|
||||||
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_size_off2on.h"
|
|
||||||
|
|
||||||
#include "atom.h"
|
|
||||||
#include "error.h"
|
|
||||||
#include "my_page.h"
|
|
||||||
#include "neigh_list.h"
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
NPairSkipTrimSizeOff2on::NPairSkipTrimSizeOff2on(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 NPairSkipTrimSizeOff2on::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<int> *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;
|
|
||||||
}
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
/* -*- 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/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_TRIM_SIZE_OFF2ON_H
|
|
||||||
#define LMP_NPAIR_SKIP_TRIM_SIZE_OFF2ON_H
|
|
||||||
|
|
||||||
#include "npair.h"
|
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
|
||||||
|
|
||||||
class NPairSkipTrimSizeOff2on : public NPair {
|
|
||||||
public:
|
|
||||||
NPairSkipTrimSizeOff2on(class LAMMPS *);
|
|
||||||
void build(class NeighList *) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace LAMMPS_NS
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
@ -1,185 +0,0 @@
|
|||||||
// 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_trim_size_off2on_oneside.h"
|
|
||||||
|
|
||||||
#include "atom.h"
|
|
||||||
#include "domain.h"
|
|
||||||
#include "error.h"
|
|
||||||
#include "my_page.h"
|
|
||||||
#include "neigh_list.h"
|
|
||||||
|
|
||||||
using namespace LAMMPS_NS;
|
|
||||||
|
|
||||||
/* ---------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
NPairSkipTrimSizeOff2onOneside::NPairSkipTrimSizeOff2onOneside(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 NPairSkipTrimSizeOff2onOneside::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<int> *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;
|
|
||||||
}
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
/* -*- 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/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_TRIM_SIZE_OFF2ON_ONESIDE_H
|
|
||||||
#define LMP_NPAIR_SKIP_TRIM_SIZE_OFF2ON_ONESIDE_H
|
|
||||||
|
|
||||||
#include "npair.h"
|
|
||||||
|
|
||||||
namespace LAMMPS_NS {
|
|
||||||
|
|
||||||
class NPairSkipTrimSizeOff2onOneside : public NPair {
|
|
||||||
public:
|
|
||||||
NPairSkipTrimSizeOff2onOneside(class LAMMPS *);
|
|
||||||
void build(class NeighList *) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace LAMMPS_NS
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
Reference in New Issue
Block a user