Batch 1 of typo/bug fixes
This commit is contained in:
@ -211,8 +211,8 @@ void CommBrick::setup()
|
||||
cutghost[2] = cut * length2;
|
||||
|
||||
if (mode == Comm::MULTI) {
|
||||
if (multi_tiered) {
|
||||
// If using tiered binlists, use the itype-itype interaction distance for communication
|
||||
if (multi2) {
|
||||
// If using multi2 binlists, use the itype-itype interaction distance for communication
|
||||
double **cutneighsq = neighbor->cutneighsq;
|
||||
for (i = 1; i <= ntypes; i++) {
|
||||
cut = 0.0;
|
||||
|
||||
72
src/nbin.cpp
72
src/nbin.cpp
@ -31,18 +31,18 @@ NBin::NBin(LAMMPS *lmp) : Pointers(lmp)
|
||||
bins = nullptr;
|
||||
atom2bin = nullptr;
|
||||
|
||||
nbinx_tiered = nullptr; nbiny_tiered = nullptr; nbinz_tiered = nullptr;
|
||||
mbins_tiered = nullptr;
|
||||
mbinx_tiered = nullptr; mbiny_tiered = nullptr, mbinz_tiered = nullptr;
|
||||
mbinxlo_tiered = nullptr;
|
||||
mbinylo_tiered = nullptr;
|
||||
mbinzlo_tiered = nullptr;
|
||||
binsizex_tiered = nullptr; binsizey_tiered = nullptr; binsizez_tiered = nullptr;
|
||||
bininvx_tiered = nullptr; bininvy_tiered = nullptr; bininvz_tiered = nullptr;
|
||||
binhead_tiered = nullptr;
|
||||
bins_tiered = nullptr;
|
||||
atom2bin_tiered = nullptr;
|
||||
maxbins_tiered = nullptr;
|
||||
nbinx_multi2 = nullptr; nbiny_multi2 = nullptr; nbinz_multi2 = nullptr;
|
||||
mbins_multi2 = nullptr;
|
||||
mbinx_multi2 = nullptr; mbiny_multi2 = nullptr, mbinz_multi2 = nullptr;
|
||||
mbinxlo_multi2 = nullptr;
|
||||
mbinylo_multi2 = nullptr;
|
||||
mbinzlo_multi2 = nullptr;
|
||||
binsizex_multi2 = nullptr; binsizey_multi2 = nullptr; binsizez_multi2 = nullptr;
|
||||
bininvx_multi2 = nullptr; bininvy_multi2 = nullptr; bininvz_multi2 = nullptr;
|
||||
binhead_multi2 = nullptr;
|
||||
bins_multi2 = nullptr;
|
||||
atom2bin_multi2 = nullptr;
|
||||
maxbins_multi2 = nullptr;
|
||||
|
||||
maxtypes = 0;
|
||||
|
||||
@ -64,36 +64,36 @@ NBin::~NBin()
|
||||
memory->destroy(bins);
|
||||
memory->destroy(atom2bin);
|
||||
|
||||
if (!bins_tiered) return;
|
||||
if (!bins_multi2) return;
|
||||
|
||||
memory->destroy(nbinx_tiered);
|
||||
memory->destroy(nbiny_tiered);
|
||||
memory->destroy(nbinz_tiered);
|
||||
memory->destroy(mbins_tiered);
|
||||
memory->destroy(mbinx_tiered);
|
||||
memory->destroy(mbiny_tiered);
|
||||
memory->destroy(mbinz_tiered);
|
||||
memory->destroy(mbinxlo_tiered);
|
||||
memory->destroy(mbinylo_tiered);
|
||||
memory->destroy(mbinzlo_tiered);
|
||||
memory->destroy(nbinx_multi2);
|
||||
memory->destroy(nbiny_multi2);
|
||||
memory->destroy(nbinz_multi2);
|
||||
memory->destroy(mbins_multi2);
|
||||
memory->destroy(mbinx_multi2);
|
||||
memory->destroy(mbiny_multi2);
|
||||
memory->destroy(mbinz_multi2);
|
||||
memory->destroy(mbinxlo_multi2);
|
||||
memory->destroy(mbinylo_multi2);
|
||||
memory->destroy(mbinzlo_multi2);
|
||||
|
||||
memory->destroy(binsizex_tiered);
|
||||
memory->destroy(binsizey_tiered);
|
||||
memory->destroy(binsizez_tiered);
|
||||
memory->destroy(bininvx_tiered);
|
||||
memory->destroy(bininvy_tiered);
|
||||
memory->destroy(bininvz_tiered);
|
||||
memory->destroy(binsizex_multi2);
|
||||
memory->destroy(binsizey_multi2);
|
||||
memory->destroy(binsizez_multi2);
|
||||
memory->destroy(bininvx_multi2);
|
||||
memory->destroy(bininvy_multi2);
|
||||
memory->destroy(bininvz_multi2);
|
||||
|
||||
for (int n = 1; n <= maxtypes; n++) {
|
||||
memory->destroy(binhead_tiered[n]);
|
||||
memory->destroy(bins_tiered[n]);
|
||||
memory->destroy(atom2bin_tiered[n]);
|
||||
memory->destroy(binhead_multi2[n]);
|
||||
memory->destroy(bins_multi2[n]);
|
||||
memory->destroy(atom2bin_multi2[n]);
|
||||
}
|
||||
delete [] binhead_tiered;
|
||||
delete [] bins_tiered;
|
||||
delete [] atom2bin_tiered;
|
||||
delete [] binhead_multi2;
|
||||
delete [] bins_multi2;
|
||||
delete [] atom2bin_multi2;
|
||||
|
||||
memory->destroy(maxbins_tiered);
|
||||
memory->destroy(maxbins_multi2);
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
@ -77,7 +77,7 @@ void NPairHalfSizeMulti2Newtoff::build(NeighList *list)
|
||||
// stores own/own pairs only once
|
||||
// stores own/ghost pairs on both procs
|
||||
|
||||
ibin = nb->atom2bin_type[itype][i];
|
||||
ibin = atom2bin_multi2[itype][i];
|
||||
for (ktype = 1; ktype <= atom->ntypes; ktype++) {
|
||||
if (itype == ktype) {
|
||||
kbin = ibin;
|
||||
@ -90,7 +90,7 @@ void NPairHalfSizeMulti2Newtoff::build(NeighList *list)
|
||||
ns = nstencil_multi2[itype][ktype];
|
||||
for (k = 0; k < ns; k++) {
|
||||
js = binhead_multi2[ktype][kbin + s[k]];
|
||||
for (j = js; j >=0; j = nb->bins_multi2[ktype][j]) {
|
||||
for (j = js; j >=0; j = bins_multi2[ktype][j]) {
|
||||
if (j <= i) continue;
|
||||
|
||||
jtype = type[j];
|
||||
|
||||
@ -284,6 +284,10 @@ void NStencil::create_setup()
|
||||
memory->create(binsizez_multi2, n+1, n+1,
|
||||
"neighstencil:binsizez_multi2");
|
||||
|
||||
memory->create(mbinx_multi2, n+1, n+1,"neighstencil:mbinx_multi2");
|
||||
memory->create(mbiney_multi2, n+1, n+1, "neighstencil:mbiny_multi2");
|
||||
memory->create(mbinz_multi2, n+1, n+1, "neighstencil:mbinz_multi2");
|
||||
|
||||
// Skip all stencils by default, initialize smax
|
||||
for (i = 1; i <= n; i++) {
|
||||
for (j = 1; j <= n; j++) {
|
||||
@ -323,6 +327,10 @@ void NStencil::create_setup()
|
||||
binsizey_multi2[i][j] = binsizey;
|
||||
binsizez_multi2[i][j] = binsizez;
|
||||
|
||||
mbinx_multi2[i][j] = mbinx;
|
||||
mbiny_multi2[i][j] = mbiny;
|
||||
mbinz_multi2[i][j] = mbinz;
|
||||
|
||||
stencil_range = stencil_cut[i][j];
|
||||
|
||||
sx = static_cast<int> (stencil_range*bininvx);
|
||||
|
||||
@ -70,7 +70,7 @@ class NStencil : protected Pointers {
|
||||
double cutneighmax;
|
||||
double cutneighmaxsq;
|
||||
double *cuttypesq;
|
||||
double *cutneighsq;
|
||||
double **cutneighsq;
|
||||
|
||||
// data from NBin class
|
||||
|
||||
@ -80,6 +80,9 @@ class NStencil : protected Pointers {
|
||||
|
||||
// analogs for multi-tiered
|
||||
|
||||
int **mbinx_multi2;
|
||||
int **mbiny_multi2;
|
||||
int **mbinz_multi2;
|
||||
double **binsizex_multi2;
|
||||
double **binsizey_multi2;
|
||||
double **binsizez_multi2;
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#ifdef NSTENCIL_CLASS
|
||||
|
||||
NStencilStyle(full/multi2/2d,
|
||||
NStencilFullMulti22d, NS_FULL | NS_Multi2 | NS_2D | NS_ORTHO | NS_TRI)
|
||||
NStencilFullMulti22d, NS_FULL | NS_MULTI2 | NS_2D | NS_ORTHO | NS_TRI)
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@ -92,7 +92,7 @@ void NStencilFullMulti23d::create()
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance(i,j,k) < cutsq)
|
||||
stencil_type[itype][jtype][ns++] =
|
||||
stencil_multi2[itype][jtype][ns++] =
|
||||
k*mbiny*mbinx + j*mbinx + i;
|
||||
|
||||
nstencil_multi2[itype][jtype] = ns;
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
#ifdef NSTENCIL_CLASS
|
||||
|
||||
NStencilStyle(full/multi2/3d,
|
||||
NStencilFullMulti23d, NS_FULL | NS_Multi2 | NS_3D | NS_ORTHO | NS_TRI)
|
||||
NStencilFullMulti23d, NS_FULL | NS_MULTI2 | NS_3D | NS_ORTHO | NS_TRI)
|
||||
|
||||
#else
|
||||
|
||||
|
||||
@ -23,12 +23,12 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NStencilHalfMulti22d::NStencilHalfMulti23d(LAMMPS *lmp) :
|
||||
NStencilHalfMulti22d::NStencilHalfMulti22d(LAMMPS *lmp) :
|
||||
NStencil(lmp) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void NStencilHalfMulti23d::set_stencil_properties()
|
||||
void NStencilHalfMulti22d::set_stencil_properties()
|
||||
{
|
||||
int n = atom->ntypes;
|
||||
int i, j;
|
||||
@ -69,7 +69,7 @@ void NStencilHalfMulti23d::set_stencil_properties()
|
||||
create stencils based on bin geometry and cutoff
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NStencilHalfMulti23d::create()
|
||||
void NStencilHalfMulti22d::create()
|
||||
{
|
||||
int itype, jtype, i, j, ns;
|
||||
int n = atom->ntypes;
|
||||
@ -95,13 +95,13 @@ void NStencilHalfMulti23d::create()
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (j > 0 || (j == 0 && i > 0)) {
|
||||
if (bin_distance(i,j,0) < cutsq)
|
||||
stencil_type[itype][jtype][ns++] = j*mbinx + i;
|
||||
stencil_multi2[itype][jtype][ns++] = j*mbinx + i;
|
||||
}
|
||||
} else {
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance(i,j,0) < cutsq)
|
||||
stencil_type[itype][jtype][ns++] = j*mbinx + i;
|
||||
stencil_multi2[itype][jtype][ns++] = j*mbinx + i;
|
||||
}
|
||||
|
||||
nstencil_multi2[itype][jtype] = ns;
|
||||
|
||||
@ -23,12 +23,12 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NStencilHalfMulti22dTri::NStencilHalfMulti22d(LAMMPS *lmp) :
|
||||
NStencilHalfMulti22dTri::NStencilHalfMulti22dTri(LAMMPS *lmp) :
|
||||
NStencil(lmp) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void NStencilHalfMulti22d::set_stencil_properties()
|
||||
void NStencilHalfMulti22dTri::set_stencil_properties()
|
||||
{
|
||||
int n = atom->ntypes;
|
||||
int i, j;
|
||||
@ -69,7 +69,7 @@ void NStencilHalfMulti22d::set_stencil_properties()
|
||||
create stencils based on bin geometry and cutoff
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NStencilHalfMulti22d::create()
|
||||
void NStencilHalfMulti22dTri::create()
|
||||
{
|
||||
int itype, jtype, i, j, ns;
|
||||
int n = atom->ntypes;
|
||||
@ -94,12 +94,12 @@ void NStencilHalfMulti22d::create()
|
||||
for (j = 0; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance(i,j,0) < cutsq)
|
||||
stencil_type[itype][jtype][ns++] = j*mbinx + i;
|
||||
stencil_multi2[itype][jtype][ns++] = j*mbinx + i;
|
||||
} else {
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance(i,j,0) < cutsq)
|
||||
stencil_type[itype][jtype][ns++] = j*mbinx + i;
|
||||
stencil_multi2[itype][jtype][ns++] = j*mbinx + i;
|
||||
}
|
||||
|
||||
nstencil_multi2[itype][jtype] = ns;
|
||||
|
||||
@ -23,12 +23,12 @@ using namespace LAMMPS_NS;
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NStencilHalfMulti23dTri::NStencilHalfMulti23d(LAMMPS *lmp) :
|
||||
NStencilHalfMulti23dTri::NStencilHalfMulti23dTri(LAMMPS *lmp) :
|
||||
NStencil(lmp) {}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void NStencilHalfMulti23d::set_stencil_properties()
|
||||
void NStencilHalfMulti23dTri::set_stencil_properties()
|
||||
{
|
||||
int n = atom->ntypes;
|
||||
int i, j;
|
||||
@ -69,7 +69,7 @@ void NStencilHalfMulti23d::set_stencil_properties()
|
||||
create stencils based on bin geometry and cutoff
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NStencilHalfMulti23d::create()
|
||||
void NStencilHalfMulti23dTri::create()
|
||||
{
|
||||
int itype, jtype, i, j, k, ns;
|
||||
int n = atom->ntypes;
|
||||
@ -97,14 +97,14 @@ void NStencilHalfMulti23d::create()
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance(i,j,k) < cutsq)
|
||||
stencil_type[itype][jtype][ns++] =
|
||||
stencil_multi2[itype][jtype][ns++] =
|
||||
k*mbiny*mbinx + j*mbinx + i;
|
||||
} else {
|
||||
for (k = -sz; k <= sz; k++)
|
||||
for (j = -sy; j <= sy; j++)
|
||||
for (i = -sx; i <= sx; i++)
|
||||
if (bin_distance(i,j,k) < cutsq)
|
||||
stencil_type[itype][jtype][ns++] =
|
||||
stencil_multi2[itype][jtype][ns++] =
|
||||
k*mbiny*mbinx + j*mbinx + i;
|
||||
}
|
||||
|
||||
@ -112,118 +112,3 @@ void NStencilHalfMulti23d::create()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
// KS To superclass
|
||||
void NStencilHalfMulti23d::copy_bin_info_bytype(int itype) {
|
||||
|
||||
mbinx = nb->mbinx_type[itype];
|
||||
mbiny = nb->mbiny_type[itype];
|
||||
mbinz = nb->mbinz_type[itype];
|
||||
binsizex = nb->binsizex_type[itype];
|
||||
binsizey = nb->binsizey_type[itype];
|
||||
binsizez = nb->binsizez_type[itype];
|
||||
bininvx = nb->bininvx_type[itype];
|
||||
bininvy = nb->bininvy_type[itype];
|
||||
bininvz = nb->bininvz_type[itype];
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
// KS To superclass?
|
||||
int NStencilHalfMulti23d::copy_neigh_info_bytype(int itype) {
|
||||
|
||||
cutneighmaxsq = neighbor->cutneighsq[itype][itype];
|
||||
cutneighmax = sqrt(cutneighmaxsq);
|
||||
cuttypesq = neighbor->cuttypesq;
|
||||
|
||||
// sx,sy,sz = max range of stencil in each dim
|
||||
// smax = max possible size of entire 3d stencil
|
||||
// stencil will be empty if cutneighmax = 0.0
|
||||
|
||||
sx = static_cast<int> (cutneighmax*bininvx);
|
||||
if (sx*binsizex < cutneighmax) sx++;
|
||||
sy = static_cast<int> (cutneighmax*bininvy);
|
||||
if (sy*binsizey < cutneighmax) sy++;
|
||||
sz = static_cast<int> (cutneighmax*bininvz);
|
||||
if (sz*binsizez < cutneighmax) sz++;
|
||||
|
||||
return ((2*sx+1) * (2*sy+1) * (2*sz+1));
|
||||
}
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
void NStencilHalfMulti23d::create_setup()
|
||||
{
|
||||
|
||||
int itype, jtype;
|
||||
int maxtypes;
|
||||
int smax;
|
||||
|
||||
// maxstencil_type to superclass?
|
||||
maxtypes = atom->ntypes;
|
||||
|
||||
if (maxstencil_type == NULL) {
|
||||
memory->create(maxstencil_type, maxtypes+1, maxtypes+1, "maxstencil_type");
|
||||
memory->create(nstencil_type, maxtypes+1, maxtypes+1, "nstencil_type");
|
||||
stencil_type = new int**[maxtypes+1]();
|
||||
for (itype = 1; itype <= maxtypes; ++itype) {
|
||||
stencil_type[itype] = new int*[maxtypes+1]();
|
||||
for (jtype = 1; jtype <= maxtypes; ++jtype) {
|
||||
maxstencil_type[itype][jtype] = 0;
|
||||
nstencil_type[itype][jtype] = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// like -> like => use standard Newton stencil at bin
|
||||
|
||||
for (itype = 1; itype <= maxtypes; ++itype) {
|
||||
copy_bin_info_bytype(itype);
|
||||
smax = copy_neigh_info_bytype(itype);
|
||||
if (smax > maxstencil_type[itype][itype]) {
|
||||
maxstencil_type[itype][itype] = smax;
|
||||
memory->destroy(stencil_type[itype][itype]);
|
||||
memory->create(stencil_type[itype][itype], smax,
|
||||
"NStencilHalfBytypeNewton::create_steup() stencil");
|
||||
}
|
||||
create_newton(itype, itype, cutneighmaxsq);
|
||||
}
|
||||
|
||||
// Cross types: "Newton on" reached by using Newton off stencil and
|
||||
// looking one way through hierarchy
|
||||
// smaller -> larger => use Newton off stencil in larger bin
|
||||
// larger -> smaller => no nstecil required
|
||||
// If cut offs are same, use existing type-type stencil
|
||||
|
||||
for (itype = 1; itype <= maxtypes; ++itype) {
|
||||
for (jtype = 1; jtype <= maxtypes; ++jtype) {
|
||||
if (itype == jtype) continue;
|
||||
if (cuttypesq[itype] == cuttypesq[jtype]) {
|
||||
nstencil_type[itype][jtype] = nstencil_type[jtype][jtype];
|
||||
stencil_type[itype][jtype] = stencil_type[jtype][jtype];
|
||||
}
|
||||
else if (cuttypesq[itype] < cuttypesq[jtype]) {
|
||||
copy_bin_info_bytype(jtype);
|
||||
|
||||
cutneighmaxsq = cuttypesq[jtype];
|
||||
cutneighmax = sqrt(cutneighmaxsq);
|
||||
sx = static_cast<int> (cutneighmax*bininvx);
|
||||
if (sx*binsizex < cutneighmax) sx++;
|
||||
sy = static_cast<int> (cutneighmax*bininvy);
|
||||
if (sy*binsizey < cutneighmax) sy++;
|
||||
sz = static_cast<int> (cutneighmax*bininvz);
|
||||
if (sz*binsizez < cutneighmax) sz++;
|
||||
|
||||
smax = (2*sx+1) * (2*sy+1) * (2*sz+1);
|
||||
if (smax > maxstencil_type[itype][jtype]) {
|
||||
maxstencil_type[itype][jtype] = smax;
|
||||
memory->destroy(stencil_type[itype][jtype]);
|
||||
memory->create(stencil_type[itype][jtype], smax, "stencil_type[]");
|
||||
}
|
||||
create_newtoff(itype, jtype, cuttypesq[jtype]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user