Decouple update-group aspects of vsites and constraints
[alexxy/gromacs.git] / src / gromacs / mdlib / constr.cpp
index ecaaa2c85f5a0b1e92e2c8f8bd819e71afc5407d..ef7be1b06d0a5b873afb67f63a54d8b713b13a1d 100644 (file)
@@ -104,6 +104,7 @@ public:
          pull_t*               pull_work,
          FILE*                 log_p,
          const t_commrec*      cr_p,
+         bool                  useUpdateGroups,
          const gmx_multisim_t* ms,
          t_nrnb*               nrnb,
          gmx_wallcycle*        wcycle_p,
@@ -1080,13 +1081,14 @@ Constraints::Constraints(const gmx_mtop_t&     mtop,
                          pull_t*               pull_work,
                          FILE*                 log,
                          const t_commrec*      cr,
+                         const bool            useUpdateGroups,
                          const gmx_multisim_t* ms,
                          t_nrnb*               nrnb,
                          gmx_wallcycle*        wcycle,
                          bool                  pbcHandlingRequired,
                          int                   numConstraints,
                          int                   numSettles) :
-    impl_(new Impl(mtop, ir, pull_work, log, cr, ms, nrnb, wcycle, pbcHandlingRequired, numConstraints, numSettles))
+    impl_(new Impl(mtop, ir, pull_work, log, cr, useUpdateGroups, ms, nrnb, wcycle, pbcHandlingRequired, numConstraints, numSettles))
 {
 }
 
@@ -1095,6 +1097,7 @@ Constraints::Impl::Impl(const gmx_mtop_t&     mtop_p,
                         pull_t*               pull_work,
                         FILE*                 log_p,
                         const t_commrec*      cr_p,
+                        const bool            mayHaveSplitConstraints,
                         const gmx_multisim_t* ms_p,
                         t_nrnb*               nrnb_p,
                         gmx_wallcycle*        wcycle_p,
@@ -1151,23 +1154,20 @@ Constraints::Impl::Impl(const gmx_mtop_t&     mtop_p,
             }
         }
 
+        // When there are multiple PP domains and update groups are not in use,
+        // the constraints might be split across them.
         if (ir.eConstrAlg == ConstraintAlgorithm::Lincs)
         {
-            lincsd = init_lincs(log,
-                                mtop,
-                                nflexcon,
-                                at2con_mt,
-                                DOMAINDECOMP(cr) && ddHaveSplitConstraints(*cr->dd),
-                                ir.nLincsIter,
-                                ir.nProjOrder);
+            lincsd = init_lincs(
+                    log, mtop, nflexcon, at2con_mt, mayHaveSplitConstraints, ir.nLincsIter, ir.nProjOrder);
         }
 
         if (ir.eConstrAlg == ConstraintAlgorithm::Shake)
         {
-            if (DOMAINDECOMP(cr) && ddHaveSplitConstraints(*cr->dd))
+            if (mayHaveSplitConstraints)
             {
                 gmx_fatal(FARGS,
-                          "SHAKE is not supported with domain decomposition and constraint that "
+                          "SHAKE is not supported with domain decomposition and constraints that "
                           "cross domain boundaries, use LINCS");
             }
             if (nflexcon)