Merge branch release-5-1
authorMark Abraham <mark.j.abraham@gmail.com>
Sat, 6 Feb 2016 01:54:15 +0000 (01:54 +0000)
committerMark Abraham <mark.j.abraham@gmail.com>
Sat, 6 Feb 2016 02:00:27 +0000 (02:00 +0000)
Moved new test/readinp.cpp file to fileio where readinp.cpp is
now located. Left skeleton test infrastructure in place but
deactivated until needed again.

Change-Id: I9261aba261314170634322018b4315d2ebe35601

16 files changed:
cmake/gmxVersionInfo.cmake
src/gromacs/ewald/pme.cpp
src/gromacs/fileio/readinp.cpp
src/gromacs/fileio/tests/CMakeLists.txt
src/gromacs/fileio/tests/readinp.cpp [new file with mode: 0644]
src/gromacs/fileio/warninp.cpp
src/gromacs/fileio/warninp.h
src/gromacs/gmxlib/CMakeLists.txt
src/gromacs/gmxlib/tests/CMakeLists.txt [new file with mode: 0644]
src/gromacs/gmxpreprocess/toppush.cpp
src/gromacs/mdlib/calc_verletbuf.cpp
src/gromacs/mdlib/clincs.cpp
src/gromacs/mdlib/constr.cpp
src/gromacs/mdlib/nbnxn_search.cpp
src/gromacs/mdlib/stat.cpp
src/programs/mdrun/runner.cpp

index 56ca2feeb9064e80a031d4f6480f7e0896daa9e4..87b96f0d36ac562c1de2da98db8b782900b7f59e 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -254,7 +254,7 @@ set(REGRESSIONTEST_BRANCH "refs/heads/master")
 # each release. It's hard to test because it is only used for
 # REGRESSIONTEST_DOWNLOAD, which doesn't work until that tarball has
 # been placed on the server.
-set(REGRESSIONTEST_MD5SUM "614a74e9b143bda5476f87f4ce08eec0" CACHE INTERNAL "MD5 sum of the regressiontests tarball")
+set(REGRESSIONTEST_MD5SUM "3f663536649db883a5616f25f95ac927" CACHE INTERNAL "MD5 sum of the regressiontests tarball")
 
 math(EXPR GMX_VERSION_NUMERIC
      "${GMX_VERSION_MAJOR}*10000 + ${GMX_VERSION_PATCH}")
index 353cfa02218b52a82e2a17cd83c27e68deb8a431..81db679a23b7a1b0906da625a0e98270348d7400 100644 (file)
@@ -927,6 +927,7 @@ int gmx_pme_do(struct gmx_pme_t *pme,
     int                  fep_state;
     int                  fep_states_lj           = pme->bFEP_lj ? 2 : 1;
     const gmx_bool       bCalcEnerVir            = flags & GMX_PME_CALC_ENER_VIR;
+    const gmx_bool       bBackFFT                = flags & (GMX_PME_CALC_F | GMX_PME_CALC_POT);
     const gmx_bool       bCalcF                  = flags & GMX_PME_CALC_F;
 
     assert(pme->nnodes > 0);
@@ -1140,7 +1141,7 @@ int gmx_pme_do(struct gmx_pme_t *pme,
                     }
                 }
 
