# Our own GROMACS tests
########################################################################
-include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src)
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/src/external)
-# Required for config.h, maybe should only be set in src/CMakeLists.txt
-include_directories(BEFORE ${CMAKE_BINARY_DIR}/src)
include(gmxTestInlineASM)
gmx_test_inline_asm_gcc_x86(GMX_X86_GCC_INLINE_ASM)
KUBERNETES_CPU_LIMIT: 1
KUBERNETES_CPU_REQUEST: 1
KUBERNETES_MEMORY_REQUEST: 2Gi
- # Always clone the default version for this branch, 2021 in this case
+ # Always clone the default version for this branch, master in this case
script:
- - export REGTESTBRANCH=release-2021
+ - export REGTESTBRANCH=master
- if [[ ! -z $REGRESSIONTESTBRANCH ]] ; then
export REGTESTBRANCH=$REGRESSIONTESTBRANCH ;
echo "Using $REGTESTBRANCH instead of default" ;
- if [[ $GROMACS_RELEASE != "true" ]] ; then
REGTESTNAME=$REGTESTNAME-dev ;
fi
- - export REGTESTBRANCH=release-2021
+ - export REGTESTBRANCH=master
- if [[ $CI_COMMIT_REF_NAME == "master" || $CI_COMMIT_REF_NAME == "release-20"[1-2][0-9] ]] ; then
export REGTESTBRANCH=$CI_COMMIT_REF_NAME ;
fi
- job: webpage:build
variables:
BUILD_DIR: build-docs
+ before_script:
+ - eval $(ssh-agent -s)
+ - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add -
+ - mkdir -p ~/.ssh
+ - chmod 700 ~/.ssh
+ - ssh-keyscan www.gromacs.org > ~/.ssh/known_hosts # Force overwrite the known hosts so we only have that one key in it.
+ - chmod 644 ~/.ssh/known_hosts
script:
- tar czf webpage.tar.gz $BUILD_DIR/docs/html/
+ - rsync --chmod=u+rwX,g+rwX,o+rX -av $BUILD_DIR/docs/html/* $BUILD_DIR/docs/html/.[a-z]* pbauer@www.gromacs.org:/var/www/manual/nightly/
artifacts:
when: always
KUBERNETES_MEMORY_LIMIT: 8Gi
KUBERNETES_EXTENDED_RESOURCE_NAME: ""
KUBERNETES_EXTENDED_RESOURCE_LIMIT: 0
- CACHE_FALLBACK_KEY: "$CI_JOB_NAME-$CI_JOB_STAGE-release-2021"
+ CACHE_FALLBACK_KEY: "$CI_JOB_NAME-$CI_JOB_STAGE-master"
BUILD_DIR: build
INSTALL_DIR: install
CMAKE_GMXAPI_OPTIONS: ""
variables:
CMAKE: /usr/local/cmake-3.13.0/bin/cmake
CMAKE_SIMD_OPTIONS: "-DGMX_SIMD=AVX2_256"
- CMAKE_EXTRA_OPTIONS: "-DGMX_EXTERNAL_CLFFT=ON"
+ CMAKE_EXTRA_OPTIONS: "-DGMX_EXTERNAL_CLFFT=ON -DGMX_INSTALL_LEGACY_API=ON"
COMPILER_MAJOR_VERSION: 7
gromacs:clang-8-cuda-10.0:configure:
# Make sure that a Python interpreter can be found for `/bin/env python`
- test -x /usr/bin/python || update-alternatives --install /usr/bin/python python /usr/bin/python3 1
# TODO (issue #3272) `master` is not appropriate for use on release-xxxx branches, how should we handle that?
- - REV=$(git fetch -q https://gitlab.com/gromacs/gromacs.git release-2021 && git show -s --pretty=format:"%h" `git merge-base FETCH_HEAD HEAD`)
+ - REV=$(git fetch -q https://gitlab.com/gromacs/gromacs.git master && git show -s --pretty=format:"%h" `git merge-base FETCH_HEAD HEAD`)
- HEAD_REV=$(git show -s --pretty=format:"%h" HEAD)
- if [[ "$REV" == "$HEAD_REV" ]] ; then
REV="HEAD~1" ;
KUBERNETES_MEMORY_REQUEST: 2Gi
EXTRA_INSTALLS: clang-format-$COMPILER_MAJOR_VERSION
script:
- - REV=$(git fetch -q https://gitlab.com/gromacs/gromacs.git release-2021 && git show -s --pretty=format:"%h" `git merge-base FETCH_HEAD HEAD`)
+ # TODO (issue #3272) `master` is not appropriate for use on release-xxxx branches, how should we handle that?
+ - REV=$(git fetch -q https://gitlab.com/gromacs/gromacs.git master && git show -s --pretty=format:"%h" `git merge-base FETCH_HEAD HEAD`)
- HEAD_REV=$(git show -s --pretty=format:"%h" HEAD)
- if [[ "$REV" == "$HEAD_REV" ]] ; then
REV="HEAD~1" ;
gmxapi-0.2:gcc-7:gmx2021:py-3.6.10:
extends:
- .gmxapi-0.2:gcc-7:gmx2021
- - .rules:merge-requests:release-2021
+ - .rules:merge-requests:master
variables:
VENVPATH: "/root/venv/py3.6"
PY_VER: "3.6.10"
gmxapi-0.2:gcc-7:gmx2021:py-3.7.7:
extends:
- .gmxapi-0.2:gcc-7:gmx2021
- - .rules:merge-requests:release-2021
+ - .rules:merge-requests:master
variables:
VENVPATH: "/root/venv/py3.7"
PY_VER: "3.7.7"
gmxapi-0.2:gcc-7:gmx2021:py-3.8.2:
extends:
- .gmxapi-0.2:gcc-7:gmx2021
- - .rules:merge-requests:release-2021
+ - .rules:merge-requests:master
variables:
VENVPATH: "/root/venv/py3.8"
PY_VER: "3.8.2"
.rules-element:if-post-merge-acceptance-or-mr-then-always: &if-post-merge-acceptance-or-mr-then-always
if: '$CI_PIPELINE_SOURCE == "merge_request_event" ||
($CI_PIPELINE_SOURCE == "push" &&
- $CI_COMMIT_REF_NAME == "release-2021")'
+ $CI_COMMIT_REF_NAME == "master")'
when: always
# Include job only for post submit push
.rules-element:if-post-merge-acceptance-then-always: &if-post-merge-acceptance-then-always
if: '$CI_PIPELINE_SOURCE == "push" &&
- $CI_COMMIT_REF_NAME == "release-2021"'
+ $CI_COMMIT_REF_NAME == "master"'
when: always
# When composing a rule set, note that the first matching rule is applied.
- *if-schedule-then-always
- *if-mr-then-always
-# Jobs that run for merge requests and schedules for branch `release-2021`,
-# but not when GROMACS_RELEASE is set.
-# Excludes non-gromacs projects.
-.rules:merge-requests:release-2021:
- rules:
- - *if-not-gromacs-then-never
- - *if-release-then-never
- - *if-post-merge-acceptance-then-never
- # This next rule catches "push" and other events in branches other than `release-2021`
- # but allows merge_request_events for merge requests targeting `release-2021`.
- # This rule is before "web" so the web interface won't include jobs that can't succeed
- # (and would not ordinarily be run). Such jobs are hard to identify in a way that is
- # sufficiently general for a global rules definition.
- # If extra coverage is needed through a web-triggered job in merge request branches,
- # we could provide an additional short-circuiting rule based on an environment variable
- # to be provided through the web interface.
- - if: '$CI_MERGE_REQUEST_TARGET_BRANCH_NAME != "release-2021" && $CI_COMMIT_REF_NAME != "release-2021"'
- when: never
- - *if-web-then-always
- - *if-schedule-then-always
- - *if-mr-then-always
-
# Rule to run a job only in nightly release-preparation pipelines.
# Checks if the GROMACS_RELEASE variable was set (typically through the GitLab web interface).
# Excludes merge_requests and non-gromacs projects.
sample_restraint:gcc-7:gmx2021:py-3.6.10:
extends:
- .sample_restraint:gcc-7:gmx2021
- - .rules:merge-requests:release-2021
+ - .rules:merge-requests:master
variables:
VENVPATH: "/root/venv/py3.6"
PY_VER: "3.6.10"
sample_restraint:gcc-7:gmx2021:py-3.7.7:
extends:
- .sample_restraint:gcc-7:gmx2021
- - .rules:merge-requests:release-2021
+ - .rules:merge-requests:master
variables:
VENVPATH: "/root/venv/py3.7"
PY_VER: "3.7.7"
sample_restraint:gcc-7:gmx2021:py-3.8.2:
extends:
- .sample_restraint:gcc-7:gmx2021
- - .rules:merge-requests:release-2021
+ - .rules:merge-requests:master
variables:
VENVPATH: "/root/venv/py3.8"
PY_VER: "3.8.2"
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# The legacy public API headers may still be installed,
+# but may be removed or changed without warning.
+add_subdirectory(legacy)
# Activate targets for new C++ API components and docs.
if(GMX_NATIVE_WINDOWS OR GMX_BUILD_MDRUN_ONLY)
# be tagged. Official GROMACS releases should be mappable to a distinct gmxapi
# release string. For roadmap details, see https://gitlab.com/gromacs/gromacs/-/issues/2585
set(GMXAPI_MAJOR 0)
-set(GMXAPI_MINOR 2)
+set(GMXAPI_MINOR 3)
set(GMXAPI_PATCH 0)
set(GMXAPI_RELEASE ${GMXAPI_MAJOR}.${GMXAPI_MINOR}.${GMXAPI_PATCH})
find_package(MPI COMPONENTS C)
if (MPI_C_FOUND)
target_link_libraries(gmxapi PRIVATE MPI::MPI_C)
+ # If clients also need to link this target, we need to provide help in gmxapi-config.cmake
+ set(_gmxapi_find_dependencies "find_dependency(MPI COMPONENTS C)")
else()
message(FATAL_ERROR "Building gmxapi for MPI-enabled GROMACS, but no MPI toolchain found.")
endif ()
)
target_link_libraries(gmxapi PRIVATE libgromacs)
+target_link_libraries(gmxapi PRIVATE common)
+# TODO: Explicitly link specific modules: mdlib, mdtypes, utility, commandline
+target_link_libraries(gmxapi PRIVATE legacy_modules)
################################################
@PACKAGE_INIT@
# Refer to CMake docs for information on more elaborate use of this stub file:
# https://cmake.org/cmake/help/v3.4/module/CMakePackageConfigHelpers.html#command:configure_package_config_file
+include(CMakeFindDependencyMacro)
+@_gmxapi_find_dependencies@
include("${CMAKE_CURRENT_LIST_DIR}/gmxapi.cmake")
check_required_components(gmxapi)
set_property(TARGET Gromacs::gmxapi PROPERTY MPI "@_mpi@")
--- /dev/null
+#
+# This file is part of the GROMACS molecular simulation package.
+#
+# Copyright (c) 2020, 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.
+
+# The legacy installed API consists of headers that are not considered
+# to be maintainable in terms of a stable API specification. These headers
+# will no longer be available to install in a future release.
+
+# Note: Any usage requirements that should be transitive should be added to
+# this INTERFACE target. Compiler and linker options (that do not need to
+# be propagated when linking to the `common` target) can be added directly
+# to the `common` target.
+add_library(legacy_api INTERFACE)
+target_include_directories(legacy_api INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>
+ $<INSTALL_INTERFACE:include>)
+
+configure_file(version.h.cmakein include/gromacs/version.h)
+
+# Allow an export target for legacy_api since it is a dependency of the
+# installable libgromacs target.
+install(TARGETS legacy_api
+ EXPORT libgromacs
+ INCLUDES DESTINATION include)
+
+if(GMX_INSTALL_LEGACY_API)
+ # Install public header directories.
+ install(DIRECTORY include/gromacs
+ DESTINATION include)
+
+ # Install "configured" files from the build tree.
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/include/gromacs/version.h
+ DESTINATION include/gromacs)
+endif()
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2018,2019,2020, 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.
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2014,2015,2018,2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2019,2020, 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.
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2011-2018, The GROMACS development team.
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, 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.
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2012,2014,2020, 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
+ * Version information for software that links to \Gromacs.
+ *
+ * \if libapi
+ * This include file will be configured by CMake and contains version
+ * information. It is not used by \Gromacs, but intended for software that
+ * links to \Gromacs.
+ * The values come from the main CMakeLists.txt.
+ * \endif
+ *
+ * This file exists from 4.6 onward, and can be included as
+ * `<gromacs/version.h>`. In 4.6, it is also included by
+ * `<gromacs/typedefs.h>, but that header has already moved in 5.0.
+ *
+ * This header defines two values, the \Gromacs version, and the API version.
+ * The versions are in numerical form, where, for example, version
+ * 4.6.1 would be 40601.
+ *
+ * The API version is defined in ::GMX_API_VERSION, and denotes the
+ * version of the programmer interface, i.e. the installed header files
+ * and compatible library.
+ *
+ * Programs written against the \Gromacs library can use this file
+ * to provide some backward compatibility even though parts of the API
+ * change. For example:
+ * \code
+ #include <gromacs/version.h>
+ #if (GMX_API_VERSION < 50000)
+ .... <do pre-5.0 stuff>
+ #else
+ .... <do post-5.0 stuff>
+ #endif
+ \endcode
+ * where version.h is included directly. For code that must be compatible
+ * between 4.5 and 4.6, an interim solution is to include typedefs.h, which
+ * includes this file:
+ * \code
+ #include <gromacs/typedefs.h>
+ #if !defined(GMX_API_VERSION) || (GMX_API_VERSION < 40600)
+ .... <do 4.5 specific stuff>
+ #elif (GMX_API_VERSION < 40700)
+ .... <do 4.6 specific stuff>
+ #endif
+ \endcode
+ *
+ * \inpublicapi
+ */
+#ifndef GMX_VERSION_H
+#define GMX_VERSION_H
+
+/*! \brief
+ * API version of this set of \Gromacs headers.
+ *
+ * If there are multiple versions of \Gromacs that work with the same set of
+ * headers, then this version is not updated between the versions, even though
+ * ::GMX_VERSION is.
+ * For 4.6 and 5.0 (and likely for some time in the future as well), this
+ * tracks the exact \Gromacs version.
+ */
+#define GMX_API_VERSION @GMX_API_VERSION@
+
+/*! \brief
+ * Exact \Gromacs version of this set of headers.
+ *
+ * This specifies the version number of the actual \Gromacs library that
+ * installed these headers.
+ */
+#define GMX_VERSION @GMX_VERSION_NUMERIC@
+
+#endif
target_link_libraries(nblib PRIVATE libgromacs)
target_include_directories(nblib PRIVATE ${PROJECT_SOURCE_DIR}/api)
include_directories(BEFORE ${CMAKE_SOURCE_DIR}/api)
+target_link_libraries(nblib PRIVATE common)
+# There are transitive dependencies on the legacy GROMACS headers.
+target_link_libraries(nblib PUBLIC legacy_api)
+# TODO: Explicitly link specific modules.
+target_link_libraries(nblib PRIVATE legacy_modules)
install(TARGETS nblib
EXPORT nblib
)
target_include_directories(nblib_test_infrastructure PRIVATE ${PROJECT_SOURCE_DIR}/api)
target_include_directories(nblib_test_infrastructure SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
+target_link_libraries(nblib_test_infrastructure PRIVATE legacy_api)
+# TODO: Explicitly link specific modules: math,
+target_link_libraries(nblib_test_infrastructure PRIVATE legacy_modules)
set(testname "NbLibSetupTests")
set(exename "nblib-setup-test")
# GROMACS 2019 4
# GROMACS 2020 5
# GROMACS 2021 6
+# GROMACS 2022 7
# LIBRARY_SOVERSION_MINOR so minor version for the built libraries.
# Should be increased for each release that changes only the implementation.
# In GROMACS, the typical policy is to increase it for each patch version
# The GROMACS convention is that these are the version number of the next
# release that is going to be made from this branch.
-set(GMX_VERSION_MAJOR 2021)
+set(GMX_VERSION_MAJOR 2022)
set(GMX_VERSION_PATCH 0)
# The suffix, on the other hand, is used mainly for betas and release
# candidates, where it signifies the most recent such release from
# this branch; it will be empty before the first such release, as well
# as after the final release is out.
-set(GMX_VERSION_SUFFIX "-beta2")
+set(GMX_VERSION_SUFFIX "")
# Conventionally with libtool, any ABI change must change the major
# version number, the minor version number should change if it's just
# here. The important thing is to minimize the chance of third-party
# code being able to dynamically link with a version of libgromacs
# that might not work.
-set(LIBRARY_SOVERSION_MAJOR 6)
+set(LIBRARY_SOVERSION_MAJOR 7)
set(LIBRARY_SOVERSION_MINOR 0)
set(LIBRARY_VERSION ${LIBRARY_SOVERSION_MAJOR}.${LIBRARY_SOVERSION_MINOR}.0)
endif()
set(REGRESSIONTEST_VERSION "${GMX_VERSION_STRING}")
-set(REGRESSIONTEST_BRANCH "release-2021")
+set(REGRESSIONTEST_BRANCH "master")
# Run the regressiontests packaging job with the correct pakage
# version string, and the release box checked, in order to have it
# build the regressiontests tarball with all the right naming. The
how-to/visualize.rst
install-guide/index.rst
release-notes/index.rst
+ release-notes/2022/major/highlights.rst
+ release-notes/2022/major/features.rst
+ release-notes/2022/major/performance.rst
+ release-notes/2022/major/tools.rst
+ release-notes/2022/major/bugs-fixed.rst
+ release-notes/2022/major/removed-functionality.rst
+ release-notes/2022/major/deprecated-functionality.rst
+ release-notes/2022/major/portability.rst
+ release-notes/2022/major/miscellaneous.rst
release-notes/2021/major/highlights.rst
release-notes/2021/major/features.rst
release-notes/2021/major/performance.rst
headers fall in this category. See Doxygen documentation for
:file:`gmxpre.h`.
- All the above files get generated in :file:`src/`.
+ The above files are available through the INTERFACE_INCLUDE_DIR of
+ the ``common`` CMake target. I.e. to ``#include "config.h"``, be sure to
+ ``target_link_libraries(mymodule PRIVATE common)``
Additionally, the following file is generated by the build system:
1. Each *source* file should include ``gmxpre.h`` first.
2. If a *source* file has a corresponding header, it should be included next.
If the header is in the same directory as the source, then it is included
- without any path (i.e., relative to the source), otherwise relative to
- ``src/`` (the latter case should be rare).
+ without any path (i.e., relative to the source). Otherwise, the canonical
+ include path of ``libraryname/modulename/header.h`` is used.
3. If the file depends on defines from ``config.h``, that comes next.
4. This is followed by standard C/C++ headers, grouped as follows:
``<gtest/gtest.h>``.
6. |Gromacs|-specific libraries from ``src/external/``, such as
``"thread_mpi/threads.h"``.
-7. |Gromacs|-specific headers that are not internal to the including module,
- included with a path relative to ``src/``.
-8. In *test* files, headers not internal to the module, but specific to
- testing code, are in a separate block at this point, paths relative to
- ``src/``.
-9. Finally, |Gromacs| headers that are internal to the including module are
- included using a relative path (but never with a path starting with ``../``;
- such headers go into group 7 instead). For test files, this group contains
- headers that are internal to tests for that module.
+7. |Gromacs| headers that are not part of the including module.
+8. Public |Gromacs| headers that are part of the including module.
+9. Finally, |Gromacs| headers that are internal to the including module,
+ executable, or test target
+ (typically at the same path as the source file).
All |Gromacs| headers are included with quotes (``"gromacs/utility/path.h"``),
other headers with angle brackets (``<stdio.h>``). Headers under ``src/external/``
cases. Trailing comments on the same line as #include statements are
preserved and do not affect the checker/sorter.
-The includestyle used to differentiate between header files that were declared
-to be part of the module and not used outside the module, and those that were
-either not part of a module, used in other modules, or installed.
-As the possibility of installation has been removed (for now), changes to the
-previous organization might occur where such installed files were implicitly
-marked as being used outside of a module even though they were not used within
-|Gromacs| outside their module.
-
As part of the effort to build a proper API, a new scheme of separating between
public, library and module functionality in header files is planned.
-
-The guidelines are enforced by an automatic checker script that can also
-sort/reformat include statements to follow the guidelines.
-See :doc:`gmxtree` for details.
+See also :doc:`gmxtree` and
+`API restructuring issues <https://gitlab.com/gromacs/gromacs/-/issues?label_name%5B%5D=API+restructuring>`__
+for details.
Enforcing a consistent order and style has a few advantages:
first. With this order, the person working on the header is most likely to
see these problems instead of someone else seeing them later when
refactoring unrelated code.
-* Consistent usage of paths in #include directives makes it easy to use
+* Consistent usage of paths in ``#include`` directives makes it easy to use
``grep`` to find all uses of a header, as well as all include dependencies
between two modules.
* An automatic script can be used to re-establish clean code after
LAYOUT_FILE = @CMAKE_CURRENT_SOURCE_DIR@/DoxygenLayout.xml
INPUT = @CMAKE_CURRENT_SOURCE_DIR@ \
@CMAKE_SOURCE_DIR@/src \
+ @CMAKE_SOURCE_DIR@/api/legacy/include \
@CMAKE_SOURCE_DIR@/share/template
FILE_PATTERNS = *.c *.cpp *.h *.md
# CUDA files could be included like this, but currently produce a lot of
EXCLUDE_SYMBOLS += MOCK_METHOD* MOCK_CONST_METHOD*
FULL_PATH_NAMES = YES
STRIP_FROM_PATH = @CMAKE_SOURCE_DIR@
-STRIP_FROM_INC_PATH = @CMAKE_SOURCE_DIR@/src
+STRIP_FROM_INC_PATH = @CMAKE_SOURCE_DIR@/src \
+ @CMAKE_SOURCE_DIR@/src/include \
+ @CMAKE_SOURCE_DIR@/src/gromacs/*/include \
+ @CMAKE_SOURCE_DIR@/api/legacy/include
INCLUDE_PATH = @CMAKE_SOURCE_DIR@/src
HAVE_DOT = @DOXYGEN_DOT_FOUND@
DOT_PATH = @DOXYGEN_DOT_PATH@
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2018,2019,2020, 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.
def check_all(tree, reporter, check_ignored):
"""Do all checks for the GROMACS tree."""
- includesorter = IncludeSorter()
- for fileobj in tree.get_files():
- if isinstance(fileobj, gmxtree.GeneratorSourceFile):
- continue
- check_file(fileobj, tree, reporter)
- for includedfile in fileobj.get_includes():
- check_include(fileobj, includedfile, reporter)
- if fileobj.should_includes_be_sorted():
- is_sorted, details = includesorter.check_sorted(fileobj)
- if not is_sorted:
- details.append("You can use includesorter.py to do the sorting automatically; see docs/dev-manual/gmxtree.rst")
- reporter.code_issue(fileobj,
- "include style/order is not consistent; see docs/dev-manual/includestyle.rst", details)
+ # Include sorting is disabled pending resolution of
+ # https://gitlab.com/gromacs/gromacs/-/issues/3288 and
+ # https://gitlab.com/gromacs/gromacs/-/issues/3659
+ # includesorter = IncludeSorter()
+ # for fileobj in tree.get_files():
+ # if isinstance(fileobj, gmxtree.GeneratorSourceFile):
+ # continue
+ # check_file(fileobj, tree, reporter)
+ # for includedfile in fileobj.get_includes():
+ # check_include(fileobj, includedfile, reporter)
+ # if fileobj.should_includes_be_sorted():
+ # is_sorted, details = includesorter.check_sorted(fileobj)
+ # if not is_sorted:
+ # details.append("You can use includesorter.py to do the sorting automatically; see docs/dev-manual/gmxtree.rst")
+ # reporter.code_issue(fileobj,
+ # "include style/order is not consistent; see docs/dev-manual/includestyle.rst", details)
for classobj in tree.get_classes():
check_class(classobj, reporter)
simd -> hardware
gpu_utils -> hardware
listed_forces -> mdlib
-utility -> math
# modular simulator uses shellfc from mdrun, but is later included in mdrun by simulator builder
modularsimulator -> mdrun
-# The script is currently a bit too eager
-share/template/template.cpp: error: source file documentation appears outside full documentation
-# The parser in the script is not clever enough
-src/gromacs/version.h: warning: includes local file as <gromacs/version.h>
-
-# These are OK
-src/gromacs/linearalgebra/eigensolver.cpp: warning: should include "config.h"
-src/gromacs/linearalgebra/gmx_arpack.cpp: warning: should include "config.h"
-src/gromacs/linearalgebra/gmx_blas/*: warning: does not include "gmxpre.h" first
-src/gromacs/linearalgebra/gmx_blas/*: warning: should include "config.h"
-src/gromacs/linearalgebra/gmx_lapack/*: warning: does not include "gmxpre.h" first
-src/gromacs/linearalgebra/gmx_lapack/*: warning: should include "config.h"
-src/gromacs/utility/baseversion-gen.cpp: warning: does not include "gmxpre.h" first
-
-# Exclude header files that are used for inlining code; the responsibility for
-# making the right #includes should be on the source file that uses these.
-# TODO: # Stop using the preprocessor for meta-programming!
-src/gromacs/ewald/pme_simd4.h: warning: should include "pme_simd.h"
-src/gromacs/ewald/pme_spline_work.cpp: warning: includes "simd.h" unnecessarily
-src/gromacs/ewald/pme_spline_work.h: warning: includes "simd.h" unnecessarily
-src/gromacs/ewald/pme_spread.cpp: warning: includes "simd.h" unnecessarily
-src/gromacs/nbnxm/boundingboxes.h: warning: includes "simd.h" unnecessarily
-src/gromacs/nbnxm/kernels_simd_2xmm/kernel_inner.h: warning: should include "simd.h"
-src/gromacs/nbnxm/kernels_simd_2xmm/kernel_outer.h: warning: should include "simd.h"
-src/gromacs/nbnxm/kernels_simd_4xm/kernel_inner.h: warning: should include "simd.h"
-src/gromacs/nbnxm/kernels_simd_4xm/kernel_outer.h: warning: should include "simd.h"
-src/gromacs/nbnxm/pairlist_simd_2xmm.h: warning: should include "simd.h"
-src/gromacs/nbnxm/pairlist_simd_4xm.h: warning: should include "simd.h"
-
-# This module name doesn't really fall into any currently used pattern; needs some thought
-: error: no matching directory for module: module_mdrun_integration_tests
-
-# These would be nice to fix, but can wait for later / deletion / rewrites
-src/gromacs/nbnxm/kernels_simd_2xmm/kernel_common.h: warning: should include "nbnxm_simd.h"
-src/gromacs/nbnxm/kernels_simd_4xm/kernel_common.h: warning: should include "nbnxm_simd.h"
-
# This seems to be a false positive
src/gromacs/nbnxm/cuda/nbnxm_cuda_types.h: error: NbnxmGpu: is in internal file(s), but appears in public documentation
+# doxygen has problems with the template construct in this file
+src/gromacs/modularsimulator/signallers.h: error: build: is documented, but does not have brief description
+
# False positive caused by forward-declaration of BasicVector in src/testutils/refdata.h
-src/gromacs/math/vectypes.h: error: gmx::BasicVector: is in library file(s), but appears in public documentation
+src/testutils/refdata.h: error: gmx::BasicVector: is in library file(s), but appears in public documentation
-# Temporary while we change the SIMD implementation
-src/gromacs/simd/impl_sparc64_hpc_ace/impl_sparc64_hpc_ace_common.h: warning: should include "simd.h"
+#
+# All following suppressions are disabled while the include checker
+# is temporarily disabled pending resolution of
+# https://gitlab.com/gromacs/gromacs/-/issues/3288 and
+# https://gitlab.com/gromacs/gromacs/-/issues/3659
+#
-src/gromacs/simd/tests/scalar.cpp: warning: includes "simd.h" unnecessarily
-src/gromacs/simd/tests/scalar_math.cpp: warning: includes "simd.h" unnecessarily
-src/gromacs/simd/tests/scalar_util.cpp: warning: includes "simd.h" unnecessarily
-src/gromacs/tables/cubicsplinetable.h: warning: includes "simd.h" unnecessarily
-src/gromacs/tables/quadraticsplinetable.h: warning: includes "simd.h" unnecessarily
+# # The script is currently a bit too eager
+# share/template/template.cpp: error: source file documentation appears outside full documentation
+# # The parser in the script is not clever enough
+# src/gromacs/version.h: warning: includes local file as <gromacs/version.h>
-# These are specific to Folding@Home, and easiest to suppress here
-src/gmxpre.h: warning: includes non-local file as "swindirect.h"
+# # These are OK
+# src/gromacs/linearalgebra/eigensolver.cpp: warning: should include "config.h"
+# src/gromacs/linearalgebra/gmx_arpack.cpp: warning: should include "config.h"
+# src/gromacs/linearalgebra/gmx_blas/*: warning: does not include "gmxpre.h" first
+# src/gromacs/linearalgebra/gmx_blas/*: warning: should include "config.h"
+# src/gromacs/linearalgebra/gmx_lapack/*: warning: does not include "gmxpre.h" first
+# src/gromacs/linearalgebra/gmx_lapack/*: warning: should include "config.h"
+# src/gromacs/utility/baseversion-gen.cpp: warning: does not include "gmxpre.h" first
-# New external API (see https://gitlab.com/gromacs/gromacs/-/issues/2586) has some unresolved
-# conflicts with previous definitions of public API, installed API, and other things
-# described or implemented in check-source.py, gmxtree.py, gmxtree.rst, and others
-# TODO: resolve definitions, update testing heuristics, and activate policy checks
-# for src/api/cpp files.
-src/api/cpp/*: *
+# # Exclude header files that are used for inlining code; the responsibility for
+# # making the right #includes should be on the source file that uses these.
+# # TODO: # Stop using the preprocessor for meta-programming!
+# src/gromacs/ewald/pme_simd4.h: warning: should include "pme_simd.h"
+# src/gromacs/ewald/pme_spline_work.cpp: warning: includes "simd.h" unnecessarily
+# src/gromacs/ewald/pme_spline_work.h: warning: includes "simd.h" unnecessarily
+# src/gromacs/ewald/pme_spread.cpp: warning: includes "simd.h" unnecessarily
+# src/gromacs/nbnxm/boundingboxes.h: warning: includes "simd.h" unnecessarily
+# src/gromacs/nbnxm/kernels_simd_2xmm/kernel_inner.h: warning: should include "simd.h"
+# src/gromacs/nbnxm/kernels_simd_2xmm/kernel_outer.h: warning: should include "simd.h"
+# src/gromacs/nbnxm/kernels_simd_4xm/kernel_inner.h: warning: should include "simd.h"
+# src/gromacs/nbnxm/kernels_simd_4xm/kernel_outer.h: warning: should include "simd.h"
+# src/gromacs/nbnxm/pairlist_simd_2xmm.h: warning: should include "simd.h"
+# src/gromacs/nbnxm/pairlist_simd_4xm.h: warning: should include "simd.h"
-# doxygen has problems with the template construct in this file
-src/gromacs/modularsimulator/signallers.h: error: build: is documented, but does not have brief description
+# # This module name doesn't really fall into any currently used pattern; needs some thought
+# : error: no matching directory for module: module_mdrun_integration_tests
+
+# # These would be nice to fix, but can wait for later / deletion / rewrites
+# src/gromacs/nbnxm/kernels_simd_2xmm/kernel_common.h: warning: should include "nbnxm_simd.h"
+# src/gromacs/nbnxm/kernels_simd_4xm/kernel_common.h: warning: should include "nbnxm_simd.h"
+
+
+# # Temporary while we change the SIMD implementation
+# src/gromacs/simd/impl_sparc64_hpc_ace/impl_sparc64_hpc_ace_common.h: warning: should include "simd.h"
+
+# src/gromacs/simd/tests/scalar.cpp: warning: includes "simd.h" unnecessarily
+# src/gromacs/simd/tests/scalar_math.cpp: warning: includes "simd.h" unnecessarily
+# src/gromacs/simd/tests/scalar_util.cpp: warning: includes "simd.h" unnecessarily
+# src/gromacs/tables/cubicsplinetable.h: warning: includes "simd.h" unnecessarily
+# src/gromacs/tables/quadraticsplinetable.h: warning: includes "simd.h" unnecessarily
+
+# # These are specific to Folding@Home, and easiest to suppress here
+# src/gmxpre.h: warning: includes non-local file as "swindirect.h"
+
+# # New external API (see https://gitlab.com/gromacs/gromacs/-/issues/2586) has some unresolved
+# # conflicts with previous definitions of public API, installed API, and other things
+# # described or implemented in check-source.py, gmxtree.py, gmxtree.rst, and others
+# # TODO: resolve definitions, update testing heuristics, and activate policy checks
+# # for src/api/cpp files.
+# src/api/cpp/*: *
}
To check the status or error output of a command line operation, refer to the
-``returncode`` and ``erroroutput`` outputs.
+``returncode`` and ``stderr`` outputs.
To access the results from the output file arguments, use the command line flags
as keys in the ``file`` dictionary output.
-.. _anticipated-changes:
-
.. Note to developers!
Please use """"""" to underline the individual entries for fixed issues in the subfolders,
otherwise the formatting on the webpage is messed up.
--- /dev/null
+Bugs fixed
+^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on GitLab, without the
+ a space between the colon and number!
+
--- /dev/null
+.. _anticipated-changes:
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on GitLab, without the
+ a space between the colon and number!
+
+Changes anticipated to |Gromacs| 2022 functionality
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Functionality deprecated in |Gromacs| 2022
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
--- /dev/null
+New and improved features
+^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on GitLab, without the
+ a space between the colon and number!
+
--- /dev/null
+Highlights
+^^^^^^^^^^
+
+|Gromacs| 2022 was released on INSERT DATE HERE. Patch releases may
+have been made since then, please use the updated versions! Here are
+some highlights of what you can expect, along with more detail in the
+links below!
+
+As always, we've got several useful performance improvements, with or
+without GPUs, all enabled and automated by default. In addition,
+several new features are available for running simulations. We are extremely
+interested in your feedback on how well the new release works on your
+simulations and hardware. The new features are:
+
+* Cool quotes music play list
+
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on GitLab, without the
+ a space between the colon and number!
--- /dev/null
+Miscellaneous
+^^^^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on GitLab, without the
+ a space between the colon and number!
+
--- /dev/null
+Performance improvements
+^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on GitLab, without the
+ a space between the colon and number!
+
--- /dev/null
+Portability
+^^^^^^^^^^^
+
--- /dev/null
+Removed functionality
+^^^^^^^^^^^^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on GitLab, without the
+ a space between the colon and number!
+
--- /dev/null
+Improvements to |Gromacs| tools
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+.. Note to developers!
+ Please use """"""" to underline the individual entries for fixed issues in the subfolders,
+ otherwise the formatting on the webpage is messed up.
+ Also, please use the syntax :issue:`number` to reference issues on GitLab, without the
+ a space between the colon and number!
+
functionality supported, whereas patch releases contain only fixes for
issues identified in the corresponding major releases.
-Two versions of |Gromacs| are under active maintenance, the 2021
-series and the 2020 series. In the latter, only highly conservative
+Two versions of |Gromacs| are under active maintenance, the 2022
+series and the 2021 series. In the latter, only highly conservative
fixes will be made, and only to address issues that affect scientific
correctness. Naturally, some of those releases will be made after the
-year 2020 ends, but we keep 2019 in the name so users understand how
+year 2021 ends, but we keep 2021 in the name so users understand how
up to date their version is. Such fixes will also be incorporated into
-the 2021 release series, as appropriate. Around the time the 2022
-release is made, the 2020 series will no longer be maintained.
+the 2022 release series, as appropriate. Around the time the 2023
+release is made, the 2021 series will no longer be maintained.
Where issue numbers are reported in these release notes, more details
can be found on the `issue tracker`_ at that issue number.
-|Gromacs| 2021 series
+|Gromacs| 2022 series
---------------------
.. todolist::
Major release
^^^^^^^^^^^^^
+.. toctree::
+ :maxdepth: 1
+
+ 2022/major/highlights
+ 2022/major/features
+ 2022/major/performance
+ 2022/major/tools
+ 2022/major/bugs-fixed
+ 2022/major/deprecated-functionality
+ 2022/major/removed-functionality
+ 2022/major/portability
+ 2022/major/miscellaneous
+
+
+|Gromacs| 2021 series
+---------------------
+
+Major release
+^^^^^^^^^^^^^
+
.. toctree::
:maxdepth: 1
2021/major/portability
2021/major/miscellaneous
+
+Older (unmaintained) |Gromacs| series
+-------------------------------------------------------
+
|Gromacs| 2020 series
---------------------
2019/major/portability
2019/major/miscellaneous
-Older (unmaintained) |Gromacs| series
--------------------------------------------------------
-
|Gromacs| 2018 series
---------------------
# If building with setuptools, CMake will not be performing the install
set_target_properties(gmxapi_extension_ensemblepotential PROPERTIES BUILD_WITH_INSTALL_RPATH TRUE)
-target_link_libraries(gmxapi_extension_ensemblepotential PRIVATE Gromacs::gmxapi)
+target_link_libraries(gmxapi_extension_ensemblepotential PUBLIC Gromacs::libgromacs Gromacs::gmxapi)
add_executable(gmxapi_extension_library-test test_binding.cpp)
add_dependencies(gmxapi_extension_library-test gmxapi_extension_spc2_water_box)
target_include_directories(gmxapi_extension_library-test PRIVATE ${CMAKE_CURRENT_BINARY_DIR})
-target_link_libraries(gmxapi_extension_library-test Gromacs::gmxapi GTest::Main)
+target_link_libraries(gmxapi_extension_library-test Gromacs::libgromacs Gromacs::gmxapi GTest::Main)
gtest_add_tests(TARGET gmxapi_extension_library-test
TEST_LIST BasicPlugin)
assert os.path.exists(topfile)
if solvate.output.returncode.result() != 0:
- logging.debug(solvate.output.erroroutput.result())
+ logging.debug(solvate.output.stderr.result())
raise RuntimeError('solvate failed in spc_water_box testing fixture.')
# Choose an exactly representable dt of 2^-9 ps (approximately 0.002)
output_files={'-o': tprfile})
tprfilename = grompp.output.file['-o'].result()
if grompp.output.returncode.result() != 0:
- logging.debug(grompp.output.erroroutput.result())
+ logging.debug(grompp.output.stderr.result())
raise RuntimeError('grompp failed in spc_water_box testing fixture.')
# TODO: more inspection of grompp errors...
# Note that this is the gmxapi._gmxapi Python bindings package version,
# not the C++ API version. It is not essential that it match the pure Python
# package version, but is likely to do so.
-project(gmxapi VERSION 0.2.0)
+project(gmxapi VERSION 0.3.0)
# Check if Python package is being built directly or via add_subdirectory
set(GMXAPI_MASTER_PROJECT OFF)
# * provides `output` publishing proxy to the inner function and
# * produce a result with attributes for
# * file: mapping of output flags to output filenames
-# * erroroutput: text results in case of error
+# * stdout: process STDOUT
+# * stderr: porcess STDERR
# * returncode: integer return code of wrapped command
#
# Note that the existence of the 'file' output map is expressed here, but
#
# TODO: Operation returns the output object when called with the shorter signature.
#
-@gmx.function_wrapper(output={'erroroutput': str, 'returncode': int})
+@gmx.function_wrapper(output={'stdout': str,
+ 'stderr': str,
+ 'returncode': int})
def cli(command: NDArray, shell: bool, output: OutputCollectionDescription, stdin: str = ''):
"""Execute a command line program in a subprocess.
>>> my_filename = "somefilename"
>>> result = cli(('exe', '--origin', 1.0, 2.0, 3.0, '-f', my_filename), shell=False)
>>> assert hasattr(result, 'file')
- >>> assert hasattr(result, 'erroroutput')
+ >>> assert hasattr(result, 'stdout')
+ >>> assert hasattr(result, 'stderr')
>>> assert hasattr(result, 'returncode')
Returns:
- A data structure with attributes for each of the results `file`, `erroroutput`, and `returncode`
+ A data structure with attributes for each of the results `file`, `stdout`, `stderr`, and `returncode`
Result object attributes:
* `file`: the mapping of CLI flags to filename strings resulting from the `output` kwarg
- * `erroroutput`: A string of error output (if any) if the process failed.
+ * `stdout`: A string mapping from process STDOUT.
+ * `stderr`: A string mapping from process STDERR; it will be the
+ error output (if any) if the process failed.
* `returncode`: return code of the subprocess.
"""
- # Note: we could make provisions for stdio filehandles in a future version. E.g.
- # * STDOUT is available if a consuming operation is bound to `output.stdout`.
- # * STDERR is available if a consuming operation is bound to `output.stderr`.
- # * Otherwise, STDOUT and/or STDERR is(are) closed when command is called.
-
# In the operation implementation, we expect the `shell` parameter to be intercepted by the
# wrapper and set to False.
if shell:
# TODO: (FR9) Can OS input/output filehandles be a responsibility of
# the code providing 'resources'?
- erroroutput = ''
+ stdout = ''
+ stderr = ''
logger.debug('executing subprocess')
try:
completed_process = subprocess.run(command,
input=stdin,
check=True,
stdout=subprocess.PIPE,
- stderr=subprocess.STDOUT,
+ stderr=subprocess.PIPE,
encoding='utf-8',
universal_newlines=True
)
returncode = completed_process.returncode
# TODO: Resource management code should manage a safe data object for `output`.
- for line in completed_process.stdout.split('\n'):
- logger.debug(line)
+ logger.debug('STDOUT:')
+ if completed_process.stderr is not None:
+ for line in completed_process.stdout.split('\n'):
+ logger.debug(line)
+ else:
+ logger.debug('STDOUT is empty')
+ logger.debug('STDERR:')
+ if completed_process.stderr is not None:
+ for line in completed_process.stderr.split('\n'):
+ logger.debug(line)
+ else:
+ logger.debug('STDERR is empty')
+
+ stdout = completed_process.stdout
+ stderr = completed_process.stderr
+
except subprocess.CalledProcessError as e:
- logger.info("commandline operation had non-zero return status when calling {}".format(e.cmd))
- erroroutput = e.output
+ logger.info("commandline operation had non-zero return status"
+ "when calling {}".format(e.cmd))
+ stdout = e.stdout
+ stderr = e.stderr
returncode = e.returncode
+
# Publish outputs.
- output.erroroutput = erroroutput
+ output.stdout = stdout
+ output.stderr = stderr
output.returncode = returncode
The output node of the resulting operation handle contains
* ``file``: the mapping of CLI flags to filename strings resulting from the ``output_files`` kwarg
- * ``erroroutput``: A string of error output (if any) if the process failed.
+ * ``stdout``: A string mapping from process STDOUT.
+ * ``stderr``: A string mapping from process STDERR; it will be the
+ error output (if any) if the process failed.
* ``returncode``: return code of the subprocess.
"""
#
# TODO: (FR4+) Characterize the `file` dictionary key type:
# explicitly sequences rather than maybe-string/maybe-sequence-of-strings
- @gmx.function_wrapper(output={'erroroutput': str, 'returncode': int, 'file': dict})
- def merged_ops(erroroutput: str = None, returncode: int = None, file: dict = None,
+ @gmx.function_wrapper(output={'stdout': str,
+ 'stderr': str,
+ 'returncode': int,
+ 'file': dict})
+ def merged_ops(stdout: str = None,
+ stderr: str = None,
+ returncode: int = None,
+ file: dict = None,
output: OutputCollectionDescription = None):
- assert erroroutput is not None
+ assert stdout is not None
+ assert stderr is not None
assert returncode is not None
assert file is not None
assert output is not None
output.returncode = returncode
- output.erroroutput = erroroutput
+ output.stdout = stdout
+ output.stderr = stderr
if returncode == 0:
output.file = file
else:
# TODO: ``label`` kwarg
# TODO: input fingerprinting
cli_result = cli(**cli_args)
- merged_result = merged_ops(erroroutput=cli_result.output.erroroutput,
+ merged_result = merged_ops(stdout=cli_result.output.stdout,
+ stderr=cli_result.output.stderr,
returncode=cli_result.output.returncode,
file=output_files,
**kwargs)
# TODO: Version management policy and procedures.
_major = 0
-_minor = 2
+_minor = 3
_micro = 0
_suffix = 'b1'
name='gmxapi',
# TODO: single-source version information (currently repeated in gmxapi/version.py and CMakeLists.txt)
- version='0.2.0b1',
+ version='0.3.0a1',
python_requires='>=3.6',
install_requires=['networkx>=2.0',
'numpy>=1'],
assert os.path.exists(topfile)
if solvate.output.returncode.result() != 0:
- logging.debug(solvate.output.erroroutput.result())
+ logging.debug(solvate.output.stderr.result())
raise RuntimeError('solvate failed in spc_water_box testing fixture.')
# Choose an exactly representable dt of 2^-9 ps (approximately 0.002)
output_files={'-o': tprfile})
tprfilename = grompp.output.file['-o'].result()
if grompp.output.returncode.result() != 0:
- logging.debug(grompp.output.erroroutput.result())
+ logging.debug(grompp.output.stderr.result())
raise RuntimeError('grompp failed in spc_water_box testing fixture.')
# TODO: more inspection of grompp errors...
command = shutil.which('true')
operation = commandline.cli(command=[command], shell=False)
- # Note: 'stdout' and 'stderr' not mapped.
# Note: getitem not implemented.
- # assert not 'stdout' in operation.output
- # assert not 'stderr' in operation.output
- assert not hasattr(operation.output, 'stdout')
- assert not hasattr(operation.output, 'stderr')
-
- # Check for the attributes that we _do_ expect.
- assert hasattr(operation.output, 'erroroutput')
+ # assert 'stdout' in operation.output
+ # assert 'stderr' in operation.output
+ assert hasattr(operation.output, 'stdout')
+ assert hasattr(operation.output, 'stderr')
+ assert not hasattr(operation.output, 'erroroutput')
assert hasattr(operation.output, 'returncode')
operation.run()
def test_true(self):
operation = commandline.commandline_operation(executable='true')
- # Note: 'stdout' and 'stderr' not mapped.
# Note: getitem not implemented.
- # assert not 'stdout' in operation.output
- # assert not 'stderr' in operation.output
- assert not hasattr(operation.output, 'stdout')
- assert not hasattr(operation.output, 'stderr')
+ # assert 'stdout' in operation.output
+ # assert 'stderr' in operation.output
+ assert not hasattr(operation.output, 'erroroutput')
assert hasattr(operation.output, 'file')
- assert hasattr(operation.output, 'erroroutput')
+ assert hasattr(operation.output, 'stdout')
+ assert hasattr(operation.output, 'stderr')
assert hasattr(operation.output, 'returncode')
assert operation.output.returncode.result() == 0
assert operation.output.returncode.result() == 1
def test_echo(self):
- # TODO: (FR5+) do we want to pipeline or checkpoint stdout somehow?
+ # TODO: (#3549) Check stdout, stderr.
operation = commandline.commandline_operation(executable='echo',
arguments=['hi there'])
assert operation.output.returncode.result() == 0
# This should be removable once object libraries can directly use target_link_libraries
# with CMake 3.12, #3290
target_include_directories(template SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
-target_link_libraries(template libgromacs ${GMX_EXE_LINKER_FLAGS})
+target_link_libraries(template libgromacs legacy_modules ${GMX_EXE_LINKER_FLAGS})
set(DOCUMENTATION_HTTP_URL_BASE
http://jenkins.gromacs.org/job/Documentation_Nightly_master/javadoc)
# CMAKE_BUILD_TYPE is #included into buildinfo.h and populates the
# fields e.g. printed to the log file.
file(GENERATE
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/compilerflaginfo-$<CONFIG>-$<COMPILE_LANGUAGE>.h
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/compilerflaginfo-$<CONFIG>-$<COMPILE_LANGUAGE>.h
INPUT ${CMAKE_CURRENT_SOURCE_DIR}/compilerflaginfo.h.cmakein
CONDITION $<CONFIG:${CMAKE_BUILD_TYPE}>
)
mark_as_advanced(CLANG_TIDY_EXE)
endif()
+# Create a basic target for the `src` section of the build tree to capture
+# the library-level shared details through CMake infrastructure. It is not
+# installed or exported, so it must only be used as a PRIVATE dependency by
+# installed targets.
+# Initially, this is just an INTERFACE target to provide include directory.
+# It should also absorb global variables and compiler/linker details to be
+# provided as transitive usage requirements.
+# It could expand to aggregate the module targets in the future.
+add_library(common INTERFACE)
+target_include_directories(common INTERFACE
+ ${CMAKE_CURRENT_SOURCE_DIR}/include
+ ${CMAKE_CURRENT_BINARY_DIR}/include)
+
add_subdirectory(external)
if (BUILD_TESTING)
# header file in both of the make stages. That's slow, and is useless
# busy work for ccache, too.
string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER)
-configure_file(config.h.cmakein config.h)
-configure_file(gmxpre-config.h.cmakein gmxpre-config.h)
+configure_file(config.h.cmakein include/config.h)
+configure_file(gmxpre-config.h.cmakein include/gmxpre-config.h)
set(CMAKE_BUILD_CONFIGURATION_C_FLAGS ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}})
set(CMAKE_BUILD_CONFIGURATION_CXX_FLAGS ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER}})
-configure_file(buildinfo.h.cmakein buildinfo.h ESCAPE_QUOTES)
+configure_file(buildinfo.h.cmakein include/buildinfo.h ESCAPE_QUOTES)
endif()
list(APPEND libgromacs_object_library_dependencies thread_mpi)
-configure_file(version.h.cmakein version.h)
if(GMX_INSTALL_LEGACY_API)
install(FILES
- ${CMAKE_CURRENT_BINARY_DIR}/version.h
analysisdata.h
options.h
selection.h
else()
add_library(libgromacs ${LIBGROMACS_SOURCES})
endif()
+target_link_libraries(libgromacs PRIVATE $<BUILD_INTERFACE:common>)
+# As long as the libgromacs target has source files that reference headers from
+# modules that don't provide CMake targets, libgromacs needs to use `src/`
+# amongst its include directories (to support `#include "gromacs/module/header.h"`).
+add_library(legacy_modules INTERFACE)
+target_include_directories(legacy_modules INTERFACE $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>)
+target_link_libraries(libgromacs PRIVATE $<BUILD_INTERFACE:legacy_modules>)
# Add these contents first because linking their tests can take a lot
# of time, so we want lots of parallel work still available after
set_target_properties(${object_library} PROPERTIES POSITION_INDEPENDENT_CODE true)
endif()
target_include_directories(${object_library} SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
+ target_link_libraries(${object_library} PRIVATE common)
# Add the sources from the object libraries to the main library.
target_sources(libgromacs PRIVATE $<TARGET_OBJECTS:${object_library}>)
PUBLIC
${GMX_PUBLIC_LIBRARIES}
)
+target_link_libraries(libgromacs PUBLIC legacy_api)
+# Dependencies from libgromacs to the modules are set up here, but
+# once the add_subdirectory() commands are re-ordered then
+# responsibility for setting this up will move to the respective
+# modules.
+target_link_libraries(libgromacs PRIVATE
+ $<BUILD_INTERFACE:analysisdata>
+ $<BUILD_INTERFACE:applied_forces>
+ $<BUILD_INTERFACE:commandline>
+ $<BUILD_INTERFACE:compat>
+ $<BUILD_INTERFACE:coordinateio>
+ $<BUILD_INTERFACE:correlationfunctions>
+ $<BUILD_INTERFACE:domdec>
+# $<BUILD_INTERFACE:energyanalysis>
+ $<BUILD_INTERFACE:essentialdynamics>
+ $<BUILD_INTERFACE:ewald>
+ $<BUILD_INTERFACE:fft>
+ $<BUILD_INTERFACE:fileio>
+ $<BUILD_INTERFACE:gmxana>
+ $<BUILD_INTERFACE:gmxlib>
+ $<BUILD_INTERFACE:gmxpreprocess>
+ $<BUILD_INTERFACE:gpu_utils>
+ $<BUILD_INTERFACE:hardware>
+ $<BUILD_INTERFACE:imd>
+ $<BUILD_INTERFACE:linearalgebra>
+ $<BUILD_INTERFACE:listed_forces>
+ $<BUILD_INTERFACE:math>
+ $<BUILD_INTERFACE:mdlib>
+ $<BUILD_INTERFACE:mdrun>
+ $<BUILD_INTERFACE:mdrunutility>
+ $<BUILD_INTERFACE:mdspan>
+ $<BUILD_INTERFACE:mdtypes>
+ $<BUILD_INTERFACE:mimic>
+ $<BUILD_INTERFACE:modularsimulator>
+ $<BUILD_INTERFACE:nbnxm>
+ $<BUILD_INTERFACE:onlinehelp>
+ $<BUILD_INTERFACE:options>
+ $<BUILD_INTERFACE:pbcutil>
+ $<BUILD_INTERFACE:pulling>
+ $<BUILD_INTERFACE:random>
+ $<BUILD_INTERFACE:restraint>
+ $<BUILD_INTERFACE:selection>
+ $<BUILD_INTERFACE:simd>
+ $<BUILD_INTERFACE:statistics>
+ $<BUILD_INTERFACE:swap>
+ $<BUILD_INTERFACE:tables>
+ $<BUILD_INTERFACE:taskassignment>
+ $<BUILD_INTERFACE:timing>
+ $<BUILD_INTERFACE:tools>
+ $<BUILD_INTERFACE:topology>
+ $<BUILD_INTERFACE:trajectory>
+ $<BUILD_INTERFACE:trajectoryanalysis>
+ $<BUILD_INTERFACE:utility>
+ )
if (GMX_OPENMP)
target_link_libraries(libgromacs PUBLIC OpenMP::OpenMP_CXX)
endif()
# Only install the library in mdrun-only mode if it is actually necessary
# for the binary
+# TODO: Stop installing libgromacs. Possibly allow installation during deprecation period with GMX_INSTALL_LEGACY_API.
if (NOT GMX_BUILD_MDRUN_ONLY OR BUILD_SHARED_LIBS)
install(TARGETS libgromacs
EXPORT libgromacs
if(GMX_INSTALL_LEGACY_API)
target_compile_features(libgromacs INTERFACE cxx_std_${CMAKE_CXX_STANDARD})
endif()
- add_library(Gromacs::libgromacs ALIAS libgromacs)
endif()
+add_library(Gromacs::libgromacs ALIAS libgromacs)
if (NOT GMX_BUILD_MDRUN_ONLY)
include(InstallLibInfo.cmake)
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(analysisdata INTERFACE)
file(GLOB ANALYSISDATA_SOURCES *.cpp modules/*.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${ANALYSISDATA_SOURCES} PARENT_SCOPE)
DESTINATION include/gromacs/analysisdata)
endif()
+# Source files have the following private module dependencies.
+target_link_libraries(analysisdata PRIVATE
+# gmxlib
+# math
+# mdtypes
+# tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(analysisdata PUBLIC
+target_include_directories(analysisdata INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(analysisdata PUBLIC
+target_link_libraries(analysisdata INTERFACE
+ legacy_api
+ )
+
+# TODO: when analysisdata is an OBJECT target
+#target_link_libraries(analysisdata PUBLIC legacy_api)
+#target_link_libraries(analysisdata PRIVATE common)
+
+# Module dependencies
+# analysisdata interfaces convey transitive dependence on these modules.
+#target_link_libraries(analysisdata PUBLIC
+target_link_libraries(analysisdata INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(analysisdata PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(analysisdata PRIVATE legacy_modules)
add_subdirectory(modules)
gmx_add_unit_test_library(analysisdata-test-shared
datatest.cpp
mock_datamodule.cpp)
+target_link_libraries(analysisdata-test-shared PRIVATE legacy_api)
gmx_add_unit_test(AnalysisDataUnitTests analysisdata-test
CPP_SOURCE_FILES
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(applied_forces INTERFACE)
+
+# Source files have the following private module dependencies.
+target_link_libraries(applied_forces PRIVATE
+ # gmxlib
+ # math
+ # mdtypes
+ # tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(applied_forces PUBLIC
+target_include_directories(applied_forces INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(applied_forces PUBLIC
+target_link_libraries(applied_forces INTERFACE
+ legacy_api
+ )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(applied_forces PUBLIC legacy_api)
+#target_link_libraries(applied_forces PRIVATE common)
+
+# Module dependencies
+# This module convey transitive dependence on these modules.
+#target_link_libraries(applied_forces PUBLIC
+target_link_libraries(applied_forces INTERFACE
+ # utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(applied_forces PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(applied_forces PRIVATE legacy_modules)
+
gmx_add_libgromacs_sources(
electricfield.cpp
)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014,2015,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2019,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(commandline INTERFACE)
file(GLOB COMMANDLINE_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${COMMANDLINE_SOURCES} PARENT_SCOPE)
+# Source files have the following private module dependencies.
+target_link_libraries(commandline PRIVATE
+# gmxlib
+# math
+# mdtypes
+# tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(commandline PUBLIC
+target_include_directories(commandline INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(commandline PUBLIC
+target_link_libraries(commandline INTERFACE
+ legacy_api
+ )
+
+# TODO: when commandline is an OBJECT target
+#target_link_libraries(commandline PUBLIC legacy_api)
+#target_link_libraries(commandline PRIVATE common)
+
+# Module dependencies
+# commandline interfaces convey transitive dependence on these modules.
+#target_link_libraries(commandline PUBLIC
+target_link_libraries(commandline INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(commandline PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(commandline PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2018,2019,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(compat INTERFACE)
+
+# Source files have the following private module dependencies.
+target_link_libraries(compat PRIVATE
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(compat PUBLIC
+target_include_directories(compat INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(compat PUBLIC
+target_link_libraries(compat INTERFACE
+ legacy_api
+ )
+
+# TODO: when compat is an OBJECT target
+#target_link_libraries(compat PUBLIC legacy_api)
+#target_link_libraries(compat PRIVATE common)
+
+# Module dependencies
+# compat interfaces convey transitive dependence on these modules.
+#target_link_libraries(compat PUBLIC
+target_link_libraries(compat INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(compat PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(compat PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(coordinateio INTERFACE)
file(GLOB COORDINATEIO_SOURCES *.cpp outputadapters/*.cpp)
-
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${COORDINATEIO_SOURCES} PARENT_SCOPE)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(coordinateio PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(coordinateio PUBLIC
+target_include_directories(coordinateio INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(coordinateio PUBLIC
+target_link_libraries(coordinateio INTERFACE
+ legacy_api
+ )
+
+# TODO: when coordinateio is an OBJECT target
+#target_link_libraries(coordinateio PUBLIC legacy_api)
+#target_link_libraries(coordinateio PRIVATE common)
+
+# Module dependencies
+# coordinateio interfaces convey transitive dependence on these modules.
+#target_link_libraries(coordinateio PUBLIC
+target_link_libraries(coordinateio INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(coordinateio PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(coordinateio PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(correlationfunctions INTERFACE)
+
file(GLOB GMXCORRFUNC_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${GMXCORRFUNC_SOURCES} PARENT_SCOPE)
+
+# Source files have the following private module dependencies.
+target_link_libraries(correlationfunctions PRIVATE
+ # gmxlib
+ # math
+ # mdtypes
+ # tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(correlationfunctions PUBLIC
+target_include_directories(correlationfunctions INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(correlationfunctions PUBLIC
+target_link_libraries(correlationfunctions INTERFACE
+ legacy_api
+ )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(correlationfunctions PUBLIC legacy_api)
+#target_link_libraries(correlationfunctions PRIVATE common)
+
+# Module dependencies
+# This module convey transitive dependence on these modules.
+#target_link_libraries(correlationfunctions PUBLIC
+target_link_libraries(correlationfunctions INTERFACE
+ # utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(correlationfunctions PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(correlationfunctions PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(domdec INTERFACE)
file(GLOB DOMDEC_SOURCES *.cpp)
if(GMX_GPU_CUDA)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${DOMDEC_SOURCES} ${DOMDEC_CUDA_SOURCES} PARENT_SCOPE)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(domdec PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(domdec PUBLIC
+target_include_directories(domdec INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(domdec PUBLIC
+target_link_libraries(domdec INTERFACE
+ legacy_api
+ )
+
+# TODO: when domdec is an OBJECT target
+#target_link_libraries(domdec PUBLIC legacy_api)
+#target_link_libraries(domdec PRIVATE common)
+
+# Module dependencies
+# domdec interfaces convey transitive dependence on these modules.
+#target_link_libraries(domdec PUBLIC
+target_link_libraries(domdec INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(domdec PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(domdec PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(essentialdynamics INTERFACE)
+
file(GLOB ESSENTIALDYNAMICS_SOURCES *.cpp)
+
+# Source files have the following private module dependencies.
+target_link_libraries(essentialdynamics PRIVATE
+ # gmxlib
+ # math
+ # mdtypes
+ # tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(essentialdynamics PUBLIC
+target_include_directories(essentialdynamics INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(essentialdynamics PUBLIC
+target_link_libraries(essentialdynamics INTERFACE
+ legacy_api
+ )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(fileio PUBLIC legacy_api)
+#target_link_libraries(fileio PRIVATE common)
+
+# Module dependencies
+# fileio interfaces convey transitive dependence on these modules.
+#target_link_libraries(essentialdynamics PUBLIC
+target_link_libraries(essentialdynamics INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(essentialdynamics PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(essentialdynamics PRIVATE legacy_modules)
+
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${ESSENTIALDYNAMICS_SOURCES} PARENT_SCOPE)
if (BUILD_TESTING)
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(ewald INTERFACE)
gmx_add_libgromacs_sources(
calculate_spline_moduli.cpp
ewald.cpp
)
endif()
+# Source files have the following private module dependencies.
+target_link_libraries(ewald PRIVATE
+ # gmxlib
+ # math
+ # mdtypes
+ # tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(ewald PUBLIC
+target_include_directories(ewald INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(ewald PUBLIC
+target_link_libraries(ewald INTERFACE
+ legacy_api
+ )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(ewald PUBLIC legacy_api)
+#target_link_libraries(ewald PRIVATE common)
+
+# Module dependencies
+# This module convey transitive dependence on these modules.
+#target_link_libraries(ewald PUBLIC
+target_link_libraries(ewald INTERFACE
+ # utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(ewald PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(ewald PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2013,2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2018,2019,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(fft INTERFACE)
+
gmx_add_libgromacs_sources(
calcgrid.cpp
fft.cpp
gmx_add_libgromacs_sources(fft_mkl.cpp)
endif()
+# Source files have the following private module dependencies.
+target_link_libraries(fft PRIVATE
+ # gmxlib
+ # math
+ # mdtypes
+ # tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(fft PUBLIC
+target_include_directories(fft INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(fft PUBLIC
+target_link_libraries(fft INTERFACE
+ legacy_api
+ )
+
+# TODO: when fft is an OBJECT target
+#target_link_libraries(fft PUBLIC legacy_api)
+#target_link_libraries(fft PRIVATE common)
+
+# Module dependencies
+# This module convey transitive dependence on these modules.
+#target_link_libraries(fft PUBLIC
+target_link_libraries(fft INTERFACE
+ # utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(fft PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(fft PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
*/
/* Small grid size array */
-#define g_initNR 15
-const int grid_init[g_initNR] = { 6, 8, 10, 12, 14, 16, 20, 24, 25, 28, 32, 36, 40, 42, 44 };
+constexpr int g_initNR = 15;
+constexpr int grid_init[g_initNR] = { 6, 8, 10, 12, 14, 16, 20, 24, 25, 28, 32, 36, 40, 42, 44 };
/* For larger grid sizes, a prefactor with any power of 2 can be added.
* Only sizes divisible by 4 should be used, 90 is allowed, 140 not.
*/
-#define g_baseNR 14
-const int grid_base[g_baseNR] = { 45, 48, 50, 52, 54, 56, 60, 64, 70, 72, 75, 80, 81, 84 };
+constexpr int g_baseNR = 14;
+constexpr int grid_base[g_baseNR] = { 45, 48, 50, 52, 54, 56, 60, 64, 70, 72, 75, 80, 81, 84 };
real calcFftGrid(FILE* fp, const matrix box, real gridSpacing, int minGridPointsPerDim, int* nx, int* ny, int* nz)
{
gmx_fatal(FARGS, "invalid fourier grid spacing: %g", gridSpacing);
}
- if (grid_base[g_baseNR - 1] % 4 != 0)
- {
- gmx_incons("the last entry in grid_base is not a multiple of 4");
- }
+ static_assert(grid_base[g_baseNR - 1] % 4 == 0,
+ "the last entry in grid_base is not a multiple of 4");
/* New grid calculation setup:
*
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(fileio INTERFACE)
file(GLOB FILEIO_SOURCES *.cpp)
if(GMX_USE_PLUGINS)
list(FILTER FILEIO_SOURCES EXCLUDE REGEX ".*vmdio.cpp$")
endif()
-target_sources(libgromacs PRIVATE ${FILEIO_SOURCES})
+# Source files have the following private module dependencies.
+target_link_libraries(fileio PRIVATE
+# gmxlib
+# math
+# mdtypes
+# tng_io
+ )
-if(GMX_INSTALL_LEGACY_API)
- install(FILES
- oenv.h
- confio.h
- pdbio.h
- tpxio.h
- trxio.h
- filetypes.h
- DESTINATION include/gromacs/fileio)
-endif()
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(fileio PUBLIC
+target_include_directories(fileio INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(fileio PUBLIC
+target_link_libraries(fileio INTERFACE
+ legacy_api
+ )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(fileio PUBLIC legacy_api)
+#target_link_libraries(fileio PRIVATE common)
+
+# Module dependencies
+# fileio interfaces convey transitive dependence on these modules.
+#target_link_libraries(fileio PUBLIC
+target_link_libraries(fileio INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(fileio PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(fileio PRIVATE legacy_modules)
+
+target_sources(libgromacs PRIVATE ${FILEIO_SOURCES})
if (BUILD_TESTING)
add_subdirectory(tests)
*/
#include "gmxpre.h"
-#include "confio.h"
+#include "gromacs/fileio/confio.h"
#include <cstdio>
#include <cstring>
*/
#include "gmxpre.h"
-#include "filetypes.h"
+#include "gromacs/fileio/filetypes.h"
#include <cstring>
*/
#include "gmxpre.h"
-#include "oenv.h"
+#include "gromacs/fileio/oenv.h"
#include "gromacs/utility/enumerationhelpers.h"
#include "gromacs/utility/exceptions.h"
*/
#include "gmxpre.h"
-#include "pdbio.h"
+#include "gromacs/fileio/pdbio.h"
#include <cctype>
#include <cmath>
${tng_sources}
xvgio.cpp
)
+target_link_libraries(fileio-test PRIVATE legacy_api)
/* This file is completely threadsafe - keep it that way! */
-#include "tpxio.h"
+#include "gromacs/fileio/tpxio.h"
#include <cstdio>
#include <cstdlib>
*/
#include "gmxpre.h"
-#include "trxio.h"
+#include "gromacs/fileio/trxio.h"
#include "config.h"
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2013,2014,2015,2017,2019, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2017,2019,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(gmxana INTERFACE)
+
file(GLOB GMXANA_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${GMXANA_SOURCES} PARENT_SCOPE)
+# Source files have the following private module dependencies.
+target_link_libraries(gmxana PRIVATE
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(gmxana PUBLIC
+target_include_directories(gmxana INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(gmxana PUBLIC
+target_link_libraries(gmxana INTERFACE
+ legacy_api
+ )
+
+# TODO: when gmxana is an OBJECT target
+#target_link_libraries(gmxana PUBLIC legacy_api)
+#target_link_libraries(gmxana PRIVATE common)
+
+# Module dependencies
+# gmxana interfaces convey transitive dependence on these modules.
+#target_link_libraries(gmxana PUBLIC
+target_link_libraries(gmxana INTERFACE
+ utility
+ )
+
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(gmxlib INTERFACE)
+
add_subdirectory(nonbonded)
# The nonbonded directory contains subdirectories that are only
set(GMXLIB_SOURCES ${GMXLIB_SOURCES} ${NONBONDED_SOURCES} PARENT_SCOPE)
+# Source files have the following private module dependencies.
+target_link_libraries(gmxlib PRIVATE
+ # gmxlib
+ # math
+ # mdtypes
+ # tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(gmxlib PUBLIC
+target_include_directories(gmxlib INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(gmxlib PUBLIC
+target_link_libraries(gmxlib INTERFACE
+ legacy_api
+ )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(gmxlib PUBLIC legacy_api)
+#target_link_libraries(gmxlib PRIVATE common)
+
+# Module dependencies
+# fileio interfaces convey transitive dependence on these modules.
+#target_link_libraries(gmxlib PUBLIC
+target_link_libraries(gmxlib INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(gmxlib PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(gmxlib PRIVATE legacy_modules)
+
# if(BUILD_TESTING)
# add_subdirectory(tests)
# endif()
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2011,2013,2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2011,2013,2014,2015,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(gmxpreprocess INTERFACE)
+
file(GLOB GMXPREPROCESS_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${GMXPREPROCESS_SOURCES} PARENT_SCOPE)
+# Source files have the following private module dependencies.
+target_link_libraries(gmxpreprocess PRIVATE
+ # gmxlib
+ # math
+ # mdtypes
+ # tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(gmxpreprocess PUBLIC
+target_include_directories(gmxpreprocess INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(gmxpreprocess PUBLIC
+target_link_libraries(gmxpreprocess INTERFACE
+ legacy_api
+ )
+
+# TODO: when is an OBJECT target
+#target_link_libraries(gmxpreprocess PUBLIC legacy_api)
+#target_link_libraries(gmxpreprocess PRIVATE common)
+
+# Module dependencies
+# This module convey transitive dependence on these modules.
+#target_link_libraries(gmxpreprocess PUBLIC
+target_link_libraries(gmxpreprocess INTERFACE
+ # utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(gmxpreprocess PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(gmxpreprocess PRIVATE legacy_modules)
+
if(BUILD_TESTING)
add_subdirectory(tests)
endif()
}
}
-static void checkMtsRequirement(const t_inputrec& ir, const char* param, const int nstValue, warninp_t wi)
-{
- GMX_RELEASE_ASSERT(ir.mtsLevels.size() >= 2, "Need at least two levels for MTS");
- const int mtsFactor = ir.mtsLevels.back().stepFactor;
- if (nstValue % mtsFactor != 0)
- {
- auto message = gmx::formatString(
- "With MTS, %s = %d should be a multiple of mts-factor = %d", param, nstValue, mtsFactor);
- warning_error(wi, message.c_str());
- }
-}
-
-static void setupMtsLevels(gmx::ArrayRef<gmx::MtsLevel> mtsLevels,
- const t_inputrec& ir,
- const t_gromppopts& opts,
- warninp_t wi)
-{
- /* MD-VV has no MTS support yet.
- * SD1 needs different scaling coefficients for the different MTS forces
- * and the different forces are currently not available in ForceBuffers.
- */
- if (ir.eI != eiMD)
- {
- auto message = gmx::formatString(
- "Multiple time stepping is only supported with integrator %s", ei_names[eiMD]);
- warning_error(wi, message.c_str());
- }
- if (opts.numMtsLevels != 2)
- {
- warning_error(wi, "Only mts-levels = 2 is supported");
- }
- else
- {
- const std::vector<std::string> inputForceGroups = gmx::splitString(opts.mtsLevel2Forces);
- auto& forceGroups = mtsLevels[1].forceGroups;
- for (const auto& inputForceGroup : inputForceGroups)
- {
- bool found = false;
- int nameIndex = 0;
- for (const auto& forceGroupName : gmx::mtsForceGroupNames)
- {
- if (gmx::equalCaseInsensitive(inputForceGroup, forceGroupName))
- {
- forceGroups.set(nameIndex);
- found = true;
- }
- nameIndex++;
- }
- if (!found)
- {
- auto message =
- gmx::formatString("Unknown MTS force group '%s'", inputForceGroup.c_str());
- warning_error(wi, message.c_str());
- }
- }
-
- if (mtsLevels[1].stepFactor <= 1)
- {
- gmx_fatal(FARGS, "mts-factor should be larger than 1");
- }
-
- // Make the level 0 use the complement of the force groups of group 1
- mtsLevels[0].forceGroups = ~mtsLevels[1].forceGroups;
- mtsLevels[0].stepFactor = 1;
-
- if ((EEL_FULL(ir.coulombtype) || EVDW_PME(ir.vdwtype))
- && !mtsLevels[1].forceGroups[static_cast<int>(gmx::MtsForceGroups::LongrangeNonbonded)])
- {
- warning_error(wi,
- "With long-range electrostatics and/or LJ treatment, the long-range part "
- "has to be part of the mts-level2-forces");
- }
-
- if (ir.nstcalcenergy > 0)
- {
- checkMtsRequirement(ir, "nstcalcenergy", ir.nstcalcenergy, wi);
- }
- checkMtsRequirement(ir, "nstenergy", ir.nstenergy, wi);
- checkMtsRequirement(ir, "nstlog", ir.nstlog, wi);
- if (ir.efep != efepNO)
- {
- checkMtsRequirement(ir, "nstdhdl", ir.fepvals->nstdhdl, wi);
- }
-
- if (ir.bPull)
- {
- const int pullMtsLevel = gmx::forceGroupMtsLevel(ir.mtsLevels, gmx::MtsForceGroups::Pull);
- if (ir.pull->nstxout % ir.mtsLevels[pullMtsLevel].stepFactor != 0)
- {
- warning_error(wi, "pull-nstxout should be a multiple of mts-factor");
- }
- if (ir.pull->nstfout % ir.mtsLevels[pullMtsLevel].stepFactor != 0)
- {
- warning_error(wi, "pull-nstfout should be a multiple of mts-factor");
- }
- }
- }
-}
-
void check_ir(const char* mdparin,
const gmx::MdModulesNotifier& mdModulesNotifier,
t_inputrec* ir,
set_warning_line(wi, mdparin, -1);
+ /* We cannot check MTS requirements with an invalid MTS setup
+ * and we will already have generated errors with an invalid MTS setup.
+ */
+ if (gmx::haveValidMtsSetup(*ir))
+ {
+ std::vector<std::string> errorMessages = gmx::checkMtsRequirements(*ir);
+
+ for (const auto& errorMessage : errorMessages)
+ {
+ warning_error(wi, errorMessage.c_str());
+ }
+ }
+
if (ir->coulombtype == eelRF_NEC_UNSUPPORTED)
{
sprintf(warn_buf, "%s electrostatics is no longer supported", eel_names[eelRF_NEC_UNSUPPORTED]);
ir->useMts = (get_eeenum(&inp, "mts", yesno_names, wi) != 0);
if (ir->useMts)
{
- opts->numMtsLevels = get_eint(&inp, "mts-levels", 2, wi);
+ gmx::GromppMtsOpts& mtsOpts = opts->mtsOpts;
+ mtsOpts.numLevels = get_eint(&inp, "mts-levels", 2, wi);
ir->mtsLevels.resize(2);
- gmx::MtsLevel& mtsLevel = ir->mtsLevels[1];
- opts->mtsLevel2Forces = setStringEntry(&inp, "mts-level2-forces",
- "longrange-nonbonded nonbonded pair dihedral");
- mtsLevel.stepFactor = get_eint(&inp, "mts-level2-factor", 2, wi);
+ mtsOpts.level2Forces = setStringEntry(&inp, "mts-level2-forces",
+ "longrange-nonbonded nonbonded pair dihedral");
+ mtsOpts.level2Factor = get_eint(&inp, "mts-level2-factor", 2, wi);
// We clear after reading without dynamics to not force the user to remove MTS mdp options
if (!EI_DYNAMICS(ir->eI))
{
ir->useMts = false;
- ir->mtsLevels.clear();
}
}
printStringNoNewline(&inp, "mode for center of mass motion removal");
/* Set up MTS levels, this needs to happen before checking AWH parameters */
if (ir->useMts)
{
- setupMtsLevels(ir->mtsLevels, *ir, *opts, wi);
+ std::vector<std::string> errorMessages;
+ ir->mtsLevels = gmx::setupMtsLevels(opts->mtsOpts, &errorMessages);
+
+ for (const auto& errorMessage : errorMessages)
+ {
+ warning_error(wi, errorMessage.c_str());
+ }
}
if (ir->bDoAwh)
void triple_check(const char* mdparin, t_inputrec* ir, gmx_mtop_t* sys, warninp_t wi)
{
// Not meeting MTS requirements should have resulted in a fatal error, so we can assert here
- gmx::assertMtsRequirements(*ir);
+ GMX_ASSERT(gmx::checkMtsRequirements(*ir).empty(), "All MTS requirements should be met here");
char err_buf[STRLEN];
int i, m, c, nmol;
#include "gromacs/fileio/readinp.h"
#include "gromacs/math/vectypes.h"
+#include "gromacs/mdtypes/multipletimestepping.h"
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/real.h"
struct t_gromppopts
{
- int warnings = 0;
- int nshake = 0;
- char* include = nullptr;
- char* define = nullptr;
- bool bGenVel = false;
- bool bGenPairs = false;
- real tempi = 0;
- int seed = 0;
- int numMtsLevels = 0;
- std::string mtsLevel2Forces;
- bool bOrire = false;
- bool bMorse = false;
- char* wall_atomtype[2] = { nullptr, nullptr };
- char* couple_moltype = nullptr;
- int couple_lam0 = 0;
- int couple_lam1 = 0;
- bool bCoupleIntra = false;
+ int warnings = 0;
+ int nshake = 0;
+ char* include = nullptr;
+ char* define = nullptr;
+ bool bGenVel = false;
+ bool bGenPairs = false;
+ real tempi = 0;
+ int seed = 0;
+ gmx::GromppMtsOpts mtsOpts;
+ bool bOrire = false;
+ bool bMorse = false;
+ char* wall_atomtype[2] = { nullptr, nullptr };
+ char* couple_moltype = nullptr;
+ int couple_lam0 = 0;
+ int couple_lam1 = 0;
+ bool bCoupleIntra = false;
};
/*! \brief Initialise object to hold strings parsed from an .mdp file */
# the incidence of textual clashes when adding/moving files that
# otherwise make the end of the list a hotspot.
+add_library(gpu_utils INTERFACE)
+
gmx_add_libgromacs_sources(
clfftinitializer.cpp
device_stream_manager.cpp
)
endif()
+# Source files have the following private module dependencies.
+target_link_libraries(gpu_utils PRIVATE
+# gmxlib
+# math
+# mdtypes
+# tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(gpu_utils PUBLIC
+target_include_directories(gpu_utils INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(gpu_utils PUBLIC
+target_link_libraries(gpu_utils INTERFACE
+ legacy_api
+ )
+
+# TODO: when gpu_utils is an OBJECT target
+#target_link_libraries(gpu_utils PUBLIC legacy_api)
+#target_link_libraries(gpu_utils PRIVATE common)
+
+# Module dependencies
+# gpu_utils interfaces convey transitive dependence on these modules.
+#target_link_libraries(gpu_utils PUBLIC
+target_link_libraries(gpu_utils INTERFACE
+# utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(gpu_utils PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(gpu_utils PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(hardware INTERFACE)
gmx_add_libgromacs_sources(
cpuinfo.cpp
detecthardware.cpp
)
endif()
+# Source files have the following private module dependencies.
+target_link_libraries(hardware PRIVATE
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(hardware PUBLIC
+target_include_directories(hardware INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(hardware PUBLIC
+target_link_libraries(hardware INTERFACE
+ legacy_api
+ )
+
+# TODO: when hardware is an OBJECT target
+#target_link_libraries(hardware PUBLIC legacy_api)
+#target_link_libraries(hardware PRIVATE common)
+
+# Module dependencies
+# hardware interfaces convey transitive dependence on these modules.
+#target_link_libraries(hardware PUBLIC
+target_link_libraries(hardware INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(hardware PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(hardware PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
bool cpuIsX86Nehalem(const CpuInfo& cpuInfo)
{
- return (cpuInfo.vendor() == gmx::CpuInfo::Vendor::Intel && cpuInfo.family() == 6
+ return (cpuInfo.vendor() == CpuInfo::Vendor::Intel && cpuInfo.family() == 6
&& (cpuInfo.model() == 0x2E || cpuInfo.model() == 0x1A || cpuInfo.model() == 0x1E
|| cpuInfo.model() == 0x2F || cpuInfo.model() == 0x2C || cpuInfo.model() == 0x25));
}
+bool cpuIsAmdZen1(const CpuInfo& cpuInfo)
+{
+ /* Both Zen/Zen+/Zen2 have family==23
+ * Model numbers for Zen:
+ * 1) Naples, Whitehaven, Summit Ridge, and Snowy Owl;
+ * 17) Raven Ridge.
+ * Model numbers for Zen+:
+ * 8) Pinnacle Ridge;
+ * 24) Picasso.
+ * Hygon got license for Zen1, but not Zen2 (https://www.tomshardware.com/news/amd-zen-china-x86-ip-license,39573.html)
+ */
+ return (cpuInfo.vendor() == CpuInfo::Vendor::Amd && cpuInfo.family() == 23
+ && (cpuInfo.model() == 1 || cpuInfo.model() == 17 || cpuInfo.model() == 8
+ || cpuInfo.model() == 24))
+ || (cpuInfo.vendor() == CpuInfo::Vendor::Hygon);
+}
+
} // namespace gmx
#ifdef GMX_CPUINFO_STANDALONE
*/
bool cpuIsX86Nehalem(const CpuInfo& cpuInfo);
+/*! \brief Return true if the CPU is a first generation AMD Zen (produced by AMD or Hygon)
+ *
+ * \param cpuInfo Object with cpu information
+ *
+ * \returns True if running on a first generation AMD Zen
+ */
+bool cpuIsAmdZen1(const CpuInfo& cpuInfo);
+
} // namespace gmx
#endif // GMX_HARDWARE_CPUINFO_H
* - family=23 with the below listed models;
* - Hygon as vendor.
*/
- const bool cpuIsAmdZen1 = ((cpuInfo.vendor() == CpuInfo::Vendor::Amd && cpuInfo.family() == 23
- && (cpuInfo.model() == 1 || cpuInfo.model() == 17
- || cpuInfo.model() == 8 || cpuInfo.model() == 24))
- || cpuInfo.vendor() == CpuInfo::Vendor::Hygon);
+ const bool cpuIsAmdZen1 = gmx::cpuIsAmdZen1(cpuInfo);
int numCompatibleDevices = getCompatibleDevices(hardwareInfo->deviceInfoList).size();
#if GMX_LIB_MPI
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(imd INTERFACE)
file(GLOB IMD_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${IMD_SOURCES} PARENT_SCOPE)
+
+# Source files have the following private module dependencies.
+target_link_libraries(imd PRIVATE
+# gmxlib
+# math
+# mdtypes
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(imd PUBLIC
+target_include_directories(imd INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(imd PUBLIC
+target_link_libraries(imd INTERFACE
+ legacy_api
+ )
+
+# TODO: when imd is an OBJECT target
+#target_link_libraries(imd PUBLIC legacy_api)
+#target_link_libraries(imd PRIVATE common)
+
+# Module dependencies
+# imd interfaces convey transitive dependence on these modules.
+#target_link_libraries(imd PUBLIC
+target_link_libraries(imd INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(imd PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(imd PRIVATE legacy_modules)
${LINEARALGEBRA_SOURCES} ${BLAS_SOURCES} ${LAPACK_SOURCES})
add_library(linearalgebra OBJECT ${LINEARALGEBRA_SOURCES})
+# TODO: Only expose the module's public headers.
+target_include_directories(linearalgebra INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+target_include_directories(linearalgebra PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+
gmx_target_compile_options(linearalgebra)
target_compile_definitions(linearalgebra PRIVATE HAVE_CONFIG_H)
# The linearalgebra code is all considered external, and we will
# not expect null termination of C strings.
gmx_target_warning_suppression(linearalgebra -Wno-stringop-truncation HAS_NO_STRINGOP_TRUNCATION)
endif()
+target_link_libraries(linearalgebra PRIVATE legacy_api)
+target_link_libraries(linearalgebra PRIVATE common)
+# TODO: Link specific modules.
+target_link_libraries(linearalgebra PRIVATE legacy_modules)
list(APPEND libgromacs_object_library_dependencies linearalgebra)
set(libgromacs_object_library_dependencies ${libgromacs_object_library_dependencies} PARENT_SCOPE)
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(listed_forces INTERFACE)
gmx_add_libgromacs_sources(
bonded.cpp
disre.cpp
)
endif()
+# Source files have the following private module dependencies.
+target_link_libraries(listed_forces PRIVATE
+# gmxlib
+# math
+# mdtypes
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(listed_forces PUBLIC
+target_include_directories(listed_forces INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(listed_forces PUBLIC
+target_link_libraries(listed_forces INTERFACE
+ legacy_api
+ )
+
+# TODO: when listed_forces is an OBJECT target
+#target_link_libraries(listed_forces PUBLIC legacy_api)
+#target_link_libraries(listed_forces PRIVATE common)
+
+# Module dependencies
+# listed_forces interfaces convey transitive dependence on these modules.
+#target_link_libraries(listed_forces PUBLIC
+target_link_libraries(listed_forces INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(listed_forces PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(listed_forces PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
//! PBC values for testing
std::vector<PbcType> c_pbcForTests = { PbcType::No, PbcType::XY, PbcType::Xyz };
-// Those tests give errors with the intel compiler and nothing else, so we disable them only there.
-#ifndef __INTEL_COMPILER
+// Those tests give errors with the Intel compiler (as of October 2019) and nothing else, so we disable them only there.
+#if !defined(__INTEL_COMPILER) || (__INTEL_COMPILER >= 2021)
INSTANTIATE_TEST_CASE_P(Bond,
ListedForcesTest,
::testing::Combine(::testing::ValuesIn(c_InputBonds),
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(math INTERFACE)
+
file(GLOB MATH_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${MATH_SOURCES} PARENT_SCOPE)
-# TODO: (https://gitlab.com/gromacs/gromacs/-/issues/988) Find a new convention for defining public API.
-install(FILES
- do_fit.h
- functions.h
- units.h
- utilities.h
- vec.h
- vectypes.h
- DESTINATION include/gromacs/math)
-
-if(GMX_INSTALL_LEGACY_API)
- install(FILES
- do_fit.h
- units.h
- utilities.h
- DESTINATION include/gromacs/math)
-endif()
+# Source files have the following private module dependencies.
+target_link_libraries(math PRIVATE
+ # gmxlib
+ # math
+ # mdtypes
+ # tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(math PUBLIC
+target_include_directories(math INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(math PUBLIC
+target_link_libraries(math INTERFACE
+ legacy_api
+ )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(math PUBLIC legacy_api)
+#target_link_libraries(math PRIVATE common)
+
+# Module dependencies
+# fileio interfaces convey transitive dependence on these modules.
+#target_link_libraries(math PUBLIC
+target_link_libraries(math INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(math PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(math PRIVATE legacy_modules)
if (BUILD_TESTING)
*/
#include "gmxpre.h"
-#include "do_fit.h"
+#include "gromacs/math/do_fit.h"
#include <cmath>
#include <cstdio>
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2019,2020, 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.
#include "gmxpre.h"
-#include "functions.h"
+#include "gromacs/math/functions.h"
#include "config.h"
*/
#include "gmxpre.h"
-#include "units.h"
+#include "gromacs/math/units.h"
#include <cstdio>
*/
#include "gmxpre.h"
-#include "utilities.h"
+#include "gromacs/math/utilities.h"
#include "config.h"
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(mdlib INTERFACE)
+
file(GLOB MDLIB_SOURCES *.cpp)
# To avoid listing all the necessary files manually, we will remove SYCL-specfific one here:
list(REMOVE_ITEM MDLIB_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/leapfrog_gpu_sycl.cpp)
set(MDLIB_SOURCES ${MDLIB_SOURCES} PARENT_SCOPE)
-if (BUILD_TESTING)
- add_subdirectory(tests)
-endif()
if(GMX_GPU_CUDA)
gmx_add_libgromacs_sources(
leapfrog_gpu.cu
gpuforcereduction_impl.cu
)
endif()
+
if(GMX_GPU_SYCL)
gmx_add_libgromacs_sources(
leapfrog_gpu_sycl.cpp
leapfrog_gpu_sycl.cpp
)
endif()
+
+# Source files have the following private module dependencies.
+target_link_libraries(mdlib PRIVATE
+# gmxlib
+# math
+# mdtypes
+# tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(mdlib PUBLIC
+target_include_directories(mdlib INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(mdlib PUBLIC
+target_link_libraries(mdlib INTERFACE
+ legacy_api
+ )
+
+# TODO: when mdlib is an OBJECT target
+#target_link_libraries(mdlib PUBLIC legacy_api)
+#target_link_libraries(mdlib PRIVATE common)
+
+# Module dependencies
+# mdlib interfaces convey transitive dependence on these modules.
+#target_link_libraries(mdlib PUBLIC
+target_link_libraries(mdlib INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(mdlib PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(mdlib PRIVATE legacy_modules)
+
+if (BUILD_TESTING)
+ add_subdirectory(tests)
+endif()
if (fr->useMts)
{
- gmx::assertMtsRequirements(*ir);
+ GMX_ASSERT(gmx::checkMtsRequirements(*ir).empty(),
+ "All MTS requirements should be met here");
}
const bool haveDirectVirialContributionsFast =
namespace
{
+// Define the set of PBCs to run the test for
+const std::vector<t_pbc> c_pbcs = [] {
+ std::vector<t_pbc> pbcs;
+ t_pbc pbc;
+
+ // Infinitely small box
+ matrix boxNone = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
+ set_pbc(&pbc, PbcType::No, boxNone);
+ pbcs.emplace_back(pbc);
+
+ // Rectangular box
+ matrix boxXyz = { { 10.0, 0.0, 0.0 }, { 0.0, 20.0, 0.0 }, { 0.0, 0.0, 15.0 } };
+ set_pbc(&pbc, PbcType::Xyz, boxXyz);
+ pbcs.emplace_back(pbc);
+
+ return pbcs;
+}();
+
/*! \brief Test fixture for constraints.
*
* The fixture uses following test systems:
* For some systems, the value for scaled virial tensor is checked against
* pre-computed data.
*/
-class ConstraintsTest : public ::testing::TestWithParam<std::string>
+class ConstraintsTest : public ::testing::TestWithParam<t_pbc>
{
public:
- //! PBC setups
- std::unordered_map<std::string, t_pbc> pbcs_;
-
- /*! \brief Test setup function.
- *
- * Setting up the pbcs and algorithms. Note, that corresponding string keywords
- * have to be explicitly added at the end of this file when the tests are called.
- *
- */
- void SetUp() override
- {
-
- //
- // PBC initialization
- //
- t_pbc pbc;
-
- // Infinitely small box
- matrix boxNone = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
- set_pbc(&pbc, PbcType::No, boxNone);
- pbcs_["PBCNone"] = pbc;
-
- // Rectangular box
- matrix boxXyz = { { 10.0, 0.0, 0.0 }, { 0.0, 20.0, 0.0 }, { 0.0, 0.0, 15.0 } };
- set_pbc(&pbc, PbcType::Xyz, boxXyz);
- pbcs_["PBCXYZ"] = pbc;
- }
-
/*! \brief
* The test on the final length of constrained bonds.
*
real(0.0), real(0.001), x, xPrime, v, shakeTolerance, shakeUseSOR, lincsNIter,
lincslincsExpansionOrder, lincsWarnAngle);
- std::string pbcName = GetParam();
- t_pbc pbc = pbcs_.at(pbcName);
+ t_pbc pbc = GetParam();
// Cycle through all available runners
for (const auto& runner : getRunners())
{
- SCOPED_TRACE(formatString("Testing %s with %s using %s.", testData->title_.c_str(),
- pbcName.c_str(), runner->name().c_str()));
+ SCOPED_TRACE(formatString("Testing %s with %s PBC using %s.", testData->title_.c_str(),
+ c_pbcTypeNames[pbc.pbcType].c_str(), runner->name().c_str()));
testData->reset();
real(0.0), real(0.001), x, xPrime, v, shakeTolerance, shakeUseSOR, lincsNIter,
lincslincsExpansionOrder, lincsWarnAngle);
- std::string pbcName = GetParam();
- t_pbc pbc = pbcs_.at(pbcName);
+ t_pbc pbc = GetParam();
// Cycle through all available runners
for (const auto& runner : getRunners())
{
- SCOPED_TRACE(formatString("Testing %s with %s using %s.", testData->title_.c_str(),
- pbcName.c_str(), runner->name().c_str()));
+ SCOPED_TRACE(formatString("Testing %s with %s PBC using %s.", testData->title_.c_str(),
+ c_pbcTypeNames[pbc.pbcType].c_str(), runner->name().c_str()));
testData->reset();
real(0.0), real(0.001), x, xPrime, v, shakeTolerance, shakeUseSOR, lincsNIter,
lincslincsExpansionOrder, lincsWarnAngle);
- std::string pbcName = GetParam();
- t_pbc pbc = pbcs_.at(pbcName);
+ t_pbc pbc = GetParam();
// Cycle through all available runners
for (const auto& runner : getRunners())
{
- SCOPED_TRACE(formatString("Testing %s with %s using %s.", testData->title_.c_str(),
- pbcName.c_str(), runner->name().c_str()));
+ SCOPED_TRACE(formatString("Testing %s with %s PBC using %s.", testData->title_.c_str(),
+ c_pbcTypeNames[pbc.pbcType].c_str(), runner->name().c_str()));
testData->reset();
real(0.0), real(0.001), x, xPrime, v, shakeTolerance, shakeUseSOR, lincsNIter,
lincslincsExpansionOrder, lincsWarnAngle);
- std::string pbcName = GetParam();
- t_pbc pbc = pbcs_.at(pbcName);
+ t_pbc pbc = GetParam();
// Cycle through all available runners
for (const auto& runner : getRunners())
{
- SCOPED_TRACE(formatString("Testing %s with %s using %s.", testData->title_.c_str(),
- pbcName.c_str(), runner->name().c_str()));
+ SCOPED_TRACE(formatString("Testing %s with %s PBC using %s.", testData->title_.c_str(),
+ c_pbcTypeNames[pbc.pbcType].c_str(), runner->name().c_str()));
testData->reset();
real(0.0), real(0.001), x, xPrime, v, shakeTolerance, shakeUseSOR, lincsNIter,
lincslincsExpansionOrder, lincsWarnAngle);
- std::string pbcName = GetParam();
- t_pbc pbc = pbcs_.at(pbcName);
+ t_pbc pbc = GetParam();
// Cycle through all available runners
for (const auto& runner : getRunners())
{
- SCOPED_TRACE(formatString("Testing %s with %s using %s.", testData->title_.c_str(),
- pbcName.c_str(), runner->name().c_str()));
+ SCOPED_TRACE(formatString("Testing %s with %s PBC using %s.", testData->title_.c_str(),
+ c_pbcTypeNames[pbc.pbcType].c_str(), runner->name().c_str()));
testData->reset();
real(0.0), real(0.001), x, xPrime, v, shakeTolerance, shakeUseSOR, lincsNIter,
lincslincsExpansionOrder, lincsWarnAngle);
- std::string pbcName = GetParam();
- t_pbc pbc = pbcs_.at(pbcName);
+ t_pbc pbc = GetParam();
// Cycle through all available runners
for (const auto& runner : getRunners())
{
- SCOPED_TRACE(formatString("Testing %s with %s using %s.", testData->title_.c_str(),
- pbcName.c_str(), runner->name().c_str()));
+ SCOPED_TRACE(formatString("Testing %s with %s PBC using %s.", testData->title_.c_str(),
+ c_pbcTypeNames[pbc.pbcType].c_str(), runner->name().c_str()));
testData->reset();
}
}
-
-INSTANTIATE_TEST_CASE_P(WithParameters, ConstraintsTest, ::testing::Values("PBCNone", "PBCXYZ"));
+INSTANTIATE_TEST_CASE_P(WithParameters, ConstraintsTest, ::testing::ValuesIn(c_pbcs));
} // namespace
} // namespace test
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team.
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, 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.
+ */
+#include "gmxpre.h"
+
+#include "update_vv.h"
+
+#include <cmath>
+#include <cstdio>
+
+#include <algorithm>
+#include <memory>
+
+#include "gromacs/domdec/partition.h"
+#include "gromacs/gmxlib/nrnb.h"
+#include "gromacs/math/units.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/mdlib/constr.h"
+#include "gromacs/mdlib/coupling.h"
+#include "gromacs/mdlib/enerdata_utils.h"
+#include "gromacs/mdlib/mdatoms.h"
+#include "gromacs/mdlib/md_support.h"
+#include "gromacs/mdlib/stat.h"
+#include "gromacs/mdlib/tgroup.h"
+#include "gromacs/mdlib/update.h"
+#include "gromacs/mdtypes/commrec.h"
+#include "gromacs/mdtypes/enerdata.h"
+#include "gromacs/mdtypes/fcdata.h"
+#include "gromacs/mdtypes/forcebuffers.h"
+#include "gromacs/mdtypes/forcerec.h"
+#include "gromacs/mdtypes/group.h"
+#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/mdatom.h"
+#include "gromacs/mdtypes/state.h"
+#include "gromacs/pulling/pull.h"
+#include "gromacs/timing/wallcycle.h"
+#include "gromacs/topology/topology.h"
+
+void integrateVVFirstStep(int64_t step,
+ bool bFirstStep,
+ bool bInitStep,
+ gmx::StartingBehavior startingBehavior,
+ int nstglobalcomm,
+ t_inputrec* ir,
+ t_forcerec* fr,
+ t_commrec* cr,
+ t_state* state,
+ t_mdatoms* mdatoms,
+ const t_fcdata& fcdata,
+ t_extmass* MassQ,
+ t_vcm* vcm,
+ const gmx_mtop_t* top_global,
+ const gmx_localtop_t& top,
+ gmx_enerdata_t* enerd,
+ gmx_ekindata_t* ekind,
+ gmx_global_stat* gstat,
+ real* last_ekin,
+ bool bCalcVir,
+ tensor total_vir,
+ tensor shake_vir,
+ tensor force_vir,
+ tensor pres,
+ matrix M,
+ bool do_log,
+ bool do_ene,
+ bool bCalcEner,
+ bool bGStat,
+ bool bStopCM,
+ bool bTrotter,
+ bool bExchanged,
+ bool* bSumEkinhOld,
+ bool* shouldCheckNumberOfBondedInteractions,
+ real* saved_conserved_quantity,
+ gmx::ForceBuffers* f,
+ gmx::Update* upd,
+ gmx::Constraints* constr,
+ gmx::SimulationSignaller* nullSignaller,
+ std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
+ t_nrnb* nrnb,
+ const gmx::MDLogger& mdlog,
+ FILE* fplog,
+ gmx_wallcycle* wcycle)
+{
+ if (!bFirstStep || startingBehavior == gmx::StartingBehavior::NewSimulation)
+ {
+ /* ############### START FIRST UPDATE HALF-STEP FOR VV METHODS############### */
+ rvec* vbuf = nullptr;
+
+ wallcycle_start(wcycle, ewcUPDATE);
+ if (ir->eI == eiVV && bInitStep)
+ {
+ /* if using velocity verlet with full time step Ekin,
+ * take the first half step only to compute the
+ * virial for the first step. From there,
+ * revert back to the initial coordinates
+ * so that the input is actually the initial step.
+ */
+ snew(vbuf, state->natoms);
+ copy_rvecn(state->v.rvec_array(), vbuf, 0,
+ state->natoms); /* should make this better for parallelizing? */
+ }
+ else
+ {
+ /* this is for NHC in the Ekin(t+dt/2) version of vv */
+ trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, MassQ, trotter_seq, ettTSEQ1);
+ }
+
+ upd->update_coords(*ir, step, mdatoms, state, f->view().forceWithPadding(), fcdata, ekind,
+ M, etrtVELOCITY1, cr, constr != nullptr);
+
+ wallcycle_stop(wcycle, ewcUPDATE);
+ constrain_velocities(constr, do_log, do_ene, step, state, nullptr, bCalcVir, shake_vir);
+ wallcycle_start(wcycle, ewcUPDATE);
+ /* if VV, compute the pressure and constraints */
+ /* For VV2, we strictly only need this if using pressure
+ * control, but we really would like to have accurate pressures
+ * printed out.
+ * Think about ways around this in the future?
+ * For now, keep this choice in comments.
+ */
+ /*bPres = (ir->eI==eiVV || inputrecNptTrotter(ir)); */
+ /*bTemp = ((ir->eI==eiVV &&(!bInitStep)) || (ir->eI==eiVVAK && inputrecNptTrotter(ir)));*/
+ bool bPres = TRUE;
+ bool bTemp = ((ir->eI == eiVV && (!bInitStep)) || (ir->eI == eiVVAK));
+ if (bCalcEner && ir->eI == eiVVAK)
+ {
+ *bSumEkinhOld = TRUE;
+ }
+ /* for vv, the first half of the integration actually corresponds to the previous step.
+ So we need information from the last step in the first half of the integration */
+ if (bGStat || do_per_step(step - 1, nstglobalcomm))
+ {
+ wallcycle_stop(wcycle, ewcUPDATE);
+ int totalNumberOfBondedInteractions = -1;
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, mdatoms, nrnb, vcm, wcycle,
+ enerd, force_vir, shake_vir, total_vir, pres, constr, nullSignaller,
+ state->box, &totalNumberOfBondedInteractions, bSumEkinhOld,
+ (bGStat ? CGLO_GSTAT : 0) | (bCalcEner ? CGLO_ENERGY : 0)
+ | (bTemp ? CGLO_TEMPERATURE : 0) | (bPres ? CGLO_PRESSURE : 0)
+ | (bPres ? CGLO_CONSTRAINT : 0) | (bStopCM ? CGLO_STOPCM : 0)
+ | (*shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
+ : 0)
+ | CGLO_SCALEEKIN);
+ /* explanation of above:
+ a) We compute Ekin at the full time step
+ if 1) we are using the AveVel Ekin, and it's not the
+ initial step, or 2) if we are using AveEkin, but need the full
+ time step kinetic energy for the pressure (always true now, since we want accurate statistics).
+ b) If we are using EkinAveEkin for the kinetic energy for the temperature control, we still feed in
+ EkinAveVel because it's needed for the pressure */
+ checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global,
+ &top, makeConstArrayRef(state->x), state->box,
+ shouldCheckNumberOfBondedInteractions);
+ if (bStopCM)
+ {
+ process_and_stopcm_grp(fplog, vcm, *mdatoms, makeArrayRef(state->x),
+ makeArrayRef(state->v));
+ inc_nrnb(nrnb, eNR_STOPCM, mdatoms->homenr);
+ }
+ wallcycle_start(wcycle, ewcUPDATE);
+ }
+ /* temperature scaling and pressure scaling to produce the extended variables at t+dt */
+ if (!bInitStep)
+ {
+ if (bTrotter)
+ {
+ m_add(force_vir, shake_vir, total_vir); /* we need the un-dispersion corrected total vir here */
+ trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, MassQ,
+ trotter_seq, ettTSEQ2);
+
+ /* TODO This is only needed when we're about to write
+ * a checkpoint, because we use it after the restart
+ * (in a kludge?). But what should we be doing if
+ * the startingBehavior is NewSimulation or bInitStep are true? */
+ if (inputrecNptTrotter(ir) || inputrecNphTrotter(ir))
+ {
+ copy_mat(shake_vir, state->svir_prev);
+ copy_mat(force_vir, state->fvir_prev);
+ }
+ if (inputrecNvtTrotter(ir) && ir->eI == eiVV)
+ {
+ /* update temperature and kinetic energy now that step is over - this is the v(t+dt) point */
+ enerd->term[F_TEMP] = sum_ekin(&(ir->opts), ekind, nullptr, (ir->eI == eiVV), FALSE);
+ enerd->term[F_EKIN] = trace(ekind->ekin);
+ }
+ }
+ else if (bExchanged)
+ {
+ wallcycle_stop(wcycle, ewcUPDATE);
+ /* We need the kinetic energy at minus the half step for determining
+ * the full step kinetic energy and possibly for T-coupling.*/
+ /* This may not be quite working correctly yet . . . . */
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, mdatoms, nrnb, vcm, wcycle,
+ enerd, nullptr, nullptr, nullptr, nullptr, constr, nullSignaller,
+ state->box, nullptr, bSumEkinhOld, CGLO_GSTAT | CGLO_TEMPERATURE);
+ wallcycle_start(wcycle, ewcUPDATE);
+ }
+ }
+ /* if it's the initial step, we performed this first step just to get the constraint virial */
+ if (ir->eI == eiVV && bInitStep)
+ {
+ copy_rvecn(vbuf, state->v.rvec_array(), 0, state->natoms);
+ sfree(vbuf);
+ }
+ wallcycle_stop(wcycle, ewcUPDATE);
+ }
+
+ /* compute the conserved quantity */
+ *saved_conserved_quantity = NPT_energy(ir, state, MassQ);
+ if (ir->eI == eiVV)
+ {
+ *last_ekin = enerd->term[F_EKIN];
+ }
+ if ((ir->eDispCorr != edispcEnerPres) && (ir->eDispCorr != edispcAllEnerPres))
+ {
+ *saved_conserved_quantity -= enerd->term[F_DISPCORR];
+ }
+ /* sum up the foreign kinetic energy and dK/dl terms for vv. currently done every step so that dhdl is correct in the .edr */
+ if (ir->efep != efepNO)
+ {
+ accumulateKineticLambdaComponents(enerd, state->lambda, *ir->fepvals);
+ }
+}
+
+void integrateVVSecondStep(int64_t step,
+ t_inputrec* ir,
+ t_forcerec* fr,
+ t_commrec* cr,
+ t_state* state,
+ t_mdatoms* mdatoms,
+ const t_fcdata& fcdata,
+ t_extmass* MassQ,
+ t_vcm* vcm,
+ pull_t* pull_work,
+ gmx_enerdata_t* enerd,
+ gmx_ekindata_t* ekind,
+ gmx_global_stat* gstat,
+ real* dvdl_constr,
+ bool bCalcVir,
+ tensor total_vir,
+ tensor shake_vir,
+ tensor force_vir,
+ tensor pres,
+ matrix M,
+ matrix lastbox,
+ bool do_log,
+ bool do_ene,
+ bool bGStat,
+ bool* bSumEkinhOld,
+ gmx::ForceBuffers* f,
+ std::vector<gmx::RVec>* cbuf,
+ gmx::Update* upd,
+ gmx::Constraints* constr,
+ gmx::SimulationSignaller* nullSignaller,
+ std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
+ t_nrnb* nrnb,
+ gmx_wallcycle* wcycle)
+{
+ /* velocity half-step update */
+ upd->update_coords(*ir, step, mdatoms, state, f->view().forceWithPadding(), fcdata, ekind, M,
+ etrtVELOCITY2, cr, constr != nullptr);
+
+
+ /* Above, initialize just copies ekinh into ekin,
+ * it doesn't copy position (for VV),
+ * and entire integrator for MD.
+ */
+
+ if (ir->eI == eiVVAK)
+ {
+ cbuf->resize(state->x.size());
+ std::copy(state->x.begin(), state->x.end(), cbuf->begin());
+ }
+
+ if (ir->bPull && ir->pull->bSetPbcRefToPrevStepCOM)
+ {
+ updatePrevStepPullCom(pull_work, state);
+ }
+
+ upd->update_coords(*ir, step, mdatoms, state, f->view().forceWithPadding(), fcdata, ekind, M,
+ etrtPOSITION, cr, constr != nullptr);
+
+ wallcycle_stop(wcycle, ewcUPDATE);
+
+ constrain_coordinates(constr, do_log, do_ene, step, state, upd->xp()->arrayRefWithPadding(),
+ dvdl_constr, bCalcVir, shake_vir);
+
+ upd->update_sd_second_half(*ir, step, dvdl_constr, mdatoms, state, cr, nrnb, wcycle, constr,
+ do_log, do_ene);
+ upd->finish_update(*ir, mdatoms, state, wcycle, constr != nullptr);
+
+ if (ir->eI == eiVVAK)
+ {
+ /* erase F_EKIN and F_TEMP here? */
+ /* just compute the kinetic energy at the half step to perform a trotter step */
+ compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+ makeConstArrayRef(state->v), state->box, mdatoms, nrnb, vcm, wcycle, enerd,
+ force_vir, shake_vir, total_vir, pres, constr, nullSignaller, lastbox,
+ nullptr, bSumEkinhOld, (bGStat ? CGLO_GSTAT : 0) | CGLO_TEMPERATURE);
+ wallcycle_start(wcycle, ewcUPDATE);
+ trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, MassQ, trotter_seq, ettTSEQ4);
+ /* now we know the scaling, we can compute the positions again */
+ std::copy(cbuf->begin(), cbuf->end(), state->x.begin());
+
+ upd->update_coords(*ir, step, mdatoms, state, f->view().forceWithPadding(), fcdata, ekind,
+ M, etrtPOSITION, cr, constr != nullptr);
+ wallcycle_stop(wcycle, ewcUPDATE);
+
+ /* do we need an extra constraint here? just need to copy out of as_rvec_array(state->v.data()) to upd->xp? */
+ /* are the small terms in the shake_vir here due
+ * to numerical errors, or are they important
+ * physically? I'm thinking they are just errors, but not completely sure.
+ * For now, will call without actually constraining, constr=NULL*/
+ upd->finish_update(*ir, mdatoms, state, wcycle, false);
+ }
+ /* this factor or 2 correction is necessary
+ because half of the constraint force is removed
+ in the vv step, so we have to double it. See
+ the Issue #1255. It is not yet clear
+ if the factor of 2 is exact, or just a very
+ good approximation, and this will be
+ investigated. The next step is to see if this
+ can be done adding a dhdl contribution from the
+ rattle step, but this is somewhat more
+ complicated with the current code. Will be
+ investigated, hopefully for 4.6.3. However,
+ this current solution is much better than
+ having it completely wrong.
+ */
+ enerd->term[F_DVDL_CONSTR] += 2 * *dvdl_constr;
+}
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team.
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, 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.
+ */
+#ifndef GMX_MDLIB_UPDATE_VV_H
+#define GMX_MDLIB_UPDATE_VV_H
+
+#include <vector>
+
+#include "gromacs/math/vectypes.h"
+#include "gromacs/mdrunutility/handlerestart.h"
+#include "gromacs/mdtypes/md_enums.h"
+
+struct gmx_ekindata_t;
+struct gmx_enerdata_t;
+struct gmx_global_stat;
+struct gmx_localtop_t;
+struct gmx_mtop_t;
+struct gmx_wallcycle;
+struct pull_t;
+struct t_commrec;
+struct t_extmass;
+struct t_fcdata;
+struct t_forcerec;
+struct t_inputrec;
+struct t_mdatoms;
+struct t_nrnb;
+class t_state;
+struct t_vcm;
+
+namespace gmx
+{
+class Constraints;
+class ForceBuffers;
+class MDLogger;
+class SimulationSignaller;
+class Update;
+} // namespace gmx
+
+/*! \brief Make the first step of Velocity Verlet integration
+ *
+ * \param[in] step Current timestep.
+ * \param[in] bFirstStep Is it a first step.
+ * \param[in] bInitStep Is it an initialization step.
+ * \param[in] startingBehavior Describes whether this is a restart appending to output files.
+ * \param[in] nstglobalcomm Will globals be computed on this step.
+ * \param[in] ir Input record.
+ * \param[in] fr Force record.
+ * \param[in] cr Comunication record.
+ * \param[in] state Simulation state.
+ * \param[in] mdatoms MD atoms data.
+ * \param[in] fcdata Force calculation data.
+ * \param[in] MassQ Mass/pressure data.
+ * \param[in] vcm Center of mass motion removal.
+ * \param[in] top_global Global topology.
+ * \param[in] top Local topology.
+ * \param[in] enerd Energy data.
+ * \param[in] ekind Kinetic energy data.
+ * \param[in] gstat Storage of thermodynamic parameters data.
+ * \param[out] last_ekin Kinetic energies of the last step.
+ * \param[in] bCalcVir If the virial is computed on this step.
+ * \param[in] total_vir Total virial tensor.
+ * \param[in] shake_vir Constraints virial.
+ * \param[in] force_vir Force virial.
+ * \param[in] pres Pressure tensor.
+ * \param[in] M Parrinello-Rahman velocity scaling matrix.
+ * \param[in] do_log Do logging on this step.
+ * \param[in] do_ene Print energies on this step.
+ * \param[in] bCalcEner Compute energies on this step.
+ * \param[in] bGStat Collect globals this step.
+ * \param[in] bStopCM Stop the center of mass motion on this step.
+ * \param[in] bTrotter Do trotter routines this step.
+ * \param[in] bExchanged If this is a replica exchange step.
+ * \param[out] bSumEkinhOld Old kinetic energies will need to be summed up.
+ * \param[out] shouldCheckNumberOfBondedInteractions If checks for missing bonded
+ * interactions will be needed.
+ * \param[out] saved_conserved_quantity Place to store the conserved energy.
+ * \param[in] f Force buffers.
+ * \param[in] upd Update object.
+ * \param[in] constr Constraints object.
+ * \param[in] nullSignaller Simulation signaller.
+ * \param[in] trotter_seq NPT variables.
+ * \param[in] nrnb Cycle counters.
+ * \param[in] mdlog Logger.
+ * \param[in] fplog Another logger.
+ * \param[in] wcycle Wall-clock cycle counter.
+ */
+void integrateVVFirstStep(int64_t step,
+ bool bFirstStep,
+ bool bInitStep,
+ gmx::StartingBehavior startingBehavior,
+ int nstglobalcomm,
+ t_inputrec* ir,
+ t_forcerec* fr,
+ t_commrec* cr,
+ t_state* state,
+ t_mdatoms* mdatoms,
+ const t_fcdata& fcdata,
+ t_extmass* MassQ,
+ t_vcm* vcm,
+ const gmx_mtop_t* top_global,
+ const gmx_localtop_t& top,
+ gmx_enerdata_t* enerd,
+ gmx_ekindata_t* ekind,
+ gmx_global_stat* gstat,
+ real* last_ekin,
+ bool bCalcVir,
+ tensor total_vir,
+ tensor shake_vir,
+ tensor force_vir,
+ tensor pres,
+ matrix M,
+ bool do_log,
+ bool do_ene,
+ bool bCalcEner,
+ bool bGStat,
+ bool bStopCM,
+ bool bTrotter,
+ bool bExchanged,
+ bool* bSumEkinhOld,
+ bool* shouldCheckNumberOfBondedInteractions,
+ real* saved_conserved_quantity,
+ gmx::ForceBuffers* f,
+ gmx::Update* upd,
+ gmx::Constraints* constr,
+ gmx::SimulationSignaller* nullSignaller,
+ std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
+ t_nrnb* nrnb,
+ const gmx::MDLogger& mdlog,
+ FILE* fplog,
+ gmx_wallcycle* wcycle);
+
+
+/*! \brief Make the second step of Velocity Verlet integration
+ *
+ * \param[in] step Current timestep.
+ * \param[in] ir Input record.
+ * \param[in] fr Force record.
+ * \param[in] cr Comunication record.
+ * \param[in] state Simulation state.
+ * \param[in] mdatoms MD atoms data.
+ * \param[in] fcdata Force calculation data.
+ * \param[in] MassQ Mass/pressure data.
+ * \param[in] vcm Center of mass motion removal.
+ * \param[in] pull_work Pulling data.
+ * \param[in] enerd Energy data.
+ * \param[in] ekind Kinetic energy data.
+ * \param[in] gstat Storage of thermodynamic parameters data.
+ * \param[out] dvdl_constr FEP data for constraints.
+ * \param[in] bCalcVir If the virial is computed on this step.
+ * \param[in] total_vir Total virial tensor.
+ * \param[in] shake_vir Constraints virial.
+ * \param[in] force_vir Force virial.
+ * \param[in] pres Pressure tensor.
+ * \param[in] M Parrinello-Rahman velocity scaling matrix.
+ * \param[in] lastbox Last recorded PBC box.
+ * \param[in] do_log Do logging on this step.
+ * \param[in] do_ene Print energies on this step.
+ * \param[in] bGStat Collect globals this step.
+ * \param[out] bSumEkinhOld Old kinetic energies need to be summed up.
+ * \param[in] f Force buffers.
+ * \param[in] cbuf Buffer to store intermediate coordinates
+ * \param[in] upd Update object.
+ * \param[in] constr Constraints object.
+ * \param[in] nullSignaller Simulation signaller.
+ * \param[in] trotter_seq NPT variables.
+ * \param[in] nrnb Cycle counters.
+ * \param[in] wcycle Wall-clock cycle counter.
+ */
+void integrateVVSecondStep(int64_t step,
+ t_inputrec* ir,
+ t_forcerec* fr,
+ t_commrec* cr,
+ t_state* state,
+ t_mdatoms* mdatoms,
+ const t_fcdata& fcdata,
+ t_extmass* MassQ,
+ t_vcm* vcm,
+ pull_t* pull_work,
+ gmx_enerdata_t* enerd,
+ gmx_ekindata_t* ekind,
+ gmx_global_stat* gstat,
+ real* dvdl_constr,
+ bool bCalcVir,
+ tensor total_vir,
+ tensor shake_vir,
+ tensor force_vir,
+ tensor pres,
+ matrix M,
+ matrix lastbox,
+ bool do_log,
+ bool do_ene,
+ bool bGStat,
+ bool* bSumEkinhOld,
+ gmx::ForceBuffers* f,
+ std::vector<gmx::RVec>* cbuf,
+ gmx::Update* upd,
+ gmx::Constraints* constr,
+ gmx::SimulationSignaller* nullSignaller,
+ std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
+ t_nrnb* nrnb,
+ gmx_wallcycle* wcycle);
+
+
+#endif // GMX_MDLIB_UPDATE_VV_H
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(mdrun INTERFACE)
gmx_add_libgromacs_sources(
legacymdrunoptions.cpp
legacysimulator.cpp
tpi.cpp
)
+# Source files have the following private module dependencies.
+target_link_libraries(mdrun PRIVATE
+# gmxlib
+# math
+# mdtypes
+# tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(mdrun PUBLIC
+target_include_directories(mdrun INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(mdrun PUBLIC
+target_link_libraries(mdrun INTERFACE
+ legacy_api
+ )
+
+# TODO: when mdrun is an OBJECT target
+#target_link_libraries(mdrun PUBLIC legacy_api)
+#target_link_libraries(mdrun PRIVATE common)
+
+# Module dependencies
+# mdrun interfaces convey transitive dependence on these modules.
+#target_link_libraries(mdrun PUBLIC
+target_link_libraries(mdrun INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(mdrun PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(mdrun PRIVATE legacy_modules)
+
# TODO: Find a home for this header and a scheme for installation.
# This header straddles the installed libraries and is a transitive interface
# from libgromacs to libgmxapi to libgmxapi clients. Near term efforts are
#include "gromacs/mdlib/trajectory_writing.h"
#include "gromacs/mdlib/update.h"
#include "gromacs/mdlib/update_constrain_gpu.h"
+#include "gromacs/mdlib/update_vv.h"
#include "gromacs/mdlib/vcm.h"
#include "gromacs/mdlib/vsite.h"
#include "gromacs/mdrunutility/handlerestart.h"
gmx_global_stat_t gstat;
gmx_shellfc_t* shellfc;
gmx_bool bSumEkinhOld, bDoReplEx, bExchanged, bNeedRepartition;
- gmx_bool bTemp, bPres, bTrotter;
+ gmx_bool bTrotter;
real dvdl_constr;
std::vector<RVec> cbuf;
matrix lastbox;
if (bExchanged)
{
-
/* We need the kinetic energy at minus the half step for determining
* the full step kinetic energy and possibly for T-coupling.*/
/* This may not be quite working correctly yet . . . . */
// if it is the first step after starting from a checkpoint.
// That is, the half step is needed on all other steps, and
// also the first step when starting from a .tpr file.
- if (EI_VV(ir->eI) && (!bFirstStep || startingBehavior == StartingBehavior::NewSimulation))
- /* ############### START FIRST UPDATE HALF-STEP FOR VV METHODS############### */
- {
- rvec* vbuf = nullptr;
-
- wallcycle_start(wcycle, ewcUPDATE);
- if (ir->eI == eiVV && bInitStep)
- {
- /* if using velocity verlet with full time step Ekin,
- * take the first half step only to compute the
- * virial for the first step. From there,
- * revert back to the initial coordinates
- * so that the input is actually the initial step.
- */
- snew(vbuf, state->natoms);
- copy_rvecn(state->v.rvec_array(), vbuf, 0,
- state->natoms); /* should make this better for parallelizing? */
- }
- else
- {
- /* this is for NHC in the Ekin(t+dt/2) version of vv */
- trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, &MassQ,
- trotter_seq, ettTSEQ1);
- }
-
- upd.update_coords(*ir, step, mdatoms, state, f.view().forceWithPadding(), fcdata, ekind,
- M, etrtVELOCITY1, cr, constr != nullptr);
-
- wallcycle_stop(wcycle, ewcUPDATE);
- constrain_velocities(constr, do_log, do_ene, step, state, nullptr, bCalcVir, shake_vir);
- wallcycle_start(wcycle, ewcUPDATE);
- /* if VV, compute the pressure and constraints */
- /* For VV2, we strictly only need this if using pressure
- * control, but we really would like to have accurate pressures
- * printed out.
- * Think about ways around this in the future?
- * For now, keep this choice in comments.
- */
- /*bPres = (ir->eI==eiVV || inputrecNptTrotter(ir)); */
- /*bTemp = ((ir->eI==eiVV &&(!bInitStep)) || (ir->eI==eiVVAK && inputrecNptTrotter(ir)));*/
- bPres = TRUE;
- bTemp = ((ir->eI == eiVV && (!bInitStep)) || (ir->eI == eiVVAK));
- if (bCalcEner && ir->eI == eiVVAK)
- {
- bSumEkinhOld = TRUE;
- }
- /* for vv, the first half of the integration actually corresponds to the previous step.
- So we need information from the last step in the first half of the integration */
- if (bGStat || do_per_step(step - 1, nstglobalcomm))
- {
- wallcycle_stop(wcycle, ewcUPDATE);
- compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
- makeConstArrayRef(state->v), state->box, mdatoms, nrnb, &vcm, wcycle,
- enerd, force_vir, shake_vir, total_vir, pres, constr, &nullSignaller,
- state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
- (bGStat ? CGLO_GSTAT : 0) | (bCalcEner ? CGLO_ENERGY : 0)
- | (bTemp ? CGLO_TEMPERATURE : 0) | (bPres ? CGLO_PRESSURE : 0)
- | (bPres ? CGLO_CONSTRAINT : 0) | (bStopCM ? CGLO_STOPCM : 0)
- | (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
- : 0)
- | CGLO_SCALEEKIN);
- /* explanation of above:
- a) We compute Ekin at the full time step
- if 1) we are using the AveVel Ekin, and it's not the
- initial step, or 2) if we are using AveEkin, but need the full
- time step kinetic energy for the pressure (always true now, since we want accurate statistics).
- b) If we are using EkinAveEkin for the kinetic energy for the temperature control, we still feed in
- EkinAveVel because it's needed for the pressure */
- checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions,
- top_global, &top, makeConstArrayRef(state->x),
- state->box, &shouldCheckNumberOfBondedInteractions);
- if (bStopCM)
- {
- process_and_stopcm_grp(fplog, &vcm, *mdatoms, makeArrayRef(state->x),
- makeArrayRef(state->v));
- inc_nrnb(nrnb, eNR_STOPCM, mdatoms->homenr);
- }
- wallcycle_start(wcycle, ewcUPDATE);
- }
- /* temperature scaling and pressure scaling to produce the extended variables at t+dt */
- if (!bInitStep)
- {
- if (bTrotter)
- {
- m_add(force_vir, shake_vir,
- total_vir); /* we need the un-dispersion corrected total vir here */
- trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, &MassQ,
- trotter_seq, ettTSEQ2);
-
- /* TODO This is only needed when we're about to write
- * a checkpoint, because we use it after the restart
- * (in a kludge?). But what should we be doing if
- * the startingBehavior is NewSimulation or bInitStep are true? */
- if (inputrecNptTrotter(ir) || inputrecNphTrotter(ir))
- {
- copy_mat(shake_vir, state->svir_prev);
- copy_mat(force_vir, state->fvir_prev);
- }
- if (inputrecNvtTrotter(ir) && ir->eI == eiVV)
- {
- /* update temperature and kinetic energy now that step is over - this is the v(t+dt) point */
- enerd->term[F_TEMP] =
- sum_ekin(&(ir->opts), ekind, nullptr, (ir->eI == eiVV), FALSE);
- enerd->term[F_EKIN] = trace(ekind->ekin);
- }
- }
- else if (bExchanged)
- {
- wallcycle_stop(wcycle, ewcUPDATE);
- /* We need the kinetic energy at minus the half step for determining
- * the full step kinetic energy and possibly for T-coupling.*/
- /* This may not be quite working correctly yet . . . . */
- compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
- makeConstArrayRef(state->v), state->box, mdatoms, nrnb, &vcm, wcycle,
- enerd, nullptr, nullptr, nullptr, nullptr, constr, &nullSignaller,
- state->box, nullptr, &bSumEkinhOld, CGLO_GSTAT | CGLO_TEMPERATURE);
- wallcycle_start(wcycle, ewcUPDATE);
- }
- }
- /* if it's the initial step, we performed this first step just to get the constraint virial */
- if (ir->eI == eiVV && bInitStep)
- {
- copy_rvecn(vbuf, state->v.rvec_array(), 0, state->natoms);
- sfree(vbuf);
- }
- wallcycle_stop(wcycle, ewcUPDATE);
- }
-
- /* compute the conserved quantity */
if (EI_VV(ir->eI))
{
- saved_conserved_quantity = NPT_energy(ir, state, &MassQ);
- if (ir->eI == eiVV)
- {
- last_ekin = enerd->term[F_EKIN];
- }
- if ((ir->eDispCorr != edispcEnerPres) && (ir->eDispCorr != edispcAllEnerPres))
- {
- saved_conserved_quantity -= enerd->term[F_DISPCORR];
- }
- /* sum up the foreign kinetic energy and dK/dl terms for vv. currently done every step so that dhdl is correct in the .edr */
- if (ir->efep != efepNO)
- {
- accumulateKineticLambdaComponents(enerd, state->lambda, *ir->fepvals);
- }
+ integrateVVFirstStep(step, bFirstStep, bInitStep, startingBehavior, nstglobalcomm, ir,
+ fr, cr, state, mdatoms, fcdata, &MassQ, &vcm, top_global, top, enerd,
+ ekind, gstat, &last_ekin, bCalcVir, total_vir, shake_vir, force_vir,
+ pres, M, do_log, do_ene, bCalcEner, bGStat, bStopCM, bTrotter,
+ bExchanged, &bSumEkinhOld, &shouldCheckNumberOfBondedInteractions,
+ &saved_conserved_quantity, &f, &upd, constr, &nullSignaller,
+ trotter_seq, nrnb, mdlog, fplog, wcycle);
}
/* ######## END FIRST UPDATE STEP ############## */
update_pcouple_before_coordinates(fplog, step, ir, state, pressureCouplingMu, M, bInitStep);
}
- if (EI_VV(ir->eI))
- {
- /* velocity half-step update */
- upd.update_coords(*ir, step, mdatoms, state, f.view().forceWithPadding(), fcdata, ekind,
- M, etrtVELOCITY2, cr, constr != nullptr);
- }
-
- /* Above, initialize just copies ekinh into ekin,
- * it doesn't copy position (for VV),
- * and entire integrator for MD.
- */
-
- if (ir->eI == eiVVAK)
- {
- cbuf.resize(state->x.size());
- std::copy(state->x.begin(), state->x.end(), cbuf.begin());
- }
-
/* With leap-frog type integrators we compute the kinetic energy
* at a whole time step as the average of the half-time step kinetic
* energies of two subsequent steps. Therefore we need to compute the
const bool doParrinelloRahman = (ir->epc == epcPARRINELLORAHMAN
&& do_per_step(step + ir->nstpcouple - 1, ir->nstpcouple));
- if (useGpuForUpdate)
+ if (EI_VV(ir->eI))
+ {
+ GMX_ASSERT(!useGpuForUpdate, "GPU update is not supported with VVAK integrator.");
+
+ integrateVVSecondStep(step, ir, fr, cr, state, mdatoms, fcdata, &MassQ, &vcm, pull_work,
+ enerd, ekind, gstat, &dvdl_constr, bCalcVir, total_vir, shake_vir,
+ force_vir, pres, M, lastbox, do_log, do_ene, bGStat, &bSumEkinhOld,
+ &f, &cbuf, &upd, constr, &nullSignaller, trotter_seq, nrnb, wcycle);
+ }
+ else
{
- if (bNS && (bFirstStep || DOMAINDECOMP(cr)))
+ if (useGpuForUpdate)
{
- integrator->set(stateGpu->getCoordinates(), stateGpu->getVelocities(),
- stateGpu->getForces(), top.idef, *mdatoms, ekind->ngtc);
- // Copy data to the GPU after buffers might have being reinitialized
- stateGpu->copyVelocitiesToGpu(state->v, AtomLocality::Local);
- stateGpu->copyCoordinatesToGpu(state->x, AtomLocality::Local);
- }
+ wallcycle_stop(wcycle, ewcUPDATE);
- if (simulationWork.useGpuPme && !runScheduleWork->simulationWork.useGpuPmePpCommunication
- && !thisRankHasDuty(cr, DUTY_PME))
- {
- // The PME forces were recieved to the host, so have to be copied
- stateGpu->copyForcesToGpu(f.view().force(), AtomLocality::All);
- }
- else if (!runScheduleWork->stepWork.useGpuFBufferOps)
- {
- // The buffer ops were not offloaded this step, so the forces are on the
- // host and have to be copied
- stateGpu->copyForcesToGpu(f.view().force(), AtomLocality::Local);
- }
+ if (bNS && (bFirstStep || DOMAINDECOMP(cr)))
+ {
+ integrator->set(stateGpu->getCoordinates(), stateGpu->getVelocities(),
+ stateGpu->getForces(), top.idef, *mdatoms, ekind->ngtc);
- const bool doTemperatureScaling =
- (ir->etc != etcNO && do_per_step(step + ir->nsttcouple - 1, ir->nsttcouple));
+ // Copy data to the GPU after buffers might have being reinitialized
+ stateGpu->copyVelocitiesToGpu(state->v, AtomLocality::Local);
+ stateGpu->copyCoordinatesToGpu(state->x, AtomLocality::Local);
+ }
- // This applies Leap-Frog, LINCS and SETTLE in succession
- integrator->integrate(stateGpu->getForcesReadyOnDeviceEvent(
- AtomLocality::Local, runScheduleWork->stepWork.useGpuFBufferOps),
- ir->delta_t, true, bCalcVir, shake_vir, doTemperatureScaling,
- ekind->tcstat, doParrinelloRahman, ir->nstpcouple * ir->delta_t, M);
+ if (simulationWork.useGpuPme && !runScheduleWork->simulationWork.useGpuPmePpCommunication
+ && !thisRankHasDuty(cr, DUTY_PME))
+ {
+ // The PME forces were recieved to the host, so have to be copied
+ stateGpu->copyForcesToGpu(f.view().force(), AtomLocality::All);
+ }
+ else if (!runScheduleWork->stepWork.useGpuFBufferOps)
+ {
+ // The buffer ops were not offloaded this step, so the forces are on the
+ // host and have to be copied
+ stateGpu->copyForcesToGpu(f.view().force(), AtomLocality::Local);
+ }
- // Copy velocities D2H after update if:
- // - Globals are computed this step (includes the energy output steps).
- // - Temperature is needed for the next step.
- if (bGStat || needHalfStepKineticEnergy)
- {
- stateGpu->copyVelocitiesFromGpu(state->v, AtomLocality::Local);
- stateGpu->waitVelocitiesReadyOnHost(AtomLocality::Local);
- }
- }
- else
- {
- /* With multiple time stepping we need to do an additional normal
- * update step to obtain the virial, as the actual MTS integration
- * using an acceleration where the slow forces are multiplied by mtsFactor.
- * Using that acceleration would result in a virial with the slow
- * force contribution would be a factor mtsFactor too large.
- */
- if (fr->useMts && bCalcVir && constr != nullptr)
- {
- upd.update_for_constraint_virial(*ir, *mdatoms, *state, f.view().forceWithPadding(), *ekind);
+ const bool doTemperatureScaling =
+ (ir->etc != etcNO && do_per_step(step + ir->nsttcouple - 1, ir->nsttcouple));
- constrain_coordinates(constr, do_log, do_ene, step, state,
- upd.xp()->arrayRefWithPadding(), &dvdl_constr, bCalcVir, shake_vir);
- }
+ // This applies Leap-Frog, LINCS and SETTLE in succession
+ integrator->integrate(
+ stateGpu->getForcesReadyOnDeviceEvent(
+ AtomLocality::Local, runScheduleWork->stepWork.useGpuFBufferOps),
+ ir->delta_t, true, bCalcVir, shake_vir, doTemperatureScaling, ekind->tcstat,
+ doParrinelloRahman, ir->nstpcouple * ir->delta_t, M);
- ArrayRefWithPadding<const RVec> forceCombined =
- (fr->useMts && step % ir->mtsLevels[1].stepFactor == 0)
- ? f.view().forceMtsCombinedWithPadding()
- : f.view().forceWithPadding();
- upd.update_coords(*ir, step, mdatoms, state, forceCombined, fcdata, ekind, M,
- etrtPOSITION, cr, constr != nullptr);
+ // Copy velocities D2H after update if:
+ // - Globals are computed this step (includes the energy output steps).
+ // - Temperature is needed for the next step.
+ if (bGStat || needHalfStepKineticEnergy)
+ {
+ stateGpu->copyVelocitiesFromGpu(state->v, AtomLocality::Local);
+ stateGpu->waitVelocitiesReadyOnHost(AtomLocality::Local);
+ }
+ }
+ else
+ {
+ /* With multiple time stepping we need to do an additional normal
+ * update step to obtain the virial, as the actual MTS integration
+ * using an acceleration where the slow forces are multiplied by mtsFactor.
+ * Using that acceleration would result in a virial with the slow
+ * force contribution would be a factor mtsFactor too large.
+ */
+ if (fr->useMts && bCalcVir && constr != nullptr)
+ {
+ upd.update_for_constraint_virial(*ir, *mdatoms, *state,
+ f.view().forceWithPadding(), *ekind);
- wallcycle_stop(wcycle, ewcUPDATE);
+ constrain_coordinates(constr, do_log, do_ene, step, state,
+ upd.xp()->arrayRefWithPadding(), &dvdl_constr, bCalcVir,
+ shake_vir);
+ }
- constrain_coordinates(constr, do_log, do_ene, step, state, upd.xp()->arrayRefWithPadding(),
- &dvdl_constr, bCalcVir && !fr->useMts, shake_vir);
+ ArrayRefWithPadding<const RVec> forceCombined =
+ (fr->useMts && step % ir->mtsLevels[1].stepFactor == 0)
+ ? f.view().forceMtsCombinedWithPadding()
+ : f.view().forceWithPadding();
+ upd.update_coords(*ir, step, mdatoms, state, forceCombined, fcdata, ekind, M,
+ etrtPOSITION, cr, constr != nullptr);
- upd.update_sd_second_half(*ir, step, &dvdl_constr, mdatoms, state, cr, nrnb, wcycle,
- constr, do_log, do_ene);
- upd.finish_update(*ir, mdatoms, state, wcycle, constr != nullptr);
- }
+ wallcycle_stop(wcycle, ewcUPDATE);
- if (ir->bPull && ir->pull->bSetPbcRefToPrevStepCOM)
- {
- updatePrevStepPullCom(pull_work, state);
- }
+ constrain_coordinates(constr, do_log, do_ene, step, state,
+ upd.xp()->arrayRefWithPadding(), &dvdl_constr,
+ bCalcVir && !fr->useMts, shake_vir);
- if (ir->eI == eiVVAK)
- {
- /* erase F_EKIN and F_TEMP here? */
- /* just compute the kinetic energy at the half step to perform a trotter step */
- compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
- makeConstArrayRef(state->v), state->box, mdatoms, nrnb, &vcm, wcycle, enerd,
- force_vir, shake_vir, total_vir, pres, constr, &nullSignaller, lastbox,
- nullptr, &bSumEkinhOld, (bGStat ? CGLO_GSTAT : 0) | CGLO_TEMPERATURE);
- wallcycle_start(wcycle, ewcUPDATE);
- trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, &MassQ, trotter_seq, ettTSEQ4);
- /* now we know the scaling, we can compute the positions again */
- std::copy(cbuf.begin(), cbuf.end(), state->x.begin());
+ upd.update_sd_second_half(*ir, step, &dvdl_constr, mdatoms, state, cr, nrnb, wcycle,
+ constr, do_log, do_ene);
+ upd.finish_update(*ir, mdatoms, state, wcycle, constr != nullptr);
+ }
- upd.update_coords(*ir, step, mdatoms, state, f.view().forceWithPadding(), fcdata, ekind,
- M, etrtPOSITION, cr, constr != nullptr);
- wallcycle_stop(wcycle, ewcUPDATE);
+ if (ir->bPull && ir->pull->bSetPbcRefToPrevStepCOM)
+ {
+ updatePrevStepPullCom(pull_work, state);
+ }
- /* do we need an extra constraint here? just need to copy out of as_rvec_array(state->v.data()) to upd->xp? */
- /* are the small terms in the shake_vir here due
- * to numerical errors, or are they important
- * physically? I'm thinking they are just errors, but not completely sure.
- * For now, will call without actually constraining, constr=NULL*/
- upd.finish_update(*ir, mdatoms, state, wcycle, false);
- }
- if (EI_VV(ir->eI))
- {
- /* this factor or 2 correction is necessary
- because half of the constraint force is removed
- in the vv step, so we have to double it. See
- the Issue #1255. It is not yet clear
- if the factor of 2 is exact, or just a very
- good approximation, and this will be
- investigated. The next step is to see if this
- can be done adding a dhdl contribution from the
- rattle step, but this is somewhat more
- complicated with the current code. Will be
- investigated, hopefully for 4.6.3. However,
- this current solution is much better than
- having it completely wrong.
- */
- enerd->term[F_DVDL_CONSTR] += 2 * dvdl_constr;
- }
- else
- {
enerd->term[F_DVDL_CONSTR] += dvdl_constr;
}
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2015,2016,2019, by the GROMACS development team, led by
+# Copyright (c) 2015,2016,2019,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(mdrunutility INTERFACE)
gmx_add_libgromacs_sources(
handlerestart.cpp
logging.cpp
threadaffinity.cpp
)
+# Source files have the following private module dependencies.
+target_link_libraries(mdrunutility PRIVATE
+# gmxlib
+# math
+# mdtypes
+# tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(mdrunutility PUBLIC
+target_include_directories(mdrunutility INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(mdrunutility PUBLIC
+target_link_libraries(mdrunutility INTERFACE
+ legacy_api
+ )
+
+# TODO: when mdrunutility is an OBJECT target
+#target_link_libraries(mdrunutility PUBLIC legacy_api)
+#target_link_libraries(mdrunutility PRIVATE common)
+
+# Module dependencies
+# mdrunutility interfaces convey transitive dependence on these modules.
+#target_link_libraries(mdrunutility PUBLIC
+target_link_libraries(mdrunutility INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(mdrunutility PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(mdrunutility PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
gmx_add_unit_test_library(mdrunutility-test-shared
threadaffinitytest.cpp)
+target_link_libraries(mdrunutility-test-shared PRIVATE common)
+target_link_libraries(mdrunutility-test-shared PUBLIC legacy_api)
gmx_add_unit_test(MdrunUtilityUnitTests mdrunutility-test
CPP_SOURCE_FILES
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2018, by the GROMACS development team, led by
+# Copyright (c) 2018,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(mdspan INTERFACE)
+
+# Public interface for modules, including dependencies and interfaces
+target_include_directories(mdspan INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
layouts.cpp
mdspan.cpp
)
+target_link_libraries(mdspan-test PRIVATE mdspan)
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(mdtypes INTERFACE)
+
file(GLOB MDTYPES_SOURCES
checkpointdata.cpp
df_history.cpp
)
endif()
+# Source files have the following private module dependencies.
+target_link_libraries(mdtypes PRIVATE
+ # gmxlib
+ # math
+ # mdtypes
+ # tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(mdtypes PUBLIC
+target_include_directories(mdtypes INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(mdtypes PUBLIC
+target_link_libraries(mdtypes INTERFACE
+ legacy_api
+ )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(mdtypes PUBLIC legacy_api)
+#target_link_libraries(mdtypes PRIVATE common)
+
+# Module dependencies
+# fileio interfaces convey transitive dependence on these modules.
+#target_link_libraries(mdtypes PUBLIC
+target_link_libraries(mdtypes INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(mdtypes PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(mdtypes PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
#include "md_enums.h"
-const char* enum_name(int index, int max_index, const char* names[])
+const char* enum_name(int index, int max_index, const char* const names[])
{
if (index < 0 || index >= max_index)
{
* \param[in] names The array
* \return the correct string or "no name defined"
*/
-const char* enum_name(int index, int max_index, const char* names[]);
+const char* enum_name(int index, int max_index, const char* const names[]);
//! Boolean strings no or yes
extern const char* yesno_names[BOOL_NR + 1];
#include "multipletimestepping.h"
+#include <optional>
+
#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/pull_params.h"
+#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/stringutil.h"
namespace gmx
{
}
}
-void assertMtsRequirements(const t_inputrec& ir)
+std::vector<MtsLevel> setupMtsLevels(const GromppMtsOpts& mtsOpts, std::vector<std::string>* errorMessages)
+{
+ std::vector<MtsLevel> mtsLevels;
+
+ if (mtsOpts.numLevels != 2)
+ {
+ if (errorMessages)
+ {
+ errorMessages->push_back("Only mts-levels = 2 is supported");
+ }
+ }
+ else
+ {
+ mtsLevels.resize(2);
+
+ const std::vector<std::string> inputForceGroups = gmx::splitString(mtsOpts.level2Forces);
+ auto& forceGroups = mtsLevels[1].forceGroups;
+ for (const auto& inputForceGroup : inputForceGroups)
+ {
+ bool found = false;
+ int nameIndex = 0;
+ for (const auto& forceGroupName : gmx::mtsForceGroupNames)
+ {
+ if (gmx::equalCaseInsensitive(inputForceGroup, forceGroupName))
+ {
+ forceGroups.set(nameIndex);
+ found = true;
+ }
+ nameIndex++;
+ }
+ if (!found && errorMessages)
+ {
+ errorMessages->push_back(
+ gmx::formatString("Unknown MTS force group '%s'", inputForceGroup.c_str()));
+ }
+ }
+
+ // Make the level 0 use the complement of the force groups of group 1
+ mtsLevels[0].forceGroups = ~mtsLevels[1].forceGroups;
+ mtsLevels[0].stepFactor = 1;
+
+ mtsLevels[1].stepFactor = mtsOpts.level2Factor;
+
+ if (errorMessages && mtsLevels[1].stepFactor <= 1)
+ {
+ errorMessages->push_back("mts-factor should be larger than 1");
+ }
+ }
+
+ return mtsLevels;
+}
+
+bool haveValidMtsSetup(const t_inputrec& ir)
+{
+ return (ir.useMts && ir.mtsLevels.size() == 2 && ir.mtsLevels[1].stepFactor > 1);
+}
+
+namespace
+{
+
+//! Checks whether \p nstValue is a multiple of the largest MTS step, returns an error string for parameter \p param when this is not the case
+std::optional<std::string> checkMtsInterval(ArrayRef<const MtsLevel> mtsLevels, const char* param, const int nstValue)
+{
+ GMX_RELEASE_ASSERT(mtsLevels.size() >= 2, "Need at least two levels for MTS");
+
+ const int mtsFactor = mtsLevels.back().stepFactor;
+ if (nstValue % mtsFactor == 0)
+ {
+ return {};
+ }
+ else
+ {
+ return gmx::formatString("With MTS, %s = %d should be a multiple of mts-factor = %d", param,
+ nstValue, mtsFactor);
+ }
+}
+
+} // namespace
+
+std::vector<std::string> checkMtsRequirements(const t_inputrec& ir)
{
+ std::vector<std::string> errorMessages;
+
if (!ir.useMts)
{
- return;
+ return errorMessages;
}
- GMX_RELEASE_ASSERT(ir.mtsLevels.size() >= 2, "Need at least two levels for MTS");
+ GMX_RELEASE_ASSERT(haveValidMtsSetup(ir), "MTS setup should be valid here");
+
+ ArrayRef<const MtsLevel> mtsLevels = ir.mtsLevels;
+
+ if (!(ir.eI == eiMD || ir.eI == eiSD1))
+ {
+ errorMessages.push_back(gmx::formatString(
+ "Multiple time stepping is only supported with integrators %s and %s",
+ ei_names[eiMD], ei_names[eiSD1]));
+ }
- GMX_RELEASE_ASSERT(ir.mtsLevels[0].stepFactor == 1, "Base MTS step should be 1");
+ if ((EEL_FULL(ir.coulombtype) || EVDW_PME(ir.vdwtype))
+ && forceGroupMtsLevel(ir.mtsLevels, MtsForceGroups::LongrangeNonbonded) == 0)
+ {
+ errorMessages.emplace_back(
+ "With long-range electrostatics and/or LJ treatment, the long-range part "
+ "has to be part of the mts-level2-forces");
+ }
- GMX_RELEASE_ASSERT((!EEL_FULL(ir.coulombtype) && !EVDW_PME(ir.vdwtype))
- || forceGroupMtsLevel(ir.mtsLevels, MtsForceGroups::LongrangeNonbonded) > 0,
- "Long-range nonbondeds should be in the highest MTS level");
+ std::optional<std::string> mesg;
+ if (ir.nstcalcenergy > 0)
+ {
+ if ((mesg = checkMtsInterval(mtsLevels, "nstcalcenergy", ir.nstcalcenergy)))
+ {
+ errorMessages.push_back(mesg.value());
+ }
+ }
+ if ((mesg = checkMtsInterval(mtsLevels, "nstenergy", ir.nstenergy)))
+ {
+ errorMessages.push_back(mesg.value());
+ }
+ if ((mesg = checkMtsInterval(mtsLevels, "nstlog", ir.nstlog)))
+ {
+ errorMessages.push_back(mesg.value());
+ }
+ if ((mesg = checkMtsInterval(mtsLevels, "nstfout", ir.nstfout)))
+ {
+ errorMessages.push_back(mesg.value());
+ }
+ if (ir.efep != efepNO)
+ {
+ if ((mesg = checkMtsInterval(mtsLevels, "nstdhdl", ir.fepvals->nstdhdl)))
+ {
+ errorMessages.push_back(mesg.value());
+ }
+ }
+ if (mtsLevels.back().forceGroups[static_cast<int>(gmx::MtsForceGroups::Nonbonded)])
+ {
+ if ((mesg = checkMtsInterval(mtsLevels, "nstlist", ir.nstlist)))
+ {
+ errorMessages.push_back(mesg.value());
+ }
+ }
- for (const auto& mtsLevel : ir.mtsLevels)
+ if (ir.bPull)
{
- const int mtsFactor = mtsLevel.stepFactor;
- GMX_RELEASE_ASSERT(ir.nstcalcenergy % mtsFactor == 0,
- "nstcalcenergy should be a multiple of mtsFactor");
- GMX_RELEASE_ASSERT(ir.nstenergy % mtsFactor == 0,
- "nstenergy should be a multiple of mtsFactor");
- GMX_RELEASE_ASSERT(ir.nstlog % mtsFactor == 0, "nstlog should be a multiple of mtsFactor");
- GMX_RELEASE_ASSERT(ir.epc == epcNO || ir.nstpcouple % mtsFactor == 0,
- "nstpcouple should be a multiple of mtsFactor");
- GMX_RELEASE_ASSERT(ir.efep == efepNO || ir.fepvals->nstdhdl % mtsFactor == 0,
- "nstdhdl should be a multiple of mtsFactor");
- if (ir.mtsLevels.back().forceGroups[static_cast<int>(gmx::MtsForceGroups::Nonbonded)])
+ const int pullMtsLevel = gmx::forceGroupMtsLevel(ir.mtsLevels, gmx::MtsForceGroups::Pull);
+ const int mtsStepFactor = ir.mtsLevels[pullMtsLevel].stepFactor;
+ if (ir.pull->nstxout % mtsStepFactor != 0)
+ {
+ errorMessages.emplace_back("pull-nstxout should be a multiple of mts-factor");
+ }
+ if (ir.pull->nstfout % mtsStepFactor != 0)
{
- GMX_RELEASE_ASSERT(ir.nstlist % ir.mtsLevels.back().stepFactor == 0,
- "With multiple time stepping for the non-bonded pair interactions, "
- "nstlist should be a "
- "multiple of mtsFactor");
+ errorMessages.emplace_back("pull-nstfout should be a multiple of mts-factor");
}
}
+
+ return errorMessages;
}
} // namespace gmx
#ifndef GMX_MULTIPLETIMESTEPPING_H
#define GMX_MULTIPLETIMESTEPPING_H
+#include <string>
+#include <vector>
+
#include <bitset>
#include "gromacs/utility/arrayref.h"
Count //!< The number of groups above
};
+//! Names for the MTS force groups
static const gmx::EnumerationArray<MtsForceGroups, std::string> mtsForceGroupNames = {
"longrange-nonbonded", "nonbonded", "pair", "dihedral", "angle", "pull", "awh"
};
*/
int nonbondedMtsFactor(const t_inputrec& ir);
-//! (Release) Asserts that all multiple time-stepping requirements on \p ir are fulfilled
-void assertMtsRequirements(const t_inputrec& ir);
+//! Struct for passing the MTS mdp options to setupMtsLevels()
+struct GromppMtsOpts
+{
+ //! The number of MTS levels
+ int numLevels = 0;
+ //! The names of the force groups assigned by the user to level 2, internal index 1
+ std::string level2Forces;
+ //! The step factor assigned by the user to level 2, internal index 1
+ int level2Factor = 0;
+};
+
+/*! \brief Sets up and returns the MTS levels and checks requirements of MTS
+ *
+ * Appends errors about allowed input values ir to errorMessages, when not nullptr.
+ *
+ * \param[in] mtsOpts Options for setting the MTS levels
+ * \param[in,out] errorMessages List of error messages, can be nullptr
+ */
+std::vector<MtsLevel> setupMtsLevels(const GromppMtsOpts& mtsOpts, std::vector<std::string>* errorMessages);
+
+/*! \brief Returns whether we use MTS and the MTS setup is internally valid
+ *
+ * Note that setupMtsLevels would have returned at least one error message
+ * when this function returns false
+ */
+bool haveValidMtsSetup(const t_inputrec& ir);
+
+/*! \brief Checks whether the MTS requirements on other algorithms and output frequencies are met
+ *
+ * Note: exits with an assertion failure when
+ * ir.useMts == true && haveValidMtsSetup(ir) == false
+ *
+ * \param[in] ir Complete input record
+ * \returns list of error messages, empty when all MTS requirements are met
+ */
+std::vector<std::string> checkMtsRequirements(const t_inputrec& ir);
} // namespace gmx
CPP_SOURCE_FILES
checkpointdata.cpp
forcebuffers.cpp
+ multipletimestepping.cpp
)
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2020, 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.
+ */
+/*! \internal \file
+ * \brief
+ * Tests for the MultipleTimeStepping class and stand-alone functions.
+ *
+ * \author berk Hess <hess@kth.se>
+ * \ingroup module_mdtypes
+ */
+#include "gmxpre.h"
+
+#include "gromacs/mdtypes/multipletimestepping.h"
+
+#include <gmock/gmock.h>
+#include <gtest/gtest.h>
+
+#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/utility/gmxassert.h"
+#include "gromacs/utility/smalloc.h"
+
+#include "testutils/testasserts.h"
+
+namespace gmx
+{
+
+namespace test
+{
+
+namespace
+{
+
+//! brief Sets up the MTS levels in \p ir and tests whether the number of errors matches \p numExpectedErrors
+void setAndCheckMtsLevels(const GromppMtsOpts& mtsOpts, t_inputrec* ir, const int numExpectedErrors)
+{
+ std::vector<std::string> errorMessages;
+ ir->useMts = true;
+ ir->mtsLevels = setupMtsLevels(mtsOpts, &errorMessages);
+
+ if (haveValidMtsSetup(*ir))
+ {
+ std::vector<std::string> errorMessagesCheck = checkMtsRequirements(*ir);
+
+ // Concatenate the two lists with error messages
+ errorMessages.insert(errorMessages.end(), errorMessagesCheck.begin(), errorMessagesCheck.end());
+ }
+
+ EXPECT_EQ(errorMessages.size(), numExpectedErrors);
+}
+
+} // namespace
+
+//! Checks that only numLevels = 2 does not produce an error
+TEST(MultipleTimeStepping, ChecksNumLevels)
+{
+ for (int numLevels = 0; numLevels <= 3; numLevels++)
+ {
+ GromppMtsOpts mtsOpts;
+ mtsOpts.numLevels = numLevels;
+ mtsOpts.level2Factor = 2;
+
+ t_inputrec ir;
+
+ setAndCheckMtsLevels(mtsOpts, &ir, numLevels != 2 ? 1 : 0);
+ }
+}
+
+//! Test that each force group works
+TEST(MultipleTimeStepping, SelectsForceGroups)
+{
+ for (int forceGroupIndex = 0; forceGroupIndex < static_cast<int>(MtsForceGroups::Count);
+ forceGroupIndex++)
+ {
+ const MtsForceGroups forceGroup = static_cast<MtsForceGroups>(forceGroupIndex);
+ SCOPED_TRACE("Testing force group " + mtsForceGroupNames[forceGroup]);
+
+ GromppMtsOpts mtsOpts;
+ mtsOpts.numLevels = 2;
+ mtsOpts.level2Forces = mtsForceGroupNames[forceGroup];
+ mtsOpts.level2Factor = 2;
+
+ t_inputrec ir;
+
+ setAndCheckMtsLevels(mtsOpts, &ir, 0);
+
+ EXPECT_EQ(ir.mtsLevels[1].forceGroups.count(), 1);
+ EXPECT_EQ(ir.mtsLevels[1].forceGroups[forceGroupIndex], true);
+ }
+}
+
+//! Checks that factor is checked
+TEST(MultipleTimeStepping, ChecksStepFactor)
+{
+ for (int stepFactor = 0; stepFactor <= 3; stepFactor++)
+ {
+ GromppMtsOpts mtsOpts;
+ mtsOpts.numLevels = 2;
+ mtsOpts.level2Factor = stepFactor;
+
+ t_inputrec ir;
+
+ setAndCheckMtsLevels(mtsOpts, &ir, stepFactor < 2 ? 1 : 0);
+ }
+}
+
+namespace
+{
+
+GromppMtsOpts simpleMtsOpts()
+{
+ GromppMtsOpts mtsOpts;
+ mtsOpts.numLevels = 2;
+ mtsOpts.level2Forces = "nonbonded";
+ mtsOpts.level2Factor = 4;
+
+ return mtsOpts;
+}
+
+} // namespace
+
+TEST(MultipleTimeStepping, ChecksPmeIsAtLastLevel)
+{
+ const GromppMtsOpts mtsOpts = simpleMtsOpts();
+
+ t_inputrec ir;
+ ir.coulombtype = eelPME;
+
+ setAndCheckMtsLevels(mtsOpts, &ir, 1);
+}
+
+//! Test fixture base for parametrizing interval tests
+using MtsIntervalTestParams = std::tuple<std::string, int>;
+class MtsIntervalTest : public ::testing::Test, public ::testing::WithParamInterface<MtsIntervalTestParams>
+{
+public:
+ MtsIntervalTest()
+ {
+ const auto params = GetParam();
+ const auto& parameterName = std::get<0>(params);
+ const auto interval = std::get<1>(params);
+ numExpectedErrors_ = (interval == 4 ? 0 : 1);
+
+ if (parameterName == "nstcalcenergy")
+ {
+ ir_.nstcalcenergy = interval;
+ }
+ else if (parameterName == "nstenergy")
+ {
+ ir_.nstenergy = interval;
+ }
+ else if (parameterName == "nstfout")
+ {
+ ir_.nstfout = interval;
+ }
+ else if (parameterName == "nstlist")
+ {
+ ir_.nstlist = interval;
+ }
+ else if (parameterName == "nstdhdl")
+ {
+ ir_.efep = efepYES;
+ ir_.fepvals->nstdhdl = interval;
+ }
+ else
+
+ {
+ GMX_RELEASE_ASSERT(false, "unknown parameter name");
+ }
+ }
+
+ t_inputrec ir_;
+ int numExpectedErrors_;
+};
+
+TEST_P(MtsIntervalTest, Works)
+{
+ const GromppMtsOpts mtsOpts = simpleMtsOpts();
+
+ setAndCheckMtsLevels(mtsOpts, &ir_, numExpectedErrors_);
+}
+
+INSTANTIATE_TEST_CASE_P(
+ ChecksStepInterval,
+ MtsIntervalTest,
+ ::testing::Combine(
+ ::testing::Values("nstcalcenergy", "nstenergy", "nstfout", "nstlist", "nstdhdl"),
+ ::testing::Values(3, 4, 5)));
+
+// Check that correct input does not produce errors
+TEST(MultipleTimeStepping, ChecksIntegrator)
+{
+ const GromppMtsOpts mtsOpts = simpleMtsOpts();
+
+ t_inputrec ir;
+ ir.eI = eiBD;
+
+ setAndCheckMtsLevels(mtsOpts, &ir, 1);
+}
+
+} // namespace test
+} // namespace gmx
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2018,2019,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-gmx_add_libgromacs_sources(
- communicator.cpp
- utilities.cpp
+# Set up the module library
+add_library(mimic INTERFACE)
+file(GLOB MIMIC_SOURCES *.cpp)
+set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${MIMIC_SOURCES} PARENT_SCOPE)
+
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(mimic PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(mimic PUBLIC
+target_include_directories(mimic INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(mimic PUBLIC
+target_link_libraries(mimic INTERFACE
+ legacy_api
)
+# TODO: when mimic is an OBJECT target
+#target_link_libraries(mimic PUBLIC legacy_api)
+#target_link_libraries(mimic PRIVATE common)
+
+# Module dependencies
+# mimic interfaces convey transitive dependence on these modules.
+#target_link_libraries(mimic PUBLIC
+target_link_libraries(mimic INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(mimic PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(mimic PRIVATE legacy_modules)
+
file(GLOB MODULARSIMULATOR_SOURCES *.cpp)
add_library(modularsimulator OBJECT ${MODULARSIMULATOR_SOURCES})
-target_include_directories(modularsimulator SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
-gmx_target_compile_options(modularsimulator)
-target_compile_definitions(modularsimulator PRIVATE HAVE_CONFIG_H)
-# Should be possible to remove this when resolving #3290
-target_include_directories(modularsimulator SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
-if(GMX_OPENMP)
+if (GMX_OPENMP)
# Explicitly set properties for modular simulator module to compile with openmp
set_target_properties(modularsimulator PROPERTIES COMPILE_OPTIONS $<TARGET_PROPERTY:OpenMP::OpenMP_CXX,INTERFACE_COMPILE_OPTIONS>)
-endif()
+endif ()
if (WIN32)
gmx_target_warning_suppression(modularsimulator /wd4244 HAS_NO_MSVC_LOSSY_CONVERSION)
gmx_target_warning_suppression(modularsimulator /wd4996 HAS_NO_MSVC_UNSAFE_FUNCTION)
-else()
+else ()
# Several std::move uses are redundant in C++14, but clang before
# 3.9 had a bug that needed them. gcc 9 can warn about their use,
# which we need to supress. This suppression should be removed
# when GROMACS requires clang 3.9 or higher.
gmx_target_warning_suppression(modularsimulator "-Wno-redundant-move" HAS_NO_REDUNDANT_MOVE)
-endif()
+endif ()
+
+target_include_directories(modularsimulator SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
+gmx_target_compile_options(modularsimulator)
+target_compile_definitions(modularsimulator PRIVATE HAVE_CONFIG_H)
+# Should be possible to remove this when resolving #3290
+target_include_directories(modularsimulator SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
+
+# Source files have the following private external dependencies.
+target_link_libraries(modularsimulator PRIVATE tng_io)
+
+# Source files have the following private infrastructure dependencies.
+target_link_libraries(modularsimulator PRIVATE common)
+
+# Source files have the following private module dependencies.
+# TODO: Explicitly link specific modules.
+target_link_libraries(modularsimulator PRIVATE legacy_modules)
+target_link_libraries(modularsimulator PRIVATE
+ gmxlib
+ math
+ mdtypes
+ tng_io
+ )
+
+# Public interface for modules, including dependencies and interfaces
+target_include_directories(modularsimulator PUBLIC
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+target_link_libraries(modularsimulator PUBLIC
+ legacy_api
+ )
+
+# Module dependencies
+# This module convey transitive dependence on these modules.
+target_link_libraries(modularsimulator PUBLIC
+ utility
+ )
list(APPEND libgromacs_object_library_dependencies modularsimulator)
set(libgromacs_object_library_dependencies ${libgromacs_object_library_dependencies} PARENT_SCOPE)
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(nbnxm INTERFACE)
+
add_subdirectory(kernels_simd_4xm)
add_subdirectory(kernels_simd_2xmm)
endif()
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${NBNXM_SOURCES} PARENT_SCOPE)
+
+
+# Source files have the following private module dependencies.
+target_link_libraries(nbnxm PRIVATE
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(nbnxm PUBLIC
+target_include_directories(nbnxm INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(nbnxm PUBLIC
+target_link_libraries(nbnxm INTERFACE
+ legacy_api
+ )
+
+# TODO: when nbnxm is an OBJECT target
+#target_link_libraries(nbnxm PUBLIC legacy_api)
+#target_link_libraries(nbnxm PRIVATE common)
+
+# Module dependencies
+# nbnxm interfaces convey transitive dependence on these modules.
+#target_link_libraries(nbnxm PUBLIC
+target_link_libraries(nbnxm INTERFACE
+ utility
+ )
\ No newline at end of file
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/gmx_omp_nthreads.h"
#include "gromacs/mdtypes/forcerec.h" // only for GET_CGINFO_*
+#include "gromacs/mdtypes/md_enums.h"
#include "gromacs/nbnxm/nbnxm.h"
#include "gromacs/pbcutil/ishift.h"
#include "gromacs/simd/simd.h"
using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
+const char* const c_ljcrNames[ljcrNR + 1] = { "none", "geometric", "Lorentz-Berthelot", nullptr };
+
void nbnxn_atomdata_t::resizeCoordinateBuffer(int numAtoms)
{
numAtoms_ = numAtoms;
}
else
{
- mesg = gmx::formatString(
- "Using %s Lennard-Jones combination rule",
- params->comb_rule == ljcrGEOM ? "geometric" : "Lorentz-Berthelot");
+ mesg = gmx::formatString("Using %s Lennard-Jones combination rule",
+ enum_name(params->comb_rule, ljcrNR, c_ljcrNames));
}
GMX_LOG(mdlog.info).asParagraph().appendText(mesg);
}
ljcrNR
};
+//! String corresponding to LJ combination rule
+extern const char* const c_ljcrNames[ljcrNR + 1];
+
/*! \internal
* \brief Struct that stores atom related data for the nbnxn module
*
*/
/*! Force-only kernel function pointers. */
-static const nbnxn_cu_kfunc_ptr_t nb_kfunc_noener_noprune_ptr[eelTypeNR][evdwTypeNR] = {
+static const nbnxn_cu_kfunc_ptr_t nb_kfunc_noener_noprune_ptr[c_numElecTypes][c_numVdwTypes] = {
{ nbnxn_kernel_ElecCut_VdwLJ_F_cuda, nbnxn_kernel_ElecCut_VdwLJCombGeom_F_cuda,
nbnxn_kernel_ElecCut_VdwLJCombLB_F_cuda, nbnxn_kernel_ElecCut_VdwLJFsw_F_cuda,
nbnxn_kernel_ElecCut_VdwLJPsw_F_cuda, nbnxn_kernel_ElecCut_VdwLJEwCombGeom_F_cuda,
};
/*! Force + energy kernel function pointers. */
-static const nbnxn_cu_kfunc_ptr_t nb_kfunc_ener_noprune_ptr[eelTypeNR][evdwTypeNR] = {
+static const nbnxn_cu_kfunc_ptr_t nb_kfunc_ener_noprune_ptr[c_numElecTypes][c_numVdwTypes] = {
{ nbnxn_kernel_ElecCut_VdwLJ_VF_cuda, nbnxn_kernel_ElecCut_VdwLJCombGeom_VF_cuda,
nbnxn_kernel_ElecCut_VdwLJCombLB_VF_cuda, nbnxn_kernel_ElecCut_VdwLJFsw_VF_cuda,
nbnxn_kernel_ElecCut_VdwLJPsw_VF_cuda, nbnxn_kernel_ElecCut_VdwLJEwCombGeom_VF_cuda,
};
/*! Force + pruning kernel function pointers. */
-static const nbnxn_cu_kfunc_ptr_t nb_kfunc_noener_prune_ptr[eelTypeNR][evdwTypeNR] = {
+static const nbnxn_cu_kfunc_ptr_t nb_kfunc_noener_prune_ptr[c_numElecTypes][c_numVdwTypes] = {
{ nbnxn_kernel_ElecCut_VdwLJ_F_prune_cuda, nbnxn_kernel_ElecCut_VdwLJCombGeom_F_prune_cuda,
nbnxn_kernel_ElecCut_VdwLJCombLB_F_prune_cuda, nbnxn_kernel_ElecCut_VdwLJFsw_F_prune_cuda,
nbnxn_kernel_ElecCut_VdwLJPsw_F_prune_cuda, nbnxn_kernel_ElecCut_VdwLJEwCombGeom_F_prune_cuda,
};
/*! Force + energy + pruning kernel function pointers. */
-static const nbnxn_cu_kfunc_ptr_t nb_kfunc_ener_prune_ptr[eelTypeNR][evdwTypeNR] = {
+static const nbnxn_cu_kfunc_ptr_t nb_kfunc_ener_prune_ptr[c_numElecTypes][c_numVdwTypes] = {
{ nbnxn_kernel_ElecCut_VdwLJ_VF_prune_cuda, nbnxn_kernel_ElecCut_VdwLJCombGeom_VF_prune_cuda,
nbnxn_kernel_ElecCut_VdwLJCombLB_VF_prune_cuda, nbnxn_kernel_ElecCut_VdwLJFsw_VF_prune_cuda,
nbnxn_kernel_ElecCut_VdwLJPsw_VF_prune_cuda, nbnxn_kernel_ElecCut_VdwLJEwCombGeom_VF_prune_cuda,
};
/*! Return a pointer to the kernel version to be executed at the current step. */
-static inline nbnxn_cu_kfunc_ptr_t select_nbnxn_kernel(int eeltype,
- int evdwtype,
+static inline nbnxn_cu_kfunc_ptr_t select_nbnxn_kernel(enum ElecType elecType,
+ enum VdwType vdwType,
bool bDoEne,
bool bDoPrune,
const DeviceInformation gmx_unused* deviceInfo)
{
- nbnxn_cu_kfunc_ptr_t res;
+ const int elecTypeIdx = static_cast<int>(elecType);
+ const int vdwTypeIdx = static_cast<int>(vdwType);
- GMX_ASSERT(eeltype < eelTypeNR,
+ GMX_ASSERT(elecTypeIdx < c_numElecTypes,
"The electrostatics type requested is not implemented in the CUDA kernels.");
- GMX_ASSERT(evdwtype < evdwTypeNR,
+ GMX_ASSERT(vdwTypeIdx < c_numVdwTypes,
"The VdW type requested is not implemented in the CUDA kernels.");
/* assert assumptions made by the kernels */
{
if (bDoPrune)
{
- res = nb_kfunc_ener_prune_ptr[eeltype][evdwtype];
+ return nb_kfunc_ener_prune_ptr[elecTypeIdx][vdwTypeIdx];
}
else
{
- res = nb_kfunc_ener_noprune_ptr[eeltype][evdwtype];
+ return nb_kfunc_ener_noprune_ptr[elecTypeIdx][vdwTypeIdx];
}
}
else
{
if (bDoPrune)
{
- res = nb_kfunc_noener_prune_ptr[eeltype][evdwtype];
+ return nb_kfunc_noener_prune_ptr[elecTypeIdx][vdwTypeIdx];
}
else
{
- res = nb_kfunc_noener_noprune_ptr[eeltype][evdwtype];
+ return nb_kfunc_noener_noprune_ptr[elecTypeIdx][vdwTypeIdx];
}
}
-
- return res;
}
/*! \brief Calculates the amount of shared memory required by the nonbonded kernel in use. */
/* cj in shared memory, for each warp separately */
shmem += num_threads_z * c_nbnxnGpuClusterpairSplit * c_nbnxnGpuJgroupSize * sizeof(int);
- if (nbp->vdwtype == evdwTypeCUTCOMBGEOM || nbp->vdwtype == evdwTypeCUTCOMBLB)
+ if (nbp->vdwType == VdwType::CutCombGeom || nbp->vdwType == VdwType::CutCombLB)
{
/* i-atom LJ combination parameters in shared memory */
shmem += c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(float2);
auto* timingEvent = bDoTime ? t->interaction[iloc].nb_k.fetchNextEvent() : nullptr;
const auto kernel =
- select_nbnxn_kernel(nbp->eeltype, nbp->vdwtype, stepWork.computeEnergy,
+ select_nbnxn_kernel(nbp->elecType, nbp->vdwType, stepWork.computeEnergy,
(plist->haveFreshList && !nb->timers->interaction[iloc].didPrune),
&nb->deviceContext_->deviceInfo());
const auto kernelArgs =
{
cudaError_t stat;
- for (int i = 0; i < eelTypeNR; i++)
+ for (int i = 0; i < c_numElecTypes; i++)
{
- for (int j = 0; j < evdwTypeNR; j++)
+ for (int j = 0; j < c_numVdwTypes; j++)
{
/* Default kernel 32/32 kB Shared/L1 */
cudaFuncSetCacheConfig(nb_kfunc_ener_prune_ptr[i][j], cudaFuncCachePreferEqual);
const nbnxn_atomdata_t::Params& nbatParams,
const DeviceContext& deviceContext)
{
- int ntypes;
-
- ntypes = nbatParams.numTypes;
+ const int ntypes = nbatParams.numTypes;
set_cutoff_parameters(nbp, ic, listParams);
* combination is rarely used. LJ force-switch with LB rule is more common,
* but gives only 1% speed-up.
*/
- if (ic->vdwtype == evdwCUT)
- {
- switch (ic->vdw_modifier)
- {
- case eintmodNONE:
- case eintmodPOTSHIFT:
- switch (nbatParams.comb_rule)
- {
- case ljcrNONE: nbp->vdwtype = evdwTypeCUT; break;
- case ljcrGEOM: nbp->vdwtype = evdwTypeCUTCOMBGEOM; break;
- case ljcrLB: nbp->vdwtype = evdwTypeCUTCOMBLB; break;
- default:
- gmx_incons(
- "The requested LJ combination rule is not implemented in the CUDA "
- "GPU accelerated kernels!");
- }
- break;
- case eintmodFORCESWITCH: nbp->vdwtype = evdwTypeFSWITCH; break;
- case eintmodPOTSWITCH: nbp->vdwtype = evdwTypePSWITCH; break;
- default:
- gmx_incons(
- "The requested VdW interaction modifier is not implemented in the CUDA GPU "
- "accelerated kernels!");
- }
- }
- else if (ic->vdwtype == evdwPME)
- {
- if (ic->ljpme_comb_rule == ljcrGEOM)
- {
- assert(nbatParams.comb_rule == ljcrGEOM);
- nbp->vdwtype = evdwTypeEWALDGEOM;
- }
- else
- {
- assert(nbatParams.comb_rule == ljcrLB);
- nbp->vdwtype = evdwTypeEWALDLB;
- }
- }
- else
- {
- gmx_incons(
- "The requested VdW type is not implemented in the CUDA GPU accelerated kernels!");
- }
-
- if (ic->eeltype == eelCUT)
- {
- nbp->eeltype = eelTypeCUT;
- }
- else if (EEL_RF(ic->eeltype))
- {
- nbp->eeltype = eelTypeRF;
- }
- else if ((EEL_PME(ic->eeltype) || ic->eeltype == eelEWALD))
- {
- nbp->eeltype = nbnxn_gpu_pick_ewald_kernel_type(*ic);
- }
- else
- {
- /* Shouldn't happen, as this is checked when choosing Verlet-scheme */
- gmx_incons(
- "The requested electrostatics type is not implemented in the CUDA GPU accelerated "
- "kernels!");
- }
+ nbp->vdwType = nbnxmGpuPickVdwKernelType(ic, nbatParams.comb_rule);
+ nbp->elecType = nbnxmGpuPickElectrostaticsKernelType(ic);
/* generate table for PME */
nbp->coulomb_tab = nullptr;
- if (nbp->eeltype == eelTypeEWALD_TAB || nbp->eeltype == eelTypeEWALD_TAB_TWIN)
+ if (nbp->elecType == ElecType::EwaldTab || nbp->elecType == ElecType::EwaldTabTwin)
{
GMX_RELEASE_ASSERT(ic->coulombEwaldTables, "Need valid Coulomb Ewald correction tables");
init_ewald_coulomb_force_table(*ic->coulombEwaldTables, nbp, deviceContext);
}
/* set up LJ parameter lookup table */
- if (!useLjCombRule(nbp->vdwtype))
+ if (!useLjCombRule(nbp->vdwType))
{
initParamLookupTable(&nbp->nbfp, &nbp->nbfp_texobj, nbatParams.nbfp.data(),
2 * ntypes * ntypes, deviceContext);
allocateDeviceBuffer(&d_atdat->f, nalloc, deviceContext);
allocateDeviceBuffer(&d_atdat->xq, nalloc, deviceContext);
- if (useLjCombRule(nb->nbparam->vdwtype))
+ if (useLjCombRule(nb->nbparam->vdwType))
{
allocateDeviceBuffer(&d_atdat->lj_comb, nalloc, deviceContext);
}
nbnxn_cuda_clear_f(nb, nalloc);
}
- if (useLjCombRule(nb->nbparam->vdwtype))
+ if (useLjCombRule(nb->nbparam->vdwType))
{
static_assert(sizeof(d_atdat->lj_comb[0]) == sizeof(float2),
"Size of the LJ parameters element should be equal to the size of float2.");
nbparam = nb->nbparam;
if ((!nbparam->coulomb_tab)
- && (nbparam->eeltype == eelTypeEWALD_TAB || nbparam->eeltype == eelTypeEWALD_TAB_TWIN))
+ && (nbparam->elecType == ElecType::EwaldTab || nbparam->elecType == ElecType::EwaldTabTwin))
{
destroyParamLookupTable(&nbparam->coulomb_tab, nbparam->coulomb_tab_texobj);
}
delete nb->timers;
- if (!useLjCombRule(nb->nbparam->vdwtype))
+ if (!useLjCombRule(nb->nbparam->vdwType))
{
destroyParamLookupTable(&nbparam->nbfp, nbparam->nbfp_texobj);
}
- if (nbparam->vdwtype == evdwTypeEWALDGEOM || nbparam->vdwtype == evdwTypeEWALDLB)
+ if (nbparam->vdwType == VdwType::EwaldGeom || nbparam->vdwType == VdwType::EwaldLB)
{
destroyParamLookupTable(&nbparam->nbfp_comb, nbparam->nbfp_comb_texobj);
}
#include "gromacs/gpu_utils/gpu_macros.h"
#include "gromacs/mdtypes/locality.h"
+#include "nbnxm.h"
+
struct NbnxmGpu;
struct DeviceInformation;
struct gmx_wallclock_gpu_nbnxn_t;
GPU_FUNC_QUALIFIER
bool gpu_is_kernel_ewald_analytical(const NbnxmGpu gmx_unused* nb) GPU_FUNC_TERM_WITH_RETURN(FALSE);
+/** Return the enum value of electrostatics kernel type for given interaction parameters \p ic. */
+GPU_FUNC_QUALIFIER
+enum ElecType nbnxmGpuPickElectrostaticsKernelType(const interaction_const_t gmx_unused* ic)
+ GPU_FUNC_TERM_WITH_RETURN(ElecType::Count);
+
+/** Return the enum value of VdW kernel type for given \p ic and \p combRule. */
+GPU_FUNC_QUALIFIER
+enum VdwType nbnxmGpuPickVdwKernelType(const interaction_const_t gmx_unused* ic, int gmx_unused combRule)
+ GPU_FUNC_TERM_WITH_RETURN(VdwType::Count);
+
/** Returns an opaque pointer to the GPU command stream
* Note: CUDA only.
*/
#include "gromacs/mdtypes/locality.h"
#include "gromacs/utility/enumerationhelpers.h"
+#include "nbnxm.h"
#include "pairlist.h"
#if GMX_GPU_OPENCL
struct NBParamGpu
{
- //! type of electrostatics, takes values from #eelType
- int eeltype;
- //! type of VdW impl., takes values from #evdwType
- int vdwtype;
+ //! type of electrostatics
+ enum Nbnxm::ElecType elecType;
+ //! type of VdW impl.
+ enum Nbnxm::VdwType vdwType;
//! charge multiplication factor
float epsfac;
class UpdateGroupsCog;
} // namespace gmx
+//! Namespace for non-bonded kernels
namespace Nbnxm
{
enum class KernelType;
-}
-namespace Nbnxm
+/*! \brief Nbnxm electrostatic GPU kernel flavors.
+ *
+ * Types of electrostatics implementations available in the GPU non-bonded
+ * force kernels. These represent both the electrostatics types implemented
+ * by the kernels (cut-off, RF, and Ewald - a subset of what's defined in
+ * enums.h) as well as encode implementation details analytical/tabulated
+ * and single or twin cut-off (for Ewald kernels).
+ * Note that the cut-off and RF kernels have only analytical flavor and unlike
+ * in the CPU kernels, the tabulated kernels are ATM Ewald-only.
+ *
+ * The row-order of pointers to different electrostatic kernels defined in
+ * nbnxn_cuda.cu by the nb_*_kfunc_ptr function pointer table
+ * should match the order of enumerated types below.
+ */
+enum class ElecType : int
+{
+ Cut, //!< Plain cut-off
+ RF, //!< Reaction field
+ EwaldTab, //!< Tabulated Ewald with single cut-off
+ EwaldTabTwin, //!< Tabulated Ewald with twin cut-off
+ EwaldAna, //!< Analytical Ewald with single cut-off
+ EwaldAnaTwin, //!< Analytical Ewald with twin cut-off
+ Count //!< Number of valid values
+};
+
+//! Number of possible \ref ElecType values.
+constexpr int c_numElecTypes = static_cast<int>(ElecType::Count);
+
+/*! \brief Nbnxm VdW GPU kernel flavors.
+ *
+ * The enumerates values correspond to the LJ implementations in the GPU non-bonded
+ * kernels.
+ *
+ * The column-order of pointers to different electrostatic kernels defined in
+ * nbnxn_cuda_ocl.cpp/.cu by the nb_*_kfunc_ptr function pointer table
+ * should match the order of enumerated types below.
+ */
+enum class VdwType : int
{
+ Cut, //!< Plain cut-off
+ CutCombGeom, //!< Cut-off with geometric combination rules
+ CutCombLB, //!< Cut-off with Lorentz-Berthelot combination rules
+ FSwitch, //!< Smooth force switch
+ PSwitch, //!< Smooth potential switch
+ EwaldGeom, //!< Ewald with geometric combination rules
+ EwaldLB, //!< Ewald with Lorentz-Berthelot combination rules
+ Count //!< Number of valid values
+};
+
+//! Number of possible \ref VdwType values.
+constexpr int c_numVdwTypes = static_cast<int>(VdwType::Count);
/*! \brief Nonbonded NxN kernel types: plain C, CPU SIMD, GPU, GPU emulation */
enum class KernelType : int
//! Return whether the pairlist is of simple, CPU type
bool pairlistIsSimple() const { return !useGpu() && !emulateGpu(); }
- //! Initialize the pair list sets, TODO this should be private
- void initPairlistSets(bool haveMultipleDomains);
//! Returns the order of the local atoms on the grid
gmx::ArrayRef<const int> getLocalAtomOrder() const;
*/
void atomdata_add_nbat_f_to_f(gmx::AtomLocality locality, gmx::ArrayRef<gmx::RVec> force);
- /*! \brief Add the forces stored in nbat to total force using GPU buffer opse
- *
- * \param [in] locality Local or non-local
- * \param [in,out] totalForcesDevice Force to be added to
- * \param [in] forcesPmeDevice Device buffer with PME forces
- * \param[in] dependencyList List of synchronizers that represent the dependencies the reduction task needs to sync on.
- * \param [in] useGpuFPmeReduction Whether PME forces should be added
- * \param [in] accumulateForce If the total force buffer already contains data
- */
- void atomdata_add_nbat_f_to_f_gpu(gmx::AtomLocality locality,
- DeviceBuffer<gmx::RVec> totalForcesDevice,
- void* forcesPmeDevice,
- gmx::ArrayRef<GpuEventSynchronizer* const> dependencyList,
- bool useGpuFPmeReduction,
- bool accumulateForce);
-
/*! \brief Get the number of atoms for a given locality
*
* \param [in] locality Local or non-local
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
+#include "nbnxm.h"
+
struct interaction_const_t;
struct nbnxn_atomdata_t;
struct gmx_wallcycle;
class StepWorkload;
} // namespace gmx
-/*! \brief Nbnxm electrostatic GPU kernel flavors.
- *
- * Types of electrostatics implementations available in the GPU non-bonded
- * force kernels. These represent both the electrostatics types implemented
- * by the kernels (cut-off, RF, and Ewald - a subset of what's defined in
- * enums.h) as well as encode implementation details analytical/tabulated
- * and single or twin cut-off (for Ewald kernels).
- * Note that the cut-off and RF kernels have only analytical flavor and unlike
- * in the CPU kernels, the tabulated kernels are ATM Ewald-only.
- *
- * The row-order of pointers to different electrostatic kernels defined in
- * nbnxn_cuda.cu by the nb_*_kfunc_ptr function pointer table
- * should match the order of enumerated types below.
- */
-enum eelType : int
-{
- eelTypeCUT,
- eelTypeRF,
- eelTypeEWALD_TAB,
- eelTypeEWALD_TAB_TWIN,
- eelTypeEWALD_ANA,
- eelTypeEWALD_ANA_TWIN,
- eelTypeNR
-};
-
-/*! \brief Nbnxm VdW GPU kernel flavors.
- *
- * The enumerates values correspond to the LJ implementations in the GPU non-bonded
- * kernels.
- *
- * The column-order of pointers to different electrostatic kernels defined in
- * nbnxn_cuda_ocl.cpp/.cu by the nb_*_kfunc_ptr function pointer table
- * should match the order of enumerated types below.
- */
-enum evdwType : int
-{
- evdwTypeCUT,
- evdwTypeCUTCOMBGEOM,
- evdwTypeCUTCOMBLB,
- evdwTypeFSWITCH,
- evdwTypePSWITCH,
- evdwTypeEWALDGEOM,
- evdwTypeEWALDLB,
- evdwTypeNR
-};
-
namespace Nbnxm
{
/*! \brief Returns true if LJ combination rules are used in the non-bonded kernels.
*
- * \param[in] vdwType The VdW interaction/implementation type as defined by evdwType
+ * \param[in] vdwType The VdW interaction/implementation type as defined by VdwType
* enumeration.
*
* \returns Whether combination rules are used by the run.
*/
-static inline bool useLjCombRule(const int vdwType)
+static inline bool useLjCombRule(const enum VdwType vdwType)
{
- return (vdwType == evdwTypeCUTCOMBGEOM || vdwType == evdwTypeCUTCOMBLB);
+ return (vdwType == VdwType::CutCombGeom || vdwType == VdwType::CutCombLB);
}
/*! \brief
#include "nbnxm_gpu_data_mgmt.h"
+#include "gromacs/mdtypes/interaction_const.h"
#include "gromacs/nbnxm/gpu_data_mgmt.h"
#include "gromacs/timing/gpu_timing.h"
#include "gromacs/utility/cstringutil.h"
}
}
-int nbnxn_gpu_pick_ewald_kernel_type(const interaction_const_t& ic)
+enum ElecType nbnxn_gpu_pick_ewald_kernel_type(const interaction_const_t& ic)
{
bool bTwinCut = (ic.rcoulomb != ic.rvdw);
- int kernel_type;
/* Benchmarking/development environment variables to force the use of
analytical or tabulated Ewald kernel. */
forces it (use it for debugging/benchmarking only). */
if (!bTwinCut && !forceTwinCutoffEwald)
{
- kernel_type = bUseAnalyticalEwald ? eelTypeEWALD_ANA : eelTypeEWALD_TAB;
+ return bUseAnalyticalEwald ? ElecType::EwaldAna : ElecType::EwaldTab;
}
else
{
- kernel_type = bUseAnalyticalEwald ? eelTypeEWALD_ANA_TWIN : eelTypeEWALD_TAB_TWIN;
+ return bUseAnalyticalEwald ? ElecType::EwaldAnaTwin : ElecType::EwaldTabTwin;
}
-
- return kernel_type;
}
void set_cutoff_parameters(NBParamGpu* nbp, const interaction_const_t* ic, const PairlistParams& listParams)
set_cutoff_parameters(nbp, ic, nbv->pairlistSets().params());
- nbp->eeltype = nbnxn_gpu_pick_ewald_kernel_type(*ic);
+ nbp->elecType = nbnxn_gpu_pick_ewald_kernel_type(*ic);
GMX_RELEASE_ASSERT(ic->coulombEwaldTables, "Need valid Coulomb Ewald correction tables");
init_ewald_coulomb_force_table(*ic->coulombEwaldTables, nbp, *nb->deviceContext_);
bool gpu_is_kernel_ewald_analytical(const NbnxmGpu* nb)
{
- return ((nb->nbparam->eeltype == eelTypeEWALD_ANA) || (nb->nbparam->eeltype == eelTypeEWALD_ANA_TWIN));
+ return ((nb->nbparam->elecType == ElecType::EwaldAna)
+ || (nb->nbparam->elecType == ElecType::EwaldAnaTwin));
+}
+
+enum ElecType nbnxmGpuPickElectrostaticsKernelType(const interaction_const_t* ic)
+{
+ if (ic->eeltype == eelCUT)
+ {
+ return ElecType::Cut;
+ }
+ else if (EEL_RF(ic->eeltype))
+ {
+ return ElecType::RF;
+ }
+ else if ((EEL_PME(ic->eeltype) || ic->eeltype == eelEWALD))
+ {
+ return nbnxn_gpu_pick_ewald_kernel_type(*ic);
+ }
+ else
+ {
+ /* Shouldn't happen, as this is checked when choosing Verlet-scheme */
+ GMX_THROW(gmx::InconsistentInputError(
+ gmx::formatString("The requested electrostatics type %s (%d) is not implemented in "
+ "the GPU accelerated kernels!",
+ EELTYPE(ic->eeltype), ic->eeltype)));
+ }
+}
+
+
+enum VdwType nbnxmGpuPickVdwKernelType(const interaction_const_t* ic, int combRule)
+{
+ if (ic->vdwtype == evdwCUT)
+ {
+ switch (ic->vdw_modifier)
+ {
+ case eintmodNONE:
+ case eintmodPOTSHIFT:
+ switch (combRule)
+ {
+ case ljcrNONE: return VdwType::Cut;
+ case ljcrGEOM: return VdwType::CutCombGeom;
+ case ljcrLB: return VdwType::CutCombLB;
+ default:
+ GMX_THROW(gmx::InconsistentInputError(gmx::formatString(
+ "The requested LJ combination rule %s (%d) is not implemented in "
+ "the GPU accelerated kernels!",
+ enum_name(combRule, ljcrNR, c_ljcrNames), combRule)));
+ }
+ case eintmodFORCESWITCH: return VdwType::FSwitch;
+ case eintmodPOTSWITCH: return VdwType::PSwitch;
+ default:
+ GMX_THROW(gmx::InconsistentInputError(
+ gmx::formatString("The requested VdW interaction modifier %s (%d) is not "
+ "implemented in the GPU accelerated kernels!",
+ INTMODIFIER(ic->vdw_modifier), ic->vdw_modifier)));
+ }
+ }
+ else if (ic->vdwtype == evdwPME)
+ {
+ if (ic->ljpme_comb_rule == ljcrGEOM)
+ {
+ assert(combRule == ljcrGEOM);
+ return VdwType::EwaldGeom;
+ }
+ else
+ {
+ assert(combRule == ljcrLB);
+ return VdwType::EwaldLB;
+ }
+ }
+ else
+ {
+ GMX_THROW(gmx::InconsistentInputError(gmx::formatString(
+ "The requested VdW type %s (%d) is not implemented in the GPU accelerated kernels!",
+ EVDWTYPE(ic->vdwtype), ic->vdwtype)));
+ }
}
} // namespace Nbnxm
const DeviceContext& deviceContext);
/*! \brief Selects the Ewald kernel type, analytical or tabulated, single or twin cut-off. */
-int nbnxn_gpu_pick_ewald_kernel_type(const interaction_const_t gmx_unused& ic);
+enum ElecType nbnxn_gpu_pick_ewald_kernel_type(const interaction_const_t gmx_unused& ic);
/*! \brief Copies all parameters related to the cut-off from ic to nbp
*/
*/
/*! \brief Force-only kernel function names. */
-static const char* nb_kfunc_noener_noprune_ptr[eelTypeNR][evdwTypeNR] = {
+static const char* nb_kfunc_noener_noprune_ptr[c_numElecTypes][c_numVdwTypes] = {
{ "nbnxn_kernel_ElecCut_VdwLJ_F_opencl", "nbnxn_kernel_ElecCut_VdwLJCombGeom_F_opencl",
"nbnxn_kernel_ElecCut_VdwLJCombLB_F_opencl", "nbnxn_kernel_ElecCut_VdwLJFsw_F_opencl",
"nbnxn_kernel_ElecCut_VdwLJPsw_F_opencl", "nbnxn_kernel_ElecCut_VdwLJEwCombGeom_F_opencl",
};
/*! \brief Force + energy kernel function pointers. */
-static const char* nb_kfunc_ener_noprune_ptr[eelTypeNR][evdwTypeNR] = {
+static const char* nb_kfunc_ener_noprune_ptr[c_numElecTypes][c_numVdwTypes] = {
{ "nbnxn_kernel_ElecCut_VdwLJ_VF_opencl", "nbnxn_kernel_ElecCut_VdwLJCombGeom_VF_opencl",
"nbnxn_kernel_ElecCut_VdwLJCombLB_VF_opencl", "nbnxn_kernel_ElecCut_VdwLJFsw_VF_opencl",
"nbnxn_kernel_ElecCut_VdwLJPsw_VF_opencl", "nbnxn_kernel_ElecCut_VdwLJEwCombGeom_VF_opencl",
};
/*! \brief Force + pruning kernel function pointers. */
-static const char* nb_kfunc_noener_prune_ptr[eelTypeNR][evdwTypeNR] = {
+static const char* nb_kfunc_noener_prune_ptr[c_numElecTypes][c_numVdwTypes] = {
{ "nbnxn_kernel_ElecCut_VdwLJ_F_prune_opencl",
"nbnxn_kernel_ElecCut_VdwLJCombGeom_F_prune_opencl",
"nbnxn_kernel_ElecCut_VdwLJCombLB_F_prune_opencl",
};
/*! \brief Force + energy + pruning kernel function pointers. */
-static const char* nb_kfunc_ener_prune_ptr[eelTypeNR][evdwTypeNR] = {
+static const char* nb_kfunc_ener_prune_ptr[c_numElecTypes][c_numVdwTypes] = {
{ "nbnxn_kernel_ElecCut_VdwLJ_VF_prune_opencl",
"nbnxn_kernel_ElecCut_VdwLJCombGeom_VF_prune_opencl",
"nbnxn_kernel_ElecCut_VdwLJCombLB_VF_prune_opencl",
* OpenCL kernel objects are cached in nb. If the requested kernel is not
* found in the cache, it will be created and the cache will be updated.
*/
-static inline cl_kernel select_nbnxn_kernel(NbnxmGpu* nb, int eeltype, int evdwtype, bool bDoEne, bool bDoPrune)
+static inline cl_kernel
+select_nbnxn_kernel(NbnxmGpu* nb, enum ElecType elecType, enum VdwType vdwType, bool bDoEne, bool bDoPrune)
{
const char* kernel_name_to_run;
cl_kernel* kernel_ptr;
cl_int cl_error;
- GMX_ASSERT(eeltype < eelTypeNR,
+ const int elecTypeIdx = static_cast<int>(elecType);
+ const int vdwTypeIdx = static_cast<int>(vdwType);
+
+ GMX_ASSERT(elecTypeIdx < c_numElecTypes,
"The electrostatics type requested is not implemented in the OpenCL kernels.");
- GMX_ASSERT(evdwtype < evdwTypeNR,
+ GMX_ASSERT(vdwTypeIdx < c_numVdwTypes,
"The VdW type requested is not implemented in the OpenCL kernels.");
if (bDoEne)
{
if (bDoPrune)
{
- kernel_name_to_run = nb_kfunc_ener_prune_ptr[eeltype][evdwtype];
- kernel_ptr = &(nb->kernel_ener_prune_ptr[eeltype][evdwtype]);
+ kernel_name_to_run = nb_kfunc_ener_prune_ptr[elecTypeIdx][vdwTypeIdx];
+ kernel_ptr = &(nb->kernel_ener_prune_ptr[elecTypeIdx][vdwTypeIdx]);
}
else
{
- kernel_name_to_run = nb_kfunc_ener_noprune_ptr[eeltype][evdwtype];
- kernel_ptr = &(nb->kernel_ener_noprune_ptr[eeltype][evdwtype]);
+ kernel_name_to_run = nb_kfunc_ener_noprune_ptr[elecTypeIdx][vdwTypeIdx];
+ kernel_ptr = &(nb->kernel_ener_noprune_ptr[elecTypeIdx][vdwTypeIdx]);
}
}
else
{
if (bDoPrune)
{
- kernel_name_to_run = nb_kfunc_noener_prune_ptr[eeltype][evdwtype];
- kernel_ptr = &(nb->kernel_noener_prune_ptr[eeltype][evdwtype]);
+ kernel_name_to_run = nb_kfunc_noener_prune_ptr[elecTypeIdx][vdwTypeIdx];
+ kernel_ptr = &(nb->kernel_noener_prune_ptr[elecTypeIdx][vdwTypeIdx]);
}
else
{
- kernel_name_to_run = nb_kfunc_noener_noprune_ptr[eeltype][evdwtype];
- kernel_ptr = &(nb->kernel_noener_noprune_ptr[eeltype][evdwtype]);
+ kernel_name_to_run = nb_kfunc_noener_noprune_ptr[elecTypeIdx][vdwTypeIdx];
+ kernel_ptr = &(nb->kernel_noener_noprune_ptr[elecTypeIdx][vdwTypeIdx]);
}
}
/*! \brief Calculates the amount of shared memory required by the nonbonded kernel in use.
*/
-static inline int calc_shmem_required_nonbonded(int vdwType, bool bPrefetchLjParam)
+static inline int calc_shmem_required_nonbonded(enum VdwType vdwType, bool bPrefetchLjParam)
{
int shmem;
nbparams_params->coulomb_tab_scale = nbp->coulomb_tab_scale;
nbparams_params->c_rf = nbp->c_rf;
nbparams_params->dispersion_shift = nbp->dispersion_shift;
- nbparams_params->eeltype = nbp->eeltype;
+ nbparams_params->elecType = nbp->elecType;
nbparams_params->epsfac = nbp->epsfac;
nbparams_params->ewaldcoeff_lj = nbp->ewaldcoeff_lj;
nbparams_params->ewald_beta = nbp->ewald_beta;
nbparams_params->sh_ewald = nbp->sh_ewald;
nbparams_params->sh_lj_ewald = nbp->sh_lj_ewald;
nbparams_params->two_k_rf = nbp->two_k_rf;
- nbparams_params->vdwtype = nbp->vdwtype;
+ nbparams_params->vdwType = nbp->vdwType;
nbparams_params->vdw_switch = nbp->vdw_switch;
}
/* kernel launch config */
KernelLaunchConfig config;
- config.sharedMemorySize = calc_shmem_required_nonbonded(nbp->vdwtype, nb->bPrefetchLjParam);
+ config.sharedMemorySize = calc_shmem_required_nonbonded(nbp->vdwType, nb->bPrefetchLjParam);
config.blockSize[0] = c_clSize;
config.blockSize[1] = c_clSize;
config.gridSize[0] = plist->nsci;
auto* timingEvent = bDoTime ? t->interaction[iloc].nb_k.fetchNextEvent() : nullptr;
constexpr char kernelName[] = "k_calc_nb";
const auto kernel =
- select_nbnxn_kernel(nb, nbp->eeltype, nbp->vdwtype, stepWork.computeEnergy,
+ select_nbnxn_kernel(nb, nbp->elecType, nbp->vdwType, stepWork.computeEnergy,
(plist->haveFreshList && !nb->timers->interaction[iloc].didPrune));
// The OpenCL kernel takes int as second to last argument because bool is
// not supported as a kernel argument type (sizeof(bool) is implementation defined).
const int computeFshift = static_cast<int>(stepWork.computeVirial);
- if (useLjCombRule(nb->nbparam->vdwtype))
+ if (useLjCombRule(nb->nbparam->vdwType))
{
const auto kernelArgs = prepareGpuKernelArguments(
kernel, config, &nbparams_params, &adat->xq, &adat->f, &adat->e_lj, &adat->e_el,
ad->nalloc = -1;
}
-/*! \brief Returns the kinds of electrostatics and Vdw OpenCL
- * kernels that will be used.
- *
- * Respectively, these values are from enum eelOcl and enum
- * evdwOcl. */
-static void map_interaction_types_to_gpu_kernel_flavors(const interaction_const_t* ic,
- int combRule,
- int* gpu_eeltype,
- int* gpu_vdwtype)
-{
- if (ic->vdwtype == evdwCUT)
- {
- switch (ic->vdw_modifier)
- {
- case eintmodNONE:
- case eintmodPOTSHIFT:
- switch (combRule)
- {
- case ljcrNONE: *gpu_vdwtype = evdwTypeCUT; break;
- case ljcrGEOM: *gpu_vdwtype = evdwTypeCUTCOMBGEOM; break;
- case ljcrLB: *gpu_vdwtype = evdwTypeCUTCOMBLB; break;
- default:
- gmx_incons(
- "The requested LJ combination rule is not implemented in the "
- "OpenCL GPU accelerated kernels!");
- }
- break;
- case eintmodFORCESWITCH: *gpu_vdwtype = evdwTypeFSWITCH; break;
- case eintmodPOTSWITCH: *gpu_vdwtype = evdwTypePSWITCH; break;
- default:
- gmx_incons(
- "The requested VdW interaction modifier is not implemented in the GPU "
- "accelerated kernels!");
- }
- }
- else if (ic->vdwtype == evdwPME)
- {
- if (ic->ljpme_comb_rule == ljcrGEOM)
- {
- *gpu_vdwtype = evdwTypeEWALDGEOM;
- }
- else
- {
- *gpu_vdwtype = evdwTypeEWALDLB;
- }
- }
- else
- {
- gmx_incons("The requested VdW type is not implemented in the GPU accelerated kernels!");
- }
-
- if (ic->eeltype == eelCUT)
- {
- *gpu_eeltype = eelTypeCUT;
- }
- else if (EEL_RF(ic->eeltype))
- {
- *gpu_eeltype = eelTypeRF;
- }
- else if ((EEL_PME(ic->eeltype) || ic->eeltype == eelEWALD))
- {
- *gpu_eeltype = nbnxn_gpu_pick_ewald_kernel_type(*ic);
- }
- else
- {
- /* Shouldn't happen, as this is checked when choosing Verlet-scheme */
- gmx_incons(
- "The requested electrostatics type is not implemented in the GPU accelerated "
- "kernels!");
- }
-}
/*! \brief Initializes the nonbonded parameter data structure.
*/
{
set_cutoff_parameters(nbp, ic, listParams);
- map_interaction_types_to_gpu_kernel_flavors(ic, nbatParams.comb_rule, &(nbp->eeltype), &(nbp->vdwtype));
+ nbp->vdwType = nbnxmGpuPickVdwKernelType(ic, nbatParams.comb_rule);
+ nbp->elecType = nbnxmGpuPickElectrostaticsKernelType(ic);
if (ic->vdwtype == evdwPME)
{
}
/* generate table for PME */
nbp->coulomb_tab = nullptr;
- if (nbp->eeltype == eelTypeEWALD_TAB || nbp->eeltype == eelTypeEWALD_TAB_TWIN)
+ if (nbp->elecType == ElecType::EwaldTab || nbp->elecType == ElecType::EwaldTabTwin)
{
GMX_RELEASE_ASSERT(ic->coulombEwaldTables, "Need valid Coulomb Ewald correction tables");
init_ewald_coulomb_force_table(*ic->coulombEwaldTables, nbp, deviceContext);
allocateDeviceBuffer(&d_atdat->f, nalloc * DIM, deviceContext);
allocateDeviceBuffer(&d_atdat->xq, nalloc * (DIM + 1), deviceContext);
- if (useLjCombRule(nb->nbparam->vdwtype))
+ if (useLjCombRule(nb->nbparam->vdwType))
{
// Two Lennard-Jones parameters per atom
allocateDeviceBuffer(&d_atdat->lj_comb, nalloc * 2, deviceContext);
nbnxn_ocl_clear_f(nb, nalloc);
}
- if (useLjCombRule(nb->nbparam->vdwtype))
+ if (useLjCombRule(nb->nbparam->vdwType))
{
GMX_ASSERT(sizeof(float) == sizeof(*nbat->params().lj_comb.data()),
"Size of the LJ parameters element should be equal to the size of float2.");
/*! \brief Returns a string with the compiler defines required to avoid all flavour generation
*
- * For example if flavour eelTypeRF with evdwTypeFSWITCH, the output will be such that the corresponding
+ * For example if flavour ElecType::RF with VdwType::FSwitch, the output will be such that the corresponding
* kernel flavour is generated:
* -DGMX_OCL_FASTGEN (will replace flavour generator nbnxn_ocl_kernels.clh with nbnxn_ocl_kernels_fastgen.clh)
- * -DEL_RF (The eelTypeRF flavour)
+ * -DEL_RF (The ElecType::RF flavour)
* -DEELNAME=_ElecRF (The first part of the generated kernel name )
- * -DLJ_EWALD_COMB_GEOM (The evdwTypeFSWITCH flavour)
+ * -DLJ_EWALD_COMB_GEOM (The VdwType::FSwitch flavour)
* -DVDWNAME=_VdwLJEwCombGeom (The second part of the generated kernel name )
*
* prune/energy are still generated as originally. It is only the flavour-level that has changed, so that
* only the required flavour for the simulation is compiled.
*
- * If eeltype is single-range Ewald, then we need to add the
+ * If elecType is single-range Ewald, then we need to add the
* twin-cutoff flavour kernels to the JIT, because PME tuning might
* need it. This path sets -DGMX_OCL_FASTGEN_ADD_TWINCUT, which
* triggers the use of nbnxn_ocl_kernels_fastgen_add_twincut.clh. This
* JIT defaults to compiling all kernel flavours.
*
* \param[in] bFastGen Whether FastGen should be used
- * \param[in] eeltype Electrostatics kernel flavour for FastGen
- * \param[in] vdwtype VDW kernel flavour for FastGen
+ * \param[in] elecType Electrostatics kernel flavour for FastGen
+ * \param[in] vdwType VDW kernel flavour for FastGen
* \return String with the defines if FastGen is active
*
* \throws std::bad_alloc if out of memory
*/
-static std::string makeDefinesForKernelTypes(bool bFastGen, int eeltype, int vdwtype)
+static std::string makeDefinesForKernelTypes(bool bFastGen,
+ enum Nbnxm::ElecType elecType,
+ enum Nbnxm::VdwType vdwType)
{
+ using Nbnxm::ElecType;
std::string defines_for_kernel_types;
if (bFastGen)
{
- bool bIsEwaldSingleCutoff = (eeltype == eelTypeEWALD_TAB || eeltype == eelTypeEWALD_ANA);
+ bool bIsEwaldSingleCutoff = (elecType == ElecType::EwaldTab || elecType == ElecType::EwaldAna);
if (bIsEwaldSingleCutoff)
{
nbnxn_ocl_kernels_fastgen.clh. */
defines_for_kernel_types += "-DGMX_OCL_FASTGEN";
}
- defines_for_kernel_types += kernel_electrostatic_family_definitions[eeltype];
- defines_for_kernel_types += kernel_VdW_family_definitions[vdwtype];
+ defines_for_kernel_types += kernel_electrostatic_family_definitions[static_cast<int>(elecType)];
+ defines_for_kernel_types += kernel_VdW_family_definitions[static_cast<int>(vdwType)];
}
return defines_for_kernel_types;
try
{
std::string extraDefines =
- makeDefinesForKernelTypes(bFastGen, nb->nbparam->eeltype, nb->nbparam->vdwtype);
+ makeDefinesForKernelTypes(bFastGen, nb->nbparam->elecType, nb->nbparam->vdwType);
/* Here we pass macros and static const/constexpr int variables defined
* in include files outside the opencl as macros, to avoid
typedef struct cl_nbparam_params
{
- //! type of electrostatics, takes values from #eelCu
- int eeltype;
- //! type of VdW impl., takes values from #evdwCu
- int vdwtype;
+ //! type of electrostatics, takes values from #ElecType
+ int elecType;
+ //! type of VdW impl., takes values from #VdwType
+ int vdwType;
//! charge multiplication factor
float epsfac;
typedef struct cl_nbparam_params
{
- //! type of electrostatics, takes values from #eelType
- int eeltype;
- //! type of VdW impl., takes values from #evdwType
- int vdwtype;
+ //! type of electrostatics
+ enum Nbnxm::ElecType elecType;
+ //! type of VdW impl.
+ enum Nbnxm::VdwType vdwType;
//! charge multiplication factor
float epsfac;
float two_k_rf;
//! Ewald/PME parameter
float ewald_beta;
- //! Ewald/PME correction term substracted from the direct-space potential
+ //! Ewald/PME correction term subtracted from the direct-space potential
float sh_ewald;
//! LJ-Ewald/PME correction term added to the correction potential
float sh_lj_ewald;
/**< Pointers to non-bonded kernel functions
* organized similar with nb_kfunc_xxx arrays in nbnxn_ocl.cpp */
///@{
- cl_kernel kernel_noener_noprune_ptr[eelTypeNR][evdwTypeNR] = { { nullptr } };
- cl_kernel kernel_ener_noprune_ptr[eelTypeNR][evdwTypeNR] = { { nullptr } };
- cl_kernel kernel_noener_prune_ptr[eelTypeNR][evdwTypeNR] = { { nullptr } };
- cl_kernel kernel_ener_prune_ptr[eelTypeNR][evdwTypeNR] = { { nullptr } };
+ cl_kernel kernel_noener_noprune_ptr[Nbnxm::c_numElecTypes][Nbnxm::c_numVdwTypes] = { { nullptr } };
+ cl_kernel kernel_ener_noprune_ptr[Nbnxm::c_numElecTypes][Nbnxm::c_numVdwTypes] = { { nullptr } };
+ cl_kernel kernel_noener_prune_ptr[Nbnxm::c_numElecTypes][Nbnxm::c_numVdwTypes] = { { nullptr } };
+ cl_kernel kernel_ener_prune_ptr[Nbnxm::c_numElecTypes][Nbnxm::c_numVdwTypes] = { { nullptr } };
///@}
//! prune kernels, ePruneKind defined the kernel kinds
cl_kernel kernel_pruneonly[ePruneNR] = { nullptr };
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(onlinehelp INTERFACE)
file(GLOB ONLINEHELP_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${ONLINEHELP_SOURCES} PARENT_SCOPE)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(onlinehelp PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(onlinehelp PUBLIC
+target_include_directories(onlinehelp INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(onlinehelp PUBLIC
+target_link_libraries(onlinehelp INTERFACE
+ legacy_api
+ )
+
+# TODO: when onlinehelp is an OBJECT target
+#target_link_libraries(onlinehelp PUBLIC legacy_api)
+#target_link_libraries(onlinehelp PRIVATE common)
+
+# Module dependencies
+# onlinehelp interfaces convey transitive dependence on these modules.
+#target_link_libraries(onlinehelp PUBLIC
+target_link_libraries(onlinehelp INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(onlinehelp PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(onlinehelp PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
gmx_add_unit_test_library(onlinehelp-test-shared
mock_helptopic.cpp)
+target_link_libraries(onlinehelp-test-shared PUBLIC common)
gmx_add_unit_test(OnlineHelpUnitTests onlinehelp-test
CPP_SOURCE_FILES
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(options INTERFACE)
+
gmx_add_libgromacs_sources(
abstractoption.cpp
abstractsection.cpp
DESTINATION include/gromacs/options)
endif()
+# Source files have the following private module dependencies.
+target_link_libraries(options PRIVATE
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(options PUBLIC
+target_include_directories(options INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(options PUBLIC
+target_link_libraries(options INTERFACE
+ legacy_api
+ )
+
+# TODO: when options is an OBJECT target
+#target_link_libraries(options PUBLIC legacy_api)
+#target_link_libraries(options PRIVATE common)
+
+# Module dependencies
+# options interfaces convey transitive dependence on these modules.
+#target_link_libraries(options PUBLIC
+target_link_libraries(options INTERFACE
+ utility
+ )
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(pbcutil INTERFACE)
file(GLOB PBCUTIL_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${PBCUTIL_SOURCES} PARENT_SCOPE)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(pbcutil PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(pbcutil PUBLIC
+target_include_directories(pbcutil INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(pbcutil PUBLIC
+target_link_libraries(pbcutil INTERFACE
+ legacy_api
+ )
+
+# TODO: when pbcutil is an OBJECT target
+#target_link_libraries(pbcutil PUBLIC legacy_api)
+#target_link_libraries(pbcutil PRIVATE common)
+
+# Module dependencies
+# pbcutil interfaces convey transitive dependence on these modules.
+#target_link_libraries(pbcutil PUBLIC
+target_link_libraries(pbcutil INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(pbcutil PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(pbcutil PRIVATE legacy_modules)
+
if(GMX_INSTALL_LEGACY_API)
install(FILES
pbc.h
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(pulling INTERFACE)
file(GLOB PULLING_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${PULLING_SOURCES} PARENT_SCOPE)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(pulling PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(pulling PUBLIC
+target_include_directories(pulling INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(pulling PUBLIC
+target_link_libraries(pulling INTERFACE
+ legacy_api
+ )
+
+# TODO: when pulling is an OBJECT target
+#target_link_libraries(pulling PUBLIC legacy_api)
+#target_link_libraries(pulling PRIVATE common)
+
+# Module dependencies
+# pulling interfaces convey transitive dependence on these modules.
+#target_link_libraries(pulling PUBLIC
+target_link_libraries(pulling INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(pulling PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(pulling PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
/* calculates center of mass of selection index from all coordinates x */
// Compiler segfault with 2019_update_5 and 2020_initial
-#if defined(__INTEL_COMPILER) \
- && ((__INTEL_COMPILER == 1900 && __INTEL_COMPILER_UPDATE >= 5) || __INTEL_COMPILER >= 1910)
+#if defined(__INTEL_COMPILER) \
+ && ((__INTEL_COMPILER == 1900 && __INTEL_COMPILER_UPDATE >= 5) \
+ || (__INTEL_COMPILER >= 1910 && __INTEL_COMPILER < 2021))
# pragma intel optimization_level 2
#endif
void pull_calc_coms(const t_commrec* cr, pull_t* pull, const real* masses, t_pbc* pbc, double t, const rvec x[], rvec* xp)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2015,2016,2019, by the GROMACS development team, led by
+# Copyright (c) 2015,2016,2019,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(random INTERFACE)
file(GLOB RANDOM_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${RANDOM_SOURCES} PARENT_SCOPE)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(random PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(random PUBLIC
+target_include_directories(random INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(random PUBLIC
+target_link_libraries(random INTERFACE
+ legacy_api
+ )
+
+# TODO: when random is an OBJECT target
+#target_link_libraries(random PUBLIC legacy_api)
+#target_link_libraries(random PRIVATE common)
+
+# Module dependencies
+# random interfaces convey transitive dependence on these modules.
+#target_link_libraries(random PUBLIC
+target_link_libraries(random INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(random PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(random PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2017,2018,2019,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(restraint INTERFACE)
+file(GLOB RESTRAINT_SOURCES *.cpp)
+set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${RESTRAINT_SOURCES} PARENT_SCOPE)
-gmx_add_libgromacs_sources(
- manager.cpp
- restraintmdmodule.cpp
- )
-# TODO this is a hacky way to expose things for the API and needs to be changed to something proper
-install(FILES restraintpotential.h DESTINATION include/gromacs/restraint)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(restraint PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(restraint PUBLIC
+target_include_directories(restraint INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(restraint PUBLIC
+target_link_libraries(restraint INTERFACE
+ legacy_api
+ )
+
+# TODO: when restraint is an OBJECT target
+#target_link_libraries(restraint PUBLIC legacy_api)
+#target_link_libraries(restraint PRIVATE common)
+
+# Module dependencies
+# restraint interfaces convey transitive dependence on these modules.
+#target_link_libraries(restraint PUBLIC
+target_link_libraries(restraint INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(restraint PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(restraint PRIVATE legacy_modules)
if (BUILD_TESTING)
add_subdirectory(tests)
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(selection INTERFACE)
+
file(GLOB SELECTION_SOURCES *.cpp)
file(GLOB SCANNER_SOURCES scanner.cpp parser.cpp)
list(REMOVE_ITEM SELECTION_SOURCES ${SCANNER_SOURCES})
gmx_target_warning_suppression(scanner -Wno-missing-declarations HAS_NO_MISSING_DECLARATIONS)
gmx_target_warning_suppression(scanner -Wno-null-conversion HAS_NO_NULL_CONVERSIONS)
endif()
+target_link_libraries(scanner PRIVATE legacy_api)
+# TODO: Use explicit module dependencies.
+target_link_libraries(scanner PRIVATE legacy_modules)
+
list(APPEND libgromacs_object_library_dependencies scanner)
set(libgromacs_object_library_dependencies ${libgromacs_object_library_dependencies} PARENT_SCOPE)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(selection PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(selection PUBLIC
+target_include_directories(selection INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(selection PUBLIC
+target_link_libraries(selection INTERFACE
+ legacy_api
+ )
+
+# TODO: when selection is an OBJECT target
+#target_link_libraries(selection PUBLIC legacy_api)
+#target_link_libraries(selection PRIVATE common)
+
+# Module dependencies
+# selection interfaces convey transitive dependence on these modules.
+#target_link_libraries(selection PUBLIC
+target_link_libraries(selection INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(selection PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(selection PRIVATE legacy_modules)
+
if(GMX_INSTALL_LEGACY_API)
install(FILES
indexutil.h
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(simd INTERFACE)
file(GLOB SIMD_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${SIMD_SOURCES} PARENT_SCOPE)
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(simd PUBLIC
+target_include_directories(simd INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(simd PUBLIC
+target_link_libraries(simd INTERFACE
+ legacy_api
+ )
+
+# TODO: when simd is an OBJECT target
+#target_link_libraries(simd PUBLIC legacy_api)
+#target_link_libraries(simd PRIVATE common)
+
+# Module dependencies
+# simd interfaces convey transitive dependence on these modules.
+#target_link_libraries(simd PUBLIC
+target_link_libraries(simd INTERFACE
+ utility
+ )
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
return name.at(s);
}
-namespace
-{
-
-
-//! Helper to detect correct AMD Zen architecture.
-bool cpuIsAmdZen1(const CpuInfo& cpuInfo)
-{
- // Both Zen/Zen+/Zen2 have family==23
- // Model numbers for Zen:
- // 1) Naples, Whitehaven, Summit ridge, and Snowy Owl
- // 17) Raven ridge
- // Model numbers for Zen+:
- // 8) Pinnacle Ridge
- // 24) Picasso
- return (cpuInfo.vendor() == gmx::CpuInfo::Vendor::Amd && cpuInfo.family() == 23
- && (cpuInfo.model() == 1 || cpuInfo.model() == 17 || cpuInfo.model() == 8
- || cpuInfo.model() == 24));
-}
-
-} // namespace
-
-
SimdType simdSuggested(const CpuInfo& c)
{
SimdType suggested = SimdType::None;
mem0_[j] = refmem[j] = (1000.0 + j) * (1.0 + 100 * GMX_REAL_EPS);
}
-# ifdef __INTEL_COMPILER // Bug in (at least) 19u1 and 18u5 (03424712)
+# if defined(__INTEL_COMPILER) && (__INTEL_COMPILER < 2021) // Bug in (at least) 19u1 and 18u5 (03424712)
# pragma novector
# endif
for (std::size_t j = 0; j < GMX_SIMD_REAL_WIDTH; j++)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(statistics INTERFACE)
file(GLOB STATISTICS_SOURCES *.cpp)
-
set(LIBGROMACS_SOURCES
${LIBGROMACS_SOURCES} ${STATISTICS_SOURCES} PARENT_SCOPE)
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(statistics PUBLIC
+target_include_directories(statistics INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(statistics PUBLIC
+target_link_libraries(statistics INTERFACE
+ legacy_api
+ )
+
+# TODO: when statistics is an OBJECT target
+#target_link_libraries(statistics PUBLIC legacy_api)
+#target_link_libraries(statistics PRIVATE common)
+
+# Module dependencies
+# statistics interfaces convey transitive dependence on these modules.
+#target_link_libraries(statistics PUBLIC
+target_link_libraries(statistics INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(statistics PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(statistics PRIVATE legacy_modules)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(swap INTERFACE)
file(GLOB SWAP_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${SWAP_SOURCES} PARENT_SCOPE)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(swap PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(swap PUBLIC
+target_include_directories(swap INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(swap PUBLIC
+target_link_libraries(swap INTERFACE
+ legacy_api
+ )
+
+# TODO: when swap is an OBJECT target
+#target_link_libraries(swap PUBLIC legacy_api)
+#target_link_libraries(swap PRIVATE common)
+
+# Module dependencies
+# swap interfaces convey transitive dependence on these modules.
+#target_link_libraries(swap PUBLIC
+target_link_libraries(swap INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(swap PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(swap PRIVATE legacy_modules)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2015,2016,200, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(tables INTERFACE)
file(GLOB TABLE_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TABLE_SOURCES} PARENT_SCOPE)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(tables PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(tables PUBLIC
+target_include_directories(tables INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(tables PUBLIC
+target_link_libraries(tables INTERFACE
+ legacy_api
+ )
+
+# TODO: when tables is an OBJECT target
+#target_link_libraries(tables PUBLIC legacy_api)
+#target_link_libraries(tables PRIVATE common)
+
+# Module dependencies
+# tables interfaces convey transitive dependence on these modules.
+#target_link_libraries(tables PUBLIC
+target_link_libraries(tables INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(tables PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(tables PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(taskassignment INTERFACE)
+file(GLOB TASKASSIGNMENT_SOURCES *.cpp)
+set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TASKASSIGNMENT_SOURCES} PARENT_SCOPE)
+
# Note that this is a higher-level module that should not need
# special compilation to suit e.g. GPU or MPI dependencies.
# If you find you want to do that, consider a preliminary
# refactoring.
-gmx_add_libgromacs_sources(
- decidegpuusage.cpp
- decidesimulationworkload.cpp
- findallgputasks.cpp
- reportgpuusage.cpp
- resourcedivision.cpp
- taskassignment.cpp
- usergpuids.cpp
- )
+
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(taskassignment PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(taskassignment PUBLIC
+target_include_directories(taskassignment INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(taskassignment PUBLIC
+target_link_libraries(taskassignment INTERFACE
+ legacy_api
+ )
+
+# TODO: when taskassignment is an OBJECT target
+#target_link_libraries(taskassignment PUBLIC legacy_api)
+#target_link_libraries(taskassignment PRIVATE common)
+
+# Module dependencies
+# taskassignment interfaces convey transitive dependence on these modules.
+#target_link_libraries(taskassignment PUBLIC
+target_link_libraries(taskassignment INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(taskassignment PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(taskassignment PRIVATE legacy_modules)
if (BUILD_TESTING)
add_subdirectory(tests)
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2013,2014,2015,2019, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2019,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(timing INTERFACE)
file(GLOB TIMING_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TIMING_SOURCES} PARENT_SCOPE)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(timing PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(timing PUBLIC
+target_include_directories(timing INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(timing PUBLIC
+target_link_libraries(timing INTERFACE
+ legacy_api
+ )
+
+# TODO: when timing is an OBJECT target
+#target_link_libraries(timing PUBLIC legacy_api)
+#target_link_libraries(timing PRIVATE common)
+
+# Module dependencies
+# timing interfaces convey transitive dependence on these modules.
+#target_link_libraries(timing PUBLIC
+target_link_libraries(timing INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(timing PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(timing PRIVATE legacy_modules)
+
if (BUILD_TESTING)
# add_subdirectory(tests)
endif()
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2014,2015,2018, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2018,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(tools INTERFACE)
file(GLOB TOOLS_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TOOLS_SOURCES} PARENT_SCOPE)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(tools PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(tools PUBLIC
+target_include_directories(tools INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(tools PUBLIC
+target_link_libraries(tools INTERFACE
+ legacy_api
+ )
+
+# TODO: when tools is an OBJECT target
+#target_link_libraries(tools PUBLIC legacy_api)
+#target_link_libraries(tools PRIVATE common)
+
+# Module dependencies
+# tools interfaces convey transitive dependence on these modules.
+#target_link_libraries(tools PUBLIC
+target_link_libraries(tools INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(tools PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(tools PRIVATE legacy_modules)
+
+
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(topology INTERFACE)
+
file(GLOB TOPOLOGY_SOURCES *.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TOPOLOGY_SOURCES} PARENT_SCOPE)
-if (BUILD_TESTING)
- add_subdirectory(tests)
-endif()
-
if(GMX_INSTALL_LEGACY_API)
install(FILES
atomprop.h
- atoms.h
- block.h
- forcefieldparameters.h
- idef.h
- ifunc.h
+ atoms.h
+ block.h
+ forcefieldparameters.h
+ idef.h
+ ifunc.h
index.h
- symtab.h
- topology.h
- DESTINATION include/gromacs/topology)
+ symtab.h
+ topology.h
+ DESTINATION include/gromacs/topology)
endif()
+
+# Source files have the following private module dependencies.
+target_link_libraries(options PRIVATE
+ )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(topology PUBLIC
+target_include_directories(topology INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(topology PUBLIC
+target_link_libraries(topology INTERFACE
+ legacy_api
+ )
+
+# TODO: when topology is an OBJECT target
+#target_link_libraries(topology PUBLIC legacy_api)
+#target_link_libraries(topology PRIVATE common)
+
+# Module dependencies
+# topology interfaces convey transitive dependence on these modules.
+#target_link_libraries(topology PUBLIC
+target_link_libraries(topology INTERFACE
+ utility
+ )
+
+if (BUILD_TESTING)
+ add_subdirectory(tests)
+endif()
\ No newline at end of file
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2015,2016,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2015,2016,2018,2019,2020, 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.
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
-gmx_add_libgromacs_sources(
- energyframe.cpp
- trajectoryframe.cpp
- )
+# Set up the module library
+add_library(trajectory INTERFACE)
+file(GLOB TRAJECTORY_SOURCES *.cpp)
+set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TRAJECTORY_SOURCES} PARENT_SCOPE)
+
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(trajectory PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(trajectory PUBLIC
+target_include_directories(trajectory INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(trajectory PUBLIC
+target_link_libraries(trajectory INTERFACE
+ legacy_api
+ )
+
+# TODO: when trajectory is an OBJECT target
+#target_link_libraries(trajectory PUBLIC legacy_api)
+#target_link_libraries(trajectory PRIVATE common)
+
+# Module dependencies
+# trajectory interfaces convey transitive dependence on these modules.
+#target_link_libraries(trajectory PUBLIC
+target_link_libraries(trajectory INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(trajectory PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(trajectory PRIVATE legacy_modules)
if(GMX_INSTALL_LEGACY_API)
install(FILES trajectoryframe.h
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+# Set up the module library
+add_library(trajectoryanalysis INTERFACE)
file(GLOB TRAJECTORYANALYSIS_SOURCES *.cpp modules/*.cpp)
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TRAJECTORYANALYSIS_SOURCES} PARENT_SCOPE)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(trajectoryanalysis PRIVATE
+# common
+# legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(trajectoryanalysis PUBLIC
+target_include_directories(trajectoryanalysis INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(trajectoryanalysis PUBLIC
+target_link_libraries(trajectoryanalysis INTERFACE
+ legacy_api
+ )
+
+# TODO: when trajectoryanalysis is an OBJECT target
+#target_link_libraries(trajectoryanalysis PUBLIC legacy_api)
+#target_link_libraries(trajectoryanalysis PRIVATE common)
+
+# Module dependencies
+# trajectoryanalysis interfaces convey transitive dependence on these modules.
+#target_link_libraries(trajectoryanalysis PUBLIC
+target_link_libraries(trajectoryanalysis INTERFACE
+ utility
+ )
+# Source files have the following private module dependencies.
+#target_link_libraries(trajectoryanalysis PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(trajectoryanalysis PRIVATE legacy_modules)
+
if(GMX_INSTALL_LEGACY_API)
install(FILES
analysismodule.h
)
gmx_register_gtest_test(TrajectoryAnalysisUnitTests trajectoryanalysis-test SLOW_TEST)
target_link_libraries(trajectoryanalysis-test PRIVATE analysisdata-test-shared)
+target_link_libraries(trajectoryanalysis-test PRIVATE common)
add_executable(test_selection ${UNITTEST_TARGET_OPTIONS} test_selection.cpp)
-target_link_libraries(test_selection PRIVATE libgromacs ${GMX_EXE_LINKER_FLAGS})
+target_link_libraries(test_selection PRIVATE
+ common
+ libgromacs
+ ${GMX_EXE_LINKER_FLAGS})
+# TODO: Explicitly link to module dependencies.
+target_link_libraries(test_selection PRIVATE legacy_modules)
# To help us fund GROMACS development, we humbly ask that you cite
# the research papers on the package. Check out http://www.gromacs.org.
+add_library(utility INTERFACE)
+
file(GLOB UTILITY_SOURCES *.cpp)
if (GMX_GPU_CUDA)
gmx_add_libgromacs_sources(cuda_version_information.cu)
endif()
set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${UTILITY_SOURCES} PARENT_SCOPE)
-# TODO: (https://gitlab.com/gromacs/gromacs/-/issues/988) Find a new convention for defining public API.
-install(FILES
- basedefinitions.h
- current_function.h
- gmxassert.h
- real.h
- DESTINATION include/gromacs/utility)
-
if(GMX_INSTALL_LEGACY_API)
install(FILES
- arrayref.h
baseversion.h
classhelpers.h
enumerationhelpers.h
- exceptions.h
- listoflists.h
fileptr.h
futil.h
flags.h
DESTINATION include/gromacs/utility)
endif()
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(utility PUBLIC
+target_include_directories(utility INTERFACE
+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(utility PUBLIC
+target_link_libraries(utility INTERFACE
+ legacy_api
+ )
+
+# TODO: when utility is an OBJECT target
+#target_link_libraries(utility PUBLIC legacy_api)
+#target_link_libraries(utility PRIVATE common)
+
+# Source files have the following private module dependencies.
+# TODO: Explicitly link specific modules.
+#target_link_libraries(utility PRIVATE legacy_modules)
+
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
*/
#include "gmxpre.h"
-#include "exceptions.h"
+#include "gromacs/utility/exceptions.h"
#include <cstring>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2014,2015,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "gmxassert.h"
+#include "gromacs/utility/gmxassert.h"
#include <cstdio>
#include <cstdlib>
textwriter.cpp
typetraits.cpp
)
+# TODO: Explicitly link specific modules.
+target_link_libraries(utility-test PRIVATE legacy_modules)
gmx_add_mpi_unit_test(UtilityMpiUnitTests utility-mpi-test 4
CPP_SOURCE_FILES
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2018,2019,2020, 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.
target_include_directories(mdrun_objlib SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
# Should be possible to remove this when resolving #3290
target_include_directories(mdrun_objlib SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
+target_link_libraries(mdrun_objlib PRIVATE common)
+target_link_libraries(mdrun_objlib PRIVATE legacy_api)
+# TODO: Explicitly link specific modules.
+target_link_libraries(mdrun_objlib PRIVATE legacy_modules)
if(GMX_FAHCORE)
# The lack of a real source file here alongside the object library
# may break some generators, according to CMake documentation. If
# so, we can consider adding some dummy file to make it work.
add_library(fahcore $<TARGET_OBJECTS:mdrun_objlib>)
- target_link_libraries(fahcore PRIVATE ${GMX_COMMON_LIBRARIES})
+ target_link_libraries(fahcore PRIVATE ${GMX_COMMON_LIBRARIES} legacy_api)
elseif(GMX_BUILD_MDRUN_ONLY)
add_executable(mdrun $<TARGET_OBJECTS:mdrun_objlib> mdrun_main.cpp)
gmx_target_compile_options(mdrun)
gmx_target_compile_options(view_objlib)
target_compile_definitions(view_objlib PRIVATE HAVE_CONFIG_H)
target_include_directories(view_objlib SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
+ target_link_libraries(view_objlib PRIVATE common legacy_api)
+ # TODO: Explicitly link specific modules.
+ target_link_libraries(view_objlib PRIVATE legacy_modules)
add_library(gmx_objlib OBJECT ${GMX_MAIN_SOURCES})
+ target_link_libraries(gmx_objlib PRIVATE common legacy_api)
+ # TODO: Explicitly link specific modules.
+ target_link_libraries(gmx_objlib PRIVATE legacy_modules)
target_include_directories(gmx_objlib SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
target_include_directories(gmx_objlib SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
add_executable(gmx
add_executable(Gromacs::gmx ALIAS gmx)
gmx_target_compile_options(gmx)
target_compile_definitions(gmx PRIVATE HAVE_CONFIG_H)
- target_link_libraries(gmx libgromacs
- ${GMX_COMMON_LIBRARIES}
- ${GMX_EXE_LINKER_FLAGS})
+ target_link_libraries(gmx PRIVATE
+ common
+ libgromacs
+ ${GMX_COMMON_LIBRARIES}
+ ${GMX_EXE_LINKER_FLAGS})
if(GMX_X11)
target_link_libraries(gmx ${X11_LIBRARIES})
endif()
$<TARGET_OBJECTS:mdrun_objlib>
)
target_include_directories(mdrun_test_infrastructure SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
+target_link_libraries(mdrun_test_infrastructure PUBLIC legacy_api)
# To avoid running into test timeouts, some end-to-end tests of mdrun
# functionality are split off. This can be rearranged in future as we
$<TARGET_OBJECTS:mdrun_objlib>
)
target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
+# TODO: Link specific modules: topology
+target_link_libraries(${exename} PRIVATE legacy_modules)
gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
return()
endif()
-set(TESTUTILS_SOURCES
- cmdlinetest.cpp
- conftest.cpp
- filematchers.cpp
- interactivetest.cpp
- loggertest.cpp
- mpi_printer.cpp
- mpitest.cpp
- refdata.cpp
- refdata_xml.cpp
- simulationdatabase.cpp
- stdiohelper.cpp
- stringtest.cpp
- testasserts.cpp
- testfilemanager.cpp
- testfileredirector.cpp
- test_device.cpp
- test_hardware_environment.cpp
- testinit.cpp
- testmatchers.cpp
- testoptions.cpp
- textblockmatchers.cpp
- tprfilegenerator.cpp
- xvgtest.cpp
- )
-
-if(NOT HAVE_TINYXML2)
- list(APPEND TESTUTILS_SOURCES ../external/tinyxml2/tinyxml2.cpp)
-endif()
-
if (GMX_GPU_CUDA)
# Work around FindCUDA that prevents using target_link_libraries()
# with keywords otherwise...
set(CUDA_LIBRARIES PRIVATE ${CUDA_LIBRARIES})
if (NOT GMX_CLANG_CUDA)
- gmx_cuda_add_library(testutils ${TESTUTILS_SOURCES})
+ gmx_cuda_add_library(testutils)
else()
set_source_files_properties(test_device.cpp PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ)
gmx_compile_cuda_file_with_clang(test_device.cpp)
endif()
target_link_libraries(testutils PRIVATE ${CUDA_CUFFT_LIBRARIES})
else()
- add_library(testutils STATIC ${UNITTEST_TARGET_OPTIONS} ${TESTUTILS_SOURCES})
+ add_library(testutils STATIC ${UNITTEST_TARGET_OPTIONS})
+endif()
+
+# Module interface / provided facilities
+target_include_directories(testutils PUBLIC include)
+
+# Executable targets for tests based on `testutils` acquire the source for
+# their entry point from unittest_main.cpp when linking to the `testutils` target.
+target_sources(testutils INTERFACE unittest_main.cpp)
+
+
+target_sources(testutils PRIVATE
+ cmdlinetest.cpp
+ conftest.cpp
+ filematchers.cpp
+ interactivetest.cpp
+ loggertest.cpp
+ mpi_printer.cpp
+ mpitest.cpp
+ refdata.cpp
+ refdata_xml.cpp
+ simulationdatabase.cpp
+ stdiohelper.cpp
+ stringtest.cpp
+ testasserts.cpp
+ testfilemanager.cpp
+ testfileredirector.cpp
+ test_device.cpp
+ test_hardware_environment.cpp
+ testinit.cpp
+ testmatchers.cpp
+ testoptions.cpp
+ textblockmatchers.cpp
+ tprfilegenerator.cpp
+ xvgtest.cpp
+ )
+
+
+if(HAVE_TINYXML2)
+ target_include_directories(testutils SYSTEM PRIVATE ${TinyXML2_INCLUDE_DIR})
+ target_link_libraries(testutils PRIVATE ${TinyXML2_LIBRARIES})
+else()
+ target_include_directories(testutils SYSTEM BEFORE PRIVATE ${CMAKE_SOURCE_DIR}/src/external/tinyxml2)
+ target_sources(testutils PRIVATE ${CMAKE_SOURCE_DIR}/src/external/tinyxml2/tinyxml2.cpp)
endif()
+target_include_directories(testutils PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+
if (GMX_GPU_SYCL)
set_source_files_properties(test_device.cpp
PROPERTIES COMPILE_FLAGS "${SYCL_CXX_FLAGS}")
target_compile_definitions(testutils PRIVATE HAVE_CONFIG_H)
target_include_directories(testutils SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
target_link_libraries(testutils PRIVATE libgromacs ${GMX_COMMON_LIBRARIES} gmock)
+target_link_libraries(testutils PUBLIC common)
-if(HAVE_TINYXML2)
- include_directories(SYSTEM ${TinyXML2_INCLUDE_DIR})
- target_link_libraries(testutils PRIVATE ${TinyXML2_LIBRARIES})
-else()
- include_directories(BEFORE SYSTEM "../external/tinyxml2")
-endif()
+# GROMACS module dependencies.
+# Note that testutils conveys transitive dependencies on some modules.
+# TODO: Explicitly link specific modules with minimal exposure.
+target_link_libraries(testutils PUBLIC legacy_modules)
# TODO Use gmx_add_missing_tests_notice() instead of the messages below.
set(GMX_CAN_RUN_MPI_TESTS 1)
set(GMX_CAN_RUN_MPI_TESTS 0)
endif()
-set(TESTUTILS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-set(TESTUTILS_DIR ${TESTUTILS_DIR} PARENT_SCOPE)
set(GMX_CAN_RUN_MPI_TESTS ${GMX_CAN_RUN_MPI_TESTS} PARENT_SCOPE)
add_subdirectory(tests)
cuda_add_executable(${EXENAME} ${UNITTEST_TARGET_OPTIONS}
${ARG_CPP_SOURCE_FILES}
${ARG_CUDA_CU_SOURCE_FILES}
- ${ARG_GPU_CPP_SOURCE_FILES}
- ${TESTUTILS_DIR}/unittest_main.cpp)
+ ${ARG_GPU_CPP_SOURCE_FILES})
else()
add_executable(${EXENAME} ${UNITTEST_TARGET_OPTIONS}
- ${ARG_CPP_SOURCE_FILES}
- ${TESTUTILS_DIR}/unittest_main.cpp)
+ ${ARG_CPP_SOURCE_FILES})
endif()
if (GMX_GPU_CUDA)
endif()
target_link_libraries(${EXENAME} PRIVATE
- testutils libgromacs gmock
+ testutils common libgromacs gmock
${GMX_COMMON_LIBRARIES} ${GMX_EXE_LINKER_FLAGS})
if(GMX_CLANG_TIDY)
*/
#include "gmxpre.h"
-#include "cmdlinetest.h"
+#include "testutils/cmdlinetest.h"
#include <cstdlib>
#include <cstring>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "conftest.h"
+#include "testutils/conftest.h"
#include <cstdio>
#include <cstdlib>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "filematchers.h"
+#include "testutils/filematchers.h"
#include "gromacs/utility/filestream.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2017,2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2018,2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2017,2019,2020, 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.
* \param[in] refFilename File with the expected contents.
* \param[in] testFilename File with the contents to be tested.
*/
- void testFilesEqual(const std::string& refFilename, const std::string& testFilename);
+ static void testFilesEqual(const std::string& refFilename, const std::string& testFilename);
private:
class Impl;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2015,2018,2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2018,2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2018,2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2018,2019,2020, 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.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "interactivetest.h"
+#include "testutils/interactivetest.h"
#include <string>
#include <utility>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "loggertest.h"
+#include "testutils/loggertest.h"
#include <gmock/gmock.h>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "mpitest.h"
+#include "testutils/mpitest.h"
#include "config.h"
*/
#include "gmxpre.h"
-#include "refdata.h"
+#include "testutils/refdata.h"
#include <cctype>
#include <cstdlib>
#include "gromacs/utility/real.h"
#include "gromacs/utility/stringutil.h"
-#include "testutils/refdata_checkers.h"
-#include "testutils/refdata_impl.h"
-#include "testutils/refdata_xml.h"
#include "testutils/testasserts.h"
#include "testutils/testexceptions.h"
#include "testutils/testfilemanager.h"
+#include "refdata_checkers.h"
+#include "refdata_impl.h"
+#include "refdata_xml.h"
+
namespace gmx
{
namespace test
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019,2020, 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.
#include "gromacs/utility/strconvert.h"
#include "gromacs/utility/stringutil.h"
-#include "testutils/refdata_impl.h"
#include "testutils/testasserts.h"
#include "testutils/testexceptions.h"
+#include "refdata_impl.h"
+
namespace gmx
{
namespace test
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2019,2020, 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.
#include "gromacs/utility/exceptions.h"
-#include "testutils/refdata_impl.h"
#include "testutils/testexceptions.h"
+#include "refdata_impl.h"
+
namespace gmx
{
namespace test
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2019,2020, 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.
#include <string>
-#include "testutils/refdata_impl.h"
+#include "refdata_impl.h"
namespace gmx
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "simulationdatabase.h"
+#include "testutils/simulationdatabase.h"
#include <algorithm>
#include <map>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "stdiohelper.h"
+#include "testutils/stdiohelper.h"
#include <cerrno>
#include <cstdio>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "stringtest.h"
+#include "testutils/stringtest.h"
#include <string>
*/
#include "gmxpre.h"
-#include "test_device.h"
+#include "testutils/test_device.h"
#include <memory>
#include "gmxpre.h"
-#include "test_hardware_environment.h"
+#include "testutils/test_hardware_environment.h"
#include <memory>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2018,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "testasserts.h"
+#include "testutils/testasserts.h"
#include <cmath>
#include <cstdio>
*/
#include "gmxpre.h"
-#include "testfilemanager.h"
+#include "testutils/testfilemanager.h"
#include <cstdio>
// Assume file is in global directory for simulation input files.
return Path::join(getTestSimulationDatabaseDirectory(), filename);
}
- else
- {
- // Assume file is present locally without full name (e.g. extension).
- return Path::join(getInputDataDirectory(), filename);
- }
+ // Assume file is present locally without full name (e.g. extension).
+ return Path::join(getInputDataDirectory(), filename);
}
std::string TestFileManager::getInputFilePath(const std::string& filename)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "testfileredirector.h"
+#include "testutils/testfileredirector.h"
#include <memory>
#include <set>
*/
#include "gmxpre.h"
-#include "testinit.h"
+#include "testutils/testinit.h"
#include <cstdio>
#include <cstdlib>
#include "gromacs/utility/programcontext.h"
#include "gromacs/utility/textwriter.h"
-#include "testutils/mpi_printer.h"
#include "testutils/refdata.h"
#include "testutils/test_hardware_environment.h"
#include "testutils/testfilemanager.h"
#include "testutils/testoptions.h"
+#include "mpi_printer.h"
+
namespace gmx
{
namespace test
*/
#include "gmxpre.h"
-#include "testmatchers.h"
+#include "testutils/testmatchers.h"
#include <memory>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "testoptions.h"
+#include "testutils/testoptions.h"
#include <list>
testasserts_tests.cpp
xvgtest_tests.cpp
)
+target_link_libraries(testutils-test PRIVATE testutils)
gmx_add_mpi_unit_test(TestUtilsMpiUnitTests testutils-mpi-test 2
CPP_SOURCE_FILES
mpitest.cpp
)
+target_link_libraries(testutils-test PRIVATE testutils)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2018,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "textblockmatchers.h"
+#include "testutils/textblockmatchers.h"
#include <memory>
#include <regex>
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, 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.
#include "gmxpre.h"
-#include "tprfilegenerator.h"
+#include "testutils/tprfilegenerator.h"
#include "gromacs/gmxpreprocess/grompp.h"
#include "gromacs/utility/textwriter.h"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019,2020, 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.
*/
#include "gmxpre.h"
-#include "xvgtest.h"
+#include "testutils/xvgtest.h"
#include <cerrno>
#include <cstdlib>