Bootstrap seed selection in gmx wham is not random

GROMACS version: 2021.2 (likely affects all versions)
GROMACS modification: No


I think I’ve discovered a bug in gmx wham. The manual, as well as the source code, state that when no bootstrap seed is provided, current time is used to generate one. However, I’ve noticed that running the WHAM analysis repeatedly on the same data yields exactly the same results.

I inspected the source code src/gromacs/gmxana/gmx_wham.cpp · master · GROMACS / GROMACS · GitLab and I think that I’ve found the issue. On l. 3120 (src/gromacs/gmxana/gmx_wham.cpp · master · GROMACS / GROMACS · GitLab), the bootstrap seed opt.bsSeed is initialized to -1; however, the check on l. 1296 (src/gromacs/gmxana/gmx_wham.cpp · master · GROMACS / GROMACS · GitLab) checks whether the value is 0 – and, if it is, a random seed is generated.

I am not making a PR because 1. I have zero experience with C++ programming and could be wrong regarding the above, and 2. I think this bug could have affected quite a few users and I think promoting it on the forums may raise its visibility.