Use reduced default tolerances for tpx comparison
authorErik Lindahl <erik@kth.se>
Sun, 17 Dec 2017 10:03:17 +0000 (11:03 +0100)
committerMark Abraham <mark.j.abraham@gmail.com>
Tue, 19 Dec 2017 00:57:18 +0000 (01:57 +0100)
The tolerances for gmx check are mainly intended
for handling slight statistical deviations, but they
can hide differences between tpr files, when the
user likely wants exact checks. This changes
changes the default relative tolerance to 0.000001
and the absolute tolerance to zero, so that we only
allow for minor differences due to compiler optimization.

Fixes #2024.

Change-Id: I55b882a194d931bf5c36541e25339b6e1eb0a1e4

src/gromacs/tools/check.cpp

index 691d0b136d8b829d94cdb3b4578891d7fbcba0d0..6605352eae5d2e3e5b3c41f1da8abff21b27a4ae 100644 (file)
@@ -831,7 +831,11 @@ int gmx_check(int argc, char *argv[])
         "virtual sites. With these flags, [TT]gmx check[tt] provides a quick check for such problems.[PAR]",
         "The program can compare two run input ([REF].tpr[ref])",
         "files",
-        "when both [TT]-s1[tt] and [TT]-s2[tt] are supplied.",
+        "when both [TT]-s1[tt] and [TT]-s2[tt] are supplied. When comparing",
+        "run input files this way, the default relative tolerance is reduced",
+        "to 0.000001 and the absolute tolerance set to zero to find any differences",
+        "not due to minor compiler optimization differences, although you can",
+        "of course still set any other tolerances through the options."
         "Similarly a pair of trajectory files can be compared (using the [TT]-f2[tt]",
         "option), or a pair of energy files (using the [TT]-e2[tt] option).[PAR]",
         "For free energy simulations the A and B state topology from one",
@@ -915,6 +919,16 @@ int gmx_check(int argc, char *argv[])
             }
             fn2 = nullptr;
         }
+
+        fprintf(stderr, "Note: When comparing run input files, default tolerances are reduced.\n");
+        if (!opt2parg_bSet("-tol", asize(pa), pa))
+        {
+            ftol = 0.000001;
+        }
+        if (!opt2parg_bSet("-abstol", asize(pa), pa))
+        {
+            abstol = 0;
+        }
         comp_tpx(fn1, fn2, bRMSD, ftol, abstol);
     }
     else if (fn1 && tex)