int i, j;
int donb_flags;
int pme_flags;
- t_pbc pbc;
real dvdl_dum[efptNR], dvdl_nb[efptNR];
#if GMX_MPI
double t0 = 0.0, t1, t2, t3; /* time measurement for coarse load balancing */
#endif
- set_pbc(&pbc, fr->ePBC, box);
-
/* reset free energy components */
for (i = 0; i < efptNR; i++)
{
inc_nrnb(nrnb, eNR_SHIFTX, graph->nnodes);
}
}
- /* Check whether we need to do listed interactions or correct for exclusions */
- if (fr->bMolPBC &&
- ((flags & GMX_FORCE_LISTED)
- || EEL_RF(fr->ic->eeltype) || EEL_FULL(fr->ic->eeltype) || EVDW_PME(fr->ic->vdwtype)))
+
+ t_pbc pbc;
+ const bool useRfWithGroupScheme = (fr->cutoff_scheme == ecutsGROUP) && EEL_RF(fr->ic->eeltype);
+ /* Check whether we need to take into account PBC in the following force tasks:
+ * listed interactions or when correcting for exclusions (for the Group scheme with RF) */
+ if (fr->bMolPBC)
{
- /* TODO There are no electrostatics methods that require this
- transformation, when using the Verlet scheme, so update the
- above conditional. */
- /* Since all atoms are in the rectangular or triclinic unit-cell,
- * only single box vector shifts (2 in x) are required.
- */
- set_pbc_dd(&pbc, fr->ePBC, DOMAINDECOMP(cr) ? cr->dd->nc : nullptr,
- TRUE, box);
+ // 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);
+ if (needPbcForListedForces || useRfWithGroupScheme)
+ {
+ /* Since all atoms are in the rectangular or triclinic unit-cell,
+ * only single box vector shifts (2 in x) are required.
+ */
+ set_pbc_dd(&pbc, fr->ePBC, DOMAINDECOMP(cr) ? cr->dd->nc : nullptr,
+ TRUE, box);
+ }
}
do_force_listed(wcycle, box, ir->fepvals, cr, ms,
* With the Verlet scheme, exclusion forces are calculated
* in the non-bonded kernel.
*/
- if (ir->cutoff_scheme != ecutsVERLET && EEL_RF(fr->ic->eeltype))
+ if (useRfWithGroupScheme)
{
real dvdl_rf_excl = 0;
enerd->term[F_RF_EXCL] =