whitespace fixes

This commit is contained in:
Axel Kohlmeyer
2021-05-12 06:30:52 -04:00
parent 24075b3281
commit 9ef0395313
43 changed files with 505 additions and 507 deletions

View File

@ -67,7 +67,7 @@ cutoff across all atom type pairs.
For many systems this is an efficient algorithm, but for systems with
widely varying cutoffs for different type pairs, the *multi* or *multi/old* mode can
be faster. In *multi*, each atom is assigned to a collection which should
be faster. In *multi*, each atom is assigned to a collection which should
correspond to a set of atoms with similar interaction cutoffs.
In this case, each atom collection is assigned its own distance
cutoff for communication purposes, and fewer atoms will be
@ -100,22 +100,22 @@ The *cutoff/multi* option is equivalent to *cutoff*\ , but applies to
communication mode *multi* instead. Since the communication
cutoffs are determined per atom collections, a collection specifier is needed and
cutoff for one or multiple collections can be extended. Also ranges of collections
using the usual asterisk notation can be given.
using the usual asterisk notation can be given.
Collections are indexed from 1 to N where N is the total number of collections.
Note that the arguments for *cutoff/multi* are parsed right before each
simulation to account for potential changes in the number of collections.
Custom cutoffs are preserved between runs but if collections are redefined,
Custom cutoffs are preserved between runs but if collections are redefined,
one may want to respecify communication cutoffs.
For granular pair styles,the default cutoff is set to the sum of the
current maximum atomic radii for each collection.
For granular pair styles,the default cutoff is set to the sum of the
current maximum atomic radii for each collection.
The *cutoff/multi/old* option is similar to *cutoff/multi* except it
operates on atom types as opposed to collections.
The *reduce/multi* option applies to *multi* and sets the communication
cutoff for a particle equal to the maximum interaction distance between particles
The *reduce/multi* option applies to *multi* and sets the communication
cutoff for a particle equal to the maximum interaction distance between particles
in the same collection. This reduces the number of
ghost atoms that need to be communicated. This method is only compatible with the
*multi* neighbor style and requires a half neighbor list and Newton on.
ghost atoms that need to be communicated. This method is only compatible with the
*multi* neighbor style and requires a half neighbor list and Newton on.
See the :doc:`neighbor multi <neighbor>` command for more information.
These are simulation scenarios in which it may be useful or even

View File

@ -196,8 +196,8 @@ atom can have.
The *binsize* option allows you to specify what size of bins will be
used in neighbor list construction to sort and find neighboring atoms.
By default, for :doc:`neighbor style bin <neighbor>`, LAMMPS uses bins
that are 1/2 the size of the maximum pair cutoff. For :doc:`neighbor style multi <neighbor>`,
the bins are 1/2 the size of the collection interaction cutoff.
that are 1/2 the size of the maximum pair cutoff. For :doc:`neighbor style multi <neighbor>`,
the bins are 1/2 the size of the collection interaction cutoff.
Typically these are good values for minimizing the time for
neighbor list construction. This setting overrides the default.
If you make it too big, there is little overhead due to
@ -206,23 +206,23 @@ small, the optimal number of atoms is checked, but bin overhead goes
up. If you set the binsize to 0.0, LAMMPS will use the default
binsize of 1/2 the cutoff.
The *collection/type* option allows you to define collections of atom
types, used by the *multi* neighbor mode. By grouping atom types with
similar physical size or interaction cutoff lengths, one may be able
The *collection/type* option allows you to define collections of atom
types, used by the *multi* neighbor mode. By grouping atom types with
similar physical size or interaction cutoff lengths, one may be able
to improve performance by reducing
overhead. You must first specify the number of collections N to be
defined followed by N lists of types. Each list consists of a series of type
ranges separated by commas. The range can be specified as a
ranges separated by commas. The range can be specified as a
single numeric value, or a wildcard asterisk can be used to specify a range
of values. This takes the form "\*" or "\*n" or "n\*" or "m\*n". For
example, if M = the number of atom types, then an asterisk with no numeric
values means all types from 1 to M. A leading asterisk means all types
from 1 to n (inclusive). A trailing asterisk means all types from n to M
(inclusive). A middle asterisk means all types from m to n (inclusive).
example, if M = the number of atom types, then an asterisk with no numeric
values means all types from 1 to M. A leading asterisk means all types
from 1 to n (inclusive). A trailing asterisk means all types from n to M
(inclusive). A middle asterisk means all types from m to n (inclusive).
Note that all atom types must be included in exactly one of the N collections.
The *collection/interval* option provides a similar capability.
This command allows a user to define collections by specifying a
The *collection/interval* option provides a similar capability.
This command allows a user to define collections by specifying a
series of cutoff intervals. LAMMPS will automatically sort atoms into these intervals
based on their type-dependent cutoffs or their finite size.
You must first specify the number of collections N to be

View File

@ -56,28 +56,28 @@ the largest cutoff distance between any pair of atom types and a
single set of bins is defined to search over for all atom types. This
can be inefficient if one pair of types has a very long cutoff, but
other type pairs have a much shorter cutoff. The *multi* style uses
different sized bins for collections of different sized particles, where
"size" may mean the physical size of the particle or its cutoff
different sized bins for collections of different sized particles, where
"size" may mean the physical size of the particle or its cutoff
distance for interacting with other particles. Different
sets of bins are then used to construct the neighbor lists as as further
described by Shire, Hanley, and Stratford :ref:`(Shire) <bytype-Shire>`.
sets of bins are then used to construct the neighbor lists as as further
described by Shire, Hanley, and Stratford :ref:`(Shire) <bytype-Shire>`.
This imposes some extra setup overhead, but the searches themselves
may be much faster. By default, each atom type defines a separate
collection of particles. For systems where two or more atom types
have the same size (either physical size or cutoff distance), the
definition of collections can be customized, which can result in less
overhead and faster performance. See the :doc:`neigh_modify <neigh_modify>`
command for how to define custom collections. Whether the collection
definition is customized or not, also see the
:doc:`comm_modify mode multi <comm_modify>` command for communication
options that further improve performance in a manner consistent with
neighbor style multi.
may be much faster. By default, each atom type defines a separate
collection of particles. For systems where two or more atom types
have the same size (either physical size or cutoff distance), the
definition of collections can be customized, which can result in less
overhead and faster performance. See the :doc:`neigh_modify <neigh_modify>`
command for how to define custom collections. Whether the collection
definition is customized or not, also see the
:doc:`comm_modify mode multi <comm_modify>` command for communication
options that further improve performance in a manner consistent with
neighbor style multi.
An alternate style, *multi/old*, sets the bin size to 1/2 of the shortest
cutoff distance and multiple sets of bins are defined to search over for
different atom types. This algorithm used to be the default *multi*
An alternate style, *multi/old*, sets the bin size to 1/2 of the shortest
cutoff distance and multiple sets of bins are defined to search over for
different atom types. This algorithm used to be the default *multi*
algorithm in LAMMPS but was found to be significantly slower than the new
approach. For now we are keeping the old option in case there are use cases
approach. For now we are keeping the old option in case there are use cases
where multi/old outperforms the new multi style.

View File

@ -1846,7 +1846,7 @@ void PairGranular::transfer_history(double* source, double* target)
double PairGranular::atom2cut(int i)
{
double cut;
cut = atom->radius[i]*2;
if(beyond_contact) {
int itype = atom->type[i];
@ -1854,7 +1854,7 @@ double PairGranular::atom2cut(int i)
cut += pulloff_distance(cut, cut, itype, itype);
}
}
return cut;
}
@ -1865,11 +1865,11 @@ double PairGranular::atom2cut(int i)
double PairGranular::radii2cut(double r1, double r2)
{
double cut = 0.0;
if(beyond_contact) {
int n = atom->ntypes;
double temp;
// Check all combinations of i and j to find theoretical maximum pull off distance
for(int i = 0; i < n; i++){
for(int j = 0; j < n; j++){
@ -1877,11 +1877,11 @@ double PairGranular::radii2cut(double r1, double r2)
temp = pulloff_distance(r1, r2, i, j);
if(temp > cut) cut = temp;
}
}
}
}
}
}
cut += r1 + r2;
return cut;
}

View File

