[lammps-users] Restart not providing Exactly Same Results.

Hello, I am using the restart command to restart my simulation. Right now as a test I am melting a structure and then minimizing. I wrote the restart of the structure after the melting and then used it to minimize the structure. I got very very very similar results but not exactly the same. Is it possible to get the exact same results?
Here is the code for the first run:

Hello, I am using the restart command to restart my simulation. Right now as a test I am melting a structure and then minimizing. I wrote the restart of the structure after the melting and then used it to minimize the structure. I got very very very similar results but not exactly the same. Is it possible to get the exact same results?

you are reading positions from a dump file. those are written with finite precision and in a different representation (base 10) instead of the binary representation (base 2) of floating point numbers. so you “will not” be able to have exactly the same numbers and even the tiniest difference will not easily go away due to using floating point math, which is not associative.

you can try to minimize the difference by writing your dump file with more precision (~16 digits for double precision floating point), but keep in mind that some numbers in base 10 floating point cannot be exactly represented in base 2 floating point and vice versa. classical example: 0.5 can be represented exactly, 0.1 can not be exactly represented in base2 floating point.

axel.

So the rerun is reading in a restart file, but since the input script that produced the restart file comes from a dump file, that is causing the problem? If that’s the case is there anything I can do to start from a binary file? Like can I convert my starting dat file into a binary file?
Thank you for the help

So the rerun is reading in a restart file, but since the input script that produced the restart file comes from a dump file, that is causing the problem?

no. the biggest problem is that your input files were needlessly convoluted and had unnecessary items in them and also had commands in different order.

that makes it very hard to read and see where differences are. thus I got confused by the “read_dump” statement and didn’t see what you were actually getting at.

bottom line: if the question and files are easy to read and understand, it is easy to give correct and good advice. if not, the chance to misread something is higher.

If that’s the case is there anything I can do to start from a binary file? Like can I convert my starting dat file into a binary file?

one problem is the missing log files.

if you have the identical setup, run with the same number of processors, on the same hardware, you should get the identical results from when you do a “run 0” before the restart and after reading the restart. after that things can change since you are enforcing a reneighboring and also with minimization you have the “history” that is used to accelerate convergence but also can lead to small differences and that in turn can lead to slightly different minima, if you have a noisy potential hypersurface.

it is not obvious that this is what you are doing and comparing since there are different filenames in the different inputs and so on.

is suggest you take one of the example systems from the LAMMPS distribution and set up a minimal test case with it.
that is something where it is going to be easier to reproduce what you are doing and to determine what level of reproducibility there should be.

Okay, I will try that.
Thank you