Remove minor broken functionality in gmx bar
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 26 Feb 2019 00:22:21 +0000 (16:22 -0800)
committerMagnus Lundborg <magnus.lundborg@scilifelab.se>
Wed, 27 Feb 2019 09:06:05 +0000 (10:06 +0100)
In the large commit 23eb71d14195e494f215bca1115bdb0b47bd5cf7, this got
broken, because the transition before GROMACS 4.6 to use a lambda that
is a vector of doubles is inconsistent with the practice of embedding
an integer in a filename.

Change-Id: I517a6c329b692d88732a9031de969a6dc77c699c

src/gromacs/gmxana/gmx_bar.cpp

index 602af7d282a185a117ddd165c4d7194270c63482..82a428a4c088030aa1431e5089ad2810da10fba6 100644 (file)
@@ -2659,58 +2659,6 @@ static gmx_bool subtitle2lambda(const char *subtitle, xvg_t *ba, const char *fn,
     return bFound;
 }
 
-static double filename2lambda(const char *fn)
-{
-    double        lambda;
-    const char   *ptr, *digitptr;
-    char         *endptr;
-    int           dirsep;
-    ptr = fn;
-    /* go to the end of the path string and search backward to find the last
-       directory in the path which has to contain the value of lambda
-     */
-    while (ptr[1] != '\0')
-    {
-        ptr++;
-    }
-    /* searching backward to find the second directory separator */
-    dirsep   = 0;
-    digitptr = nullptr;
-    while (ptr >= fn)
-    {
-        if (ptr[0] != DIR_SEPARATOR && ptr[1] == DIR_SEPARATOR)
-        {
-            if (dirsep == 1)
-            {
-                break;
-            }
-            dirsep++;
-        }
-        /* save the last position of a digit between the last two
-           separators = in the last dirname */
-        if (dirsep > 0 && std::isdigit(*ptr))
-        {
-            digitptr = ptr;
-        }
-        ptr--;
-    }
-    if (!digitptr)
-    {
-        gmx_fatal(FARGS, "While trying to read the lambda value from the file path:"
-                  " last directory in the path '%s' does not contain a number", fn);
-    }
-    if (digitptr[-1] == '-')
-    {
-        digitptr--;
-    }
-    lambda = strtod(digitptr, &endptr);
-    if (endptr == digitptr)
-    {
-        gmx_fatal(FARGS, "Malformed number in file path '%s'", fn);
-    }
-    return lambda;
-}
-
 static void read_bar_xvg_lowlevel(const char *fn, const real *temp, xvg_t *ba,
                                   lambda_components_t *lc)
 {
@@ -2784,15 +2732,6 @@ static void read_bar_xvg_lowlevel(const char *fn, const real *temp, xvg_t *ba,
         /* Check if we have a single set, no legend, nset=1 means t and dH/dl */
         if (ba->nset == 1)
         {
-            if (!native_lambda_read)
-            {
-                // Deduce lambda from the file name.
-                // Updated the routine filename2lambda to actually return lambda
-                // to avoid C++ warnings, but this usage does not seem to need it?
-                // EL 2015-07-10
-                filename2lambda(fn);
-                native_lambda_read = TRUE;
-            }
             ba->lambda[0] = ba->native_lambda;
         }
         else