@ -31,7 +31,7 @@ NPairFullMultiOmp::NPairFullMultiOmp(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction for all neighbors
multi stencil is icollection-jcollection dependent
multi stencil is icollection-jcollection dependent
every neighbor pair appears in list of both atoms i and j
------------------------------------------------------------------------- */
@ -51,7 +51,7 @@ void NPairFullMultiOmp::build(NeighList *list)
tagint tagprev;
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
int *neighptr,*s;
int js;
int js;
// loop over each atom, storing neighbors
@ -82,7 +82,7 @@ void NPairFullMultiOmp::build(NeighList *list)
neighptr = ipage.vget();
itype = type[i];
icollection = collection[i];
icollection = collection[i];
xtmp = x[i][0];
ytmp = x[i][1];
ztmp = x[i][2];
@ -93,7 +93,7 @@ void NPairFullMultiOmp::build(NeighList *list)
}
ibin = atom2bin[i];
// loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
@ -107,12 +107,12 @@ void NPairFullMultiOmp::build(NeighList *list)
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;
@ -120,7 +120,7 @@ void NPairFullMultiOmp::build(NeighList *list)
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)

View File

@ -31,7 +31,7 @@ NPairHalfMultiNewtoffOmp::NPairHalfMultiNewtoffOmp(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction with partial Newton's 3rd law
multi stencil is icollection-jcollection dependent
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)
@ -95,36 +95,36 @@ void NPairHalfMultiNewtoffOmp::build(NeighList *list)
}
ibin = atom2bin[i];
// loop through stencils for all collections
// 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
// 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)

View File

@ -94,31 +94,31 @@ void NPairHalfMultiNewtonOmp::build(NeighList *list)
}
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 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 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
// 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 ((icollection != jcollection) && (j < i)) continue;
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
@ -126,15 +126,15 @@ void NPairHalfMultiNewtonOmp::build(NeighList *list)
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)
@ -150,29 +150,29 @@ void NPairHalfMultiNewtonOmp::build(NeighList *list)
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
// 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)

View File

@ -32,7 +32,7 @@ NPairHalfMultiNewtonTriOmp::NPairHalfMultiNewtonTriOmp(LAMMPS *lmp) :
/* ----------------------------------------------------------------------
binned neighbor list construction with Newton's 3rd law for triclinic
multi stencil is icollection-jcollection dependent
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
------------------------------------------------------------------------- */
@ -95,14 +95,14 @@ void NPairHalfMultiNewtonTriOmp::build(NeighList *list)
}
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
@ -114,12 +114,12 @@ void NPairHalfMultiNewtonTriOmp::build(NeighList *list)
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 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) {
@ -128,17 +128,17 @@ void NPairHalfMultiNewtonTriOmp::build(NeighList *list)
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)

View File

