Colvars / colvars

Collective variables library for molecular simulation and analysis programs
http://colvars.github.io/
GNU Lesser General Public License v3.0
196 stars 56 forks source link

GROMACS - issue continuing a simulation #651

Closed fadelm01 closed 5 months ago

fadelm01 commented 5 months ago

hello everyone,

I'm using GROMACS 2023.3, colvars version 2023-12-05. I want to continue a simulation where I'm using colvars to investigate a particular cholesterole molecule flopping around in a stratum corneum membrane - I'm doing my simulations on a cluster, so I'm splitting up my simulation into smaller jobs.

To continue the simulation from an older job, I want to use the md.colvars.state file (renaming it into md.colvars.state.dat), like this: [excerpt from my slurm input]

gmx mdrun \
    -s npt-prod-step1.tpr \
    -gpu_id $CUDA_VISIBLE_DEVICES \
    -maxh 72 \
    -colvars previous/my_config.colvars.dat \
    -colvars_restart ../part01/md.colvars.state.dat

The folder where I'm running the simulation contains:

As visible from the slurm input, the colvars.state.dat file is always in a different folder, so not in the same folder where I'm running the simulation.

I attached the files I used in this .zip: Archive.zip

The job where I continue the simulation always crashes after six seconds, and always gives the same error:

colvars: Error: cannot open restart file/channel "md".

I've read the colvars 2023-12-05 manual (gromacs edition) but it doesn't indicate what I'm doing incorrectly, as it only refers to GROMACS 2024.

" Beginning with GROMACS 2024, all information necessary to restart Colvars is included in the checkpoint “.cpt" file. No special provisions are therefore needed compared to a GROMACS simulation without Colvars enabled."

I would be incredibly thankful if someone could help me out with this. Thank you very much and definitely let me know if I haven't given enough information on something.

jhenin commented 5 months ago

Hi, thanks for the report. We need more information to reproduce the issue. Can you upload the Colvars configuration and a gro file please?

fadelm01 commented 5 months ago

gro-colvars.zip Thank you for your answer, I uploaded the gro file and the colvars configuration into this .zip now.

jhenin commented 5 months ago

Thanks, I can now run your input files with this command line:

gmx  mdrun -s npt-prod-step1.tpr \
   -colvars_restart ../part01/md.colvars.state.dat\
   -colvars previous/my_config.colvars.dat

I then get a different error due to a mismatch between the initial coordinates (from the tpr file) and the colvar values stored in the Colvars state file. I don't see the error you mentioned. I wonder if there is something off with the directory structure on the machine you are running. Is part01 really in the parent directory?

fadelm01 commented 5 months ago

my folder structure is like this:

production is the parent folder it contains part01, part02-test (which is where I attempted to run the simulation).

Also, I'm pretty sure I just gave you my outdated confout.gro. This should be the correct one: confout.gro.zip

Sorry for the error, my brain is not braining because I've tried fixing this since saturday. I hope you will be able to reproduce my error now.

I've also attempted to give it the absolute path rather than the relative path (also from different folders that aren't part02-test), but it always gave the same error that "cannot open restart file/channel: md"

fadelm01 commented 5 months ago

I've been fucking around with this for a while now and talked to my professor as well:

both the .state and the .state.dat file need to exist

Essentially, my error was that I just renamed the .state file to .state.dat (as gromacs requires you to), and didn't "keep" the .state file too. I hope this could be clarified in either the error message you receive when you don't have a .state.dat file, or somewhere in the manual or something. (I think we could close this thread now?)

either way, thank you very much @jhenin :)

jhenin commented 5 months ago

This comes as a surprise to me - in my tests I did rename the file, not copy it. Anyway I'm glad that this is working for you. We will probably not push this further, since this interface is going to be deprecated by Gromacs 2024.

HubLot commented 5 months ago

Hi @fadelm01,

It looks like the bug you encountered was fixed in https://github.com/Colvars/colvars/pull/642. It was merged on 8.12.2023 and your version is 5.12.2023.

So, if you want, you can patch manually your GROMACS installation with the master version of colvars and the bug should not arise.

giacomofiorin commented 5 months ago

@HubLot @fadelm01 In addition to or as an alternative to patching, how about using the pre-patched version of 2023?

https://github.com/Colvars/gromacs/releases/tag/v2023.4-colvars

I just updated that repo to include the latest patch release of the standard GROMACS, 2023.4.