Prototyping new nstencil/npair classes
This commit is contained in:
@ -12,29 +12,33 @@
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "npair_full_bin.h"
|
||||
#include "npair_bin.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "neighbor.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace NeighConst;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairFullBin::NPairFullBin(LAMMPS *lmp) : NPair(lmp) {}
|
||||
template<int HALF, int NEWTON, int TRI>
|
||||
NPairBin<HALF, NEWTON, TRI>::NPairBin(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction for all neighbors
|
||||
every neighbor pair appears in list of both atoms i and j
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairFullBin::build(NeighList *list)
|
||||
template<int HALF, int NEWTON, int TRI>
|
||||
void NPairBin<HALF, NEWTON, TRI>::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,imol,iatom,moltemplate;
|
||||
int i,j,k,n,itype,jtype,ibin,bin_start,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr;
|
||||
@ -77,14 +81,59 @@ void NPairFullBin::build(NeighList *list)
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in surrounding bins in stencil including self
|
||||
// skip i = j
|
||||
|
||||
ibin = atom2bin[i];
|
||||
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
bin_start = binhead[ibin+stencil[k]];
|
||||
if (stencil[k] == 0) {
|
||||
if (HALF && NEWTON && (!TRI)) {
|
||||
// Half neighbor list, newton on, orthonormal
|
||||
// loop over rest of atoms in i's bin, ghosts are at end of linked list
|
||||
bin_start = bins[i];
|
||||
}
|
||||
}
|
||||
|
||||
for (j = bin_start; j >= 0; j = bins[j]) {
|
||||
if (!HALF) {
|
||||
// Full neighbor list
|
||||
// only skip i = j
|
||||
if (i == j) continue;
|
||||
} else if (!NEWTON) {
|
||||
// Half neighbor list, newton off
|
||||
// only store pair if i < j
|
||||
// stores own/own pairs only once
|
||||
// stores own/ghost pairs on both procs
|
||||
if (j <= i) continue;
|
||||
} else if (TRI) {
|
||||
// Half neighbor list, newton on, triclinic
|
||||
// pairs for atoms j "below" i are excluded
|
||||
// below = lower z or (equal z and lower y) or (equal zy and lower x)
|
||||
// (equal zyx and j <= i)
|
||||
// latter excludes self-self interaction but allows superposed atoms
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp) {
|
||||
if (x[j][0] < xtmp) continue;
|
||||
if (x[j][0] == xtmp && j <= i) continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Half neighbor list, newton on, orthonormal
|
||||
// store every pair for every bin in stencil,except for i's bin
|
||||
|
||||
if (stencil[k] == 0) {
|
||||
// if j is owned atom, store it, since j is beyond i in linked list
|
||||
// if j is ghost, only store if j coords are "above and to the "right" of i
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
@ -121,5 +170,12 @@ void NPairFullBin::build(NeighList *list)
|
||||
}
|
||||
|
||||
list->inum = inum;
|
||||
list->gnum = 0;
|
||||
if (!HALF) list->gnum = 0;
|
||||
}
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
template class NPairBin<0,1,0>;
|
||||
template class NPairBin<1,0,0>;
|
||||
template class NPairBin<1,1,0>;
|
||||
template class NPairBin<1,1,1>;
|
||||
}
|
||||
@ -13,23 +13,40 @@
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
typedef NPairBin<0, 1, 0> NPairFullBin;
|
||||
NPairStyle(full/bin,
|
||||
NPairFullBin,
|
||||
NP_FULL | NP_BIN | NP_MOLONLY |
|
||||
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
|
||||
typedef NPairBin<1, 0, 0> NPairHalfBinNewtoff;
|
||||
NPairStyle(half/bin/newtoff,
|
||||
NPairHalfBinNewtoff,
|
||||
NP_HALF | NP_BIN | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
|
||||
typedef NPairBin<1, 1, 0> NPairHalfBinNewton;
|
||||
NPairStyle(half/bin/newton,
|
||||
NPairHalfBinNewton,
|
||||
NP_HALF | NP_BIN | NP_MOLONLY | NP_NEWTON | NP_ORTHO);
|
||||
|
||||
typedef NPairBin<1, 1, 1> NPairHalfBinNewtonTri;
|
||||
NPairStyle(half/bin/newton/tri,
|
||||
NPairHalfBinNewtonTri,
|
||||
NP_HALF | NP_BIN | NP_NEWTON | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_FULL_BIN_H
|
||||
#define LMP_NPAIR_FULL_BIN_H
|
||||
#ifndef LMP_NPAIR_BIN_H
|
||||
#define LMP_NPAIR_BIN_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairFullBin : public NPair {
|
||||
template<int HALF, int NEWTON, int TRI>
|
||||
class NPairBin : public NPair {
|
||||
public:
|
||||
NPairFullBin(class LAMMPS *);
|
||||
NPairBin(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
148
src/npair_bin_atomonly.cpp
Normal file
148
src/npair_bin_atomonly.cpp
Normal file
@ -0,0 +1,148 @@
|
||||
// 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 "npair_bin_atomonly.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
#include "neighbor.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
using namespace NeighConst;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<int HALF, int NEWTON, int TRI>
|
||||
NPairBinAtomonly<HALF, NEWTON, TRI>::NPairBinAtomonly(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction for all neighbors
|
||||
every neighbor pair appears in list of both atoms i and j
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
template<int HALF, int NEWTON, int TRI>
|
||||
void NPairBinAtomonly<HALF, NEWTON, TRI>::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,bin_start;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *molecule = atom->molecule;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
|
||||
ibin = atom2bin[i];
|
||||
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
bin_start = binhead[ibin+stencil[k]];
|
||||
if (stencil[k] == 0) {
|
||||
if (HALF && NEWTON && (!TRI)) {
|
||||
// Half neighbor list, newton on, orthonormal
|
||||
// loop over rest of atoms in i's bin, ghosts are at end of linked list
|
||||
bin_start = bins[i];
|
||||
}
|
||||
}
|
||||
|
||||
for (j = bin_start; j >= 0; j = bins[j]) {
|
||||
if (!HALF) {
|
||||
// Full neighbor list
|
||||
// only skip i = j
|
||||
if (i == j) continue;
|
||||
} else if (!NEWTON) {
|
||||
// Half neighbor list, newton off
|
||||
// only store pair if i < j
|
||||
// stores own/own pairs only once
|
||||
// stores own/ghost pairs on both procs
|
||||
if (j <= i) continue;
|
||||
} else if (TRI) {
|
||||
// Half neighbor list, newton on, triclinic
|
||||
// pairs for atoms j "below" i are excluded
|
||||
// below = lower z or (equal z and lower y) or (equal zy and lower x)
|
||||
// (equal zyx and j <= i)
|
||||
// latter excludes self-self interaction but allows superposed atoms
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp) {
|
||||
if (x[j][0] < xtmp) continue;
|
||||
if (x[j][0] == xtmp && j <= i) continue;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Half neighbor list, newton on, orthonormal
|
||||
// store every pair for every bin in stencil,except for i's bin
|
||||
|
||||
if (stencil[k] == 0) {
|
||||
// if j is owned atom, store it, since j is beyond i in linked list
|
||||
// if j is ghost, only store if j coords are "above and to the "right" of i
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
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 (!HALF) list->gnum = 0;
|
||||
}
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
template class NPairBinAtomonly<0,1,0>;
|
||||
template class NPairBinAtomonly<1,1,0>;
|
||||
}
|
||||
@ -13,23 +13,30 @@
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
typedef NPairBinAtomonly<0, 1, 0> NPairFullBinAtomonly;
|
||||
NPairStyle(full/bin/atomonly,
|
||||
NPairFullBinAtomonly,
|
||||
NP_FULL | NP_BIN | NP_ATOMONLY |
|
||||
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
|
||||
typedef NPairBinAtomonly<1, 1, 0> NPairHalfBinAtomonlyNewton;
|
||||
NPairStyle(half/bin/atomonly/newton,
|
||||
NPairHalfBinAtomonlyNewton,
|
||||
NP_HALF | NP_BIN | NP_ATOMONLY | NP_NEWTON | NP_ORTHO);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_FULL_BIN_ATOMONLY_H
|
||||
#define LMP_NPAIR_FULL_BIN_ATOMONLY_H
|
||||
#ifndef LMP_NPAIR_BIN_ATOMONLY_H
|
||||
#define LMP_NPAIR_BIN_ATOMONLY_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairFullBinAtomonly : public NPair {
|
||||
template<int HALF, int NEWTON, int TRI>
|
||||
class NPairBinAtomonly : public NPair {
|
||||
public:
|
||||
NPairFullBinAtomonly(class LAMMPS *);
|
||||
NPairBinAtomonly(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
@ -1,38 +0,0 @@
|
||||
// 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 "npair_copy.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairCopy::NPairCopy(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
create list which is simply a copy of parent list
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairCopy::build(NeighList *list)
|
||||
{
|
||||
NeighList *listcopy = list->listcopy;
|
||||
|
||||
list->inum = listcopy->inum;
|
||||
list->gnum = listcopy->gnum;
|
||||
list->ilist = listcopy->ilist;
|
||||
list->numneigh = listcopy->numneigh;
|
||||
list->firstneigh = listcopy->firstneigh;
|
||||
list->ipage = listcopy->ipage;
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(copy,
|
||||
NPairCopy,
|
||||
NP_COPY);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_COPY_H
|
||||
#define LMP_NPAIR_COPY_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairCopy : public NPair {
|
||||
public:
|
||||
NPairCopy(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
*/
|
||||
@ -1,94 +0,0 @@
|
||||
// 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 "npair_full_bin_atomonly.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairFullBinAtomonly::NPairFullBinAtomonly(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction for all neighbors
|
||||
every neighbor pair appears in list of both atoms i and j
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairFullBinAtomonly::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *molecule = atom->molecule;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
|
||||
// loop over all atoms in surrounding bins in stencil including self
|
||||
// skip i = j
|
||||
|
||||
ibin = atom2bin[i];
|
||||
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (i == j) continue;
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
list->gnum = 0;
|
||||
}
|
||||
@ -1,156 +0,0 @@
|
||||
// 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 "npair_full_bin_ghost.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairFullBinGhost::NPairFullBinGhost(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction for all neighbors
|
||||
include neighbors of ghost atoms, but no "special neighbors" for ghosts
|
||||
every neighbor pair appears in list of both atoms i and j
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairFullBinGhost::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int xbin,ybin,zbin,xbin2,ybin2,zbin2;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
// loop over owned & ghost atoms, storing neighbors
|
||||
|
||||
for (i = 0; i < nall; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in surrounding bins in stencil including self
|
||||
// when i is a ghost atom, must check if stencil bin is out of bounds
|
||||
// skip i = j
|
||||
// no molecular test when i = ghost atom
|
||||
|
||||
if (i < nlocal) {
|
||||
ibin = atom2bin[i];
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (i == j) continue;
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
ibin = coord2bin(x[i],xbin,ybin,zbin);
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
xbin2 = xbin + stencilxyz[k][0];
|
||||
ybin2 = ybin + stencilxyz[k][1];
|
||||
zbin2 = zbin + stencilxyz[k][2];
|
||||
if (xbin2 < 0 || xbin2 >= mbinx ||
|
||||
ybin2 < 0 || ybin2 >= mbiny ||
|
||||
zbin2 < 0 || zbin2 >= mbinz) continue;
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (i == j) continue;
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighghostsq[itype][jtype]) neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 = atom->nlocal;
|
||||
list->gnum = inum - atom->nlocal;
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(full/bin/ghost,
|
||||
NPairFullBinGhost,
|
||||
NP_FULL | NP_BIN | NP_GHOST | NP_NEWTON | NP_NEWTOFF |
|
||||
NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_FULL_BIN_GHOST_H
|
||||
#define LMP_NPAIR_FULL_BIN_GHOST_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairFullBinGhost : public NPair {
|
||||
public:
|
||||
NPairFullBinGhost(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,143 +0,0 @@
|
||||
// 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 "npair_full_multi.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairFullMulti::NPairFullMulti(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction for all neighbors
|
||||
multi stencil is icollection-jcollection dependent
|
||||
every neighbor pair appears in list of both atoms i and j
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairFullMulti::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,which,ns,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*s;
|
||||
int js;
|
||||
|
||||
int *collection = neighbor->collection;
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
itype = type[i];
|
||||
icollection = collection[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
ibin = atom2bin[i];
|
||||
|
||||
// loop through stencils for all collections
|
||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||
|
||||
// if same collection use own bin
|
||||
if(icollection == jcollection) jbin = ibin;
|
||||
else jbin = coord2bin(x[i], jcollection);
|
||||
|
||||
// loop over all atoms in surrounding bins in stencil including self
|
||||
// skip i = j
|
||||
// use full stencil for all collection combinations
|
||||
|
||||
s = stencil_multi[icollection][jcollection];
|
||||
ns = nstencil_multi[icollection][jcollection];
|
||||
|
||||
for (k = 0; k < ns; k++) {
|
||||
js = binhead_multi[jcollection][jbin + s[k]];
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
if (i == j) continue;
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
list->gnum = 0;
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(full/multi,
|
||||
NPairFullMulti,
|
||||
NP_FULL | NP_MULTI | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_FULL_MULTI_H
|
||||
#define LMP_NPAIR_FULL_MULTI_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairFullMulti : public NPair {
|
||||
public:
|
||||
NPairFullMulti(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,133 +0,0 @@
|
||||
// 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 "npair_full_multi_old.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairFullMultiOld::NPairFullMultiOld(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction for all neighbors
|
||||
multi-type stencil is itype dependent and is distance checked
|
||||
every neighbor pair appears in list of both atoms i and j
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairFullMultiOld::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*s;
|
||||
double *cutsq,*distsq;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in other bins in stencil, including self
|
||||
// skip if i,j neighbor cutoff is less than bin distance
|
||||
// skip i = j
|
||||
|
||||
ibin = atom2bin[i];
|
||||
s = stencil_multi_old[itype];
|
||||
distsq = distsq_multi_old[itype];
|
||||
cutsq = cutneighsq[itype];
|
||||
ns = nstencil_multi_old[itype];
|
||||
for (k = 0; k < ns; k++) {
|
||||
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
|
||||
jtype = type[j];
|
||||
if (cutsq[jtype] < distsq[k]) continue;
|
||||
if (i == j) continue;
|
||||
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
list->gnum = 0;
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(full/multi/old,
|
||||
NPairFullMultiOld,
|
||||
NP_FULL | NP_MULTI_OLD | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_FULL_MULTI_OLD_H
|
||||
#define LMP_NPAIR_FULL_MULTI_OLD_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairFullMultiOld : public NPair {
|
||||
public:
|
||||
NPairFullMultiOld(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,125 +0,0 @@
|
||||
// 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 "npair_full_nsq.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "group.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairFullNsq::NPairFullNsq(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
N^2 search for all neighbors
|
||||
every neighbor pair appears in list of both atoms i and j
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairFullNsq::build(NeighList *list)
|
||||
{
|
||||
int i,j,n,itype,jtype,which,bitmask,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
if (includegroup) {
|
||||
nlocal = atom->nfirst;
|
||||
bitmask = group->bitmask[includegroup];
|
||||
}
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms, owned and ghost
|
||||
// skip i = j
|
||||
|
||||
for (j = 0; j < nall; j++) {
|
||||
if (includegroup && !(mask[j] & bitmask)) continue;
|
||||
if (i == j) continue;
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
list->gnum = 0;
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(full/nsq,
|
||||
NPairFullNsq,
|
||||
NP_FULL | NP_NSQ | NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_FULL_NSQ_H
|
||||
#define LMP_NPAIR_FULL_NSQ_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairFullNsq : public NPair {
|
||||
public:
|
||||
NPairFullNsq(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,138 +0,0 @@
|
||||
// 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 "npair_full_nsq_ghost.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairFullNsqGhost::NPairFullNsqGhost(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
N^2 search for all neighbors
|
||||
include neighbors of ghost atoms, but no "special neighbors" for ghosts
|
||||
every neighbor pair appears in list of both atoms i and j
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairFullNsqGhost::build(NeighList *list)
|
||||
{
|
||||
int i,j,n,itype,jtype,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
// loop over owned & ghost atoms, storing neighbors
|
||||
|
||||
for (i = 0; i < nall; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms, owned and ghost
|
||||
// skip i = j
|
||||
// no molecular test when i = ghost atom
|
||||
|
||||
if (i < nlocal) {
|
||||
for (j = 0; j < nall; j++) {
|
||||
if (i == j) continue;
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (j = 0; j < nall; j++) {
|
||||
if (i == j) continue;
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighghostsq[itype][jtype]) neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
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 = atom->nlocal;
|
||||
list->gnum = inum - atom->nlocal;
|
||||
}
|
||||
@ -1,47 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(full/nsq/ghost,
|
||||
NPairFullNsqGhost,
|
||||
NP_FULL | NP_NSQ | NP_GHOST | NP_NEWTON | NP_NEWTOFF |
|
||||
NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_FULL_NSQ_GHOST_H
|
||||
#define LMP_NPAIR_FULL_NSQ_GHOST_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairFullNsqGhost : public NPair {
|
||||
public:
|
||||
NPairFullNsqGhost(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,116 +0,0 @@
|
||||
// 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 "npair_half_bin_atomonly_newton.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfBinAtomonlyNewton::NPairHalfBinAtomonlyNewton(LAMMPS *lmp) :
|
||||
NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with full Newton's 3rd law
|
||||
each owned atom i checks its own bin and other bins in Newton stencil
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfBinAtomonlyNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *molecule = atom->molecule;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
|
||||
// loop over rest of atoms in i's bin, ghosts are at end of linked list
|
||||
// if j is owned atom, store it, since j is beyond i in linked list
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
for (j = bins[i]; j >= 0; j = bins[j]) {
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) neighptr[n++] = j;
|
||||
}
|
||||
|
||||
// loop over all atoms in other bins in stencil, store every pair
|
||||
|
||||
ibin = atom2bin[i];
|
||||
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/bin/atomonly/newton,
|
||||
NPairHalfBinAtomonlyNewton,
|
||||
NP_HALF | NP_BIN | NP_ATOMONLY | NP_NEWTON | NP_ORTHO);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_BIN_ATOMONLY_NEWTON_H
|
||||
#define LMP_NPAIR_HALF_BIN_ATOMONLY_NEWTON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfBinAtomonlyNewton : public NPair {
|
||||
public:
|
||||
NPairHalfBinAtomonlyNewton(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,129 +0,0 @@
|
||||
// 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 "npair_half_bin_newtoff.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfBinNewtoff::NPairHalfBinNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with partial Newton's 3rd law
|
||||
each owned atom i checks own bin and other bins in stencil
|
||||
pair stored once if i,j are both owned and i < j
|
||||
pair stored by me if j is ghost (also stored by proc owning j)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfBinNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in other bins in stencil including self
|
||||
// only store pair if i < j
|
||||
// stores own/own pairs only once
|
||||
// stores own/ghost pairs on both procs
|
||||
|
||||
ibin = atom2bin[i];
|
||||
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (j <= i) continue;
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/bin/newtoff,
|
||||
NPairHalfBinNewtoff,
|
||||
NP_HALF | NP_BIN | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_BIN_NEWTOFF_H
|
||||
#define LMP_NPAIR_HALF_BIN_NEWTOFF_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfBinNewtoff : public NPair {
|
||||
public:
|
||||
NPairHalfBinNewtoff(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,162 +0,0 @@
|
||||
// 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 "npair_half_bin_newtoff_ghost.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfBinNewtoffGhost::NPairHalfBinNewtoffGhost(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with partial Newton's 3rd law
|
||||
include neighbors of ghost atoms, but no "special neighbors" for ghosts
|
||||
owned and ghost atoms check own bin and other bins in stencil
|
||||
pair stored once if i,j are both owned and i < j
|
||||
pair stored by me if i owned and j ghost (also stored by proc owning j)
|
||||
pair stored once if i,j are both ghost and i < j
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfBinNewtoffGhost::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int xbin,ybin,zbin,xbin2,ybin2,zbin2;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nall; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in other bins in stencil including self
|
||||
// when i is a ghost atom, must check if stencil bin is out of bounds
|
||||
// only store pair if i < j
|
||||
// stores own/own pairs only once
|
||||
// stores own/ghost pairs with owned atom only, on both procs
|
||||
// stores ghost/ghost pairs only once
|
||||
// no molecular test when i = ghost atom
|
||||
|
||||
if (i < nlocal) {
|
||||
ibin = atom2bin[i];
|
||||
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (j <= i) continue;
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
ibin = coord2bin(x[i],xbin,ybin,zbin);
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
xbin2 = xbin + stencilxyz[k][0];
|
||||
ybin2 = ybin + stencilxyz[k][1];
|
||||
zbin2 = zbin + stencilxyz[k][2];
|
||||
if (xbin2 < 0 || xbin2 >= mbinx ||
|
||||
ybin2 < 0 || ybin2 >= mbiny ||
|
||||
zbin2 < 0 || zbin2 >= mbinz) continue;
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (j <= i) continue;
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighghostsq[itype][jtype]) neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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 = atom->nlocal;
|
||||
list->gnum = inum - atom->nlocal;
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/bin/newtoff/ghost,
|
||||
NPairHalfBinNewtoffGhost,
|
||||
NP_HALF | NP_BIN | NP_NEWTOFF | NP_GHOST | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_BIN_NEWTOFF_GHOST_H
|
||||
#define LMP_NPAIR_HALF_BIN_NEWTOFF_GHOST_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfBinNewtoffGhost : public NPair {
|
||||
public:
|
||||
NPairHalfBinNewtoffGhost(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,161 +0,0 @@
|
||||
// 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 "npair_half_bin_newton.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfBinNewton::NPairHalfBinNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with full Newton's 3rd law
|
||||
each owned atom i checks its own bin and other bins in Newton stencil
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfBinNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over rest of atoms in i's bin, ghosts are at end of linked list
|
||||
// if j is owned atom, store it, since j is beyond i in linked list
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
for (j = bins[i]; j >= 0; j = bins[j]) {
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
// loop over all atoms in other bins in stencil, store every pair
|
||||
|
||||
ibin = atom2bin[i];
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
// OLD: if (which >= 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/bin/newton,
|
||||
NPairHalfBinNewton,
|
||||
NP_HALF | NP_BIN | NP_MOLONLY | NP_NEWTON | NP_ORTHO);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_BIN_NEWTON_H
|
||||
#define LMP_NPAIR_HALF_BIN_NEWTON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfBinNewton : public NPair {
|
||||
public:
|
||||
NPairHalfBinNewton(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,134 +0,0 @@
|
||||
// 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 "npair_half_bin_newton_tri.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfBinNewtonTri::NPairHalfBinNewtonTri(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with Newton's 3rd law for triclinic
|
||||
each owned atom i checks its own bin and other bins in triclinic stencil
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfBinNewtonTri::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in bins in stencil
|
||||
// pairs for atoms j "below" i are excluded
|
||||
// below = lower z or (equal z and lower y) or (equal zy and lower x)
|
||||
// (equal zyx and j <= i)
|
||||
// latter excludes self-self interaction but allows superposed atoms
|
||||
|
||||
ibin = atom2bin[i];
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp) {
|
||||
if (x[j][0] < xtmp) continue;
|
||||
if (x[j][0] == xtmp && j <= i) continue;
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/bin/newton/tri,
|
||||
NPairHalfBinNewtonTri,
|
||||
NP_HALF | NP_BIN | NP_NEWTON | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_BIN_NEWTON_TRI_H
|
||||
#define LMP_NPAIR_HALF_BIN_NEWTON_TRI_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfBinNewtonTri : public NPair {
|
||||
public:
|
||||
NPairHalfBinNewtonTri(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,146 +0,0 @@
|
||||
// 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 "npair_half_multi_newtoff.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfMultiNewtoff::NPairHalfMultiNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with partial Newton's 3rd law
|
||||
multi stencil is icollection-jcollection dependent
|
||||
each owned atom i checks own bin and other bins in stencil
|
||||
pair stored once if i,j are both owned and i < j
|
||||
pair stored by me if j is ghost (also stored by proc owning j)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfMultiNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,which,ns,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*s;
|
||||
int js;
|
||||
|
||||
int *collection = neighbor->collection;
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
itype = type[i];
|
||||
icollection = collection[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
ibin = atom2bin[i];
|
||||
|
||||
// loop through stencils for all collections
|
||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||
|
||||
// if same collection use own bin
|
||||
if (icollection == jcollection) jbin = ibin;
|
||||
else jbin = coord2bin(x[i], jcollection);
|
||||
|
||||
// loop over all atoms in other bins in stencil including self
|
||||
// only store pair if i < j
|
||||
// stores own/own pairs only once
|
||||
// stores own/ghost pairs on both procs
|
||||
// use full stencil for all collection combinations
|
||||
|
||||
s = stencil_multi[icollection][jcollection];
|
||||
ns = nstencil_multi[icollection][jcollection];
|
||||
|
||||
for (k = 0; k < ns; k++) {
|
||||
js = binhead_multi[jcollection][jbin + s[k]];
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
if (j <= i) continue;
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/multi/newtoff,
|
||||
NPairHalfMultiNewtoff,
|
||||
NP_HALF | NP_MULTI | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_MULTI_NEWTOFF_H
|
||||
#define LMP_NPAIR_HALF_MULTI_NEWTOFF_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfMultiNewtoff : public NPair {
|
||||
public:
|
||||
NPairHalfMultiNewtoff(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,194 +0,0 @@
|
||||
// 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 "npair_half_multi_newton.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfMultiNewton::NPairHalfMultiNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with full Newton's 3rd law
|
||||
multi stencil is icollection-jcollection dependent
|
||||
each owned atom i checks its own bin and other bins in Newton stencil
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfMultiNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,which,ns,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*s;
|
||||
int js;
|
||||
|
||||
int *collection = neighbor->collection;
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == 2) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
itype = type[i];
|
||||
icollection = collection[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
ibin = atom2bin[i];
|
||||
|
||||
// loop through stencils for all collections
|
||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||
|
||||
// if same collection use own bin
|
||||
if(icollection == jcollection) jbin = ibin;
|
||||
else jbin = coord2bin(x[i], jcollection);
|
||||
|
||||
// if same size: uses half stencil so check central bin
|
||||
if(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
||||
|
||||
if (icollection == jcollection) js = bins[i];
|
||||
else js = binhead_multi[jcollection][jbin];
|
||||
|
||||
// if same collection,
|
||||
// if j is owned atom, store it, since j is beyond i in linked list
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
// if different collections,
|
||||
// if j is owned atom, store it if j > i
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
if((icollection != jcollection) && (j < i)) continue;
|
||||
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for all collections, loop over all atoms in other bins in stencil, store every pair
|
||||
// stencil is empty if i larger than j
|
||||
// stencil is half if i same size as j
|
||||
// stencil is full if i smaller than j
|
||||
|
||||
s = stencil_multi[icollection][jcollection];
|
||||
ns = nstencil_multi[icollection][jcollection];
|
||||
|
||||
for (k = 0; k < ns; k++) {
|
||||
js = binhead_multi[jcollection][jbin + s[k]];
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,42 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/multi/newton,
|
||||
NPairHalfMultiNewton,
|
||||
NP_HALF | NP_MULTI | NP_NEWTON | NP_ORTHO);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_MULTI_NEWTON_H
|
||||
#define LMP_NPAIR_HALF_MULTI_NEWTON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfMultiNewton : public NPair {
|
||||
public:
|
||||
NPairHalfMultiNewton(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
*/
|
||||
@ -1,159 +0,0 @@
|
||||
// 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 "npair_half_multi_newton_tri.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfMultiNewtonTri::NPairHalfMultiNewtonTri(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with Newton's 3rd law for triclinic
|
||||
multi stencil is icollection-jcollection dependent
|
||||
each owned atom i checks its own bin and other bins in triclinic stencil
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfMultiNewtonTri::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,icollection,jcollection,ibin,jbin,which,ns,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*s;
|
||||
int js;
|
||||
|
||||
int *collection = neighbor->collection;
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == 2) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
itype = type[i];
|
||||
icollection = collection[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
ibin = atom2bin[i];
|
||||
|
||||
// loop through stencils for all collections
|
||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||
|
||||
// if same collection use own bin
|
||||
if (icollection == jcollection) jbin = ibin;
|
||||
else jbin = coord2bin(x[i], jcollection);
|
||||
|
||||
// loop over all atoms in bins in stencil
|
||||
// stencil is empty if i larger than j
|
||||
// stencil is half if i same size as j
|
||||
// stencil is full if i smaller than j
|
||||
// if half: pairs for atoms j "below" i are excluded
|
||||
// below = lower z or (equal z and lower y) or (equal zy and lower x)
|
||||
// (equal zyx and j <= i)
|
||||
// latter excludes self-self interaction but allows superposed atoms
|
||||
|
||||
s = stencil_multi[icollection][jcollection];
|
||||
ns = nstencil_multi[icollection][jcollection];
|
||||
|
||||
for (k = 0; k < ns; k++) {
|
||||
js = binhead_multi[jcollection][jbin + s[k]];
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
|
||||
// if same size (same collection), use half stencil
|
||||
if(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp) {
|
||||
if (x[j][0] < xtmp) continue;
|
||||
if (x[j][0] == xtmp && j <= i) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,42 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/multi/newton/tri,
|
||||
NPairHalfMultiNewtonTri,
|
||||
NP_HALF | NP_MULTI | NP_NEWTON | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_MULTI_NEWTON_TRI_H
|
||||
#define LMP_NPAIR_HALF_MULTI_NEWTON_TRI_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfMultiNewtonTri : public NPair {
|
||||
public:
|
||||
NPairHalfMultiNewtonTri(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
*/
|
||||
@ -1,136 +0,0 @@
|
||||
// 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 "npair_half_multi_old_newtoff.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfMultiOldNewtoff::NPairHalfMultiOldNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with partial Newton's 3rd law
|
||||
each owned atom i checks own bin and other bins in stencil
|
||||
multi-type stencil is itype dependent and is distance checked
|
||||
pair stored once if i,j are both owned and i < j
|
||||
pair stored by me if j is ghost (also stored by proc owning j)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfMultiOldNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*s;
|
||||
double *cutsq,*distsq;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in other bins in stencil including self
|
||||
// only store pair if i < j
|
||||
// skip if i,j neighbor cutoff is less than bin distance
|
||||
// stores own/own pairs only once
|
||||
// stores own/ghost pairs on both procs
|
||||
|
||||
ibin = atom2bin[i];
|
||||
s = stencil_multi_old[itype];
|
||||
distsq = distsq_multi_old[itype];
|
||||
cutsq = cutneighsq[itype];
|
||||
ns = nstencil_multi_old[itype];
|
||||
for (k = 0; k < ns; k++) {
|
||||
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
|
||||
if (j <= i) continue;
|
||||
jtype = type[j];
|
||||
if (cutsq[jtype] < distsq[k]) continue;
|
||||
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/multi/old/newtoff,
|
||||
NPairHalfMultiOldNewtoff,
|
||||
NP_HALF | NP_MULTI_OLD | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_MULTI_OLD_NEWTOFF_H
|
||||
#define LMP_NPAIR_HALF_MULTI_OLD_NEWTOFF_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfMultiOldNewtoff : public NPair {
|
||||
public:
|
||||
NPairHalfMultiOldNewtoff(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,169 +0,0 @@
|
||||
// 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 "npair_half_multi_old_newton.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfMultiOldNewton::NPairHalfMultiOldNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with full Newton's 3rd law
|
||||
each owned atom i checks its own bin and other bins in Newton stencil
|
||||
multi-type stencil is itype dependent and is distance checked
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfMultiOldNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*s;
|
||||
double *cutsq,*distsq;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over rest of atoms in i's bin, ghosts are at end of linked list
|
||||
// if j is owned atom, store it, since j is beyond i in linked list
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
for (j = bins[i]; j >= 0; j = bins[j]) {
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
// loop over all atoms in other bins in stencil, store every pair
|
||||
// skip if i,j neighbor cutoff is less than bin distance
|
||||
|
||||
ibin = atom2bin[i];
|
||||
s = stencil_multi_old[itype];
|
||||
distsq = distsq_multi_old[itype];
|
||||
cutsq = cutneighsq[itype];
|
||||
ns = nstencil_multi_old[itype];
|
||||
for (k = 0; k < ns; k++) {
|
||||
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
|
||||
jtype = type[j];
|
||||
if (cutsq[jtype] < distsq[k]) continue;
|
||||
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/multi/old/newton,
|
||||
NPairHalfMultiOldNewton,
|
||||
NP_HALF | NP_MULTI_OLD | NP_NEWTON | NP_ORTHO);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_MULTI_OLD_NEWTON_H
|
||||
#define LMP_NPAIR_HALF_MULTI_OLD_NEWTON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfMultiOldNewton : public NPair {
|
||||
public:
|
||||
NPairHalfMultiOldNewton(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,144 +0,0 @@
|
||||
// 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 "npair_half_multi_old_newton_tri.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfMultiOldNewtonTri::NPairHalfMultiOldNewtonTri(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with Newton's 3rd law for triclinic
|
||||
each owned atom i checks its own bin and other bins in triclinic stencil
|
||||
multi-type stencil is itype dependent and is distance checked
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfMultiOldNewtonTri::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,which,ns,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*s;
|
||||
double *cutsq,*distsq;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in bins, including self, in stencil
|
||||
// skip if i,j neighbor cutoff is less than bin distance
|
||||
// bins below self are excluded from stencil
|
||||
// pairs for atoms j "below" i are excluded
|
||||
// below = lower z or (equal z and lower y) or (equal zy and lower x)
|
||||
// (equal zyx and j <= i)
|
||||
// latter excludes self-self interaction but allows superposed atoms
|
||||
|
||||
ibin = atom2bin[i];
|
||||
s = stencil_multi_old[itype];
|
||||
distsq = distsq_multi_old[itype];
|
||||
cutsq = cutneighsq[itype];
|
||||
ns = nstencil_multi_old[itype];
|
||||
for (k = 0; k < ns; k++) {
|
||||
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
|
||||
jtype = type[j];
|
||||
if (cutsq[jtype] < distsq[k]) continue;
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp) {
|
||||
if (x[j][0] < xtmp) continue;
|
||||
if (x[j][0] == xtmp && j <= i) continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/multi/old/newton/tri,
|
||||
NPairHalfMultiOldNewtonTri,
|
||||
NP_HALF | NP_MULTI_OLD | NP_NEWTON | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_MULTI_OLD_NEWTON_TRI_H
|
||||
#define LMP_NPAIR_HALF_MULTI_OLD_NEWTON_TRI_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfMultiOldNewtonTri : public NPair {
|
||||
public:
|
||||
NPairHalfMultiOldNewtonTri(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,125 +0,0 @@
|
||||
// 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 "npair_half_nsq_newtoff.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "group.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfNsqNewtoff::NPairHalfNsqNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
N^2 / 2 search for neighbor pairs with partial Newton's 3rd law
|
||||
pair stored once if i,j are both owned and i < j
|
||||
pair stored by me if j is ghost (also stored by proc owning j)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfNsqNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,n,itype,jtype,which,bitmask,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
if (includegroup) {
|
||||
nlocal = atom->nfirst;
|
||||
bitmask = group->bitmask[includegroup];
|
||||
}
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over remaining atoms, owned and ghost
|
||||
// only store pair if i < j
|
||||
|
||||
for (j = i+1; j < nall; j++) {
|
||||
if (includegroup && !(mask[j] & bitmask)) continue;
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/nsq/newtoff,
|
||||
NPairHalfNsqNewtoff,
|
||||
NP_HALF | NP_NSQ | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_NSQ_NEWTOFF_H
|
||||
#define LMP_NPAIR_HALF_NSQ_NEWTOFF_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfNsqNewtoff : public NPair {
|
||||
public:
|
||||
NPairHalfNsqNewtoff(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,150 +0,0 @@
|
||||
// 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 "npair_half_nsq_newtoff_ghost.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "group.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfNsqNewtoffGhost::NPairHalfNsqNewtoffGhost(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
N^2 / 2 search for neighbor pairs with partial Newton's 3rd law
|
||||
include neighbors of ghost atoms, but no "special neighbors" for ghosts
|
||||
pair stored once if i,j are both owned and i < j
|
||||
pair stored by me if i owned and j ghost (also stored by proc owning j)
|
||||
pair stored once if i,j are both ghost and i < j
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfNsqNewtoffGhost::build(NeighList *list)
|
||||
{
|
||||
int i,j,n,itype,jtype,which,bitmask,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
if (includegroup) {
|
||||
nlocal = atom->nfirst;
|
||||
bitmask = group->bitmask[includegroup];
|
||||
}
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
// loop over owned & ghost atoms, storing neighbors
|
||||
|
||||
for (i = 0; i < nall; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over remaining atoms, owned and ghost
|
||||
// only store pair if i < j
|
||||
// stores own/own pairs only once
|
||||
// stores own/ghost pairs with owned atom only, on both procs
|
||||
// stores ghost/ghost pairs only once
|
||||
// no molecular test when i = ghost atom
|
||||
|
||||
if (i < nlocal) {
|
||||
for (j = i+1; j < nall; j++) {
|
||||
if (includegroup && !(mask[j] & bitmask)) continue;
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
for (j = i+1; j < nall; j++) {
|
||||
if (includegroup && !(mask[j] & bitmask)) continue;
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
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 = atom->nlocal;
|
||||
list->gnum = inum - atom->nlocal;
|
||||
}
|
||||
@ -1,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/nsq/newtoff/ghost,
|
||||
NPairHalfNsqNewtoffGhost,
|
||||
NP_HALF | NP_NSQ | NP_NEWTOFF | NP_GHOST | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_NSQ_NEWTOFF_GHOST_H
|
||||
#define LMP_NPAIR_HALF_NSQ_NEWTOFF_GHOST_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfNsqNewtoffGhost : public NPair {
|
||||
public:
|
||||
NPairHalfNsqNewtoffGhost(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,142 +0,0 @@
|
||||
// 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 "npair_half_nsq_newton.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "group.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfNsqNewton::NPairHalfNsqNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
N^2 / 2 search for neighbor pairs with full Newton's 3rd law
|
||||
every pair stored exactly once by some processor
|
||||
decision on ghost atoms based on itag,jtag tests
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfNsqNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,n,itype,jtype,which,bitmask,imol,iatom,moltemplate;
|
||||
tagint itag,jtag,tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
if (includegroup) {
|
||||
nlocal = atom->nfirst;
|
||||
bitmask = group->bitmask[includegroup];
|
||||
}
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itag = tag[i];
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over remaining atoms, owned and ghost
|
||||
// itag = jtag is possible for long cutoffs that include images of self
|
||||
|
||||
for (j = i+1; j < nall; j++) {
|
||||
if (includegroup && !(mask[j] & bitmask)) continue;
|
||||
|
||||
if (j >= nlocal) {
|
||||
jtag = tag[j];
|
||||
if (itag > jtag) {
|
||||
if ((itag+jtag) % 2 == 0) continue;
|
||||
} else if (itag < jtag) {
|
||||
if ((itag+jtag) % 2 == 1) continue;
|
||||
} else {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/nsq/newton,
|
||||
NPairHalfNsqNewton,
|
||||
NP_HALF | NP_NSQ | NP_NEWTON | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_NSQ_NEWTON_H
|
||||
#define LMP_NPAIR_HALF_NSQ_NEWTON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfNsqNewton : public NPair {
|
||||
public:
|
||||
NPairHalfNsqNewton(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,187 +0,0 @@
|
||||
// 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 "npair_half_respa_bin_newtoff.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfRespaBinNewtoff::NPairHalfRespaBinNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
multiple respa lists
|
||||
binned neighbor list construction with partial Newton's 3rd law
|
||||
each owned atom i checks own bin and surrounding bins in non-Newton stencil
|
||||
pair stored once if i,j are both owned and i < j
|
||||
pair stored by me if j is ghost (also stored by proc owning j)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfRespaBinNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,n_inner,n_middle,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*neighptr_inner,*neighptr_middle;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
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 *ilist_middle,*numneigh_middle,**firstneigh_middle;
|
||||
MyPage<int> *ipage_middle;
|
||||
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;
|
||||
}
|
||||
|
||||
int inum = 0;
|
||||
int which = 0;
|
||||
int minchange = 0;
|
||||
ipage->reset();
|
||||
ipage_inner->reset();
|
||||
if (respamiddle) ipage_middle->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = n_inner = 0;
|
||||
neighptr = ipage->vget();
|
||||
neighptr_inner = ipage_inner->vget();
|
||||
if (respamiddle) {
|
||||
n_middle = 0;
|
||||
neighptr_middle = ipage_middle->vget();
|
||||
}
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
ibin = atom2bin[i];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in surrounding bins in stencil including self
|
||||
// only store pair if i < j
|
||||
// stores own/own pairs only once
|
||||
// stores own/ghost pairs on both procs
|
||||
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (j <= i) continue;
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
|
||||
if (rsq < cut_inner_sq) {
|
||||
if (which == 0) neighptr_inner[n_inner++] = j;
|
||||
else if (minchange) neighptr_inner[n_inner++] = j;
|
||||
else if (which > 0)
|
||||
neighptr_inner[n_inner++] = j ^ (which << SBBITS);
|
||||
}
|
||||
|
||||
if (respamiddle &&
|
||||
rsq < cut_middle_sq && rsq > cut_middle_inside_sq) {
|
||||
if (which == 0) neighptr_middle[n_middle++] = j;
|
||||
else if (minchange) neighptr_middle[n_middle++] = j;
|
||||
else if (which > 0)
|
||||
neighptr_middle[n_middle++] = j ^ (which << SBBITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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_inner);
|
||||
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_middle);
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/respa/bin/newtoff,
|
||||
NPairHalfRespaBinNewtoff,
|
||||
NP_HALF | NP_RESPA | NP_BIN | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_RESPA_BIN_NEWTOFF_H
|
||||
#define LMP_NPAIR_HALF_RESPA_BIN_NEWTOFF_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfRespaBinNewtoff : public NPair {
|
||||
public:
|
||||
NPairHalfRespaBinNewtoff(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,233 +0,0 @@
|
||||
// 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 "npair_half_respa_bin_newton.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfRespaBinNewton::NPairHalfRespaBinNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
multiple respa lists
|
||||
binned neighbor list construction with full Newton's 3rd law
|
||||
each owned atom i checks its own bin and other bins in Newton stencil
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfRespaBinNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,n_inner,n_middle,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*neighptr_inner,*neighptr_middle;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
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 *ilist_middle,*numneigh_middle,**firstneigh_middle;
|
||||
MyPage<int> *ipage_middle;
|
||||
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;
|
||||
}
|
||||
|
||||
int inum = 0;
|
||||
int which = 0;
|
||||
int minchange = 0;
|
||||
ipage->reset();
|
||||
ipage_inner->reset();
|
||||
if (respamiddle) ipage_middle->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = n_inner = 0;
|
||||
neighptr = ipage->vget();
|
||||
neighptr_inner = ipage_inner->vget();
|
||||
if (respamiddle) {
|
||||
n_middle = 0;
|
||||
neighptr_middle = ipage_middle->vget();
|
||||
}
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over rest of atoms in i's bin, ghosts are at end of linked list
|
||||
// if j is owned atom, store it, since j is beyond i in linked list
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
for (j = bins[i]; j >= 0; j = bins[j]) {
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
|
||||
if (rsq < cut_inner_sq) {
|
||||
if (which == 0) neighptr_inner[n_inner++] = j;
|
||||
else if (minchange) neighptr_inner[n_inner++] = j;
|
||||
else if (which > 0) neighptr_inner[n_inner++] = j ^ (which << SBBITS);
|
||||
}
|
||||
|
||||
if (respamiddle &&
|
||||
rsq < cut_middle_sq && rsq > cut_middle_inside_sq) {
|
||||
if (which == 0) neighptr_middle[n_middle++] = j;
|
||||
else if (minchange) neighptr_middle[n_middle++] = j;
|
||||
else if (which > 0)
|
||||
neighptr_middle[n_middle++] = j ^ (which << SBBITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// loop over all atoms in other bins in stencil, store every pair
|
||||
|
||||
ibin = atom2bin[i];
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
|
||||
if (rsq < cut_inner_sq) {
|
||||
if (which == 0) neighptr_inner[n_inner++] = j;
|
||||
else if (minchange) neighptr_inner[n_inner++] = j;
|
||||
else if (which > 0)
|
||||
neighptr_inner[n_inner++] = j ^ (which << SBBITS);
|
||||
}
|
||||
|
||||
if (respamiddle &&
|
||||
rsq < cut_middle_sq && rsq > cut_middle_inside_sq) {
|
||||
if (which == 0) neighptr_middle[n_middle++] = j;
|
||||
else if (minchange) neighptr_middle[n_middle++] = j;
|
||||
else if (which > 0)
|
||||
neighptr_middle[n_middle++] = j ^ (which << SBBITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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_inner);
|
||||
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_middle);
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/respa/bin/newton,
|
||||
NPairHalfRespaBinNewton,
|
||||
NP_HALF | NP_RESPA | NP_BIN | NP_NEWTON | NP_ORTHO);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_RESPA_BIN_NEWTON_H
|
||||
#define LMP_NPAIR_HALF_RESPA_BIN_NEWTON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfRespaBinNewton : public NPair {
|
||||
public:
|
||||
NPairHalfRespaBinNewton(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,195 +0,0 @@
|
||||
// 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 "npair_half_respa_bin_newton_tri.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfRespaBinNewtonTri::NPairHalfRespaBinNewtonTri(LAMMPS *lmp) :
|
||||
NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
multiple respa lists
|
||||
binned neighbor list construction with Newton's 3rd law for triclinic
|
||||
each owned atom i checks its own bin and other bins in triclinic stencil
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfRespaBinNewtonTri::build(NeighList *list)
|
||||
{
|
||||
int i,j,k,n,itype,jtype,ibin,n_inner,n_middle,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*neighptr_inner,*neighptr_middle;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
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 *ilist_middle,*numneigh_middle,**firstneigh_middle;
|
||||
MyPage<int> *ipage_middle;
|
||||
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;
|
||||
}
|
||||
|
||||
int inum = 0;
|
||||
int which = 0;
|
||||
int minchange = 0;
|
||||
ipage->reset();
|
||||
ipage_inner->reset();
|
||||
if (respamiddle) ipage_middle->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = n_inner = 0;
|
||||
neighptr = ipage->vget();
|
||||
neighptr_inner = ipage_inner->vget();
|
||||
if (respamiddle) {
|
||||
n_middle = 0;
|
||||
neighptr_middle = ipage_middle->vget();
|
||||
}
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in bins in stencil
|
||||
// pairs for atoms j "below" i are excluded
|
||||
// below = lower z or (equal z and lower y) or (equal zy and lower x)
|
||||
// (equal zyx and j <= i)
|
||||
// latter excludes self-self interaction but allows superposed atoms
|
||||
|
||||
ibin = atom2bin[i];
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp) {
|
||||
if (x[j][0] < xtmp) continue;
|
||||
if (x[j][0] == xtmp && j <= i) continue;
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
|
||||
if (rsq < cut_inner_sq) {
|
||||
if (which == 0) neighptr_inner[n_inner++] = j;
|
||||
else if (minchange) neighptr_inner[n_inner++] = j;
|
||||
else if (which > 0)
|
||||
neighptr_inner[n_inner++] = j ^ (which << SBBITS);
|
||||
}
|
||||
|
||||
if (respamiddle &&
|
||||
rsq < cut_middle_sq && rsq > cut_middle_inside_sq) {
|
||||
if (which == 0) neighptr_middle[n_middle++] = j;
|
||||
else if (minchange) neighptr_middle[n_middle++] = j;
|
||||
else if (which > 0)
|
||||
neighptr_middle[n_middle++] = j ^ (which << SBBITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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_inner);
|
||||
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_middle);
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/respa/bin/newton/tri,
|
||||
NPairHalfRespaBinNewtonTri,
|
||||
NP_HALF | NP_RESPA | NP_BIN | NP_NEWTON | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_RESPA_BIN_NEWTON_TRI_H
|
||||
#define LMP_NPAIR_HALF_RESPA_BIN_NEWTON_TRI_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfRespaBinNewtonTri : public NPair {
|
||||
public:
|
||||
NPairHalfRespaBinNewtonTri(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,182 +0,0 @@
|
||||
// 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 "npair_half_respa_nsq_newtoff.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "group.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfRespaNsqNewtoff::NPairHalfRespaNsqNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
multiple respa lists
|
||||
N^2 / 2 search for neighbor pairs with partial Newton's 3rd law
|
||||
pair added to list if atoms i and j are both owned and i < j
|
||||
pair added if j is ghost (also stored by proc owning j)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfRespaNsqNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,n,itype,jtype,n_inner,n_middle,bitmask,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*neighptr_inner,*neighptr_middle;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
if (includegroup) {
|
||||
nlocal = atom->nfirst;
|
||||
bitmask = group->bitmask[includegroup];
|
||||
}
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
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 *ilist_middle,*numneigh_middle,**firstneigh_middle;
|
||||
MyPage<int> *ipage_middle;
|
||||
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;
|
||||
}
|
||||
|
||||
int inum = 0;
|
||||
int which = 0;
|
||||
int minchange = 0;
|
||||
ipage->reset();
|
||||
ipage_inner->reset();
|
||||
if (respamiddle) ipage_middle->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = n_inner = 0;
|
||||
neighptr = ipage->vget();
|
||||
neighptr_inner = ipage_inner->vget();
|
||||
if (respamiddle) {
|
||||
n_middle = 0;
|
||||
neighptr_middle = ipage_middle->vget();
|
||||
}
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over remaining atoms, owned and ghost
|
||||
|
||||
for (j = i+1; j < nall; j++) {
|
||||
if (includegroup && !(mask[j] & bitmask)) continue;
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
|
||||
if (rsq < cut_inner_sq) {
|
||||
if (which == 0) neighptr_inner[n_inner++] = j;
|
||||
else if (minchange) neighptr_inner[n_inner++] = j;
|
||||
else if (which > 0) neighptr_inner[n_inner++] = j ^ (which << SBBITS);
|
||||
}
|
||||
|
||||
if (respamiddle && rsq < cut_middle_sq && rsq > cut_middle_inside_sq) {
|
||||
if (which == 0) neighptr_middle[n_middle++] = j;
|
||||
else if (minchange) neighptr_middle[n_middle++] = j;
|
||||
else if (which > 0)
|
||||
neighptr_middle[n_middle++] = j ^ (which << SBBITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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_inner);
|
||||
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_middle);
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/respa/nsq/newtoff,
|
||||
NPairHalfRespaNsqNewtoff,
|
||||
NP_HALF | NP_RESPA | NP_NSQ | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_RESPA_NSQ_NEWTOFF_H
|
||||
#define LMP_NPAIR_HALF_RESPA_NSQ_NEWTOFF_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfRespaNsqNewtoff : public NPair {
|
||||
public:
|
||||
NPairHalfRespaNsqNewtoff(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,202 +0,0 @@
|
||||
// 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 "npair_half_respa_nsq_newton.h"
|
||||
#include "neigh_list.h"
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "group.h"
|
||||
#include "molecule.h"
|
||||
#include "domain.h"
|
||||
#include "my_page.h"
|
||||
#include "error.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfRespaNsqNewton::NPairHalfRespaNsqNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
multiple respa lists
|
||||
N^2 / 2 search for neighbor pairs with full Newton's 3rd law
|
||||
pair added to list if atoms i and j are both owned and i < j
|
||||
if j is ghost only me or other proc adds pair
|
||||
decision based on itag,jtag tests
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfRespaNsqNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,n,itype,jtype,itag,jtag,n_inner,n_middle,bitmask;
|
||||
int imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
int *neighptr,*neighptr_inner,*neighptr_middle;
|
||||
|
||||
double **x = atom->x;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
if (includegroup) {
|
||||
nlocal = atom->nfirst;
|
||||
bitmask = group->bitmask[includegroup];
|
||||
}
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
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 *ilist_middle,*numneigh_middle,**firstneigh_middle;
|
||||
MyPage<int> *ipage_middle;
|
||||
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;
|
||||
}
|
||||
|
||||
int inum = 0;
|
||||
int which = 0;
|
||||
int minchange = 0;
|
||||
ipage->reset();
|
||||
ipage_inner->reset();
|
||||
if (respamiddle) ipage_middle->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = n_inner = 0;
|
||||
neighptr = ipage->vget();
|
||||
neighptr_inner = ipage_inner->vget();
|
||||
if (respamiddle) {
|
||||
n_middle = 0;
|
||||
neighptr_middle = ipage_middle->vget();
|
||||
}
|
||||
|
||||
itag = tag[i];
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over remaining atoms, owned and ghost
|
||||
|
||||
for (j = i+1; j < nall; j++) {
|
||||
if (includegroup && !(mask[j] & bitmask)) continue;
|
||||
|
||||
if (j >= nlocal) {
|
||||
jtag = tag[j];
|
||||
if (itag > jtag) {
|
||||
if ((itag+jtag) % 2 == 0) continue;
|
||||
} else if (itag < jtag) {
|
||||
if ((itag+jtag) % 2 == 1) continue;
|
||||
} else {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) 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 <= cutneighsq[itype][jtype]) {
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if ((minchange = domain->minimum_image_check(delx,dely,delz)))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
|
||||
if (rsq < cut_inner_sq) {
|
||||
if (which == 0) neighptr_inner[n_inner++] = j;
|
||||
else if (minchange) neighptr_inner[n_inner++] = j;
|
||||
else if (which > 0) neighptr_inner[n_inner++] = j ^ (which << SBBITS);
|
||||
}
|
||||
|
||||
if (respamiddle &&
|
||||
rsq < cut_middle_sq && rsq > cut_middle_inside_sq) {
|
||||
if (which == 0) neighptr_middle[n_middle++] = j;
|
||||
else if (minchange) neighptr_middle[n_middle++] = j;
|
||||
else if (which > 0)
|
||||
neighptr_middle[n_middle++] = j ^ (which << SBBITS);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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_inner);
|
||||
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_middle);
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/respa/nsq/newton,
|
||||
NPairHalfRespaNsqNewton,
|
||||
NP_HALF | NP_RESPA | NP_NSQ | NP_NEWTON | NP_ORTHO);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_RESPA_NSQ_NEWTON_H
|
||||
#define LMP_NPAIR_HALF_RESPA_NSQ_NEWTON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfRespaNsqNewton : public NPair {
|
||||
public:
|
||||
NPairHalfRespaNsqNewton(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,138 +0,0 @@
|
||||
// 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 "npair_half_size_bin_newtoff.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfSizeBinNewtoff::NPairHalfSizeBinNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
size particles
|
||||
binned neighbor list construction with partial Newton's 3rd law
|
||||
each owned atom i checks own bin and surrounding bins in non-Newton stencil
|
||||
pair stored once if i,j are both owned and i < j
|
||||
pair stored by me if j is ghost (also stored by proc owning j)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfSizeBinNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,jh,k,n,ibin,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double radi,radsum,cutsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
double *radius = atom->radius;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int history = list->history;
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int mask_history = 1 << HISTBITS;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
ibin = atom2bin[i];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in surrounding bins in stencil including self
|
||||
// only store pair if i < j
|
||||
// stores own/own pairs only once
|
||||
// stores own/ghost pairs on both procs
|
||||
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (j <= i) continue;
|
||||
if (exclude && exclusion(i,j,type[i],type[j],mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/size/bin/newtoff,
|
||||
NPairHalfSizeBinNewtoff,
|
||||
NP_HALF | NP_SIZE | NP_BIN | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_SIZE_BIN_NEWTOFF_H
|
||||
#define LMP_NPAIR_HALF_SIZE_BIN_NEWTOFF_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfSizeBinNewtoff : public NPair {
|
||||
public:
|
||||
NPairHalfSizeBinNewtoff(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,176 +0,0 @@
|
||||
// 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 "npair_half_size_bin_newton.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfSizeBinNewton::NPairHalfSizeBinNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
size particles
|
||||
binned neighbor list construction with full Newton's 3rd law
|
||||
each owned atom i checks its own bin and other bins in Newton stencil
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfSizeBinNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,jh,k,n,ibin,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double radi,radsum,cutsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
double *radius = atom->radius;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int history = list->history;
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int mask_history = 1 << HISTBITS;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over rest of atoms in i's bin, ghosts are at end of linked list
|
||||
// if j is owned atom, store it, since j is beyond i in linked list
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
for (j = bins[i]; j >= 0; j = bins[j]) {
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (exclude && exclusion(i,j,type[i],type[j],mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
|
||||
// loop over all atoms in other bins in stencil, store every pair
|
||||
|
||||
ibin = atom2bin[i];
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (exclude && exclusion(i,j,type[i],type[j],mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/size/bin/newton,
|
||||
NPairHalfSizeBinNewton,
|
||||
NP_HALF | NP_SIZE | NP_BIN | NP_NEWTON | NP_ORTHO);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_SIZE_BIN_NEWTON_H
|
||||
#define LMP_NPAIR_HALF_SIZE_BIN_NEWTON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfSizeBinNewton : public NPair {
|
||||
public:
|
||||
NPairHalfSizeBinNewton(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,147 +0,0 @@
|
||||
// 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 "npair_half_size_bin_newton_tri.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfSizeBinNewtonTri::NPairHalfSizeBinNewtonTri(LAMMPS *lmp) :
|
||||
NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
size particles
|
||||
binned neighbor list construction with Newton's 3rd law for triclinic
|
||||
each owned atom i checks its own bin and other bins in triclinic stencil
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfSizeBinNewtonTri::build(NeighList *list)
|
||||
{
|
||||
int i,j,jh,k,n,ibin,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double radi,radsum,cutsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
double *radius = atom->radius;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int history = list->history;
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int mask_history = 1 << HISTBITS;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in bins in stencil
|
||||
// pairs for atoms j "below" i are excluded
|
||||
// below = lower z or (equal z and lower y) or (equal zy and lower x)
|
||||
// (equal zyx and j <= i)
|
||||
// latter excludes self-self interaction but allows superposed atoms
|
||||
|
||||
ibin = atom2bin[i];
|
||||
for (k = 0; k < nstencil; k++) {
|
||||
for (j = binhead[ibin+stencil[k]]; j >= 0; j = bins[j]) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp) {
|
||||
if (x[j][0] < xtmp) continue;
|
||||
if (x[j][0] == xtmp && j <= i) continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (exclude && exclusion(i,j,type[i],type[j],mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/size/bin/newton/tri,
|
||||
NPairHalfSizeBinNewtonTri,
|
||||
NP_HALF | NP_SIZE | NP_BIN | NP_NEWTON | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_SIZE_BIN_NEWTON_TRI_H
|
||||
#define LMP_NPAIR_HALF_SIZE_BIN_NEWTON_TRI_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfSizeBinNewtonTri : public NPair {
|
||||
public:
|
||||
NPairHalfSizeBinNewtonTri(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,160 +0,0 @@
|
||||
// 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
|
||||
es 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_half_size_multi_newtoff.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfSizeMultiNewtoff::NPairHalfSizeMultiNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
size particles
|
||||
binned neighbor list construction with partial Newton's 3rd law
|
||||
multi stencil is icollection-jcollection dependent
|
||||
each owned atom i checks own bin and other bins in stencil
|
||||
pair stored once if i,j are both owned and i < j
|
||||
pair stored by me if j is ghost (also stored by proc owning j)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfSizeMultiNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,jh,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns;
|
||||
int which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double radi,radsum,cutdistsq;
|
||||
int *neighptr,*s;
|
||||
int js;
|
||||
|
||||
int *collection = neighbor->collection;
|
||||
double **x = atom->x;
|
||||
double *radius = atom->radius;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int history = list->history;
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int mask_history = 1 << HISTBITS;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
itype = type[i];
|
||||
icollection = collection[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
ibin = atom2bin[i];
|
||||
|
||||
// loop through stencils for all collections
|
||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||
|
||||
// if same collection use own bin
|
||||
if (icollection == jcollection) jbin = ibin;
|
||||
else jbin = coord2bin(x[i], jcollection);
|
||||
|
||||
// loop over all atoms in other bins in stencil including self
|
||||
// only store pair if i < j
|
||||
// stores own/own pairs only once
|
||||
// stores own/ghost pairs on both procs
|
||||
// use full stencil for all collection combinations
|
||||
|
||||
s = stencil_multi[icollection][jcollection];
|
||||
ns = nstencil_multi[icollection][jcollection];
|
||||
|
||||
for (k = 0; k < ns; k++) {
|
||||
js = binhead_multi[jcollection][jbin + s[k]];
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
if (j <= i) continue;
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutdistsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/size/multi/newtoff,
|
||||
NPairHalfSizeMultiNewtoff,
|
||||
NP_HALF | NP_SIZE | NP_MULTI | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_SIZE_MULTI_NEWTOFF_H
|
||||
#define LMP_NPAIR_HALF_SIZE_MULTI_NEWTOFF_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfSizeMultiNewtoff : public NPair {
|
||||
public:
|
||||
NPairHalfSizeMultiNewtoff(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,213 +0,0 @@
|
||||
// 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 "npair_half_size_multi_newton.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfSizeMultiNewton::NPairHalfSizeMultiNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
size particles
|
||||
binned neighbor list construction with full Newton's 3rd law
|
||||
multi stencil is icollection-jcollection dependent
|
||||
each owned atom i checks its own bin and other bins in Newton stencil
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfSizeMultiNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,jh,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns,js;
|
||||
int which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double radi,radsum,cutdistsq;
|
||||
int *neighptr,*s;
|
||||
|
||||
int *collection = neighbor->collection;
|
||||
double **x = atom->x;
|
||||
double *radius = atom->radius;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int history = list->history;
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int mask_history = 1 << HISTBITS;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
itype = type[i];
|
||||
icollection = collection[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
ibin = atom2bin[i];
|
||||
|
||||
// loop through stencils for all collections
|
||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||
|
||||
// if same collection use own bin
|
||||
if (icollection == jcollection) jbin = ibin;
|
||||
else jbin = coord2bin(x[i], jcollection);
|
||||
|
||||
// if same size: uses half stencil so check central bin
|
||||
if (cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
||||
|
||||
if (icollection == jcollection) js = bins[i];
|
||||
else js = binhead_multi[jcollection][jbin];
|
||||
|
||||
// if same collection,
|
||||
// if j is owned atom, store it, since j is beyond i in linked list
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
// if different collections,
|
||||
// if j is owned atom, store it if j > i
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
if ((icollection != jcollection) && (j < i)) continue;
|
||||
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutdistsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// for all collections, loop over all atoms in other bins in stencil, store every pair
|
||||
// stencil is empty if i larger than j
|
||||
// stencil is half if i same size as j
|
||||
// stencil is full if i smaller than j
|
||||
|
||||
s = stencil_multi[icollection][jcollection];
|
||||
ns = nstencil_multi[icollection][jcollection];
|
||||
|
||||
for (k = 0; k < ns; k++) {
|
||||
js = binhead_multi[jcollection][jbin + s[k]];
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutdistsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/size/multi/newton,
|
||||
NPairHalfSizeMultiNewton,
|
||||
NP_HALF | NP_SIZE | NP_MULTI | NP_NEWTON | NP_ORTHO);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_SIZE_MULTI_NEWTON_H
|
||||
#define LMP_NPAIR_HALF_SIZE_MULTI_NEWTON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfSizeMultiNewton : public NPair {
|
||||
public:
|
||||
NPairHalfSizeMultiNewton(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,172 +0,0 @@
|
||||
// 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 "npair_half_size_multi_newton_tri.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neighbor.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfSizeMultiNewtonTri::NPairHalfSizeMultiNewtonTri(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
size particles
|
||||
binned neighbor list construction with Newton's 3rd law for triclinic
|
||||
multi stencil is icollection-jcollection dependent
|
||||
each owned atom i checks its own bin and other bins in triclinic stencil
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfSizeMultiNewtonTri::build(NeighList *list)
|
||||
{
|
||||
int i,j,jh,k,n,itype,jtype,icollection,jcollection,ibin,jbin,ns,js;
|
||||
int which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double radi,radsum,cutdistsq;
|
||||
int *neighptr,*s;
|
||||
|
||||
int *collection = neighbor->collection;
|
||||
double **x = atom->x;
|
||||
double *radius = atom->radius;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int history = list->history;
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int mask_history = 1 << HISTBITS;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
itype = type[i];
|
||||
icollection = collection[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
ibin = atom2bin[i];
|
||||
|
||||
// loop through stencils for all collections
|
||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||
|
||||
// if same collection use own bin
|
||||
if (icollection == jcollection) jbin = ibin;
|
||||
else jbin = coord2bin(x[i], jcollection);
|
||||
|
||||
// loop over all atoms in bins in stencil
|
||||
// stencil is empty if i larger than j
|
||||
// stencil is half if i same size as j
|
||||
// stencil is full if i smaller than j
|
||||
// if half: pairs for atoms j "below" i are excluded
|
||||
// below = lower z or (equal z and lower y) or (equal zy and lower x)
|
||||
// (equal zyx and j <= i)
|
||||
// latter excludes self-self interaction but allows superposed atoms
|
||||
|
||||
s = stencil_multi[icollection][jcollection];
|
||||
ns = nstencil_multi[icollection][jcollection];
|
||||
|
||||
for (k = 0; k < ns; k++) {
|
||||
js = binhead_multi[jcollection][jbin + s[k]];
|
||||
for (j = js; j >= 0; j = bins[j]) {
|
||||
|
||||
// if same size (same collection), use half stencil
|
||||
if (cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp) {
|
||||
if (x[j][0] < xtmp) continue;
|
||||
if (x[j][0] == xtmp && j <= i) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutdistsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/size/multi/newton/tri,
|
||||
NPairHalfSizeMultiNewtonTri,
|
||||
NP_HALF | NP_SIZE | NP_MULTI | NP_NEWTON | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_SIZE_MULTI_NEWTON_TRI_H
|
||||
#define LMP_NPAIR_HALF_SIZE_MULTI_NEWTON_TRI_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfSizeMultiNewtonTri : public NPair {
|
||||
public:
|
||||
NPairHalfSizeMultiNewtonTri(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,149 +0,0 @@
|
||||
// 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 "npair_half_size_multi_old_newtoff.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfSizeMultiOldNewtoff::NPairHalfSizeMultiOldNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
size particles
|
||||
binned neighbor list construction with partial Newton's 3rd law
|
||||
each owned atom i checks own bin and other bins in stencil
|
||||
multi-type stencil is itype dependent and is distance checked
|
||||
pair stored once if i,j are both owned and i < j
|
||||
pair stored by me if j is ghost (also stored by proc owning j)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfSizeMultiOldNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,jh,k,n,itype,jtype,ibin,ns,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double radi,radsum,cutdistsq;
|
||||
int *neighptr,*s;
|
||||
double *cutsq,*distsq;
|
||||
|
||||
double **x = atom->x;
|
||||
double *radius = atom->radius;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int history = list->history;
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int mask_history = 1 << HISTBITS;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in other bins in stencil including self
|
||||
// only store pair if i < j
|
||||
// skip if i,j neighbor cutoff is less than bin distance
|
||||
// stores own/own pairs only once
|
||||
// stores own/ghost pairs on both procs
|
||||
|
||||
ibin = atom2bin[i];
|
||||
s = stencil_multi_old[itype];
|
||||
distsq = distsq_multi_old[itype];
|
||||
cutsq = cutneighsq[itype];
|
||||
ns = nstencil_multi_old[itype];
|
||||
for (k = 0; k < ns; k++) {
|
||||
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
|
||||
if (j <= i) continue;
|
||||
jtype = type[j];
|
||||
if (cutsq[jtype] < distsq[k]) continue;
|
||||
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutdistsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,45 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/size/multi/old/newtoff,
|
||||
NPairHalfSizeMultiOldNewtoff,
|
||||
NP_HALF | NP_SIZE | NP_MULTI_OLD | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTOFF_H
|
||||
#define LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTOFF_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfSizeMultiOldNewtoff : public NPair {
|
||||
public:
|
||||
NPairHalfSizeMultiOldNewtoff(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
*/
|
||||
@ -1,187 +0,0 @@
|
||||
// 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 "npair_half_size_multi_old_newton.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfSizeMultiOldNewton::NPairHalfSizeMultiOldNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
size particles
|
||||
binned neighbor list construction with full Newton's 3rd law
|
||||
each owned atom i checks its own bin and other bins in Newton stencil
|
||||
multi-type stencil is itype dependent and is distance checked
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfSizeMultiOldNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,jh,k,n,itype,jtype,ibin,ns,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double radi,radsum,cutdistsq;
|
||||
int *neighptr,*s;
|
||||
double *cutsq,*distsq;
|
||||
|
||||
double **x = atom->x;
|
||||
double *radius = atom->radius;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int history = list->history;
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int mask_history = 1 << HISTBITS;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over rest of atoms in i's bin, ghosts are at end of linked list
|
||||
// if j is owned atom, store it, since j is beyond i in linked list
|
||||
// if j is ghost, only store if j coords are "above and to the right" of i
|
||||
|
||||
for (j = bins[i]; j >= 0; j = bins[j]) {
|
||||
if (j >= nlocal) {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
|
||||
jtype = type[j];
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutdistsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
|
||||
// loop over all atoms in other bins in stencil, store every pair
|
||||
// skip if i,j neighbor cutoff is less than bin distance
|
||||
|
||||
ibin = atom2bin[i];
|
||||
s = stencil_multi_old[itype];
|
||||
distsq = distsq_multi_old[itype];
|
||||
cutsq = cutneighsq[itype];
|
||||
ns = nstencil_multi_old[itype];
|
||||
for (k = 0; k < ns; k++) {
|
||||
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
|
||||
jtype = type[j];
|
||||
if (cutsq[jtype] < distsq[k]) continue;
|
||||
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutdistsq) {
|
||||
if (history && rsq < radsum*radsum)
|
||||
j = j ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = j;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = j;
|
||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||
} else neighptr[n++] = j;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,45 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/size/multi/old/newton,
|
||||
NPairHalfSizeMultiOldNewton,
|
||||
NP_HALF | NP_SIZE | NP_MULTI_OLD | NP_NEWTON | NP_ORTHO);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTON_H
|
||||
#define LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfSizeMultiOldNewton : public NPair {
|
||||
public:
|
||||
NPairHalfSizeMultiOldNewton(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
*/
|
||||
@ -1,156 +0,0 @@
|
||||
// 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 "npair_half_size_multi_old_newton_tri.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfSizeMultiOldNewtonTri::NPairHalfSizeMultiOldNewtonTri(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
binned neighbor list construction with Newton's 3rd law for triclinic
|
||||
each owned atom i checks its own bin and other bins in triclinic stencil
|
||||
multi-type stencil is itype dependent and is distance checked
|
||||
every pair stored exactly once by some processor
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfSizeMultiOldNewtonTri::build(NeighList *list)
|
||||
{
|
||||
int i,j,jh,k,n,itype,jtype,ibin,ns,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double radi,radsum,cutdistsq;
|
||||
int *neighptr,*s;
|
||||
double *cutsq,*distsq;
|
||||
|
||||
double **x = atom->x;
|
||||
double *radius = atom->radius;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
if (includegroup) nlocal = atom->nfirst;
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int history = list->history;
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int mask_history = 1 << HISTBITS;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itype = type[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over all atoms in bins, including self, in stencil
|
||||
// skip if i,j neighbor cutoff is less than bin distance
|
||||
// bins below self are excluded from stencil
|
||||
// pairs for atoms j "below" i are excluded
|
||||
// below = lower z or (equal z and lower y) or (equal zy and lower x)
|
||||
// (equal zyx and j <= i)
|
||||
// latter excludes self-self interaction but allows superposed atoms
|
||||
|
||||
ibin = atom2bin[i];
|
||||
s = stencil_multi_old[itype];
|
||||
distsq = distsq_multi_old[itype];
|
||||
cutsq = cutneighsq[itype];
|
||||
ns = nstencil_multi_old[itype];
|
||||
for (k = 0; k < ns; k++) {
|
||||
for (j = binhead[ibin+s[k]]; j >= 0; j = bins[j]) {
|
||||
jtype = type[j];
|
||||
if (cutsq[jtype] < distsq[k]) continue;
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp) {
|
||||
if (x[j][0] < xtmp) continue;
|
||||
if (x[j][0] == xtmp && j <= i) continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutdistsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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,45 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/size/multi/old/newton/tri,
|
||||
NPairHalfSizeMultiOldNewtonTri,
|
||||
NP_HALF | NP_SIZE | NP_MULTI_OLD | NP_NEWTON | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTON_TRI_H
|
||||
#define LMP_NPAIR_HALF_SIZE_MULTI_OLD_NEWTON_TRI_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfSizeMultiOldNewtonTri : public NPair {
|
||||
public:
|
||||
NPairHalfSizeMultiOldNewtonTri(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
*/
|
||||
@ -1,136 +0,0 @@
|
||||
// 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 "npair_half_size_nsq_newtoff.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "group.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfSizeNsqNewtoff::NPairHalfSizeNsqNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
size particles
|
||||
N^2 / 2 search for neighbor pairs with partial Newton's 3rd law
|
||||
pair added to list if atoms i and j are both owned and i < j
|
||||
pair added if j is ghost (also stored by proc owning j)
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfSizeNsqNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,jh,n,bitmask,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double radi,radsum,cutsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
double *radius = atom->radius;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *tag = atom->tag;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
if (includegroup) {
|
||||
nlocal = atom->nfirst;
|
||||
bitmask = group->bitmask[includegroup];
|
||||
}
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int history = list->history;
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int mask_history = 1 << HISTBITS;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over remaining atoms, owned and ghost
|
||||
|
||||
for (j = i+1; j < nall; j++) {
|
||||
if (includegroup && !(mask[j] & bitmask)) continue;
|
||||
if (exclude && exclusion(i,j,type[i],type[j],mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/size/nsq/newtoff,
|
||||
NPairHalfSizeNsqNewtoff,
|
||||
NP_HALF | NP_SIZE | NP_NSQ | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_SIZE_NSQ_NEWTOFF_H
|
||||
#define LMP_NPAIR_HALF_SIZE_NSQ_NEWTOFF_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfSizeNsqNewtoff : public NPair {
|
||||
public:
|
||||
NPairHalfSizeNsqNewtoff(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,154 +0,0 @@
|
||||
// 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 "npair_half_size_nsq_newton.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "atom_vec.h"
|
||||
#include "domain.h"
|
||||
#include "error.h"
|
||||
#include "molecule.h"
|
||||
#include "group.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalfSizeNsqNewton::NPairHalfSizeNsqNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
size particles
|
||||
N^2 / 2 search for neighbor pairs with full Newton's 3rd law
|
||||
pair added to list if atoms i and j are both owned and i < j
|
||||
if j is ghost only me or other proc adds pair
|
||||
decision based on itag,jtag tests
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalfSizeNsqNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,jh,n,itag,jtag,bitmask,which,imol,iatom,moltemplate;
|
||||
tagint tagprev;
|
||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||
double radi,radsum,cutsq;
|
||||
int *neighptr;
|
||||
|
||||
double **x = atom->x;
|
||||
double *radius = atom->radius;
|
||||
tagint *tag = atom->tag;
|
||||
int *type = atom->type;
|
||||
int *mask = atom->mask;
|
||||
tagint *molecule = atom->molecule;
|
||||
tagint **special = atom->special;
|
||||
int **nspecial = atom->nspecial;
|
||||
int nlocal = atom->nlocal;
|
||||
int nall = nlocal + atom->nghost;
|
||||
if (includegroup) {
|
||||
nlocal = atom->nfirst;
|
||||
bitmask = group->bitmask[includegroup];
|
||||
}
|
||||
|
||||
int *molindex = atom->molindex;
|
||||
int *molatom = atom->molatom;
|
||||
Molecule **onemols = atom->avec->onemols;
|
||||
if (molecular == Atom::TEMPLATE) moltemplate = 1;
|
||||
else moltemplate = 0;
|
||||
|
||||
int history = list->history;
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int mask_history = 1 << HISTBITS;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
for (i = 0; i < nlocal; i++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
itag = tag[i];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
radi = radius[i];
|
||||
if (moltemplate) {
|
||||
imol = molindex[i];
|
||||
iatom = molatom[i];
|
||||
tagprev = tag[i] - iatom - 1;
|
||||
}
|
||||
|
||||
// loop over remaining atoms, owned and ghost
|
||||
|
||||
for (j = i+1; j < nall; j++) {
|
||||
if (includegroup && !(mask[j] & bitmask)) continue;
|
||||
|
||||
if (j >= nlocal) {
|
||||
jtag = tag[j];
|
||||
if (itag > jtag) {
|
||||
if ((itag+jtag) % 2 == 0) continue;
|
||||
} else if (itag < jtag) {
|
||||
if ((itag+jtag) % 2 == 1) continue;
|
||||
} else {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (exclude && exclusion(i,j,type[i],type[j],mask,molecule)) continue;
|
||||
|
||||
delx = xtmp - x[j][0];
|
||||
dely = ytmp - x[j][1];
|
||||
delz = ztmp - x[j][2];
|
||||
rsq = delx*delx + dely*dely + delz*delz;
|
||||
radsum = radi + radius[j];
|
||||
cutsq = (radsum+skin) * (radsum+skin);
|
||||
|
||||
if (rsq <= cutsq) {
|
||||
jh = j;
|
||||
if (history && rsq < radsum*radsum)
|
||||
jh = jh ^ mask_history;
|
||||
|
||||
if (molecular != Atom::ATOMIC) {
|
||||
if (!moltemplate)
|
||||
which = find_special(special[i],nspecial[i],tag[j]);
|
||||
else if (imol >= 0)
|
||||
which = find_special(onemols[imol]->special[iatom],
|
||||
onemols[imol]->nspecial[iatom],
|
||||
tag[j]-tagprev);
|
||||
else which = 0;
|
||||
if (which == 0) neighptr[n++] = jh;
|
||||
else if (domain->minimum_image_check(delx,dely,delz))
|
||||
neighptr[n++] = jh;
|
||||
else if (which > 0) neighptr[n++] = jh ^ (which << SBBITS);
|
||||
} else neighptr[n++] = jh;
|
||||
}
|
||||
}
|
||||
|
||||
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,46 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(half/size/nsq/newton,
|
||||
NPairHalfSizeNsqNewton,
|
||||
NP_HALF | NP_SIZE | NP_NSQ | NP_NEWTON | NP_ORTHO | NP_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALF_SIZE_NSQ_NEWTON_H
|
||||
#define LMP_NPAIR_HALF_SIZE_NSQ_NEWTON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalfSizeNsqNewton : public NPair {
|
||||
public:
|
||||
NPairHalfSizeNsqNewton(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,83 +0,0 @@
|
||||
// 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 "npair_halffull_newtoff.h"
|
||||
|
||||
#include "error.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalffullNewtoff::NPairHalffullNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
build half list from full list
|
||||
pair stored once if i,j are both owned and i < j
|
||||
pair stored by me if j is ghost (also stored by proc owning j)
|
||||
works if full list is a skip list
|
||||
works for owned (non-ghost) list, also for ghost list
|
||||
if ghost, also store neighbors of ghost atoms & set inum,gnum correctly
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalffullNewtoff::build(NeighList *list)
|
||||
{
|
||||
int i,j,ii,jj,n,jnum,joriginal;
|
||||
int *neighptr,*jlist;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int *ilist_full = list->listfull->ilist;
|
||||
int *numneigh_full = list->listfull->numneigh;
|
||||
int **firstneigh_full = list->listfull->firstneigh;
|
||||
int inum_full = list->listfull->inum;
|
||||
if (list->ghost) inum_full += list->listfull->gnum;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
// loop over atoms in full list
|
||||
|
||||
for (ii = 0; ii < inum_full; ii++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
// loop over parent full list
|
||||
|
||||
i = ilist_full[ii];
|
||||
jlist = firstneigh_full[i];
|
||||
jnum = numneigh_full[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
joriginal = jlist[jj];
|
||||
j = joriginal & NEIGHMASK;
|
||||
if (j > i) 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) list->gnum = list->listfull->gnum;
|
||||
}
|
||||
@ -1,62 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(halffull/newtoff,
|
||||
NPairHalffullNewtoff,
|
||||
NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_HALF |
|
||||
NP_ORTHO | NP_TRI);
|
||||
|
||||
NPairStyle(halffull/newtoff/skip,
|
||||
NPairHalffullNewtoff,
|
||||
NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_HALF |
|
||||
NP_ORTHO | NP_TRI | NP_SKIP);
|
||||
|
||||
NPairStyle(halffull/newtoff/ghost,
|
||||
NPairHalffullNewtoff,
|
||||
NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_HALF |
|
||||
NP_ORTHO | NP_TRI | NP_GHOST);
|
||||
|
||||
NPairStyle(halffull/newtoff/skip/ghost,
|
||||
NPairHalffullNewtoff,
|
||||
NP_HALF_FULL | NP_NEWTOFF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD | NP_HALF |
|
||||
NP_ORTHO | NP_TRI | NP_SKIP | NP_GHOST);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALFFULL_NEWTOFF_H
|
||||
#define LMP_NPAIR_HALFFULL_NEWTOFF_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalffullNewtoff : public NPair {
|
||||
public:
|
||||
NPairHalffullNewtoff(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,97 +0,0 @@
|
||||
// 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 "npair_halffull_newton.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairHalffullNewton::NPairHalffullNewton(LAMMPS *lmp) : NPair(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
build half list from full list
|
||||
pair stored once if i,j are both owned and i < j
|
||||
if j is ghost, only store if j coords are "above and to the right" of i
|
||||
works if full list is a skip list
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NPairHalffullNewton::build(NeighList *list)
|
||||
{
|
||||
int i,j,ii,jj,n,jnum,joriginal;
|
||||
int *neighptr,*jlist;
|
||||
double xtmp,ytmp,ztmp;
|
||||
|
||||
double **x = atom->x;
|
||||
int nlocal = atom->nlocal;
|
||||
|
||||
int *ilist = list->ilist;
|
||||
int *numneigh = list->numneigh;
|
||||
int **firstneigh = list->firstneigh;
|
||||
MyPage<int> *ipage = list->ipage;
|
||||
|
||||
int *ilist_full = list->listfull->ilist;
|
||||
int *numneigh_full = list->listfull->numneigh;
|
||||
int **firstneigh_full = list->listfull->firstneigh;
|
||||
int inum_full = list->listfull->inum;
|
||||
|
||||
int inum = 0;
|
||||
ipage->reset();
|
||||
|
||||
// loop over parent full list
|
||||
|
||||
for (ii = 0; ii < inum_full; ii++) {
|
||||
n = 0;
|
||||
neighptr = ipage->vget();
|
||||
|
||||
i = ilist_full[ii];
|
||||
xtmp = x[i][0];
|
||||
ytmp = x[i][1];
|
||||
ztmp = x[i][2];
|
||||
|
||||
// loop over full neighbor list
|
||||
|
||||
jlist = firstneigh_full[i];
|
||||
jnum = numneigh_full[i];
|
||||
|
||||
for (jj = 0; jj < jnum; jj++) {
|
||||
joriginal = jlist[jj];
|
||||
j = joriginal & NEIGHMASK;
|
||||
if (j < nlocal) {
|
||||
if (i > j) continue;
|
||||
} else {
|
||||
if (x[j][2] < ztmp) continue;
|
||||
if (x[j][2] == ztmp) {
|
||||
if (x[j][1] < ytmp) continue;
|
||||
if (x[j][1] == ytmp && x[j][0] < xtmp) 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,52 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(halffull/newton,
|
||||
NPairHalffullNewton,
|
||||
NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
|
||||
NP_ORTHO | NP_TRI);
|
||||
|
||||
NPairStyle(halffull/newton/skip,
|
||||
NPairHalffullNewton,
|
||||
NP_HALF_FULL | NP_NEWTON | NP_HALF | NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
|
||||
NP_ORTHO | NP_TRI | NP_SKIP);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_HALFFULL_NEWTON_H
|
||||
#define LMP_NPAIR_HALFFULL_NEWTON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairHalffullNewton : public NPair {
|
||||
public:
|
||||
NPairHalffullNewton(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,102 +0,0 @@
|
||||
// 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 "npair_skip.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairSkip::NPairSkip(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 NPairSkip::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();
|
||||
|
||||
// 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;
|
||||
|
||||
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;
|
||||
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,54 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(skip,
|
||||
NPairSkip,
|
||||
NP_SKIP | NP_HALF | NP_FULL |
|
||||
NP_NSQ | NP_BIN | NP_MULTI | NP_MULTI_OLD |
|
||||
NP_NEWTON | NP_NEWTOFF | NP_ORTHO | NP_TRI);
|
||||
|
||||
NPairStyle(skip/ghost,
|
||||
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_GHOST);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_SKIP_H
|
||||
#define LMP_NPAIR_SKIP_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairSkip : public NPair {
|
||||
public:
|
||||
NPairSkip(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,163 +0,0 @@
|
||||
// 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 "npair_skip_respa.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairSkipRespa::NPairSkipRespa(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 NPairSkipRespa::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();
|
||||
|
||||
// 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 = 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;
|
||||
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;
|
||||
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;
|
||||
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,48 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(skip/half/respa,
|
||||
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);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_SKIP_RESPA_H
|
||||
#define LMP_NPAIR_SKIP_RESPA_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairSkipRespa : public NPair {
|
||||
public:
|
||||
NPairSkipRespa(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,88 +0,0 @@
|
||||
// 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 "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,47 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#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
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,100 +0,0 @@
|
||||
// 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 "npair_skip_size_off2on.h"
|
||||
|
||||
#include "atom.h"
|
||||
#include "error.h"
|
||||
#include "my_page.h"
|
||||
#include "neigh_list.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairSkipSizeOff2on::NPairSkipSizeOff2on(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 NPairSkipSizeOff2on::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();
|
||||
|
||||
// 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];
|
||||
|
||||
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;
|
||||
|
||||
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,48 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(skip/size/off2on,
|
||||
NPairSkipSizeOff2on,
|
||||
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);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_SKIP_SIZE_OFF2ON_H
|
||||
#define LMP_NPAIR_SKIP_SIZE_OFF2ON_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairSkipSizeOff2on : public NPair {
|
||||
public:
|
||||
NPairSkipSizeOff2on(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -1,163 +0,0 @@
|
||||
// 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 "npair_skip_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;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NPairSkipSizeOff2onOneside::NPairSkipSizeOff2onOneside(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 NPairSkipSizeOff2onOneside::build(NeighList *list)
|
||||
{
|
||||
int i,j,ii,jj,n,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();
|
||||
|
||||
// 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;
|
||||
|
||||
n = 0;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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;
|
||||
n = numneigh[i];
|
||||
firstneigh[i] = ipage->get(n);
|
||||
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;
|
||||
|
||||
// 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;
|
||||
|
||||
// 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,48 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NPAIR_CLASS
|
||||
// clang-format off
|
||||
NPairStyle(skip/size/off2on/oneside,
|
||||
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);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NPAIR_SKIP_SIZE_OFF2ON_ONESIDE_H
|
||||
#define LMP_NPAIR_SKIP_SIZE_OFF2ON_ONESIDE_H
|
||||
|
||||
#include "npair.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NPairSkipSizeOff2onOneside : public NPair {
|
||||
public:
|
||||
NPairSkipSizeOff2onOneside(class LAMMPS *);
|
||||
void build(class NeighList *) override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
E: Neighbor list overflow, boost neigh_modify one
|
||||
|
||||
UNDOCUMENTED
|
||||
|
||||
*/
|
||||
@ -12,28 +12,55 @@
|
||||
See the README file in the top-level LAMMPS directory.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#include "nstencil_half_bin_3d_tri.h"
|
||||
#include "nstencil_bin.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NStencilHalfBin3dTri::NStencilHalfBin3dTri(LAMMPS *lmp) :
|
||||
NStencil(lmp) {}
|
||||
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
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NStencilHalfBin3dTri::create()
|
||||
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 = 0; k <= sz; k++)
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
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>;
|
||||
}
|
||||
69
src/nstencil_bin.h
Normal file
69
src/nstencil_bin.h
Normal file
@ -0,0 +1,69 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NSTENCIL_CLASS
|
||||
// clang-format off
|
||||
typedef NStencilBin<0, 0, 0> NStencilFullBin2d;
|
||||
NStencilStyle(full/bin/2d,
|
||||
NStencilFullBin2d,
|
||||
NS_FULL | NS_BIN | NS_2D | NS_ORTHO | NS_TRI);
|
||||
|
||||
typedef NStencilBin<0, 1, 0> NStencilFullBin3d;
|
||||
NStencilStyle(full/bin/3d,
|
||||
NStencilFullBin3d,
|
||||
NS_FULL | NS_BIN | NS_3D | NS_ORTHO | NS_TRI);
|
||||
|
||||
typedef NStencilBin<1, 0, 0> NStencilHalfBin2d;
|
||||
NStencilStyle(half/bin/2d,
|
||||
NStencilHalfBin2d,
|
||||
NS_HALF | NS_BIN | NS_2D | NS_ORTHO);
|
||||
|
||||
typedef NStencilBin<1, 0, 1> NStencilHalfBin2dTri;
|
||||
NStencilStyle(half/bin/2d/tri,
|
||||
NStencilHalfBin2dTri,
|
||||
NS_HALF | NS_BIN | NS_2D | NS_TRI);
|
||||
|
||||
typedef NStencilBin<1, 1, 0> NStencilHalfBin3d;
|
||||
NStencilStyle(half/bin/3d,
|
||||
NStencilHalfBin3d,
|
||||
NS_HALF | NS_BIN | NS_3D | NS_ORTHO);
|
||||
|
||||
typedef NStencilBin<1, 1, 1> NStencilHalfBin3dTri;
|
||||
NStencilStyle(half/bin/3d/tri,
|
||||
NStencilHalfBin3dTri,
|
||||
NS_HALF | NS_BIN | NS_3D | NS_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NSTENCIL_BIN_H
|
||||
#define LMP_NSTENCIL_BIN_H
|
||||
|
||||
#include "nstencil.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
template<int HALF, int DIM_3D, int TRI>
|
||||
class NStencilBin : public NStencil {
|
||||
public:
|
||||
NStencilBin(class LAMMPS *);
|
||||
void create() override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
*/
|
||||
@ -1,37 +0,0 @@
|
||||
// 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_full_bin_2d.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NStencilFullBin2d::NStencilFullBin2d(LAMMPS *lmp) : NStencil(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
create stencil based on bin geometry and cutoff
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NStencilFullBin2d::create()
|
||||
{
|
||||
int i,j;
|
||||
|
||||
nstencil = 0;
|
||||
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance(i,j,0) < cutneighmaxsq)
|
||||
stencil[nstencil++] = j*mbinx + i;
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NSTENCIL_CLASS
|
||||
// clang-format off
|
||||
NStencilStyle(full/bin/2d,
|
||||
NStencilFullBin2d,
|
||||
NS_FULL | NS_BIN | NS_2D | NS_ORTHO | NS_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NSTENCIL_FULL_BIN_2D_H
|
||||
#define LMP_NSTENCIL_FULL_BIN_2D_H
|
||||
|
||||
#include "nstencil.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NStencilFullBin2d : public NStencil {
|
||||
public:
|
||||
NStencilFullBin2d(class LAMMPS *);
|
||||
void create() override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
*/
|
||||
@ -1,38 +0,0 @@
|
||||
// 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_full_bin_3d.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NStencilFullBin3d::NStencilFullBin3d(LAMMPS *lmp) : NStencil(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
create stencil based on bin geometry and cutoff
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NStencilFullBin3d::create()
|
||||
{
|
||||
int i,j,k;
|
||||
|
||||
nstencil = 0;
|
||||
|
||||
for (k = -sz; k <= sz; k++)
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance(i,j,k) < cutneighmaxsq)
|
||||
stencil[nstencil++] = k*mbiny*mbinx + j*mbinx + i;
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NSTENCIL_CLASS
|
||||
// clang-format off
|
||||
NStencilStyle(full/bin/3d,
|
||||
NStencilFullBin3d,
|
||||
NS_FULL | NS_BIN | NS_3D | NS_ORTHO | NS_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NSTENCIL_FULL_BIN_3D_H
|
||||
#define LMP_NSTENCIL_FULL_BIN_3D_H
|
||||
|
||||
#include "nstencil.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NStencilFullBin3d : public NStencil {
|
||||
public:
|
||||
NStencilFullBin3d(class LAMMPS *);
|
||||
void create() override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
*/
|
||||
@ -1,44 +0,0 @@
|
||||
// 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_full_ghost_bin_2d.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NStencilFullGhostBin2d::NStencilFullGhostBin2d(LAMMPS *lmp) : NStencil(lmp)
|
||||
{
|
||||
xyzflag = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
create stencil based on bin geometry and cutoff
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NStencilFullGhostBin2d::create()
|
||||
{
|
||||
int i,j;
|
||||
|
||||
nstencil = 0;
|
||||
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance(i,j,0) < cutneighmaxsq) {
|
||||
stencilxyz[nstencil][0] = i;
|
||||
stencilxyz[nstencil][1] = j;
|
||||
stencilxyz[nstencil][2] = 0;
|
||||
stencil[nstencil++] = j*mbinx + i;
|
||||
}
|
||||
}
|
||||
@ -1,42 +0,0 @@
|
||||
/* -*- c++ -*- ----------------------------------------------------------
|
||||
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.
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
#ifdef NSTENCIL_CLASS
|
||||
// clang-format off
|
||||
NStencilStyle(full/ghost/bin/2d,
|
||||
NStencilFullGhostBin2d,
|
||||
NS_FULL | NS_GHOST | NS_BIN | NS_2D | NS_ORTHO | NS_TRI);
|
||||
// clang-format on
|
||||
#else
|
||||
|
||||
#ifndef LMP_NSTENCIL_FULL_GHOST_BIN_2D_H
|
||||
#define LMP_NSTENCIL_FULL_GHOST_BIN_2D_H
|
||||
|
||||
#include "nstencil.h"
|
||||
|
||||
namespace LAMMPS_NS {
|
||||
|
||||
class NStencilFullGhostBin2d : public NStencil {
|
||||
public:
|
||||
NStencilFullGhostBin2d(class LAMMPS *);
|
||||
void create() override;
|
||||
};
|
||||
|
||||
} // namespace LAMMPS_NS
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/* ERROR/WARNING messages:
|
||||
|
||||
*/
|
||||
@ -1,45 +0,0 @@
|
||||
// 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_full_ghost_bin_3d.h"
|
||||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NStencilFullGhostBin3d::NStencilFullGhostBin3d(LAMMPS *lmp) : NStencil(lmp)
|
||||
{
|
||||
xyzflag = 1;
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
create stencil based on bin geometry and cutoff
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NStencilFullGhostBin3d::create()
|
||||
{
|
||||
int i,j,k;
|
||||
|
||||
nstencil = 0;
|
||||
|
||||
for (k = -sz; k <= sz; k++)
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance(i,j,k) < cutneighmaxsq) {
|
||||
stencilxyz[nstencil][0] = i;
|
||||
stencilxyz[nstencil][1] = j;
|
||||
stencilxyz[nstencil][2] = k;
|
||||
stencil[nstencil++] = k*mbiny*mbinx + j*mbinx + i;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user