Merge release-5-0 into master
[alexxy/gromacs.git] / src / gromacs / mdlib / force.c
index 021761672ca9f597a60c28ef4cc8afd54b473119..4313d3e75ef729035af5e0600472183e92fadeb8 100644 (file)
  * To help us fund GROMACS development, we humbly ask that you cite
  * the research papers on the package. Check out http://www.gromacs.org.
  */
+#include "gmxpre.h"
+
+#include "gromacs/legacyheaders/force.h"
+
 #include "config.h"
 
 #include <assert.h>
 #include <math.h>
 #include <string.h>
 
-#include "typedefs.h"
-#include "macros.h"
-#include "force.h"
-#include "nonbonded.h"
-#include "names.h"
-#include "network.h"
-#include "ns.h"
-#include "nrnb.h"
-#include "bondf.h"
-#include "txtdump.h"
-#include "coulomb.h"
-#include "pme.h"
-#include "mdrun.h"
-#include "domdec.h"
-#include "qmmm.h"
-#include "gmx_omp_nthreads.h"
-
+#include "gromacs/legacyheaders/coulomb.h"
+#include "gromacs/legacyheaders/domdec.h"
+#include "gromacs/legacyheaders/gmx_omp_nthreads.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/legacyheaders/mdrun.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/legacyheaders/nonbonded.h"
+#include "gromacs/legacyheaders/nrnb.h"
+#include "gromacs/legacyheaders/ns.h"
+#include "gromacs/legacyheaders/pme.h"
+#include "gromacs/legacyheaders/qmmm.h"
+#include "gromacs/legacyheaders/txtdump.h"
+#include "gromacs/legacyheaders/typedefs.h"
 #include "gromacs/legacyheaders/types/commrec.h"
+#include "gromacs/listed-forces/bonded.h"
 #include "gromacs/math/vec.h"
 #include "gromacs/pbcutil/ishift.h"
 #include "gromacs/pbcutil/mshift.h"
@@ -116,9 +118,11 @@ static void reduce_thread_forces(int n, rvec *f,
                                  int nthreads, f_thread_t *f_t)
 {
     int t, i;
+    int nthreads_loop gmx_unused;
 
     /* This reduction can run over any number of threads */
-#pragma omp parallel for num_threads(gmx_omp_nthreads_get(emntBonded)) private(t) schedule(static)
+    nthreads_loop = gmx_omp_nthreads_get(emntBonded);
+#pragma omp parallel for num_threads(nthreads_loop) private(t) schedule(static)
     for (i = 0; i < n; i++)
     {
         for (t = 1; t < nthreads; t++)
@@ -148,7 +152,6 @@ void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
                        t_fcdata   *fcd,
                        gmx_localtop_t *top,
                        gmx_genborn_t *born,
-                       t_atomtypes *atype,
                        gmx_bool       bBornRadii,
                        matrix     box,
                        t_lambda   *fepvals,
@@ -297,10 +300,10 @@ void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
     /* MRS: Eventually, many need to include free energy contribution here! */
     if (ir->implicit_solvent)
     {
-        wallcycle_sub_start(wcycle, ewcsBONDED);
+        wallcycle_sub_start(wcycle, ewcsLISTED);
         calc_gb_forces(cr, md, born, top, x, f, fr, idef,
                        ir->gb_algorithm, ir->sa_algorithm, nrnb, &pbc, graph, enerd);
-        wallcycle_sub_stop(wcycle, ewcsBONDED);
+        wallcycle_sub_stop(wcycle, ewcsLISTED);
     }
 
 #ifdef GMX_MPI
@@ -340,9 +343,9 @@ void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
         pr_rvecs(debug, 0, "fshift after SR", fr->fshift, SHIFTS);
     }
 
-    /* Shift the coordinates. Must be done before bonded forces and PPPM,
+    /* 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 bonded forces have to be evaluated.
+     * go when no listed forces have to be evaluated.
      */
 
     /* Here sometimes we would not need to shift with NBFonly,
@@ -360,9 +363,9 @@ void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
             inc_nrnb(nrnb, eNR_SHIFTX, graph->nnodes);
         }
     }
-    /* Check whether we need to do bondeds or correct for exclusions */
+    /* Check whether we need to do listed interactions or correct for exclusions */
     if (fr->bMolPBC &&
-        ((flags & GMX_FORCE_BONDED)
+        ((flags & GMX_FORCE_LISTED)
          || EEL_RF(fr->eeltype) || EEL_FULL(fr->eeltype) || EVDW_PME(fr->vdwtype)))
     {
         /* Since all atoms are in the rectangular or triclinic unit-cell,
@@ -372,12 +375,12 @@ void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
     }
     debug_gmx();
 
-    if (flags & GMX_FORCE_BONDED)
+    if (flags & GMX_FORCE_LISTED)
     {
-        wallcycle_sub_start(wcycle, ewcsBONDED);
+        wallcycle_sub_start(wcycle, ewcsLISTED);
         calc_bonds(cr->ms,
-                   idef, x, hist, f, fr, &pbc, graph, enerd, nrnb, lambda, md, fcd,
-                   DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL, atype, born,
+                   idef, (const rvec *) x, hist, f, fr, &pbc, graph, enerd, nrnb, lambda, md, fcd,
+                   DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL,
                    flags);
 
         /* Check if we have to determine energy differences
@@ -397,7 +400,7 @@ void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
                 {
                     lam_i[j] = (i == 0 ? lambda[j] : fepvals->all_lambda[j][i-1]);
                 }
-                calc_bonds_lambda(idef, x, fr, &pbc, graph, &(enerd->foreign_grpp), enerd->foreign_term, nrnb, lam_i, md,
+                calc_bonds_lambda(idef, (const rvec *) x, fr, &pbc, graph, &(enerd->foreign_grpp), enerd->foreign_term, nrnb, lam_i, md,
                                   fcd, DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL);
                 sum_epot(&(enerd->foreign_grpp), enerd->foreign_term);
                 enerd->enerpart_lambda[i] += enerd->foreign_term[F_EPOT];
@@ -405,7 +408,7 @@ void do_force_lowlevel(t_forcerec *fr,      t_inputrec *ir,
         }
         debug_gmx();
 
-        wallcycle_sub_stop(wcycle, ewcsBONDED);
+        wallcycle_sub_stop(wcycle, ewcsLISTED);
     }
 
     where();