diff --git a/doc/Manual.html b/doc/Manual.html index f7de15bfc7..dea556ad93 100644 --- a/doc/Manual.html +++ b/doc/Manual.html @@ -1,7 +1,7 @@ LAMMPS-ICMS Users Manual - + @@ -22,7 +22,7 @@

LAMMPS-ICMS Documentation

-

31 Mar 2014 version +

2 Apr 2014 version

Version info:

diff --git a/doc/Manual.txt b/doc/Manual.txt index 704dc7f6e2..13e3582ab3 100644 --- a/doc/Manual.txt +++ b/doc/Manual.txt @@ -1,7 +1,7 @@ LAMMPS-ICMS Users Manual LAMMPS Users Manual - + @@ -19,7 +19,7 @@

LAMMPS-ICMS Documentation :c,h3 -31 Mar 2014 version :c,h4 +2 Apr 2014 version :c,h4 Version info: :h4 diff --git a/src/finish.cpp b/src/finish.cpp index 1d67dc995f..f94ae80488 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -682,7 +682,7 @@ void Finish::end(int flag) } } - // find a non-skip neighbor list containing half the pairwise interactions + // find a non-skip neighbor list containing half pairwise interactions // count neighbors in that list for stats purposes // allow it to be Kokkos neigh list as well @@ -729,6 +729,7 @@ void Finish::end(int flag) // find a non-skip neighbor list containing full pairwise interactions // count neighbors in that list for stats purposes + // allow it to be Kokkos neigh list as well for (m = 0; m < neighbor->old_nrequest; m++) { if (neighbor->old_requests[m]->full && diff --git a/src/irregular.cpp b/src/irregular.cpp index 679428fb48..b9203ebdd8 100644 --- a/src/irregular.cpp +++ b/src/irregular.cpp @@ -24,6 +24,12 @@ using namespace LAMMPS_NS; +// allocate space for static class variable +// prototype for non-class function + +int *Irregular::proc_recv_copy; +int compare_standalone(const void *, const void *); + #define BUFFACTOR 1.5 #define BUFMIN 1000 #define BUFEXTRA 1000 @@ -247,7 +253,7 @@ int Irregular::migrate_check() return total # of doubles I will recv (not including self) ------------------------------------------------------------------------- */ -int Irregular::create_atom(int n, int *sizes, int *proclist) +int Irregular::create_atom(int n, int *sizes, int *proclist, int sort) { int i; @@ -358,6 +364,33 @@ int Irregular::create_atom(int n, int *sizes, int *proclist) nrecvsize += length_recv[i]; } + // sort proc_recv and num_recv by proc ID if requested + // useful for debugging to insure reproducible ordering of received atoms + // invoke by adding final arg = 1 to create_atom() call in migrate_atoms() + + if (sort) { + int *order = new int[nrecv]; + int *proc_recv_ordered = new int[nrecv]; + int *length_recv_ordered = new int[nrecv]; + + for (i = 0; i < nrecv; i++) order[i] = i; + proc_recv_copy = proc_recv; + qsort(order,nrecv,sizeof(int),compare_standalone); + + int j; + for (i = 0; i < nrecv; i++) { + j = order[i]; + proc_recv_ordered[i] = proc_recv[j]; + length_recv_ordered[i] = length_recv[j]; + } + + memcpy(proc_recv,proc_recv_ordered,nrecv*sizeof(int)); + memcpy(length_recv,length_recv_ordered,nrecv*sizeof(int)); + delete [] order; + delete [] proc_recv_ordered; + delete [] length_recv_ordered; + } + // barrier to insure all MPI_ANY_SOURCE messages are received // else another proc could proceed to exchange_atom() and send to me @@ -388,6 +421,21 @@ int Irregular::create_atom(int n, int *sizes, int *proclist) return nrecvsize; } +/* ---------------------------------------------------------------------- + comparison function invoked by qsort() + accesses static class member proc_recv_copy, set before call to qsort() +------------------------------------------------------------------------- */ + +int compare_standalone(const void *iptr, const void *jptr) +{ + int i = *((int *) iptr); + int j = *((int *) jptr); + int *proc_recv = Irregular::proc_recv_copy; + if (proc_recv[i] < proc_recv[j]) return -1; + if (proc_recv[i] > proc_recv[j]) return 1; + return 0; +} + /* ---------------------------------------------------------------------- communicate atoms via PlanAtom sendbuf = list of atoms to send diff --git a/src/irregular.h b/src/irregular.h index c6488bcf7e..40df2eff84 100644 --- a/src/irregular.h +++ b/src/irregular.h @@ -20,6 +20,11 @@ namespace LAMMPS_NS { class Irregular : protected Pointers { public: + + // static variable across all Irregular objects, for qsort callback + + static int *proc_recv_copy; + Irregular(class LAMMPS *); ~Irregular(); void migrate_atoms(); @@ -82,7 +87,7 @@ class Irregular : protected Pointers { PlanAtom *aplan; PlanData *dplan; - int create_atom(int, int *, int *); + int create_atom(int, int *, int *, int sort = 0); void exchange_atom(double *, int *, double *); void destroy_atom(); int coord2proc(double *, int &, int &, int &); @@ -95,6 +100,7 @@ class Irregular : protected Pointers { } #endif + /* ERROR/WARNING messages: */ diff --git a/src/neighbor.cpp b/src/neighbor.cpp index a155312937..98bf70549c 100644 --- a/src/neighbor.cpp +++ b/src/neighbor.cpp @@ -1480,16 +1480,26 @@ void Neighbor::build_one(int i) error->one(FLERR,"Too many local+ghost atoms for neighbor list"); // when occasional list built, LAMMPS can crash if atoms have moved too far - // why is this?, give warning if this is the case + // why is this? maybe b/c this list is derived from some now out-of-date list? + // give warning if this is the case // no easy workaround b/c all neighbor lists really need to be rebuilt // solution is for input script to check more often for rebuild // only check_distance if running a simulation, not between simulations + // comment out for now + // is sometimes giving warning when there is no issue + // e.g. when a variable uses a fix with an occasional neigh list + // at the beginning of a timestep (e.g. fix move) where + // all neigh lists are about to be re-built anyway + /* int flag = 0; if (dist_check && update->whichflag) flag = check_distance(); - if (flag && me == 0) + if (flag && me == 0) { + printf("BUILD ONE ERROR: %ld\n",update->ntimestep); error->warning(FLERR,"Building an occasional neighbor list when " "atoms may have moved too far"); + } + */ (this->*pair_build[i])(lists[i]); } diff --git a/src/read_restart.cpp b/src/read_restart.cpp index fb8cb02e31..f72ced2c53 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -242,8 +242,7 @@ void ReadRestart::command(int narg, char **arg) coord[1] >= sublo[1] && coord[1] < subhi[1] && coord[2] >= sublo[2] && coord[2] < subhi[2]) { m += avec->unpack_restart(&buf[m]); - } - else m += static_cast (buf[m]); + } else m += static_cast (buf[m]); } } diff --git a/src/update.cpp b/src/update.cpp index f9d304de11..aac3e7382f 100644 --- a/src/update.cpp +++ b/src/update.cpp @@ -247,7 +247,7 @@ void Update::set_units(const char *style) force->ftm2v = 1.0; force->mv2d = 1.0; force->nktv2p = 1.0; - force->qqr2e = 8.9876e30; + force->qqr2e = 8.987556e6; force->qe2f = 1.0; force->vxmu2f = 1.0; force->xxt2kmu = 1.0; @@ -262,13 +262,13 @@ void Update::set_units(const char *style) neighbor->skin = 0.1; } else if (strcmp(style,"nano") == 0) { - force->boltz = 0.013806503; + force->boltz = 0.013806504; force->hplanck = 6.62606896e-4; force->mvv2e = 1.0; force->ftm2v = 1.0; force->mv2d = 1.0; force->nktv2p = 1.0; - force->qqr2e = 8.9876e39; + force->qqr2e = 230.7078669; force->qe2f = 1.0; force->vxmu2f = 1.0; force->xxt2kmu = 1.0; diff --git a/src/version.h b/src/version.h index 0f75fe78f1..a88f7efddc 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "31 Mar 2014" +#define LAMMPS_VERSION "2 Apr 2014"