Merge branch 'origin/release-2021' into merge-2021-into-master
authorPaul Bauer <paul.bauer.q@gmail.com>
Thu, 5 Nov 2020 10:53:20 +0000 (11:53 +0100)
committerPaul Bauer <paul.bauer.q@gmail.com>
Thu, 5 Nov 2020 12:12:18 +0000 (13:12 +0100)
Resolved Conflicts:
src/gromacs/gmxpreprocess/readir.cpp
        admin/gitlab/archive.gitlab-ci-yml

87 files changed:
admin/gitlab-ci/archive.gitlab-ci.yml
admin/gitlab-ci/global.gitlab-ci.yml
admin/gitlab-ci/gromacs.gitlab-ci.yml
admin/gitlab-ci/lint.gitlab-ci.yml
admin/gitlab-ci/python-gmxapi.gitlab-ci.yml
admin/gitlab-ci/rules.gitlab-ci.yml
admin/gitlab-ci/sample_restraint.gitlab-ci.yml
api/CMakeLists.txt
api/legacy/CMakeLists.txt [new file with mode: 0644]
api/legacy/include/gromacs/fileio/confio.h [moved from src/gromacs/fileio/confio.h with 100% similarity]
api/legacy/include/gromacs/fileio/filetypes.h [moved from src/gromacs/fileio/filetypes.h with 100% similarity]
api/legacy/include/gromacs/fileio/oenv.h [moved from src/gromacs/fileio/oenv.h with 100% similarity]
api/legacy/include/gromacs/fileio/pdbio.h [moved from src/gromacs/fileio/pdbio.h with 100% similarity]
api/legacy/include/gromacs/fileio/tpxio.h [moved from src/gromacs/fileio/tpxio.h with 100% similarity]
api/legacy/include/gromacs/math/do_fit.h [moved from src/gromacs/math/do_fit.h with 100% similarity]
api/legacy/include/gromacs/math/functions.h [moved from src/gromacs/math/functions.h with 99% similarity]
api/legacy/include/gromacs/math/units.h [moved from src/gromacs/math/units.h with 98% similarity]
api/legacy/include/gromacs/math/utilities.h [moved from src/gromacs/math/utilities.h with 100% similarity]
api/legacy/include/gromacs/math/vec.h [moved from src/gromacs/math/vec.h with 100% similarity]
api/legacy/include/gromacs/math/vectypes.h [moved from src/gromacs/math/vectypes.h with 100% similarity]
api/legacy/include/gromacs/restraint/restraintpotential.h [moved from src/gromacs/restraint/restraintpotential.h with 99% similarity]
api/legacy/include/gromacs/utility/arrayref.h [moved from src/gromacs/utility/arrayref.h with 100% similarity]
api/legacy/include/gromacs/utility/basedefinitions.h [moved from src/gromacs/utility/basedefinitions.h with 100% similarity]
api/legacy/include/gromacs/utility/current_function.h [moved from src/gromacs/utility/current_function.h with 97% similarity]
api/legacy/include/gromacs/utility/exceptions.h [moved from src/gromacs/utility/exceptions.h with 100% similarity]
api/legacy/include/gromacs/utility/gmxassert.h [moved from src/gromacs/utility/gmxassert.h with 98% similarity]
api/legacy/include/gromacs/utility/listoflists.h [moved from src/gromacs/utility/listoflists.h with 100% similarity]
api/legacy/include/gromacs/utility/real.h [moved from src/gromacs/utility/real.h with 100% similarity]
api/legacy/version.h.cmakein [new file with mode: 0644]
api/nblib/CMakeLists.txt
api/nblib/tests/CMakeLists.txt
cmake/gmxVersionInfo.cmake
docs/CMakeLists.txt
docs/dev-manual/includestyle.rst
docs/doxygen/Doxyfile-common.cmakein
docs/doxygen/check-source.py
docs/doxygen/cycle-suppressions.txt
docs/doxygen/suppressions.txt
docs/release-notes/2021/major/deprecated-functionality.rst
docs/release-notes/2022/major/bugs-fixed.rst [new file with mode: 0644]
docs/release-notes/2022/major/deprecated-functionality.rst [new file with mode: 0644]
docs/release-notes/2022/major/features.rst [new file with mode: 0644]
docs/release-notes/2022/major/highlights.rst [new file with mode: 0644]
docs/release-notes/2022/major/miscellaneous.rst [new file with mode: 0644]
docs/release-notes/2022/major/performance.rst [new file with mode: 0644]
docs/release-notes/2022/major/portability.rst [new file with mode: 0644]
docs/release-notes/2022/major/removed-functionality.rst [new file with mode: 0644]
docs/release-notes/2022/major/tools.rst [new file with mode: 0644]
docs/release-notes/index.rst
python_packaging/sample_restraint/src/cpp/CMakeLists.txt
python_packaging/sample_restraint/tests/CMakeLists.txt
src/gromacs/CMakeLists.txt
src/gromacs/analysisdata/tests/CMakeLists.txt
src/gromacs/fft/calcgrid.cpp
src/gromacs/fileio/CMakeLists.txt
src/gromacs/fileio/confio.cpp
src/gromacs/fileio/filetypes.cpp
src/gromacs/fileio/oenv.cpp
src/gromacs/fileio/pdbio.cpp
src/gromacs/fileio/tests/CMakeLists.txt
src/gromacs/fileio/tpxio.cpp
src/gromacs/gmxpreprocess/readir.cpp
src/gromacs/gmxpreprocess/readir.h
src/gromacs/linearalgebra/CMakeLists.txt
src/gromacs/listed_forces/tests/bonded.cpp
src/gromacs/math/CMakeLists.txt
src/gromacs/math/do_fit.cpp
src/gromacs/math/functions.cpp
src/gromacs/math/units.cpp
src/gromacs/math/utilities.cpp
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdrunutility/tests/CMakeLists.txt
src/gromacs/mdtypes/multipletimestepping.cpp
src/gromacs/mdtypes/multipletimestepping.h
src/gromacs/mdtypes/tests/CMakeLists.txt
src/gromacs/mdtypes/tests/multipletimestepping.cpp [new file with mode: 0644]
src/gromacs/modularsimulator/CMakeLists.txt
src/gromacs/pulling/pullutil.cpp
src/gromacs/restraint/CMakeLists.txt
src/gromacs/selection/CMakeLists.txt
src/gromacs/simd/tests/simd_floatingpoint_util.cpp
src/gromacs/utility/CMakeLists.txt
src/gromacs/utility/exceptions.cpp
src/gromacs/utility/gmxassert.cpp
src/programs/CMakeLists.txt
src/programs/mdrun/tests/CMakeLists.txt
src/testutils/CMakeLists.txt

