Enable most of the pulling flavors with GPU update
authorArtem Zhmurov <zhmurov@gmail.com>
Wed, 11 Dec 2019 15:19:15 +0000 (16:19 +0100)
committerArtem Zhmurov <zhmurov@gmail.com>
Wed, 11 Dec 2019 21:06:35 +0000 (22:06 +0100)
Only constraints pulling is not supported, since it is not implemented
in GPU version of LINCS. There is no reason to disallow other flavors
of pulling.

Change-Id: Iceca52bba5e040bd241a156f9cf58ab3556acdac

src/gromacs/mdrun/md.cpp
src/gromacs/pulling/pull.cpp
src/gromacs/pulling/pull.h
src/gromacs/taskassignment/decidegpuusage.cpp

index 4f163faf865f7ef5c3ee9caadb0fee5ec2bf86e8..a5cdccce965c4c94e917a50763c5c1eec0408d04 100644 (file)
@@ -351,7 +351,7 @@ void gmx::LegacySimulator::do_md()
                            "Virtual sites are not supported with the GPU update.\n");
         GMX_RELEASE_ASSERT(ed == nullptr,
                            "Essential dynamics is not supported with the GPU update.\n");
-        GMX_RELEASE_ASSERT(!ir->bPull && !ir->pull,
+        GMX_RELEASE_ASSERT(!ir->bPull || !pull_have_constraint(ir->pull),
                            "Pulling is not supported with the GPU update.\n");
         GMX_RELEASE_ASSERT(fcd->orires.nr == 0,
                            "Orientation restraints are not supported with the GPU update.\n");
index c20deec924102628ce1a33e4c3a6cfa4709c0e39..a93cda1ea6d0638ce7dbf72242bfaf052dc80b5f 100644 (file)
@@ -2351,3 +2351,19 @@ gmx_bool pull_have_constraint(const struct pull_t* pull)
 {
     return pull->bConstraint;
 }
+
+bool pull_have_constraint(const pull_params_t* pullParameters)
+{
+    if (pullParameters == nullptr)
+    {
+        return false;
+    }
+    for (int c = 0; c < pullParameters->ncoord; c++)
+    {
+        if (pullParameters->coord[c].eType == epullCONSTRAINT)
+        {
+            return true;
+        }
+    }
+    return false;
+}
index 20b8bf1d4c6f4454b41d4c6dfc2374e5eee17085..de6ec28f5abcc90d666f2036f18afabfc727392c 100644 (file)
@@ -338,6 +338,12 @@ gmx_bool pull_have_potential(const struct pull_t* pull);
  */
 gmx_bool pull_have_constraint(const struct pull_t* pull);
 
+/*! \brief Returns if inputrec has pull coordinates with constraint pulling.
+ *
+ * \param[in] pullParameters  Pulling input parameters from input record.
+ */
+bool pull_have_constraint(const pull_params_t* pullParameters);
+
 /*! \brief Returns the maxing distance for pulling
  *
  * For distance geometries, only dimensions with pcrd->params[dim]=1
index 69279929be622786b89cc4e514fca4ddf6de208d..b7eff1d3bfc408d3c27e0043857bbc8d362cdc54 100644 (file)
@@ -62,6 +62,7 @@
 #include "gromacs/mdtypes/inputrec.h"
 #include "gromacs/mdtypes/md_enums.h"
 #include "gromacs/mdtypes/mdrunoptions.h"
+#include "gromacs/pulling/pull.h"
 #include "gromacs/taskassignment/taskassignment.h"
 #include "gromacs/topology/mtop_util.h"
 #include "gromacs/topology/topology.h"
@@ -553,10 +554,9 @@ bool decideWhetherToUseGpuForUpdate(const bool        isDomainDecomposition,
     {
         errorMessage += "Essential dynamics is not supported.\n";
     }
-    if (inputrec.bPull || inputrec.pull)
+    if (inputrec.bPull && pull_have_constraint(inputrec.pull))
     {
-        // Pull potentials are actually supported, but constraint pulling is not
-        errorMessage += "Pulling is not supported.\n";
+        errorMessage += "Constraints pulling is not supported.\n";
     }
     if (doOrientationRestraints)
     {