Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't strip input state file in GROMACS (pre-2024) #642

Merged
merged 1 commit into from
Dec 8, 2023

Conversation

HubLot
Copy link
Member

@HubLot HubLot commented Dec 8, 2023

This follows the bug report in GROMACS forum here.

The bug lied in the name of the colvars restart file or (colvars input state file) which was abf_dihedral_state.dat so the line input_prefix_str.erase(input_prefix_str.rfind(".colvars.state")); crashed.
Furthermore, the function colvarmodule::setup_input():

colvars/src/colvarmodule.cpp

Lines 1346 to 1351 in 351bfd2

std::string restart_in_name(proxy->input_prefix() + std::string(".colvars.state"));
std::istream *input_is = &(proxy->input_stream(restart_in_name, "restart file/channel", false));
if (!*input_is) {
// Try without the suffix ".colvars.state"
restart_in_name = proxy->input_prefix();
input_is = &(proxy->input_stream(restart_in_name, "restart file/channel"));

doesn't handle the case when the suffix is .dat. (suffix .dat was introduced due to a limitation in file extension in mdrun).

So the most forward bugfix is to not strip the extension and let setup_input() takes the whole string as a filename.
The downside is the variable input_prefix_str is also called in colvarmodule::print_total_forces_errning() but according to @jhenin it's only called for code older than 2016

if (restart_version_number() < 20160810) {

(it's basically a revert of commit efac865)

GROMACS Mdrun needs a special extension .dat incompatible with
colvarmodule.
Revert commit efac865
@giacomofiorin giacomofiorin merged commit 8f40a7a into master Dec 8, 2023
16 checks passed
@HubLot HubLot deleted the fix_gmx_restart_filename_bug branch February 6, 2024 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants