-t_oriresdata::t_oriresdata(FILE* fplog,
- const gmx_mtop_t& mtop,
- const t_inputrec& ir,
- const t_commrec* cr,
- const gmx_multisim_t* ms,
- t_state* globalState) :
- numRestraints(gmx_mtop_ftype_count(mtop, F_ORIRES))
+void extendStateWithOriresHistory(const gmx_mtop_t& mtop, const t_inputrec& ir, t_state* globalState)
+{
+ GMX_RELEASE_ASSERT(globalState != nullptr,
+ "We need a valid global state in extendStateWithOriresHistory()");
+
+ const int numRestraints = gmx_mtop_ftype_count(mtop, F_ORIRES);
+ if (numRestraints > 0 && ir.orires_tau > 0)
+ {
+ /* Extend the state with the orires history */
+ globalState->flags |= enumValueToBitMask(StateEntry::OrireInitF);
+ globalState->hist.orire_initf = 1;
+ globalState->flags |= enumValueToBitMask(StateEntry::OrireDtav);
+ globalState->hist.orire_Dtav.resize(numRestraints * 5);
+ }
+}
+
+namespace
+{
+
+//! Creates and returns a list of global atom indices of the orientation restraint fit group
+std::vector<gmx::index> fitGlobalAtomIndices(const gmx_mtop_t& mtop)
+{
+ std::vector<gmx::index> indices;
+
+ for (int i = 0; i < mtop.natoms; i++)
+ {
+ if (getGroupType(mtop.groups, SimulationAtomGroupType::OrientationRestraintsFit, i) == 0)
+ {
+ indices.push_back(i);
+ }
+ }
+
+ return indices;
+}
+
+} // namespace
+
+t_oriresdata::t_oriresdata(FILE* fplog,
+ const gmx_mtop_t& mtop,
+ const t_inputrec& ir,
+ const gmx_multisim_t* ms,
+ t_state* globalState,
+ gmx::LocalAtomSetManager* localAtomSetManager) :
+ numRestraints(gmx_mtop_ftype_count(mtop, F_ORIRES)),
+ fitLocalAtomSet_(localAtomSetManager->add(fitGlobalAtomIndices(mtop)))