using pair_modify with pair hybrid/overlay


I am having trouble with the pair modify command. I am using the Sept 30, 2014 version of LAMMPS with pair hybrid/overlay:

pair_style hybrid/overlay reax/c NULL checkqeq no lj/cut/coul/long 10.0

Then after defining all the pair_coeff’s, I use:

pair_modify pair lj/cut/coul/long mix arithmetic

I’m getting an error from lammps:
“Illegal pair_modify command (…/pair.cpp:168)” which I then modified in the source code to show that it gets hung up on the “pair lj/cut/coul/long” part. But shouldn’t the modify_params from pair_hybrid be invoked? Seems to me that I messed up this compilation but I’m struggling to find the source. Any tips/help would be greatly appreciated. Thank you,


Hmm … I don’t know how the logic for this pair_modify pair command
ever worked. You need the following version of PairHybrid::modify_params().

Please see if that fixes your problem. I will post a patch.


void PairHybrid::modify_params(int narg, char **arg)
if (narg == 0) error->all(FLERR,“Illegal pair_modify command”);

// if 1st keyword is pair, then apply args to one sub-style
// else pass args to every sub-style
// also apply all args (except pair) to pair hybrid itself
// important for some keywords like tail or compute

if (strcmp(arg[0],“pair”) == 0) {
if (narg < 2) error->all(FLERR,“Illegal pair_modify command”);
int m;
for (m = 0; m < nstyles; m++)
if (strcmp(arg[1],keywords[m]) == 0) break;
if (m == nstyles) error->all(FLERR,“Unknown pair_modify hybrid sub-style”);
if (multiple[m] == 0) {
} else {
if (narg < 3) error->all(FLERR,“Illegal pair_modify command”);
int multiflag = force->inumeric(FLERR,arg[2]);
for (m = 0; m < nstyles; m++)
if (strcmp(arg[1],keywords[m]) == 0 && multiflag == multiple[m]) break;
if (m == nstyles)
error->all(FLERR,“Unknown pair_modify hybrid sub-style”);

} else {
for (int m = 0; m < nstyles; m++) styles[m]->modify_params(narg,arg);

Thanks Steve,

That worked perfectly.