From: Sebastian Kehl Date: Thu, 21 Oct 2021 15:24:49 +0000 (+0200) Subject: Fix use of simd-masks in gapsys softcore. X-Git-Url: http://biod.pnpi.spb.ru/gitweb/?a=commitdiff_plain;h=0558c2b62eb4a41bafba23dbd55c1e6ad05c1926;p=alexxy%2Fgromacs.git Fix use of simd-masks in gapsys softcore. Don't rely on bools to be implicitly cast to the correct BoolType mask but enforce this more explicitly. --- diff --git a/src/gromacs/gmxlib/nonbonded/nb_softcore.h b/src/gromacs/gmxlib/nonbonded/nb_softcore.h index 5db070ff42..de1852d3b7 100644 --- a/src/gromacs/gmxlib/nonbonded/nb_softcore.h +++ b/src/gromacs/gmxlib/nonbonded/nb_softcore.h @@ -86,8 +86,11 @@ static inline void reactionFieldQuadraticPotential(const RealType qq, RealType* dvdl, BoolType mask) { + RealType one(1); + RealType zero(0); + /* check if we have to use the hardcore values */ - BoolType computeValues = mask && (lambdaFac < 1 && 0 < alphaEff && facel != 0); + BoolType computeValues = mask && (lambdaFac < one && zero < alphaEff && facel != zero); if (gmx::anyTrue(computeValues)) { RealType lambdaFacRev = gmx::selectByMask(1 - lambdaFac, computeValues); @@ -146,8 +149,11 @@ static inline void ewaldQuadraticPotential(const RealType qq, RealType* dvdl, BoolType mask) { + RealType one(1); + RealType zero(0); + /* check if we have to use the hardcore values */ - BoolType computeValues = mask && (lambdaFac < 1 && 0 < alphaEff && facel != 0); + BoolType computeValues = mask && (lambdaFac < one && zero < alphaEff && facel != zero); if (gmx::anyTrue(computeValues)) { RealType lambdaFacRev = gmx::selectByMask(1 - lambdaFac, computeValues); @@ -212,8 +218,11 @@ static inline void lennardJonesQuadraticPotential(const RealType c6, constexpr real c_oneTwelth = 1.0_real / 12.0_real; constexpr real c_half = 1.0_real / 2.0_real; + RealType one(1); + RealType zero(0); + /* check if we have to use the hardcore values */ - BoolType computeValues = mask && (lambdaFac < 1 && 0 < alphaEff); + BoolType computeValues = mask && (lambdaFac < one && zero < alphaEff); if (gmx::anyTrue(computeValues)) { RealType lambdaFacRev = gmx::selectByMask(1 - lambdaFac, computeValues);