Remove use of graph in do_force()
[alexxy/gromacs.git] / src / gromacs / mdlib / force.cpp
index fc407a0fe35635cbcfa62291c190696dc47ec3d8..591e64f66198c95a3504684923df2e92e941d716 100644 (file)
 #include "gromacs/mdtypes/mdatom.h"
 #include "gromacs/mdtypes/simulation_workload.h"
 #include "gromacs/pbcutil/ishift.h"
-#include "gromacs/pbcutil/mshift.h"
 #include "gromacs/pbcutil/pbc.h"
 #include "gromacs/timing/wallcycle.h"
 #include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
 
+using gmx::ArrayRef;
+using gmx::RVec;
+
 static void clearEwaldThreadOutput(ewald_corr_thread_t* ewc_t)
 {
     ewc_t->Vcorr_q        = 0;
@@ -99,29 +101,28 @@ 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,
-                       gmx_wallcycle_t                     wcycle,
-                       const t_mdatoms*                    md,
-                       gmx::ArrayRefWithPadding<gmx::RVec> coordinates,
-                       gmx::ArrayRef<const gmx::RVec>      xWholeMolecules,
-                       history_t*                          hist,
-                       gmx::ForceOutputs*                  forceOutputs,
-                       gmx_enerdata_t*                     enerd,
-                       t_fcdata*                           fcd,
-                       const matrix                        box,
-                       const real*                         lambda,
-                       const t_graph*                      graph,
-                       const rvec*                         mu_tot,
-                       const gmx::StepWorkload&            stepWork,
-                       const DDBalanceRegionHandler&       ddBalanceRegionHandler)
+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,
+                       gmx_wallcycle_t                      wcycle,
+                       const t_mdatoms*                     md,
+                       gmx::ArrayRefWithPadding<const RVec> coordinates,
+                       ArrayRef<const RVec>                 xWholeMolecules,
+                       history_t*                           hist,
+                       gmx::ForceOutputs*                   forceOutputs,
+                       gmx_enerdata_t*                      enerd,
+                       t_fcdata*                            fcd,
+                       const matrix                         box,
+                       const real*                          lambda,
+                       const rvec*                          mu_tot,
+                       const gmx::StepWorkload&             stepWork,
+                       const DDBalanceRegionHandler&        ddBalanceRegionHandler)
 {
     // TODO: Replace all uses of x by const coordinates
-    rvec* x = as_rvec_array(coordinates.paddedArrayRef().data());
+    const rvec* x = as_rvec_array(coordinates.paddedArrayRef().data());
 
     auto& forceWithVirial = forceOutputs->forceWithVirial();
 
@@ -140,33 +141,6 @@ void do_force_lowlevel(t_forcerec*                         fr,
         }
     }
 
-    /* Shift the coordinates. Must be done before listed forces and PPPM,
-     * but is also necessary for SHAKE and update, therefore it can NOT
-     * go when no listed forces have to be evaluated.
-     *
-     * The shifting and PBC code is deliberately not timed, since with
-     * the Verlet scheme it only takes non-zero time with triclinic
-     * boxes, and even then the time is around a factor of 100 less
-     * than the next smallest counter.
-     */
-
-
-    /* Here sometimes we would not need to shift with NBFonly,
-     * but we do so anyhow for consistency of the returned coordinates.
-     */
-    if (graph)
-    {
-        shift_self(graph, box, x);
-        if (TRICLINIC(box))
-        {
-            inc_nrnb(nrnb, eNR_SHIFTX, 2 * graph->numNodes());
-        }
-        else
-        {
-            inc_nrnb(nrnb, eNR_SHIFTX, graph->numNodes());
-        }
-    }
-
     {
         t_pbc pbc;
 
@@ -182,7 +156,7 @@ void do_force_lowlevel(t_forcerec*                         fr,
         }
 
         do_force_listed(wcycle, box, ir->fepvals, cr, ms, idef, x, xWholeMolecules, hist,
-                        forceOutputs, fr, &pbc, graph, enerd, nrnb, lambda, md, fcd,
+                        forceOutputs, fr, &pbc, enerd, nrnb, lambda, md, fcd,
                         DOMAINDECOMP(cr) ? cr->dd->globalAtomIndices.data() : nullptr, stepWork);
     }