Fixes where mdrun could return incorrect results

Fixed LINCS triangle constraint thread issue

With triangle constraints, a OpenMP thread barrier could be missing under certain conditions. A debug build produced an assertion failure. This was unlikely to happen without DD, but quite likely with DD. This bug will have had minimal effect on the results.

Issue 1853

Corrected LINCS dHdl contribution

The LINCS constraint contribution to dH/dlambda was missing a factor 1/delta_t^2 and thus orders of magnitude too small.

Issue 1851

Fixed SETTLE error handling

SETTLE errors detected by any OpenMP thread are now processed, not just the last thread.

Also made SETTLE errors fatal; there is no use in generating warnings and continuing a simulation after a SETTLE error. This only causes confusion for users, since the run will usually terminate with a more confusing error message instead.

Fixed exact continuation from non-energy steps

At continuation of a run, from e.g. checkpoint file, the energy of the first step would be printed to log file. This caused different code paths to be used, which prevents exact continuation of runs. Now the print to log at the first step is skipped when starting from a checkpoint file (unless step % nstlog == 0).

Issue 1888.

Fixed energy file continuation with md-vv

When continuing a run from a checkpoint file, The velocity-Verlet integrators would not account for the energy or step of the first step and not write an energy frame if this happened to be an nstenergy step.

Fixed energy average with continuation

When continuing a run from a checkpoint file, the energies at the restart step would always be added to the sum for the averages in the energy file, even when the restart step was not a multiple of nstcalcenergy. Now energy file are binary identical without and with restarts.

Issue 1888.

Backported some md-vv fixes

This corrects non-Trotter md-vv temperature-coupling behaviour, and fixes the first step of md-vv pressure-coupling volume integration after restarts.

Issue 1883

Required Nose-Hoover with MTTK

Nothing else was ever supported, and could segfault if reference temperatures in the .mdp file were zero because there was no thermostat.

Fixed Trotter integration

Re-using the iteration variable in an inner scope could have produced any manner of nonsense. Luckily it was only broken for md-vv with NPT and more than one temperature-coupling group, which is a rare combination.

Issue 1872

Stopped global communication depending on integrator

The iterative case for the md-vv integrator has been removed, which exposed an opportunity for replica-exchange and/or rerun to segfault. I suspect that opportunity has been there ever since the first implementation of md-vv.

Issue 1858

Fixed dEkin/dl handling with multiple ranks

With non-vv integrators, enerd->dekindl was computed at nstglobalcomm-1 step, but not accumulated across ranks unless bGStat also happened to be true. Then at the next (ie nstglobalcomm) step, bGStat and bEkinhOld were true, so calc_ke_part copied the values into enerd->ekindl_old. These were then not accumulated, so sum_ekin averaged the accumulated enerd->ekind with the non-accumulated enerd->ekind_old to store in enerd->dvdl_lin[efptMASS]. So, it seems likely that mass-perturbed free-energy calculations with multiple ranks have been broken with (at least) non-vv integrators for a long time (perhaps since 031a8b58f).

Issue 1873

Fixed TPI ignoring PME mesh contributions.

The PME mesh contribution to test particle insertion energies was ignored.

Issue 1895.

Fixed an error in multi-sim communication

This would e.g. break replica-exchange at the first successful exchange.

Issue 1848

Fixed a bug with pull group weights

Using pull-group?-weights would set all pull indices to 0.

Issue 1878

Removed mdrun fatal_error with P3M-AD

This is a supported code path.

Fix mdrun removing Verlet buffer with EM

With energy minimization, grompp by default adds a Verlet buffer of 5% to rlist, but mdrun erroneously removed this. Added checks to prevent future misuse of calc_verlet_buffer_size.

Issue 1896.

Fixes for mdrun performance issues

Restored a lost performance tweak with AdResS

Made AdResS as fast as it was intended to be.

Fixed walltime measurement with bgclang

BlueGeneQ + xlc was fine.

BlueGeneQ + bgclang clock_gettime doesn’t work properly, leading to checkpoints every nstlist steps.

Fixed PME load balancing skipping a setup

During stage 0 of the PME tuning we only time every second setup. In stage 1 only a reduced range of setups is considered. If the tpr setup (setup index 0) was not part of this reduced range, the first setup in the range would never be timed. This could lead to choosing a non-bonded cut-off that was longer than optimal.