@ -31,7 +31,7 @@ NPairHalfSizeMultiNewtoffOmp::NPairHalfSizeMultiNewtoffOmp(LAMMPS *lmp) : NPair(
/* ----------------------------------------------------------------------
size particles
binned neighbor list construction with partial Newton's 3rd law
multi stencil is icollection-jcollection dependent
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)
@ -59,7 +59,7 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list)
int *collection = neighbor->collection;
double **x = atom->x;
double *radius = atom->radius;
double *radius = atom->radius;
int *type = atom->type;
int *mask = atom->mask;
tagint *molecule = atom->molecule;
@ -85,31 +85,31 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list)
radi = radius[i];
ibin = atom2bin[i];
// loop through stencils for all collections
// 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
// 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];
@ -118,7 +118,7 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list)
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;

View File

@ -58,7 +58,7 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list)
int *collection = neighbor->collection;
double **x = atom->x;
double *radius = atom->radius;
double *radius = atom->radius;
int *type = atom->type;
int *mask = atom->mask;
tagint *molecule = atom->molecule;
@ -84,10 +84,10 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list)
radi = radius[i];
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);
@ -97,18 +97,18 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list)
if(icollection == jcollection) js = bins[i];
else js = binhead_multi[jcollection][jbin];
// if same collection,
// 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 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
// 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 and j < i) continue;
if(icollection != jcollection and j < i) continue;
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
@ -116,38 +116,38 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list)
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) {
if (history && rsq < radsum*radsum)
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
else
neighptr[n++] = j;
}
}
}
}
// for all collections, loop over all atoms in other bins in stencil, store every pair
// 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;
@ -157,9 +157,9 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list)
rsq = delx*delx + dely*dely + delz*delz;
radsum = radi + radius[j];
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;

View File

@ -32,14 +32,14 @@ NPairHalfSizeMultiNewtonTriOmp::NPairHalfSizeMultiNewtonTriOmp(LAMMPS *lmp) :
/* ----------------------------------------------------------------------
size particles
binned neighbor list construction with Newton's 3rd law for triclinic
multi stencil is icollection-jcollection dependent
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 NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list)
{
const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
const int nlocal = (includegroup) ? atom->nfirst : atom->nlocal;
const int history = list->history;
const int mask_history = 3 << SBBITS;
@ -59,7 +59,7 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list)
int *collection = neighbor->collection;
double **x = atom->x;
double *radius = atom->radius;
double *radius = atom->radius;
int *type = atom->type;
int *mask = atom->mask;
tagint *molecule = atom->molecule;
@ -105,12 +105,12 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list)
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 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) {
@ -119,21 +119,21 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list)
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) {
if (history && rsq < radsum*radsum)
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;

View File

@ -361,7 +361,7 @@ void Comm::modify_params(int narg, char **arg)
memory->create(cutusermulti,ncollections_cutoff,"comm:cutusermulti");
for (i=0; i < ncollections_cutoff; ++i)
cutusermulti[i] = -1.0;
}
}
utils::bounds(FLERR,arg[iarg+1],1,ncollections_cutoff+1,nlo,nhi,error);
cut = utils::numeric(FLERR,arg[iarg+2],false,lmp);
cutghostuser = MAX(cutghostuser,cut);
@ -752,7 +752,7 @@ double Comm::get_comm_cutoff()
if (neighbor->interval_collection_flag) {
for (int i = 0; i < neighbor->ncollections; i++){
maxcommcutoff = MAX(maxcommcutoff, neighbor->collection2cut[i]);
}
}
}
return maxcommcutoff;

View File

@ -43,13 +43,11 @@ using namespace LAMMPS_NS;
CommBrick::CommBrick(LAMMPS *lmp) :
Comm(lmp),
sendnum(nullptr), recvnum(nullptr), sendproc(nullptr), recvproc(nullptr),
size_forward_recv(nullptr),
size_reverse_send(nullptr), size_reverse_recv(nullptr),
size_forward_recv(nullptr), size_reverse_send(nullptr), size_reverse_recv(nullptr),
slablo(nullptr), slabhi(nullptr), multilo(nullptr), multihi(nullptr),
cutghostmulti(nullptr), pbc_flag(nullptr), pbc(nullptr), firstrecv(nullptr),
multioldlo(nullptr), multioldhi(nullptr), cutghostmultiold(nullptr),
sendlist(nullptr), localsendlist(nullptr), maxsendlist(nullptr),
buf_send(nullptr), buf_recv(nullptr)
multioldlo(nullptr), multioldhi(nullptr), cutghostmulti(nullptr), cutghostmultiold(nullptr),
pbc_flag(nullptr), pbc(nullptr), firstrecv(nullptr), sendlist(nullptr),
localsendlist(nullptr), maxsendlist(nullptr), buf_send(nullptr), buf_recv(nullptr)
{
style = 0;
layout = Comm::LAYOUT_UNIFORM;
@ -141,44 +139,44 @@ void CommBrick::init()
// memory for multi style communication
// allocate in setup
if (mode == Comm::MULTI) {
if (mode == Comm::MULTI) {
// If inconsitent # of collections, destroy any preexisting arrays (may be missized)
if (ncollections != neighbor->ncollections) {
ncollections = neighbor->ncollections;
if (multilo != nullptr) {
free_multi();
memory->destroy(cutghostmulti);
}
}
}
// delete any old user cutoffs if # of collections chanaged
if (cutusermulti && ncollections != ncollections_cutoff) {
if(me == 0) error->warning(FLERR, "cutoff/multi settings discarded, must be defined"
" after customizing collections in neigh_modify");
memory->destroy(cutusermulti);
cutusermulti = nullptr;
}
}
if (multilo == nullptr) {
allocate_multi(maxswap);
memory->create(cutghostmulti,ncollections,3,"comm:cutghostmulti");
memory->create(cutghostmulti,ncollections,3,"comm:cutghostmulti");
}
}
}
if ((mode == Comm::SINGLE || mode == Comm::MULTIOLD) && multilo) {
free_multi();
memory->destroy(cutghostmulti);
}
// memory for multi/old-style communication
if (mode == Comm::MULTIOLD && multioldlo == nullptr) {
allocate_multiold(maxswap);
memory->create(cutghostmultiold,atom->ntypes+1,3,"comm:cutghostmultiold");
}
}
if ((mode == Comm::SINGLE || mode == Comm::MULTI) && multioldlo) {
free_multiold();
memory->destroy(cutghostmultiold);
}
}
}
/* ----------------------------------------------------------------------
@ -201,7 +199,7 @@ void CommBrick::setup()
// cutghostmulti = same as cutghost, only for each atom collection
// for multi/old:
// cutghostmultiold = same as cutghost, only for each atom type
int i,j;
int ntypes = atom->ntypes;
double *prd,*sublo,*subhi;
@ -213,10 +211,10 @@ void CommBrick::setup()
if (mode == Comm::MULTI) {
double **cutcollectionsq = neighbor->cutcollectionsq;
// build collection array for atom exchange
neighbor->build_collection(0);
// build collection array for atom exchange
neighbor->build_collection(0);
// If using multi/reduce, communicate particles a distance equal
// to the max cutoff with equally sized or smaller collections
// If not, communicate the maximum cutoff of the entire collection
@ -230,7 +228,7 @@ void CommBrick::setup()
cutghostmulti[i][1] = 0.0;
cutghostmulti[i][2] = 0.0;
}
for (j = 0; j < ncollections; j++){
if (multi_reduce && (cutcollectionsq[j][j] > cutcollectionsq[i][i])) continue;
cutghostmulti[i][0] = MAX(cutghostmulti[i][0],sqrt(cutcollectionsq[i][j]));
@ -239,7 +237,7 @@ void CommBrick::setup()
}
}
}
if (mode == Comm::MULTIOLD) {
double *cuttype = neighbor->cuttype;
for (i = 1; i <= ntypes; i++) {
@ -275,7 +273,7 @@ void CommBrick::setup()
cutghostmulti[i][2] *= length2;
}
}
if (mode == Comm::MULTIOLD) {
for (i = 1; i <= ntypes; i++) {
cutghostmultiold[i][0] *= length0;
@ -902,7 +900,7 @@ void CommBrick::borders()
if (nsend == maxsendlist[iswap]) grow_list(iswap,nsend);
sendlist[iswap][nsend++] = i;
}
}
}
} else {
ngroup = atom->nfirst;
for (i = 0; i < ngroup; i++) {
@ -973,7 +971,7 @@ void CommBrick::borders()
nprior = atom->nlocal + atom->nghost;
atom->nghost += nrecv;
if (neighbor->style == Neighbor::MULTI) neighbor->build_collection(nprior);
iswap++;
}
}

View File

@ -122,24 +122,24 @@ void CommTiled::init()
nswap = 2*domain->dimension;
memory->destroy(cutghostmulti);
if (mode == Comm::MULTI) {
if (mode == Comm::MULTI) {
// If inconsitent # of collections, destroy any preexisting arrays (may be missized)
if (ncollections != neighbor->ncollections) {
ncollections = neighbor->ncollections;
}
// delete any old user cutoffs if # of collections chanaged
if (cutusermulti && ncollections != ncollections_cutoff) {
if(me == 0) error->warning(FLERR, "cutoff/multi settings discarded, must be defined"
" after customizing collections in neigh_modify");
memory->destroy(cutusermulti);
cutusermulti = nullptr;
}
}
// grow sendbox_multi now that ncollections is known
for (int i = 0; i < maxswap; i ++)
grow_swap_send_multi(i,DELTA_PROCS);
grow_swap_send_multi(i,DELTA_PROCS);
memory->create(cutghostmulti,ncollections,3,"comm:cutghostmulti");
}
@ -201,13 +201,13 @@ void CommTiled::setup()
// set cutoff for comm forward and comm reverse
// check that cutoff < any periodic box length
if (mode == Comm::MULTI) {
double **cutcollectionsq = neighbor->cutcollectionsq;
// build collection array for atom exchange
neighbor->build_collection(0);
neighbor->build_collection(0);
// If using multi/reduce, communicate particles a distance equal
// to the max cutoff with equally sized or smaller collections
// If not, communicate the maximum cutoff of the entire collection
@ -221,7 +221,7 @@ void CommTiled::setup()
cutghostmulti[i][1] = 0.0;
cutghostmulti[i][2] = 0.0;
}
for (j = 0; j < ncollections; j++){
if (multi_reduce && (cutcollectionsq[j][j] > cutcollectionsq[i][i])) continue;
cutghostmulti[i][0] = MAX(cutghostmulti[i][0],sqrt(cutcollectionsq[i][j]));
@ -230,7 +230,7 @@ void CommTiled::setup()
}
}
}
if (mode == Comm::MULTIOLD) {
double *cuttype = neighbor->cuttype;
for (i = 1; i <= ntypes; i++) {
@ -264,7 +264,7 @@ void CommTiled::setup()
cutghostmulti[i][2] *= length2;
}
}
if (mode == Comm::MULTIOLD) {
for (i = 1; i <= ntypes; i++) {
cutghostmultiold[i][0] *= length0;
@ -1051,9 +1051,9 @@ void CommTiled::borders()
double *bbox;
double **x;
AtomVec *avec = atom->avec;
// After exchanging, need to reconstruct collection array for border communication
if (mode == Comm::MULTI) neighbor->build_collection(0);
if (mode == Comm::MULTI) neighbor->build_collection(0);
// send/recv max one = max # of atoms in single send/recv for any swap
// send/recv max all = max # of atoms in all sends/recvs within any swap
@ -2391,7 +2391,7 @@ void CommTiled::grow_swap_recv(int i, int n)
void CommTiled::grow_swap_send_multi(int i, int n)
{
memory->destroy(sendbox_multi[i]);
if (ncollections > 0)
memory->create(sendbox_multi[i],n,ncollections,6,"comm:sendbox_multi");
}

View File

@ -373,12 +373,12 @@ void Info::command(int narg, char **arg)
for (int j=0; j < neighbor->ncollections; ++j) {
cut = MAX(cut,sqrt(neighbor->cutcollectionsq[i][j]));
}
if (comm->cutusermulti) cut = MAX(cut,comm->cutusermulti[i]);
fmt::print(out,"Communication cutoff for collection {} = {:.8}\n", i, cut);
}
}
if (comm->mode == 2) {
fputs("Communication mode = multi/old\n",out);
double cut;

View File

@ -61,9 +61,9 @@ NBin::~NBin()
memory->destroy(binhead);
memory->destroy(bins);
memory->destroy(atom2bin);
if (!binhead_multi) return;
memory->destroy(nbinx_multi);
memory->destroy(nbiny_multi);
memory->destroy(nbinz_multi);
@ -87,7 +87,7 @@ NBin::~NBin()
}
delete [] binhead_multi;
memory->destroy(maxbins_multi);
memory->destroy(maxbins_multi);
}
/* ---------------------------------------------------------------------- */
@ -111,7 +111,7 @@ void NBin::copy_neighbor_info()
binsize_user = neighbor->binsize_user;
bboxlo = neighbor->bboxlo;
bboxhi = neighbor->bboxhi;
ncollections = neighbor->ncollections;
cutcollectionsq = neighbor->cutcollectionsq;
@ -206,7 +206,7 @@ int NBin::coord2bin_multi(double *x, int ic)
} else
iz = static_cast<int> ((x[2]-bboxlo[2])*bininvz_multi[ic]) - 1;
ibin = (iz-mbinzlo_multi[ic])*mbiny_multi[ic]*mbinx_multi[ic]
+ (iy-mbinylo_multi[ic])*mbinx_multi[ic]
+ (ix-mbinxlo_multi[ic]);

View File

