Renamed to multi2, initial stencil edits
This commit is contained in:
@ -29,6 +29,33 @@ using namespace LAMMPS_NS;
|
||||
|
||||
NBinStandard::NBinStandard(LAMMPS *lmp) : NBin(lmp) {}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
setup for bin_atoms()
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
void NBinStandard::bin_atoms_setup(int nall)
|
||||
{
|
||||
// binhead = per-bin vector, mbins in length
|
||||
// add 1 bin for USER-INTEL package
|
||||
|
||||
if (mbins > maxbin) {
|
||||
maxbin = mbins;
|
||||
memory->destroy(binhead);
|
||||
memory->create(binhead,maxbin,"neigh:binhead");
|
||||
}
|
||||
|
||||
// bins and atom2bin = per-atom vectors
|
||||
// for both local and ghost atoms
|
||||
|
||||
if (nall > maxatom) {
|
||||
maxatom = nall;
|
||||
memory->destroy(bins);
|
||||
memory->create(bins,maxatom,"neigh:bins");
|
||||
memory->destroy(atom2bin);
|
||||
memory->create(atom2bin,maxatom,"neigh:atom2bin");
|
||||
}
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
setup neighbor binning geometry
|
||||
bin numbering in each dimension is global:
|
||||
@ -230,3 +257,61 @@ void NBinStandard::bin_atoms()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
convert atom coords into local bin #
|
||||
for orthogonal, only ghost atoms will have coord >= bboxhi or coord < bboxlo
|
||||
take special care to insure ghosts are in correct bins even w/ roundoff
|
||||
hi ghost atoms = nbin,nbin+1,etc
|
||||
owned atoms = 0 to nbin-1
|
||||
lo ghost atoms = -1,-2,etc
|
||||
this is necessary so that both procs on either side of PBC
|
||||
treat a pair of atoms straddling the PBC in a consistent way
|
||||
for triclinic, doesn't matter since stencil & neigh list built differently
|
||||
------------------------------------------------------------------------- */
|
||||
|
||||
int NBinStandard::coord2bin(double *x)
|
||||
{
|
||||
int ix,iy,iz;
|
||||
|
||||
if (!std::isfinite(x[0]) || !std::isfinite(x[1]) || !std::isfinite(x[2]))
|
||||
error->one(FLERR,"Non-numeric positions - simulation unstable");
|
||||
|
||||
if (x[0] >= bboxhi[0])
|
||||
ix = static_cast<int> ((x[0]-bboxhi[0])*bininvx) + nbinx;
|
||||
else if (x[0] >= bboxlo[0]) {
|
||||
ix = static_cast<int> ((x[0]-bboxlo[0])*bininvx);
|
||||
ix = MIN(ix,nbinx-1);
|
||||
} else
|
||||
ix = static_cast<int> ((x[0]-bboxlo[0])*bininvx) - 1;
|
||||
|
||||
if (x[1] >= bboxhi[1])
|
||||
iy = static_cast<int> ((x[1]-bboxhi[1])*bininvy) + nbiny;
|
||||
else if (x[1] >= bboxlo[1]) {
|
||||
iy = static_cast<int> ((x[1]-bboxlo[1])*bininvy);
|
||||
iy = MIN(iy,nbiny-1);
|
||||
} else
|
||||
iy = static_cast<int> ((x[1]-bboxlo[1])*bininvy) - 1;
|
||||
|
||||
if (x[2] >= bboxhi[2])
|
||||
iz = static_cast<int> ((x[2]-bboxhi[2])*bininvz) + nbinz;
|
||||
else if (x[2] >= bboxlo[2]) {
|
||||
iz = static_cast<int> ((x[2]-bboxlo[2])*bininvz);
|
||||
iz = MIN(iz,nbinz-1);
|
||||
} else
|
||||
iz = static_cast<int> ((x[2]-bboxlo[2])*bininvz) - 1;
|
||||
|
||||
return (iz-mbinzlo)*mbiny*mbinx + (iy-mbinylo)*mbinx + (ix-mbinxlo);
|
||||
}
|
||||
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
double NBinStandard::memory_usage()
|
||||
{
|
||||
double bytes = 0;
|
||||
bytes += maxbin*sizeof(int);
|
||||
bytes += 2*maxatom*sizeof(int);
|
||||
return bytes;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user