This meant that restraint potentials would silently fail to be applied with
gmxapi versions >= 0.1.
Updates have been applied internally to gmxapi.
+
+The gmxapi 0.2.2 Python package supports the updated GROMACS API and will
+issue errors if a simulation attempts to bind external plugin code with
+a compatible-but-broken API (GROMACS 2021 through 2021.2).
+
Third party code should not need to be updated, but developers will
note an additional "null restraint" in
https://gitlab.com/gromacs/gromacs/-/tree/master/python_packaging/sample_restraint
(for illustration and testing purposes).
-:issue:`4078`
+:issue:`4078` and :issue:`4102`
Fixes for ``gmx`` tools
^^^^^^^^^^^^^^^^^^^^^^^
endif()
if(GMXAPI_MASTER_PROJECT)
- find_package(gmxapi 0.2.1 REQUIRED
+ find_package(gmxapi 0.2 REQUIRED
HINTS "$ENV{GROMACS_DIR}"
)
+ if (gmxapi_VERSION VERSION_LESS 0.2.1)
+ message(WARNING "Your GROMACS installation does not support custom MD plugins. "
+ "If you need this feature, please install GROMACS 2021.3 or higher.")
+ endif ()
endif()
if(gmxapi_FOUND)
set(_suffix "")
${GMXAPI_PYTHON_EXTENSION_SOURCES}
)
+if (gmxapi_VERSION VERSION_GREATER_EQUAL 0.2.1)
+ target_sources(_gmxapi PRIVATE gmxapi/launch_021.cpp)
+else()
+ target_sources(_gmxapi PRIVATE gmxapi/launch_020.cpp)
+endif()
+
target_include_directories(_gmxapi PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/gmxapi
${CMAKE_CURRENT_BINARY_DIR}/gmxapi
#include "gmxapi/session.h"
#include "gmxapi/status.h"
#include "gmxapi/system.h"
+#include "gmxapi/version.h"
#include "pycontext.h"
#include "pysystem.h"
// 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 work = gmxapi::getWork(*system->get());
- auto newSession = context->launch(*work);
- return newSession;
- },
- "Launch the configured workflow in the provided context.");
+ system.def("launch", &launch, "Launch the configured workflow in the provided context.");
// Module-level function
m.def("from_tpr", &gmxpy::from_tpr,
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2021, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \file
+ * \brief Implement Session launcher.
+ *
+ * \ingroup module_python
+ * \author M. Eric Irrgang <ericirrgang@gmail.com>
+ */
+
+#include "pycontext.h"
+#include "pysystem.h"
+
+namespace gmxpy
+{
+
+std::shared_ptr<gmxapi::Session> launch(::gmxapi::System* system, PyContext* context)
+{
+ auto newSession = system->launch(context->get());
+ return newSession;
+}
+
+} // namespace gmxpy
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2021, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \file
+ * \brief Implement Session launcher.
+ *
+ * \ingroup module_python
+ * \author M. Eric Irrgang <ericirrgang@gmail.com>
+ */
+
+#include "pycontext.h"
+#include "pysystem.h"
+
+namespace gmxpy
+{
+
+std::shared_ptr<gmxapi::Session> launch(::gmxapi::System* system, PyContext* context)
+{
+ auto work = gmxapi::getWork(*system->get());
+ auto newSession = context->launch(*work);
+ return newSession;
+}
+
+} // namespace gmxpy
#include "gmxapi/md.h"
#include "gmxapi/session.h"
#include "gmxapi/status.h"
-
+#include "gmxapi/version.h"
namespace py = pybind11;
void PyContext::addMDModule(const pybind11::object& force_object) const
{
+ if (!::gmxapi::Version::isAtLeast(0, 2, 1))
+ {
+ throw ::gmxapi::NotImplementedError("Feature requires gmxapi 0.2.1 with GROMACS 2021.3.");
+ }
// If force_object has a bind method, give it a PyCapsule with a pointer
// to our C++ object.
if (py::hasattr(force_object, "bind"))
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
std::shared_ptr<gmxapi::System> from_tpr(std::string filename);
+class PyContext;
+
+std::shared_ptr<gmxapi::Session> launch(::gmxapi::System* system, PyContext* context);
+
} // end namespace gmxpy
#endif // header guard
name='gmxapi',
# TODO: single-source version information (currently repeated in gmxapi/version.py and CMakeLists.txt)
- version='0.2.1',
+ version='0.2.2',
python_requires='>=3.6',
install_requires=['networkx>=2.0',
'numpy>=1'],