@ -22,7 +22,7 @@ class NBin : protected Pointers {
public:
int istyle; // 1-N index into binnames
bigint last_bin; // last timestep atoms were binned
double cutoff_custom; // cutoff set by requestor
double cutoff_custom; // cutoff set by requestor
// Variables for NBinStandard
@ -39,7 +39,7 @@ class NBin : protected Pointers {
int *atom2bin; // bin assignment for each atom (local+ghost)
// Analogues for NBinMultimulti
int *nbinx_multi, *nbiny_multi, *nbinz_multi;
int *mbins_multi;
int *mbinx_multi, *mbiny_multi, *mbinz_multi;
@ -48,7 +48,7 @@ class NBin : protected Pointers {
double *bininvx_multi, *bininvy_multi, *bininvz_multi;
int **binhead_multi;
NBin(class LAMMPS *);
~NBin();
void post_constructor(class NeighRequest *);
@ -82,7 +82,7 @@ class NBin : protected Pointers {
int triclinic;
// data for standard NBin
int maxatom; // size of bins array
int maxbin; // size of binhead array
@ -94,7 +94,7 @@ class NBin : protected Pointers {
// methods
int coord2bin(double *);
int coord2bin_multi(double *, int);
int coord2bin_multi(double *, int);
};
}

View File

@ -34,10 +34,10 @@ NBinMulti::NBinMulti(LAMMPS *lmp) : NBin(lmp) {}
setup for bin_atoms()
------------------------------------------------------------------------- */
void NBinMulti::bin_atoms_setup(int nall)
void NBinMulti::bin_atoms_setup(int nall)
{
// binhead_multi[n] = per-bin vector mbins in length mbins_multi[n]
for (int n = 0; n < maxcollections; n++) {
if (mbins_multi[n] > maxbins_multi[n]) {
maxbins_multi[n] = mbins_multi[n];
@ -90,7 +90,7 @@ void NBinMulti::setup_bins(int /*style*/)
// Clear any/all memory for existing groupings
for (n = 0; n < maxcollections; n++)
memory->destroy(binhead_multi[n]);
delete [] binhead_multi;
maxcollections = ncollections;
@ -136,7 +136,7 @@ void NBinMulti::setup_bins(int /*style*/)
memory->destroy(maxbins_multi);
memory->create(maxbins_multi, maxcollections, "neigh:maxbins_multi");
// ensure reallocation occurs in bin_atoms_setup()
for (n = 0; n < maxcollections; n++) {
maxbins_multi[n] = 0;
@ -147,7 +147,7 @@ void NBinMulti::setup_bins(int /*style*/)
// Identify smallest collection
int icollectionmin = 0;
for (n = 0; n < ncollections; n++)
if (cutcollectionsq[n][n] < cutcollectionsq[icollectionmin][icollectionmin])
if (cutcollectionsq[n][n] < cutcollectionsq[icollectionmin][icollectionmin])
icollectionmin = n;
// bbox = size of bbox of entire domain
@ -279,7 +279,7 @@ void NBinMulti::setup_bins(int /*style*/)
} else mbinzlo_multi[n] = mbinzhi = 0;
mbinz_multi[n] = mbinzhi - mbinzlo_multi[n] + 1;
bigint bbin = ((bigint) mbinx_multi[n])
bigint bbin = ((bigint) mbinx_multi[n])
* ((bigint) mbiny_multi[n]) * ((bigint) mbinz_multi[n]) + 1;
if (bbin > MAXSMALLINT) error->one(FLERR,"Too many neighbor bins");
mbins_multi[n] = bbin;
@ -327,7 +327,7 @@ void NBinMulti::bin_atoms()
binhead_multi[n][ibin] = i;
}
} else {
for (i = nall-1; i >= 0; i--) {
for (i = nall-1; i >= 0; i--) {
n = collection[i];
ibin = coord2bin_multi(x[i], n);
atom2bin[i] = ibin;
@ -344,6 +344,6 @@ double NBinMulti::memory_usage()
double bytes = 0;
for (int m = 0; m < maxcollections; m++)
bytes += (double)maxbins_multi[m]*sizeof(int);
bytes += (double)2*maxatom*sizeof(int);
bytes += (double)2*maxatom*sizeof(int);
return bytes;
}

View File

@ -30,7 +30,7 @@ class NBinStandard : public NBin {
public:
NBinStandard(class LAMMPS *);
~NBinStandard() {}
void bin_atoms_setup(int);
void bin_atoms_setup(int);
void setup_bins(int);
void bin_atoms();
double memory_usage();

View File

@ -88,7 +88,7 @@ static const char cite_neigh_multi[] =
"@article{Stratford2018,\n"
" author = {Stratford, Kevin and Shire, Tom and Hanley, Kevin},\n"
" title = {Implementation of multi-level contact detection in LAMMPS},\n"
" year = {2018}\n"
" year = {2018}\n"
"}\n\n"
"@article{Shire2020,\n"
" author = {Shire, Tom and Hanley, Kevin J. and Stratford, Kevin},\n"
@ -196,7 +196,7 @@ pairclass(nullptr), pairnames(nullptr), pairmasks(nullptr)
ex_mol_group = ex_mol_bit = ex_mol_intra = nullptr;
// Multi data
type2collection = nullptr;
collection2cut = nullptr;
collection = nullptr;
@ -270,7 +270,7 @@ Neighbor::~Neighbor()
memory->destroy(ex_mol_group);
delete [] ex_mol_bit;
memory->destroy(ex_mol_intra);
memory->destroy(type2collection);
memory->destroy(collection2cut);
memory->destroy(collection);
@ -361,19 +361,19 @@ void Neighbor::init()
// Define cutoffs for multi
if (style == Neighbor::MULTI) {
int icollection, jcollection;
// If collections not yet defined, create default map using types
if (not custom_collection_flag) {
ncollections = n;
interval_collection_flag = 0;
if (not type2collection)
memory->create(type2collection,n+1,"neigh:type2collection");
memory->create(type2collection,n+1,"neigh:type2collection");
for (i = 1; i <= n; i++)
type2collection[i] = i-1;
}
}
memory->grow(cutcollectionsq, ncollections, ncollections, "neigh:cutcollectionsq");
// 3 possible ways of defining collections
// 1) Types are used to define collections
// Each collection loops through its owned types, and uses cutneighsq to calculate its cutoff
@ -381,14 +381,14 @@ void Neighbor::init()
// Types are first sorted into collections based on cutneighsq[i][i]
// Each collection loops through its owned types, and uses cutneighsq to calculate its cutoff
// 3) Collections are defined by intervals, finite particles
//
// Define collection cutoffs
//
// Define collection cutoffs
for (i = 0; i < ncollections; i++)
for (j = 0; j < ncollections; j++)
cutcollectionsq[i][j] = 0.0;
if (not interval_collection_flag) {
cutcollectionsq[i][j] = 0.0;
if (not interval_collection_flag) {
finite_cut_flag = 0;
for (i = 1; i <= n; i++){
icollection = type2collection[i];
@ -403,26 +403,26 @@ void Neighbor::init()
} else {
if (force->pair->finitecutflag) {
finite_cut_flag = 1;
// If cutoffs depend on finite atom sizes, use radii of intervals to find cutoffs
// If cutoffs depend on finite atom sizes, use radii of intervals to find cutoffs
double ri, rj, tmp;
for (i = 0; i < ncollections; i++){
ri = collection2cut[i]*0.5;
for (j = 0; j < ncollections; j++){
rj = collection2cut[j]*0.5;
tmp = force->pair->radii2cut(ri, rj) + skin;
cutcollectionsq[i][j] = tmp*tmp;
cutcollectionsq[i][j] = tmp*tmp;
}
}
}
} else {
finite_cut_flag = 0;
// Map types to collections
if (not type2collection)
memory->create(type2collection,n+1,"neigh:type2collection");
memory->create(type2collection,n+1,"neigh:type2collection");
for (i = 1; i <= n; i++)
type2collection[i] = -1;
double cuttmp;
for (i = 1; i <= n; i++){
// Remove skin added to cutneighsq
@ -433,11 +433,11 @@ void Neighbor::init()
break;
}
}
if (type2collection[i] == -1)
error->all(FLERR, "Pair cutoff exceeds interval cutoffs for multi");
}
}
// Define cutoffs
for (i = 1; i <= n; i++){
icollection = type2collection[i];
@ -448,7 +448,7 @@ void Neighbor::init()
cutcollectionsq[jcollection][icollection] = cutneighsq[i][j];
}
}
}
}
}
}
}
@ -2216,7 +2216,7 @@ void Neighbor::build(int topoflag)
}
}
}
// bin atoms for all NBin instances
// not just NBin associated with perpetual lists, also occasional lists
// b/c cannot wait to bin occasional lists in build_one() call
@ -2497,12 +2497,12 @@ void Neighbor::modify_params(int narg, char **arg)
} else if (strcmp(arg[iarg+1],"none") == 0) {
nex_type = nex_group = nex_mol = 0;
iarg += 2;
} else error->all(FLERR,"Illegal neigh_modify command");
} else if (strcmp(arg[iarg],"collection/interval") == 0) {
if (style != Neighbor::MULTI)
error->all(FLERR,"Cannot use collection/interval command without multi setting");
if (iarg+2 > narg)
error->all(FLERR,"Invalid collection/interval command");
ncollections = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
@ -2512,12 +2512,12 @@ void Neighbor::modify_params(int narg, char **arg)
error->all(FLERR,"Invalid collection/interval command");
int i;
// Invalidate old user cutoffs
comm->ncollections_cutoff = 0;
interval_collection_flag = 1;
custom_collection_flag = 1;
memory->grow(collection2cut,ncollections,"neigh:collection2cut");
memory->grow(collection2cut,ncollections,"neigh:collection2cut");
// Set upper cutoff for each collection
@ -2525,34 +2525,34 @@ void Neighbor::modify_params(int narg, char **arg)
for (i = 0; i < ncollections; i++){
cut_interval = utils::numeric(FLERR,arg[iarg+2+i],false,lmp);
collection2cut[i] = cut_interval;
if (i != 0)
if (collection2cut[i-1] >= collection2cut[i])
error->all(FLERR,"Nonsequential interval cutoffs in collection/interval setting");
}
}
iarg += 2 + ncollections;
} else if (strcmp(arg[iarg],"collection/type") == 0) {
if (style != Neighbor::MULTI)
error->all(FLERR,"Cannot use collection/type command without multi setting");
if (iarg+2 > narg)
error->all(FLERR,"Invalid collection/type command");
ncollections = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
if (ncollections < 1)
error->all(FLERR,"Invalid collection/interval command");
error->all(FLERR,"Invalid collection/interval command");
if (iarg+1+ncollections > narg)
error->all(FLERR,"Invalid collection/type command");
int ntypes = atom->ntypes;
int n, nlo, nhi, i, j, k;
// Invalidate old user cutoffs
comm->ncollections_cutoff = 0;
interval_collection_flag = 0;
custom_collection_flag = 1;
if (not type2collection)
memory->create(type2collection,ntypes+1,"neigh:type2collection");
memory->create(type2collection,ntypes+1,"neigh:type2collection");
// Erase previous mapping
for (i = 1; i <= ntypes; i++)
@ -2567,28 +2567,28 @@ void Neighbor::modify_params(int narg, char **arg)
strcpy(str,arg[iarg+2+i]);
std::vector<std::string> words = Tokenizer(str, ",").as_vector();
nfield = words.size();
for (j = 0; j < nfield; j++) {
const char * field = words[j].c_str();
const char * field = words[j].c_str();
utils::bounds(FLERR,field,1,ntypes,nlo,nhi,error);
for (k = nlo; k <= nhi; k++) {
if (type2collection[k] != -1)
error->all(FLERR,"Type specified more than once in collection/type commnd");
type2collection[k] = i;
}
}
}
delete [] str;
}
// Check for undefined atom type
delete [] str;
}
// Check for undefined atom type
for (i = 1; i <= ntypes; i++){
if (type2collection[i] == -1) {
error->all(FLERR,"Type missing in collection/type commnd");
}
}
iarg += 2 + ncollections;
} else error->all(FLERR,"Illegal neigh_modify command");
}
@ -2671,21 +2671,21 @@ void Neighbor::build_collection(int istart)
nmax_collection = nmax+DELTA_PERATOM;
memory->grow(collection, nmax_collection, "neigh:collection");
}
if (finite_cut_flag) {
double cut;
int icollection;
for (int i = istart; i < nmax; i++){
cut = force->pair->atom2cut(i);
collection[i] = -1;
for (icollection = 0; icollection < ncollections; icollection++){
if (collection2cut[icollection] >= cut) {
collection[i] = icollection;
break;
}
}
if (collection[i] == -1)
error->one(FLERR, "Atom cutoff exceeds interval cutoffs for multi");
}
@ -2693,7 +2693,7 @@ void Neighbor::build_collection(int istart)
int *type = atom->type;
for (int i = istart; i < nmax; i++){
collection[i] = type2collection[type[i]];
}
}
}
}

