forked from lijiext/lammps
move enum{NSQ,BIN,MULTI} to the Neighbor class in neighbor.h
This commit is contained in:
parent
d8138a5b4c
commit
994fd2af0e
|
@ -23,8 +23,6 @@
|
|||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{NSQ,BIN,MULTI}; // also in Neighbor
|
||||
|
||||
#define SMALL 1.0e-6
|
||||
#define CUT2BIN_RATIO 100
|
||||
|
||||
|
|
|
@ -17,8 +17,6 @@
|
|||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{NSQ,BIN,MULTI};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
template<class Device>
|
||||
|
|
|
@ -33,8 +33,6 @@
|
|||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{NSQ,BIN,MULTI}; // also in neigh_list.cpp
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NeighborKokkos::NeighborKokkos(LAMMPS *lmp) : Neighbor(lmp),
|
||||
|
@ -98,7 +96,7 @@ void NeighborKokkos::init_cutneighsq_kokkos(int n)
|
|||
|
||||
void NeighborKokkos::create_kokkos_list(int i)
|
||||
{
|
||||
if (style != BIN)
|
||||
if (style != Neighbor::BIN)
|
||||
error->all(FLERR,"KOKKOS package only supports 'bin' neighbor lists");
|
||||
|
||||
if (requests[i]->kokkos_device) {
|
||||
|
@ -300,7 +298,7 @@ void NeighborKokkos::build_kokkos(int topoflag)
|
|||
// if bin then, atoms may have moved outside of proc domain & bin extent,
|
||||
// leading to errors or even a crash
|
||||
|
||||
if (style != NSQ) {
|
||||
if (style != Neighbor::NSQ) {
|
||||
for (int i = 0; i < nbin; i++) {
|
||||
neigh_bin[i]->bin_atoms_setup(nall);
|
||||
neigh_bin[i]->bin_atoms();
|
||||
|
|
|
@ -55,8 +55,6 @@ using namespace FixConst;
|
|||
#endif
|
||||
#endif
|
||||
|
||||
enum{NSQ,BIN,MULTI};
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
FixIntel::FixIntel(LAMMPS *lmp, int narg, char **arg) : Fix(lmp, narg, arg)
|
||||
|
@ -353,7 +351,7 @@ void FixIntel::init()
|
|||
|
||||
void FixIntel::setup(int vflag)
|
||||
{
|
||||
if (neighbor->style != BIN)
|
||||
if (neighbor->style != Neighbor::BIN)
|
||||
error->all(FLERR,
|
||||
"Currently, neighbor style BIN must be used with Intel package.");
|
||||
if (neighbor->exclude_setting() != 0)
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{NSQ,BIN,MULTI}; // also in Neighbor
|
||||
|
||||
#define SMALL 1.0e-6
|
||||
#define CUT2BIN_RATIO 100
|
||||
|
||||
|
@ -94,7 +92,7 @@ void NBinStandard::setup_bins(int style)
|
|||
|
||||
double binsize_optimal;
|
||||
if (binsizeflag) binsize_optimal = binsize_user;
|
||||
else if (style == BIN) binsize_optimal = 0.5*cutneighmax;
|
||||
else if (style == Neighbor::BIN) binsize_optimal = 0.5*cutneighmax;
|
||||
else binsize_optimal = 0.5*cutneighmin;
|
||||
if (binsize_optimal == 0.0) binsize_optimal = bbox[0];
|
||||
double binsizeinv = 1.0/binsize_optimal;
|
||||
|
|
|
@ -26,8 +26,6 @@ using namespace LAMMPS_NS;
|
|||
|
||||
#define PGDELTA 1
|
||||
|
||||
enum{NSQ,BIN,MULTI}; // also in Neighbor
|
||||
|
||||
/* ---------------------------------------------------------------------- */
|
||||
|
||||
NeighList::NeighList(LAMMPS *lmp) : Pointers(lmp)
|
||||
|
|
|
@ -57,7 +57,6 @@ using namespace NeighConst;
|
|||
|
||||
#define BIG 1.0e20
|
||||
|
||||
enum{NSQ,BIN,MULTI}; // also in NBin, NeighList, NStencil
|
||||
enum{NONE,ALL,PARTIAL,TEMPLATE};
|
||||
|
||||
static const char cite_neigh_multi[] =
|
||||
|
@ -85,7 +84,7 @@ pairclass(NULL), pairnames(NULL), pairmasks(NULL)
|
|||
|
||||
firsttime = 1;
|
||||
|
||||
style = BIN;
|
||||
style = Neighbor::BIN;
|
||||
every = 1;
|
||||
delay = 10;
|
||||
dist_check = 1;
|
||||
|
@ -651,7 +650,7 @@ int Neighbor::init_pair()
|
|||
// at time of binning when neighbor lists are rebuilt,
|
||||
// similar to what vanilla Nbin::coord2atom() does now in atom2bin
|
||||
|
||||
if (style == BIN) {
|
||||
if (style == Neighbor::BIN) {
|
||||
for (i = 0; i < nrequest; i++)
|
||||
if (requests[i]->occasional && requests[i]->ghost)
|
||||
error->all(FLERR,"Cannot request an occasional binned neighbor list "
|
||||
|
@ -1420,7 +1419,7 @@ void Neighbor::print_pairwise_info()
|
|||
bbox[1] = bboxhi[1]-bboxlo[1];
|
||||
bbox[2] = bboxhi[2]-bboxlo[2];
|
||||
if (binsizeflag) binsize = binsize_user;
|
||||
else if (style == BIN) binsize = 0.5*cutneighmax;
|
||||
else if (style == Neighbor::BIN) binsize = 0.5*cutneighmax;
|
||||
else binsize = 0.5*cutneighmin;
|
||||
if (binsize == 0.0) binsize = bbox[0];
|
||||
|
||||
|
@ -1445,7 +1444,7 @@ void Neighbor::print_pairwise_info()
|
|||
oneatom, pgsize);
|
||||
fprintf(out," master list distance cutoff = %g\n",cutneighmax);
|
||||
fprintf(out," ghost atom cutoff = %g\n",cutghost);
|
||||
if (style != NSQ)
|
||||
if (style != Neighbor::NSQ)
|
||||
fprintf(out," binsize = %g, bins = %g %g %g\n",binsize,
|
||||
ceil(bbox[0]/binsize), ceil(bbox[1]/binsize),
|
||||
ceil(bbox[2]/binsize));
|
||||
|
@ -1595,7 +1594,7 @@ int Neighbor::choose_bin(NeighRequest *rq)
|
|||
{
|
||||
// no binning needed
|
||||
|
||||
if (style == NSQ) return 0;
|
||||
if (style == Neighbor::NSQ) return 0;
|
||||
if (rq->skip || rq->copy || rq->halffull) return 0;
|
||||
|
||||
// use request settings to match exactly one NBin class mask
|
||||
|
@ -1635,7 +1634,7 @@ int Neighbor::choose_stencil(NeighRequest *rq)
|
|||
{
|
||||
// no stencil creation needed
|
||||
|
||||
if (style == NSQ) return 0;
|
||||
if (style == Neighbor::NSQ) return 0;
|
||||
if (rq->skip || rq->copy || rq->halffull) return 0;
|
||||
|
||||
// convert newton request to newtflag = on or off
|
||||
|
@ -1686,9 +1685,9 @@ int Neighbor::choose_stencil(NeighRequest *rq)
|
|||
|
||||
// neighbor style is BIN or MULTI and must match
|
||||
|
||||
if (style == BIN) {
|
||||
if (style == Neighbor::BIN) {
|
||||
if (!(mask & NS_BIN)) continue;
|
||||
} else if (style == MULTI) {
|
||||
} else if (style == Neighbor::MULTI) {
|
||||
if (!(mask & NS_MULTI)) continue;
|
||||
}
|
||||
|
||||
|
@ -1817,11 +1816,11 @@ int Neighbor::choose_pair(NeighRequest *rq)
|
|||
|
||||
// neighbor style is one of NSQ,BIN,MULTI and must match
|
||||
|
||||
if (style == NSQ) {
|
||||
if (style == Neighbor::NSQ) {
|
||||
if (!(mask & NP_NSQ)) continue;
|
||||
} else if (style == BIN) {
|
||||
} else if (style == Neighbor::BIN) {
|
||||
if (!(mask & NP_BIN)) continue;
|
||||
} else if (style == MULTI) {
|
||||
} else if (style == Neighbor::MULTI) {
|
||||
if (!(mask & NP_MULTI)) continue;
|
||||
}
|
||||
|
||||
|
@ -2063,7 +2062,7 @@ void Neighbor::build(int topoflag)
|
|||
// if bin then, atoms may have moved outside of proc domain & bin extent,
|
||||
// leading to errors or even a crash
|
||||
|
||||
if (style != NSQ) {
|
||||
if (style != Neighbor::NSQ) {
|
||||
for (int i = 0; i < nbin; i++) {
|
||||
neigh_bin[i]->bin_atoms_setup(nall);
|
||||
neigh_bin[i]->bin_atoms();
|
||||
|
@ -2180,12 +2179,12 @@ void Neighbor::set(int narg, char **arg)
|
|||
skin = force->numeric(FLERR,arg[0]);
|
||||
if (skin < 0.0) error->all(FLERR,"Illegal neighbor command");
|
||||
|
||||
if (strcmp(arg[1],"nsq") == 0) style = NSQ;
|
||||
else if (strcmp(arg[1],"bin") == 0) style = BIN;
|
||||
else if (strcmp(arg[1],"multi") == 0) style = MULTI;
|
||||
if (strcmp(arg[1],"nsq") == 0) style = Neighbor::NSQ;
|
||||
else if (strcmp(arg[1],"bin") == 0) style = Neighbor::BIN;
|
||||
else if (strcmp(arg[1],"multi") == 0) style = Neighbor::MULTI;
|
||||
else error->all(FLERR,"Illegal neighbor command");
|
||||
|
||||
if (style == MULTI && lmp->citeme) lmp->citeme->add(cite_neigh_multi);
|
||||
if (style == Neighbor::MULTI && lmp->citeme) lmp->citeme->add(cite_neigh_multi);
|
||||
}
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
|
|
|
@ -21,6 +21,7 @@ namespace LAMMPS_NS {
|
|||
|
||||
class Neighbor : protected Pointers {
|
||||
public:
|
||||
enum{NSQ,BIN,MULTI};
|
||||
int style; // 0,1,2 = nsq, bin, multi
|
||||
int every; // build every this many steps
|
||||
int delay; // delay build for this many steps
|
||||
|
|
|
@ -22,8 +22,6 @@
|
|||
|
||||
using namespace LAMMPS_NS;
|
||||
|
||||
enum{NSQ,BIN,MULTI}; // also in Neighbor
|
||||
|
||||
/* ----------------------------------------------------------------------
|
||||
NStencil classes
|
||||
each has method to create a stencil = list of bin offsets
|
||||
|
@ -161,7 +159,7 @@ void NStencil::create_setup()
|
|||
// reallocate stencil structs if necessary
|
||||
// for BIN and MULTI styles
|
||||
|
||||
if (neighstyle == BIN) {
|
||||
if (neighstyle == Neighbor::BIN) {
|
||||
if (smax > maxstencil) {
|
||||
maxstencil = smax;
|
||||
memory->destroy(stencil);
|
||||
|
@ -227,10 +225,10 @@ double NStencil::bin_distance(int i, int j, int k)
|
|||
bigint NStencil::memory_usage()
|
||||
{
|
||||
bigint bytes = 0;
|
||||
if (neighstyle == BIN) {
|
||||
if (neighstyle == Neighbor::BIN) {
|
||||
bytes += memory->usage(stencil,maxstencil);
|
||||
bytes += memory->usage(stencilxyz,maxstencil,3);
|
||||
} else if (neighstyle == MULTI) {
|
||||
} else if (neighstyle == Neighbor::MULTI) {
|
||||
bytes += atom->ntypes*maxstencil_multi * sizeof(int);
|
||||
bytes += atom->ntypes*maxstencil_multi * sizeof(double);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue