From de0c8d1f141f17255be373dbc7556b90cbd9d4d7 Mon Sep 17 00:00:00 2001 From: sjplimp Date: Thu, 8 May 2014 14:51:32 +0000 Subject: [PATCH] git-svn-id: svn://svn.icms.temple.edu/lammps-ro/trunk@11946 f3b2605a-c512-4ea7-a41b-209d697bcdaa --- src/balance.cpp | 2 +- src/change_box.cpp | 2 +- src/create_atoms.cpp | 2 +- src/displace_atoms.cpp | 2 +- src/irregular.cpp | 10 ++++------ src/irregular.h | 4 ++-- src/read_dump.cpp | 2 +- src/read_restart.cpp | 3 ++- 8 files changed, 13 insertions(+), 14 deletions(-) diff --git a/src/balance.cpp b/src/balance.cpp index 459c37febc..ccca989369 100644 --- a/src/balance.cpp +++ b/src/balance.cpp @@ -300,7 +300,7 @@ void Balance::command(int narg, char **arg) if (domain->triclinic) domain->x2lamda(atom->nlocal); Irregular *irregular = new Irregular(lmp); - irregular->migrate_atoms(); + irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); diff --git a/src/change_box.cpp b/src/change_box.cpp index fcc90b7512..4237e973b2 100644 --- a/src/change_box.cpp +++ b/src/change_box.cpp @@ -362,7 +362,7 @@ void ChangeBox::command(int narg, char **arg) if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); Irregular *irregular = new Irregular(lmp); - irregular->migrate_atoms(); + irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); diff --git a/src/create_atoms.cpp b/src/create_atoms.cpp index a9393729b7..be5c479360 100644 --- a/src/create_atoms.cpp +++ b/src/create_atoms.cpp @@ -400,7 +400,7 @@ void CreateAtoms::command(int narg, char **arg) if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); Irregular *irregular = new Irregular(lmp); - irregular->migrate_atoms(); + irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); } diff --git a/src/displace_atoms.cpp b/src/displace_atoms.cpp index 4a62647395..1c08439455 100644 --- a/src/displace_atoms.cpp +++ b/src/displace_atoms.cpp @@ -270,7 +270,7 @@ void DisplaceAtoms::command(int narg, char **arg) if (domain->triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); Irregular *irregular = new Irregular(lmp); - irregular->migrate_atoms(); + irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal); diff --git a/src/irregular.cpp b/src/irregular.cpp index 6b3ade751e..e708c49598 100644 --- a/src/irregular.cpp +++ b/src/irregular.cpp @@ -78,7 +78,7 @@ Irregular::~Irregular() for triclinic: atoms must be in lamda coords (0-1) before this is called ------------------------------------------------------------------------- */ -void Irregular::migrate_atoms() +void Irregular::migrate_atoms(int sortflag) { // clear global->local map since atoms move to new procs // clear old ghosts so map_set() at end will operate only on local atoms @@ -145,10 +145,8 @@ void Irregular::migrate_atoms() // create irregular communication plan, perform comm, destroy plan // returned nrecv = size of buffer needed for incoming atoms - // debug: turn on sorting for repoducible irregular() via extra final arg - //int nrecv = create_atom(nsendatom,sizes,proclist,1); - int nrecv = create_atom(nsendatom,sizes,proclist); + int nrecv = create_atom(nsendatom,sizes,proclist,sortflag); if (nrecv > maxrecv) grow_recv(nrecv); exchange_atom(buf_send,sizes,buf_recv); destroy_atom(); @@ -255,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 sort) +int Irregular::create_atom(int n, int *sizes, int *proclist, int sortflag) { int i; @@ -370,7 +368,7 @@ int Irregular::create_atom(int n, int *sizes, int *proclist, int sort) // 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) { + if (sortflag) { int *order = new int[nrecv]; int *proc_recv_ordered = new int[nrecv]; int *length_recv_ordered = new int[nrecv]; diff --git a/src/irregular.h b/src/irregular.h index 1ca51a51c9..eba889c767 100644 --- a/src/irregular.h +++ b/src/irregular.h @@ -27,7 +27,7 @@ class Irregular : protected Pointers { Irregular(class LAMMPS *); ~Irregular(); - void migrate_atoms(); + void migrate_atoms(int sortflag = 0); int migrate_check(); int create_data(int, int *); void exchange_data(char *, int, char *); @@ -87,7 +87,7 @@ class Irregular : protected Pointers { PlanAtom *aplan; PlanData *dplan; - int create_atom(int, int *, int *, int sort = 0); + int create_atom(int, int *, int *, int); void exchange_atom(double *, int *, double *); void destroy_atom(); int coord2proc(double *, int &, int &, int &); diff --git a/src/read_dump.cpp b/src/read_dump.cpp index 3256d28a46..f5c9ddc850 100644 --- a/src/read_dump.cpp +++ b/src/read_dump.cpp @@ -547,7 +547,7 @@ void ReadDump::atoms() if (triclinic) domain->x2lamda(atom->nlocal); domain->reset_box(); Irregular *irregular = new Irregular(lmp); - irregular->migrate_atoms(); + irregular->migrate_atoms(1); delete irregular; if (triclinic) domain->lamda2x(atom->nlocal); diff --git a/src/read_restart.cpp b/src/read_restart.cpp index a224bfa2e3..99238e104d 100644 --- a/src/read_restart.cpp +++ b/src/read_restart.cpp @@ -429,13 +429,14 @@ void ReadRestart::command(int narg, char **arg) } // move atoms to new processors via irregular() + // turn sorting on in migrate_atoms() to avoid non-reproducible restarts // in case read by different proc than wrote restart file // first do map_init() since irregular->migrate_atoms() will do map_clear() if (atom->map_style) atom->map_init(); if (domain->triclinic) domain->x2lamda(atom->nlocal); Irregular *irregular = new Irregular(lmp); - irregular->migrate_atoms(); + irregular->migrate_atoms(1); delete irregular; if (domain->triclinic) domain->lamda2x(atom->nlocal);