Question on read_restart command and its accuracy


I relaxed my structure and used write_restart command to save the optimized structure. But, unfortunately when I call read_restart command, the output simulation result is 10% smaller.
Surely, I redefined all fixes after read_restart command. I used mpirun for 3 March 2020 version.
Should output results be exactly similar in these two cases?
Thanks for your comments,

Restarts are exact within the confines of floating point math. That means the differences are usually not immediately visible but are more of the kind of differences that accumulate if you perform the same simulation on a different number of processors or with different neighbor list update settings.

Oh, I looked carefully and saw LAMMPS shows warning on the write_restart command:

One or more atoms are time integrated more than once (src/modify.cpp:289)

I used fix langevin for a bit and then used fix nvt and finally used the write_restart command.

This combination does not do multiple time integrations. There must be some other command responsible in addition to trigger the warning. However, also using fix langevin and fix nvt, which includes a Nose-Hoover thermostat, at the same time on the same atoms is an error and can lead to bogus results. The difference is that unlike with time integration, there is no simple way for LAMMPS to detect and warn about double thermostatting.

1 Like

The more common scenario is that you picked a restart file that was not written when you thought it was. You may have just picked the wrong file or it was overwritten and you didn’t notice.

Here is some little hack that can be very helpful with identifying restart files. If you are on a Linux or MacOS machine, you probably have the “file” program installed. With the proper configuration, it can identify files and extract useful information from them. In the LAMMPS source distribution there is a file tools/magic, that can be copied (or appended) to your $HOME/.magic file. With that addition, the file program can identify some information from restart files (and log and dump files). Here is an example output from my LAMMPS development and testing folder:

$ file  *.restart
in.restart:        ASCII text
lepton.restart:    LAMMPS binary restart file (rev 3), Version 22 Dec 2022, Units real, Timestep 0, Little Endian
log.restart:       LAMMPS log file written by version 3 Nov 2022
melt.restart:      LAMMPS binary restart file (rev 3), Version 22 Dec 2022, Units lj, Timestep 100, Little Endian
old_table.restart: LAMMPS binary restart file (rev 3), Version 3 Nov 2022, Units lj, Timestep 1000, Little Endian
peptide.restart:   LAMMPS binary restart file (rev 3), Version 3 Nov 2022, Units real, Timestep 10, Little Endian