Add class ListedForces
[alexxy/gromacs.git] / src / gromacs / mdlib / force.cpp
index 591e64f66198c95a3504684923df2e92e941d716..dd5887ced25b9037054dafb428ef1cff65a0225c 100644 (file)
@@ -103,7 +103,6 @@ static void reduceEwaldThreadOuput(int nthreads, ewald_corr_thread_t* ewc_t)
 
 void do_force_lowlevel(t_forcerec*                          fr,
                        const t_inputrec*                    ir,
-                       const InteractionDefinitions&        idef,
                        const t_commrec*                     cr,
                        const gmx_multisim_t*                ms,
                        t_nrnb*                              nrnb,
@@ -114,7 +113,6 @@ void do_force_lowlevel(t_forcerec*                          fr,
                        history_t*                           hist,
                        gmx::ForceOutputs*                   forceOutputs,
                        gmx_enerdata_t*                      enerd,
-                       t_fcdata*                            fcd,
                        const matrix                         box,
                        const real*                          lambda,
                        const rvec*                          mu_tot,
@@ -145,8 +143,9 @@ void do_force_lowlevel(t_forcerec*                          fr,
         t_pbc pbc;
 
         /* Check whether we need to take into account PBC in listed interactions. */
-        const auto needPbcForListedForces =
-                fr->bMolPBC && stepWork.computeListedForces && haveCpuListedForces(*fr, idef, *fcd);
+        ListedForces& listedForces = *fr->listedForces;
+        const auto    needPbcForListedForces =
+                fr->bMolPBC && stepWork.computeListedForces && listedForces.haveCpuListedForces();
         if (needPbcForListedForces)
         {
             /* Since all atoms are in the rectangular or triclinic unit-cell,
@@ -155,9 +154,9 @@ void do_force_lowlevel(t_forcerec*                          fr,
             set_pbc_dd(&pbc, fr->pbcType, DOMAINDECOMP(cr) ? cr->dd->numCells : nullptr, TRUE, box);
         }
 
-        do_force_listed(wcycle, box, ir->fepvals, cr, ms, idef, x, xWholeMolecules, hist,
-                        forceOutputs, fr, &pbc, enerd, nrnb, lambda, md, fcd,
-                        DOMAINDECOMP(cr) ? cr->dd->globalAtomIndices.data() : nullptr, stepWork);
+        listedForces.calculate(wcycle, box, ir->fepvals, cr, ms, x, xWholeMolecules, hist,
+                               forceOutputs, fr, &pbc, enerd, nrnb, lambda, md,
+                               DOMAINDECOMP(cr) ? cr->dd->globalAtomIndices.data() : nullptr, stepWork);
     }
 
     const bool computePmeOnCpu = (EEL_PME(fr->ic->eeltype) || EVDW_PME(fr->ic->vdwtype))