Issue 1880

Also fixed two conditionals (but this had no effect on the settings).

Brought performance estimation up to date

The performance estimation code for estimating the PME/PP load and the optimal DD grid setup used outdated numbers. We now estimate using actual cycle counts on Haswell and estimate for other architectures through a scaling factor that takes into account the SIMD width and FMA. The DD grid automation now ignores PBC cost for exclusions with the Verlet scheme and the for angles and dihedrals with SIMD.

The effect of this is a more reliable PME load estimate that’s now a factor 1.4 to 1.7 higher on Haswell. The DD grid automation will now often choose a setup that better matches the PME decomposition and reduce the PME redist cost.

Fixes for gmx tools

Corrected vector check in gmx check

The check of vector components relative to the RMS vector component incorrectly scaled the absolute tolerance instead of the relative. Also different vectors were compared in several different ways. Now all vectors are checked with the same procedure.

Fixed -npstring command line argument in gmx tune_pme

The old format “-npstring -n” would be interpreted as two command line options by the parser. Therefore, now the syntax is adapted to “-npstring n” and the minus sign is added later when the mdrun command line is constructed.

Made gmx tune_pme work with -cpi -deffnm combination

Using -deffnm with g_tune_pme would not work with checkpoint restarts since the file names used for the benchmark output files (-bo...) could clash with output file names expected by the checkpoint file when appending. Fixed it by using the -deffnm option only at launch time, but not for benchmarking.

Also added the -bo and -bx output files to the files that need to be deleted after the benchmark test run, so that there is slightly less clutter in the output directory after tuning.

New consistency checks

Added check for double perturbation

Added a check for changes atom charges and/or types through both the topology and the couple-moltype option. The couple-moltype option would override the topology settings for decoupled states.

Issue 1892.

Fix grompp not warning when .mdp values have wrong types

For example, init-lambda-state = 0.35 was silently interpreted as 0.

Issue 1893

Build system enhancements

Allowed NVML support to be toggled

A new CMake advanced option GMX_USE_NVML takes its default value from the result of the NVML detection, thus by default NVML support is on only if the detection succeeds. It can be turned off or on at will, but when set on, it will give a fatal error if the detection did not succeed.

Split the NVML section of the install guide into its own paragraph.

Issue 1835

Improved documentation

Updated pair-list buffer description in reference manual

Several corrections and updates to the manual section that explains the pair-list buffer estimation: * Clarified the role of i and j particles in the equations * Added missing factors t and t^2 for several sigmas * Added missing term in expansion in intermediate result * Added text explaining the approximations made * Rewrote the paragraph on how constrained particles are handled, which matched the code in 4.6, not 5.0 or 5.1 Note that the code and code documentation are correct and up to date.

Rotated Figure 8.2 in manual

Issue 1865

Added suggestions to install guide and cmake for updating binutils

CentOS seems to ship with an old binutils, as well as compiler. Other distros probably also do this. Install guide and cmake messages now explicitly suggest updating such infrastructure.

Fixed a duplicate LaTeX equation label in the reference manual

Documented how potential-switch works

Adjusted the notation in the force-switch section to make clear the difference between the two.

Updated references to HTML and online documentation

Issue 1891

Documented limitations on 32-bit Linux

Large file support does not currently work on 32-bit Linux, so document this in the install guide.

Related to Issue 1834

Improved documentation on OpenCL issue with NVIDIA

Added reference to the known to be buggy OpenCL runtime versions (r349) and version of the single release that has been shown to not exhibit the issues.

House-keeping that reduces users’problems

Avoided finding C++ bindings for SGI’s MPT

Stopped using UNDEFINED as name of a symbol

Apparently SGI’s MPT MPI library defines this symbol, breaking the compilation. We don’t need to use it anyway.

Fixed some OpenCL issues

Added routine to convert error codes into more helpful diagnostics. Called it in one place that needed some troubleshooting, but an overhaul of OpenCL error handling is needed (in master branch).

Introduced new OpenCL control variable to indicate when there is a non-local event upon which it is valid to wait, since it is an error to wait upon an ocl_event that was never returned by an API call.

Updated install guide.

Issue 1871