another chunk of neighbor list request updates

This commit is contained in:
Axel Kohlmeyer
2022-03-09 17:57:21 -05:00
parent e8547af049
commit 9bbd1df57b
36 changed files with 190 additions and 321 deletions

View File

@ -24,7 +24,6 @@
#include "memory.h"
#include "modify.h"
#include "neigh_list.h"
#include "neigh_request.h"
#include "neighbor.h"
#include "update.h"
@ -271,15 +270,11 @@ void PairTracker::init_style()
if (!atom->radius_flag && finitecutflag)
error->all(FLERR, "Pair tracker requires atom attribute radius for finite cutoffs");
// need a history neigh list
int irequest = neighbor->request(this, instance_me);
if (finitecutflag) {
neighbor->requests[irequest]->size = 1;
neighbor->requests[irequest]->history = 1;
// history flag won't affect results, but match granular pairstyles
// so neighborlist can be copied to reduce overhead
}
int neigh_flags = NeighConst::REQ_DEFAULT;
// history flag won't affect results, but match granular pairstyles
// so neighborlist can be copied to reduce overhead
if (finitecutflag) neigh_flags |= NeighConst::REQ_SIZE | NeighConst::REQ_HISTORY;
neighbor->add_request(this, neigh_flags);
// if history is stored and first init, create Fix to store history
// it replaces FixDummy, created in the constructor
@ -288,10 +283,12 @@ void PairTracker::init_style()
if (fix_history == nullptr) {
modify->replace_fix("NEIGH_HISTORY_TRACK_DUMMY",
fmt::format("NEIGH_HISTORY_TRACK all NEIGH_HISTORY {}", size_history), 1);
int ifix = modify->find_fix("NEIGH_HISTORY_TRACK");
fix_history = (FixNeighHistory *) modify->fix[ifix];
fix_history = (FixNeighHistory *) modify->get_fix_by_id("NEIGH_HISTORY_TRACK");
fix_history->pair = this;
fix_history->use_bit_flag = 0;
} else {
fix_history = (FixNeighHistory *) modify->get_fix_by_id("NEIGH_HISTORY_TRACK");
if (!fix_history) error->all(FLERR, "Could not find pair fix neigh history ID");
}
if (finitecutflag) {
@ -342,10 +339,6 @@ void PairTracker::init_style()
MPI_Allreduce(&onerad_frozen[1], &maxrad_frozen[1], atom->ntypes, MPI_DOUBLE, MPI_MAX, world);
}
int ifix = modify->find_fix("NEIGH_HISTORY_TRACK");
if (ifix < 0) error->all(FLERR, "Could not find pair fix neigh history ID");
fix_history = (FixNeighHistory *) modify->fix[ifix];
auto trackfixes = modify->get_fix_by_style("pair/tracker");
if (trackfixes.size() != 1)
error->all(FLERR, "Must use exactly one fix pair/tracker command with pair style tracker");