View File

@ -103,7 +103,7 @@ class Neighbor : protected Pointers {
int **improperlist;
// optional type grouping for multi
int custom_collection_flag; // 1 if custom collections are defined for multi
int interval_collection_flag; // 1 if custom collections use intervals
int finite_cut_flag; // 1 if multi considers finite atom size
@ -113,7 +113,7 @@ class Neighbor : protected Pointers {
double *collection2cut; // ncollection array with upper bounds on cutoff intervals
double **cutcollectionsq; // cutoffs for each combination of collections
int *collection; // local per-atom array to store collection id
// public methods
Neighbor(class LAMMPS *);

View File

@ -96,7 +96,7 @@ void NPair::copy_neighbor_info()
special_flag = neighbor->special_flag;
// multi info
ncollections = neighbor->ncollections;
cutcollectionsq = neighbor->cutcollectionsq;
@ -183,7 +183,7 @@ void NPair::build_setup()
{
if (nb) copy_bin_info();
if (ns) copy_stencil_info();
// set here, since build_setup() always called before build()
last_build = update->ntimestep;
}

View File

@ -50,7 +50,7 @@ class NPair : protected Pointers {
double *bboxlo,*bboxhi;
int ncollections;
double **cutcollectionsq;
// exclusion data from Neighbor class
int nex_type; // # of entries in type exclusion list
@ -99,7 +99,7 @@ class NPair : protected Pointers {
int ** nstencil_multi;
int *** stencil_multi;
// data common to all NPair variants
int molecular;

View File

@ -30,7 +30,7 @@ NPairFullMulti::NPairFullMulti(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction for all neighbors
multi stencil is icollection-jcollection dependent
multi stencil is icollection-jcollection dependent
every neighbor pair appears in list of both atoms i and j
------------------------------------------------------------------------- */
@ -82,7 +82,7 @@ void NPairFullMulti::build(NeighList *list)
}
ibin = atom2bin[i];
// loop through stencils for all collections
for (jcollection = 0; jcollection < ncollections; jcollection++) {
@ -96,20 +96,20 @@ void NPairFullMulti::build(NeighList *list)
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)

View File

@ -30,7 +30,7 @@ NPairHalfMultiNewtoff::NPairHalfMultiNewtoff(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction with partial Newton's 3rd law
multi stencil is icollection-jcollection dependent
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)
@ -84,36 +84,36 @@ void NPairHalfMultiNewtoff::build(NeighList *list)
}
ibin = atom2bin[i];
// loop through stencils for all collections
// 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
// 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)

View File

@ -83,31 +83,31 @@ void NPairHalfMultiNewton::build(NeighList *list)
}
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 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 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
// 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((icollection != jcollection) && (j < i)) continue;
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
@ -115,15 +115,15 @@ void NPairHalfMultiNewton::build(NeighList *list)
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)
@ -139,29 +139,29 @@ void NPairHalfMultiNewton::build(NeighList *list)
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
// 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)
@ -180,7 +180,7 @@ void NPairHalfMultiNewton::build(NeighList *list)
}
}
}
ilist[inum++] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;

View File

@ -30,7 +30,7 @@ NPairHalfMultiNewtonTri::NPairHalfMultiNewtonTri(LAMMPS *lmp) : NPair(lmp) {}
/* ----------------------------------------------------------------------
binned neighbor list construction with Newton's 3rd law for triclinic
multi stencil is icollection-jcollection dependent
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
------------------------------------------------------------------------- */
@ -42,7 +42,7 @@ void NPairHalfMultiNewtonTri::build(NeighList *list)
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;
@ -83,14 +83,14 @@ void NPairHalfMultiNewtonTri::build(NeighList *list)
}
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
@ -102,12 +102,12 @@ void NPairHalfMultiNewtonTri::build(NeighList *list)
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 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) {
@ -116,17 +116,17 @@ void NPairHalfMultiNewtonTri::build(NeighList *list)
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)
@ -145,7 +145,7 @@ void NPairHalfMultiNewtonTri::build(NeighList *list)
}
}
}
ilist[inum++] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;

View File

@ -29,7 +29,7 @@ NPairHalfSizeMultiNewtoff::NPairHalfSizeMultiNewtoff(LAMMPS *lmp) : NPair(lmp) {
/* ----------------------------------------------------------------------
size particles
binned neighbor list construction with partial Newton's 3rd law
multi stencil is icollection-jcollection dependent
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)
@ -74,31 +74,31 @@ void NPairHalfSizeMultiNewtoff::build(NeighList *list)
radi = radius[i];
ibin = atom2bin[i];
// loop through stencils for all collections
// 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
// 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];
@ -107,7 +107,7 @@ void NPairHalfSizeMultiNewtoff::build(NeighList *list)
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;

View File

@ -71,10 +71,10 @@ void NPairHalfSizeMultiNewton::build(NeighList *list)
radi = radius[i];
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);
@ -84,18 +84,18 @@ void NPairHalfSizeMultiNewton::build(NeighList *list)
if (icollection == jcollection) js = bins[i];
else js = binhead_multi[jcollection][jbin];
// if same collection,
// 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 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
// 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 ((icollection != jcollection) && (j < i)) continue;
if (j >= nlocal) {
if (x[j][2] < ztmp) continue;
if (x[j][2] == ztmp) {
@ -103,50 +103,50 @@ void NPairHalfSizeMultiNewton::build(NeighList *list)
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) {
if (history && rsq < radsum*radsum)
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
else
neighptr[n++] = j;
}
}
}
}
// for all collections, loop over all atoms in other bins in stencil, store every pair
// 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) {
if (history && rsq < radsum*radsum)
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;
@ -154,7 +154,7 @@ void NPairHalfSizeMultiNewton::build(NeighList *list)
}
}
}
ilist[inum++] = i;
firstneigh[i] = neighptr;
numneigh[i] = n;

View File

@ -44,4 +44,4 @@ E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED
*/
*/

View File

@ -28,7 +28,7 @@ NPairHalfSizeMultiNewtonTri::NPairHalfSizeMultiNewtonTri(LAMMPS *lmp) : NPair(lm
/* ----------------------------------------------------------------------
size particles
binned neighbor list construction with Newton's 3rd law for triclinic
multi stencil is icollection-jcollection dependent
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
------------------------------------------------------------------------- */
@ -90,12 +90,12 @@ void NPairHalfSizeMultiNewtonTri::build(NeighList *list)
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 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) {
@ -104,21 +104,21 @@ void NPairHalfSizeMultiNewtonTri::build(NeighList *list)
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) {
if (history && rsq < radsum*radsum)
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;

View File

@ -44,4 +44,4 @@ E: Neighbor list overflow, boost neigh_modify one
UNDOCUMENTED
*/
*/

View File

@ -94,9 +94,9 @@ void NPairHalfSizeMultiOldNewton::build(NeighList *list)
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
else
neighptr[n++] = j;
}
}
@ -124,7 +124,7 @@ void NPairHalfSizeMultiOldNewton::build(NeighList *list)
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;

View File