index 0a9dda9943a97cdbb4ee126de7a7c56deddccae3..9d44b76a345ffdf3bea59dcb1e802eda3da8912f 100644 (file)
@@ -31,9 +31,9 @@ regressiontests:prepare:
     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" ;
@@ -84,7 +84,7 @@ regressiontests:package:
     - 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
@@ -254,8 +254,16 @@ archive:nightly-webpage:
     - 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
index d7eb86ac1207b3c4be98a2d0c98823a71b4ffbe9..2463fa96b43269894b04ab2cc947fa9171e4f116 100644 (file)
@@ -15,7 +15,7 @@
     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: ""
index a4deaa01e7824371a03246d4d203951992b9756a..8ddef2991554c48400995b30a1dd2fe3b725577e 100644 (file)
@@ -230,7 +230,7 @@ gromacs:gcc-7:configure:
   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:
index 325248ef53f85729b2fbe334b1ee5fc639e7fcb3..548b9ec9a733e53c2ca589c5f18ae4f5e2fcc877 100644 (file)
@@ -59,7 +59,7 @@ clang-tidy:test:
     # 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" ;
@@ -89,7 +89,8 @@ clang-format:
     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" ;
index dc4ed5079664088e0d37f84562913e7e8a8b7244..8e6b52a1d0d1a976e2b64f042841bed948b5407e 100644 (file)
@@ -111,7 +111,7 @@ gmxapi-0.1:clang-8:py-3.8.2:
 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"
@@ -119,7 +119,7 @@ gmxapi-0.2:gcc-7:gmx2021:py-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"
@@ -127,7 +127,7 @@ gmxapi-0.2:gcc-7:gmx2021:py-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"
index c53451100649921494646057d2fb0d12d021778c..7bf1648b47f83a2508677c5ea10e9a723e99854d 100644 (file)
 .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.
index a52a4ad1dd57a2c4fbf34bfaee797af90f4bdb87..27e56e2296a0578f14ad831ff77b3f5fa048a22b 100644 (file)
@@ -33,7 +33,7 @@
 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"
