whitespace fixes
This commit is contained in:
@ -67,7 +67,7 @@ cutoff across all atom type pairs.
|
|||||||
|
|
||||||
For many systems this is an efficient algorithm, but for systems with
|
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
|
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.
|
correspond to a set of atoms with similar interaction cutoffs.
|
||||||
In this case, each atom collection is assigned its own distance
|
In this case, each atom collection is assigned its own distance
|
||||||
cutoff for communication purposes, and fewer atoms will be
|
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
|
communication mode *multi* instead. Since the communication
|
||||||
cutoffs are determined per atom collections, a collection specifier is needed and
|
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
|
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.
|
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
|
Note that the arguments for *cutoff/multi* are parsed right before each
|
||||||
simulation to account for potential changes in the number of collections.
|
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.
|
one may want to respecify communication cutoffs.
|
||||||
For granular pair styles,the default cutoff is set to the sum of the
|
For granular pair styles,the default cutoff is set to the sum of the
|
||||||
current maximum atomic radii for each collection.
|
current maximum atomic radii for each collection.
|
||||||
The *cutoff/multi/old* option is similar to *cutoff/multi* except it
|
The *cutoff/multi/old* option is similar to *cutoff/multi* except it
|
||||||
operates on atom types as opposed to collections.
|
operates on atom types as opposed to collections.
|
||||||
|
|
||||||
The *reduce/multi* option applies to *multi* and sets the communication
|
The *reduce/multi* option applies to *multi* and sets the communication
|
||||||
cutoff for a particle equal to the maximum interaction distance between particles
|
cutoff for a particle equal to the maximum interaction distance between particles
|
||||||
in the same collection. This reduces the number of
|
in the same collection. This reduces the number of
|
||||||
ghost atoms that need to be communicated. This method is only compatible with the
|
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.
|
*multi* neighbor style and requires a half neighbor list and Newton on.
|
||||||
See the :doc:`neighbor multi <neighbor>` command for more information.
|
See the :doc:`neighbor multi <neighbor>` command for more information.
|
||||||
|
|
||||||
These are simulation scenarios in which it may be useful or even
|
These are simulation scenarios in which it may be useful or even
|
||||||
|
|||||||
@ -196,8 +196,8 @@ atom can have.
|
|||||||
The *binsize* option allows you to specify what size of bins will be
|
The *binsize* option allows you to specify what size of bins will be
|
||||||
used in neighbor list construction to sort and find neighboring atoms.
|
used in neighbor list construction to sort and find neighboring atoms.
|
||||||
By default, for :doc:`neighbor style bin <neighbor>`, LAMMPS uses bins
|
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>`,
|
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.
|
the bins are 1/2 the size of the collection interaction cutoff.
|
||||||
Typically these are good values for minimizing the time for
|
Typically these are good values for minimizing the time for
|
||||||
neighbor list construction. This setting overrides the default.
|
neighbor list construction. This setting overrides the default.
|
||||||
If you make it too big, there is little overhead due to
|
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
|
up. If you set the binsize to 0.0, LAMMPS will use the default
|
||||||
binsize of 1/2 the cutoff.
|
binsize of 1/2 the cutoff.
|
||||||
|
|
||||||
The *collection/type* option allows you to define collections of atom
|
The *collection/type* option allows you to define collections of atom
|
||||||
types, used by the *multi* neighbor mode. By grouping atom types with
|
types, used by the *multi* neighbor mode. By grouping atom types with
|
||||||
similar physical size or interaction cutoff lengths, one may be able
|
similar physical size or interaction cutoff lengths, one may be able
|
||||||
to improve performance by reducing
|
to improve performance by reducing
|
||||||
overhead. You must first specify the number of collections N to be
|
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
|
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
|
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
|
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
|
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
|
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
|
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).
|
(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.
|
Note that all atom types must be included in exactly one of the N collections.
|
||||||
|
|
||||||
The *collection/interval* option provides a similar capability.
|
The *collection/interval* option provides a similar capability.
|
||||||
This command allows a user to define collections by specifying a
|
This command allows a user to define collections by specifying a
|
||||||
series of cutoff intervals. LAMMPS will automatically sort atoms into these intervals
|
series of cutoff intervals. LAMMPS will automatically sort atoms into these intervals
|
||||||
based on their type-dependent cutoffs or their finite size.
|
based on their type-dependent cutoffs or their finite size.
|
||||||
You must first specify the number of collections N to be
|
You must first specify the number of collections N to be
|
||||||
|
|||||||
@ -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
|
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
|
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
|
other type pairs have a much shorter cutoff. The *multi* style uses
|
||||||
different sized bins for collections of different sized particles, where
|
different sized bins for collections of different sized particles, where
|
||||||
"size" may mean the physical size of the particle or its cutoff
|
"size" may mean the physical size of the particle or its cutoff
|
||||||
distance for interacting with other particles. Different
|
distance for interacting with other particles. Different
|
||||||
sets of bins are then used to construct the neighbor lists as as further
|
sets of bins are then used to construct the neighbor lists as as further
|
||||||
described by Shire, Hanley, and Stratford :ref:`(Shire) <bytype-Shire>`.
|
described by Shire, Hanley, and Stratford :ref:`(Shire) <bytype-Shire>`.
|
||||||
This imposes some extra setup overhead, but the searches themselves
|
This imposes some extra setup overhead, but the searches themselves
|
||||||
may be much faster. By default, each atom type defines a separate
|
may be much faster. By default, each atom type defines a separate
|
||||||
collection of particles. For systems where two or more atom types
|
collection of particles. For systems where two or more atom types
|
||||||
have the same size (either physical size or cutoff distance), the
|
have the same size (either physical size or cutoff distance), the
|
||||||
definition of collections can be customized, which can result in less
|
definition of collections can be customized, which can result in less
|
||||||
overhead and faster performance. See the :doc:`neigh_modify <neigh_modify>`
|
overhead and faster performance. See the :doc:`neigh_modify <neigh_modify>`
|
||||||
command for how to define custom collections. Whether the collection
|
command for how to define custom collections. Whether the collection
|
||||||
definition is customized or not, also see the
|
definition is customized or not, also see the
|
||||||
:doc:`comm_modify mode multi <comm_modify>` command for communication
|
:doc:`comm_modify mode multi <comm_modify>` command for communication
|
||||||
options that further improve performance in a manner consistent with
|
options that further improve performance in a manner consistent with
|
||||||
neighbor style multi.
|
neighbor style multi.
|
||||||
|
|
||||||
An alternate style, *multi/old*, sets the bin size to 1/2 of the shortest
|
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
|
cutoff distance and multiple sets of bins are defined to search over for
|
||||||
different atom types. This algorithm used to be the default *multi*
|
different atom types. This algorithm used to be the default *multi*
|
||||||
algorithm in LAMMPS but was found to be significantly slower than the new
|
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.
|
where multi/old outperforms the new multi style.
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -1846,7 +1846,7 @@ void PairGranular::transfer_history(double* source, double* target)
|
|||||||
double PairGranular::atom2cut(int i)
|
double PairGranular::atom2cut(int i)
|
||||||
{
|
{
|
||||||
double cut;
|
double cut;
|
||||||
|
|
||||||
cut = atom->radius[i]*2;
|
cut = atom->radius[i]*2;
|
||||||
if(beyond_contact) {
|
if(beyond_contact) {
|
||||||
int itype = atom->type[i];
|
int itype = atom->type[i];
|
||||||
@ -1854,7 +1854,7 @@ double PairGranular::atom2cut(int i)
|
|||||||
cut += pulloff_distance(cut, cut, itype, itype);
|
cut += pulloff_distance(cut, cut, itype, itype);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return cut;
|
return cut;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1865,11 +1865,11 @@ double PairGranular::atom2cut(int i)
|
|||||||
double PairGranular::radii2cut(double r1, double r2)
|
double PairGranular::radii2cut(double r1, double r2)
|
||||||
{
|
{
|
||||||
double cut = 0.0;
|
double cut = 0.0;
|
||||||
|
|
||||||
if(beyond_contact) {
|
if(beyond_contact) {
|
||||||
int n = atom->ntypes;
|
int n = atom->ntypes;
|
||||||
double temp;
|
double temp;
|
||||||
|
|
||||||
// Check all combinations of i and j to find theoretical maximum pull off distance
|
// Check all combinations of i and j to find theoretical maximum pull off distance
|
||||||
for(int i = 0; i < n; i++){
|
for(int i = 0; i < n; i++){
|
||||||
for(int j = 0; j < n; j++){
|
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);
|
temp = pulloff_distance(r1, r2, i, j);
|
||||||
if(temp > cut) cut = temp;
|
if(temp > cut) cut = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
cut += r1 + r2;
|
cut += r1 + r2;
|
||||||
|
|
||||||
return cut;
|
return cut;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ NPairFullMultiOmp::NPairFullMultiOmp(LAMMPS *lmp) : NPair(lmp) {}
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
binned neighbor list construction for all neighbors
|
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
|
every neighbor pair appears in list of both atoms i and j
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ void NPairFullMultiOmp::build(NeighList *list)
|
|||||||
tagint tagprev;
|
tagint tagprev;
|
||||||
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||||
int *neighptr,*s;
|
int *neighptr,*s;
|
||||||
int js;
|
int js;
|
||||||
|
|
||||||
// loop over each atom, storing neighbors
|
// loop over each atom, storing neighbors
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ void NPairFullMultiOmp::build(NeighList *list)
|
|||||||
neighptr = ipage.vget();
|
neighptr = ipage.vget();
|
||||||
|
|
||||||
itype = type[i];
|
itype = type[i];
|
||||||
icollection = collection[i];
|
icollection = collection[i];
|
||||||
xtmp = x[i][0];
|
xtmp = x[i][0];
|
||||||
ytmp = x[i][1];
|
ytmp = x[i][1];
|
||||||
ztmp = x[i][2];
|
ztmp = x[i][2];
|
||||||
@ -93,7 +93,7 @@ void NPairFullMultiOmp::build(NeighList *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ibin = atom2bin[i];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
// loop through stencils for all collections
|
// loop through stencils for all collections
|
||||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||||
|
|
||||||
@ -107,12 +107,12 @@ void NPairFullMultiOmp::build(NeighList *list)
|
|||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
for (j = js; j >= 0; j = bins[j]) {
|
||||||
if (i == j) continue;
|
if (i == j) continue;
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
@ -120,7 +120,7 @@ void NPairFullMultiOmp::build(NeighList *list)
|
|||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
|
||||||
if (rsq <= cutneighsq[itype][jtype]) {
|
if (rsq <= cutneighsq[itype][jtype]) {
|
||||||
if (molecular != Atom::ATOMIC) {
|
if (molecular != Atom::ATOMIC) {
|
||||||
if (!moltemplate)
|
if (!moltemplate)
|
||||||
|
|||||||
@ -31,7 +31,7 @@ NPairHalfMultiNewtoffOmp::NPairHalfMultiNewtoffOmp(LAMMPS *lmp) : NPair(lmp) {}
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
binned neighbor list construction with partial Newton's 3rd law
|
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
|
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 once if i,j are both owned and i < j
|
||||||
pair stored by me if j is ghost (also stored by proc owning 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];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
// loop through stencils for all collections
|
// loop through stencils for all collections
|
||||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||||
|
|
||||||
// if same collection use own bin
|
// if same collection use own bin
|
||||||
if (icollection == jcollection) jbin = ibin;
|
if (icollection == jcollection) jbin = ibin;
|
||||||
else jbin = coord2bin(x[i], jcollection);
|
else jbin = coord2bin(x[i], jcollection);
|
||||||
|
|
||||||
// loop over all atoms in other bins in stencil including self
|
// loop over all atoms in other bins in stencil including self
|
||||||
// only store pair if i < j
|
// only store pair if i < j
|
||||||
// stores own/own pairs only once
|
// 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
|
// use full stencil for all collection combinations
|
||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
for (j = js; j >= 0; j = bins[j]) {
|
||||||
if (j <= i) continue;
|
if (j <= i) continue;
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
|
||||||
if (rsq <= cutneighsq[itype][jtype]) {
|
if (rsq <= cutneighsq[itype][jtype]) {
|
||||||
if (molecular != Atom::ATOMIC) {
|
if (molecular != Atom::ATOMIC) {
|
||||||
if (!moltemplate)
|
if (!moltemplate)
|
||||||
|
|||||||
@ -94,31 +94,31 @@ void NPairHalfMultiNewtonOmp::build(NeighList *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ibin = atom2bin[i];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
// loop through stencils for all collections
|
// loop through stencils for all collections
|
||||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||||
|
|
||||||
// if same collection use own bin
|
// if same collection use own bin
|
||||||
if (icollection == jcollection) jbin = ibin;
|
if (icollection == jcollection) jbin = ibin;
|
||||||
else jbin = coord2bin(x[i], jcollection);
|
else jbin = coord2bin(x[i], jcollection);
|
||||||
|
|
||||||
// if same size: uses half stencil so check central bin
|
// if same size: uses half stencil so check central bin
|
||||||
if (cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
if (cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
||||||
|
|
||||||
if (icollection == jcollection) js = bins[i];
|
if (icollection == jcollection) js = bins[i];
|
||||||
else js = binhead_multi[jcollection][jbin];
|
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 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 different collections,
|
||||||
// if j is owned atom, store it if j > i
|
// 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]) {
|
for (j = js; j >= 0; j = bins[j]) {
|
||||||
if ((icollection != jcollection) && (j < i)) continue;
|
if ((icollection != jcollection) && (j < i)) continue;
|
||||||
|
|
||||||
if (j >= nlocal) {
|
if (j >= nlocal) {
|
||||||
if (x[j][2] < ztmp) continue;
|
if (x[j][2] < ztmp) continue;
|
||||||
if (x[j][2] == ztmp) {
|
if (x[j][2] == ztmp) {
|
||||||
@ -126,15 +126,15 @@ void NPairHalfMultiNewtonOmp::build(NeighList *list)
|
|||||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
|
||||||
if (rsq <= cutneighsq[itype][jtype]) {
|
if (rsq <= cutneighsq[itype][jtype]) {
|
||||||
if (molecular) {
|
if (molecular) {
|
||||||
if (!moltemplate)
|
if (!moltemplate)
|
||||||
@ -150,29 +150,29 @@ void NPairHalfMultiNewtonOmp::build(NeighList *list)
|
|||||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||||
} else neighptr[n++] = j;
|
} 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 empty if i larger than j
|
||||||
// stencil is half if i same size as j
|
// stencil is half if i same size as j
|
||||||
// stencil is full if i smaller than j
|
// stencil is full if i smaller than j
|
||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
for (j = js; j >= 0; j = bins[j]) {
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
|
||||||
if (rsq <= cutneighsq[itype][jtype]) {
|
if (rsq <= cutneighsq[itype][jtype]) {
|
||||||
if (molecular != Atom::ATOMIC) {
|
if (molecular != Atom::ATOMIC) {
|
||||||
if (!moltemplate)
|
if (!moltemplate)
|
||||||
|
|||||||
@ -32,7 +32,7 @@ NPairHalfMultiNewtonTriOmp::NPairHalfMultiNewtonTriOmp(LAMMPS *lmp) :
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
binned neighbor list construction with Newton's 3rd law for triclinic
|
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
|
each owned atom i checks its own bin and other bins in triclinic stencil
|
||||||
every pair stored exactly once by some processor
|
every pair stored exactly once by some processor
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
@ -95,14 +95,14 @@ void NPairHalfMultiNewtonTriOmp::build(NeighList *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ibin = atom2bin[i];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
// loop through stencils for all collections
|
// loop through stencils for all collections
|
||||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||||
|
|
||||||
// if same collection use own bin
|
// if same collection use own bin
|
||||||
if (icollection == jcollection) jbin = ibin;
|
if (icollection == jcollection) jbin = ibin;
|
||||||
else jbin = coord2bin(x[i], jcollection);
|
else jbin = coord2bin(x[i], jcollection);
|
||||||
|
|
||||||
// loop over all atoms in bins in stencil
|
// loop over all atoms in bins in stencil
|
||||||
// stencil is empty if i larger than j
|
// stencil is empty if i larger than j
|
||||||
// stencil is half if i same size as j
|
// stencil is half if i same size as j
|
||||||
@ -114,12 +114,12 @@ void NPairHalfMultiNewtonTriOmp::build(NeighList *list)
|
|||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
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 (cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
||||||
if (x[j][2] < ztmp) continue;
|
if (x[j][2] < ztmp) continue;
|
||||||
if (x[j][2] == ztmp) {
|
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) continue;
|
||||||
if (x[j][0] == xtmp && j <= i) continue;
|
if (x[j][0] == xtmp && j <= i) continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
|
||||||
if (rsq <= cutneighsq[itype][jtype]) {
|
if (rsq <= cutneighsq[itype][jtype]) {
|
||||||
if (molecular != Atom::ATOMIC) {
|
if (molecular != Atom::ATOMIC) {
|
||||||
if (!moltemplate)
|
if (!moltemplate)
|
||||||
|
|||||||
@ -31,7 +31,7 @@ NPairHalfSizeMultiNewtoffOmp::NPairHalfSizeMultiNewtoffOmp(LAMMPS *lmp) : NPair(
|
|||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
size particles
|
size particles
|
||||||
binned neighbor list construction with partial Newton's 3rd law
|
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
|
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 once if i,j are both owned and i < j
|
||||||
pair stored by me if j is ghost (also stored by proc owning 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;
|
int *collection = neighbor->collection;
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
double *radius = atom->radius;
|
double *radius = atom->radius;
|
||||||
int *type = atom->type;
|
int *type = atom->type;
|
||||||
int *mask = atom->mask;
|
int *mask = atom->mask;
|
||||||
tagint *molecule = atom->molecule;
|
tagint *molecule = atom->molecule;
|
||||||
@ -85,31 +85,31 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list)
|
|||||||
radi = radius[i];
|
radi = radius[i];
|
||||||
|
|
||||||
ibin = atom2bin[i];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
// loop through stencils for all collections
|
// loop through stencils for all collections
|
||||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||||
|
|
||||||
// if same collection use own bin
|
// if same collection use own bin
|
||||||
if(icollection == jcollection) jbin = ibin;
|
if(icollection == jcollection) jbin = ibin;
|
||||||
else jbin = coord2bin(x[i], jcollection);
|
else jbin = coord2bin(x[i], jcollection);
|
||||||
|
|
||||||
// loop over all atoms in other bins in stencil including self
|
// loop over all atoms in other bins in stencil including self
|
||||||
// only store pair if i < j
|
// only store pair if i < j
|
||||||
// stores own/own pairs only once
|
// 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
|
// use full stencil for all collection combinations
|
||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >=0; j = bins[j]) {
|
for (j = js; j >=0; j = bins[j]) {
|
||||||
if (j <= i) continue;
|
if (j <= i) continue;
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
@ -118,7 +118,7 @@ void NPairHalfSizeMultiNewtoffOmp::build(NeighList *list)
|
|||||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||||
|
|
||||||
if (rsq <= cutdistsq) {
|
if (rsq <= cutdistsq) {
|
||||||
if (history && rsq < radsum*radsum)
|
if (history && rsq < radsum*radsum)
|
||||||
neighptr[n++] = j ^ mask_history;
|
neighptr[n++] = j ^ mask_history;
|
||||||
else
|
else
|
||||||
neighptr[n++] = j;
|
neighptr[n++] = j;
|
||||||
|
|||||||
@ -58,7 +58,7 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list)
|
|||||||
|
|
||||||
int *collection = neighbor->collection;
|
int *collection = neighbor->collection;
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
double *radius = atom->radius;
|
double *radius = atom->radius;
|
||||||
int *type = atom->type;
|
int *type = atom->type;
|
||||||
int *mask = atom->mask;
|
int *mask = atom->mask;
|
||||||
tagint *molecule = atom->molecule;
|
tagint *molecule = atom->molecule;
|
||||||
@ -84,10 +84,10 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list)
|
|||||||
radi = radius[i];
|
radi = radius[i];
|
||||||
|
|
||||||
ibin = atom2bin[i];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
// loop through stencils for all collections
|
// loop through stencils for all collections
|
||||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||||
|
|
||||||
// if same collection use own bin
|
// if same collection use own bin
|
||||||
if(icollection == jcollection) jbin = ibin;
|
if(icollection == jcollection) jbin = ibin;
|
||||||
else jbin = coord2bin(x[i], jcollection);
|
else jbin = coord2bin(x[i], jcollection);
|
||||||
@ -97,18 +97,18 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list)
|
|||||||
|
|
||||||
if(icollection == jcollection) js = bins[i];
|
if(icollection == jcollection) js = bins[i];
|
||||||
else js = binhead_multi[jcollection][jbin];
|
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 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 different collections,
|
||||||
// if j is owned atom, store it if j > i
|
// 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]) {
|
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 (j >= nlocal) {
|
||||||
if (x[j][2] < ztmp) continue;
|
if (x[j][2] < ztmp) continue;
|
||||||
if (x[j][2] == ztmp) {
|
if (x[j][2] == ztmp) {
|
||||||
@ -116,38 +116,38 @@ void NPairHalfSizeMultiNewtonOmp::build(NeighList *list)
|
|||||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
radsum = radi + radius[j];
|
radsum = radi + radius[j];
|
||||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||||
|
|
||||||
if (rsq <= cutdistsq) {
|
if (rsq <= cutdistsq) {
|
||||||
if (history && rsq < radsum*radsum)
|
if (history && rsq < radsum*radsum)
|
||||||
neighptr[n++] = j ^ mask_history;
|
neighptr[n++] = j ^ mask_history;
|
||||||
else
|
else
|
||||||
neighptr[n++] = j;
|
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 empty if i larger than j
|
||||||
// stencil is half if i same size as j
|
// stencil is half if i same size as j
|
||||||
// stencil is full if i smaller than j
|
// stencil is full if i smaller than j
|
||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
for (j = js; j >= 0; j = bins[j]) {
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
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;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
radsum = radi + radius[j];
|
radsum = radi + radius[j];
|
||||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||||
|
|
||||||
if (rsq <= cutdistsq) {
|
if (rsq <= cutdistsq) {
|
||||||
if (history && rsq < radsum*radsum)
|
if (history && rsq < radsum*radsum)
|
||||||
neighptr[n++] = j ^ mask_history;
|
neighptr[n++] = j ^ mask_history;
|
||||||
else
|
else
|
||||||
neighptr[n++] = j;
|
neighptr[n++] = j;
|
||||||
|
|||||||
@ -32,14 +32,14 @@ NPairHalfSizeMultiNewtonTriOmp::NPairHalfSizeMultiNewtonTriOmp(LAMMPS *lmp) :
|
|||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
size particles
|
size particles
|
||||||
binned neighbor list construction with Newton's 3rd law for triclinic
|
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
|
each owned atom i checks its own bin and other bins in triclinic stencil
|
||||||
every pair stored exactly once by some processor
|
every pair stored exactly once by some processor
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list)
|
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 history = list->history;
|
||||||
const int mask_history = 3 << SBBITS;
|
const int mask_history = 3 << SBBITS;
|
||||||
|
|
||||||
@ -59,7 +59,7 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list)
|
|||||||
|
|
||||||
int *collection = neighbor->collection;
|
int *collection = neighbor->collection;
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
double *radius = atom->radius;
|
double *radius = atom->radius;
|
||||||
int *type = atom->type;
|
int *type = atom->type;
|
||||||
int *mask = atom->mask;
|
int *mask = atom->mask;
|
||||||
tagint *molecule = atom->molecule;
|
tagint *molecule = atom->molecule;
|
||||||
@ -105,12 +105,12 @@ void NPairHalfSizeMultiNewtonTriOmp::build(NeighList *list)
|
|||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
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(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
||||||
if (x[j][2] < ztmp) continue;
|
if (x[j][2] < ztmp) continue;
|
||||||
if (x[j][2] == ztmp) {
|
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) continue;
|
||||||
if (x[j][0] == xtmp && j <= i) continue;
|
if (x[j][0] == xtmp && j <= i) continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
radsum = radi + radius[j];
|
radsum = radi + radius[j];
|
||||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||||
|
|
||||||
if (rsq <= cutdistsq) {
|
if (rsq <= cutdistsq) {
|
||||||
if (history && rsq < radsum*radsum)
|
if (history && rsq < radsum*radsum)
|
||||||
neighptr[n++] = j ^ mask_history;
|
neighptr[n++] = j ^ mask_history;
|
||||||
else
|
else
|
||||||
neighptr[n++] = j;
|
neighptr[n++] = j;
|
||||||
|
|||||||
@ -361,7 +361,7 @@ void Comm::modify_params(int narg, char **arg)
|
|||||||
memory->create(cutusermulti,ncollections_cutoff,"comm:cutusermulti");
|
memory->create(cutusermulti,ncollections_cutoff,"comm:cutusermulti");
|
||||||
for (i=0; i < ncollections_cutoff; ++i)
|
for (i=0; i < ncollections_cutoff; ++i)
|
||||||
cutusermulti[i] = -1.0;
|
cutusermulti[i] = -1.0;
|
||||||
}
|
}
|
||||||
utils::bounds(FLERR,arg[iarg+1],1,ncollections_cutoff+1,nlo,nhi,error);
|
utils::bounds(FLERR,arg[iarg+1],1,ncollections_cutoff+1,nlo,nhi,error);
|
||||||
cut = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
cut = utils::numeric(FLERR,arg[iarg+2],false,lmp);
|
||||||
cutghostuser = MAX(cutghostuser,cut);
|
cutghostuser = MAX(cutghostuser,cut);
|
||||||
@ -752,7 +752,7 @@ double Comm::get_comm_cutoff()
|
|||||||
if (neighbor->interval_collection_flag) {
|
if (neighbor->interval_collection_flag) {
|
||||||
for (int i = 0; i < neighbor->ncollections; i++){
|
for (int i = 0; i < neighbor->ncollections; i++){
|
||||||
maxcommcutoff = MAX(maxcommcutoff, neighbor->collection2cut[i]);
|
maxcommcutoff = MAX(maxcommcutoff, neighbor->collection2cut[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return maxcommcutoff;
|
return maxcommcutoff;
|
||||||
|
|||||||
@ -43,13 +43,11 @@ using namespace LAMMPS_NS;
|
|||||||
CommBrick::CommBrick(LAMMPS *lmp) :
|
CommBrick::CommBrick(LAMMPS *lmp) :
|
||||||
Comm(lmp),
|
Comm(lmp),
|
||||||
sendnum(nullptr), recvnum(nullptr), sendproc(nullptr), recvproc(nullptr),
|
sendnum(nullptr), recvnum(nullptr), sendproc(nullptr), recvproc(nullptr),
|
||||||
size_forward_recv(nullptr),
|
size_forward_recv(nullptr), size_reverse_send(nullptr), size_reverse_recv(nullptr),
|
||||||
size_reverse_send(nullptr), size_reverse_recv(nullptr),
|
|
||||||
slablo(nullptr), slabhi(nullptr), multilo(nullptr), multihi(nullptr),
|
slablo(nullptr), slabhi(nullptr), multilo(nullptr), multihi(nullptr),
|
||||||
cutghostmulti(nullptr), pbc_flag(nullptr), pbc(nullptr), firstrecv(nullptr),
|
multioldlo(nullptr), multioldhi(nullptr), cutghostmulti(nullptr), cutghostmultiold(nullptr),
|
||||||
multioldlo(nullptr), multioldhi(nullptr), cutghostmultiold(nullptr),
|
pbc_flag(nullptr), pbc(nullptr), firstrecv(nullptr), sendlist(nullptr),
|
||||||
sendlist(nullptr), localsendlist(nullptr), maxsendlist(nullptr),
|
localsendlist(nullptr), maxsendlist(nullptr), buf_send(nullptr), buf_recv(nullptr)
|
||||||
buf_send(nullptr), buf_recv(nullptr)
|
|
||||||
{
|
{
|
||||||
style = 0;
|
style = 0;
|
||||||
layout = Comm::LAYOUT_UNIFORM;
|
layout = Comm::LAYOUT_UNIFORM;
|
||||||
@ -141,44 +139,44 @@ void CommBrick::init()
|
|||||||
// memory for multi style communication
|
// memory for multi style communication
|
||||||
// allocate in setup
|
// allocate in setup
|
||||||
|
|
||||||
if (mode == Comm::MULTI) {
|
if (mode == Comm::MULTI) {
|
||||||
// If inconsitent # of collections, destroy any preexisting arrays (may be missized)
|
// If inconsitent # of collections, destroy any preexisting arrays (may be missized)
|
||||||
if (ncollections != neighbor->ncollections) {
|
if (ncollections != neighbor->ncollections) {
|
||||||
ncollections = neighbor->ncollections;
|
ncollections = neighbor->ncollections;
|
||||||
if (multilo != nullptr) {
|
if (multilo != nullptr) {
|
||||||
free_multi();
|
free_multi();
|
||||||
memory->destroy(cutghostmulti);
|
memory->destroy(cutghostmulti);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete any old user cutoffs if # of collections chanaged
|
// delete any old user cutoffs if # of collections chanaged
|
||||||
if (cutusermulti && ncollections != ncollections_cutoff) {
|
if (cutusermulti && ncollections != ncollections_cutoff) {
|
||||||
if(me == 0) error->warning(FLERR, "cutoff/multi settings discarded, must be defined"
|
if(me == 0) error->warning(FLERR, "cutoff/multi settings discarded, must be defined"
|
||||||
" after customizing collections in neigh_modify");
|
" after customizing collections in neigh_modify");
|
||||||
memory->destroy(cutusermulti);
|
memory->destroy(cutusermulti);
|
||||||
cutusermulti = nullptr;
|
cutusermulti = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (multilo == nullptr) {
|
if (multilo == nullptr) {
|
||||||
allocate_multi(maxswap);
|
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) {
|
if ((mode == Comm::SINGLE || mode == Comm::MULTIOLD) && multilo) {
|
||||||
free_multi();
|
free_multi();
|
||||||
memory->destroy(cutghostmulti);
|
memory->destroy(cutghostmulti);
|
||||||
}
|
}
|
||||||
|
|
||||||
// memory for multi/old-style communication
|
// memory for multi/old-style communication
|
||||||
|
|
||||||
if (mode == Comm::MULTIOLD && multioldlo == nullptr) {
|
if (mode == Comm::MULTIOLD && multioldlo == nullptr) {
|
||||||
allocate_multiold(maxswap);
|
allocate_multiold(maxswap);
|
||||||
memory->create(cutghostmultiold,atom->ntypes+1,3,"comm:cutghostmultiold");
|
memory->create(cutghostmultiold,atom->ntypes+1,3,"comm:cutghostmultiold");
|
||||||
}
|
}
|
||||||
if ((mode == Comm::SINGLE || mode == Comm::MULTI) && multioldlo) {
|
if ((mode == Comm::SINGLE || mode == Comm::MULTI) && multioldlo) {
|
||||||
free_multiold();
|
free_multiold();
|
||||||
memory->destroy(cutghostmultiold);
|
memory->destroy(cutghostmultiold);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
@ -201,7 +199,7 @@ void CommBrick::setup()
|
|||||||
// cutghostmulti = same as cutghost, only for each atom collection
|
// cutghostmulti = same as cutghost, only for each atom collection
|
||||||
// for multi/old:
|
// for multi/old:
|
||||||
// cutghostmultiold = same as cutghost, only for each atom type
|
// cutghostmultiold = same as cutghost, only for each atom type
|
||||||
|
|
||||||
int i,j;
|
int i,j;
|
||||||
int ntypes = atom->ntypes;
|
int ntypes = atom->ntypes;
|
||||||
double *prd,*sublo,*subhi;
|
double *prd,*sublo,*subhi;
|
||||||
@ -213,10 +211,10 @@ void CommBrick::setup()
|
|||||||
|
|
||||||
if (mode == Comm::MULTI) {
|
if (mode == Comm::MULTI) {
|
||||||
double **cutcollectionsq = neighbor->cutcollectionsq;
|
double **cutcollectionsq = neighbor->cutcollectionsq;
|
||||||
|
|
||||||
// build collection array for atom exchange
|
// build collection array for atom exchange
|
||||||
neighbor->build_collection(0);
|
neighbor->build_collection(0);
|
||||||
|
|
||||||
// If using multi/reduce, communicate particles a distance equal
|
// If using multi/reduce, communicate particles a distance equal
|
||||||
// to the max cutoff with equally sized or smaller collections
|
// to the max cutoff with equally sized or smaller collections
|
||||||
// If not, communicate the maximum cutoff of the entire collection
|
// If not, communicate the maximum cutoff of the entire collection
|
||||||
@ -230,7 +228,7 @@ void CommBrick::setup()
|
|||||||
cutghostmulti[i][1] = 0.0;
|
cutghostmulti[i][1] = 0.0;
|
||||||
cutghostmulti[i][2] = 0.0;
|
cutghostmulti[i][2] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < ncollections; j++){
|
for (j = 0; j < ncollections; j++){
|
||||||
if (multi_reduce && (cutcollectionsq[j][j] > cutcollectionsq[i][i])) continue;
|
if (multi_reduce && (cutcollectionsq[j][j] > cutcollectionsq[i][i])) continue;
|
||||||
cutghostmulti[i][0] = MAX(cutghostmulti[i][0],sqrt(cutcollectionsq[i][j]));
|
cutghostmulti[i][0] = MAX(cutghostmulti[i][0],sqrt(cutcollectionsq[i][j]));
|
||||||
@ -239,7 +237,7 @@ void CommBrick::setup()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == Comm::MULTIOLD) {
|
if (mode == Comm::MULTIOLD) {
|
||||||
double *cuttype = neighbor->cuttype;
|
double *cuttype = neighbor->cuttype;
|
||||||
for (i = 1; i <= ntypes; i++) {
|
for (i = 1; i <= ntypes; i++) {
|
||||||
@ -275,7 +273,7 @@ void CommBrick::setup()
|
|||||||
cutghostmulti[i][2] *= length2;
|
cutghostmulti[i][2] *= length2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == Comm::MULTIOLD) {
|
if (mode == Comm::MULTIOLD) {
|
||||||
for (i = 1; i <= ntypes; i++) {
|
for (i = 1; i <= ntypes; i++) {
|
||||||
cutghostmultiold[i][0] *= length0;
|
cutghostmultiold[i][0] *= length0;
|
||||||
@ -902,7 +900,7 @@ void CommBrick::borders()
|
|||||||
if (nsend == maxsendlist[iswap]) grow_list(iswap,nsend);
|
if (nsend == maxsendlist[iswap]) grow_list(iswap,nsend);
|
||||||
sendlist[iswap][nsend++] = i;
|
sendlist[iswap][nsend++] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ngroup = atom->nfirst;
|
ngroup = atom->nfirst;
|
||||||
for (i = 0; i < ngroup; i++) {
|
for (i = 0; i < ngroup; i++) {
|
||||||
@ -973,7 +971,7 @@ void CommBrick::borders()
|
|||||||
nprior = atom->nlocal + atom->nghost;
|
nprior = atom->nlocal + atom->nghost;
|
||||||
atom->nghost += nrecv;
|
atom->nghost += nrecv;
|
||||||
if (neighbor->style == Neighbor::MULTI) neighbor->build_collection(nprior);
|
if (neighbor->style == Neighbor::MULTI) neighbor->build_collection(nprior);
|
||||||
|
|
||||||
iswap++;
|
iswap++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -122,24 +122,24 @@ void CommTiled::init()
|
|||||||
nswap = 2*domain->dimension;
|
nswap = 2*domain->dimension;
|
||||||
|
|
||||||
memory->destroy(cutghostmulti);
|
memory->destroy(cutghostmulti);
|
||||||
if (mode == Comm::MULTI) {
|
if (mode == Comm::MULTI) {
|
||||||
// If inconsitent # of collections, destroy any preexisting arrays (may be missized)
|
// If inconsitent # of collections, destroy any preexisting arrays (may be missized)
|
||||||
if (ncollections != neighbor->ncollections) {
|
if (ncollections != neighbor->ncollections) {
|
||||||
ncollections = neighbor->ncollections;
|
ncollections = neighbor->ncollections;
|
||||||
}
|
}
|
||||||
|
|
||||||
// delete any old user cutoffs if # of collections chanaged
|
// delete any old user cutoffs if # of collections chanaged
|
||||||
if (cutusermulti && ncollections != ncollections_cutoff) {
|
if (cutusermulti && ncollections != ncollections_cutoff) {
|
||||||
if(me == 0) error->warning(FLERR, "cutoff/multi settings discarded, must be defined"
|
if(me == 0) error->warning(FLERR, "cutoff/multi settings discarded, must be defined"
|
||||||
" after customizing collections in neigh_modify");
|
" after customizing collections in neigh_modify");
|
||||||
memory->destroy(cutusermulti);
|
memory->destroy(cutusermulti);
|
||||||
cutusermulti = nullptr;
|
cutusermulti = nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
// grow sendbox_multi now that ncollections is known
|
// grow sendbox_multi now that ncollections is known
|
||||||
for (int i = 0; i < maxswap; i ++)
|
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");
|
memory->create(cutghostmulti,ncollections,3,"comm:cutghostmulti");
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,13 +201,13 @@ void CommTiled::setup()
|
|||||||
|
|
||||||
// set cutoff for comm forward and comm reverse
|
// set cutoff for comm forward and comm reverse
|
||||||
// check that cutoff < any periodic box length
|
// check that cutoff < any periodic box length
|
||||||
|
|
||||||
if (mode == Comm::MULTI) {
|
if (mode == Comm::MULTI) {
|
||||||
double **cutcollectionsq = neighbor->cutcollectionsq;
|
double **cutcollectionsq = neighbor->cutcollectionsq;
|
||||||
|
|
||||||
// build collection array for atom exchange
|
// build collection array for atom exchange
|
||||||
neighbor->build_collection(0);
|
neighbor->build_collection(0);
|
||||||
|
|
||||||
// If using multi/reduce, communicate particles a distance equal
|
// If using multi/reduce, communicate particles a distance equal
|
||||||
// to the max cutoff with equally sized or smaller collections
|
// to the max cutoff with equally sized or smaller collections
|
||||||
// If not, communicate the maximum cutoff of the entire collection
|
// If not, communicate the maximum cutoff of the entire collection
|
||||||
@ -221,7 +221,7 @@ void CommTiled::setup()
|
|||||||
cutghostmulti[i][1] = 0.0;
|
cutghostmulti[i][1] = 0.0;
|
||||||
cutghostmulti[i][2] = 0.0;
|
cutghostmulti[i][2] = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (j = 0; j < ncollections; j++){
|
for (j = 0; j < ncollections; j++){
|
||||||
if (multi_reduce && (cutcollectionsq[j][j] > cutcollectionsq[i][i])) continue;
|
if (multi_reduce && (cutcollectionsq[j][j] > cutcollectionsq[i][i])) continue;
|
||||||
cutghostmulti[i][0] = MAX(cutghostmulti[i][0],sqrt(cutcollectionsq[i][j]));
|
cutghostmulti[i][0] = MAX(cutghostmulti[i][0],sqrt(cutcollectionsq[i][j]));
|
||||||
@ -230,7 +230,7 @@ void CommTiled::setup()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == Comm::MULTIOLD) {
|
if (mode == Comm::MULTIOLD) {
|
||||||
double *cuttype = neighbor->cuttype;
|
double *cuttype = neighbor->cuttype;
|
||||||
for (i = 1; i <= ntypes; i++) {
|
for (i = 1; i <= ntypes; i++) {
|
||||||
@ -264,7 +264,7 @@ void CommTiled::setup()
|
|||||||
cutghostmulti[i][2] *= length2;
|
cutghostmulti[i][2] *= length2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mode == Comm::MULTIOLD) {
|
if (mode == Comm::MULTIOLD) {
|
||||||
for (i = 1; i <= ntypes; i++) {
|
for (i = 1; i <= ntypes; i++) {
|
||||||
cutghostmultiold[i][0] *= length0;
|
cutghostmultiold[i][0] *= length0;
|
||||||
@ -1051,9 +1051,9 @@ void CommTiled::borders()
|
|||||||
double *bbox;
|
double *bbox;
|
||||||
double **x;
|
double **x;
|
||||||
AtomVec *avec = atom->avec;
|
AtomVec *avec = atom->avec;
|
||||||
|
|
||||||
// After exchanging, need to reconstruct collection array for border communication
|
// 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 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
|
// 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)
|
void CommTiled::grow_swap_send_multi(int i, int n)
|
||||||
{
|
{
|
||||||
memory->destroy(sendbox_multi[i]);
|
memory->destroy(sendbox_multi[i]);
|
||||||
|
|
||||||
if (ncollections > 0)
|
if (ncollections > 0)
|
||||||
memory->create(sendbox_multi[i],n,ncollections,6,"comm:sendbox_multi");
|
memory->create(sendbox_multi[i],n,ncollections,6,"comm:sendbox_multi");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -373,12 +373,12 @@ void Info::command(int narg, char **arg)
|
|||||||
for (int j=0; j < neighbor->ncollections; ++j) {
|
for (int j=0; j < neighbor->ncollections; ++j) {
|
||||||
cut = MAX(cut,sqrt(neighbor->cutcollectionsq[i][j]));
|
cut = MAX(cut,sqrt(neighbor->cutcollectionsq[i][j]));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comm->cutusermulti) cut = MAX(cut,comm->cutusermulti[i]);
|
if (comm->cutusermulti) cut = MAX(cut,comm->cutusermulti[i]);
|
||||||
fmt::print(out,"Communication cutoff for collection {} = {:.8}\n", i, cut);
|
fmt::print(out,"Communication cutoff for collection {} = {:.8}\n", i, cut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (comm->mode == 2) {
|
if (comm->mode == 2) {
|
||||||
fputs("Communication mode = multi/old\n",out);
|
fputs("Communication mode = multi/old\n",out);
|
||||||
double cut;
|
double cut;
|
||||||
|
|||||||
10
src/nbin.cpp
10
src/nbin.cpp
@ -61,9 +61,9 @@ NBin::~NBin()
|
|||||||
memory->destroy(binhead);
|
memory->destroy(binhead);
|
||||||
memory->destroy(bins);
|
memory->destroy(bins);
|
||||||
memory->destroy(atom2bin);
|
memory->destroy(atom2bin);
|
||||||
|
|
||||||
if (!binhead_multi) return;
|
if (!binhead_multi) return;
|
||||||
|
|
||||||
memory->destroy(nbinx_multi);
|
memory->destroy(nbinx_multi);
|
||||||
memory->destroy(nbiny_multi);
|
memory->destroy(nbiny_multi);
|
||||||
memory->destroy(nbinz_multi);
|
memory->destroy(nbinz_multi);
|
||||||
@ -87,7 +87,7 @@ NBin::~NBin()
|
|||||||
}
|
}
|
||||||
delete [] binhead_multi;
|
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;
|
binsize_user = neighbor->binsize_user;
|
||||||
bboxlo = neighbor->bboxlo;
|
bboxlo = neighbor->bboxlo;
|
||||||
bboxhi = neighbor->bboxhi;
|
bboxhi = neighbor->bboxhi;
|
||||||
|
|
||||||
ncollections = neighbor->ncollections;
|
ncollections = neighbor->ncollections;
|
||||||
cutcollectionsq = neighbor->cutcollectionsq;
|
cutcollectionsq = neighbor->cutcollectionsq;
|
||||||
|
|
||||||
@ -206,7 +206,7 @@ int NBin::coord2bin_multi(double *x, int ic)
|
|||||||
} else
|
} else
|
||||||
iz = static_cast<int> ((x[2]-bboxlo[2])*bininvz_multi[ic]) - 1;
|
iz = static_cast<int> ((x[2]-bboxlo[2])*bininvz_multi[ic]) - 1;
|
||||||
|
|
||||||
|
|
||||||
ibin = (iz-mbinzlo_multi[ic])*mbiny_multi[ic]*mbinx_multi[ic]
|
ibin = (iz-mbinzlo_multi[ic])*mbiny_multi[ic]*mbinx_multi[ic]
|
||||||
+ (iy-mbinylo_multi[ic])*mbinx_multi[ic]
|
+ (iy-mbinylo_multi[ic])*mbinx_multi[ic]
|
||||||
+ (ix-mbinxlo_multi[ic]);
|
+ (ix-mbinxlo_multi[ic]);
|
||||||
|
|||||||
10
src/nbin.h
10
src/nbin.h
@ -22,7 +22,7 @@ class NBin : protected Pointers {
|
|||||||
public:
|
public:
|
||||||
int istyle; // 1-N index into binnames
|
int istyle; // 1-N index into binnames
|
||||||
bigint last_bin; // last timestep atoms were binned
|
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
|
// Variables for NBinStandard
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ class NBin : protected Pointers {
|
|||||||
int *atom2bin; // bin assignment for each atom (local+ghost)
|
int *atom2bin; // bin assignment for each atom (local+ghost)
|
||||||
|
|
||||||
// Analogues for NBinMultimulti
|
// Analogues for NBinMultimulti
|
||||||
|
|
||||||
int *nbinx_multi, *nbiny_multi, *nbinz_multi;
|
int *nbinx_multi, *nbiny_multi, *nbinz_multi;
|
||||||
int *mbins_multi;
|
int *mbins_multi;
|
||||||
int *mbinx_multi, *mbiny_multi, *mbinz_multi;
|
int *mbinx_multi, *mbiny_multi, *mbinz_multi;
|
||||||
@ -48,7 +48,7 @@ class NBin : protected Pointers {
|
|||||||
double *bininvx_multi, *bininvy_multi, *bininvz_multi;
|
double *bininvx_multi, *bininvy_multi, *bininvz_multi;
|
||||||
|
|
||||||
int **binhead_multi;
|
int **binhead_multi;
|
||||||
|
|
||||||
NBin(class LAMMPS *);
|
NBin(class LAMMPS *);
|
||||||
~NBin();
|
~NBin();
|
||||||
void post_constructor(class NeighRequest *);
|
void post_constructor(class NeighRequest *);
|
||||||
@ -82,7 +82,7 @@ class NBin : protected Pointers {
|
|||||||
int triclinic;
|
int triclinic;
|
||||||
|
|
||||||
// data for standard NBin
|
// data for standard NBin
|
||||||
|
|
||||||
int maxatom; // size of bins array
|
int maxatom; // size of bins array
|
||||||
int maxbin; // size of binhead array
|
int maxbin; // size of binhead array
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ class NBin : protected Pointers {
|
|||||||
// methods
|
// methods
|
||||||
|
|
||||||
int coord2bin(double *);
|
int coord2bin(double *);
|
||||||
int coord2bin_multi(double *, int);
|
int coord2bin_multi(double *, int);
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -34,10 +34,10 @@ NBinMulti::NBinMulti(LAMMPS *lmp) : NBin(lmp) {}
|
|||||||
setup for bin_atoms()
|
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]
|
// binhead_multi[n] = per-bin vector mbins in length mbins_multi[n]
|
||||||
|
|
||||||
for (int n = 0; n < maxcollections; n++) {
|
for (int n = 0; n < maxcollections; n++) {
|
||||||
if (mbins_multi[n] > maxbins_multi[n]) {
|
if (mbins_multi[n] > maxbins_multi[n]) {
|
||||||
maxbins_multi[n] = mbins_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
|
// Clear any/all memory for existing groupings
|
||||||
for (n = 0; n < maxcollections; n++)
|
for (n = 0; n < maxcollections; n++)
|
||||||
memory->destroy(binhead_multi[n]);
|
memory->destroy(binhead_multi[n]);
|
||||||
|
|
||||||
delete [] binhead_multi;
|
delete [] binhead_multi;
|
||||||
|
|
||||||
maxcollections = ncollections;
|
maxcollections = ncollections;
|
||||||
@ -136,7 +136,7 @@ void NBinMulti::setup_bins(int /*style*/)
|
|||||||
|
|
||||||
memory->destroy(maxbins_multi);
|
memory->destroy(maxbins_multi);
|
||||||
memory->create(maxbins_multi, maxcollections, "neigh:maxbins_multi");
|
memory->create(maxbins_multi, maxcollections, "neigh:maxbins_multi");
|
||||||
|
|
||||||
// ensure reallocation occurs in bin_atoms_setup()
|
// ensure reallocation occurs in bin_atoms_setup()
|
||||||
for (n = 0; n < maxcollections; n++) {
|
for (n = 0; n < maxcollections; n++) {
|
||||||
maxbins_multi[n] = 0;
|
maxbins_multi[n] = 0;
|
||||||
@ -147,7 +147,7 @@ void NBinMulti::setup_bins(int /*style*/)
|
|||||||
// Identify smallest collection
|
// Identify smallest collection
|
||||||
int icollectionmin = 0;
|
int icollectionmin = 0;
|
||||||
for (n = 0; n < ncollections; n++)
|
for (n = 0; n < ncollections; n++)
|
||||||
if (cutcollectionsq[n][n] < cutcollectionsq[icollectionmin][icollectionmin])
|
if (cutcollectionsq[n][n] < cutcollectionsq[icollectionmin][icollectionmin])
|
||||||
icollectionmin = n;
|
icollectionmin = n;
|
||||||
|
|
||||||
// bbox = size of bbox of entire domain
|
// bbox = size of bbox of entire domain
|
||||||
@ -279,7 +279,7 @@ void NBinMulti::setup_bins(int /*style*/)
|
|||||||
} else mbinzlo_multi[n] = mbinzhi = 0;
|
} else mbinzlo_multi[n] = mbinzhi = 0;
|
||||||
mbinz_multi[n] = mbinzhi - mbinzlo_multi[n] + 1;
|
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;
|
* ((bigint) mbiny_multi[n]) * ((bigint) mbinz_multi[n]) + 1;
|
||||||
if (bbin > MAXSMALLINT) error->one(FLERR,"Too many neighbor bins");
|
if (bbin > MAXSMALLINT) error->one(FLERR,"Too many neighbor bins");
|
||||||
mbins_multi[n] = bbin;
|
mbins_multi[n] = bbin;
|
||||||
@ -327,7 +327,7 @@ void NBinMulti::bin_atoms()
|
|||||||
binhead_multi[n][ibin] = i;
|
binhead_multi[n][ibin] = i;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = nall-1; i >= 0; i--) {
|
for (i = nall-1; i >= 0; i--) {
|
||||||
n = collection[i];
|
n = collection[i];
|
||||||
ibin = coord2bin_multi(x[i], n);
|
ibin = coord2bin_multi(x[i], n);
|
||||||
atom2bin[i] = ibin;
|
atom2bin[i] = ibin;
|
||||||
@ -344,6 +344,6 @@ double NBinMulti::memory_usage()
|
|||||||
double bytes = 0;
|
double bytes = 0;
|
||||||
for (int m = 0; m < maxcollections; m++)
|
for (int m = 0; m < maxcollections; m++)
|
||||||
bytes += (double)maxbins_multi[m]*sizeof(int);
|
bytes += (double)maxbins_multi[m]*sizeof(int);
|
||||||
bytes += (double)2*maxatom*sizeof(int);
|
bytes += (double)2*maxatom*sizeof(int);
|
||||||
return bytes;
|
return bytes;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -30,7 +30,7 @@ class NBinStandard : public NBin {
|
|||||||
public:
|
public:
|
||||||
NBinStandard(class LAMMPS *);
|
NBinStandard(class LAMMPS *);
|
||||||
~NBinStandard() {}
|
~NBinStandard() {}
|
||||||
void bin_atoms_setup(int);
|
void bin_atoms_setup(int);
|
||||||
void setup_bins(int);
|
void setup_bins(int);
|
||||||
void bin_atoms();
|
void bin_atoms();
|
||||||
double memory_usage();
|
double memory_usage();
|
||||||
|
|||||||
@ -88,7 +88,7 @@ static const char cite_neigh_multi[] =
|
|||||||
"@article{Stratford2018,\n"
|
"@article{Stratford2018,\n"
|
||||||
" author = {Stratford, Kevin and Shire, Tom and Hanley, Kevin},\n"
|
" author = {Stratford, Kevin and Shire, Tom and Hanley, Kevin},\n"
|
||||||
" title = {Implementation of multi-level contact detection in LAMMPS},\n"
|
" title = {Implementation of multi-level contact detection in LAMMPS},\n"
|
||||||
" year = {2018}\n"
|
" year = {2018}\n"
|
||||||
"}\n\n"
|
"}\n\n"
|
||||||
"@article{Shire2020,\n"
|
"@article{Shire2020,\n"
|
||||||
" author = {Shire, Tom and Hanley, Kevin J. and Stratford, Kevin},\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;
|
ex_mol_group = ex_mol_bit = ex_mol_intra = nullptr;
|
||||||
|
|
||||||
// Multi data
|
// Multi data
|
||||||
|
|
||||||
type2collection = nullptr;
|
type2collection = nullptr;
|
||||||
collection2cut = nullptr;
|
collection2cut = nullptr;
|
||||||
collection = nullptr;
|
collection = nullptr;
|
||||||
@ -270,7 +270,7 @@ Neighbor::~Neighbor()
|
|||||||
memory->destroy(ex_mol_group);
|
memory->destroy(ex_mol_group);
|
||||||
delete [] ex_mol_bit;
|
delete [] ex_mol_bit;
|
||||||
memory->destroy(ex_mol_intra);
|
memory->destroy(ex_mol_intra);
|
||||||
|
|
||||||
memory->destroy(type2collection);
|
memory->destroy(type2collection);
|
||||||
memory->destroy(collection2cut);
|
memory->destroy(collection2cut);
|
||||||
memory->destroy(collection);
|
memory->destroy(collection);
|
||||||
@ -361,19 +361,19 @@ void Neighbor::init()
|
|||||||
// Define cutoffs for multi
|
// Define cutoffs for multi
|
||||||
if (style == Neighbor::MULTI) {
|
if (style == Neighbor::MULTI) {
|
||||||
int icollection, jcollection;
|
int icollection, jcollection;
|
||||||
|
|
||||||
// If collections not yet defined, create default map using types
|
// If collections not yet defined, create default map using types
|
||||||
if (not custom_collection_flag) {
|
if (not custom_collection_flag) {
|
||||||
ncollections = n;
|
ncollections = n;
|
||||||
interval_collection_flag = 0;
|
interval_collection_flag = 0;
|
||||||
if (not type2collection)
|
if (not type2collection)
|
||||||
memory->create(type2collection,n+1,"neigh:type2collection");
|
memory->create(type2collection,n+1,"neigh:type2collection");
|
||||||
for (i = 1; i <= n; i++)
|
for (i = 1; i <= n; i++)
|
||||||
type2collection[i] = i-1;
|
type2collection[i] = i-1;
|
||||||
}
|
}
|
||||||
|
|
||||||
memory->grow(cutcollectionsq, ncollections, ncollections, "neigh:cutcollectionsq");
|
memory->grow(cutcollectionsq, ncollections, ncollections, "neigh:cutcollectionsq");
|
||||||
|
|
||||||
// 3 possible ways of defining collections
|
// 3 possible ways of defining collections
|
||||||
// 1) Types are used to define collections
|
// 1) Types are used to define collections
|
||||||
// Each collection loops through its owned types, and uses cutneighsq to calculate its cutoff
|
// 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]
|
// 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
|
// Each collection loops through its owned types, and uses cutneighsq to calculate its cutoff
|
||||||
// 3) Collections are defined by intervals, finite particles
|
// 3) Collections are defined by intervals, finite particles
|
||||||
//
|
//
|
||||||
|
|
||||||
// Define collection cutoffs
|
// Define collection cutoffs
|
||||||
for (i = 0; i < ncollections; i++)
|
for (i = 0; i < ncollections; i++)
|
||||||
for (j = 0; j < ncollections; j++)
|
for (j = 0; j < ncollections; j++)
|
||||||
cutcollectionsq[i][j] = 0.0;
|
cutcollectionsq[i][j] = 0.0;
|
||||||
|
|
||||||
if (not interval_collection_flag) {
|
if (not interval_collection_flag) {
|
||||||
finite_cut_flag = 0;
|
finite_cut_flag = 0;
|
||||||
for (i = 1; i <= n; i++){
|
for (i = 1; i <= n; i++){
|
||||||
icollection = type2collection[i];
|
icollection = type2collection[i];
|
||||||
@ -403,26 +403,26 @@ void Neighbor::init()
|
|||||||
} else {
|
} else {
|
||||||
if (force->pair->finitecutflag) {
|
if (force->pair->finitecutflag) {
|
||||||
finite_cut_flag = 1;
|
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;
|
double ri, rj, tmp;
|
||||||
for (i = 0; i < ncollections; i++){
|
for (i = 0; i < ncollections; i++){
|
||||||
ri = collection2cut[i]*0.5;
|
ri = collection2cut[i]*0.5;
|
||||||
for (j = 0; j < ncollections; j++){
|
for (j = 0; j < ncollections; j++){
|
||||||
rj = collection2cut[j]*0.5;
|
rj = collection2cut[j]*0.5;
|
||||||
tmp = force->pair->radii2cut(ri, rj) + skin;
|
tmp = force->pair->radii2cut(ri, rj) + skin;
|
||||||
cutcollectionsq[i][j] = tmp*tmp;
|
cutcollectionsq[i][j] = tmp*tmp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
finite_cut_flag = 0;
|
finite_cut_flag = 0;
|
||||||
|
|
||||||
// Map types to collections
|
// Map types to collections
|
||||||
if (not type2collection)
|
if (not type2collection)
|
||||||
memory->create(type2collection,n+1,"neigh:type2collection");
|
memory->create(type2collection,n+1,"neigh:type2collection");
|
||||||
|
|
||||||
for (i = 1; i <= n; i++)
|
for (i = 1; i <= n; i++)
|
||||||
type2collection[i] = -1;
|
type2collection[i] = -1;
|
||||||
|
|
||||||
double cuttmp;
|
double cuttmp;
|
||||||
for (i = 1; i <= n; i++){
|
for (i = 1; i <= n; i++){
|
||||||
// Remove skin added to cutneighsq
|
// Remove skin added to cutneighsq
|
||||||
@ -433,11 +433,11 @@ void Neighbor::init()
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type2collection[i] == -1)
|
if (type2collection[i] == -1)
|
||||||
error->all(FLERR, "Pair cutoff exceeds interval cutoffs for multi");
|
error->all(FLERR, "Pair cutoff exceeds interval cutoffs for multi");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Define cutoffs
|
// Define cutoffs
|
||||||
for (i = 1; i <= n; i++){
|
for (i = 1; i <= n; i++){
|
||||||
icollection = type2collection[i];
|
icollection = type2collection[i];
|
||||||
@ -448,7 +448,7 @@ void Neighbor::init()
|
|||||||
cutcollectionsq[jcollection][icollection] = cutneighsq[i][j];
|
cutcollectionsq[jcollection][icollection] = cutneighsq[i][j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2216,7 +2216,7 @@ void Neighbor::build(int topoflag)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// bin atoms for all NBin instances
|
// bin atoms for all NBin instances
|
||||||
// not just NBin associated with perpetual lists, also occasional lists
|
// not just NBin associated with perpetual lists, also occasional lists
|
||||||
// b/c cannot wait to bin occasional lists in build_one() call
|
// 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) {
|
} else if (strcmp(arg[iarg+1],"none") == 0) {
|
||||||
nex_type = nex_group = nex_mol = 0;
|
nex_type = nex_group = nex_mol = 0;
|
||||||
iarg += 2;
|
iarg += 2;
|
||||||
|
|
||||||
} else error->all(FLERR,"Illegal neigh_modify command");
|
} else error->all(FLERR,"Illegal neigh_modify command");
|
||||||
} else if (strcmp(arg[iarg],"collection/interval") == 0) {
|
} else if (strcmp(arg[iarg],"collection/interval") == 0) {
|
||||||
if (style != Neighbor::MULTI)
|
if (style != Neighbor::MULTI)
|
||||||
error->all(FLERR,"Cannot use collection/interval command without multi setting");
|
error->all(FLERR,"Cannot use collection/interval command without multi setting");
|
||||||
|
|
||||||
if (iarg+2 > narg)
|
if (iarg+2 > narg)
|
||||||
error->all(FLERR,"Invalid collection/interval command");
|
error->all(FLERR,"Invalid collection/interval command");
|
||||||
ncollections = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
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");
|
error->all(FLERR,"Invalid collection/interval command");
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
// Invalidate old user cutoffs
|
// Invalidate old user cutoffs
|
||||||
comm->ncollections_cutoff = 0;
|
comm->ncollections_cutoff = 0;
|
||||||
interval_collection_flag = 1;
|
interval_collection_flag = 1;
|
||||||
custom_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
|
// Set upper cutoff for each collection
|
||||||
|
|
||||||
@ -2525,34 +2525,34 @@ void Neighbor::modify_params(int narg, char **arg)
|
|||||||
for (i = 0; i < ncollections; i++){
|
for (i = 0; i < ncollections; i++){
|
||||||
cut_interval = utils::numeric(FLERR,arg[iarg+2+i],false,lmp);
|
cut_interval = utils::numeric(FLERR,arg[iarg+2+i],false,lmp);
|
||||||
collection2cut[i] = cut_interval;
|
collection2cut[i] = cut_interval;
|
||||||
|
|
||||||
if (i != 0)
|
if (i != 0)
|
||||||
if (collection2cut[i-1] >= collection2cut[i])
|
if (collection2cut[i-1] >= collection2cut[i])
|
||||||
error->all(FLERR,"Nonsequential interval cutoffs in collection/interval setting");
|
error->all(FLERR,"Nonsequential interval cutoffs in collection/interval setting");
|
||||||
}
|
}
|
||||||
|
|
||||||
iarg += 2 + ncollections;
|
iarg += 2 + ncollections;
|
||||||
} else if (strcmp(arg[iarg],"collection/type") == 0) {
|
} else if (strcmp(arg[iarg],"collection/type") == 0) {
|
||||||
if (style != Neighbor::MULTI)
|
if (style != Neighbor::MULTI)
|
||||||
error->all(FLERR,"Cannot use collection/type command without multi setting");
|
error->all(FLERR,"Cannot use collection/type command without multi setting");
|
||||||
|
|
||||||
if (iarg+2 > narg)
|
if (iarg+2 > narg)
|
||||||
error->all(FLERR,"Invalid collection/type command");
|
error->all(FLERR,"Invalid collection/type command");
|
||||||
ncollections = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
ncollections = utils::inumeric(FLERR,arg[iarg+1],false,lmp);
|
||||||
if (ncollections < 1)
|
if (ncollections < 1)
|
||||||
error->all(FLERR,"Invalid collection/interval command");
|
error->all(FLERR,"Invalid collection/interval command");
|
||||||
if (iarg+1+ncollections > narg)
|
if (iarg+1+ncollections > narg)
|
||||||
error->all(FLERR,"Invalid collection/type command");
|
error->all(FLERR,"Invalid collection/type command");
|
||||||
|
|
||||||
int ntypes = atom->ntypes;
|
int ntypes = atom->ntypes;
|
||||||
int n, nlo, nhi, i, j, k;
|
int n, nlo, nhi, i, j, k;
|
||||||
|
|
||||||
// Invalidate old user cutoffs
|
// Invalidate old user cutoffs
|
||||||
comm->ncollections_cutoff = 0;
|
comm->ncollections_cutoff = 0;
|
||||||
interval_collection_flag = 0;
|
interval_collection_flag = 0;
|
||||||
custom_collection_flag = 1;
|
custom_collection_flag = 1;
|
||||||
if (not type2collection)
|
if (not type2collection)
|
||||||
memory->create(type2collection,ntypes+1,"neigh:type2collection");
|
memory->create(type2collection,ntypes+1,"neigh:type2collection");
|
||||||
|
|
||||||
// Erase previous mapping
|
// Erase previous mapping
|
||||||
for (i = 1; i <= ntypes; i++)
|
for (i = 1; i <= ntypes; i++)
|
||||||
@ -2567,28 +2567,28 @@ void Neighbor::modify_params(int narg, char **arg)
|
|||||||
strcpy(str,arg[iarg+2+i]);
|
strcpy(str,arg[iarg+2+i]);
|
||||||
std::vector<std::string> words = Tokenizer(str, ",").as_vector();
|
std::vector<std::string> words = Tokenizer(str, ",").as_vector();
|
||||||
nfield = words.size();
|
nfield = words.size();
|
||||||
|
|
||||||
for (j = 0; j < nfield; j++) {
|
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);
|
utils::bounds(FLERR,field,1,ntypes,nlo,nhi,error);
|
||||||
|
|
||||||
for (k = nlo; k <= nhi; k++) {
|
for (k = nlo; k <= nhi; k++) {
|
||||||
if (type2collection[k] != -1)
|
if (type2collection[k] != -1)
|
||||||
error->all(FLERR,"Type specified more than once in collection/type commnd");
|
error->all(FLERR,"Type specified more than once in collection/type commnd");
|
||||||
type2collection[k] = i;
|
type2collection[k] = i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
delete [] str;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check for undefined atom type
|
delete [] str;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Check for undefined atom type
|
||||||
for (i = 1; i <= ntypes; i++){
|
for (i = 1; i <= ntypes; i++){
|
||||||
if (type2collection[i] == -1) {
|
if (type2collection[i] == -1) {
|
||||||
error->all(FLERR,"Type missing in collection/type commnd");
|
error->all(FLERR,"Type missing in collection/type commnd");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
iarg += 2 + ncollections;
|
iarg += 2 + ncollections;
|
||||||
} else error->all(FLERR,"Illegal neigh_modify command");
|
} else error->all(FLERR,"Illegal neigh_modify command");
|
||||||
}
|
}
|
||||||
@ -2671,21 +2671,21 @@ void Neighbor::build_collection(int istart)
|
|||||||
nmax_collection = nmax+DELTA_PERATOM;
|
nmax_collection = nmax+DELTA_PERATOM;
|
||||||
memory->grow(collection, nmax_collection, "neigh:collection");
|
memory->grow(collection, nmax_collection, "neigh:collection");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (finite_cut_flag) {
|
if (finite_cut_flag) {
|
||||||
double cut;
|
double cut;
|
||||||
int icollection;
|
int icollection;
|
||||||
for (int i = istart; i < nmax; i++){
|
for (int i = istart; i < nmax; i++){
|
||||||
cut = force->pair->atom2cut(i);
|
cut = force->pair->atom2cut(i);
|
||||||
collection[i] = -1;
|
collection[i] = -1;
|
||||||
|
|
||||||
for (icollection = 0; icollection < ncollections; icollection++){
|
for (icollection = 0; icollection < ncollections; icollection++){
|
||||||
if (collection2cut[icollection] >= cut) {
|
if (collection2cut[icollection] >= cut) {
|
||||||
collection[i] = icollection;
|
collection[i] = icollection;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (collection[i] == -1)
|
if (collection[i] == -1)
|
||||||
error->one(FLERR, "Atom cutoff exceeds interval cutoffs for multi");
|
error->one(FLERR, "Atom cutoff exceeds interval cutoffs for multi");
|
||||||
}
|
}
|
||||||
@ -2693,7 +2693,7 @@ void Neighbor::build_collection(int istart)
|
|||||||
int *type = atom->type;
|
int *type = atom->type;
|
||||||
for (int i = istart; i < nmax; i++){
|
for (int i = istart; i < nmax; i++){
|
||||||
collection[i] = type2collection[type[i]];
|
collection[i] = type2collection[type[i]];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -103,7 +103,7 @@ class Neighbor : protected Pointers {
|
|||||||
int **improperlist;
|
int **improperlist;
|
||||||
|
|
||||||
// optional type grouping for multi
|
// optional type grouping for multi
|
||||||
|
|
||||||
int custom_collection_flag; // 1 if custom collections are defined 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 interval_collection_flag; // 1 if custom collections use intervals
|
||||||
int finite_cut_flag; // 1 if multi considers finite atom size
|
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 *collection2cut; // ncollection array with upper bounds on cutoff intervals
|
||||||
double **cutcollectionsq; // cutoffs for each combination of collections
|
double **cutcollectionsq; // cutoffs for each combination of collections
|
||||||
int *collection; // local per-atom array to store collection id
|
int *collection; // local per-atom array to store collection id
|
||||||
|
|
||||||
// public methods
|
// public methods
|
||||||
|
|
||||||
Neighbor(class LAMMPS *);
|
Neighbor(class LAMMPS *);
|
||||||
|
|||||||
@ -96,7 +96,7 @@ void NPair::copy_neighbor_info()
|
|||||||
special_flag = neighbor->special_flag;
|
special_flag = neighbor->special_flag;
|
||||||
|
|
||||||
// multi info
|
// multi info
|
||||||
|
|
||||||
ncollections = neighbor->ncollections;
|
ncollections = neighbor->ncollections;
|
||||||
cutcollectionsq = neighbor->cutcollectionsq;
|
cutcollectionsq = neighbor->cutcollectionsq;
|
||||||
|
|
||||||
@ -183,7 +183,7 @@ void NPair::build_setup()
|
|||||||
{
|
{
|
||||||
if (nb) copy_bin_info();
|
if (nb) copy_bin_info();
|
||||||
if (ns) copy_stencil_info();
|
if (ns) copy_stencil_info();
|
||||||
|
|
||||||
// set here, since build_setup() always called before build()
|
// set here, since build_setup() always called before build()
|
||||||
last_build = update->ntimestep;
|
last_build = update->ntimestep;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -50,7 +50,7 @@ class NPair : protected Pointers {
|
|||||||
double *bboxlo,*bboxhi;
|
double *bboxlo,*bboxhi;
|
||||||
int ncollections;
|
int ncollections;
|
||||||
double **cutcollectionsq;
|
double **cutcollectionsq;
|
||||||
|
|
||||||
// exclusion data from Neighbor class
|
// exclusion data from Neighbor class
|
||||||
|
|
||||||
int nex_type; // # of entries in type exclusion list
|
int nex_type; // # of entries in type exclusion list
|
||||||
@ -99,7 +99,7 @@ class NPair : protected Pointers {
|
|||||||
|
|
||||||
int ** nstencil_multi;
|
int ** nstencil_multi;
|
||||||
int *** stencil_multi;
|
int *** stencil_multi;
|
||||||
|
|
||||||
// data common to all NPair variants
|
// data common to all NPair variants
|
||||||
|
|
||||||
int molecular;
|
int molecular;
|
||||||
|
|||||||
@ -30,7 +30,7 @@ NPairFullMulti::NPairFullMulti(LAMMPS *lmp) : NPair(lmp) {}
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
binned neighbor list construction for all neighbors
|
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
|
every neighbor pair appears in list of both atoms i and j
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
|
|
||||||
@ -82,7 +82,7 @@ void NPairFullMulti::build(NeighList *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ibin = atom2bin[i];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
// loop through stencils for all collections
|
// loop through stencils for all collections
|
||||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||||
|
|
||||||
@ -96,20 +96,20 @@ void NPairFullMulti::build(NeighList *list)
|
|||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
for (j = js; j >= 0; j = bins[j]) {
|
||||||
if (i == j) continue;
|
if (i == j) continue;
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
|
||||||
if (rsq <= cutneighsq[itype][jtype]) {
|
if (rsq <= cutneighsq[itype][jtype]) {
|
||||||
if (molecular != Atom::ATOMIC) {
|
if (molecular != Atom::ATOMIC) {
|
||||||
if (!moltemplate)
|
if (!moltemplate)
|
||||||
|
|||||||
@ -30,7 +30,7 @@ NPairHalfMultiNewtoff::NPairHalfMultiNewtoff(LAMMPS *lmp) : NPair(lmp) {}
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
binned neighbor list construction with partial Newton's 3rd law
|
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
|
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 once if i,j are both owned and i < j
|
||||||
pair stored by me if j is ghost (also stored by proc owning 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];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
// loop through stencils for all collections
|
// loop through stencils for all collections
|
||||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||||
|
|
||||||
// if same collection use own bin
|
// if same collection use own bin
|
||||||
if (icollection == jcollection) jbin = ibin;
|
if (icollection == jcollection) jbin = ibin;
|
||||||
else jbin = coord2bin(x[i], jcollection);
|
else jbin = coord2bin(x[i], jcollection);
|
||||||
|
|
||||||
// loop over all atoms in other bins in stencil including self
|
// loop over all atoms in other bins in stencil including self
|
||||||
// only store pair if i < j
|
// only store pair if i < j
|
||||||
// stores own/own pairs only once
|
// 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
|
// use full stencil for all collection combinations
|
||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
for (j = js; j >= 0; j = bins[j]) {
|
||||||
if (j <= i) continue;
|
if (j <= i) continue;
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
|
||||||
if (rsq <= cutneighsq[itype][jtype]) {
|
if (rsq <= cutneighsq[itype][jtype]) {
|
||||||
if (molecular != Atom::ATOMIC) {
|
if (molecular != Atom::ATOMIC) {
|
||||||
if (!moltemplate)
|
if (!moltemplate)
|
||||||
|
|||||||
@ -83,31 +83,31 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ibin = atom2bin[i];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
// loop through stencils for all collections
|
// loop through stencils for all collections
|
||||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||||
|
|
||||||
// if same collection use own bin
|
// if same collection use own bin
|
||||||
if(icollection == jcollection) jbin = ibin;
|
if(icollection == jcollection) jbin = ibin;
|
||||||
else jbin = coord2bin(x[i], jcollection);
|
else jbin = coord2bin(x[i], jcollection);
|
||||||
|
|
||||||
// if same size: uses half stencil so check central bin
|
// if same size: uses half stencil so check central bin
|
||||||
if(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
if(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
||||||
|
|
||||||
if (icollection == jcollection) js = bins[i];
|
if (icollection == jcollection) js = bins[i];
|
||||||
else js = binhead_multi[jcollection][jbin];
|
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 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 different collections,
|
||||||
// if j is owned atom, store it if j > i
|
// 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]) {
|
for (j = js; j >= 0; j = bins[j]) {
|
||||||
if((icollection != jcollection) && (j < i)) continue;
|
if((icollection != jcollection) && (j < i)) continue;
|
||||||
|
|
||||||
if (j >= nlocal) {
|
if (j >= nlocal) {
|
||||||
if (x[j][2] < ztmp) continue;
|
if (x[j][2] < ztmp) continue;
|
||||||
if (x[j][2] == ztmp) {
|
if (x[j][2] == ztmp) {
|
||||||
@ -115,15 +115,15 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
|||||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
|
||||||
if (rsq <= cutneighsq[itype][jtype]) {
|
if (rsq <= cutneighsq[itype][jtype]) {
|
||||||
if (molecular) {
|
if (molecular) {
|
||||||
if (!moltemplate)
|
if (!moltemplate)
|
||||||
@ -139,29 +139,29 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
|||||||
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
else if (which > 0) neighptr[n++] = j ^ (which << SBBITS);
|
||||||
} else neighptr[n++] = j;
|
} 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 empty if i larger than j
|
||||||
// stencil is half if i same size as j
|
// stencil is half if i same size as j
|
||||||
// stencil is full if i smaller than j
|
// stencil is full if i smaller than j
|
||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
for (j = js; j >= 0; j = bins[j]) {
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
|
||||||
if (rsq <= cutneighsq[itype][jtype]) {
|
if (rsq <= cutneighsq[itype][jtype]) {
|
||||||
if (molecular != Atom::ATOMIC) {
|
if (molecular != Atom::ATOMIC) {
|
||||||
if (!moltemplate)
|
if (!moltemplate)
|
||||||
@ -180,7 +180,7 @@ void NPairHalfMultiNewton::build(NeighList *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ilist[inum++] = i;
|
ilist[inum++] = i;
|
||||||
firstneigh[i] = neighptr;
|
firstneigh[i] = neighptr;
|
||||||
numneigh[i] = n;
|
numneigh[i] = n;
|
||||||
|
|||||||
@ -30,7 +30,7 @@ NPairHalfMultiNewtonTri::NPairHalfMultiNewtonTri(LAMMPS *lmp) : NPair(lmp) {}
|
|||||||
|
|
||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
binned neighbor list construction with Newton's 3rd law for triclinic
|
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
|
each owned atom i checks its own bin and other bins in triclinic stencil
|
||||||
every pair stored exactly once by some processor
|
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;
|
double xtmp,ytmp,ztmp,delx,dely,delz,rsq;
|
||||||
int *neighptr,*s;
|
int *neighptr,*s;
|
||||||
int js;
|
int js;
|
||||||
|
|
||||||
int *collection = neighbor->collection;
|
int *collection = neighbor->collection;
|
||||||
double **x = atom->x;
|
double **x = atom->x;
|
||||||
int *type = atom->type;
|
int *type = atom->type;
|
||||||
@ -83,14 +83,14 @@ void NPairHalfMultiNewtonTri::build(NeighList *list)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ibin = atom2bin[i];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
// loop through stencils for all collections
|
// loop through stencils for all collections
|
||||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||||
|
|
||||||
// if same collection use own bin
|
// if same collection use own bin
|
||||||
if (icollection == jcollection) jbin = ibin;
|
if (icollection == jcollection) jbin = ibin;
|
||||||
else jbin = coord2bin(x[i], jcollection);
|
else jbin = coord2bin(x[i], jcollection);
|
||||||
|
|
||||||
// loop over all atoms in bins in stencil
|
// loop over all atoms in bins in stencil
|
||||||
// stencil is empty if i larger than j
|
// stencil is empty if i larger than j
|
||||||
// stencil is half if i same size as j
|
// stencil is half if i same size as j
|
||||||
@ -102,12 +102,12 @@ void NPairHalfMultiNewtonTri::build(NeighList *list)
|
|||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
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(cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
||||||
if (x[j][2] < ztmp) continue;
|
if (x[j][2] < ztmp) continue;
|
||||||
if (x[j][2] == ztmp) {
|
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) continue;
|
||||||
if (x[j][0] == xtmp && j <= i) continue;
|
if (x[j][0] == xtmp && j <= i) continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
|
|
||||||
if (rsq <= cutneighsq[itype][jtype]) {
|
if (rsq <= cutneighsq[itype][jtype]) {
|
||||||
if (molecular != Atom::ATOMIC) {
|
if (molecular != Atom::ATOMIC) {
|
||||||
if (!moltemplate)
|
if (!moltemplate)
|
||||||
@ -145,7 +145,7 @@ void NPairHalfMultiNewtonTri::build(NeighList *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ilist[inum++] = i;
|
ilist[inum++] = i;
|
||||||
firstneigh[i] = neighptr;
|
firstneigh[i] = neighptr;
|
||||||
numneigh[i] = n;
|
numneigh[i] = n;
|
||||||
|
|||||||
@ -29,7 +29,7 @@ NPairHalfSizeMultiNewtoff::NPairHalfSizeMultiNewtoff(LAMMPS *lmp) : NPair(lmp) {
|
|||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
size particles
|
size particles
|
||||||
binned neighbor list construction with partial Newton's 3rd law
|
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
|
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 once if i,j are both owned and i < j
|
||||||
pair stored by me if j is ghost (also stored by proc owning 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];
|
radi = radius[i];
|
||||||
|
|
||||||
ibin = atom2bin[i];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
// loop through stencils for all collections
|
// loop through stencils for all collections
|
||||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||||
|
|
||||||
// if same collection use own bin
|
// if same collection use own bin
|
||||||
if (icollection == jcollection) jbin = ibin;
|
if (icollection == jcollection) jbin = ibin;
|
||||||
else jbin = coord2bin(x[i], jcollection);
|
else jbin = coord2bin(x[i], jcollection);
|
||||||
|
|
||||||
// loop over all atoms in other bins in stencil including self
|
// loop over all atoms in other bins in stencil including self
|
||||||
// only store pair if i < j
|
// only store pair if i < j
|
||||||
// stores own/own pairs only once
|
// 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
|
// use full stencil for all collection combinations
|
||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
for (j = js; j >= 0; j = bins[j]) {
|
||||||
if (j <= i) continue;
|
if (j <= i) continue;
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
@ -107,7 +107,7 @@ void NPairHalfSizeMultiNewtoff::build(NeighList *list)
|
|||||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||||
|
|
||||||
if (rsq <= cutdistsq) {
|
if (rsq <= cutdistsq) {
|
||||||
if (history && rsq < radsum*radsum)
|
if (history && rsq < radsum*radsum)
|
||||||
neighptr[n++] = j ^ mask_history;
|
neighptr[n++] = j ^ mask_history;
|
||||||
else
|
else
|
||||||
neighptr[n++] = j;
|
neighptr[n++] = j;
|
||||||
|
|||||||
@ -71,10 +71,10 @@ void NPairHalfSizeMultiNewton::build(NeighList *list)
|
|||||||
radi = radius[i];
|
radi = radius[i];
|
||||||
|
|
||||||
ibin = atom2bin[i];
|
ibin = atom2bin[i];
|
||||||
|
|
||||||
// loop through stencils for all collections
|
// loop through stencils for all collections
|
||||||
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
for (jcollection = 0; jcollection < ncollections; jcollection++) {
|
||||||
|
|
||||||
// if same collection use own bin
|
// if same collection use own bin
|
||||||
if (icollection == jcollection) jbin = ibin;
|
if (icollection == jcollection) jbin = ibin;
|
||||||
else jbin = coord2bin(x[i], jcollection);
|
else jbin = coord2bin(x[i], jcollection);
|
||||||
@ -84,18 +84,18 @@ void NPairHalfSizeMultiNewton::build(NeighList *list)
|
|||||||
|
|
||||||
if (icollection == jcollection) js = bins[i];
|
if (icollection == jcollection) js = bins[i];
|
||||||
else js = binhead_multi[jcollection][jbin];
|
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 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 different collections,
|
||||||
// if j is owned atom, store it if j > i
|
// 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]) {
|
for (j = js; j >= 0; j = bins[j]) {
|
||||||
if ((icollection != jcollection) && (j < i)) continue;
|
if ((icollection != jcollection) && (j < i)) continue;
|
||||||
|
|
||||||
if (j >= nlocal) {
|
if (j >= nlocal) {
|
||||||
if (x[j][2] < ztmp) continue;
|
if (x[j][2] < ztmp) continue;
|
||||||
if (x[j][2] == ztmp) {
|
if (x[j][2] == ztmp) {
|
||||||
@ -103,50 +103,50 @@ void NPairHalfSizeMultiNewton::build(NeighList *list)
|
|||||||
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
if (x[j][1] == ytmp && x[j][0] < xtmp) continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
radsum = radi + radius[j];
|
radsum = radi + radius[j];
|
||||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||||
|
|
||||||
if (rsq <= cutdistsq) {
|
if (rsq <= cutdistsq) {
|
||||||
if (history && rsq < radsum*radsum)
|
if (history && rsq < radsum*radsum)
|
||||||
neighptr[n++] = j ^ mask_history;
|
neighptr[n++] = j ^ mask_history;
|
||||||
else
|
else
|
||||||
neighptr[n++] = j;
|
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 empty if i larger than j
|
||||||
// stencil is half if i same size as j
|
// stencil is half if i same size as j
|
||||||
// stencil is full if i smaller than j
|
// stencil is full if i smaller than j
|
||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
for (j = js; j >= 0; j = bins[j]) {
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
radsum = radi + radius[j];
|
radsum = radi + radius[j];
|
||||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||||
|
|
||||||
if (rsq <= cutdistsq) {
|
if (rsq <= cutdistsq) {
|
||||||
if (history && rsq < radsum*radsum)
|
if (history && rsq < radsum*radsum)
|
||||||
neighptr[n++] = j ^ mask_history;
|
neighptr[n++] = j ^ mask_history;
|
||||||
else
|
else
|
||||||
neighptr[n++] = j;
|
neighptr[n++] = j;
|
||||||
@ -154,7 +154,7 @@ void NPairHalfSizeMultiNewton::build(NeighList *list)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ilist[inum++] = i;
|
ilist[inum++] = i;
|
||||||
firstneigh[i] = neighptr;
|
firstneigh[i] = neighptr;
|
||||||
numneigh[i] = n;
|
numneigh[i] = n;
|
||||||
|
|||||||
@ -44,4 +44,4 @@ E: Neighbor list overflow, boost neigh_modify one
|
|||||||
|
|
||||||
UNDOCUMENTED
|
UNDOCUMENTED
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -28,7 +28,7 @@ NPairHalfSizeMultiNewtonTri::NPairHalfSizeMultiNewtonTri(LAMMPS *lmp) : NPair(lm
|
|||||||
/* ----------------------------------------------------------------------
|
/* ----------------------------------------------------------------------
|
||||||
size particles
|
size particles
|
||||||
binned neighbor list construction with Newton's 3rd law for triclinic
|
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
|
each owned atom i checks its own bin and other bins in triclinic stencil
|
||||||
every pair stored exactly once by some processor
|
every pair stored exactly once by some processor
|
||||||
------------------------------------------------------------------------- */
|
------------------------------------------------------------------------- */
|
||||||
@ -90,12 +90,12 @@ void NPairHalfSizeMultiNewtonTri::build(NeighList *list)
|
|||||||
|
|
||||||
s = stencil_multi[icollection][jcollection];
|
s = stencil_multi[icollection][jcollection];
|
||||||
ns = nstencil_multi[icollection][jcollection];
|
ns = nstencil_multi[icollection][jcollection];
|
||||||
|
|
||||||
for (k = 0; k < ns; k++) {
|
for (k = 0; k < ns; k++) {
|
||||||
js = binhead_multi[jcollection][jbin + s[k]];
|
js = binhead_multi[jcollection][jbin + s[k]];
|
||||||
for (j = js; j >= 0; j = bins[j]) {
|
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 (cutcollectionsq[icollection][icollection] == cutcollectionsq[jcollection][jcollection]){
|
||||||
if (x[j][2] < ztmp) continue;
|
if (x[j][2] < ztmp) continue;
|
||||||
if (x[j][2] == ztmp) {
|
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) continue;
|
||||||
if (x[j][0] == xtmp && j <= i) continue;
|
if (x[j][0] == xtmp && j <= i) continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
jtype = type[j];
|
jtype = type[j];
|
||||||
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
if (exclude && exclusion(i,j,itype,jtype,mask,molecule)) continue;
|
||||||
|
|
||||||
delx = xtmp - x[j][0];
|
delx = xtmp - x[j][0];
|
||||||
dely = ytmp - x[j][1];
|
dely = ytmp - x[j][1];
|
||||||
delz = ztmp - x[j][2];
|
delz = ztmp - x[j][2];
|
||||||
rsq = delx*delx + dely*dely + delz*delz;
|
rsq = delx*delx + dely*dely + delz*delz;
|
||||||
radsum = radi + radius[j];
|
radsum = radi + radius[j];
|
||||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||||
|
|
||||||
if (rsq <= cutdistsq) {
|
if (rsq <= cutdistsq) {
|
||||||
if (history && rsq < radsum*radsum)
|
if (history && rsq < radsum*radsum)
|
||||||
neighptr[n++] = j ^ mask_history;
|
neighptr[n++] = j ^ mask_history;
|
||||||
else
|
else
|
||||||
neighptr[n++] = j;
|
neighptr[n++] = j;
|
||||||
|
|||||||
@ -44,4 +44,4 @@ E: Neighbor list overflow, boost neigh_modify one
|
|||||||
|
|
||||||
UNDOCUMENTED
|
UNDOCUMENTED
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|||||||
@ -94,9 +94,9 @@ void NPairHalfSizeMultiOldNewton::build(NeighList *list)
|
|||||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||||
|
|
||||||
if (rsq <= cutdistsq) {
|
if (rsq <= cutdistsq) {
|
||||||
if (history && rsq < radsum*radsum)
|
if (history && rsq < radsum*radsum)
|
||||||
neighptr[n++] = j ^ mask_history;
|
neighptr[n++] = j ^ mask_history;
|
||||||
else
|
else
|
||||||
neighptr[n++] = j;
|
neighptr[n++] = j;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -124,7 +124,7 @@ void NPairHalfSizeMultiOldNewton::build(NeighList *list)
|
|||||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||||
|
|
||||||
if (rsq <= cutdistsq) {
|
if (rsq <= cutdistsq) {
|
||||||
if (history && rsq < radsum*radsum)
|
if (history && rsq < radsum*radsum)
|
||||||
neighptr[n++] = j ^ mask_history;
|
neighptr[n++] = j ^ mask_history;
|
||||||
else
|
else
|
||||||
neighptr[n++] = j;
|
neighptr[n++] = j;
|
||||||
|
|||||||
@ -106,7 +106,7 @@ void NPairHalfSizeMultiOldNewtonTri::build(NeighList *list)
|
|||||||
cutdistsq = (radsum+skin) * (radsum+skin);
|
cutdistsq = (radsum+skin) * (radsum+skin);
|
||||||
|
|
||||||
if (rsq <= cutdistsq) {
|
if (rsq <= cutdistsq) {
|
||||||
if (history && rsq < radsum*radsum)
|
if (history && rsq < radsum*radsum)
|
||||||
neighptr[n++] = j ^ mask_history;
|
neighptr[n++] = j ^ mask_history;
|
||||||
else
|
else
|
||||||
neighptr[n++] = j;
|
neighptr[n++] = j;
|
||||||
|
|||||||
118
src/nstencil.cpp
118
src/nstencil.cpp
@ -31,7 +31,7 @@ using namespace LAMMPS_NS;
|
|||||||
sx,sy,sz = bin bounds = furthest the stencil could possibly extend
|
sx,sy,sz = bin bounds = furthest the stencil could possibly extend
|
||||||
calculated below in create_setup()
|
calculated below in create_setup()
|
||||||
3d creates xyz stencil, 2d creates xy stencil
|
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
|
use a full stencil
|
||||||
stencil is all surrounding bins including self
|
stencil is all surrounding bins including self
|
||||||
regardless of triclinic
|
regardless of triclinic
|
||||||
@ -57,7 +57,7 @@ using namespace LAMMPS_NS;
|
|||||||
a half list with newton on has a half same-collection stencil
|
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
|
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
|
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
|
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
|
cutoff is not cutneighmaxsq, but max cutoff for that atom collection
|
||||||
no versions that allow ghost on (any need for it?)
|
no versions that allow ghost on (any need for it?)
|
||||||
@ -74,15 +74,15 @@ NStencil::NStencil(LAMMPS *lmp) : Pointers(lmp)
|
|||||||
nstencil_multi_old = nullptr;
|
nstencil_multi_old = nullptr;
|
||||||
stencil_multi_old = nullptr;
|
stencil_multi_old = nullptr;
|
||||||
distsq_multi_old = nullptr;
|
distsq_multi_old = nullptr;
|
||||||
|
|
||||||
nstencil_multi = nullptr;
|
nstencil_multi = nullptr;
|
||||||
stencil_multi = nullptr;
|
stencil_multi = nullptr;
|
||||||
maxstencil_multi = nullptr;
|
maxstencil_multi = nullptr;
|
||||||
|
|
||||||
flag_half_multi = nullptr;
|
flag_half_multi = nullptr;
|
||||||
flag_skip_multi = nullptr;
|
flag_skip_multi = nullptr;
|
||||||
bin_collection_multi = nullptr;
|
bin_collection_multi = nullptr;
|
||||||
|
|
||||||
maxcollections = 0;
|
maxcollections = 0;
|
||||||
|
|
||||||
dimension = domain->dimension;
|
dimension = domain->dimension;
|
||||||
@ -106,9 +106,9 @@ NStencil::~NStencil()
|
|||||||
delete [] stencil_multi_old;
|
delete [] stencil_multi_old;
|
||||||
delete [] distsq_multi_old;
|
delete [] distsq_multi_old;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (maxstencil_multi) {
|
if (maxstencil_multi) {
|
||||||
|
|
||||||
memory->destroy(nstencil_multi);
|
memory->destroy(nstencil_multi);
|
||||||
for (int i = 0; i < maxcollections; i++) {
|
for (int i = 0; i < maxcollections; i++) {
|
||||||
for (int j = 0; j < maxcollections; j++)
|
for (int j = 0; j < maxcollections; j++)
|
||||||
@ -120,7 +120,7 @@ NStencil::~NStencil()
|
|||||||
memory->destroy(flag_half_multi);
|
memory->destroy(flag_half_multi);
|
||||||
memory->destroy(flag_skip_multi);
|
memory->destroy(flag_skip_multi);
|
||||||
memory->destroy(bin_collection_multi);
|
memory->destroy(bin_collection_multi);
|
||||||
|
|
||||||
memory->destroy(stencil_sx_multi);
|
memory->destroy(stencil_sx_multi);
|
||||||
memory->destroy(stencil_sy_multi);
|
memory->destroy(stencil_sy_multi);
|
||||||
memory->destroy(stencil_sz_multi);
|
memory->destroy(stencil_sz_multi);
|
||||||
@ -128,7 +128,7 @@ NStencil::~NStencil()
|
|||||||
memory->destroy(stencil_mbinx_multi);
|
memory->destroy(stencil_mbinx_multi);
|
||||||
memory->destroy(stencil_mbiny_multi);
|
memory->destroy(stencil_mbiny_multi);
|
||||||
memory->destroy(stencil_mbinz_multi);
|
memory->destroy(stencil_mbinz_multi);
|
||||||
|
|
||||||
memory->destroy(stencil_binsizex_multi);
|
memory->destroy(stencil_binsizex_multi);
|
||||||
memory->destroy(stencil_binsizey_multi);
|
memory->destroy(stencil_binsizey_multi);
|
||||||
memory->destroy(stencil_binsizez_multi);
|
memory->destroy(stencil_binsizez_multi);
|
||||||
@ -154,7 +154,7 @@ void NStencil::copy_neighbor_info()
|
|||||||
cutneighmaxsq = neighbor->cutneighmaxsq;
|
cutneighmaxsq = neighbor->cutneighmaxsq;
|
||||||
cuttypesq = neighbor->cuttypesq;
|
cuttypesq = neighbor->cuttypesq;
|
||||||
cutneighsq = neighbor->cutneighsq;
|
cutneighsq = neighbor->cutneighsq;
|
||||||
|
|
||||||
ncollections = neighbor->ncollections;
|
ncollections = neighbor->ncollections;
|
||||||
collection = neighbor->collection;
|
collection = neighbor->collection;
|
||||||
cutcollectionsq = neighbor->cutcollectionsq;
|
cutcollectionsq = neighbor->cutcollectionsq;
|
||||||
@ -209,15 +209,15 @@ void NStencil::copy_bin_info_multi()
|
|||||||
|
|
||||||
void NStencil::create_setup()
|
void NStencil::create_setup()
|
||||||
{
|
{
|
||||||
|
|
||||||
if (neighstyle != Neighbor::MULTI){
|
if (neighstyle != Neighbor::MULTI){
|
||||||
if (nb) copy_bin_info();
|
if (nb) copy_bin_info();
|
||||||
last_stencil = update->ntimestep;
|
last_stencil = update->ntimestep;
|
||||||
|
|
||||||
// sx,sy,sz = max range of stencil in each dim
|
// sx,sy,sz = max range of stencil in each dim
|
||||||
// smax = max possible size of entire 3d stencil
|
// smax = max possible size of entire 3d stencil
|
||||||
// stencil will be empty if cutneighmax = 0.0
|
// stencil will be empty if cutneighmax = 0.0
|
||||||
|
|
||||||
sx = static_cast<int> (cutneighmax*bininvx);
|
sx = static_cast<int> (cutneighmax*bininvx);
|
||||||
if (sx*binsizex < cutneighmax) sx++;
|
if (sx*binsizex < cutneighmax) sx++;
|
||||||
sy = static_cast<int> (cutneighmax*bininvy);
|
sy = static_cast<int> (cutneighmax*bininvy);
|
||||||
@ -225,12 +225,12 @@ void NStencil::create_setup()
|
|||||||
sz = static_cast<int> (cutneighmax*bininvz);
|
sz = static_cast<int> (cutneighmax*bininvz);
|
||||||
if (sz*binsizez < cutneighmax) sz++;
|
if (sz*binsizez < cutneighmax) sz++;
|
||||||
if (dimension == 2) sz = 0;
|
if (dimension == 2) sz = 0;
|
||||||
|
|
||||||
int smax = (2*sx+1) * (2*sy+1) * (2*sz+1);
|
int smax = (2*sx+1) * (2*sy+1) * (2*sz+1);
|
||||||
|
|
||||||
// reallocate stencil structs if necessary
|
// reallocate stencil structs if necessary
|
||||||
// for BIN and MULTI_OLD styles
|
// for BIN and MULTI_OLD styles
|
||||||
|
|
||||||
if (neighstyle == Neighbor::BIN) {
|
if (neighstyle == Neighbor::BIN) {
|
||||||
if (smax > maxstencil) {
|
if (smax > maxstencil) {
|
||||||
maxstencil = smax;
|
maxstencil = smax;
|
||||||
@ -241,7 +241,7 @@ void NStencil::create_setup()
|
|||||||
memory->create(stencilxyz,maxstencil,3,"neighstencil:stencilxyz");
|
memory->create(stencilxyz,maxstencil,3,"neighstencil:stencilxyz");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
int i;
|
int i;
|
||||||
int n = atom->ntypes;
|
int n = atom->ntypes;
|
||||||
@ -271,19 +271,19 @@ void NStencil::create_setup()
|
|||||||
int i, j, bin_collection, smax;
|
int i, j, bin_collection, smax;
|
||||||
double stencil_range;
|
double stencil_range;
|
||||||
int n = ncollections;
|
int n = ncollections;
|
||||||
|
|
||||||
if (nb) copy_bin_info_multi();
|
if (nb) copy_bin_info_multi();
|
||||||
|
|
||||||
// Deallocate arrays if previously allocated
|
// Deallocate arrays if previously allocated
|
||||||
if((n > maxcollections) && stencil_multi){
|
if((n > maxcollections) && stencil_multi){
|
||||||
memory->destroy(nstencil_multi);
|
memory->destroy(nstencil_multi);
|
||||||
for (i = 0; i < maxcollections; i++) {
|
for (i = 0; i < maxcollections; i++) {
|
||||||
for (j = 0; j < maxcollections; j++)
|
for (j = 0; j < maxcollections; j++)
|
||||||
memory->destroy(stencil_multi[i][j]);
|
memory->destroy(stencil_multi[i][j]);
|
||||||
delete [] stencil_multi[i];
|
delete [] stencil_multi[i];
|
||||||
}
|
}
|
||||||
delete [] stencil_multi;
|
delete [] stencil_multi;
|
||||||
memory->destroy(maxstencil_multi);
|
memory->destroy(maxstencil_multi);
|
||||||
memory->destroy(flag_half_multi);
|
memory->destroy(flag_half_multi);
|
||||||
memory->destroy(flag_skip_multi);
|
memory->destroy(flag_skip_multi);
|
||||||
memory->destroy(bin_collection_multi);
|
memory->destroy(bin_collection_multi);
|
||||||
@ -295,39 +295,39 @@ void NStencil::create_setup()
|
|||||||
memory->destroy(stencil_binsizez_multi);
|
memory->destroy(stencil_binsizez_multi);
|
||||||
memory->destroy(stencil_mbinx_multi);
|
memory->destroy(stencil_mbinx_multi);
|
||||||
memory->destroy(stencil_mbiny_multi);
|
memory->destroy(stencil_mbiny_multi);
|
||||||
memory->destroy(stencil_mbinz_multi);
|
memory->destroy(stencil_mbinz_multi);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Allocate arrays
|
// Allocate arrays
|
||||||
if (!maxstencil_multi) {
|
if (!maxstencil_multi) {
|
||||||
memory->create(flag_half_multi, n, n,
|
memory->create(flag_half_multi, n, n,
|
||||||
"neighstencil:flag_half_multi");
|
"neighstencil:flag_half_multi");
|
||||||
memory->create(flag_skip_multi, n, n,
|
memory->create(flag_skip_multi, n, n,
|
||||||
"neighstencil:flag_skip_multi");
|
"neighstencil:flag_skip_multi");
|
||||||
memory->create(bin_collection_multi, n, n,
|
memory->create(bin_collection_multi, n, n,
|
||||||
"neighstencil:bin_collection_multi");
|
"neighstencil:bin_collection_multi");
|
||||||
|
|
||||||
memory->create(stencil_sx_multi, n, n,
|
memory->create(stencil_sx_multi, n, n,
|
||||||
"neighstencil:stencil_sx_multi");
|
"neighstencil:stencil_sx_multi");
|
||||||
memory->create(stencil_sy_multi, n, n,
|
memory->create(stencil_sy_multi, n, n,
|
||||||
"neighstencil:stencil_sy_multi");
|
"neighstencil:stencil_sy_multi");
|
||||||
memory->create(stencil_sz_multi, n, n,
|
memory->create(stencil_sz_multi, n, n,
|
||||||
"neighstencil:stencil_sz_multi");
|
"neighstencil:stencil_sz_multi");
|
||||||
|
|
||||||
memory->create(stencil_binsizex_multi, n, n,
|
memory->create(stencil_binsizex_multi, n, n,
|
||||||
"neighstencil:stencil_binsizex_multi");
|
"neighstencil:stencil_binsizex_multi");
|
||||||
memory->create(stencil_binsizey_multi, n, n,
|
memory->create(stencil_binsizey_multi, n, n,
|
||||||
"neighstencil:stencil_binsizey_multi");
|
"neighstencil:stencil_binsizey_multi");
|
||||||
memory->create(stencil_binsizez_multi, n, n,
|
memory->create(stencil_binsizez_multi, n, n,
|
||||||
"neighstencil:stencil_binsizez_multi");
|
"neighstencil:stencil_binsizez_multi");
|
||||||
|
|
||||||
memory->create(stencil_mbinx_multi, n, n,
|
memory->create(stencil_mbinx_multi, n, n,
|
||||||
"neighstencil:stencil_mbinx_multi");
|
"neighstencil:stencil_mbinx_multi");
|
||||||
memory->create(stencil_mbiny_multi, n, n,
|
memory->create(stencil_mbiny_multi, n, n,
|
||||||
"neighstencil:stencil_mbiny_multi");
|
"neighstencil:stencil_mbiny_multi");
|
||||||
memory->create(stencil_mbinz_multi, n, n,
|
memory->create(stencil_mbinz_multi, n, n,
|
||||||
"neighstencil:stencil_mbinz_multi");
|
"neighstencil:stencil_mbinz_multi");
|
||||||
|
|
||||||
memory->create(maxstencil_multi, n, n, "neighstencil::maxstencil_multi");
|
memory->create(maxstencil_multi, n, n, "neighstencil::maxstencil_multi");
|
||||||
memory->create(nstencil_multi, n, n, "neighstencil::nstencil_multi");
|
memory->create(nstencil_multi, n, n, "neighstencil::nstencil_multi");
|
||||||
stencil_multi = new int**[n]();
|
stencil_multi = new int**[n]();
|
||||||
@ -338,38 +338,38 @@ void NStencil::create_setup()
|
|||||||
nstencil_multi[i][j] = 0;
|
nstencil_multi[i][j] = 0;
|
||||||
stencil_multi[i][j] = nullptr;
|
stencil_multi[i][j] = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
maxcollections = n;
|
maxcollections = n;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Skip all stencils by default, initialize smax
|
// Skip all stencils by default, initialize smax
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
for (j = 0; j < n; j++) {
|
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
|
// Determine which stencils need to be built
|
||||||
set_stencil_properties();
|
set_stencil_properties();
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
// Skip creation of unused stencils
|
// Skip creation of unused stencils
|
||||||
if (flag_skip_multi[i][j]) continue;
|
if (flag_skip_multi[i][j]) continue;
|
||||||
|
|
||||||
// Copy bin info for this pair of atom collections
|
// Copy bin info for this pair of atom collections
|
||||||
bin_collection = bin_collection_multi[i][j];
|
bin_collection = bin_collection_multi[i][j];
|
||||||
|
|
||||||
stencil_binsizex_multi[i][j] = binsizex_multi[bin_collection];
|
stencil_binsizex_multi[i][j] = binsizex_multi[bin_collection];
|
||||||
stencil_binsizey_multi[i][j] = binsizey_multi[bin_collection];
|
stencil_binsizey_multi[i][j] = binsizey_multi[bin_collection];
|
||||||
stencil_binsizez_multi[i][j] = binsizez_multi[bin_collection];
|
stencil_binsizez_multi[i][j] = binsizez_multi[bin_collection];
|
||||||
|
|
||||||
stencil_mbinx_multi[i][j] = mbinx_multi[bin_collection];
|
stencil_mbinx_multi[i][j] = mbinx_multi[bin_collection];
|
||||||
stencil_mbiny_multi[i][j] = mbiny_multi[bin_collection];
|
stencil_mbiny_multi[i][j] = mbiny_multi[bin_collection];
|
||||||
stencil_mbinz_multi[i][j] = mbinz_multi[bin_collection];
|
stencil_mbinz_multi[i][j] = mbinz_multi[bin_collection];
|
||||||
|
|
||||||
stencil_range = sqrt(cutcollectionsq[i][j]);
|
stencil_range = sqrt(cutcollectionsq[i][j]);
|
||||||
|
|
||||||
sx = static_cast<int> (stencil_range*bininvx_multi[bin_collection]);
|
sx = static_cast<int> (stencil_range*bininvx_multi[bin_collection]);
|
||||||
if (sx*binsizex_multi[bin_collection] < stencil_range) sx++;
|
if (sx*binsizex_multi[bin_collection] < stencil_range) sx++;
|
||||||
sy = static_cast<int> (stencil_range*bininvy_multi[bin_collection]);
|
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]);
|
sz = static_cast<int> (stencil_range*bininvz_multi[bin_collection]);
|
||||||
if (sz*binsizez_multi[bin_collection] < stencil_range) sz++;
|
if (sz*binsizez_multi[bin_collection] < stencil_range) sz++;
|
||||||
if (dimension == 2) sz = 0;
|
if (dimension == 2) sz = 0;
|
||||||
|
|
||||||
stencil_sx_multi[i][j] = sx;
|
stencil_sx_multi[i][j] = sx;
|
||||||
stencil_sy_multi[i][j] = sy;
|
stencil_sy_multi[i][j] = sy;
|
||||||
stencil_sz_multi[i][j] = sz;
|
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]) {
|
if (smax > maxstencil_multi[i][j]) {
|
||||||
maxstencil_multi[i][j] = smax;
|
maxstencil_multi[i][j] = smax;
|
||||||
if(stencil_multi[i][j])
|
if(stencil_multi[i][j])
|
||||||
|
|||||||
@ -34,17 +34,17 @@ class NStencil : protected Pointers {
|
|||||||
int *** stencil_multi; // list of bin offsets in each multi stencil
|
int *** stencil_multi; // list of bin offsets in each multi stencil
|
||||||
int ** maxstencil_multi; // max stencil size for each multi stencil
|
int ** maxstencil_multi; // max stencil size for each multi stencil
|
||||||
int maxcollections; // size of multi arrays
|
int maxcollections; // size of multi arrays
|
||||||
|
|
||||||
int sx,sy,sz; // extent of stencil in each dim
|
int sx,sy,sz; // extent of stencil in each dim
|
||||||
int **stencil_sx_multi; // analogs for each multi stencil
|
int **stencil_sx_multi; // analogs for each multi stencil
|
||||||
int **stencil_sy_multi;
|
int **stencil_sy_multi;
|
||||||
int **stencil_sz_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
|
// Arrays to store options for multi itype-jtype stencils
|
||||||
bool **flag_half_multi; // flag creation of a half stencil for icollection-jcollection
|
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
|
int **bin_collection_multi; // what collection to use for bin information
|
||||||
|
|
||||||
NStencil(class LAMMPS *);
|
NStencil(class LAMMPS *);
|
||||||
@ -70,15 +70,15 @@ class NStencil : protected Pointers {
|
|||||||
double **cutcollectionsq;
|
double **cutcollectionsq;
|
||||||
int ncollections;
|
int ncollections;
|
||||||
int *collection;
|
int *collection;
|
||||||
|
|
||||||
// data from NBin class
|
// data from NBin class
|
||||||
|
|
||||||
int mbinx,mbiny,mbinz;
|
int mbinx,mbiny,mbinz;
|
||||||
double binsizex,binsizey,binsizez;
|
double binsizex,binsizey,binsizez;
|
||||||
double bininvx,bininvy,bininvz;
|
double bininvx,bininvy,bininvz;
|
||||||
|
|
||||||
// data from NBin class for multi
|
// data from NBin class for multi
|
||||||
|
|
||||||
int *mbinx_multi;
|
int *mbinx_multi;
|
||||||
int *mbiny_multi;
|
int *mbiny_multi;
|
||||||
int *mbinz_multi;
|
int *mbinz_multi;
|
||||||
@ -88,16 +88,16 @@ class NStencil : protected Pointers {
|
|||||||
double *bininvx_multi;
|
double *bininvx_multi;
|
||||||
double *bininvy_multi;
|
double *bininvy_multi;
|
||||||
double *bininvz_multi;
|
double *bininvz_multi;
|
||||||
|
|
||||||
// Stored bin information for each stencil
|
// Stored bin information for each stencil
|
||||||
|
|
||||||
int **stencil_mbinx_multi;
|
int **stencil_mbinx_multi;
|
||||||
int **stencil_mbiny_multi;
|
int **stencil_mbiny_multi;
|
||||||
int **stencil_mbinz_multi;
|
int **stencil_mbinz_multi;
|
||||||
double **stencil_binsizex_multi;
|
double **stencil_binsizex_multi;
|
||||||
double **stencil_binsizey_multi;
|
double **stencil_binsizey_multi;
|
||||||
double **stencil_binsizez_multi;
|
double **stencil_binsizez_multi;
|
||||||
|
|
||||||
// data common to all NStencil variants
|
// data common to all NStencil variants
|
||||||
|
|
||||||
int xyzflag; // 1 if stencilxyz is allocated
|
int xyzflag; // 1 if stencilxyz is allocated
|
||||||
@ -113,9 +113,9 @@ class NStencil : protected Pointers {
|
|||||||
|
|
||||||
// methods for multi NStencil
|
// 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
|
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
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ void NStencilFullMulti2d::set_stencil_properties()
|
|||||||
{
|
{
|
||||||
int n = ncollections;
|
int n = ncollections;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
// Always look up neighbor using full stencil and neighbor's bin
|
// Always look up neighbor using full stencil and neighbor's bin
|
||||||
|
|
||||||
for (i = 0; i < n; i++) {
|
for (i = 0; i < n; i++) {
|
||||||
@ -52,32 +52,32 @@ void NStencilFullMulti2d::create()
|
|||||||
int icollection, jcollection, bin_collection, i, j, ns;
|
int icollection, jcollection, bin_collection, i, j, ns;
|
||||||
int n = ncollections;
|
int n = ncollections;
|
||||||
double cutsq;
|
double cutsq;
|
||||||
|
|
||||||
|
|
||||||
for (icollection = 0; icollection < n; icollection++) {
|
for (icollection = 0; icollection < n; icollection++) {
|
||||||
for (jcollection = 0; jcollection < n; jcollection++) {
|
for (jcollection = 0; jcollection < n; jcollection++) {
|
||||||
if (flag_skip_multi[icollection][jcollection]) {
|
if (flag_skip_multi[icollection][jcollection]) {
|
||||||
nstencil_multi[icollection][jcollection] = 0;
|
nstencil_multi[icollection][jcollection] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ns = 0;
|
ns = 0;
|
||||||
|
|
||||||
sx = stencil_sx_multi[icollection][jcollection];
|
sx = stencil_sx_multi[icollection][jcollection];
|
||||||
sy = stencil_sy_multi[icollection][jcollection];
|
sy = stencil_sy_multi[icollection][jcollection];
|
||||||
|
|
||||||
mbinx = stencil_mbinx_multi[icollection][jcollection];
|
mbinx = stencil_mbinx_multi[icollection][jcollection];
|
||||||
mbiny = stencil_mbiny_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];
|
cutsq = cutcollectionsq[icollection][jcollection];
|
||||||
|
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
|
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
|
||||||
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
|
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
|
||||||
|
|
||||||
nstencil_multi[icollection][jcollection] = ns;
|
nstencil_multi[icollection][jcollection] = ns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,7 +31,7 @@ void NStencilFullMulti3d::set_stencil_properties()
|
|||||||
{
|
{
|
||||||
int n = ncollections;
|
int n = ncollections;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
// Always look up neighbor using full stencil and neighbor's bin
|
// Always look up neighbor using full stencil and neighbor's bin
|
||||||
// Stencil cutoff set by i-j cutoff
|
// Stencil cutoff set by i-j cutoff
|
||||||
|
|
||||||
@ -53,36 +53,36 @@ void NStencilFullMulti3d::create()
|
|||||||
int icollection, jcollection, bin_collection, i, j, k, ns;
|
int icollection, jcollection, bin_collection, i, j, k, ns;
|
||||||
int n = ncollections;
|
int n = ncollections;
|
||||||
double cutsq;
|
double cutsq;
|
||||||
|
|
||||||
|
|
||||||
for (icollection = 0; icollection < n; icollection++) {
|
for (icollection = 0; icollection < n; icollection++) {
|
||||||
for (jcollection = 0; jcollection < n; jcollection++) {
|
for (jcollection = 0; jcollection < n; jcollection++) {
|
||||||
if (flag_skip_multi[icollection][jcollection]) {
|
if (flag_skip_multi[icollection][jcollection]) {
|
||||||
nstencil_multi[icollection][jcollection] = 0;
|
nstencil_multi[icollection][jcollection] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ns = 0;
|
ns = 0;
|
||||||
|
|
||||||
sx = stencil_sx_multi[icollection][jcollection];
|
sx = stencil_sx_multi[icollection][jcollection];
|
||||||
sy = stencil_sy_multi[icollection][jcollection];
|
sy = stencil_sy_multi[icollection][jcollection];
|
||||||
sz = stencil_sz_multi[icollection][jcollection];
|
sz = stencil_sz_multi[icollection][jcollection];
|
||||||
|
|
||||||
mbinx = stencil_mbinx_multi[icollection][jcollection];
|
mbinx = stencil_mbinx_multi[icollection][jcollection];
|
||||||
mbiny = stencil_mbiny_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];
|
bin_collection = bin_collection_multi[icollection][jcollection];
|
||||||
|
|
||||||
cutsq = cutcollectionsq[icollection][jcollection];
|
cutsq = cutcollectionsq[icollection][jcollection];
|
||||||
|
|
||||||
for (k = -sz; k <= sz; k++)
|
for (k = -sz; k <= sz; k++)
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
|
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;
|
k*mbiny*mbinx + j*mbinx + i;
|
||||||
|
|
||||||
nstencil_multi[icollection][jcollection] = ns;
|
nstencil_multi[icollection][jcollection] = ns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ void NStencilHalfMulti2d::set_stencil_properties()
|
|||||||
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||||
|
|
||||||
flag_skip_multi[i][j] = 0;
|
flag_skip_multi[i][j] = 0;
|
||||||
|
|
||||||
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
||||||
flag_half_multi[i][j] = 1;
|
flag_half_multi[i][j] = 1;
|
||||||
bin_collection_multi[i][j] = i;
|
bin_collection_multi[i][j] = i;
|
||||||
@ -64,31 +64,31 @@ void NStencilHalfMulti2d::create()
|
|||||||
int icollection, jcollection, bin_collection, i, j, ns;
|
int icollection, jcollection, bin_collection, i, j, ns;
|
||||||
int n = ncollections;
|
int n = ncollections;
|
||||||
double cutsq;
|
double cutsq;
|
||||||
|
|
||||||
|
|
||||||
for (icollection = 0; icollection < n; icollection++) {
|
for (icollection = 0; icollection < n; icollection++) {
|
||||||
for (jcollection = 0; jcollection < n; jcollection++) {
|
for (jcollection = 0; jcollection < n; jcollection++) {
|
||||||
if (flag_skip_multi[icollection][jcollection]) {
|
if (flag_skip_multi[icollection][jcollection]) {
|
||||||
nstencil_multi[icollection][jcollection] = 0;
|
nstencil_multi[icollection][jcollection] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ns = 0;
|
ns = 0;
|
||||||
|
|
||||||
sx = stencil_sx_multi[icollection][jcollection];
|
sx = stencil_sx_multi[icollection][jcollection];
|
||||||
sy = stencil_sy_multi[icollection][jcollection];
|
sy = stencil_sy_multi[icollection][jcollection];
|
||||||
|
|
||||||
mbinx = stencil_mbinx_multi[icollection][jcollection];
|
mbinx = stencil_mbinx_multi[icollection][jcollection];
|
||||||
mbiny = stencil_mbiny_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];
|
cutsq = cutcollectionsq[icollection][jcollection];
|
||||||
|
|
||||||
if (flag_half_multi[icollection][jcollection]) {
|
if (flag_half_multi[icollection][jcollection]) {
|
||||||
for (j = 0; j <= sy; j++)
|
for (j = 0; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
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)
|
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
|
||||||
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
|
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)
|
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
|
||||||
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
|
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
nstencil_multi[icollection][jcollection] = ns;
|
nstencil_multi[icollection][jcollection] = ns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ void NStencilHalfMulti2dTri::set_stencil_properties()
|
|||||||
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||||
|
|
||||||
flag_skip_multi[i][j] = 0;
|
flag_skip_multi[i][j] = 0;
|
||||||
|
|
||||||
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
||||||
flag_half_multi[i][j] = 1;
|
flag_half_multi[i][j] = 1;
|
||||||
bin_collection_multi[i][j] = i;
|
bin_collection_multi[i][j] = i;
|
||||||
@ -64,27 +64,27 @@ void NStencilHalfMulti2dTri::create()
|
|||||||
int icollection, jcollection, bin_collection, i, j, ns;
|
int icollection, jcollection, bin_collection, i, j, ns;
|
||||||
int n = ncollections;
|
int n = ncollections;
|
||||||
double cutsq;
|
double cutsq;
|
||||||
|
|
||||||
|
|
||||||
for (icollection = 0; icollection < n; icollection++) {
|
for (icollection = 0; icollection < n; icollection++) {
|
||||||
for (jcollection = 0; jcollection < n; jcollection++) {
|
for (jcollection = 0; jcollection < n; jcollection++) {
|
||||||
if (flag_skip_multi[icollection][jcollection]) {
|
if (flag_skip_multi[icollection][jcollection]) {
|
||||||
nstencil_multi[icollection][jcollection] = 0;
|
nstencil_multi[icollection][jcollection] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ns = 0;
|
ns = 0;
|
||||||
|
|
||||||
sx = stencil_sx_multi[icollection][jcollection];
|
sx = stencil_sx_multi[icollection][jcollection];
|
||||||
sy = stencil_sy_multi[icollection][jcollection];
|
sy = stencil_sy_multi[icollection][jcollection];
|
||||||
|
|
||||||
mbinx = stencil_mbinx_multi[icollection][jcollection];
|
mbinx = stencil_mbinx_multi[icollection][jcollection];
|
||||||
mbiny = stencil_mbiny_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];
|
cutsq = cutcollectionsq[icollection][jcollection];
|
||||||
|
|
||||||
if (flag_half_multi[icollection][jcollection]) {
|
if (flag_half_multi[icollection][jcollection]) {
|
||||||
for (j = 0; j <= sy; j++)
|
for (j = 0; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
@ -96,7 +96,7 @@ void NStencilHalfMulti2dTri::create()
|
|||||||
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
|
if (bin_distance_multi(i,j,0,bin_collection) < cutsq)
|
||||||
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
|
stencil_multi[icollection][jcollection][ns++] = j*mbinx + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
nstencil_multi[icollection][jcollection] = ns;
|
nstencil_multi[icollection][jcollection] = ns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -43,7 +43,7 @@ void NStencilHalfMulti3d::set_stencil_properties()
|
|||||||
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||||
|
|
||||||
flag_skip_multi[i][j] = 0;
|
flag_skip_multi[i][j] = 0;
|
||||||
|
|
||||||
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
||||||
flag_half_multi[i][j] = 1;
|
flag_half_multi[i][j] = 1;
|
||||||
bin_collection_multi[i][j] = i;
|
bin_collection_multi[i][j] = i;
|
||||||
@ -64,36 +64,36 @@ void NStencilHalfMulti3d::create()
|
|||||||
int icollection, jcollection, bin_collection, i, j, k, ns;
|
int icollection, jcollection, bin_collection, i, j, k, ns;
|
||||||
int n = ncollections;
|
int n = ncollections;
|
||||||
double cutsq;
|
double cutsq;
|
||||||
|
|
||||||
|
|
||||||
for (icollection = 0; icollection < n; icollection++) {
|
for (icollection = 0; icollection < n; icollection++) {
|
||||||
for (jcollection = 0; jcollection < n; jcollection++) {
|
for (jcollection = 0; jcollection < n; jcollection++) {
|
||||||
if (flag_skip_multi[icollection][jcollection]) {
|
if (flag_skip_multi[icollection][jcollection]) {
|
||||||
nstencil_multi[icollection][jcollection] = 0;
|
nstencil_multi[icollection][jcollection] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ns = 0;
|
ns = 0;
|
||||||
|
|
||||||
sx = stencil_sx_multi[icollection][jcollection];
|
sx = stencil_sx_multi[icollection][jcollection];
|
||||||
sy = stencil_sy_multi[icollection][jcollection];
|
sy = stencil_sy_multi[icollection][jcollection];
|
||||||
sz = stencil_sz_multi[icollection][jcollection];
|
sz = stencil_sz_multi[icollection][jcollection];
|
||||||
|
|
||||||
mbinx = stencil_mbinx_multi[icollection][jcollection];
|
mbinx = stencil_mbinx_multi[icollection][jcollection];
|
||||||
mbiny = stencil_mbiny_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];
|
bin_collection = bin_collection_multi[icollection][jcollection];
|
||||||
|
|
||||||
cutsq = cutcollectionsq[icollection][jcollection];
|
cutsq = cutcollectionsq[icollection][jcollection];
|
||||||
|
|
||||||
if (flag_half_multi[icollection][jcollection]) {
|
if (flag_half_multi[icollection][jcollection]) {
|
||||||
for (k = 0; k <= sz; k++)
|
for (k = 0; k <= sz; k++)
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
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)
|
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;
|
k*mbiny*mbinx + j*mbinx + i;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -101,10 +101,10 @@ void NStencilHalfMulti3d::create()
|
|||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
|
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;
|
k*mbiny*mbinx + j*mbinx + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
nstencil_multi[icollection][jcollection] = ns;
|
nstencil_multi[icollection][jcollection] = ns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,7 +32,7 @@ void NStencilHalfMulti3dTri::set_stencil_properties()
|
|||||||
{
|
{
|
||||||
int n = ncollections;
|
int n = ncollections;
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
// Cross collections: use full stencil, looking one way through hierarchy
|
// Cross collections: use full stencil, looking one way through hierarchy
|
||||||
// smaller -> larger => use full stencil in larger bin
|
// smaller -> larger => use full stencil in larger bin
|
||||||
// larger -> smaller => no nstencil required
|
// larger -> smaller => no nstencil required
|
||||||
@ -43,7 +43,7 @@ void NStencilHalfMulti3dTri::set_stencil_properties()
|
|||||||
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
if(cutcollectionsq[i][i] > cutcollectionsq[j][j]) continue;
|
||||||
|
|
||||||
flag_skip_multi[i][j] = 0;
|
flag_skip_multi[i][j] = 0;
|
||||||
|
|
||||||
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
if(cutcollectionsq[i][i] == cutcollectionsq[j][j]){
|
||||||
flag_half_multi[i][j] = 1;
|
flag_half_multi[i][j] = 1;
|
||||||
bin_collection_multi[i][j] = i;
|
bin_collection_multi[i][j] = i;
|
||||||
@ -64,45 +64,45 @@ void NStencilHalfMulti3dTri::create()
|
|||||||
int icollection, jcollection, bin_collection, i, j, k, ns;
|
int icollection, jcollection, bin_collection, i, j, k, ns;
|
||||||
int n = ncollections;
|
int n = ncollections;
|
||||||
double cutsq;
|
double cutsq;
|
||||||
|
|
||||||
|
|
||||||
for (icollection = 0; icollection < n; icollection++) {
|
for (icollection = 0; icollection < n; icollection++) {
|
||||||
for (jcollection = 0; jcollection < n; jcollection++) {
|
for (jcollection = 0; jcollection < n; jcollection++) {
|
||||||
if (flag_skip_multi[icollection][jcollection]) {
|
if (flag_skip_multi[icollection][jcollection]) {
|
||||||
nstencil_multi[icollection][jcollection] = 0;
|
nstencil_multi[icollection][jcollection] = 0;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
ns = 0;
|
ns = 0;
|
||||||
|
|
||||||
sx = stencil_sx_multi[icollection][jcollection];
|
sx = stencil_sx_multi[icollection][jcollection];
|
||||||
sy = stencil_sy_multi[icollection][jcollection];
|
sy = stencil_sy_multi[icollection][jcollection];
|
||||||
sz = stencil_sz_multi[icollection][jcollection];
|
sz = stencil_sz_multi[icollection][jcollection];
|
||||||
|
|
||||||
mbinx = stencil_mbinx_multi[icollection][jcollection];
|
mbinx = stencil_mbinx_multi[icollection][jcollection];
|
||||||
mbiny = stencil_mbiny_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];
|
bin_collection = bin_collection_multi[icollection][jcollection];
|
||||||
|
|
||||||
cutsq = cutcollectionsq[icollection][jcollection];
|
cutsq = cutcollectionsq[icollection][jcollection];
|
||||||
|
|
||||||
if (flag_half_multi[icollection][jcollection]) {
|
if (flag_half_multi[icollection][jcollection]) {
|
||||||
for (k = 0; k <= sz; k++)
|
for (k = 0; k <= sz; k++)
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
|
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;
|
k*mbiny*mbinx + j*mbinx + i;
|
||||||
} else {
|
} else {
|
||||||
for (k = -sz; k <= sz; k++)
|
for (k = -sz; k <= sz; k++)
|
||||||
for (j = -sy; j <= sy; j++)
|
for (j = -sy; j <= sy; j++)
|
||||||
for (i = -sx; i <= sx; i++)
|
for (i = -sx; i <= sx; i++)
|
||||||
if (bin_distance_multi(i,j,k,bin_collection) < cutsq)
|
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;
|
k*mbiny*mbinx + j*mbinx + i;
|
||||||
}
|
}
|
||||||
|
|
||||||
nstencil_multi[icollection][jcollection] = ns;
|
nstencil_multi[icollection][jcollection] = ns;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1090,7 +1090,7 @@ double PairHybrid::atom2cut(int i)
|
|||||||
for (int m = 0; m < nstyles; m++) {
|
for (int m = 0; m < nstyles; m++) {
|
||||||
if (styles[m]->finitecutflag) {
|
if (styles[m]->finitecutflag) {
|
||||||
temp = styles[m]->atom2cut(i);
|
temp = styles[m]->atom2cut(i);
|
||||||
if (temp > cut) cut = temp;
|
if (temp > cut) cut = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cut;
|
return cut;
|
||||||
@ -1108,7 +1108,7 @@ double PairHybrid::radii2cut(double r1, double r2)
|
|||||||
for (int m = 0; m < nstyles; m++) {
|
for (int m = 0; m < nstyles; m++) {
|
||||||
if (styles[m]->finitecutflag) {
|
if (styles[m]->finitecutflag) {
|
||||||
temp = styles[m]->radii2cut(r1,r2);
|
temp = styles[m]->radii2cut(r1,r2);
|
||||||
if (temp > cut) cut = temp;
|
if (temp > cut) cut = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return cut;
|
return cut;
|
||||||
|
|||||||
Reference in New Issue
Block a user