From 029faeb7f09e4c239915f44752f0a6867be02285 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Fri, 29 Jan 2016 18:27:37 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@14528 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/neighbor.cpp | 27 ++++++++++++++++++++++++++- src/neighbor.h | 30 +++++++++++++++++++++++++++--- 2 files changed, 53 insertions(+), 4 deletions(-) diff --git a/src/neighbor.cpp b/src/neighbor.cpp index 63d2ffacc6..721b2b5df2 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -104,6 +104,11 @@ Neighbor::Neighbor(LAMMPS *lmp) : Pointers(lmp) maxbin = 0; bins = NULL; + // SSA AIR binning + + len_ssa_airnum = 0; + ssa_airnum = NULL; + // pair exclusion list info includegroup = 0; @@ -157,6 +162,7 @@ Neighbor::Neighbor(LAMMPS *lmp) : Pointers(lmp) improperlist = NULL; copymode = 0; + last_binning_timestep = -1; } /* ---------------------------------------------------------------------- */ @@ -176,6 +182,8 @@ Neighbor::~Neighbor() memory->destroy(binhead); memory->destroy(bins); + memory->destroy(ssa_airnum); + memory->destroy(ex1_type); memory->destroy(ex2_type); memory->destroy(ex_type); @@ -1019,6 +1027,7 @@ int Neighbor::request(void *requestor, int instance) skip -> granular function if gran with granhistory, respa function if respaouter, skip_from function for everything else + ssa -> special case for USER-DPD pair styles half_from_full, half, full, gran, respaouter -> choose by newton and rq->newton and tri settings style NSQ options = newton off, newton on @@ -1042,6 +1051,10 @@ void Neighbor::choose_build(int index, NeighRequest *rq) else if (rq->respaouter) pb = &Neighbor::skip_from_respa; else pb = &Neighbor::skip_from; + } else if (rq->ssa) { + if (rq->half_from_full) pb = &Neighbor::half_from_full_newton_ssa; + else pb = &Neighbor::half_bin_newton_ssa; + } else if (rq->half_from_full) { if (rq->newton == 0) { if (newton_pair == 0) pb = &Neighbor::half_from_full_no_newton; @@ -1286,6 +1299,7 @@ void Neighbor::choose_build(int index, NeighRequest *rq) determine which stencil_create function each neigh list needs based on settings of neigh request, only called if style != NSQ skip or copy or half_from_full -> no stencil + ssa = special case for USER-DPD pair styles half, gran, respaouter, full -> choose by newton and tri and dimension if none of these, ptr = NULL since this list needs no stencils use "else if" b/c skip,copy can be set in addition to half,full,etc @@ -1297,7 +1311,11 @@ void Neighbor::choose_stencil(int index, NeighRequest *rq) if (rq->skip || rq->copy || rq->half_from_full) sc = NULL; - else if (rq->half || rq->gran || rq->respaouter) { + else if (rq->ssa) { + if (dimension == 2) sc = &Neighbor::stencil_half_bin_2d_ssa; + else if (dimension == 3) sc = &Neighbor::stencil_half_bin_3d_ssa; + + } else if (rq->half || rq->gran || rq->respaouter) { if (style == BIN) { if (rq->newton == 0) { if (newton_pair == 0) { @@ -1997,6 +2015,11 @@ void Neighbor::bin_atoms() { int i,ibin; + // NOTE: added for USER-DPD, why do we need this? + + if (last_binning_timestep == update->ntimestep) return; + last_binning_timestep = update->ntimestep; + for (i = 0; i < mbins; i++) binhead[i] = -1; // bin in reverse order so linked list will be in forward order @@ -2152,6 +2175,8 @@ bigint Neighbor::memory_usage() bytes += memory->usage(binhead,maxhead); } + bytes += memory->usage(ssa_airnum,len_ssa_airnum); + for (int i = 0; i < nrequest; i++) if (lists[i]) bytes += lists[i]->memory_usage(); diff --git a/src/neighbor.h b/src/neighbor.h index 10ce337c7b..8059e699bf 100644 --- a/src/neighbor.h +++ b/src/neighbor.h @@ -69,6 +69,14 @@ class Neighbor : protected Pointers { int nimproperlist; // list of impropers to compute int **improperlist; + int cluster_check; // 1 if check bond/angle/etc satisfies minimg + + // USER-DPD package - better to make this private? + + int *ssa_airnum; // AIR number of each atom for SSA in USER-DPD + + // methods + Neighbor(class LAMMPS *); virtual ~Neighbor(); virtual void init(); @@ -79,14 +87,13 @@ class Neighbor : protected Pointers { void setup_bins(); // setup bins based on box and cutoff virtual void build(int topoflag=1); // create all neighbor lists (pair,bond) virtual void build_topology(); // create all topology neighbor lists - void build_one(class NeighList *list, int preflag=0); // create a single neighbor list + void build_one(class NeighList *list, + int preflag=0); // create a single one-time neigh list void set(int, char **); // set neighbor style and skin distance void modify_params(int, char**); // modify parameters that control builds bigint memory_usage(); int exclude_setting(); - int cluster_check; // 1 if check bond/angle/etc satisfies minimg - protected: int me,nprocs; @@ -114,6 +121,7 @@ class Neighbor : protected Pointers { int binatomflag; // bin atoms or not when build neigh list // turned off by build_one() + bigint last_binning_timestep; // last step neighbor binning was done int nbinx,nbiny,nbinz; // # of global bins int *bins; // ptr to next atom in each bin @@ -170,6 +178,12 @@ class Neighbor : protected Pointers { int *glist; // lists to grow atom arrays every reneigh int *slist; // lists to grow stencil arrays every reneigh + // USER-DPD package + + int len_ssa_airnum; // length of ssa_airnum array + + // methods + void bin_atoms(); // bin all atoms double bin_distance(int, int, int); // distance between binx int coord2bin(double *); // mapping atom coord to a bin @@ -304,6 +318,16 @@ class Neighbor : protected Pointers { void improper_template(); // improper list with templated bonds void improper_partial(); // exclude certain impropers + // SSA neighboring for USER-DPD + + //int coord2ssa_airnum(double *); // map atom coord to an AIR number + //void assign_ssa_airnums(); // set ssa_airnum values + + void half_bin_newton_ssa(NeighList *) {} + void half_from_full_newton_ssa(class NeighList *) {} + void stencil_half_bin_2d_ssa(class NeighList *, int, int, int) {} + void stencil_half_bin_3d_ssa(class NeighList *, int, int, int) {} + // find_special: determine if atom j is in special list of atom i // if it is not, return 0 // if it is and special flag is 0 (both coeffs are 0.0), return -1