-                if (bCalcF)
+                if (bBackFFT)
                 {
                     /* do 3d-invfft */
                     if (thread == 0)
@@ -1177,7 +1178,7 @@ int gmx_pme_do(struct gmx_pme_t *pme,
          * With MPI we have to synchronize here before gmx_sum_qgrid_dd.
          */
 
-        if (bCalcF)
+        if (bBackFFT)
         {
             /* distribute local grid to all nodes */
 #if GMX_MPI
@@ -1189,7 +1190,10 @@ int gmx_pme_do(struct gmx_pme_t *pme,
             where();
 
             unwrap_periodic_pmegrid(pme, grid);
+        }
 
+        if (bCalcF)
+        {
             /* interpolate forces for our local atoms */
 
             where();
@@ -1417,7 +1421,7 @@ int gmx_pme_do(struct gmx_pme_t *pme,
                 get_pme_ener_vir_lj(pme->solve_work, pme->nthread, &energy_AB[2+fep_state], vir_AB[2+fep_state]);
             }
 
-            if (bCalcF)
+            if (bBackFFT)
             {
                 bFirst = !(flags & GMX_PME_DO_COULOMB);
                 calc_initial_lb_coeffs(pme, local_c6, local_sigma);
@@ -1475,26 +1479,31 @@ int gmx_pme_do(struct gmx_pme_t *pme,
 
                     unwrap_periodic_pmegrid(pme, grid);
 
-                    /* interpolate forces for our local atoms */
-                    where();
-                    bClearF = (bFirst && PAR(cr));
-                    scale   = pme->bFEP ? (fep_state < 1 ? 1.0-lambda_lj : lambda_lj) : 1.0;
-                    scale  *= lb_scale_factor[grid_index-2];
-#pragma omp parallel for num_threads(pme->nthread) schedule(static)
-                    for (thread = 0; thread < pme->nthread; thread++)
+                    if (bCalcF)
                     {
-                        try
+                        /* interpolate forces for our local atoms */
+                        where();
+                        bClearF = (bFirst && PAR(cr));
+                        scale   = pme->bFEP ? (fep_state < 1 ? 1.0-lambda_lj : lambda_lj) : 1.0;
+                        scale  *= lb_scale_factor[grid_index-2];
+
+#pragma omp parallel for num_threads(pme->nthread) schedule(static)
+                        for (thread = 0; thread < pme->nthread; thread++)
                         {
-                            gather_f_bsplines(pme, grid, bClearF, &pme->atc[0],
-                                              &pme->atc[0].spline[thread],
-                                              scale);
+                            try
+                            {
+                                gather_f_bsplines(pme, grid, bClearF, &pme->atc[0],
+                                                  &pme->atc[0].spline[thread],
+                                                  scale);
+                            }
+                            GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
                         }
-                        GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
-                    }
-                    where();
 
-                    inc_nrnb(nrnb, eNR_GATHERFBSP,
-                             pme->pme_order*pme->pme_order*pme->pme_order*pme->atc[0].n);
+                        where();
+
+                        inc_nrnb(nrnb, eNR_GATHERFBSP,
+                                 pme->pme_order*pme->pme_order*pme->pme_order*pme->atc[0].n);
+                    }
                     wallcycle_stop(wcycle, ewcPME_SPREADGATHER);
 
                     bFirst = FALSE;
index 6a5f63f40ab3e82496a83d155032172dd5d9510f..0f182a718c5389f1d44efd70aa0d843b3e8780e3 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -83,6 +83,9 @@ t_inpfile *read_inpfile(const char *fn, int *ninp,
         set_warning_line(wi, fn, lc);
         if (ptr)
         {
+            // TODO This parsing should be using strip_comment, trim,
+            // strchr, etc. rather than re-inventing wheels.
+
             /* Strip comment */
             if ((cptr = std::strchr(buf, COMMENTSIGN)) != NULL)
             {
@@ -376,6 +379,7 @@ static int get_einp(int *ninp, t_inpfile **inp, const char *name)
     }
 }
 
+/* Note that sanitizing the trailing part of (*inp)[ii].value was the responsibility of read_inpfile() */
 int get_eint(int *ninp, t_inpfile **inp, const char *name, int def,
              warninp_t wi)
 {
@@ -395,7 +399,7 @@ int get_eint(int *ninp, t_inpfile **inp, const char *name, int def,
     else
     {
         ret = std::strtol((*inp)[ii].value, &ptr, 10);
-        if (ptr == (*inp)[ii].value)
+        if (*ptr != '\0')
         {
             sprintf(warn_buf, "Right hand side '%s' for parameter '%s' in parameter file is not an integer value\n", (*inp)[ii].value, (*inp)[ii].name);
             warning_error(wi, warn_buf);
@@ -405,6 +409,7 @@ int get_eint(int *ninp, t_inpfile **inp, const char *name, int def,
     }
 }
 
+/* Note that sanitizing the trailing part of (*inp)[ii].value was the responsibility of read_inpfile() */
 gmx_int64_t get_eint64(int *ninp, t_inpfile **inp,
                        const char *name, gmx_int64_t def,
                        warninp_t wi)
@@ -425,7 +430,7 @@ gmx_int64_t get_eint64(int *ninp, t_inpfile **inp,
     else
     {
         ret = str_to_int64_t((*inp)[ii].value, &ptr);
-        if (ptr == (*inp)[ii].value)
+        if (*ptr != '\0')
         {
             sprintf(warn_buf, "Right hand side '%s' for parameter '%s' in parameter file is not an integer value\n", (*inp)[ii].value, (*inp)[ii].name);
             warning_error(wi, warn_buf);
@@ -435,6 +440,7 @@ gmx_int64_t get_eint64(int *ninp, t_inpfile **inp,
     }
 }
 
+/* Note that sanitizing the trailing part of (*inp)[ii].value was the responsibility of read_inpfile() */
 double get_ereal(int *ninp, t_inpfile **inp, const char *name, double def,
                  warninp_t wi)
 {
@@ -454,7 +460,7 @@ double get_ereal(int *ninp, t_inpfile **inp, const char *name, double def,
     else
     {
         ret = strtod((*inp)[ii].value, &ptr);
-        if (ptr == (*inp)[ii].value)
+        if (*ptr != '\0')
         {
             sprintf(warn_buf, "Right hand side '%s' for parameter '%s' in parameter file is not a real value\n", (*inp)[ii].value, (*inp)[ii].name);
             warning_error(wi, warn_buf);
@@ -464,6 +470,7 @@ double get_ereal(int *ninp, t_inpfile **inp, const char *name, double def,
     }
 }
 
+/* Note that sanitizing the trailing part of (*inp)[ii].value was the responsibility of read_inpfile() */
 const char *get_estr(int *ninp, t_inpfile **inp, const char *name, const char *def)
 {
     char buf[32];
@@ -491,6 +498,7 @@ const char *get_estr(int *ninp, t_inpfile **inp, const char *name, const char *d
     }
 }
 
+/* Note that sanitizing the trailing part of (*inp)[ii].value was the responsibility of read_inpfile() */
 int get_eeenum(int *ninp, t_inpfile **inp, const char *name, const char **defs,
                warninp_t wi)
 {
index 8f83ed1cca72940202b559308d4b1eb2324ec14b..d800b19cdf9efd81f57156cc8bc14a6a38d64cf2 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -34,6 +34,7 @@
 
 set(test_sources
     confio.cpp
+    readinp.cpp
     )
 if (GMX_USE_TNG)
     list(APPEND test_sources tngio.cpp)
diff --git a/src/gromacs/fileio/tests/readinp.cpp b/src/gromacs/fileio/tests/readinp.cpp
new file mode 100644 (file)
index 0000000..506a3db
--- /dev/null
@@ -0,0 +1,149 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2016, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \internal \file
+ * \brief
+ * Tests utilities for routines that parse fields e.g. from grompp input
+ *
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ */
+#include "gmxpre.h"
+
+#include "gromacs/fileio/readinp.h"
+
+#include <gtest/gtest.h>
+
+#include "gromacs/fileio/warninp.h"
+#include "gromacs/utility/scoped_cptr.h"
+#include "gromacs/utility/smalloc.h"
+
+namespace gmx
+{
+namespace testing
+{
+
+class ReadTest : public ::testing::Test
+{
+    public:
+        ReadTest() : numInputs_(1),
+                     inputField_(0),
+                     inpGuard_(),
+                     wi_(),
+                     wiGuard_()
+        {
+            snew(inputField_, numInputs_);
+            inpGuard_.reset(inputField_);
+
+            inputField_[0].count     = 0;
+            inputField_[0].bObsolete = FALSE;
+            inputField_[0].bSet      = FALSE;
+            inputField_[0].name      = (char *) "test";
+            inputField_[0].inp_count = 0;
+
+            wi_ = init_warning(FALSE, 0);
+            wiGuard_.reset(wi_);
+        }
+
+        int                                            numInputs_;
+        t_inpfile                                     *inputField_;
+        gmx::scoped_cptr<t_inpfile>                    inpGuard_;
+        warninp_t                                      wi_;
+        gmx::scoped_cptr<struct warninp, free_warning> wiGuard_;
+};
+
+TEST_F(ReadTest, get_eint_ReadsInteger)
+{
+    inputField_[0].value = (char *) "1";
+    ASSERT_EQ(1, get_eint(&numInputs_, &inputField_, "test", 2, wi_));
+    ASSERT_FALSE(warning_errors_exist(wi_));
+}
+
+TEST_F(ReadTest, get_eint_WarnsAboutFloat)
+{
+    inputField_[0].value = (char *) "0.8";
+    get_eint(&numInputs_, &inputField_, "test", 2, wi_);
+    ASSERT_TRUE(warning_errors_exist(wi_));
+}
+
+TEST_F(ReadTest, get_eint_WarnsAboutString)
+{
+    inputField_[0].value = (char *) "hello";
+    get_eint(&numInputs_, &inputField_, "test", 2, wi_);
+    ASSERT_TRUE(warning_errors_exist(wi_));
+}
+
+TEST_F(ReadTest, get_eint64_ReadsInteger)
+{
+    inputField_[0].value = (char *) "1";
+    ASSERT_EQ(1, get_eint64(&numInputs_, &inputField_, "test", 2, wi_));
+    ASSERT_FALSE(warning_errors_exist(wi_));
+}
+
+TEST_F(ReadTest, get_eint64_WarnsAboutFloat)
+{
+    inputField_[0].value = (char *) "0.8";
+    get_eint64(&numInputs_, &inputField_, "test", 2, wi_);
+    ASSERT_TRUE(warning_errors_exist(wi_));
+}
+
+TEST_F(ReadTest, get_eint64_WarnsAboutString)
+{
+    inputField_[0].value = (char *) "hello";
+    get_eint64(&numInputs_, &inputField_, "test", 2, wi_);
+    ASSERT_TRUE(warning_errors_exist(wi_));
+}
+
+TEST_F(ReadTest, get_ereal_ReadsInteger)
+{
+    inputField_[0].value = (char *) "1";
+    ASSERT_EQ(1, get_ereal(&numInputs_, &inputField_, "test", 2, wi_));
+    ASSERT_FALSE(warning_errors_exist(wi_));
+}
+
+TEST_F(ReadTest, get_ereal_ReadsFloat)
+{
+    inputField_[0].value = (char *) "0.8";
+    ASSERT_EQ(0.8, get_ereal(&numInputs_, &inputField_, "test", 2, wi_));
+    ASSERT_FALSE(warning_errors_exist(wi_));
+}
+
+TEST_F(ReadTest, get_ereal_WarnsAboutString)
+{
+    inputField_[0].value = (char *) "hello";
+    get_ereal(&numInputs_, &inputField_, "test", 2, wi_);
+    ASSERT_TRUE(warning_errors_exist(wi_));
+}
+
+} // namespace
+} // namespace
index c247852c29b4c9633945f06d85cb115eb1ad66d0..d6231cfa31fcbdb2c4eff22b1813969aaa05a109 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -176,6 +176,11 @@ void check_warning_error(warninp_t wi, int f_errno, const char *file, int line)
     }
 }
 
+gmx_bool warning_errors_exist(warninp_t wi)
+{
+    return (wi->nwarn_error > 0);
+}
+
 void done_warning(warninp_t wi, int f_errno, const char *file, int line)
 {
     print_warn_count("note", wi->nwarn_note);
@@ -191,6 +196,11 @@ void done_warning(warninp_t wi, int f_errno, const char *file, int line)
                   wi->nwarn_warn);
     }
 
+    free_warning(wi);
+}
+
+void free_warning(warninp_t wi)
+{
     sfree(wi);
 }
 
index 1324e4996c6f16b36b68b8a83bdb3341ef43d28b..d8efa10e7c4eb535f05b45e9a592f7e455b079fc 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -95,6 +95,9 @@ warning_error(warninp_t wi, const char *s);
  * are printed, nwarn_error (local) is incremented.
  */
 
+gmx_bool warning_errors_exist(warninp_t wi);
+/* Return whether any error-level warnings were issued to wi. */
+
 void
 check_warning_error(warninp_t wi, int f_errno, const char *file, int line);
 /* When warning_error has been called at least once gmx_fatal is called,
@@ -110,6 +113,10 @@ done_warning(warninp_t wi, int f_errno, const char *file, int line);
  * Frees the data structure pointed to by wi.
  */
 
+void
+free_warning(warninp_t wi);
+/* Frees the data structure pointed to by wi. */
+
 void
 _too_few(warninp_t wi, const char *fn, int line);
 #define too_few(wi) _too_few(wi, __FILE__, __LINE__)
index 22ac02f65fc7c5bf309c68aff8b17b0608203542..50d052de34f4d1ed5416fabea17eec33f48f92fe 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2009,2010,2012,2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2012,2014,2015,2016, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -39,3 +39,7 @@ add_subdirectory(nonbonded)
 file(GLOB GMXLIB_SOURCES *.cpp)
 
 set(GMXLIB_SOURCES ${GMXLIB_SOURCES} ${NONBONDED_SOURCES} PARENT_SCOPE)
+
+# if(BUILD_TESTING)
+#     add_subdirectory(tests)
+# endif()
diff --git a/src/gromacs/gmxlib/tests/CMakeLists.txt b/src/gromacs/gmxlib/tests/CMakeLists.txt
new file mode 100644 (file)
index 0000000..66ee98c
--- /dev/null
@@ -0,0 +1,36 @@
+#
+# This file is part of the GROMACS molecular simulation package.
+#
+# Copyright (c) 2016, by the GROMACS development team, led by
+# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+# and including many others, as listed in the AUTHORS file in the
+# top-level source directory and at http://www.gromacs.org.
+#
+# GROMACS is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public License
+# as published by the Free Software Foundation; either version 2.1
+# of the License, or (at your option) any later version.
+#
+# GROMACS is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public
+# License along with GROMACS; if not, see
+# http://www.gnu.org/licenses, or write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+#
+# If you want to redistribute modifications to GROMACS, please
+# consider that scientific software is very special. Version
+# control is crucial - bugs must be traceable. We will be happy to
+# consider code for inclusion in the official distribution, but
+# derived work must not be called official GROMACS. Details are found
+# in the README & COPYING files - if they are missing, get the
+# official version at http://www.gromacs.org.
+#
+# To help us fund GROMACS development, we humbly ask that you cite
+# the research papers on the package. Check out http://www.gromacs.org.
+
+gmx_add_unit_test(GmxlibTests gmxlib-test
+    )
index 35d80c6cb9aeb5c1b9e1e3fb737b5f3ce687a417..d7ff189ea0996182409dbed88340a12bd8ed88cd 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -2699,27 +2699,38 @@ static void set_excl_all(t_blocka *excl)
 }
 
 static void decouple_atoms(t_atoms *atoms, int atomtype_decouple,
-                           int couple_lam0, int couple_lam1)
+                           int couple_lam0, int couple_lam1,
+                           const char *mol_name)
 {
     int i;
 
     for (i = 0; i < atoms->nr; i++)
     {
+        t_atom *atom;
+
+        atom = &atoms->atom[i];
+
+        if (atom->qB != atom->q || atom->typeB != atom->type)
+        {
+            gmx_fatal(FARGS, "Atom %d in molecule type '%s' has different A and B state charges and/or atom types set in the topology file as well as through the mdp option '%s'. You can not use both these methods simultaneously.",
+                      i + 1, mol_name, "couple-moltype");
+        }
+
         if (couple_lam0 == ecouplamNONE || couple_lam0 == ecouplamVDW)
         {
-            atoms->atom[i].q     = 0.0;
+            atom->q     = 0.0;
         }
         if (couple_lam0 == ecouplamNONE || couple_lam0 == ecouplamQ)
         {
-            atoms->atom[i].type  = atomtype_decouple;
+            atom->type  = atomtype_decouple;
         }
         if (couple_lam1 == ecouplamNONE || couple_lam1 == ecouplamVDW)
         {
-            atoms->atom[i].qB    = 0.0;
+            atom->qB    = 0.0;
         }
         if (couple_lam1 == ecouplamNONE || couple_lam1 == ecouplamQ)
         {
-            atoms->atom[i].typeB = atomtype_decouple;
+            atom->typeB = atomtype_decouple;
         }
     }
 }
@@ -2734,5 +2745,6 @@ void convert_moltype_couple(t_molinfo *mol, int atomtype_decouple, real fudgeQQ,
         generate_LJCpairsNB(mol, nb_funct, nbp);
         set_excl_all(&mol->excls);
     }
-    decouple_atoms(&mol->atoms, atomtype_decouple, couple_lam0, couple_lam1);
+    decouple_atoms(&mol->atoms, atomtype_decouple, couple_lam0, couple_lam1,
+                   *mol->name);
 }
index d89960c9fcf9882c7ed9ec885ef80cdea1564f6d..e8434bec9337e1dd4f84715b428ed6d4215e2e86 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -823,6 +823,15 @@ void calc_verlet_buffer_size(const gmx_mtop_t *mtop, real boxvol,
     real                  rb, rl;
     real                  drift;
 
+    if (!EI_DYNAMICS(ir->eI))
+    {
+        gmx_incons("Can only determine the Verlet buffer size for integrators that perform dynamics");
+    }
+    if (ir->verletbuf_tol <= 0)
+    {
+        gmx_incons("The Verlet buffer tolerance needs to be larger than zero");
+    }
+
     if (reference_temperature < 0)
     {
         if (EI_MD(ir->eI) && ir->etc == etcNO)
index bf9235138b7ec920bd41ed3a16a84a49087e8e17..bc8bbf91ea4830db422d6555bbb1c20b9161e56f 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -127,6 +127,7 @@ typedef struct gmx_lincsdata {
     gmx_bitmask_t  *atf;          /* atom flags for thread parallelization */
     int             atf_nalloc;   /* allocation size of atf */
     gmx_bool        bTaskDep;     /* are the LINCS tasks interdependent? */
+    gmx_bool        bTaskDepTri;  /* are there triangle constraints that cross task borders? */
     /* arrays for temporary storage in the LINCS algorithm */
     rvec           *tmpv;
     real           *tmpncc;
@@ -271,6 +272,15 @@ static void lincs_matrix_expand(const struct gmx_lincsdata *lincsd,
             rhs1 = rhs2;
             rhs2 = swap;
         } /* nrec*(ntriangle + ncc_triangle*2) flops */
+
+        if (lincsd->bTaskDepTri)
+        {
+            /* The constraints triangles are decoupled from each other,
+             * but constraints in one triangle cross thread task borders.
+             * We could probably avoid this with more advanced setup code.
+             */
+#pragma omp barrier
+        }
     }
 }
 
@@ -1150,13 +1160,15 @@ static void do_lincs(rvec *x, rvec *xp, matrix box, t_pbc *pbc,
 static void set_lincs_matrix_task(struct gmx_lincsdata *li,
                                   lincs_task_t         *li_task,
                                   const real           *invmass,
-                                  int                  *ncc_triangle)
+                                  int                  *ncc_triangle,
+                                  int                  *nCrossTaskTriangles)
 {
     int        i;
 
     /* Construct the coupling coefficient matrix blmf */
-    li_task->ntriangle = 0;
-    *ncc_triangle      = 0;
+    li_task->ntriangle   = 0;
+    *ncc_triangle        = 0;
+    *nCrossTaskTriangles = 0;
     for (i = li_task->b0; i < li_task->b1; i++)
     {
         int a1, a2, n;
@@ -1206,12 +1218,16 @@ static void set_lincs_matrix_task(struct gmx_lincsdata *li,
                     if (kk != i && kk != k &&
                         (li->bla[2*kk] == end || li->bla[2*kk+1] == end))
                     {
-                        /* If we are using multiple tasks for LINCS,
-                         * the calls to check_assign_triangle should have
-                         * put all constraints in the triangle in our task.
+                        /* Check if the constraints in this triangle actually
+                         * belong to a different task. We still assign them
+                         * here, since it's convenient for the triangle
+                         * iterations, but we then need an extra barrier.
                          */
-                        assert(k  >= li_task->b0 && k  < li_task->b1);
-                        assert(kk >= li_task->b0 && kk < li_task->b1);
+                        if (k  < li_task->b0 || k  >= li_task->b1 ||
+                            kk < li_task->b0 || kk >= li_task->b1)
+                        {
+                            (*nCrossTaskTriangles)++;
+                        }
 
                         if (li_task->ntriangle == 0 ||
                             li_task->triangle[li_task->ntriangle - 1] < i)
@@ -1253,26 +1269,33 @@ void set_lincs_matrix(struct gmx_lincsdata *li, real *invmass, real lambda)
     }
 
     /* Construct the coupling coefficient matrix blmf */
-    int th, ntriangle = 0, ncc_triangle = 0;
-#pragma omp parallel for reduction(+: ntriangle, ncc_triangle) num_threads(li->ntask) schedule(static)
+    int th, ntriangle = 0, ncc_triangle = 0, nCrossTaskTriangles = 0;
+#pragma omp parallel for reduction(+: ntriangle, ncc_triangle, nCrossTaskTriangles) num_threads(li->ntask) schedule(static)
     for (th = 0; th < li->ntask; th++)
     {
         try
         {
-            set_lincs_matrix_task(li, &li->task[th], invmass, &ncc_triangle);
+            set_lincs_matrix_task(li, &li->task[th], invmass,
+                                  &ncc_triangle, &nCrossTaskTriangles);
             ntriangle = li->task[th].ntriangle;
         }
         GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
     }
     li->ntriangle    = ntriangle;
     li->ncc_triangle = ncc_triangle;
+    li->bTaskDepTri  = (nCrossTaskTriangles > 0);
 
     if (debug)
     {
-        fprintf(debug, "Of the %d constraints %d participate in triangles\n",
+        fprintf(debug, "The %d constraints participate in %d triangles\n",
                 li->nc, li->ntriangle);
-        fprintf(debug, "There are %d couplings of which %d in triangles\n",
+        fprintf(debug, "There are %d constraint couplings, of which %d in triangles\n",
                 li->ncc, li->ncc_triangle);
+        if (li->ntriangle > 0 && li->ntask > 1)
+        {
+            fprintf(debug, "%d constraint triangles contain constraints assigned to different tasks\n",
+                    nCrossTaskTriangles);
+        }
     }
 
     /* Set matlam,
index 2e9c9b45ae1b2da4b4ace55f9a36d78ed03c621c..5b850d0f5673be171eeca00c67a3827b5cdcb5ff 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -470,6 +470,8 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner,
                         if (th > 0)
                         {
                             clear_mat(constr->vir_r_m_dr_th[th]);
+
+                            constr->settle_error[th] = -1;
                         }
 
                         start_th = (nsettle* th   )/nth;
@@ -543,40 +545,30 @@ gmx_bool constrain(FILE *fplog, gmx_bool bLog, gmx_bool bEner,
 
     if (settle->nr > 0)
     {
-        /* Combine virial and error info of the other threads */
-        for (i = 1; i < nth; i++)
-        {
-            settle_error = constr->settle_error[i];
-        }
         if (vir != NULL)
         {
+            /* Reduce the virial contributions over the threads */
             for (i = 1; i < nth; i++)
             {
                 m_add(vir_r_m_dr, constr->vir_r_m_dr_th[i], vir_r_m_dr);
             }
         }
 
-        if (econq == econqCoord && settle_error >= 0)
+        if (econq == econqCoord)
         {
-            bOK = FALSE;
-            if (constr->maxwarn >= 0)
+            for (i = 1; i < nth; i++)
             {
-                char buf[256];
-                sprintf(buf,
-                        "\nstep " "%" GMX_PRId64 ": Water molecule starting at atom %d can not be "
-                        "settled.\nCheck for bad contacts and/or reduce the timestep if appropriate.\n",
-                        step, ddglatnr(cr->dd, settle->iatoms[settle_error*(1+NRAL(F_SETTLE))+1]));
-                if (fplog)
-                {
-                    fprintf(fplog, "%s", buf);
-                }
-                fprintf(stderr, "%s", buf);
-                constr->warncount_settle++;
-                if (constr->warncount_settle > constr->maxwarn)
-                {
-                    too_many_constraint_warnings(-1, constr->warncount_settle);
-                }
-                bDump = TRUE;
+                settle_error = std::max(settle_error, constr->settle_error[i]);
+            }
+
+            if (settle_error >= 0)
+            {
+                dump_confs(fplog, step, constr->warn_mtop, start, homenr, cr, x, xprime, box);
+
+                gmx_fatal(FARGS,
+                          "\nstep " "%" GMX_PRId64 ": Water molecule starting at atom %d can not be "
+                          "settled.\nCheck for bad contacts and/or reduce the timestep if appropriate.\n",
+                          step, ddglatnr(cr->dd, settle->iatoms[settle_error*(1+NRAL(F_SETTLE))+1]));
             }
         }
     }
index d1656c1fa058e1d506c8bed6a65f16ed26872602..54a5b310202aa4f3a9c5ae804612a304a9431e47 100644 (file)
@@ -771,6 +771,9 @@ static void nbnxn_init_pairlist(nbnxn_pairlist_t *nbl,
     nbl->nci         = 0;
     nbl->ci          = NULL;
     nbl->ci_nalloc   = 0;
+    nbl->nsci        = 0;
+    nbl->sci         = NULL;
+    nbl->sci_nalloc  = 0;
     nbl->ncj         = 0;
     nbl->cj          = NULL;
     nbl->cj_nalloc   = 0;
index b4ce57091ca6d2f5b8681a12cf9da7de44c50164..7c6de83ec44ef1f4b8290d8e7a9c4f8ea2eee051 100644 (file)
@@ -150,7 +150,7 @@ void global_stat(gmx_global_stat_t gs,
     t_bin     *rb;
     int       *itc0, *itc1;
     int        ie    = 0, ifv = 0, isv = 0, irmsd = 0, imu = 0;
-    int        idedl = 0, idvdll = 0, idvdlnl = 0, iepl = 0, icm = 0, imass = 0, ica = 0, inb = 0;
+    int        idedl = 0, idedlo = 0, idvdll = 0, idvdlnl = 0, iepl = 0, icm = 0, imass = 0, ica = 0, inb = 0;
     int        isig  = -1;
     int        icj   = -1, ici = -1, icx = -1;
     int        inn[egNR];
@@ -217,6 +217,10 @@ void global_stat(gmx_global_stat_t gs,
             /* these probably need to be put into one of these categories */
             where();
             idedl = add_binr(rb, 1, &(ekind->dekindl));
+            if (bSumEkinhOld)
+            {
+                idedlo = add_binr(rb, 1, &(ekind->dekindl_old));
+            }
             where();
             ica   = add_binr(rb, 1, &(ekind->cosacc.mvcos));
             where();
@@ -329,6 +333,10 @@ void global_stat(gmx_global_stat_t gs,
                 }
             }
             extract_binr(rb, idedl, 1, &(ekind->dekindl));
+            if (bSumEkinhOld)
+            {
+                extract_binr(rb, idedlo, 1, &(ekind->dekindl_old));
+            }
             extract_binr(rb, ica, 1, &(ekind->cosacc.mvcos));
             where();
         }
index b03852d0ef11eff6faac9b216e552da3ec3e0d48..addebac4994f702ac02cdd25a5dc4041503dd37c 100644 (file)
@@ -540,7 +540,9 @@ static void prepare_verlet_scheme(FILE                           *fplog,
                                   gmx_bool                        bUseGPU)
 {
     /* For NVE simulations, we will retain the initial list buffer */
-    if (ir->verletbuf_tol > 0 && !(EI_MD(ir->eI) && ir->etc == etcNO))
+    if (EI_DYNAMICS(ir->eI) &&
+        ir->verletbuf_tol > 0 &&
+        !(EI_MD(ir->eI) && ir->etc == etcNO))
     {
         /* Update the Verlet buffer size for the current run setup */
         verletbuf_list_setup_t ls;