From 71e876752c7568b66b9d751c5e6264d0ce5e5fe0 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 Apr 2014 14:50:24 +0000 Subject: [PATCH 01/12] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11682 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/finish.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/finish.cpp b/src/finish.cpp index e9c6d3df81..ca0a883993 100644 --- a/src/finish.cpp +++ b/src/finish.cpp @@ -527,7 +527,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 @@ -572,6 +572,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 && From 143cf7b7d009ba13c707e4f76a79f95078037009 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 Apr 2014 14:50:52 +0000 Subject: [PATCH 02/12] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11683 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/neighbor.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) 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]); } From 4905f1eb51ec412f5b3efd05b34d649620b1b3ac Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 Apr 2014 14:52:16 +0000 Subject: [PATCH 03/12] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11684 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/update.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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; From f356cebdfd29a62185b21f896175fe6f0a584109 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 Apr 2014 14:52:35 +0000 Subject: [PATCH 04/12] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11685 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/atom.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/atom.h b/src/atom.h index ff396b2d44..8138496052 100644 --- a/src/atom.h +++ b/src/atom.h @@ -230,10 +230,11 @@ class Atom : protected Pointers { else return -1; }; - void map_init(); + void map_init(int check = 1); void map_clear(); void map_set(); void map_one(tagint, int); + int map_style_set(); void map_delete(); int map_find_hash(tagint); From bb871ed2a7f53f0ee0104214419b0091482764e6 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 Apr 2014 14:53:00 +0000 Subject: [PATCH 05/12] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11686 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/atom_map.cpp | 76 ++++++++++++++++++++++++++++++------------------ 1 file changed, 47 insertions(+), 29 deletions(-) diff --git a/src/atom_map.cpp b/src/atom_map.cpp index c04676c2b8..1d16cd71a0 100644 --- a/src/atom_map.cpp +++ b/src/atom_map.cpp @@ -23,7 +23,6 @@ using namespace LAMMPS_NS; /* ---------------------------------------------------------------------- allocate and initialize array or hash table for global -> local map - set map_tag_max = largest atom ID (may be larger than natoms) for array option: array length = 1 to map_tag_max set entire array to -1 as initial values @@ -33,38 +32,20 @@ using namespace LAMMPS_NS; so buckets will only be filled with 0 or 1 atoms on average ------------------------------------------------------------------------- */ -void Atom::map_init() +void Atom::map_init(int check) { - if (tag_enable == 0) - error->all(FLERR,"Cannot create an atom map unless atoms have IDs"); - - int map_style_old = map_style; - - // map_tag_max = max ID of any atom that will be in new map - - tagint max = 0; - for (int i = 0; i < nlocal; i++) max = MAX(max,tag[i]); - MPI_Allreduce(&max,&map_tag_max,1,MPI_LMP_TAGINT,MPI_MAX,world); - - // set map_style for new map - // if user-selected, use that setting - // else if map_tag_max > 1M, use hash - // else use array - - if (map_user) map_style = map_user; - else if (map_tag_max > 1000000) map_style = 2; - else map_style = 1; - + // check for new map style if max atomID changed (check = 1 = default) // recreate = 1 if must delete old map and create new map // recreate = 0 if can re-use old map w/out realloc and just adjust settings int recreate = 0; - if (map_style != map_style_old) recreate = 1; - else if (map_style == 1 && map_tag_max > map_maxarray) recreate = 1; + if (check) recreate = map_style_set(); + + if (map_style == 1 && map_tag_max > map_maxarray) recreate = 1; else if (map_style == 2 && nlocal+nghost > map_nhash) recreate = 1; // if not recreating: - // for array, just initialize current map_tag_max values + // for array, initialize current map_tag_max values // for hash, set all buckets to empty, put all entries in free list if (!recreate) { @@ -78,7 +59,7 @@ void Atom::map_init() map_hash[map_nhash-1].next = -1; } - // delete old map and create new one for array or hash + // recreating: delete old map and create new one for array or hash } else { map_delete(); @@ -203,10 +184,12 @@ void Atom::map_set() } else { - // possible reallocation of sametag must come after map_init() - // since map_init() will invoke map_delete(), whacking sametag + // if this proc has more atoms than hash table size, call map_init() + // call with 0 since max atomID in system has not changed + // possible reallocation of sametag must come after map_init(), + // b/c map_init() may invoke map_delete(), whacking sametag - if (nall > map_nhash) map_init(); + if (nall > map_nhash) map_init(0); if (nall > max_same) { max_same = nall + EXTRA; memory->destroy(sametag); @@ -294,6 +277,41 @@ void Atom::map_one(tagint global, int local) } } +/* ---------------------------------------------------------------------- + set map style to array or hash based on user request or max atomID + set map_tag_max = max atom ID (may be larger than natoms) + called whenever map_init() called with new total # of atoms + return 1 if map_style changed, else 0 +------------------------------------------------------------------------- */ + +int Atom::map_style_set() +{ + if (tag_enable == 0) + error->all(FLERR,"Cannot create an atom map unless atoms have IDs"); + + // map_tag_max = max ID of any atom that will be in new map + + tagint max = 0; + for (int i = 0; i < nlocal; i++) max = MAX(max,tag[i]); + MPI_Allreduce(&max,&map_tag_max,1,MPI_LMP_TAGINT,MPI_MAX,world); + + // set map_style for new map + // if user-selected, use that setting + // else if map_tag_max > 1M, use hash + // else use array + + int map_style_old = map_style; + if (map_user) map_style = map_user; + else if (map_tag_max > 1000000) map_style = 2; + else map_style = 1; + + // recreate = 1 if must create new map b/c map_style changed + + int recreate = 0; + if (map_style != map_style_old) recreate = 1; + return recreate; +} + /* ---------------------------------------------------------------------- free the array or hash table for global to local mapping ------------------------------------------------------------------------- */ From 7d99ce5d21de985ab6342c58f8c5e0ec56b5cf6b Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 Apr 2014 14:54:49 +0000 Subject: [PATCH 06/12] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11687 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/MC/fix_bond_create.cpp | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/src/MC/fix_bond_create.cpp b/src/MC/fix_bond_create.cpp index 1fa49e25a7..7705601758 100755 --- a/src/MC/fix_bond_create.cpp +++ b/src/MC/fix_bond_create.cpp @@ -312,6 +312,8 @@ void FixBondCreate::post_integrate() tagint *tag = atom->tag; tagint **bond_atom = atom->bond_atom; int *num_bond = atom->num_bond; + int **nspecial = atom->nspecial; + tagint **special = atom->special; int *mask = atom->mask; int *type = atom->type; @@ -349,13 +351,10 @@ void FixBondCreate::post_integrate() if (!possible) continue; // do not allow a duplicate bond to be created - // check existing bonds of both I and J + // check 1-2 neighbors of atom I - for (k = 0; k < num_bond[i]; k++) - if (bond_atom[i][k] == tag[j]) possible = 0; - if (j < nlocal) - for (k = 0; k < num_bond[j]; k++) - if (bond_atom[j][k] == tag[i]) possible = 0; + for (k = 0; k < nspecial[i][0]; k++) + if (special[i][k] == tag[j]) possible = 0; if (!possible) continue; delx = xtmp - x[j][0]; @@ -394,13 +393,11 @@ void FixBondCreate::post_integrate() comm->forward_comm_fix(this); // create bonds for atoms I own - // if other atom is owned by another proc, it should create same bond - // if both atoms list each other as winning bond partner - // and probability constraint is satisfied + // only if both atoms list each other as winning bond partner + // and probability constraint is satisfied + // if other atom is owned by another proc, it should do same thing int **bond_type = atom->bond_type; - int **nspecial = atom->nspecial; - tagint **special = atom->special; int newton_bond = force->newton_bond; int ncreate = 0; @@ -421,6 +418,7 @@ void FixBondCreate::post_integrate() // if newton_bond is set, only store with I or J // if not newton_bond, store bond with both I and J + // if J is ghost atom, other proc will be consistent if (!newton_bond || tag[i] < tag[j]) { if (num_bond[i] == atom->bond_per_atom) @@ -431,7 +429,7 @@ void FixBondCreate::post_integrate() } // add a 1-2 neighbor to special bond list for atom I - // atom J will also do this + // atom J will also do this whether owned by this proc or another proc slist = special[i]; n1 = nspecial[i][0]; From 36dfa44d34e337bc4679a5bda43ce8d55f5c45d9 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 Apr 2014 14:56:12 +0000 Subject: [PATCH 07/12] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11688 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/read_restart.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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]); } } From e9d4b7a10dace9c33fe0332bd6da9230a10fa03c Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 Apr 2014 14:57:27 +0000 Subject: [PATCH 08/12] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11689 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/irregular.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++- src/irregular.h | 8 +++++++- 2 files changed, 56 insertions(+), 2 deletions(-) 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 2581551c0f..1ca51a51c9 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: */ From 4e8aad8a6034f2fdd8a88ddb9356a9a9b4ac3462 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 Apr 2014 14:59:00 +0000 Subject: [PATCH 09/12] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11690 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index 0f75fe78f1..c784daf380 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "31 Mar 2014" +#define LAMMPS_VERSION "2 Apr 2013" From e677a5040ce70f3d7a580f38c9eb84965f72210e Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 Apr 2014 14:59:02 +0000 Subject: [PATCH 10/12] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11691 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- doc/Manual.html | 4 ++-- doc/Manual.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/Manual.html b/doc/Manual.html index 95d8c12cde..57379eb9ef 100644 --- a/doc/Manual.html +++ b/doc/Manual.html @@ -1,7 +1,7 @@ LAMMPS Users Manual - + @@ -22,7 +22,7 @@

LAMMPS Documentation

-

31 Mar 2014 version +

2 Apr 2013 version

Version info:

diff --git a/doc/Manual.txt b/doc/Manual.txt index 56cbcf8ccf..458db2ccdb 100644 --- a/doc/Manual.txt +++ b/doc/Manual.txt @@ -1,6 +1,6 @@ LAMMPS Users Manual - + @@ -18,7 +18,7 @@

LAMMPS Documentation :c,h3 -31 Mar 2014 version :c,h4 +2 Apr 2013 version :c,h4 Version info: :h4 From 7e8a22efab4a01f4793d770d2bf09280fa47dbbc Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 Apr 2014 15:55:23 +0000 Subject: [PATCH 11/12] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11693 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/version.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.h b/src/version.h index c784daf380..a88f7efddc 100644 --- a/src/version.h +++ b/src/version.h @@ -1 +1 @@ -#define LAMMPS_VERSION "2 Apr 2013" +#define LAMMPS_VERSION "2 Apr 2014" From df5738166562769daa27d0e888a3e6cecbeb2c8c Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 3 Apr 2014 15:55:25 +0000 Subject: [PATCH 12/12] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11694 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- doc/Manual.html | 4 ++-- doc/Manual.txt | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/doc/Manual.html b/doc/Manual.html index 57379eb9ef..75e46a19e6 100644 --- a/doc/Manual.html +++ b/doc/Manual.html @@ -1,7 +1,7 @@ LAMMPS Users Manual - + @@ -22,7 +22,7 @@

LAMMPS Documentation

-

2 Apr 2013 version +

2 Apr 2014 version

Version info:

diff --git a/doc/Manual.txt b/doc/Manual.txt index 458db2ccdb..f1c720c8a4 100644 --- a/doc/Manual.txt +++ b/doc/Manual.txt @@ -1,6 +1,6 @@ LAMMPS Users Manual - + @@ -18,7 +18,7 @@

LAMMPS Documentation :c,h3 -2 Apr 2013 version :c,h4 +2 Apr 2014 version :c,h4 Version info: :h4