@@ -41,7 +41,7 @@ sample_restraint:gcc-7:gmx2021:py-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"
@@ -49,7 +49,7 @@ sample_restraint:gcc-7:gmx2021:py-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"
index 80375188fafdcff090380995bdc7ccd6a75d9b62..c71f607fe6ca29d73e2fcbd05b6d6dfdc8f6189f 100644 (file)
@@ -32,6 +32,9 @@
 # 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)
diff --git a/api/legacy/CMakeLists.txt b/api/legacy/CMakeLists.txt
new file mode 100644 (file)
index 0000000..116bf49
--- /dev/null
@@ -0,0 +1,65 @@
+#
+# 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()
similarity index 99%
rename from src/gromacs/math/functions.h
rename to api/legacy/include/gromacs/math/functions.h
index 35150b3ddd7c2da8a66ddbd92d9515b744b545b8..271e1cf76035529d27aa07b4fb5313bbb2c62303 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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.
similarity index 98%
rename from src/gromacs/math/units.h
rename to api/legacy/include/gromacs/math/units.h
index 865fd31175994d1a426977af9d2afbca082ce88f..bb9f8075ac16a217895c50bad5f0dbc1fede5c76 100644 (file)
@@ -3,7 +3,7 @@
  *
  * 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.
similarity index 99%
rename from src/gromacs/restraint/restraintpotential.h
rename to api/legacy/include/gromacs/restraint/restraintpotential.h
index 72bf0dbe712d25ed80262202b4096d0bd5a71ca4..872d0690160688484e7fe606f13f6ca3f44693fc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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.
similarity index 97%
rename from src/gromacs/utility/current_function.h
rename to api/legacy/include/gromacs/utility/current_function.h
index 1f18cab6ffce9d542ae887075677ca3556e24bfc..e7718893285984e1190c680191db9093d3ead6d3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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.
similarity index 98%
rename from src/gromacs/utility/gmxassert.h
rename to api/legacy/include/gromacs/utility/gmxassert.h
index c278f2c2fc3c702d473c718a47a60793c0a1345b..089b73c1df7122089163830aad4a7518ddad7780 100644 (file)
@@ -2,7 +2,7 @@
  * 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.
