Standard library logic error when restarting colvars run

GROMACS version: 2023.3
GROMACS modification: No

Dear GROMACS forum,

I’m running an MD simulation of ethane in argon gas, where I use the colvars module to explore energy profile of the H-C-C-H dihedral. This are the ABFsettings:

colvar {
  name phi
  width 2.
  lowerBoundary 0.
  upperBoundary +360.
  # H C C H
  dihedral {
    group1 { atomNumbers 3}
    group2 { atomNumbers 1}
    group3 { atomNumbers 2}
    group4 { atomNumbers 6}
  }
  extendedLagrangian on
  extendedFluctuation 0.1
}
abf {
 colvars phi
 fullSamples 200
}

Launching the MD run works fine, but once it finished I noticed that, during the simulation time, half of the range of the dihedral angle has not been explored.

Therefore, I tried to extend the simulation as follows:

gmx mdrun -s abf_dihedral.tpr -cpi abf_dihedral.cpt -deffnm abf_dihedral -colvars abf_dihedral.dat -colvars_restart abf_dihedral_state.dat

This is the error I get, which happens right after the program version is stated in the output:

Standard library logic error (bug):
(exception type: St12out_of_range)
basic_string::erase: __pos (which is 18446744073709551615) > this->size()
(which is 18)

Am I making any mistake in my workflow or is this a bug? I would appreciate your input in troubleshooting this.

Thank you in advance for your help and let me know if further details or files are needed.

Mattia

Hi Mattia, there is certainly a bug in that the code should be able to handle a potential error in the config without crashing. We’ll take a look.

Please also note that the dihedral function has by default a range of -180° to 180°.
https://colvars.github.io/gromacs-2023/colvars-refman-gromacs.html#sec:cvc_dihedral
If you want to use 0-360 try the wrapAround keyword inside dihedral, with a value of 180.0:
https://colvars.github.io/gromacs-2023/colvars-refman-gromacs.html#sec:cvc_periodic

Lastly, GROMACS 2024 beta now supports Colvars natively:
https://colvars.github.io/gromacs-2024/colvars-refman-gromacs.html#sec:colvars_mdengine_parameters
You may want to give it a try.

Giacomo

Hi Mattia,

Thanks for reporting the issue, this looks indeed like a bug.
Could you share the tpr file so we could try to reproduce the error ?

Thanks,
Hubert

Hello everyone,

thank you for your kind responses and useful inputs.

@giacomo.fiorin thank you for the suggestion of the wrapAround command. I’m trying to compare the PES from QM calculations, and unfortunately in ORCA the dihedral range can be only between 0 and 360.

@Hub I am attaching the tpr file as required, plus the colvars input and state file. Let me know if you need anything else for debugging purposes.
abf_dihedral.dat (326 Bytes)
abf_dihedral_state.dat (9.4 KB)

Mattia

This is the tpr file (renamed with .dat extension due to the forum extension limitation).
abf_dihedral.tpr.dat (5.9 KB)

Hi Mattia,

Thanks for the file. I’m able to reproduce the error.
The reason is the name of the colvars restart file : -colvars_restart abf_dihedral_state.dat.

In the colvars/gromacs code, we assume the name of this restart file is always in the form of X.colvars.state.dat so in your case abf_dihedral.colvars.state.dat.
[Edit: you need in fact to have this file copied twice : one with the name abf_dihedral.colvars.state.dat to be read by mdrun and one with the name abf_dihedral.colvars.state to be parsed by colvars]

It will not happen in GMX 2024 because we handle the restart information differently.

Anyway, I will report the issue for GROMACS 2023 and below to have a more meaningful error message and remove the need to have 2 copies of the same file

2 Likes