From 372260ec77ad4f75d873dde5da32a8ee7059102c Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Sun, 3 Mar 2024 12:46:20 -0500 Subject: [PATCH] error out in compute ave/sphere/atom and efield/wolf/atom with multi-cutoff neighborlists --- doc/src/compute_ave_sphere_atom.rst | 2 ++ doc/src/compute_efield_wolf_atom.rst | 2 ++ src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp | 5 ++++- src/EXTRA-COMPUTE/compute_efield_wolf_atom.cpp | 6 +++++- 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/doc/src/compute_ave_sphere_atom.rst b/doc/src/compute_ave_sphere_atom.rst index ecb67ae7b5..4640b8534a 100644 --- a/doc/src/compute_ave_sphere_atom.rst +++ b/doc/src/compute_ave_sphere_atom.rst @@ -102,6 +102,8 @@ This compute is part of the EXTRA-COMPUTE package. It is only enabled if LAMMPS was built with that package. See the :doc:`Build package ` page for more info. +This compute requires :doc:`neighbor styles 'bin' or 'nsq' `. + Related commands """""""""""""""" diff --git a/doc/src/compute_efield_wolf_atom.rst b/doc/src/compute_efield_wolf_atom.rst index 1a709dc9f2..93bfa55151 100644 --- a/doc/src/compute_efield_wolf_atom.rst +++ b/doc/src/compute_efield_wolf_atom.rst @@ -106,6 +106,8 @@ Restrictions This compute is part of the EXTRA-COMPUTE package. It is only enabled if LAMMPS was built with that package. +This compute requires :doc:`neighbor styles 'bin' or 'nsq' `. + Related commands """""""""""""""" diff --git a/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp index 89011e7177..b3b920fef3 100644 --- a/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_ave_sphere_atom.cpp @@ -33,7 +33,7 @@ #include using namespace LAMMPS_NS; -using namespace MathConst; +using MathConst::MY_PI; /* ---------------------------------------------------------------------- */ @@ -108,6 +108,9 @@ void ComputeAveSphereAtom::init() else volume = MY_PI * cutsq; + if ((neighbor->style == Neighbor::MULTI) || (neighbor->style == Neighbor::MULTI_OLD)) + error->all(FLERR, "Compute ave/sphere/atom requires neighbor style 'bin' or 'nsq'"); + // need an occasional full neighbor list auto req = neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL); diff --git a/src/EXTRA-COMPUTE/compute_efield_wolf_atom.cpp b/src/EXTRA-COMPUTE/compute_efield_wolf_atom.cpp index ba5a16d52b..ceb16de2ec 100644 --- a/src/EXTRA-COMPUTE/compute_efield_wolf_atom.cpp +++ b/src/EXTRA-COMPUTE/compute_efield_wolf_atom.cpp @@ -92,7 +92,11 @@ void ComputeEfieldWolfAtom::init() if (atom->mu_flag && (comm->me == 0)) error->warning(FLERR, "Compute efield/wolf/atom does not support per-atom dipoles"); - // need an occasional full neighbor list + if ((neighbor->style == Neighbor::MULTI) || (neighbor->style == Neighbor::MULTI_OLD)) + error->all(FLERR, "Compute efield/wolf/atom requires neighbor style 'bin' or 'nsq'"); + + // request an occasional full neighbor list + auto req = neighbor->add_request(this, NeighConst::REQ_FULL | NeighConst::REQ_OCCASIONAL); if (cutoff_flag) req->set_cutoff(cutoff);