From 9b46cd9a3a43f8ef610b80fa19d4d21b27e31b97 Mon Sep 17 00:00:00 2001 From: Steve Plimpton Date: Wed, 21 Aug 2024 15:23:27 -0600 Subject: [PATCH 1/2] add error checks to verlet/split --- src/REPLICA/verlet_split.cpp | 24 ++++++++++++++++-------- src/REPLICA/verlet_split.h | 3 ++- src/atom.cpp | 2 +- 3 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/REPLICA/verlet_split.cpp b/src/REPLICA/verlet_split.cpp index f23076abe59..fce2268c5dc 100644 --- a/src/REPLICA/verlet_split.cpp +++ b/src/REPLICA/verlet_split.cpp @@ -221,14 +221,22 @@ void VerletSplit::init() if (!force->kspace && comm->me == 0) error->warning(FLERR,"A KSpace style must be defined with verlet/split"); - if (force->kspace_match("/tip4p",0)) tip4p_flag = 1; - else tip4p_flag = 0; + // error for as-yet unsupported verlet/split KSpace options - // currently TIP4P does not work with verlet/split, so generate error - // see Axel email on this, also other TIP4P notes below + int errflag = 0; + if (!atom->q_flag) errflag = 1; + if (force->kspace->tip4pflag) errflag = 1; + if (force->kspace->dipoleflag) errflag = 1; + if (force->kspace->spinflag) errflag = 1; - if (tip4p_flag) error->all(FLERR,"Verlet/split does not yet support TIP4P"); + if (errflag) error->all(FLERR,"Verlet/split cannot (yet) be used with this KSpace method"); + // partial support for TIP4P, see where this flag is used below + + tip4pflag = force->kspace->tip4pflag; + + // invoke parent Verlet init + Verlet::init(); } @@ -402,7 +410,7 @@ void VerletSplit::run(int n) // TIP4P PPPM puts forces on ghost atoms, so must reverse_comm() - if (tip4p_flag && force->newton) { + if (tip4pflag && force->newton) { comm->reverse_comm(); timer->stamp(Timer::COMM); } @@ -485,7 +493,7 @@ void VerletSplit::rk_setup() // could do this by calling r2k_comm() here and not again from run() // except that forward_comm() in r2k_comm() is wrong - if (tip4p_flag) { + if (tip4pflag) { //r2k_comm(); MPI_Gatherv(atom->type,n,MPI_INT,atom->type,qsize,qdisp,MPI_INT,0,block); MPI_Gatherv(atom->tag,n,MPI_LMP_TAGINT, @@ -543,7 +551,7 @@ void VerletSplit::r2k_comm() // for TIP4P, Kspace partition needs to update its ghost atoms - if (tip4p_flag && !master) { + if (tip4pflag && !master) { timer->stamp(); comm->forward_comm(); timer->stamp(Timer::COMM); diff --git a/src/REPLICA/verlet_split.h b/src/REPLICA/verlet_split.h index 6bffac1d388..10835e0792d 100644 --- a/src/REPLICA/verlet_split.h +++ b/src/REPLICA/verlet_split.h @@ -40,7 +40,8 @@ class VerletSplit : public Verlet { int ratio; // ratio of Rspace procs to Kspace procs int *qsize, *qdisp, *xsize, *xdisp; // MPI gather/scatter params for block comm MPI_Comm block; // communicator within one block - int tip4p_flag; // 1 if PPPM/tip4p so do extra comm + + int tip4pflag; // 1 if Kspace method sets tip4pflag double **f_kspace; // copy of Kspace forces on Rspace procs int maxatom; diff --git a/src/atom.cpp b/src/atom.cpp index 249651259e9..52cc2c9bc95 100644 --- a/src/atom.cpp +++ b/src/atom.cpp @@ -3090,7 +3090,7 @@ void *Atom::extract(const char *name) return (void *) eff_plastic_strain_rate; if (strcmp(name, "damage") == 0) return (void *) damage; - // DPD-REACT pakage + // DPD-REACT package if (strcmp(name,"dpdTheta") == 0) return (void *) dpdTheta; From c8b485a2dff6ca639fedc639be481a74b8fd45da Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Wed, 21 Aug 2024 17:48:01 -0400 Subject: [PATCH 2/2] improve error message --- doc/src/run_style.rst | 3 ++- src/REPLICA/verlet_split.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/doc/src/run_style.rst b/doc/src/run_style.rst index c06cef42966..d6a46768573 100644 --- a/doc/src/run_style.rst +++ b/doc/src/run_style.rst @@ -332,7 +332,8 @@ only if the OPENMP package was included. See the :doc:`Build package ` page for more info. Run style *verlet/split* is not compatible with kspace styles from -the INTEL package and it is not compatible with any TIP4P styles. +the INTEL package and it is not compatible with any tip4p, dipole, +or spin kspace styles. Whenever using rRESPA, the user should experiment with trade-offs in speed and accuracy for their system, and verify that they are diff --git a/src/REPLICA/verlet_split.cpp b/src/REPLICA/verlet_split.cpp index fce2268c5dc..b270ad445da 100644 --- a/src/REPLICA/verlet_split.cpp +++ b/src/REPLICA/verlet_split.cpp @@ -229,7 +229,8 @@ void VerletSplit::init() if (force->kspace->dipoleflag) errflag = 1; if (force->kspace->spinflag) errflag = 1; - if (errflag) error->all(FLERR,"Verlet/split cannot (yet) be used with this KSpace method"); + if (errflag) + error->all(FLERR,"Verlet/split cannot (yet) be used with kpace style {}", force->kspace_style); // partial support for TIP4P, see where this flag is used below