Avoid using function calls in OpenMP directives
[alexxy/gromacs.git] / src / gromacs / mdlib / force.c
index 6aa988000370bd9ae58eb2aff31dd3d2e3d0d1b3..d4e6445491e36fe2f10bff1cf360d7b6d8ae8050 100644 (file)
@@ -44,7 +44,7 @@
 #include "sysstuff.h"
 #include "typedefs.h"
 #include "macros.h"
-#include "smalloc.h"
+#include "gromacs/utility/smalloc.h"
 #include "macros.h"
 #include "physics.h"
 #include "force.h"
@@ -65,6 +65,7 @@
 #include "gmx_omp_nthreads.h"
 
 #include "gromacs/timing/wallcycle.h"
+#include "gmx_fatal.h"
 
 void ns(FILE              *fp,
         t_forcerec        *fr,
@@ -116,9 +117,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++)
@@ -209,7 +212,7 @@ void do_force_lowlevel(FILE       *fplog,   gmx_int64_t step,
 
     if (bSepDVDL)
     {
-        fprintf(fplog, "Step %s: non-bonded V and dVdl for node %d:\n",
+        fprintf(fplog, "Step %s: non-bonded V and dVdl for rank %d:\n",
                 gmx_step_str(step, buf), cr->nodeid);
     }
 
@@ -535,16 +538,17 @@ void do_force_lowlevel(FILE       *fplog,   gmx_int64_t step,
                     }
                     *dvdlt_q  = 0;
                     *dvdlt_lj = 0;
+
                     ewald_LRcorrection(fr->excl_load[t], fr->excl_load[t+1],
                                        cr, t, fr,
                                        md->chargeA,
                                        md->nChargePerturbed ? md->chargeB : NULL,
                                        md->sqrt_c6A,
-                                       md->nChargePerturbed ? md->sqrt_c6B : NULL,
+                                       md->nTypePerturbed ? md->sqrt_c6B : NULL,
                                        md->sigmaA,
-                                       md->nChargePerturbed ? md->sigmaB : NULL,
+                                       md->nTypePerturbed ? md->sigmaB : NULL,
                                        md->sigma3A,
-                                       md->nChargePerturbed ? md->sigma3B : NULL,
+                                       md->nTypePerturbed ? md->sigma3B : NULL,
                                        ir->cutoff_scheme != ecutsVERLET,
                                        excl, x, bSB ? boxs : box, mu_tot,
                                        ir->ewald_geometry,
@@ -587,7 +591,7 @@ void do_force_lowlevel(FILE       *fplog,   gmx_int64_t step,
                 assert(fr->n_tpi >= 0);
                 if (fr->n_tpi == 0 || (flags & GMX_FORCE_STATECHANGED))
                 {
-                    pme_flags = GMX_PME_SPREAD_Q | GMX_PME_SOLVE;
+                    pme_flags = GMX_PME_SPREAD | GMX_PME_SOLVE;
                     if (EEL_PME(fr->eeltype))
                     {
                         pme_flags     |= GMX_PME_DO_COULOMB;
@@ -722,7 +726,7 @@ void do_force_lowlevel(FILE       *fplog,   gmx_int64_t step,
         fr->t_wait += t3-t2;
         if (fr->timesteps == 11)
         {
-            fprintf(stderr, "* PP load balancing info: node %d, step %s, rel wait time=%3.0f%% , load string value: %7.2f\n",
+            fprintf(stderr, "* PP load balancing info: rank %d, step %s, rel wait time=%3.0f%% , load string value: %7.2f\n",
                     cr->nodeid, gmx_step_str(fr->timesteps, buf),
                     100*fr->t_wait/(fr->t_wait+fr->t_fnbf),
                     (fr->t_fnbf+fr->t_wait)/fr->t_fnbf);