Merge pull request #3341 from stanmoore1/hybrid_cutoffs
Add pair_modify option to allow separate cutoffs for each neigh list …
This commit is contained in:
@ -35,7 +35,7 @@ using namespace LAMMPS_NS;
|
||||
|
||||
PairHybrid::PairHybrid(LAMMPS *lmp) : Pair(lmp),
|
||||
styles(nullptr), keywords(nullptr), multiple(nullptr), nmap(nullptr),
|
||||
map(nullptr), special_lj(nullptr), special_coul(nullptr), compute_tally(nullptr)
|
||||
map(nullptr), special_lj(nullptr), special_coul(nullptr), compute_tally(nullptr), cutmax_style(nullptr)
|
||||
{
|
||||
nstyles = 0;
|
||||
|
||||
@ -56,6 +56,7 @@ PairHybrid::~PairHybrid()
|
||||
}
|
||||
}
|
||||
delete[] styles;
|
||||
delete[] cutmax_style;
|
||||
delete[] keywords;
|
||||
delete[] multiple;
|
||||
|
||||
@ -304,6 +305,8 @@ void PairHybrid::settings(int narg, char **arg)
|
||||
// allocate list of sub-styles as big as possibly needed if no extra args
|
||||
|
||||
styles = new Pair *[narg];
|
||||
cutmax_style = new double[narg];
|
||||
memset(cutmax_style, 0.0, narg*sizeof(double));
|
||||
keywords = new char *[narg];
|
||||
multiple = new int[narg];
|
||||
|
||||
@ -722,6 +725,24 @@ double PairHybrid::init_one(int i, int j)
|
||||
ptail_ij += styles[map[i][j][k]]->ptail_ij;
|
||||
}
|
||||
cutmax = MAX(cutmax,cut);
|
||||
|
||||
int istyle;
|
||||
for (istyle = 0; istyle < nstyles; istyle++)
|
||||
if (styles[istyle] == styles[map[i][j][k]]) break;
|
||||
|
||||
if (styles[istyle]->trim_flag) {
|
||||
|
||||
if (cut > cutmax_style[istyle]) {
|
||||
cutmax_style[istyle] = cut;
|
||||
|
||||
for (auto &request : neighbor->get_pair_requests()) {
|
||||
if (styles[istyle] == request->get_requestor() && styles[istyle]->trim_flag) {
|
||||
request->set_cutoff(cutmax_style[istyle]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return cutmax;
|
||||
@ -784,6 +805,8 @@ void PairHybrid::read_restart(FILE *fp)
|
||||
delete[] compute_tally;
|
||||
|
||||
styles = new Pair*[nstyles];
|
||||
cutmax_style = new double[nstyles];
|
||||
memset(cutmax_style, 0.0, nstyles*sizeof(double));
|
||||
keywords = new char*[nstyles];
|
||||
multiple = new int[nstyles];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user