Regarding pair_style eam/intel inconsistent compute pe/atom result

Dear LAMMPS Developers,

One of our users found that compute pe and compute pe/atom + compute reduce sum give different results when using pair_style eam/intel.

Here is an example of the thermo output showing the inconsistency between the two compute methods (c_pe vs c_pesum):

Step c_pe c_pesum

0 -0.441513708603606 3.412067688176481

1 -0.440496952081080 3.414177483301626

I found that the difference between the two values (c_pe -c_pesum) is exactly equal to the value of phi in :

pair_eam.cpp:237

as far as i recall, USER-INTEL pair styles do not tally per-atom stress or per-atom energy contributions, as that interferes with the way how they implement vectorization and threading.

axel.

Albert,

Thanks for reporting, providing a simple reproducer, and identifying the source of the bug! The addition of phi you identified was zeroed out by this duplicate/unnecessary memset that can be removed from line 454 of pair_eam_intel.cpp.

454 - if (NEWTON_PAIR) memset(f + minlocal, 0, f_stride * sizeof(FORCE_T));

The fix is here: https://github.com/lammps/lammps/pull/1608

and should be merged soon.

Best, - Mike