Skip PBC calculation when there are no listed forces
authorSzilárd Páll <pall.szilard@gmail.com>
Thu, 14 Mar 2019 11:56:58 +0000 (12:56 +0100)
committerBerk Hess <hess@kth.se>
Tue, 26 Mar 2019 08:11:11 +0000 (09:11 +0100)
Change-Id: I3857f2e55bdd052d508acc026b6f77ee5dbc2546

src/gromacs/mdlib/force.cpp

index 188ef689b55811fa57bfc924dbe30b0af1efde68..13b2e8bcef9c29d987f92bbc75cc1377ba83abc6 100644 (file)
@@ -323,9 +323,7 @@ void do_force_lowlevel(t_forcerec                   *fr,
      * listed interactions or when correcting for exclusions (for the Group scheme with RF) */
     if (fr->bMolPBC)
     {
-        // TODO: if all listed forces are offloaded to the GPU, both PBC calls below could be skipped.
-        // TODO: after rebase add && haveCpuListedForces(*fr, idef, *fcd) to the condition
-        const auto needPbcForListedForces = bool(flags & GMX_FORCE_LISTED);
+        const auto needPbcForListedForces = bool(flags & GMX_FORCE_LISTED) && haveCpuListedForces(*fr, *idef, *fcd);
         if (needPbcForListedForces || useRfWithGroupScheme)
         {
             /* Since all atoms are in the rectangular or triclinic unit-cell,