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)
--- /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)
+# There are transitive dependencies on the legacy GROMACS headers.
+target_link_libraries(nblib PUBLIC legacy_api)
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)
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 "-beta1")
+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
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/*: *
-.. _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 at https://gitlab.com/gromacs/gromacs/-/issues 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)
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
PUBLIC
${GMX_PUBLIC_LIBRARIES}
)
+target_link_libraries(libgromacs PUBLIC legacy_api)
+
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)
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
*/
/* 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:
*
target_sources(libgromacs PRIVATE ${FILEIO_SOURCES})
-if(GMX_INSTALL_LEGACY_API)
- install(FILES
- oenv.h
- confio.h
- pdbio.h
- tpxio.h
- trxio.h
- filetypes.h
- DESTINATION include/gromacs/fileio)
-endif()
-
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
*/
#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>
}
}
-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 */
${LINEARALGEBRA_SOURCES} ${BLAS_SOURCES} ${LAPACK_SOURCES})
add_library(linearalgebra OBJECT ${LINEARALGEBRA_SOURCES})
+target_include_directories(linearalgebra PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+# TODO: Only expose the module's public headers.
+target_include_directories(linearalgebra INTERFACE ${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)
list(APPEND libgromacs_object_library_dependencies linearalgebra)
set(libgromacs_object_library_dependencies ${libgromacs_object_library_dependencies} PARENT_SCOPE)
//! 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),
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()
-
-
if (BUILD_TESTING)
add_subdirectory(tests)
endif()
*/
#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"
if (fr->useMts)
{
- gmx::assertMtsRequirements(*ir);
+ GMX_ASSERT(gmx::checkMtsRequirements(*ir).empty(),
+ "All MTS requirements should be met here");
}
const bool haveDirectVirialContributionsFast =
gmx_add_unit_test_library(mdrunutility-test-shared
threadaffinitytest.cpp)
+target_link_libraries(mdrunutility-test-shared PUBLIC legacy_api)
gmx_add_unit_test(MdrunUtilityUnitTests mdrunutility-test
CPP_SOURCE_FILES
#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
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)
+target_link_libraries(modularsimulator PRIVATE legacy_api)
if(GMX_OPENMP)
# Explicitly set properties for modular simulator module to compile with openmp
/* 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) 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.
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)
if (BUILD_TESTING)
add_subdirectory(tests)
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)
+
list(APPEND libgromacs_object_library_dependencies scanner)
set(libgromacs_object_library_dependencies ${libgromacs_object_library_dependencies} PARENT_SCOPE)
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++)
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
*/
#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>
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 legacy_api)
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 legacy_api)
add_library(gmx_objlib OBJECT ${GMX_MAIN_SOURCES})
+ target_link_libraries(gmx_objlib PRIVATE legacy_api)
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
+ 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
else()
add_library(testutils STATIC ${UNITTEST_TARGET_OPTIONS} ${TESTUTILS_SOURCES})
endif()
+# TODO: Use a non-degenerate interface include directory.
+target_include_directories(testutils PUBLIC ${CMAKE_SOURCE_DIR}/src)
if (GMX_GPU_SYCL)
set_source_files_properties(test_device.cpp