Disallow newton on with full neigh list

This commit is contained in:
Stan Moore
2024-10-04 15:25:38 -06:00
parent 8827dec5a9
commit 27954609b8
4 changed files with 16 additions and 3 deletions

View File

@ -633,15 +633,24 @@ void KokkosLMP::accelerator(int narg, char **arg)
// set neighbor binsize, same as neigh_modify command // set neighbor binsize, same as neigh_modify command
force->newton = force->newton_pair = force->newton_bond = newtonflag; force->newton = force->newton_pair = force->newton_bond = newtonflag;
newton_check();
if (neigh_thread && newtonflag)
error->all(FLERR,"Must use KOKKOS package option 'newton off' with 'neigh/thread on'");
neighbor->binsize_user = binsize; neighbor->binsize_user = binsize;
if (binsize <= 0.0) neighbor->binsizeflag = 0; if (binsize <= 0.0) neighbor->binsizeflag = 0;
else neighbor->binsizeflag = 1; else neighbor->binsizeflag = 1;
} }
/* ---------------------------------------------------------------------- */
void KokkosLMP::newton_check()
{
if (neighflag == FULL && force->newton)
error->all(FLERR,"Must use 'newton off' with KOKKOS package option 'neigh full'");
if (neigh_thread && force->newton)
error->all(FLERR,"Must use 'newton off' with KOKKOS package option 'neigh/thread on'");
}
/* ---------------------------------------------------------------------- /* ----------------------------------------------------------------------
called by Finish called by Finish
------------------------------------------------------------------------- */ ------------------------------------------------------------------------- */

View File

@ -64,6 +64,7 @@ class KokkosLMP : protected Pointers {
static void initialize(const Kokkos::InitializationSettings&, Error *); static void initialize(const Kokkos::InitializationSettings&, Error *);
static void finalize(); static void finalize();
void accelerator(int, char **); void accelerator(int, char **);
void newton_check();
bigint neigh_count(int); bigint neigh_count(int);
template<class DeviceType> template<class DeviceType>

View File

@ -59,6 +59,7 @@ class KokkosLMP {
void accelerator(int, char **) {} void accelerator(int, char **) {}
int neigh_list_kokkos(int) { return 0; } int neigh_list_kokkos(int) { return 0; }
int neigh_count(int) { return 0; } int neigh_count(int) { return 0; }
void newton_check() {};
}; };
class AtomKokkos : public Atom { class AtomKokkos : public Atom {

View File

@ -1687,6 +1687,8 @@ void Input::newton()
if (newton_pair || newton_bond) force->newton = 1; if (newton_pair || newton_bond) force->newton = 1;
else force->newton = 0; else force->newton = 0;
if (lmp->kokkos) lmp->kokkos->newton_check();
} }
/* ---------------------------------------------------------------------- */ /* ---------------------------------------------------------------------- */