@ -106,7 +106,7 @@ void NPairHalfSizeMultiOldNewtonTri::build(NeighList *list)
cutdistsq = (radsum+skin) * (radsum+skin);
if (rsq <= cutdistsq) {
if (history && rsq < radsum*radsum)
if (history && rsq < radsum*radsum)
neighptr[n++] = j ^ mask_history;
else
neighptr[n++] = j;

View File

@ -31,7 +31,7 @@ using namespace LAMMPS_NS;
sx,sy,sz = bin bounds = furthest the stencil could possibly extend
calculated below in create_setup()
3d creates xyz stencil, 2d creates xy stencil
for full list or half list with newton off
for full list or half list with newton off
use a full stencil
stencil is all surrounding bins including self
regardless of triclinic
@ -57,7 +57,7 @@ using namespace LAMMPS_NS;
a half list with newton on has a half same-collection stencil
a full list or half list with newton off has a full same-collection stencil
cross collection stencils are always full to allow small-to-large lookups
for orthogonal boxes, a half stencil includes bins to the "upper right" of central bin
for orthogonal boxes, a half stencil includes bins to the "upper right" of central bin
for triclinic, a half stencil includes bins in the z (3D) or y (2D) plane of self and above
cutoff is not cutneighmaxsq, but max cutoff for that atom collection
no versions that allow ghost on (any need for it?)
@ -74,15 +74,15 @@ NStencil::NStencil(LAMMPS *lmp) : Pointers(lmp)
nstencil_multi_old = nullptr;
stencil_multi_old = nullptr;
distsq_multi_old = nullptr;
nstencil_multi = nullptr;
stencil_multi = nullptr;
maxstencil_multi = nullptr;
flag_half_multi = nullptr;
flag_skip_multi = nullptr;
bin_collection_multi = nullptr;
maxcollections = 0;
dimension = domain->dimension;
@ -106,9 +106,9 @@ NStencil::~NStencil()
delete [] stencil_multi_old;
delete [] distsq_multi_old;
}
if (maxstencil_multi) {
memory->destroy(nstencil_multi);
for (int i = 0; i < maxcollections; i++) {
for (int j = 0; j < maxcollections; j++)
@ -120,7 +120,7 @@ NStencil::~NStencil()
memory->destroy(flag_half_multi);
memory->destroy(flag_skip_multi);
memory->destroy(bin_collection_multi);
memory->destroy(stencil_sx_multi);
memory->destroy(stencil_sy_multi);
memory->destroy(stencil_sz_multi);
@ -128,7 +128,7 @@ NStencil::~NStencil()
memory->destroy(stencil_mbinx_multi);
memory->destroy(stencil_mbiny_multi);
memory->destroy(stencil_mbinz_multi);
memory->destroy(stencil_binsizex_multi);
memory->destroy(stencil_binsizey_multi);
memory->destroy(stencil_binsizez_multi);
@ -154,7 +154,7 @@ void NStencil::copy_neighbor_info()
cutneighmaxsq = neighbor->cutneighmaxsq;
cuttypesq = neighbor->cuttypesq;
cutneighsq = neighbor->cutneighsq;
ncollections = neighbor->ncollections;
collection = neighbor->collection;
cutcollectionsq = neighbor->cutcollectionsq;
@ -209,15 +209,15 @@ void NStencil::copy_bin_info_multi()
void NStencil::create_setup()
{
if (neighstyle != Neighbor::MULTI){
if (nb) copy_bin_info();
last_stencil = update->ntimestep;
// sx,sy,sz = max range of stencil in each dim
// smax = max possible size of entire 3d stencil
// stencil will be empty if cutneighmax = 0.0
sx = static_cast<int> (cutneighmax*bininvx);
if (sx*binsizex < cutneighmax) sx++;
sy = static_cast<int> (cutneighmax*bininvy);
@ -225,12 +225,12 @@ void NStencil::create_setup()
sz = static_cast<int> (cutneighmax*bininvz);
if (sz*binsizez < cutneighmax) sz++;
if (dimension == 2) sz = 0;
int smax = (2*sx+1) * (2*sy+1) * (2*sz+1);
// reallocate stencil structs if necessary
// for BIN and MULTI_OLD styles
if (neighstyle == Neighbor::BIN) {
if (smax > maxstencil) {
maxstencil = smax;
@ -241,7 +241,7 @@ void NStencil::create_setup()
memory->create(stencilxyz,maxstencil,3,"neighstencil:stencilxyz");
}
}
} else {
int i;
int n = atom->ntypes;
@ -271,19 +271,19 @@ void NStencil::create_setup()
int i, j, bin_collection, smax;
double stencil_range;
int n = ncollections;
if (nb) copy_bin_info_multi();
// Deallocate arrays if previously allocated
if((n > maxcollections) && stencil_multi){
if((n > maxcollections) && stencil_multi){
memory->destroy(nstencil_multi);
for (i = 0; i < maxcollections; i++) {
for (j = 0; j < maxcollections; j++)
memory->destroy(stencil_multi[i][j]);
delete [] stencil_multi[i];
}
delete [] stencil_multi;
memory->destroy(maxstencil_multi);
delete [] stencil_multi;
memory->destroy(maxstencil_multi);
memory->destroy(flag_half_multi);
memory->destroy(flag_skip_multi);
memory->destroy(bin_collection_multi);
@ -295,39 +295,39 @@ void NStencil::create_setup()
memory->destroy(stencil_binsizez_multi);
memory->destroy(stencil_mbinx_multi);
memory->destroy(stencil_mbiny_multi);
memory->destroy(stencil_mbinz_multi);
}
// Allocate arrays
if (!maxstencil_multi) {
memory->create(flag_half_multi, n, n,
memory->destroy(stencil_mbinz_multi);
}
// Allocate arrays
if (!maxstencil_multi) {
memory->create(flag_half_multi, n, n,
"neighstencil:flag_half_multi");
memory->create(flag_skip_multi, n, n,
memory->create(flag_skip_multi, n, n,
"neighstencil:flag_skip_multi");
memory->create(bin_collection_multi, n, n,
memory->create(bin_collection_multi, n, n,
"neighstencil:bin_collection_multi");
memory->create(stencil_sx_multi, n, n,
"neighstencil:stencil_sx_multi");
memory->create(stencil_sy_multi, n, n,
memory->create(stencil_sx_multi, n, n,
"neighstencil:stencil_sx_multi");
memory->create(stencil_sy_multi, n, n,
"neighstencil:stencil_sy_multi");
memory->create(stencil_sz_multi, n, n,
memory->create(stencil_sz_multi, n, n,
"neighstencil:stencil_sz_multi");
memory->create(stencil_binsizex_multi, n, n,
memory->create(stencil_binsizex_multi, n, n,
"neighstencil:stencil_binsizex_multi");
memory->create(stencil_binsizey_multi, n, n,
memory->create(stencil_binsizey_multi, n, n,
"neighstencil:stencil_binsizey_multi");
memory->create(stencil_binsizez_multi, n, n,
memory->create(stencil_binsizez_multi, n, n,
"neighstencil:stencil_binsizez_multi");
memory->create(stencil_mbinx_multi, n, n,
memory->create(stencil_mbinx_multi, n, n,
"neighstencil:stencil_mbinx_multi");
memory->create(stencil_mbiny_multi, n, n,
memory->create(stencil_mbiny_multi, n, n,
"neighstencil:stencil_mbiny_multi");
memory->create(stencil_mbinz_multi, n, n,
memory->create(stencil_mbinz_multi, n, n,
"neighstencil:stencil_mbinz_multi");
memory->create(maxstencil_multi, n, n, "neighstencil::maxstencil_multi");
memory->create(nstencil_multi, n, n, "neighstencil::nstencil_multi");
stencil_multi = new int**[n]();
@ -338,38 +338,38 @@ void NStencil::create_setup()
nstencil_multi[i][j] = 0;
stencil_multi[i][j] = nullptr;
}
}
maxcollections = n;
}
maxcollections = n;
}
// Skip all stencils by default, initialize smax
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
flag_skip_multi[i][j] = 1;
flag_skip_multi[i][j] = 1;
}
}
// Determine which stencils need to be built
set_stencil_properties();
set_stencil_properties();
for (i = 0; i < n; i++) {
for (j = 0; j < n; j++) {
// Skip creation of unused stencils
// Skip creation of unused stencils
if (flag_skip_multi[i][j]) continue;
// Copy bin info for this pair of atom collections
bin_collection = bin_collection_multi[i][j];
stencil_binsizex_multi[i][j] = binsizex_multi[bin_collection];
stencil_binsizey_multi[i][j] = binsizey_multi[bin_collection];
stencil_binsizez_multi[i][j] = binsizez_multi[bin_collection];
stencil_mbinx_multi[i][j] = mbinx_multi[bin_collection];
stencil_mbiny_multi[i][j] = mbiny_multi[bin_collection];
stencil_mbinz_multi[i][j] = mbinz_multi[bin_collection];
stencil_range = sqrt(cutcollectionsq[i][j]);
sx = static_cast<int> (stencil_range*bininvx_multi[bin_collection]);
if (sx*binsizex_multi[bin_collection] < stencil_range) sx++;
sy = static_cast<int> (stencil_range*bininvy_multi[bin_collection]);
@ -377,13 +377,13 @@ void NStencil::create_setup()
sz = static_cast<int> (stencil_range*bininvz_multi[bin_collection]);
if (sz*binsizez_multi[bin_collection] < stencil_range) sz++;
if (dimension == 2) sz = 0;
stencil_sx_multi[i][j] = sx;
stencil_sy_multi[i][j] = sy;
stencil_sz_multi[i][j] = sz;
smax = ((2*sx+1) * (2*sy+1) * (2*sz+1));
smax = ((2*sx+1) * (2*sy+1) * (2*sz+1));
if (smax > maxstencil_multi[i][j]) {
maxstencil_multi[i][j] = smax;
if(stencil_multi[i][j])

View File

@ -34,17 +34,17 @@ class NStencil : protected Pointers {
int *** stencil_multi; // list of bin offsets in each multi stencil
int ** maxstencil_multi; // max stencil size for each multi stencil
int maxcollections; // size of multi arrays
int sx,sy,sz; // extent of stencil in each dim
int **stencil_sx_multi; // analogs for each multi stencil
int **stencil_sy_multi;
int **stencil_sz_multi;
double cutoff_custom; // cutoff set by requestor
double cutoff_custom; // cutoff set by requestor
// Arrays to store options for multi itype-jtype stencils
bool **flag_half_multi; // flag creation of a half stencil for icollection-jcollection
bool **flag_skip_multi; // skip creation of icollection-jcollection stencils (for newton on)
bool **flag_skip_multi; // skip creation of icollection-jcollection stencils (for newton on)
int **bin_collection_multi; // what collection to use for bin information
NStencil(class LAMMPS *);
@ -70,15 +70,15 @@ class NStencil : protected Pointers {
double **cutcollectionsq;
int ncollections;
int *collection;
// data from NBin class
int mbinx,mbiny,mbinz;
double binsizex,binsizey,binsizez;
double bininvx,bininvy,bininvz;
// data from NBin class for multi
int *mbinx_multi;
int *mbiny_multi;
int *mbinz_multi;
@ -88,16 +88,16 @@ class NStencil : protected Pointers {
double *bininvx_multi;
double *bininvy_multi;
double *bininvz_multi;
// Stored bin information for each stencil
int **stencil_mbinx_multi;
int **stencil_mbiny_multi;
int **stencil_mbinz_multi;
double **stencil_binsizex_multi;
double **stencil_binsizey_multi;
double **stencil_binsizez_multi;
double **stencil_binsizez_multi;
// data common to all NStencil variants
int xyzflag; // 1 if stencilxyz is allocated
@ -113,9 +113,9 @@ class NStencil : protected Pointers {
// methods for multi NStencil
double bin_distance_multi(int, int, int, int); // distance between bin corners for different collections
double bin_distance_multi(int, int, int, int); // distance between bin corners for different collections
void copy_bin_info_multi(); // copy multi info from NBin class
virtual void set_stencil_properties(){} // determine which stencils to build and how
virtual void set_stencil_properties(){} // determine which stencils to build and how
};
}

View File

@ -31,7 +31,7 @@ void NStencilFullMulti2d::set_stencil_properties()
{
int n = ncollections;
int i, j;
// Always look up neighbor using full stencil and neighbor's bin
for (i = 0; i < n; i++) {
@ -52,32 +52,32 @@ void NStencilFullMulti2d::create()
int icollection, jcollection, bin_collection, i, j, ns;
int n = ncollections;
double cutsq;
for (icollection = 0; icollection < n; icollection++) {
for (jcollection = 0; jcollection < n; jcollection++) {
if (flag_skip_multi[icollection][jcollection]) {
nstencil_multi[icollection][jcollection] = 0;
continue;
}
ns = 0;
sx = stencil_sx_multi[icollection][jcollection];
sy = stencil_sy_multi[icollection][jcollection];
mbinx = stencil_mbinx_multi[icollection][jcollection];
mbiny = stencil_mbiny_multi[icollection][jcollection];
bin_collection = bin_collection_multi[icollection][jcollection];
cutsq = cutcollectionsq[icollection][jcollection];
for (j = -sy; j <= sy; j++)
for (i = -sx; i <= sx; i++)
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
nstencil_multi[icollection][jcollection] = ns;
}
}

View File

@ -31,7 +31,7 @@ void NStencilFullMulti3d::set_stencil_properties()
{
int n = ncollections;
int i, j;
// Always look up neighbor using full stencil and neighbor's bin
// Stencil cutoff set by i-j cutoff
@ -53,36 +53,36 @@ void NStencilFullMulti3d::create()
int icollection, jcollection, bin_collection, i, j, k, ns;
int n = ncollections;
double cutsq;
for (icollection = 0; icollection < n; icollection++) {
for (jcollection = 0; jcollection < n; jcollection++) {
if (flag_skip_multi[icollection][jcollection]) {
nstencil_multi[icollection][jcollection] = 0;
continue;
}
ns = 0;
sx = stencil_sx_multi[icollection][jcollection];
sy = stencil_sy_multi[icollection][jcollection];
sz = stencil_sz_multi[icollection][jcollection];
mbinx = stencil_mbinx_multi[icollection][jcollection];
mbiny = stencil_mbiny_multi[icollection][jcollection];
mbinz = stencil_mbinz_multi[icollection][jcollection];
mbinz = stencil_mbinz_multi[icollection][jcollection];
bin_collection = bin_collection_multi[icollection][jcollection];
cutsq = cutcollectionsq[icollection][jcollection];
for (k = -sz; k <= sz; k++)
for (j = -sy; j <= sy; j++)
for (i = -sx; i <= sx; i++)
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
stencil_multi[icollection][jcollection][ns++] =
stencil_multi[icollection][jcollection][ns++] =
k*mbiny*mbinx + j*mbinx + i;
nstencil_multi[icollection][jcollection] = ns;
}
}

View File

@ -43,7 +43,7 @@ void NStencilHalfMulti2d::set_stencil_properties()
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
flag_skip_multi[i][j] = 0;
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
flag_half_multi[i][j] = 1;
bin_collection_multi[i][j] = i;
@ -64,31 +64,31 @@ void NStencilHalfMulti2d::create()
int icollection, jcollection, bin_collection, i, j, ns;
int n = ncollections;
double cutsq;
for (icollection = 0; icollection < n; icollection++) {
for (jcollection = 0; jcollection < n; jcollection++) {
if (flag_skip_multi[icollection][jcollection]) {
nstencil_multi[icollection][jcollection] = 0;
continue;
}
ns = 0;
sx = stencil_sx_multi[icollection][jcollection];
sy = stencil_sy_multi[icollection][jcollection];
mbinx = stencil_mbinx_multi[icollection][jcollection];
mbiny = stencil_mbiny_multi[icollection][jcollection];
bin_collection = bin_collection_multi[icollection][jcollection];
bin_collection = bin_collection_multi[icollection][jcollection];
cutsq = cutcollectionsq[icollection][jcollection];
if (flag_half_multi[icollection][jcollection]) {
for (j = 0; j <= sy; j++)
for (i = -sx; i <= sx; i++)
if (j > 0 || (j == 0 && i > 0)) {
if (j > 0 || (j == 0 && i > 0)) {
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
}
@ -98,7 +98,7 @@ void NStencilHalfMulti2d::create()
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
}
nstencil_multi[icollection][jcollection] = ns;
}
}

View File

@ -43,7 +43,7 @@ void NStencilHalfMulti2dTri::set_stencil_properties()
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
flag_skip_multi[i][j] = 0;
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
flag_half_multi[i][j] = 1;
bin_collection_multi[i][j] = i;
@ -64,27 +64,27 @@ void NStencilHalfMulti2dTri::create()
int icollection, jcollection, bin_collection, i, j, ns;
int n = ncollections;
double cutsq;
for (icollection = 0; icollection < n; icollection++) {
for (jcollection = 0; jcollection < n; jcollection++) {
if (flag_skip_multi[icollection][jcollection]) {
nstencil_multi[icollection][jcollection] = 0;
continue;
}
ns = 0;
sx = stencil_sx_multi[icollection][jcollection];
sy = stencil_sy_multi[icollection][jcollection];
mbinx = stencil_mbinx_multi[icollection][jcollection];
mbiny = stencil_mbiny_multi[icollection][jcollection];
bin_collection = bin_collection_multi[icollection][jcollection];
cutsq = cutcollectionsq[icollection][jcollection];
if (flag_half_multi[icollection][jcollection]) {
for (j = 0; j <= sy; j++)
for (i = -sx; i <= sx; i++)
@ -96,7 +96,7 @@ void NStencilHalfMulti2dTri::create()
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
}
nstencil_multi[icollection][jcollection] = ns;
}
}

View File

@ -43,7 +43,7 @@ void NStencilHalfMulti3d::set_stencil_properties()
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
flag_skip_multi[i][j] = 0;
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
flag_half_multi[i][j] = 1;
bin_collection_multi[i][j] = i;
@ -64,36 +64,36 @@ void NStencilHalfMulti3d::create()
int icollection, jcollection, bin_collection, i, j, k, ns;
int n = ncollections;
double cutsq;
for (icollection = 0; icollection < n; icollection++) {
for (jcollection = 0; jcollection < n; jcollection++) {
if (flag_skip_multi[icollection][jcollection]) {
nstencil_multi[icollection][jcollection] = 0;
continue;
}
ns = 0;
sx = stencil_sx_multi[icollection][jcollection];
sy = stencil_sy_multi[icollection][jcollection];
sz = stencil_sz_multi[icollection][jcollection];
mbinx = stencil_mbinx_multi[icollection][jcollection];
mbiny = stencil_mbiny_multi[icollection][jcollection];
mbinz = stencil_mbinz_multi[icollection][jcollection];
bin_collection = bin_collection_multi[icollection][jcollection];
cutsq = cutcollectionsq[icollection][jcollection];
if (flag_half_multi[icollection][jcollection]) {
for (k = 0; k <= sz; k++)
for (j = -sy; j <= sy; j++)
for (i = -sx; i <= sx; i++)
if (k > 0 || j > 0 || (j == 0 && i > 0)) {
if (k > 0 || j > 0 || (j == 0 && i > 0)) {
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
stencil_multi[icollection][jcollection][ns++] =
stencil_multi[icollection][jcollection][ns++] =
k*mbiny*mbinx + j*mbinx + i;
}
} else {
@ -101,10 +101,10 @@ void NStencilHalfMulti3d::create()
for (j = -sy; j <= sy; j++)
for (i = -sx; i <= sx; i++)
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
stencil_multi[icollection][jcollection][ns++] =
stencil_multi[icollection][jcollection][ns++] =
k*mbiny*mbinx + j*mbinx + i;
}
nstencil_multi[icollection][jcollection] = ns;
}
}

View File

@ -32,7 +32,7 @@ void NStencilHalfMulti3dTri::set_stencil_properties()
{
int n = ncollections;
int i, j;
// Cross collections: use full stencil, looking one way through hierarchy
// smaller -> larger => use full stencil in larger bin
// larger -> smaller => no nstencil required
@ -43,7 +43,7 @@ void NStencilHalfMulti3dTri::set_stencil_properties()
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
flag_skip_multi[i][j] = 0;
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
flag_half_multi[i][j] = 1;
bin_collection_multi[i][j] = i;
@ -64,45 +64,45 @@ void NStencilHalfMulti3dTri::create()
int icollection, jcollection, bin_collection, i, j, k, ns;
int n = ncollections;
double cutsq;
for (icollection = 0; icollection < n; icollection++) {
for (jcollection = 0; jcollection < n; jcollection++) {
if (flag_skip_multi[icollection][jcollection]) {
nstencil_multi[icollection][jcollection] = 0;
continue;
}
ns = 0;
sx = stencil_sx_multi[icollection][jcollection];
sy = stencil_sy_multi[icollection][jcollection];
sz = stencil_sz_multi[icollection][jcollection];
mbinx = stencil_mbinx_multi[icollection][jcollection];
mbiny = stencil_mbiny_multi[icollection][jcollection];
mbinz = stencil_mbinz_multi[icollection][jcollection];
bin_collection = bin_collection_multi[icollection][jcollection];
cutsq = cutcollectionsq[icollection][jcollection];
if (flag_half_multi[icollection][jcollection]) {
for (k = 0; k <= sz; k++)
for (j = -sy; j <= sy; j++)
for (i = -sx; i <= sx; i++)
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
stencil_multi[icollection][jcollection][ns++] =
stencil_multi[icollection][jcollection][ns++] =
k*mbiny*mbinx + j*mbinx + i;
} else {
for (k = -sz; k <= sz; k++)
for (j = -sy; j <= sy; j++)
for (i = -sx; i <= sx; i++)
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
stencil_multi[icollection][jcollection][ns++] =
stencil_multi[icollection][jcollection][ns++] =
k*mbiny*mbinx + j*mbinx + i;
}
nstencil_multi[icollection][jcollection] = ns;
}
}

View File

@ -1090,7 +1090,7 @@ double PairHybrid::atom2cut(int i)
for (int m = 0; m < nstyles; m++) {
if (styles[m]->finitecutflag) {
temp = styles[m]->atom2cut(i);
if (temp > cut) cut = temp;
if (temp > cut) cut = temp;
}
}
return cut;
@ -1108,7 +1108,7 @@ double PairHybrid::radii2cut(double r1, double r2)
for (int m = 0; m < nstyles; m++) {
if (styles[m]->finitecutflag) {
temp = styles[m]->radii2cut(r1,r2);
if (temp > cut) cut = temp;
if (temp > cut) cut = temp;
}
}
return cut;