I was adding a new "pair" potential to LAMMPS, and then, to test if
the forces are calculated properly, I wrote a mini-program that uses
liblmp. The program, for given system, calculates numerically forces
acting on selected atom, and shows these values together with forces
obtained from lmp->atom->f[atom_nr].
I tested several pair potentials from official lammps release with
this tool, of course the forces are calculated correctly, the only
exception I found is eam (eam/fs is OK). But I don't know anything
about this potential, I just tested it on random 4-atom system with
cuu3.eam potential, so I can't tell it that's a bug.
I'm attaching the program, perhaps it will be useful for someone.
checkpot.cc (2.96 KB)
sic.in (788 Bytes)