Floating point precision

Hi,

This might be a simple CS question so please bear with me!

I wrote a custom normal force granular pair potential, and have been doing some tests lately to test its veracity. The pair style in question is a voronoii volume-dependent force that doesn’t have a unique closed-form potential like the Hertzian contact law.

One such test is a triaxial compression of a granule. Think of it as one central granule surrounded by 6 granules of equal diameters in the orthogonal axes. I then move all of these granules towards the central granule using fix move without friction. If two of those granules which lie on the same axis are considered, their total force acting should be equal and opposite (the force outputted by dump).

In the dump file however, I notice a small discrepancy… for example one granule has a force of -1.50172646412E+04 and the other has a force of 1.50172641778E+04. There seem to be 8 digits of precision in this case which I think is not too good (I was expecting way more for floating point numbers or I might be wrong).

Note I used fixed move to move all of them.

I’m worried if the error will propagate more and more with time. How can I ‘accept’ this error.

Thanks as always!

8 digits of force precision in cases such as this is not unusual, given the various numerical manipulations implied by " voronoii volume-dependent force." And it is more than enough for most applications.

1 Like