[lammps-users] Issue with fix adapt (UNCLASSIFIED)



I think that fix adapt may have an issue with correctly scaling the tail correction term of a potential when using the hybrid option for pair styles. When using fix adapt/fep the tail correction scaling is correct. To demonstrate this issue in a barebones way, I grabbed the LJ benchmark input file from the LAMMPS distribution and made some edits as shown here:

fix adapt can do things that fix adapt/fep cannot do and there are some more (sometimes subtle) differences. fix adapt/fep was introduced, because it included some change that was not considered suitable for fix adapt. from then on the two fixes have diverged further.

from a cursory look at the code it is not clear why there should be a discrepancy for your example. perhaps steve has an idea for an explanation.



Hi Axel,

Thanks for the quick response. I now see that I was mistaken in thinking that fix adapt was simply an older version of fix adapt/fep.

If replacing this portion of fix_adapt.cpp:

if (anypair) {

for (int m = 0; m < nadapt; m++) {

Adapt *ad = &adapt[m];

if (ad->which == PAIR) {





With this line from fix_adapt_fep.cpp:

if (anypair) force->pair->reinit();

Then the discrepancy disappears for fix adapt and the tail correction is properly scaled. I hope this helps with tracking the issue.



Now please try an unmodified version of fix adapt and re-issue the fix adapt command after you changed the pair style.
If that will also “cure” the problem, then we have identified the source of the problem.


Hi Axel,

As instructed, I made these edits to the end of the input file to unfix the initial fix adapt and then reapply fix adapt after the changed pair style:


not sure, if we can look into this right away. Since fix adapt/fep seems to be sufficient for your use case, you should use that for now.
It would help if you could submit a summary of this discussion as a bug report issue on github at https://github.com/lammps/lammps/issues so that it won’t get lost as otherwise happen often with mailing list bug reports.