GMX_BARRIER(cr->mpi_comm_mygroup);
}
+
if (inputrec->ePull == epullCONSTRAINT)
{
clear_pull_forces(inputrec->pull);
}
- /* update QMMMrec, if necessary */
- if (fr->bQMMM)
- {
- update_QMMMrec(cr, fr, x, mdatoms, box, top);
- }
-
- if ((flags & GMX_FORCE_BONDED) && top->idef.il[F_POSRES].nr > 0)
- {
- posres_wrapper(fplog, flags, bSepDVDL, inputrec, nrnb, top, box, x,
- f, enerd, lambda, fr);
- }
-
- /* Compute the bonded and non-bonded energies and optionally forces */
- do_force_lowlevel(fplog, step, fr, inputrec, &(top->idef),
- cr, nrnb, wcycle, mdatoms, &(inputrec->opts),
- x, hist, f, bSepLRF ? fr->f_twin : f, enerd, fcd, mtop, top, fr->born,
- &(top->atomtypes), bBornRadii, box,
- inputrec->fepvals, lambda, graph, &(top->excls), fr->mu_tot,
- flags, &cycles_pme);
-
- if (bSepLRF)
- {
- if (do_per_step(step, inputrec->nstcalclr))
- {
- /* Add the long range forces to the short range forces */
- for (i = 0; i < fr->natoms_force_constr; i++)
- {
- rvec_add(fr->f_twin[i], f[i], f[i]);
- }
- }
- }
+ /* We calculate the non-bonded forces, when done on the CPU, here.
+ * We do this before calling do_force_lowlevel, as in there bondeds
+ * forces are calculated before PME, which does communication.
+ * With this order, non-bonded and bonded force calculation imbalance
+ * can be balanced out by the domain decomposition load balancing.
+ */
if (!bUseOrEmulGPU)
{
nrnb, wcycle);
}
-
if (!bUseOrEmulGPU || bDiffKernels)
{
int aloc;
}
}
+ /* update QMMMrec, if necessary */
+ if (fr->bQMMM)
+ {
+ update_QMMMrec(cr, fr, x, mdatoms, box, top);
+ }
+
+ if ((flags & GMX_FORCE_BONDED) && top->idef.il[F_POSRES].nr > 0)
+ {
+ posres_wrapper(fplog, flags, bSepDVDL, inputrec, nrnb, top, box, x,
+ f, enerd, lambda, fr);
+ }
+
+ /* Compute the bonded and non-bonded energies and optionally forces */
+ do_force_lowlevel(fplog, step, fr, inputrec, &(top->idef),
+ cr, nrnb, wcycle, mdatoms, &(inputrec->opts),
+ x, hist, f, bSepLRF ? fr->f_twin : f, enerd, fcd, mtop, top, fr->born,
+ &(top->atomtypes), bBornRadii, box,
+ inputrec->fepvals, lambda, graph, &(top->excls), fr->mu_tot,
+ flags, &cycles_pme);
+
+ if (bSepLRF)
+ {
+ if (do_per_step(step, inputrec->nstcalclr))
+ {
+ /* Add the long range forces to the short range forces */
+ for (i = 0; i < fr->natoms_force_constr; i++)
+ {
+ rvec_add(fr->f_twin[i], f[i], f[i]);
+ }
+ }
+ }
+
cycles_force += wallcycle_stop(wcycle, ewcFORCE);
GMX_BARRIER(cr->mpi_comm_mygroup);