Colvars-Restart Issue

Dear LAMMPS Users,

I encountered a strange issue while using the colvars library and simulation restart, in which I would appreciate your opinion.

I first ran a simulation for 5000steps with no restart frequency, but just a write_restart command after the end. Also, in the colvars input file I used colvarsTrajFrequency as 5000 and I did not use the colvarsRestartFrequency. As expected, the system completed the 5000 steps and saved the system in a binary file. The same happened with colvars which saved the out.colvars.state file.

Then, I tried to restart from the point I left, using the fix colvars as:

fix metadynamics all colvars meta.colvarsinp input out.colvars.state tstat thermostat

Instead of having the same behaviour as before, colvars started saving its state every 2 timesteps in rest.colvars.state. However, I had not defined a colvarsRestartFrequency so apparently, colvars took this from the main input file. Since no restart command is used in the main file apart from the write_restart, I wonder why and how colvars chose to save a restart every 2 steps. Do you have any ideas, suggestions or corrections to my methodology?

I found a solution to my problem by manually assigning colvarsRestartFrequency to 5000 but I would like to avoid having double state files (rest/out).

Kind Regards,

Michalis

Dear LAMMPS Users,

I encountered a strange issue while using the colvars library and simulation
restart, in which I would appreciate your opinion.

I first ran a simulation for 5000steps with no restart frequency, but just a
write_restart command after the end. Also, in the colvars input file I used
colvarsTrajFrequency as 5000 and I did not use the colvarsRestartFrequency.
As expected, the system completed the 5000 steps and saved the system in a
binary file. The same happened with colvars which saved the
out.colvars.state file.

Then, I tried to restart from the point I left, using the fix colvars as:

fix metadynamics all colvars meta.colvarsinp input out.colvars.state tstat
thermostat

Instead of having the same behaviour as before, colvars started saving its
state every 2 timesteps in rest.colvars.state. However, I had not defined a
colvarsRestartFrequency so apparently, colvars took this from the main input
file. Since no restart command is used in the main file apart from the
write_restart, I wonder why and how colvars chose to save a restart every 2
steps. Do you have any ideas, suggestions or corrections to my methodology?

this happens because of an uninitialized variable due to not using the
restart command inside of LAMMPS.
thus the restart frequency will be set to some random value.

when using write_restart or the restart commands the colvars state
file will also be embedded into the LAMMPS restart file and upon
reading the restart the fix will be re-initialized with that embedded
restart information.

applying the following patch to the current version of the code should
fix this bug.

[[email protected]... src]$ git diff USER-COLVARS
diff --git a/src/USER-COLVARS/colvarproxy_lammps.cpp
b/src/USER-COLVARS/colvarproxy_lammps.cpp
index 3a65221..b42441e 100644
--- a/src/USER-COLVARS/colvarproxy_lammps.cpp
+++ b/src/USER-COLVARS/colvarproxy_lammps.cpp
@@ -71,6 +71,7 @@ colvarproxy_lammps::colvarproxy_lammps(LAMMPS_NS::LAMMPS *lmp,
   previous_step=-1;
   t_target=temp;
   do_exit=false;
+ restart_every=0;

   // set input restart name and strip the extension, if present
   input_prefix_str = std::string(inp_name ? inp_name : "");

I found a solution to my problem by manually assigning
colvarsRestartFrequency to 5000 but I would like to avoid having double
state files (rest/out).

as mentioned before. those files are redundant with LAMMPS, since -
unlike in NAMD - the restart can be embedded into the native restart
file.

thanks for the report and the easy to follow description of your procedure,

axel.