Avoid comparing Simd types to real 0 when making masks in NB FEP kernel.
[alexxy/gromacs.git] / src / gromacs / gmxlib / nonbonded / nb_free_energy.cpp
index 6304d85ef22a4d3f93f8628db5870e7c76ba673d..85f998cfc546412a2fafffbac2623f846656fe4a 100644 (file)
@@ -401,8 +401,8 @@ static void nb_free_energy_kernel(const t_nblist&
     const RealType            maxRInvSix(c_maxRInvSix);
     const RealType gmx_unused floatMin(GMX_FLOAT_MIN);
 
-    RealType dvdlCoul(zero);
-    RealType dvdlVdw(zero);
+    RealType dvdlCoul{ zero };
+    RealType dvdlVdw{ zero };
 
     /* Lambda factor for state A, 1-lambda*/
     real LFC[NSTATES], LFV[NSTATES];
@@ -621,10 +621,10 @@ static void nb_free_energy_kernel(const t_nblist&
                     preloadGapsysScaleLinpointVdW[j]  = 0;
                     preloadGapsysScaleLinpointCoul[j] = 0;
 
+                    typeIndices[STATE_A][j] = ntiA + typeA[jjnr[k]];
+                    typeIndices[STATE_B][j] = ntiB + typeB[jjnr[k]];
                     for (int i = 0; i < NSTATES; i++)
                     {
-                        typeIndices[STATE_A][j]      = ntiA + typeA[jjnr[k]];
-                        typeIndices[STATE_B][j]      = ntiB + typeB[jjnr[k]];
                         preloadLjPmeC6Grid[i][j]     = 0;
                         preloadQq[i][j]              = 0;
                         preloadSigma6[i][j]          = 0;
@@ -864,12 +864,12 @@ static void nb_free_energy_kernel(const t_nblist&
                         if constexpr (vdwInteractionTypeIsEwald)
                         {
                             computeVdwInteraction =
-                                    (r < rVdw && (c6[i] != 0 || c12[i] != 0) && bPairIncluded);
+                                    (r < rVdw && (c6[i] != zero || c12[i] != zero) && bPairIncluded);
                         }
                         else
                         {
                             computeVdwInteraction =
-                                    (rV < rVdw && (c6[i] != 0 || c12[i] != 0) && bPairIncluded);
+                                    (rV < rVdw && (c6[i] != zero || c12[i] != zero) && bPairIncluded);
                         }
                         if (gmx::anyTrue(computeVdwInteraction))
                         {