diff --git a/api/legacy/version.h.cmakein b/api/legacy/version.h.cmakein
new file mode 100644 (file)
index 0000000..ffe1a25
--- /dev/null
@@ -0,0 +1,105 @@
+/*
+ * 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
index 250b88da5069a46e5af28f5d4bd9632860e5862e..4c75ae58ad31abbdbdd180f75549b341a1309a1b 100644 (file)
@@ -122,6 +122,8 @@ gmx_target_compile_options(nblib)
 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
index 366027339c88838c2e747a255e6fa8a525e2885a..67cf8a51dc401e97758140adf72f34857879fc12 100644 (file)
@@ -46,6 +46,7 @@ gmx_add_unit_test_library(nblib_test_infrastructure
     )
 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")
index 3fa0b1ce31a37d34efb1da74ff8588092e6c4a03..1f88249c73f5be99f402a5d2ea260393295dd4fb 100644 (file)
@@ -60,6 +60,7 @@
 #         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
@@ -214,7 +215,7 @@ set(GMX_VERSION_SUFFIX "-beta1")
 # 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)
 
@@ -256,7 +257,7 @@ if (NOT SOURCE_IS_SOURCE_DISTRIBUTION AND
 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
index 4db45f30e0642a1491eaabdd309b7826f636393b..662026c08983bd3ed8aef138d49f956b30eb6d1a 100644 (file)
@@ -363,6 +363,15 @@ if (SPHINX_FOUND)
         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
index 5c2b890297d97e3d2e2b92f81b2e89d319aa38b8..ece8fbaf1ac9b363fee6e885c2722600cc0c6294 100644 (file)
@@ -7,8 +7,8 @@ between each group, and headers within each group sorted alphabetically.
 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:
 
@@ -23,15 +23,11 @@ between each group, and headers within each group sorted alphabetically.
    ``<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/``
@@ -48,20 +44,11 @@ is up to the author of the code to put the headers in proper order in such
 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:
 
@@ -73,7 +60,7 @@ 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
index d713ea9b564995041de8233d033bf44b584f67fd..e9cc7b858ce89759830c8a50c75edbbf48e17480 100644 (file)
@@ -3,6 +3,7 @@ PROJECT_NAME           = @CMAKE_PROJECT_NAME@
 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
@@ -29,7 +30,10 @@ EXCLUDE_SYMBOLS       += TEST TEST_F TEST_P TYPED_TEST_CASE TYPED_TEST INSTANTIA
 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@
index 8790eb6a1780d01893a2ea9155232f71981193f5..b37ea833cb51ccc4072bc00307a34a6d4ddb1742 100755 (executable)
@@ -2,7 +2,7 @@
 #
 # 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.
@@ -340,19 +340,22 @@ class ModuleDependencyGraph(object):
 
 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)
index ad53e6cb201dafc4f4d59b59b8d05d9ab4fd1acf..2bbaeef3061357efa2731a5108db62c334aa9bc7 100644 (file)
@@ -16,7 +16,6 @@ nbnxm -> mdlib
 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
index a6538a629f163f194e75486586a409382fbb6cd7..c32d4efeeadcedf9f2ac8aca5ea8427286a1b889 100644 (file)
@@ -1,63 +1,71 @@
-# 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/*: *
index bad48892c0ec6dd235a7ff77e345efc4ef847358..d2348ec3a97e5b6d0f1c4cda08c62c419d94a95b 100644 (file)
@@ -1,5 +1,3 @@
-.. _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.
diff --git a/docs/release-notes/2022/major/bugs-fixed.rst b/docs/release-notes/2022/major/bugs-fixed.rst
new file mode 100644 (file)
index 0000000..32793b8
--- /dev/null
@@ -0,0 +1,9 @@
+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!
+
diff --git a/docs/release-notes/2022/major/deprecated-functionality.rst b/docs/release-notes/2022/major/deprecated-functionality.rst
new file mode 100644 (file)
index 0000000..1a7bff7
--- /dev/null
@@ -0,0 +1,14 @@
+.. _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
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
diff --git a/docs/release-notes/2022/major/features.rst b/docs/release-notes/2022/major/features.rst
new file mode 100644 (file)
index 0000000..5626dc8
--- /dev/null
@@ -0,0 +1,9 @@
+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!
+
diff --git a/docs/release-notes/2022/major/highlights.rst b/docs/release-notes/2022/major/highlights.rst
new file mode 100644 (file)
index 0000000..bf79671
--- /dev/null
@@ -0,0 +1,22 @@
+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!
diff --git a/docs/release-notes/2022/major/miscellaneous.rst b/docs/release-notes/2022/major/miscellaneous.rst
new file mode 100644 (file)
index 0000000..1a242e3
--- /dev/null
@@ -0,0 +1,9 @@
+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!
+
diff --git a/docs/release-notes/2022/major/performance.rst b/docs/release-notes/2022/major/performance.rst
new file mode 100644 (file)
index 0000000..b4f7529
--- /dev/null
@@ -0,0 +1,9 @@
+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!
+
diff --git a/docs/release-notes/2022/major/portability.rst b/docs/release-notes/2022/major/portability.rst
new file mode 100644 (file)
index 0000000..aa938eb
--- /dev/null
@@ -0,0 +1,3 @@
+Portability
+^^^^^^^^^^^
+
diff --git a/docs/release-notes/2022/major/removed-functionality.rst b/docs/release-notes/2022/major/removed-functionality.rst
new file mode 100644 (file)
index 0000000..4b1b189
--- /dev/null
@@ -0,0 +1,9 @@
+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!
+
diff --git a/docs/release-notes/2022/major/tools.rst b/docs/release-notes/2022/major/tools.rst
new file mode 100644 (file)
index 0000000..32a3588
--- /dev/null
@@ -0,0 +1,9 @@
+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!
+
index dfb12c7e5a2ae8c581cdd8be8d075811cf75af58..6915178928e706d9447cb3784d798b93d4fc5e37 100644 (file)
@@ -8,19 +8,19 @@ releases of |Gromacs|. Major releases contain changes to the
 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::
@@ -28,6 +28,26 @@ can be found at https://gitlab.com/gromacs/gromacs/-/issues at that issue number
 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
 
@@ -41,6 +61,8 @@ Major release
    2021/major/portability
    2021/major/miscellaneous
 
+Older (unmaintained) |Gromacs| series
+-------------------------------------------------------
 
 |Gromacs| 2020 series
 ---------------------
@@ -106,9 +128,6 @@ Major release
    2019/major/portability
    2019/major/miscellaneous
 
-Older (unmaintained) |Gromacs| series
--------------------------------------------------------
-
 |Gromacs| 2018 series
 ---------------------
 
index 9fac443fd75ae37d22d40b062cb347e9410130e1..6e70fb46df5217e761c03ec0c2655b5f5a86d519 100644 (file)
@@ -20,4 +20,4 @@ set_target_properties(gmxapi_extension_ensemblepotential PROPERTIES SKIP_BUILD_R
 # 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)
index 3cc6a2dbad0e3835225fe998aca8c9001fbb56fd..0952396d334cb0c46e940e691be9f8066f661337 100644 (file)
@@ -97,7 +97,7 @@ configure_file(testingconfiguration.in.h testingconfiguration.h)
 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)
 
index a4430e9dd6b356d01de7f3b301ddda8994f4630d..962c2b558c30404d85257b5b0a15303cff15e900 100644 (file)
@@ -142,10 +142,8 @@ if (WIN32)
 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
@@ -321,6 +319,8 @@ target_link_libraries(libgromacs
                       PUBLIC
                       ${GMX_PUBLIC_LIBRARIES}
                       )
+target_link_libraries(libgromacs PUBLIC legacy_api)
+
 if (GMX_OPENMP)
     target_link_libraries(libgromacs PUBLIC OpenMP::OpenMP_CXX)
 endif()
@@ -380,6 +380,7 @@ 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
@@ -398,8 +399,8 @@ if (NOT GMX_BUILD_MDRUN_ONLY OR BUILD_SHARED_LIBS)
     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)
index bcecb7340e7f0ca17cbf22adf1a96d2eb4d4371f..c55d59b055fcc4e6247ccc1ceb8f7b86923d40c3 100644 (file)
@@ -35,6 +35,7 @@
 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
index 8d293464b7b069a005aecb843a6689d8fbcfcc4f..de0bbb1b9a10eeb98b1d857a37e79e2238b5ea44 100644 (file)
  */
 
 /* 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)
 {
@@ -74,10 +74,8 @@ real calcFftGrid(FILE* fp, const matrix box, real gridSpacing, int minGridPoints
         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:
      *
index f0e81bb03cd50c4434b9afc32eaf3138b0fd7053..3738f1d2ad12281ae58ad62372d529bc4a343428 100644 (file)
@@ -49,17 +49,6 @@ endif()
 
 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()
index 7114d54c6d7e56862080fd25fcaaddc440d98e1b..3b52aadf1c217d5fe90ad2e8ee475040b80cea33 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "confio.h"
+#include "gromacs/fileio/confio.h"
 
 #include <cstdio>
 #include <cstring>
index 2371bc235566d908523c062372be30da9d1a8d8b..ac6c5820be15783e7832fe3ae9898818542d1f18 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "filetypes.h"
+#include "gromacs/fileio/filetypes.h"
 
 #include <cstring>
 
index 0c99fa191a521704831fc02f86b81c540e23b968..e51c52ccc1b525eb2d935828d8b8e29d067c377b 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "oenv.h"
+#include "gromacs/fileio/oenv.h"
 
 #include "gromacs/utility/enumerationhelpers.h"
 #include "gromacs/utility/exceptions.h"
index f551dde39129a3e06e80fd3f854f0325377f421b..c3f6810bcbca812089508caa5719ca586a6399a9 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "pdbio.h"
+#include "gromacs/fileio/pdbio.h"
 
 #include <cctype>
 #include <cmath>
index 5017b67f4c53d98e9e17ce20f8ab08888da68dbf..6b9186057719abb2861b35f147389d500b118b93 100644 (file)
@@ -48,3 +48,4 @@ gmx_add_unit_test(FileIOTests fileio-test
         ${tng_sources}
         xvgio.cpp
     )
+target_link_libraries(fileio-test PRIVATE legacy_api)
index 9ea2337f86727f243dca4cff6997fe0b5e13d248..b72e66cf2acee6f6a92015b8926e0286ff96ec02 100644 (file)
@@ -39,7 +39,7 @@
 
 /* This file is completely threadsafe - keep it that way! */
 
