+/*! \brief Compute the total bonded interaction count
+ *
+ * \param[in] mtop The global system topology
+ * \param[in] includeConstraints Whether constraint interactions are included in the count
+ * \param[in] includeSettles Whether settle interactions are included in the count
+ *
+ * When using domain decomposition without update groups,
+ * constraint-type interactions can be split across domains, and so we
+ * do not consider them in this correctness check. Otherwise, we
+ * include them.
+ */
+static int computeExpectedNumGlobalBondedInteractions(const gmx_mtop_t& mtop,
+ const bool includeConstraints,
+ const bool includeSettles)
+{
+ int expectedNumGlobalBondedInteractions = gmx_mtop_interaction_count(mtop, IF_BOND);
+ if (includeConstraints)
+ {
+ expectedNumGlobalBondedInteractions +=
+ gmx_mtop_ftype_count(mtop, F_CONSTR) + gmx_mtop_ftype_count(mtop, F_CONSTRNC);
+ }
+ if (includeSettles)
+ {
+ expectedNumGlobalBondedInteractions += gmx_mtop_ftype_count(mtop, F_SETTLE);
+ }
+ return expectedNumGlobalBondedInteractions;
+}
+