From 35483a95cdfef1544adbc9d6a73209b810e7efbb Mon Sep 17 00:00:00 2001 From: Steve Farr Date: Sat, 22 Feb 2020 23:39:59 +0000 Subject: [PATCH 1/5] temper timeout synchronization fix --- src/REPLICA/temper.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 00ca062ecc..1128f5ff41 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -219,7 +219,15 @@ void Temper::command(int narg, char **arg) timer->init_timeout(); update->integrate->run(nevery); - if (timer->is_timeout()) break; + + // check for timeout across all procs + int my_timeout=0; + int any_timeout=0; + if (timer->is_timeout()){ + my_timeout=1; + } + MPI_Allreduce(&my_timeout, &any_timeout, 1, MPI_INT, MPI_SUM, universe->uworld); + if (any_timeout) break; // compute PE // notify compute it will be called at next swap From d226f5d02c5e7189f1ef855fc7dca6b09532bfee Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 23 Feb 2020 05:03:50 -0500 Subject: [PATCH 2/5] cosmetic changes --- src/REPLICA/temper.cpp | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 1128f5ff41..1a6ce8d311 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -219,13 +219,12 @@ void Temper::command(int narg, char **arg) timer->init_timeout(); update->integrate->run(nevery); - + // check for timeout across all procs + int my_timeout=0; int any_timeout=0; - if (timer->is_timeout()){ - my_timeout=1; - } + if (timer->is_timeout()) my_timeout=1; MPI_Allreduce(&my_timeout, &any_timeout, 1, MPI_INT, MPI_SUM, universe->uworld); if (any_timeout) break; From c3fc680ccdd796d07da433e87a3225f7db3adb41 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 23 Feb 2020 05:04:21 -0500 Subject: [PATCH 3/5] apply timeout bugfix to temper variants in USER-MISC --- src/USER-MISC/temper_grem.cpp | 9 ++++++++- src/USER-MISC/temper_npt.cpp | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/USER-MISC/temper_grem.cpp b/src/USER-MISC/temper_grem.cpp index 692f78cf9f..0dde34619a 100644 --- a/src/USER-MISC/temper_grem.cpp +++ b/src/USER-MISC/temper_grem.cpp @@ -241,7 +241,14 @@ void TemperGrem::command(int narg, char **arg) timer->init_timeout(); update->integrate->run(nevery); - if (timer->is_timeout()) break; + + // check for timeout across all procs + + int my_timeout=0; + int any_timeout=0; + if (timer->is_timeout()) my_timeout=1; + MPI_Allreduce(&my_timeout, &any_timeout, 1, MPI_INT, MPI_SUM, universe->uworld); + if (any_timeout) break; // compute PE // notify compute it will be called at next swap diff --git a/src/USER-MISC/temper_npt.cpp b/src/USER-MISC/temper_npt.cpp index 55c9aadc6f..0fdcd0ab81 100644 --- a/src/USER-MISC/temper_npt.cpp +++ b/src/USER-MISC/temper_npt.cpp @@ -220,7 +220,14 @@ void TemperNPT::command(int narg, char **arg) timer->init_timeout(); update->integrate->run(nevery); - if (timer->is_timeout()) break; + + // check for timeout across all procs + + int my_timeout=0; + int any_timeout=0; + if (timer->is_timeout()) my_timeout=1; + MPI_Allreduce(&my_timeout, &any_timeout, 1, MPI_INT, MPI_SUM, universe->uworld); + if (any_timeout) break; // compute PE // notify compute it will be called at next swap From f1ad4ed66b7f5d6ea04936f75a91bb979d9b68b8 Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 23 Feb 2020 05:09:25 -0500 Subject: [PATCH 4/5] update the internal timeout clock across replica when we stop parallel tempering --- src/REPLICA/temper.cpp | 5 ++++- src/USER-MISC/temper_grem.cpp | 5 ++++- src/USER-MISC/temper_npt.cpp | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/REPLICA/temper.cpp b/src/REPLICA/temper.cpp index 1a6ce8d311..a4c67108d3 100644 --- a/src/REPLICA/temper.cpp +++ b/src/REPLICA/temper.cpp @@ -226,7 +226,10 @@ void Temper::command(int narg, char **arg) int any_timeout=0; if (timer->is_timeout()) my_timeout=1; MPI_Allreduce(&my_timeout, &any_timeout, 1, MPI_INT, MPI_SUM, universe->uworld); - if (any_timeout) break; + if (any_timeout) { + timer->force_timeout(); + break; + } // compute PE // notify compute it will be called at next swap diff --git a/src/USER-MISC/temper_grem.cpp b/src/USER-MISC/temper_grem.cpp index 0dde34619a..866f923fb9 100644 --- a/src/USER-MISC/temper_grem.cpp +++ b/src/USER-MISC/temper_grem.cpp @@ -248,7 +248,10 @@ void TemperGrem::command(int narg, char **arg) int any_timeout=0; if (timer->is_timeout()) my_timeout=1; MPI_Allreduce(&my_timeout, &any_timeout, 1, MPI_INT, MPI_SUM, universe->uworld); - if (any_timeout) break; + if (any_timeout) { + timer->force_timeout(); + break; + } // compute PE // notify compute it will be called at next swap diff --git a/src/USER-MISC/temper_npt.cpp b/src/USER-MISC/temper_npt.cpp index 0fdcd0ab81..d0a14d8e4d 100644 --- a/src/USER-MISC/temper_npt.cpp +++ b/src/USER-MISC/temper_npt.cpp @@ -227,7 +227,10 @@ void TemperNPT::command(int narg, char **arg) int any_timeout=0; if (timer->is_timeout()) my_timeout=1; MPI_Allreduce(&my_timeout, &any_timeout, 1, MPI_INT, MPI_SUM, universe->uworld); - if (any_timeout) break; + if (any_timeout) { + timer->force_timeout(); + break; + } // compute PE // notify compute it will be called at next swap From bf62646977382244a2ad2b635ed810b51f93ac2e Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Tue, 25 Feb 2020 14:08:55 +0100 Subject: [PATCH 5/5] add check for required atom properties to USER-SDPD --- .../pair_sdpd_taitwater_isothermal.cpp | 19 +++++++++++++++++-- .../pair_sdpd_taitwater_isothermal.h | 1 + src/atom.cpp | 2 ++ 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp index d799869db3..b6f0c63546 100644 --- a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp +++ b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.cpp @@ -23,7 +23,9 @@ #include "atom.h" #include "force.h" #include "comm.h" +#include "neighbor.h" #include "neigh_list.h" +#include "neigh_request.h" #include "memory.h" #include "error.h" #include "domain.h" @@ -238,7 +240,7 @@ void PairSDPDTaitwaterIsothermal::allocate () { void PairSDPDTaitwaterIsothermal::settings (int narg, char **arg) { if (narg != 2 && narg != 3) error->all (FLERR, "Illegal number of arguments for " - "pair_style sdpd/taitwater/morris/isothermal"); + "pair_style sdpd/taitwater/isothermal"); temperature = force->numeric (FLERR, arg[0]); viscosity = force->numeric (FLERR, arg[1]); @@ -297,13 +299,26 @@ void PairSDPDTaitwaterIsothermal::coeff (int narg, char **arg) { error->all(FLERR,"Incorrect args for pair coefficients"); } +/* ---------------------------------------------------------------------- + init specific to this pair style +------------------------------------------------------------------------- */ + +void PairSDPDTaitwaterIsothermal::init_style() +{ + if ((!atom->rho_flag) || (atom->drho == NULL)) + error->all(FLERR,"Pair style dpd/taitwater/isothermal requires atom " + "attributes rho and drho"); + + neighbor->request(this,instance_me); +} + /* ---------------------------------------------------------------------- init for one type pair i,j and corresponding j,i ------------------------------------------------------------------------- */ double PairSDPDTaitwaterIsothermal::init_one (int i, int j) { if (setflag[i][j] == 0) - error->all(FLERR,"Not all pair sph/taitwater/morris coeffs are set"); + error->all(FLERR,"Not all pair sdpd/taitwater/isothermal coeffs are set"); cut[j][i] = cut[i][j]; diff --git a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.h b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.h index caaa0759d0..2d3d06297b 100644 --- a/src/USER-SDPD/pair_sdpd_taitwater_isothermal.h +++ b/src/USER-SDPD/pair_sdpd_taitwater_isothermal.h @@ -36,6 +36,7 @@ class PairSDPDTaitwaterIsothermal : public Pair { void settings (int, char **); void coeff (int, char **); virtual double init_one (int, int); + virtual void init_style(); protected: double viscosity, temperature; diff --git a/src/atom.cpp b/src/atom.cpp index de5d30930a..1396eb596c 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -175,6 +175,8 @@ Atom::Atom(LAMMPS *lmp) : Pointers(lmp) spin_flag = eradius_flag = ervel_flag = erforce_flag = ervelforce_flag = 0; cs_flag = csforce_flag = vforce_flag = etag_flag = 0; + // USER-SPH, USER-MESO, and USER-DPD flags + rho_flag = e_flag = cv_flag = vest_flag = 0; dpd_flag = edpd_flag = tdpd_flag = 0;