-#include "tpxio.h"
+#include "gromacs/fileio/tpxio.h"
 
 #include <cstdio>
 #include <cstdlib>
index 1a3df9b8e55b0252a37bf9e7405b8a06ad22b384..cdb0ef93cd82214df4a860733b27a5e4d4ecbb1d 100644 (file)
@@ -232,105 +232,6 @@ static void process_interaction_modifier(int* eintmod)
     }
 }
 
-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,
@@ -354,6 +255,19 @@ void check_ir(const char*                   mdparin,
 
     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]);
@@ -1992,18 +1906,17 @@ void get_ir(const char*     mdparin,
     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");
@@ -2758,7 +2671,13 @@ void get_ir(const char*     mdparin,
     /* 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)
@@ -4185,7 +4104,7 @@ static void check_combination_rules(const t_inputrec* ir, const gmx_mtop_t* mtop
 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;
index 65050546ff4003ed05215ab1662986c553a95a47..a936ef43d5c9263179043cd7d45664fad55cd8d3 100644 (file)
@@ -43,6 +43,7 @@
 
 #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"
 
@@ -87,23 +88,22 @@ enum
 
 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 */
index 4c0ab0c09ca8794ec055ab1fc288bac34be96f64..75c7ac1037e986db0cfed86c1cf40e8a27b4d03d 100644 (file)
@@ -47,6 +47,10 @@ set(LINEARALGEBRA_SOURCES
     ${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
@@ -62,5 +66,6 @@ else()
     # 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)
index 41c74f9294a23e40c02ce3fa6b5821afc4f4c1df..9cd1273cb9bc04a74ce27358273203233ca114b7 100644 (file)
@@ -770,8 +770,8 @@ std::vector<PaddedVector<RVec>> c_coordinatesForTestsZeroAngle = {
 //! 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),
index 16d6ccd7408227be68d04e515f169c1a4d290314..a879d44e2e34d86b4c1c75ecb0a4d097d368a7cf 100644 (file)
 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()
index b8be02f06dbc903616c8643ef6e2a9209a7bcc7a..d214c9b689f4ebc4cc7e805f8f11fa69b72ca1b5 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "do_fit.h"
+#include "gromacs/math/do_fit.h"
 
 #include <cmath>
 #include <cstdio>
index 2cd3e3280a82a23ff8371ade0c91b0aaa7e55ba8..db8b99db426c8122d939c6a96ce356f304cfba1e 100644 (file)
@@ -3,7 +3,7 @@
  *
  * 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.
@@ -44,7 +44,7 @@
 
 #include "gmxpre.h"
 
-#include "functions.h"
+#include "gromacs/math/functions.h"
 
 #include "config.h"
 
index 6881111e60613897049147da154d70721519a11c..883e74d15197cf010681e76014cded7691d905fc 100644 (file)
@@ -35,7 +35,7 @@
  */
 #include "gmxpre.h"
 
-#include "units.h"
+#include "gromacs/math/units.h"
 
 #include <cstdio>
 
index 3412f2c47208c4a6d591875ff40de9dab8e75e53..067cc32b25b81476635397f0a0bba91371a8c210 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "utilities.h"
+#include "gromacs/math/utilities.h"
 
 #include "config.h"
 
index 0a9f0dc89f6d760a31fcef32f4cdacd9a7982daf..ad0e645c4e19cc40309c7be7ac9a2de652c0b64c 100644 (file)
@@ -1163,7 +1163,8 @@ void init_forcerec(FILE*                            fp,
 
     if (fr->useMts)
     {
-        gmx::assertMtsRequirements(*ir);
+        GMX_ASSERT(gmx::checkMtsRequirements(*ir).empty(),
+                   "All MTS requirements should be met here");
     }
 
     const bool haveDirectVirialContributionsFast =
index e538b8ffeddf3529ba31202757571cc24022d46f..1a95671662ce36728d8131a7dea049d445360f6d 100644 (file)
@@ -34,6 +34,7 @@
 
 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
index 02bcf41be33c7f765b74dd9de4eb892a8bb1d52c..ef25f9cd0e4c4b67e3ae3ed9683ee233afaf652d 100644 (file)
 
 #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
 {
@@ -56,41 +61,163 @@ int nonbondedMtsFactor(const t_inputrec& ir)
     }
 }
 
-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
index 5796114005aea21d695b4281488294ac672efd4d..f59a5b49f8d7eeab4b6d739f13d33ac33dc139f2 100644 (file)
@@ -35,6 +35,9 @@
 #ifndef GMX_MULTIPLETIMESTEPPING_H
 #define GMX_MULTIPLETIMESTEPPING_H
 
+#include <string>
+#include <vector>
+
 #include <bitset>
 
 #include "gromacs/utility/arrayref.h"
@@ -58,6 +61,7 @@ enum class MtsForceGroups : int
     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"
 };
@@ -89,8 +93,42 @@ static inline int forceGroupMtsLevel(ArrayRef<const MtsLevel> mtsLevels, const M
  */
 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
 
index 69e1b6b00b17e8bebf82e474a0a5d423843ab274..90d37b1d51389edbc0d15720cd30f7b4f16e7d8d 100644 (file)
@@ -36,4 +36,5 @@ gmx_add_unit_test(MdtypesUnitTest mdtypes-test
     CPP_SOURCE_FILES
         checkpointdata.cpp
         forcebuffers.cpp
+        multipletimestepping.cpp
         )
diff --git a/src/gromacs/mdtypes/tests/multipletimestepping.cpp b/src/gromacs/mdtypes/tests/multipletimestepping.cpp
new file mode 100644 (file)
index 0000000..f69a45a
--- /dev/null
@@ -0,0 +1,232 @@
+/*
+ * 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
index ac50973e41ceb9cd2278ad4afb69a58d2050a519..30614ffac87ece02862f1a4f137d244fc2439e10 100644 (file)
@@ -40,6 +40,7 @@ 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)
+target_link_libraries(modularsimulator PRIVATE legacy_api)
 
 if(GMX_OPENMP)
     # Explicitly set properties for modular simulator module to compile with openmp
index a1c646c826ead2e847862b71783b96de6ff48b2a..875b535560fa85ffa334e41a22441c9b52d5f58f 100644 (file)
@@ -519,8 +519,9 @@ static void sum_com_part_cosweight(const pull_group_work_t* pgrp,
 
 /* 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)
index 06a082e57fdd4005f2d62ec91472474fc2bd5405..d1bc6a3e80073d5898271e5acde28f4ff8db8327 100644 (file)
@@ -1,7 +1,7 @@
 #
 # 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.
@@ -37,8 +37,6 @@ 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)
 
 if (BUILD_TESTING)
     add_subdirectory(tests)
index e621fa58813b9033bb42c1d709a304e2ffe9c414..a0c5e11170737a368f2367866807944b9a8d09cc 100644 (file)
@@ -56,6 +56,8 @@ else()
     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)
 
index ee43c3cada45242f2fe5c960048e3b7ae7c7dac1..502f5f0961f5ffcc3f192048c3e38970d25737fa 100644 (file)
@@ -466,7 +466,7 @@ TEST_F(SimdFloatingpointUtilTest, transposeScatterDecrU3Overlapping)
         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++)
index 93e82808cde05fa4fe50da929ba1f9a2f8eb29b3..d4d9c0a5e31a13051321dc8a9a6f3959cc81488c 100644 (file)
@@ -39,22 +39,11 @@ if (GMX_GPU_CUDA)
 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
index 84e57940a50f43b119e119d514588507e31a274e..784cf34b250af31a72a9f86641773dc011d34cd5 100644 (file)
@@ -42,7 +42,7 @@
  */
 #include "gmxpre.h"
 
-#include "exceptions.h"
+#include "gromacs/utility/exceptions.h"
 
 #include <cstring>
 
index e0d06d56ab3a9de92772d25c22391bf7c43490df..b75f5a81a33fbf980087cf0ba3a5752b03033cd0 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * 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.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "gmxassert.h"
+#include "gromacs/utility/gmxassert.h"
 
 #include <cstdio>
 #include <cstdlib>
index d41ca70478fda8a79dd18a52e64f920a321137d6..5797b1de820b9d43dcc56fe9c1bd9d7208793d8c 100644 (file)
@@ -41,13 +41,14 @@ target_compile_definitions(mdrun_objlib PRIVATE HAVE_CONFIG_H)
 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)
@@ -74,7 +75,9 @@ else()
     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
@@ -84,9 +87,10 @@ else()
     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()
index b051068c0670184835bd4dda10d283a2b7e00d10..7c0a67a76338a2a80a11f88ced44d27e30d29148 100644 (file)
@@ -47,6 +47,7 @@ gmx_add_unit_test_library(mdrun_test_infrastructure
     $<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
index e932e692b077e4bb5f06138433150b8648aaae1f..2d96c50053ed249cb76ff5b3a1fbe7a7854d5b10 100644 (file)
@@ -84,6 +84,8 @@ if (GMX_GPU_CUDA)
 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