return system;
}
+ std::shared_ptr<Workflow> getWork(const System::Impl& system)
+ {
+ return system.workflow_;
+ }
+
System::Impl::Impl(std::unique_ptr<gmxapi::Workflow> workflow) noexcept :
- workflow_(std::move(workflow)),
- spec_(std::make_shared<MDWorkSpec>())
+ workflow_(std::move(workflow)), spec_(std::make_shared<MDWorkSpec>())
{
GMX_ASSERT(workflow_, "Class invariant implies non-null workflow_ member");
GMX_ASSERT(spec_, "Class invariant implies non-null work specification member.");
-cmake_minimum_required(VERSION 3.13.0)
+cmake_minimum_required(VERSION 3.16.3)
# If you are using this repository as a template, you should probably change the
# project name and adopt your own versioning scheme.
- project(sample_restraint VERSION 0.0.8)
+ project(sample_restraint VERSION 0.2.1)
find_package(PythonInterp)
// Export system container class
py::class_<System, std::shared_ptr<System>> system(m, "MDSystem");
-- system.def("launch",
-- [](System* system, std::shared_ptr<PyContext> context) {
- auto newSession = system->launch(context->get());
- auto work = gmxapi::getWork(*system->get());
- auto newSession = context->launch(*work);
-- return newSession;
-- },
-- "Launch the configured workflow in the provided context.");
++ system.def(
++ "launch",
++ [](System* system, std::shared_ptr<PyContext> context) {
++ auto work = gmxapi::getWork(*system->get());
++ auto newSession = context->launch(*work);
++ return newSession;
++ },
++ "Launch the configured workflow in the provided context.");
// Module-level function
- m.def("from_tpr", &gmxpy::from_tpr,
+ m.def("from_tpr",
+ &gmxpy::from_tpr,
"Return a system container initialized from the given input record.");
}
/* Here AWH can be extended to work on other coordinates than pull. */
};
- /*! \brief Checks whether any dimension uses pulling as a coordinate provider.
+ /*! \brief Checks whether any dimension uses the given coordinate provider type.
*
* \param[in] awhBiasParams The bias params to check.
- * \returns true if any dimension of the bias is linked to pulling.
+ * \param[in] awhCoordProvider The type of coordinate provider
+ * \returns true if any dimension of the bias is linked to the given provider
*/
- static bool anyDimUsesPull(const AwhBiasParams& awhBiasParams)
-static bool anyDimUsesProvider(const AwhBiasParams& awhBiasParams, const int awhCoordProvider)
++static bool anyDimUsesProvider(const AwhBiasParams& awhBiasParams,
++ const AwhCoordinateProviderType awhCoordProvider)
{
- return std::any_of(
- awhBiasParams.dimParams().begin(), awhBiasParams.dimParams().end(), [](const auto& awhDimParam) {
- return awhDimParam.coordinateProvider() == AwhCoordinateProviderType::Pull;
- });
- for (int d = 0; d < awhBiasParams.ndim; d++)
- {
- const AwhDimParams& awhDimParams = awhBiasParams.dimParams[d];
- if (awhDimParams.eCoordProvider == awhCoordProvider)
- {
- return true;
- }
- }
- return false;
++ return std::any_of(awhBiasParams.dimParams().begin(),
++ awhBiasParams.dimParams().end(),
++ [&awhCoordProvider](const auto& awhDimParam) {
++ return awhDimParam.coordinateProvider() == awhCoordProvider;
++ });
}
- /*! \brief Checks whether any dimension uses pulling as a coordinate provider.
+ /*! \brief Checks whether any dimension uses the given coordinate provider type.
*
* \param[in] awhParams The AWH params to check.
- * \returns true if any dimension of awh is linked to pulling.
+ * \param[in] awhCoordProvider The type of coordinate provider
+ * \returns true if any dimension of awh is linked to the given provider type.
*/
- static bool anyDimUsesPull(const AwhParams& awhParams)
-static bool anyDimUsesProvider(const AwhParams& awhParams, const int awhCoordProvider)
++static bool anyDimUsesProvider(const AwhParams& awhParams, const AwhCoordinateProviderType awhCoordProvider)
{
- for (int k = 0; k < awhParams.numBias; k++)
- {
- const AwhBiasParams& awhBiasParams = awhParams.awhBiasParams[k];
- if (anyDimUsesProvider(awhBiasParams, awhCoordProvider))
- {
- return true;
- }
- }
- return false;
+ return std::any_of(awhParams.awhBiasParams().begin(),
+ awhParams.awhBiasParams().end(),
- [](const auto& awhBiasParam) { return anyDimUsesPull(awhBiasParam); });
++ [&awhCoordProvider](const auto& awhBiasParam) {
++ return anyDimUsesProvider(awhBiasParam, awhCoordProvider);
++ });
}
/*! \brief Checks whether any dimension uses pulling as a coordinate provider.
numFepLambdaStates_(numFepLambdaStates),
fepLambdaState_(fepLambdaState)
{
- if (anyDimUsesPull(awhParams))
- if (anyDimUsesProvider(awhParams, eawhcoordproviderPULL))
++ if (anyDimUsesProvider(awhParams, AwhCoordinateProviderType::Pull))
{
GMX_RELEASE_ASSERT(inputRecord.pull != nullptr, "With AWH we should have pull parameters");
GMX_RELEASE_ASSERT(pull_work != nullptr,
if (fplog != nullptr)
{
please_cite(fplog, "Lindahl2014");
- if (anyDimUsesProvider(awhParams, eawhcoordproviderFREE_ENERGY_LAMBDA))
+
++ if (anyDimUsesProvider(awhParams, AwhCoordinateProviderType::FreeEnergyLambda))
+ {
+ please_cite(fplog, "Lundborg2021");
+ }
}
if (haveBiasSharingWithinSimulation(awhParams))
void Awh::registerAwhWithPull(const AwhParams& awhParams, pull_t* pull_work)
{
- GMX_RELEASE_ASSERT(!anyDimUsesPull(awhParams) || pull_work, "Need a valid pull object");
- GMX_RELEASE_ASSERT(!anyDimUsesProvider(awhParams, eawhcoordproviderPULL) || pull_work,
++ GMX_RELEASE_ASSERT(!anyDimUsesProvider(awhParams, AwhCoordinateProviderType::Pull) || pull_work,
+ "Need a valid pull object");
- for (int k = 0; k < awhParams.numBias; k++)
+ for (const auto& biasParam : awhParams.awhBiasParams())
{
- const AwhBiasParams& biasParams = awhParams.awhBiasParams[k];
-
- for (int d = 0; d < biasParams.ndim; d++)
+ for (const auto& dimParam : biasParam.dimParams())
{
- if (biasParams.dimParams[d].eCoordProvider == eawhcoordproviderPULL)
+ if (dimParam.coordinateProvider() == AwhCoordinateProviderType::Pull)
{
- register_external_pull_potential(pull_work, biasParams.dimParams[d].coordIndex,
- Awh::externalPotentialString());
+ register_external_pull_potential(
+ pull_work, dimParam.coordinateIndex(), Awh::externalPotentialString());
}
}
}
state_change_natoms(state_local, comm->atomRanges.numHomeAtoms());
/* Rebuild all the indices */
- dd->ga2la->clear();
+ dd->ga2la->clear(false);
ncgindex_set = 0;
- wallcycle_sub_stop(wcycle, ewcsDD_GRID);
+ wallcycle_sub_stop(wcycle, WallCycleSubCounter::DDGrid);
}
else
{
"M. J. Abraham, T. Murtola, R. Schulz, S. Páll, J. C. Smith, B. Hess, E. Lindahl",
"GROMACS: High performance molecular simulations through multi-level parallelism from "
"laptops to supercomputers",
- "SoftwareX", 1, 2015, "19-25" },
- { "Ballenegger2009", "V. Ballenegger, A. Arnold, J. J. Cerdà",
+ "SoftwareX",
+ 1,
+ 2015,
+ "19-25" },
+ { "Ballenegger2009",
+ "V. Ballenegger, A. Arnold, J. J. Cerdà",
"Simulations of non-neutral slab systems with long-range electrostatic interactions in "
"two-dimensional periodic boundary conditions",
- "J. Chem. Phys", 131, 2009, "094107" },
- { "Hub2014a", "J. S. Hub, B. L. de Groot, H. Grubmueller, G. Groenhof",
+ "J. Chem. Phys",
+ 131,
+ 2009,
+ "094107" },
+ { "Hub2014a",
+ "J. S. Hub, B. L. de Groot, H. Grubmueller, G. Groenhof",
"Quantifying Artifacts in Ewald Simulations of Inhomogeneous Systems with a Net Charge",
- "J. Chem. Theory Comput.", 10, 2014, "381-393" },
- { "Spoel2018a", "D. van der Spoel, M. M. Ghahremanpour, J. Lemkul",
+ "J. Chem. Theory Comput.",
+ 10,
+ 2014,
+ "381-393" },
+ { "Spoel2018a",
+ "D. van der Spoel, M. M. Ghahremanpour, J. Lemkul",
"Small Molecule Thermochemistry: A Tool For Empirical Force Field Development",
- "J. Phys. Chem. A", 122, 2018, "8982-8988" },
- { "Lindahl2014", "V. Lindahl, J. Lidmar, B. Hess",
+ "J. Phys. Chem. A",
+ 122,
+ 2018,
+ "8982-8988" },
+ { "Lindahl2014",
+ "V. Lindahl, J. Lidmar, B. Hess",
"Accelerated weight histogram method for exploring free energy landscapes",
- "J. Chem. Phys.", 141, 2014, "044110" },
- { "Bernetti2020", "M. Bernetti, G. Bussi",
- "Pressure control using stochastic cell rescaling", "J. Chem. Phys.", 153, 2020,
+ "J. Chem. Phys.",
+ 141,
+ 2014,
+ "044110" },
+ { "Bernetti2020",
+ "M. Bernetti, G. Bussi",
+ "Pressure control using stochastic cell rescaling",
+ "J. Chem. Phys.",
+ 153,
+ 2020,
"114107" },
- { "Lundborg2021", "M. Lundborg, J. Lidmar, B. Hess",
++ { "Lundborg2021",
++ "M. Lundborg, J. Lidmar, B. Hess",
+ "The accelerated weight histogram method for alchemical free energy calculations",
- "J. Chem. Phys.", 154, 2021, "204103" },
++ "J. Chem. Phys.",
++ 154,
++ 2021,
++ "204103" },
};
#define NSTR static_cast<int>(asize(citedb))