const bool haveMultipleDomains = havePPDomainDecomposition(cr);
- bool bFEP_NonBonded = (fr->efep != efepNO) && haveFepPerturbedNBInteractions(mtop);
+ bool bFEP_NonBonded = (fr->efep != efepNO) && haveFepPerturbedNBInteractions(*mtop);
PairlistParams pairlistParams(kernelSetup.kernelType, bFEP_NonBonded, ir->rlist, haveMultipleDomains);
setupDynamicPairlistPruning(mdlog, ir, mtop, box, fr->ic, &pairlistParams);
mtop->finalize();
}
-bool haveFepPerturbedNBInteractions(const gmx_mtop_t* mtop)
+bool haveFepPerturbedNBInteractions(const gmx_mtop_t& mtop)
{
- for (size_t mb = 0; mb < mtop->molblock.size(); mb++)
+ for (const gmx_moltype_t& molt : mtop.moltype)
{
- const gmx_molblock_t& molb = mtop->molblock[mb];
- const gmx_moltype_t& molt = mtop->moltype[molb.type];
- for (int m = 0; m < molb.nmol; m++)
+ for (int a = 0; a < molt.atoms.nr; a++)
{
- for (int a = 0; a < molt.atoms.nr; a++)
+ if (PERTURBED(molt.atoms.atom[a]))
{
- const t_atom& atom = molt.atoms.atom[a];
- if (PERTURBED(atom))
- {
- return true;
- }
+ return true;
+ }
+ }
+ }
+
+ return false;
+}
+
+bool haveFepPerturbedMasses(const gmx_mtop_t& mtop)
+{
+ for (const gmx_moltype_t& molt : mtop.moltype)
+ {
+ for (int a = 0; a < molt.atoms.nr; a++)
+ {
+ const t_atom& atom = molt.atoms.atom[a];
+ if (atom.m != atom.mB)
+ {
+ return true;
}
}
}
+
+ return false;
+}
+
+bool havePerturbedConstraints(const gmx_mtop_t& mtop)
+{
+ // This code assumes that all perturbed constraints parameters are actually used
+ const auto& ffparams = mtop.ffparams;
+
+ for (gmx::index i = 0; i < gmx::ssize(ffparams.functype); i++)
+ {
+ if (ffparams.functype[i] == F_CONSTR || ffparams.functype[i] == F_CONSTRNC)
+ {
+ const auto& iparams = ffparams.iparams[i];
+ if (iparams.constr.dA != iparams.constr.dB)
+ {
+ return true;
+ }
+ }
+ }
+
return false;
}
*/
void convertAtomsToMtop(t_symtab* symtab, char** name, t_atoms* atoms, gmx_mtop_t* mtop);
-/*! \brief Checks if the non-bonded FEP should be performed in this run.
- *
- * \param[in] mtop Molecular topology.
- * \returns Whether FEP non-bonded is requested.
- */
-bool haveFepPerturbedNBInteractions(const gmx_mtop_t* mtop);
+//! Checks and returns whether non-bonded interactions are perturbed for free-energy calculations
+bool haveFepPerturbedNBInteractions(const gmx_mtop_t& mtop);
+
+//! Checks whether masses are perturbed for free-energy calculations
+bool haveFepPerturbedMasses(const gmx_mtop_t& mtop);
+
+//! Checks whether constraints are perturbed for free-energy calculations
+bool havePerturbedConstraints(const gmx_mtop_t& mtop);
#endif