if (file_version >= tpxv_SoftcoreGapsys)
{
serializer->doInt(reinterpret_cast<int*>(&fepvals->softcoreFunction));
+ serializer->doReal(&fepvals->scScaleLinpointLJGapsys);
+ serializer->doReal(&fepvals->scScaleLinpointQGapsys);
+ serializer->doReal(&fepvals->scSigmaLJGapsys);
}
else
{
- fepvals->softcoreFunction = SoftcoreType::Beutler;
+ fepvals->softcoreFunction = SoftcoreType::Beutler;
+ fepvals->scScaleLinpointLJGapsys = 0.85;
+ fepvals->scScaleLinpointQGapsys = 0.3;
+ fepvals->scSigmaLJGapsys = 0.3;
}
/* handle lambda_neighbors */
gmx::ArrayRef<const int> shift = nlist.shift;
gmx::ArrayRef<const int> gid = nlist.gid;
- const real lambda_coul = lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Coul)];
- const real lambda_vdw = lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Vdw)];
- const auto& scParams = *ic.softCoreParameters;
- const real gmx_unused alpha_coul = scParams.alphaCoulomb;
- const real gmx_unused alpha_vdw = scParams.alphaVdw;
- const real lam_power = scParams.lambdaPower;
- const real gmx_unused sigma6_def = scParams.sigma6WithInvalidSigma;
- const real gmx_unused sigma6_min = scParams.sigma6Minimum;
+ const real lambda_coul = lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Coul)];
+ const real lambda_vdw = lambda[static_cast<int>(FreeEnergyPerturbationCouplingType::Vdw)];
+
+ // Extract softcore parameters
+ const auto& scParams = *ic.softCoreParameters;
+ const real lam_power = scParams.lambdaPower;
+ const real gmx_unused alpha_coul = scParams.alphaCoulomb;
+ const real gmx_unused alpha_vdw = scParams.alphaVdw;
+ const real gmx_unused sigma6_def = scParams.sigma6WithInvalidSigma;
+ const real gmx_unused sigma6_min = scParams.sigma6Minimum;
+
+ const real gmx_unused scaleLinpointCoulGapsys = scParams.scaleLinpointCoulGapsys;
+ const real gmx_unused scaleLinpointVdWGapsys = scParams.scaleLinpointVdWGapsys;
+ const real gmx_unused sigma6VdWGapsys = scParams.sigma6VdWGapsys;
+
const bool gmx_unused doShiftForces = ((flags & GMX_NONBONDED_DO_SHIFTFORCE) != 0);
const bool doPotential = ((flags & GMX_NONBONDED_DO_POTENTIAL) != 0);
alignas(GMX_SIMD_ALIGNMENT) real gmx_unused preloadSigma6[NSTATES][DataTypes::simdRealWidth];
alignas(GMX_SIMD_ALIGNMENT) real gmx_unused preloadAlphaVdwEff[DataTypes::simdRealWidth];
alignas(GMX_SIMD_ALIGNMENT) real gmx_unused preloadAlphaCoulEff[DataTypes::simdRealWidth];
+ alignas(GMX_SIMD_ALIGNMENT)
+ real gmx_unused preloadScaleLinpointVdWGapsys[DataTypes::simdRealWidth];
+ alignas(GMX_SIMD_ALIGNMENT)
+ real gmx_unused preloadScaleLinpointCoulGapsys[DataTypes::simdRealWidth];
+ alignas(GMX_SIMD_ALIGNMENT)
+ real gmx_unused preloadSigma6VdWGapsys[NSTATES][DataTypes::simdRealWidth];
alignas(GMX_SIMD_ALIGNMENT) real preloadLjPmeC6Grid[NSTATES][DataTypes::simdRealWidth];
#else
real preloadPairIsValid[DataTypes::simdRealWidth];
real gmx_unused preloadSigma6[NSTATES][DataTypes::simdRealWidth];
real gmx_unused preloadAlphaVdwEff[DataTypes::simdRealWidth];
real gmx_unused preloadAlphaCoulEff[DataTypes::simdRealWidth];
+ real gmx_unused preloadScaleLinpointVdWGapsys[DataTypes::simdRealWidth];
+ real gmx_unused preloadScaleLinpointCoulGapsys[DataTypes::simdRealWidth];
+ real gmx_unused preloadSigma6VdWGapsys[NSTATES][DataTypes::simdRealWidth];
real preloadLjPmeC6Grid[NSTATES][DataTypes::simdRealWidth];
#endif
for (int s = 0; s < DataTypes::simdRealWidth; s++)
{
preloadLjPmeC6Grid[i][s] = 0;
}
- if constexpr (softcoreType == KernelSoftcoreType::Beutler
- || softcoreType == KernelSoftcoreType::Gapsys)
+ if constexpr (softcoreType == KernelSoftcoreType::Beutler)
{
const real c6 = nbfp[2 * typeIndices[i][s]];
const real c12 = nbfp[2 * typeIndices[i][s] + 1];
preloadSigma6[i][s] = sigma6_def;
}
}
+ if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
+ {
+ const real c6 = nbfp[2 * typeIndices[i][s]];
+ const real c12 = nbfp[2 * typeIndices[i][s] + 1];
+ if (c6 > 0 && c12 > 0)
+ {
+ /* c12 is stored scaled with 12.0 and c6 is scaled with 6.0 - correct for this */
+ preloadSigma6VdWGapsys[i][s] = 0.5_real * c12 / c6;
+ if (preloadSigma6VdWGapsys[i][s] < sigma6VdWGapsys)
+ {
+ preloadSigma6VdWGapsys[i][s] = sigma6VdWGapsys;
+ }
+ }
+ else
+ {
+ preloadSigma6VdWGapsys[i][s] = sigma6VdWGapsys;
+ }
+ }
}
- if constexpr (softcoreType == KernelSoftcoreType::Beutler
- || softcoreType == KernelSoftcoreType::Gapsys)
+ if constexpr (softcoreType == KernelSoftcoreType::Beutler)
{
/* only use softcore if one of the states has a zero endstate - softcore is for avoiding infinities!*/
const real c12A = nbfp[2 * typeIndices[STATE_A][s] + 1];
}
else
{
- if constexpr (softcoreType == KernelSoftcoreType::Beutler)
- {
- preloadAlphaVdwEff[s] = alpha_vdw;
- preloadAlphaCoulEff[s] = alpha_coul;
- }
- else if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
- {
- preloadAlphaVdwEff[s] = alpha_vdw;
- preloadAlphaCoulEff[s] = gmx::sixthroot(sigma6_def);
- }
+ preloadAlphaVdwEff[s] = alpha_vdw;
+ preloadAlphaCoulEff[s] = alpha_coul;
+ }
+ }
+ if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
+ {
+ /* only use softcore if one of the states has a zero endstate - softcore is for avoiding infinities!*/
+ const real c12A = nbfp[2 * typeIndices[STATE_A][s] + 1];
+ const real c12B = nbfp[2 * typeIndices[STATE_B][s] + 1];
+ if (c12A > 0 && c12B > 0)
+ {
+ preloadScaleLinpointVdWGapsys[s] = 0;
+ preloadScaleLinpointCoulGapsys[s] = 0;
+ }
+ else
+ {
+ preloadScaleLinpointVdWGapsys[s] = scaleLinpointVdWGapsys;
+ preloadScaleLinpointCoulGapsys[s] = scaleLinpointCoulGapsys;
}
}
}
else
{
- preloadJnr[s] = jjnr[k];
- preloadPairIsValid[s] = false;
- preloadPairIncluded[s] = false;
- preloadAlphaVdwEff[s] = 0;
- preloadAlphaCoulEff[s] = 0;
+ preloadJnr[s] = jjnr[k];
+ preloadPairIsValid[s] = false;
+ preloadPairIncluded[s] = false;
+ preloadAlphaVdwEff[s] = 0;
+ preloadAlphaCoulEff[s] = 0;
+ preloadScaleLinpointVdWGapsys[s] = 0;
+ preloadScaleLinpointCoulGapsys[s] = 0;
for (int i = 0; i < NSTATES; i++)
{
- typeIndices[STATE_A][s] = ntiA + typeA[jjnr[k]];
- typeIndices[STATE_B][s] = ntiB + typeB[jjnr[k]];
- preloadLjPmeC6Grid[i][s] = 0;
- preloadQq[i][s] = 0;
- preloadSigma6[i][s] = 0;
+ typeIndices[STATE_A][s] = ntiA + typeA[jjnr[k]];
+ typeIndices[STATE_B][s] = ntiB + typeB[jjnr[k]];
+ preloadLjPmeC6Grid[i][s] = 0;
+ preloadQq[i][s] = 0;
+ preloadSigma6[i][s] = 0;
+ preloadSigma6VdWGapsys[i][s] = 0;
}
}
}
RealType gmx_unused ljPmeC6Grid[NSTATES];
RealType gmx_unused alphaVdwEff;
RealType gmx_unused alphaCoulEff;
+ RealType gmx_unused scaleLinpointVdWGapsysEff;
+ RealType gmx_unused scaleLinpointCoulGapsysEff;
+ RealType gmx_unused sigmaVdWGapsysEff[NSTATES];
for (int i = 0; i < NSTATES; i++)
{
gmx::gatherLoadTranspose<2>(nbfp.data(), typeIndices[i], &c6[i], &c12[i]);
qq[i] = gmx::load<RealType>(preloadQq[i]);
ljPmeC6Grid[i] = gmx::load<RealType>(preloadLjPmeC6Grid[i]);
- if constexpr (softcoreType == KernelSoftcoreType::Beutler
- || softcoreType == KernelSoftcoreType::Gapsys)
+ if constexpr (softcoreType == KernelSoftcoreType::Beutler)
{
sigma6[i] = gmx::load<RealType>(preloadSigma6[i]);
}
+ if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
+ {
+ sigmaVdWGapsysEff[i] = gmx::load<RealType>(preloadSigma6VdWGapsys[i]);
+ }
}
- if constexpr (softcoreType == KernelSoftcoreType::Beutler
- || softcoreType == KernelSoftcoreType::Gapsys)
+ if constexpr (softcoreType == KernelSoftcoreType::Beutler)
{
alphaVdwEff = gmx::load<RealType>(preloadAlphaVdwEff);
alphaCoulEff = gmx::load<RealType>(preloadAlphaCoulEff);
}
+ if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
+ {
+ scaleLinpointVdWGapsysEff = gmx::load<RealType>(preloadScaleLinpointVdWGapsys);
+ scaleLinpointCoulGapsysEff = gmx::load<RealType>(preloadScaleLinpointCoulGapsys);
+ }
// Avoid overflow of r^-12 at distances near zero
rSq = gmx::max(rSq, minDistanceSquared);
rCutoffCoul,
LFC[i],
DLF[i],
- alphaCoulEff,
+ scaleLinpointCoulGapsysEff,
sh_ewald,
&fScalC[i],
&vCoul[i],
rCutoffCoul,
LFC[i],
DLF[i],
- alphaCoulEff,
+ scaleLinpointCoulGapsysEff,
krf,
crf,
&fScalC[i],
rSq,
LFV[i],
DLF[i],
- sigma6[i],
- alphaVdwEff,
+ sigmaVdWGapsysEff[i],
+ scaleLinpointVdWGapsysEff,
repulsionShift,
dispersionShift,
&fScalV[i],
const bool useSimd,
const interaction_const_t& ic)
{
- if (ic.softCoreParameters->alphaCoulomb == 0 && ic.softCoreParameters->alphaVdw == 0)
- {
- return (dispatchKernelOnScLambdasOrAlphasDifference<KernelSoftcoreType::None>(
- scLambdasOrAlphasDiffer,
- vdwInteractionTypeIsEwald,
- elecInteractionTypeIsEwald,
- vdwModifierIsPotSwitch,
- computeForces,
- useSimd));
- }
- else
+ const auto& scParams = *ic.softCoreParameters;
+ if (scParams.softcoreType == SoftcoreType::Beutler)
{
- if (ic.softCoreParameters->softcoreType == SoftcoreType::Beutler)
+ if (scParams.alphaCoulomb == 0 && scParams.alphaVdw == 0)
{
- return (dispatchKernelOnScLambdasOrAlphasDifference<KernelSoftcoreType::Beutler>(
+ return (dispatchKernelOnScLambdasOrAlphasDifference<KernelSoftcoreType::None>(
scLambdasOrAlphasDiffer,
vdwInteractionTypeIsEwald,
elecInteractionTypeIsEwald,
computeForces,
useSimd));
}
- else
+ return (dispatchKernelOnScLambdasOrAlphasDifference<KernelSoftcoreType::Beutler>(
+ scLambdasOrAlphasDiffer,
+ vdwInteractionTypeIsEwald,
+ elecInteractionTypeIsEwald,
+ vdwModifierIsPotSwitch,
+ computeForces,
+ useSimd));
+ }
+ else // Gapsys
+ {
+ if (scParams.scaleLinpointCoulGapsys == 0 && scParams.scaleLinpointVdWGapsys == 0)
{
- return (dispatchKernelOnScLambdasOrAlphasDifference<KernelSoftcoreType::Gapsys>(
+ return (dispatchKernelOnScLambdasOrAlphasDifference<KernelSoftcoreType::None>(
scLambdasOrAlphasDiffer,
vdwInteractionTypeIsEwald,
elecInteractionTypeIsEwald,
computeForces,
useSimd));
}
+ return (dispatchKernelOnScLambdasOrAlphasDifference<KernelSoftcoreType::Gapsys>(
+ scLambdasOrAlphasDiffer,
+ vdwInteractionTypeIsEwald,
+ elecInteractionTypeIsEwald,
+ vdwModifierIsPotSwitch,
+ computeForces,
+ useSimd));
}
}
setStringEntry(&inp, "temperature-lambdas", "");
fep->lambda_neighbors = get_eint(&inp, "calc-lambda-neighbors", 1, wi);
setStringEntry(&inp, "init-lambda-weights", inputrecStrings->lambda_weights, nullptr);
- fep->edHdLPrintEnergy = getEnum<FreeEnergyPrintEnergy>(&inp, "dhdl-print-energy", wi);
- fep->softcoreFunction = getEnum<SoftcoreType>(&inp, "sc-function", wi);
- fep->sc_alpha = get_ereal(&inp, "sc-alpha", 0.0, wi);
- fep->sc_power = get_eint(&inp, "sc-power", 1, wi);
- fep->sc_r_power = get_ereal(&inp, "sc-r-power", 6.0, wi);
- fep->sc_sigma = get_ereal(&inp, "sc-sigma", 0.3, wi);
- fep->bScCoul = (getEnum<Boolean>(&inp, "sc-coul", wi) != Boolean::No);
- fep->dh_hist_size = get_eint(&inp, "dh_hist_size", 0, wi);
- fep->dh_hist_spacing = get_ereal(&inp, "dh_hist_spacing", 0.1, wi);
- fep->separate_dhdl_file = getEnum<SeparateDhdlFile>(&inp, "separate-dhdl-file", wi);
- fep->dhdl_derivatives = getEnum<DhDlDerivativeCalculation>(&inp, "dhdl-derivatives", wi);
- fep->dh_hist_size = get_eint(&inp, "dh_hist_size", 0, wi);
- fep->dh_hist_spacing = get_ereal(&inp, "dh_hist_spacing", 0.1, wi);
+ fep->edHdLPrintEnergy = getEnum<FreeEnergyPrintEnergy>(&inp, "dhdl-print-energy", wi);
+ fep->softcoreFunction = getEnum<SoftcoreType>(&inp, "sc-function", wi);
+ fep->sc_alpha = get_ereal(&inp, "sc-alpha", 0.0, wi);
+ fep->sc_power = get_eint(&inp, "sc-power", 1, wi);
+ fep->sc_r_power = get_ereal(&inp, "sc-r-power", 6.0, wi);
+ fep->sc_sigma = get_ereal(&inp, "sc-sigma", 0.3, wi);
+ fep->bScCoul = (getEnum<Boolean>(&inp, "sc-coul", wi) != Boolean::No);
+ fep->scScaleLinpointLJGapsys = get_ereal(&inp, "sc-scale-linpoint-LJ-gapsys", 0.85, wi);
+ fep->scScaleLinpointQGapsys = get_ereal(&inp, "sc-scale-linpoint-Q-gapsys", 0.3, wi);
+ fep->scSigmaLJGapsys = get_ereal(&inp, "sc-sigma-LJ-gapsys", 0.3, wi);
+ fep->dh_hist_size = get_eint(&inp, "dh_hist_size", 0, wi);
+ fep->dh_hist_spacing = get_ereal(&inp, "dh_hist_spacing", 0.1, wi);
+ fep->separate_dhdl_file = getEnum<SeparateDhdlFile>(&inp, "separate-dhdl-file", wi);
+ fep->dhdl_derivatives = getEnum<DhDlDerivativeCalculation>(&inp, "dhdl-derivatives", wi);
+ fep->dh_hist_size = get_eint(&inp, "dh_hist_size", 0, wi);
+ fep->dh_hist_spacing = get_ereal(&inp, "dh_hist_spacing", 0.1, wi);
/* Non-equilibrium MD stuff */
printStringNewline(&inp, "Non-equilibrium MD stuff");
sc-r-power = 6
sc-sigma = 0.3
sc-coul = no
+sc-scale-linpoint-LJ-gapsys = 0.85
+sc-scale-linpoint-Q-gapsys = 0.3
+sc-sigma-LJ-gapsys = 0.3
separate-dhdl-file = yes
dhdl-derivatives = yes
dh_hist_size = 0
sc-r-power = 6
sc-sigma = 0.3
sc-coul = no
+sc-scale-linpoint-LJ-gapsys = 0.85
+sc-scale-linpoint-Q-gapsys = 0.3
+sc-sigma-LJ-gapsys = 0.3
separate-dhdl-file = yes
dhdl-derivatives = yes
dh_hist_size = 0
sc-r-power = 6
sc-sigma = 0.3
sc-coul = no
+sc-scale-linpoint-LJ-gapsys = 0.85
+sc-scale-linpoint-Q-gapsys = 0.3
+sc-sigma-LJ-gapsys = 0.3
separate-dhdl-file = yes
dhdl-derivatives = yes
dh_hist_size = 0
sc-r-power = 6
sc-sigma = 0.3
sc-coul = no
+sc-scale-linpoint-LJ-gapsys = 0.85
+sc-scale-linpoint-Q-gapsys = 0.3
+sc-sigma-LJ-gapsys = 0.3
separate-dhdl-file = yes
dhdl-derivatives = yes
dh_hist_size = 0
sc-r-power = 6
sc-sigma = 0.3
sc-coul = no
+sc-scale-linpoint-LJ-gapsys = 0.85
+sc-scale-linpoint-Q-gapsys = 0.3
+sc-sigma-LJ-gapsys = 0.3
separate-dhdl-file = yes
dhdl-derivatives = yes
dh_hist_size = 0
sc-r-power = 6
sc-sigma = 0.3
sc-coul = no
+sc-scale-linpoint-LJ-gapsys = 0.85
+sc-scale-linpoint-Q-gapsys = 0.3
+sc-sigma-LJ-gapsys = 0.3
separate-dhdl-file = yes
dhdl-derivatives = yes
dh_hist_size = 0
sc-r-power = 6
sc-sigma = 0.3
sc-coul = no
+sc-scale-linpoint-LJ-gapsys = 0.85
+sc-scale-linpoint-Q-gapsys = 0.3
+sc-sigma-LJ-gapsys = 0.3
separate-dhdl-file = yes
dhdl-derivatives = yes
dh_hist_size = 0
sc-r-power = 6
sc-sigma = 0.3
sc-coul = no
+sc-scale-linpoint-LJ-gapsys = 0.85
+sc-scale-linpoint-Q-gapsys = 0.3
+sc-sigma-LJ-gapsys = 0.3
separate-dhdl-file = yes
dhdl-derivatives = yes
dh_hist_size = 0
sc-r-power = 6
sc-sigma = 0.3
sc-coul = no
+sc-scale-linpoint-LJ-gapsys = 0.85
+sc-scale-linpoint-Q-gapsys = 0.3
+sc-sigma-LJ-gapsys = 0.3
separate-dhdl-file = yes
dhdl-derivatives = yes
dh_hist_size = 0
real fscal_vdw[2], fscal_elec[2];
real velec[2], vvdw[2];
real dvdl_elec[2], dvdl_vdw[2];
+ real scaleLinpointCoulGapsys, scaleLinpointVdWGapsys, sigma6VdWGapsys[2];
real rQ, rLJ;
real scaleDvdlRCoul;
int i, ntab;
/* Loop over state A(0) and B(1) */
for (i = 0; i < 2; i++)
{
- if (softcoreType == KernelSoftcoreType::Beutler || softcoreType == KernelSoftcoreType::Gapsys)
+ if constexpr (softcoreType == KernelSoftcoreType::Beutler)
{
if ((c6[i] > 0) && (c12[i] > 0))
{
* Correct for this by multiplying with (1/12.0)/(1/6.0)=6.0/12.0=0.5.
*/
sigma6[i] = half * c12[i] / c6[i];
- if (softcoreType == KernelSoftcoreType::Beutler && (sigma6[i] < scParams.sigma6Minimum)) /* for disappearing coul and vdw with soft core at the same time */
+ if (sigma6[i] < scParams.sigma6Minimum) /* for disappearing coul and vdw with soft core at the same time */
{
sigma6[i] = scParams.sigma6Minimum;
}
}
sigma_pow[i] = sigma6[i];
}
+ if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
+ {
+ if ((c6[i] > 0) && (c12[i] > 0))
+ {
+ /* The c6 & c12 coefficients now contain the constants 6.0 and 12.0, respectively.
+ * Correct for this by multiplying with (1/12.0)/(1/6.0)=6.0/12.0=0.5.
+ */
+ sigma6VdWGapsys[i] = half * c12[i] / c6[i];
+ if (sigma6VdWGapsys[i]
+ < scParams.sigma6VdWGapsys) /* for disappearing coul and vdw with soft core at the same time */
+ {
+ sigma6VdWGapsys[i] = scParams.sigma6VdWGapsys;
+ }
+ }
+ else
+ {
+ sigma6VdWGapsys[i] = scParams.sigma6VdWGapsys;
+ }
+ }
}
- if (softcoreType == KernelSoftcoreType::Beutler || softcoreType == KernelSoftcoreType::Gapsys)
+ if constexpr (softcoreType == KernelSoftcoreType::Beutler)
{
/* only use softcore if one of the states has a zero endstate - softcore is for avoiding infinities!*/
if ((c12[0] > 0) && (c12[1] > 0))
}
else
{
- if (softcoreType == KernelSoftcoreType::Beutler)
- {
- alpha_vdw_eff = scParams.alphaVdw;
- alpha_coul_eff = scParams.alphaCoulomb;
- }
- else if (softcoreType == KernelSoftcoreType::Gapsys)
- {
- alpha_vdw_eff = scParams.alphaVdw;
- alpha_coul_eff = gmx::sixthroot(scParams.sigma6WithInvalidSigma);
- }
+ alpha_vdw_eff = scParams.alphaVdw;
+ alpha_coul_eff = scParams.alphaCoulomb;
+ }
+ }
+ if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
+ {
+ /* only use softcore if one of the states has a zero endstate - softcore is for avoiding infinities!*/
+ if ((c12[0] > 0) && (c12[1] > 0))
+ {
+ scaleLinpointVdWGapsys = 0;
+ scaleLinpointCoulGapsys = 0;
+ }
+ else
+ {
+ scaleLinpointVdWGapsys = scParams.scaleLinpointVdWGapsys;
+ scaleLinpointCoulGapsys = scParams.scaleLinpointCoulGapsys;
}
}
if ((qq[i] != 0) || (c6[i] != 0) || (c12[i] != 0))
{
/* Coulomb */
- if (softcoreType == KernelSoftcoreType::Beutler)
+ if constexpr (softcoreType == KernelSoftcoreType::Beutler)
{
rpinv = one / (alpha_coul_eff * lfac_coul[i] * sigma_pow[i] + rp);
r_coul = sixthRoot(rpinv);
r_coul = r;
}
- if (softcoreType == KernelSoftcoreType::Gapsys)
+ if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
{
rQ = gmx::sixthroot(one - LFC[i]) * (one + std::fabs(qq[i] / facel));
- rQ *= alpha_coul_eff;
+ rQ *= scaleLinpointCoulGapsys;
scaleDvdlRCoul = 1;
if (rQ > rCoulCutoff)
{
}
/* Vdw */
- if (softcoreType == KernelSoftcoreType::Beutler)
+ if constexpr (softcoreType == KernelSoftcoreType::Beutler)
{
rpinv = one / (alpha_vdw_eff * lfac_vdw[i] * sigma_pow[i] + rp);
r_vdw = sixthRoot(rpinv);
r_vdw = r;
}
- if (softcoreType == KernelSoftcoreType::Gapsys)
+ if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
{
constexpr real c_twentySixSeventh = 26.0_real / 7.0_real;
- rLJ = gmx::sixthroot(c_twentySixSeventh * sigma6[i] * (one - LFV[i]));
- rLJ *= alpha_vdw_eff;
+ rLJ = gmx::sixthroot(c_twentySixSeventh * sigma6VdWGapsys[i] * (one - LFV[i]));
+ rLJ *= scaleLinpointVdWGapsys;
}
if ((softcoreType == KernelSoftcoreType::Gapsys) && (r < rLJ))
fscal += (LFC[i] * fscal_elec[i] + LFV[i] * fscal_vdw[i]) * rpm2;
- if (softcoreType == KernelSoftcoreType::Gapsys)
+ if constexpr (softcoreType == KernelSoftcoreType::Gapsys)
{
dvdl_coul_sum += dvdl_elec[i];
dvdl_vdw_sum += dvdl_vdw[i];
}
dvdl_coul_sum += velec[i] * DLF[i];
dvdl_vdw_sum += vvdw[i] * DLF[i];
- if (softcoreType == KernelSoftcoreType::Beutler)
+ if constexpr (softcoreType == KernelSoftcoreType::Beutler)
{
dvdl_coul_sum += LFC[i] * alpha_coul_eff * dlfac_coul[i] * fscal_elec[i] * sigma_pow[i];
dvdl_vdw_sum += LFV[i] * alpha_vdw_eff * dlfac_vdw[i] * fscal_vdw[i] * sigma_pow[i];
c12B = iparams[itype].lj14.c12B * 12.0;
const auto& scParams = *fr->ic->softCoreParameters;
- if (scParams.softcoreType == SoftcoreType::Gapsys)
- {
- fscal = free_energy_evaluate_single<KernelSoftcoreType::Gapsys>(
- r2,
- fr->ic->rcoulomb,
- *fr->ic->softCoreParameters,
- fr->pairsTable->scale,
- fr->pairsTable->data.data(),
- fr->pairsTable->stride,
- qq,
- c6,
- c12,
- qqB,
- c6B,
- c12B,
- epsfac,
- LFC,
- LFV,
- DLF,
- lfac_coul,
- lfac_vdw,
- dlfac_coul,
- dlfac_vdw,
- &velec,
- &vvdw,
- dvdl);
- }
- else if (scParams.softcoreType == SoftcoreType::Beutler)
+ if (scParams.softcoreType == SoftcoreType::Beutler)
{
- fscal = free_energy_evaluate_single<KernelSoftcoreType::Beutler>(
- r2,
- fr->ic->rcoulomb,
- *fr->ic->softCoreParameters,
- fr->pairsTable->scale,
- fr->pairsTable->data.data(),
- fr->pairsTable->stride,
- qq,
- c6,
- c12,
- qqB,
- c6B,
- c12B,
- epsfac,
- LFC,
- LFV,
- DLF,
- lfac_coul,
- lfac_vdw,
- dlfac_coul,
- dlfac_vdw,
- &velec,
- &vvdw,
- dvdl);
+ if (scParams.alphaCoulomb == 0 && scParams.alphaVdw == 0)
+ {
+ fscal = free_energy_evaluate_single<KernelSoftcoreType::None>(
+ r2,
+ fr->ic->rcoulomb,
+ *fr->ic->softCoreParameters,
+ fr->pairsTable->scale,
+ fr->pairsTable->data.data(),
+ fr->pairsTable->stride,
+ qq,
+ c6,
+ c12,
+ qqB,
+ c6B,
+ c12B,
+ epsfac,
+ LFC,
+ LFV,
+ DLF,
+ lfac_coul,
+ lfac_vdw,
+ dlfac_coul,
+ dlfac_vdw,
+ &velec,
+ &vvdw,
+ dvdl);
+ }
+ else
+ {
+ fscal = free_energy_evaluate_single<KernelSoftcoreType::Beutler>(
+ r2,
+ fr->ic->rcoulomb,
+ *fr->ic->softCoreParameters,
+ fr->pairsTable->scale,
+ fr->pairsTable->data.data(),
+ fr->pairsTable->stride,
+ qq,
+ c6,
+ c12,
+ qqB,
+ c6B,
+ c12B,
+ epsfac,
+ LFC,
+ LFV,
+ DLF,
+ lfac_coul,
+ lfac_vdw,
+ dlfac_coul,
+ dlfac_vdw,
+ &velec,
+ &vvdw,
+ dvdl);
+ }
}
- else
+ else // Gapsys
{
- fscal = free_energy_evaluate_single<KernelSoftcoreType::None>(
- r2,
- fr->ic->rcoulomb,
- *fr->ic->softCoreParameters,
- fr->pairsTable->scale,
- fr->pairsTable->data.data(),
- fr->pairsTable->stride,
- qq,
- c6,
- c12,
- qqB,
- c6B,
- c12B,
- epsfac,
- LFC,
- LFV,
- DLF,
- lfac_coul,
- lfac_vdw,
- dlfac_coul,
- dlfac_vdw,
- &velec,
- &vvdw,
- dvdl);
+ if (scParams.scaleLinpointCoulGapsys == 0 && scParams.scaleLinpointVdWGapsys == 0)
+ {
+ fscal = free_energy_evaluate_single<KernelSoftcoreType::None>(
+ r2,
+ fr->ic->rcoulomb,
+ *fr->ic->softCoreParameters,
+ fr->pairsTable->scale,
+ fr->pairsTable->data.data(),
+ fr->pairsTable->stride,
+ qq,
+ c6,
+ c12,
+ qqB,
+ c6B,
+ c12B,
+ epsfac,
+ LFC,
+ LFV,
+ DLF,
+ lfac_coul,
+ lfac_vdw,
+ dlfac_coul,
+ dlfac_vdw,
+ &velec,
+ &vvdw,
+ dvdl);
+ }
+ else
+ {
+ fscal = free_energy_evaluate_single<KernelSoftcoreType::Gapsys>(
+ r2,
+ fr->ic->rcoulomb,
+ *fr->ic->softCoreParameters,
+ fr->pairsTable->scale,
+ fr->pairsTable->data.data(),
+ fr->pairsTable->stride,
+ qq,
+ c6,
+ c12,
+ qqB,
+ c6B,
+ c12B,
+ epsfac,
+ LFC,
+ LFV,
+ DLF,
+ lfac_coul,
+ lfac_vdw,
+ dlfac_coul,
+ dlfac_vdw,
+ &velec,
+ &vvdw,
+ dvdl);
+ }
}
}
else
PS("separate-dhdl-file", enumValueToString(fep->separate_dhdl_file));
PS("dhdl-derivatives", enumValueToString(fep->dhdl_derivatives));
PS("sc-function", enumValueToString(fep->softcoreFunction));
+ PR("sc-scale-linpoint-LJ-gapsys", fep->scScaleLinpointLJGapsys);
+ PR("sc-scale-linpoint-Q-gapsys", fep->scScaleLinpointQGapsys);
+ PR("sc-sigma-LJ-gapsys", fep->scSigmaLJGapsys);
};
static void pr_pull(FILE* fp, int indent, const pull_params_t& pull)
cmp_bool(fp, "inputrec->fepvals->bScCoul", -1, fep1->bScCoul, fep1->bScCoul);
cmpEnum(fp, "inputrec->separate_dhdl_file", fep1->separate_dhdl_file, fep2->separate_dhdl_file);
cmpEnum(fp, "inputrec->dhdl_derivatives", fep1->dhdl_derivatives, fep2->dhdl_derivatives);
- cmpEnum(fp, "inputrec->softcoreFunction", fep1->softcoreFunction, fep2->softcoreFunction);
cmp_int(fp, "inputrec->dh_hist_size", -1, fep1->dh_hist_size, fep2->dh_hist_size);
cmp_double(fp, "inputrec->dh_hist_spacing", -1, fep1->dh_hist_spacing, fep2->dh_hist_spacing, ftol, abstol);
+ cmpEnum(fp, "inputrec->fepvals->softcoreFunction", fep1->softcoreFunction, fep2->softcoreFunction);
+ cmp_real(fp,
+ "inputrec->fepvals->scScaleLinpointLJGapsys",
+ -1,
+ fep1->scScaleLinpointLJGapsys,
+ fep2->scScaleLinpointLJGapsys,
+ ftol,
+ abstol);
+ cmp_real(fp,
+ "inputrec->fepvals->scScaleLinpointQGapsys",
+ -1,
+ fep1->scScaleLinpointQGapsys,
+ fep2->scScaleLinpointQGapsys,
+ ftol,
+ abstol);
+ cmp_real(fp, "inputrec->fepvals->scSigmaLJGapsys", -1, fep1->scSigmaLJGapsys, fep2->scSigmaLJGapsys, ftol, abstol);
}
void cmp_inputrec(FILE* fp, const t_inputrec* ir1, const t_inputrec* ir2, real ftol, real abstol)
bool bScCoul = false;
//! The specific soft-core function to use
SoftcoreType softcoreFunction = SoftcoreType::Beutler;
+ //! scale for the linearization point for the vdw interaction with gapsys soft-core
+ real scScaleLinpointLJGapsys = 0.85;
+ //! scale for the linearization point for the coulomb interaction with gapsys soft-core
+ real scScaleLinpointQGapsys = 0.3;
+ //! lower bound for c12/c6 in gapsys soft-core
+ real scSigmaLJGapsys = 0.3;
//! Whether to print the dvdl term associated with this term; if it is not specified as separate, it is lumped with the FEP term
gmx::EnumerationArray<FreeEnergyPerturbationCouplingType, bool> separate_dvdl;
//! Whether to write a separate dhdl.xvg file note: NOT a gmx_bool, but an enum
lambdaPower(fepvals.sc_power),
sigma6WithInvalidSigma(gmx::power6(fepvals.sc_sigma)),
sigma6Minimum(fepvals.bScCoul ? gmx::power6(fepvals.sc_sigma_min) : 0),
- softcoreType(fepvals.softcoreFunction)
+ softcoreType(fepvals.softcoreFunction),
+ scaleLinpointVdWGapsys(fepvals.scScaleLinpointLJGapsys),
+ scaleLinpointCoulGapsys(fepvals.scScaleLinpointQGapsys),
+ sigma6VdWGapsys(gmx::power6(fepvals.scSigmaLJGapsys))
{
// This is checked during tpr reading, so we can assert here
GMX_RELEASE_ASSERT(fepvals.sc_r_power == 6.0, "We only support soft-core r-power 6");
real sigma6Minimum;
// soft-core function
SoftcoreType softcoreType;
+ // (gapsys sc) linearization point scaling for vdW interactions
+ real scaleLinpointVdWGapsys;
+ // (gapsys sc) linearization point scaling for Coulomb interactions
+ real scaleLinpointCoulGapsys;
+ // (gapsys sc) lower bound/replacement for c12/c6 in vdw interactions
+ real sigma6VdWGapsys;
};
/* VdW */