How to build the tabulated file for pair_style table if I only know the formula of the force?

Dear all,

I have used pair_write to write the tabulated file of the pairwise part of the EAM potential. I calculated the force based the potential energy of two neighboring points in the table by -[phi(n)-phi(n-1)]/[r(n)-r(n-1)], I found that except the first 100 lines, the force calculated by myself is above 99% of the corresponding force value in the table. Then I also tried to verify whether the force is indeed calculated by potential energy and distance of two neighboring points with the ci-reaxFF_ZBL.dat file in the potential folder of LAMMPS. Although most of the calculated force is very close to the force value listed in the middle of table, the deviations of the values from the points at the beginning and the end are both quite large, about 20%-50%. But when the ci-reaxFF_ZBL.dat is used as that provided in the example folder, only 2 of 10000 force values inconsistent is report by LAMMPS. So, I am a bit confused about how the potential energy or force are calculated from each other. I am asking this because now I want to build a table for pair_style table but I only know the formula of the force. I think I can tabulate the force into a table without question. But how should I get the value of the potential energy at each points? Please advise me.

Any help would be much appreciated!

Best Regards,

Wenqiang

please let me remind you of some basic calculus knowledge:

if the force is the derivative of the potential energy (and thus can be approximated from numerical differentiation), what would be the inverse process?

axel.

Hi Axel,

Thanks very much for your reply! I understand the potential energy is the integration of the force. I think my confusion is that I used one existing tabulated file in the potential folder and calculated the forces from the potential values in the table. I found that although most of them are very close (more or less than 99%) , but at about 100 of 10000 points the difference between my calculation and the tabulated force values in the forth column is about 20-50%. However, when this table file is used as it provided in the example folder, LAMMPS give only 2 of 10000 force values are inconsistent with -dE/dr. From my point view, 20-50% deviation is not small, I am wondering how big deviation should be considered as a warning. Does that mean I need a smaller distance step? I think I already used a quite small step as 0.0001. How do I determine that how many points to be used at the beginning in order to get a reasonable accuracy?

Many thanks in advance!

Best Regards,

Wenqiang

a) for MD the value of the potential energy is just a diagnostic
b) the test in LAMMPS does not compare against some absolute error, but whether the value of the force at point i is between the value computed from finite differences between the current energy and the one to the left and the current energy and the one to the right.
c) the example you are referring to is a contributed example and thus has not see the same scrutiny than potential files in the potentials folder.
https://github.com/lammps/lammps/commit/e26c1706795a4b65fe1358bcf1df2c798fe7270f

Dear Axel,

Thank you very much for your explanation! That’s very helpful!

Could you please explain a bit more about your first sentence? In my case, I know the formula of the atomic force, thus I think I can tabulate the force values with high accuracy. Does that mean even if I do not obtain the potential energy values correctly, the tabulated potential values does not influence the simulation results? LAMMPS will use the force values directly and the most important thing is to get the force values precisely.

Best Regards,

Wenqiang

there is nothing to explain. this is a matter of understanding MD fundamentals.

OK Axel, thanks very much for all the helps!

Best Regards,

Wenqiang