Merge branch 'origin/release-2021' into merge-2021-into-master
authorPaul Bauer <paul.bauer.q@gmail.com>
Tue, 24 Nov 2020 15:58:43 +0000 (16:58 +0100)
committerPaul Bauer <paul.bauer.q@gmail.com>
Tue, 24 Nov 2020 15:58:43 +0000 (16:58 +0100)
Resolved Conflicts:
cmake/gmxVersionInfo.cmake
docs/release-notes/index.rst
src/gromacs/mdlib/CMakeLists.txt
src/gromacs/mdrun/md.cpp

222 files changed:
CMakeLists.txt
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/gmxapi/CMakeLists.txt
api/gmxapi/cpp/CMakeLists.txt
api/gmxapi/cpp/cmake/gmxapi-config.cmake.in
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/fileio/trxio.h [moved from src/gromacs/fileio/trxio.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/build-system.rst
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/gmxapi/userguide/usage.rst
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
python_packaging/sample_restraint/tests/conftest.py
python_packaging/src/CMakeLists.txt
python_packaging/src/gmxapi/commandline.py
python_packaging/src/gmxapi/version.py
python_packaging/src/setup.py
python_packaging/src/test/conftest.py
python_packaging/src/test/test_commandline.py
share/template/CMakeLists.txt
src/CMakeLists.txt
src/gromacs/CMakeLists.txt
src/gromacs/analysisdata/CMakeLists.txt
src/gromacs/analysisdata/tests/CMakeLists.txt
src/gromacs/applied_forces/CMakeLists.txt
src/gromacs/commandline/CMakeLists.txt
src/gromacs/compat/CMakeLists.txt
src/gromacs/coordinateio/CMakeLists.txt
src/gromacs/correlationfunctions/CMakeLists.txt
src/gromacs/domdec/CMakeLists.txt
src/gromacs/essentialdynamics/CMakeLists.txt
src/gromacs/ewald/CMakeLists.txt
src/gromacs/fft/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/fileio/trxio.cpp
src/gromacs/gmxana/CMakeLists.txt
src/gromacs/gmxlib/CMakeLists.txt
src/gromacs/gmxpreprocess/CMakeLists.txt
src/gromacs/gmxpreprocess/readir.cpp
src/gromacs/gmxpreprocess/readir.h
src/gromacs/gpu_utils/CMakeLists.txt
src/gromacs/hardware/CMakeLists.txt
src/gromacs/hardware/cpuinfo.cpp
src/gromacs/hardware/cpuinfo.h
src/gromacs/hardware/detecthardware.cpp
src/gromacs/imd/CMakeLists.txt
src/gromacs/linearalgebra/CMakeLists.txt
src/gromacs/listed_forces/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/CMakeLists.txt
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/tests/constr.cpp
src/gromacs/mdlib/update_vv.cpp [new file with mode: 0644]
src/gromacs/mdlib/update_vv.h [new file with mode: 0644]
src/gromacs/mdrun/CMakeLists.txt
src/gromacs/mdrun/md.cpp
src/gromacs/mdrunutility/CMakeLists.txt
src/gromacs/mdrunutility/tests/CMakeLists.txt
src/gromacs/mdspan/CMakeLists.txt
src/gromacs/mdspan/tests/CMakeLists.txt
src/gromacs/mdtypes/CMakeLists.txt
src/gromacs/mdtypes/md_enums.cpp
src/gromacs/mdtypes/md_enums.h
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/mimic/CMakeLists.txt
src/gromacs/modularsimulator/CMakeLists.txt
src/gromacs/nbnxm/CMakeLists.txt
src/gromacs/nbnxm/atomdata.cpp
src/gromacs/nbnxm/atomdata.h
src/gromacs/nbnxm/cuda/nbnxm_cuda.cu
src/gromacs/nbnxm/cuda/nbnxm_cuda_data_mgmt.cu
src/gromacs/nbnxm/gpu_data_mgmt.h
src/gromacs/nbnxm/gpu_types_common.h
src/gromacs/nbnxm/nbnxm.h
src/gromacs/nbnxm/nbnxm_gpu.h
src/gromacs/nbnxm/nbnxm_gpu_data_mgmt.cpp
src/gromacs/nbnxm/nbnxm_gpu_data_mgmt.h
src/gromacs/nbnxm/opencl/nbnxm_ocl.cpp
src/gromacs/nbnxm/opencl/nbnxm_ocl_data_mgmt.cpp
src/gromacs/nbnxm/opencl/nbnxm_ocl_jit_support.cpp
src/gromacs/nbnxm/opencl/nbnxm_ocl_kernel_utils.clh
src/gromacs/nbnxm/opencl/nbnxm_ocl_types.h
src/gromacs/onlinehelp/CMakeLists.txt
src/gromacs/onlinehelp/tests/CMakeLists.txt
src/gromacs/options/CMakeLists.txt
src/gromacs/pbcutil/CMakeLists.txt
src/gromacs/pulling/CMakeLists.txt
src/gromacs/pulling/pullutil.cpp
src/gromacs/random/CMakeLists.txt
src/gromacs/restraint/CMakeLists.txt
src/gromacs/selection/CMakeLists.txt
src/gromacs/simd/CMakeLists.txt
src/gromacs/simd/support.cpp
src/gromacs/simd/tests/simd_floatingpoint_util.cpp
src/gromacs/statistics/CMakeLists.txt
src/gromacs/swap/CMakeLists.txt
src/gromacs/tables/CMakeLists.txt
src/gromacs/taskassignment/CMakeLists.txt
src/gromacs/timing/CMakeLists.txt
src/gromacs/tools/CMakeLists.txt
src/gromacs/topology/CMakeLists.txt
src/gromacs/trajectory/CMakeLists.txt
src/gromacs/trajectoryanalysis/CMakeLists.txt
src/gromacs/trajectoryanalysis/tests/CMakeLists.txt
src/gromacs/utility/CMakeLists.txt
src/gromacs/utility/exceptions.cpp
src/gromacs/utility/gmxassert.cpp
src/gromacs/utility/tests/CMakeLists.txt
src/include/gmxpre.h [moved from src/gmxpre.h with 98% similarity]
src/programs/CMakeLists.txt
src/programs/mdrun/tests/CMakeLists.txt
src/testutils/CMakeLists.txt
src/testutils/TestMacros.cmake
src/testutils/cmdlinetest.cpp
src/testutils/conftest.cpp
src/testutils/filematchers.cpp
src/testutils/include/testutils/cmdlinetest.h [moved from src/testutils/cmdlinetest.h with 100% similarity]
src/testutils/include/testutils/conftest.h [moved from src/testutils/conftest.h with 97% similarity]
src/testutils/include/testutils/filematchers.h [moved from src/testutils/filematchers.h with 98% similarity]
src/testutils/include/testutils/interactivetest.h [moved from src/testutils/interactivetest.h with 98% similarity]
src/testutils/include/testutils/loggertest.h [moved from src/testutils/loggertest.h with 97% similarity]
src/testutils/include/testutils/mpitest.h [moved from src/testutils/mpitest.h with 98% similarity]
src/testutils/include/testutils/refdata.h [moved from src/testutils/refdata.h with 100% similarity]
src/testutils/include/testutils/setenv.h [moved from src/testutils/setenv.h with 97% similarity]
src/testutils/include/testutils/simulationdatabase.h [moved from src/testutils/simulationdatabase.h with 98% similarity]
src/testutils/include/testutils/stdiohelper.h [moved from src/testutils/stdiohelper.h with 97% similarity]
src/testutils/include/testutils/stringtest.h [moved from src/testutils/stringtest.h with 97% similarity]
src/testutils/include/testutils/test_device.h [moved from src/testutils/test_device.h with 100% similarity]
src/testutils/include/testutils/test_hardware_environment.h [moved from src/testutils/test_hardware_environment.h with 100% similarity]
src/testutils/include/testutils/testasserts.h [moved from src/testutils/testasserts.h with 100% similarity]
src/testutils/include/testutils/testexceptions.h [moved from src/testutils/testexceptions.h with 97% similarity]
src/testutils/include/testutils/testfilemanager.h [moved from src/testutils/testfilemanager.h with 100% similarity]
src/testutils/include/testutils/testfileredirector.h [moved from src/testutils/testfileredirector.h with 98% similarity]
src/testutils/include/testutils/testinit.h [moved from src/testutils/testinit.h with 100% similarity]
src/testutils/include/testutils/testmatchers.h [moved from src/testutils/testmatchers.h with 100% similarity]
src/testutils/include/testutils/testoptions.h [moved from src/testutils/testoptions.h with 100% similarity]
src/testutils/include/testutils/textblockmatchers.h [moved from src/testutils/textblockmatchers.h with 98% similarity]
src/testutils/include/testutils/tprfilegenerator.h [moved from src/testutils/tprfilegenerator.h with 97% similarity]
src/testutils/include/testutils/xvgtest.h [moved from src/testutils/xvgtest.h with 98% similarity]
src/testutils/interactivetest.cpp
src/testutils/loggertest.cpp
src/testutils/mpitest.cpp
src/testutils/refdata.cpp
src/testutils/refdata_checkers.h
src/testutils/refdata_xml.cpp
src/testutils/refdata_xml.h
src/testutils/simulationdatabase.cpp
src/testutils/stdiohelper.cpp
src/testutils/stringtest.cpp
src/testutils/test_device.cpp
src/testutils/test_hardware_environment.cpp
src/testutils/testasserts.cpp
src/testutils/testfilemanager.cpp
src/testutils/testfileredirector.cpp
src/testutils/testinit.cpp
src/testutils/testmatchers.cpp
src/testutils/testoptions.cpp
src/testutils/tests/CMakeLists.txt
src/testutils/textblockmatchers.cpp
src/testutils/tprfilegenerator.cpp
src/testutils/xvgtest.cpp

index 8884423152cf62d73bc2096ae1f33778bf293c74..945cacd0c9ec6fa879afeefa200e8b93ccd7fa85 100644 (file)
@@ -602,10 +602,7 @@ gmx_add_cache_dependency(GMX_BUILD_UNITTESTS BOOL BUILD_TESTING OFF)
 # Our own GROMACS tests
 ########################################################################
 
-include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src)
 include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/src/external)
-# Required for config.h, maybe should only be set in src/CMakeLists.txt
-include_directories(BEFORE ${CMAKE_BINARY_DIR}/src)
 
 include(gmxTestInlineASM)
 gmx_test_inline_asm_gcc_x86(GMX_X86_GCC_INLINE_ASM)
index 4b2cb78693f9343d5eb9692fe178625a68e6bbd1..a1736411125e79db323fb4f2c705bfc8bc800139 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 2360be64bc178d40b841abec4b488a0b3cb998d8..939b51142de68461cbb6563f1d59f6281b1f45dc 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 560e5cb991d6699a6d3ef94e090b249aa9eb6a23..e98ae896e09c190b22f4396bafc30a670d623de7 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 3ffd73e073be634a524b2a62414c36f47dfbb660..5b0fb42219e046e6b1ee389bf1071fa1985bdc78 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 4f024eba9dcfa5197eb097edabb4f2646eba1cc2..8926edddeee26383dc17c6eb032598bdbecea49c 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)
index 12b2fd4226304f7e2f841b7294aa3edb544dc618..d136d315cbf65c34b6a3a1ce8707ff4cd288ed55 100644 (file)
@@ -50,7 +50,7 @@
 # be tagged. Official GROMACS releases should be mappable to a distinct gmxapi
 # release string. For roadmap details, see https://gitlab.com/gromacs/gromacs/-/issues/2585
 set(GMXAPI_MAJOR 0)
-set(GMXAPI_MINOR 2)
+set(GMXAPI_MINOR 3)
 set(GMXAPI_PATCH 0)
 set(GMXAPI_RELEASE ${GMXAPI_MAJOR}.${GMXAPI_MINOR}.${GMXAPI_PATCH})
 
@@ -70,6 +70,8 @@ if (GMX_LIB_MPI)
     find_package(MPI COMPONENTS C)
     if (MPI_C_FOUND)
         target_link_libraries(gmxapi PRIVATE MPI::MPI_C)
+        # If clients also need to link this target, we need to provide help in gmxapi-config.cmake
+        set(_gmxapi_find_dependencies "find_dependency(MPI COMPONENTS C)")
     else()
         message(FATAL_ERROR "Building gmxapi for MPI-enabled GROMACS, but no MPI toolchain found.")
     endif ()
index 52d88c54dce11188c1ce70191028b440be493085..1e07928a83f3b2fb18977bccf75060539a3a7e93 100644 (file)
@@ -84,6 +84,9 @@ set_target_properties(gmxapi PROPERTIES
                       )
 
 target_link_libraries(gmxapi PRIVATE libgromacs)
+target_link_libraries(gmxapi PRIVATE common)
+# TODO: Explicitly link specific modules: mdlib, mdtypes, utility, commandline
+target_link_libraries(gmxapi PRIVATE legacy_modules)
 
 
 ################################################
index fcb7de77e103d4ca06183f2ba758d71aae34fd70..829e802bc639e4b689a6af3ae30aa6b4b34a4ac1 100644 (file)
@@ -2,6 +2,8 @@ set(gmxapi_VERSION @GMXAPI_RELEASE@)
 @PACKAGE_INIT@
 # Refer to CMake docs for information on more elaborate use of this stub file:
 # https://cmake.org/cmake/help/v3.4/module/CMakePackageConfigHelpers.html#command:configure_package_config_file
+include(CMakeFindDependencyMacro)
+@_gmxapi_find_dependencies@
 include("${CMAKE_CURRENT_LIST_DIR}/gmxapi.cmake")
 check_required_components(gmxapi)
 set_property(TARGET Gromacs::gmxapi PROPERTY MPI "@_mpi@")
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 a87af6108132e1cb9643c300a32093ffc5e842d7..99fcfae3d5126ff8b58c1a386c4f6c8f805c7503 100644 (file)
@@ -111,6 +111,11 @@ 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)
+target_link_libraries(nblib PRIVATE common)
+# There are transitive dependencies on the legacy GROMACS headers.
+target_link_libraries(nblib PUBLIC legacy_api)
+# TODO: Explicitly link specific modules.
+target_link_libraries(nblib PRIVATE legacy_modules)
 
 install(TARGETS nblib
         EXPORT nblib
index 4707595b4dbc0a262e0278be67817b5b5819511d..f2f2d889c4fd376317964f039a0ca6f35d42bb2c 100644 (file)
@@ -46,6 +46,9 @@ 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)
+# TODO: Explicitly link specific modules: math,
+target_link_libraries(nblib_test_infrastructure PRIVATE legacy_modules)
 
 set(testname "NbLibSetupTests")
 set(exename "nblib-setup-test")
index 5a1fb99b093393f29c7dc1e17388afc2e62a682a..73295bdd962bacf31f8b85ed8f08f3d67a14c45c 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 "-beta2")
+set(GMX_VERSION_SUFFIX "")
 
 # Conventionally with libtool, any ABI change must change the major
 # version number, the minor version number should change if it's just
@@ -214,7 +215,7 @@ set(GMX_VERSION_SUFFIX "-beta2")
 # 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 a35b57f78427902aba124c80fa84cdb690a8038e..d3be576fb9711a6223274e5c9a4b787517bb83f1 100644 (file)
@@ -566,7 +566,9 @@ The build system uses a few different mechanisms to influence the compilation:
     headers fall in this category.  See Doxygen documentation for
     :file:`gmxpre.h`.
 
-  All the above files get generated in :file:`src/`.
+  The above files are available through the INTERFACE_INCLUDE_DIR of
+  the ``common`` CMake target. I.e. to ``#include "config.h"``, be sure to
+  ``target_link_libraries(mymodule PRIVATE common)``
 
   Additionally, the following file is generated by the build system:
 
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 cc9afd0cc5acd1b0f9dc323ec2bb8a3c7a9256d4..7cd08a764b748875803e90f5c5c99d8ddf41dfb0 100644 (file)
@@ -145,7 +145,7 @@ For example, you might create a :command:`gmx solvate` operation as::
                                                       }
 
 To check the status or error output of a command line operation, refer to the
-``returncode`` and ``erroroutput`` outputs.
+``returncode`` and ``stderr`` outputs.
 To access the results from the output file arguments, use the command line flags
 as keys in the ``file`` dictionary output.
 
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 6b41402eb98eb2ad7f5b0c7f8c9bd22fc1d504f0..90a44ee75e19e7f0aaac0cf48ab06651701a9568 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 on the `issue tracker`_ at that issue number.
 
-|Gromacs| 2021 series
+|Gromacs| 2022 series
 ---------------------
 
 .. todolist::
@@ -28,6 +28,26 @@ can be found on the `issue tracker`_ 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,10 @@ Major release
    2021/major/portability
    2021/major/miscellaneous
 
+
+Older (unmaintained) |Gromacs| series
+-------------------------------------------------------
+
 |Gromacs| 2020 series
 ---------------------
 
@@ -105,9 +129,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 37ef0767824a937fcd2a92c7ce5d3ff8526e0a8b..e439b3366ec92f2cc49a51ff09915f105703d67a 100644 (file)
@@ -96,7 +96,7 @@ def spc_water_box(gmxcli, remove_tempdir):
         assert os.path.exists(topfile)
 
         if solvate.output.returncode.result() != 0:
-            logging.debug(solvate.output.erroroutput.result())
+            logging.debug(solvate.output.stderr.result())
             raise RuntimeError('solvate failed in spc_water_box testing fixture.')
 
         # Choose an exactly representable dt of 2^-9 ps (approximately 0.002)
@@ -132,7 +132,7 @@ def spc_water_box(gmxcli, remove_tempdir):
                                            output_files={'-o': tprfile})
         tprfilename = grompp.output.file['-o'].result()
         if grompp.output.returncode.result() != 0:
-            logging.debug(grompp.output.erroroutput.result())
+            logging.debug(grompp.output.stderr.result())
             raise RuntimeError('grompp failed in spc_water_box testing fixture.')
 
         # TODO: more inspection of grompp errors...
index c75549fc8213ba825f08154b882a04fb168982ff..1e82f3ba95a9ce5fb4ec8354513badec46914f9a 100644 (file)
@@ -55,7 +55,7 @@ set(CMAKE_OSX_ARCHITECTURES x86_64 CACHE STRING
 # Note that this is the gmxapi._gmxapi Python bindings package version,
 # not the C++ API version. It is not essential that it match the pure Python
 # package version, but is likely to do so.
-project(gmxapi VERSION 0.2.0)
+project(gmxapi VERSION 0.3.0)
 
 # Check if Python package is being built directly or via add_subdirectory
 set(GMXAPI_MASTER_PROJECT OFF)
index 0166dcebe13d56e1413aefabea6a3158c377f076..04269854925ccc7f6e5fa2f982975f64f416b432 100644 (file)
@@ -60,7 +60,8 @@ logger.info('Importing {}'.format(__name__))
 #    * provides `output` publishing proxy to the inner function and
 #    * produce a result with attributes for
 #       * file: mapping of output flags to output filenames
-#       * erroroutput: text results in case of error
+#       * stdout: process STDOUT
+#       * stderr: porcess STDERR
 #       * returncode: integer return code of wrapped command
 #
 # Note that the existence of the 'file' output map is expressed here, but
@@ -70,7 +71,9 @@ logger.info('Importing {}'.format(__name__))
 #
 # TODO: Operation returns the output object when called with the shorter signature.
 #
-@gmx.function_wrapper(output={'erroroutput': str, 'returncode': int})
+@gmx.function_wrapper(output={'stdout': str,
+                              'stderr': str,
+                              'returncode': int})
 def cli(command: NDArray, shell: bool, output: OutputCollectionDescription, stdin: str = ''):
     """Execute a command line program in a subprocess.
 
@@ -117,23 +120,21 @@ def cli(command: NDArray, shell: bool, output: OutputCollectionDescription, stdi
             >>> my_filename = "somefilename"
             >>> result = cli(('exe', '--origin', 1.0, 2.0, 3.0, '-f', my_filename), shell=False)
             >>> assert hasattr(result, 'file')
-            >>> assert hasattr(result, 'erroroutput')
+            >>> assert hasattr(result, 'stdout')
+            >>> assert hasattr(result, 'stderr')
             >>> assert hasattr(result, 'returncode')
 
     Returns:
-        A data structure with attributes for each of the results `file`, `erroroutput`, and `returncode`
+        A data structure with attributes for each of the results `file`, `stdout`, `stderr`, and `returncode`
 
     Result object attributes:
         * `file`: the mapping of CLI flags to filename strings resulting from the `output` kwarg
-        * `erroroutput`: A string of error output (if any) if the process failed.
+        * `stdout`: A string mapping from process STDOUT.
+        * `stderr`: A string mapping from process STDERR; it will be the
+                    error output (if any) if the process failed.
         * `returncode`: return code of the subprocess.
 
     """
-    # Note: we could make provisions for stdio filehandles in a future version. E.g.
-    # * STDOUT is available if a consuming operation is bound to `output.stdout`.
-    # * STDERR is available if a consuming operation is bound to `output.stderr`.
-    # * Otherwise, STDOUT and/or STDERR is(are) closed when command is called.
-
     # In the operation implementation, we expect the `shell` parameter to be intercepted by the
     # wrapper and set to False.
     if shell:
@@ -154,7 +155,8 @@ def cli(command: NDArray, shell: bool, output: OutputCollectionDescription, stdi
     # TODO: (FR9) Can OS input/output filehandles be a responsibility of
     #  the code providing 'resources'?
 
-    erroroutput = ''
+    stdout = ''
+    stderr = ''
     logger.debug('executing subprocess')
     try:
         completed_process = subprocess.run(command,
@@ -162,20 +164,38 @@ def cli(command: NDArray, shell: bool, output: OutputCollectionDescription, stdi
                                            input=stdin,
                                            check=True,
                                            stdout=subprocess.PIPE,
-                                           stderr=subprocess.STDOUT,
+                                           stderr=subprocess.PIPE,
                                            encoding='utf-8',
                                            universal_newlines=True
                                            )
         returncode = completed_process.returncode
         # TODO: Resource management code should manage a safe data object for `output`.
-        for line in completed_process.stdout.split('\n'):
-            logger.debug(line)
+        logger.debug('STDOUT:')
+        if completed_process.stderr is not None:
+            for line in completed_process.stdout.split('\n'):
+                logger.debug(line)
+        else:
+            logger.debug('STDOUT is empty')
+        logger.debug('STDERR:')
+        if completed_process.stderr is not None:
+            for line in completed_process.stderr.split('\n'):
+                logger.debug(line)
+        else:
+            logger.debug('STDERR is empty')
+
+        stdout = completed_process.stdout
+        stderr = completed_process.stderr
+
     except subprocess.CalledProcessError as e:
-        logger.info("commandline operation had non-zero return status when calling {}".format(e.cmd))
-        erroroutput = e.output
+        logger.info("commandline operation had non-zero return status"
+                    "when calling {}".format(e.cmd))
+        stdout = e.stdout
+        stderr = e.stderr
         returncode = e.returncode
+
     # Publish outputs.
-    output.erroroutput = erroroutput
+    output.stdout = stdout
+    output.stderr = stderr
     output.returncode = returncode
 
 
@@ -253,7 +273,9 @@ def commandline_operation(executable=None,
         The output node of the resulting operation handle contains
 
         * ``file``: the mapping of CLI flags to filename strings resulting from the ``output_files`` kwarg
-        * ``erroroutput``: A string of error output (if any) if the process failed.
+        * ``stdout``: A string mapping from process STDOUT.
+        * ``stderr``: A string mapping from process STDERR; it will be the
+                      error output (if any) if the process failed.
         * ``returncode``: return code of the subprocess.
 
     """
@@ -284,15 +306,23 @@ def commandline_operation(executable=None,
     #
     # TODO: (FR4+) Characterize the `file` dictionary key type:
     #  explicitly sequences rather than maybe-string/maybe-sequence-of-strings
-    @gmx.function_wrapper(output={'erroroutput': str, 'returncode': int, 'file': dict})
-    def merged_ops(erroroutput: str = None, returncode: int = None, file: dict = None,
+    @gmx.function_wrapper(output={'stdout': str,
+                                  'stderr': str,
+                                  'returncode': int,
+                                  'file': dict})
+    def merged_ops(stdout: str = None,
+                   stderr: str = None,
+                   returncode: int = None,
+                   file: dict = None,
                    output: OutputCollectionDescription = None):
-        assert erroroutput is not None
+        assert stdout is not None
+        assert stderr is not None
         assert returncode is not None
         assert file is not None
         assert output is not None
         output.returncode = returncode
-        output.erroroutput = erroroutput
+        output.stdout = stdout
+        output.stderr = stderr
         if returncode == 0:
             output.file = file
         else:
@@ -328,7 +358,8 @@ def commandline_operation(executable=None,
     # TODO: ``label`` kwarg
     # TODO: input fingerprinting
     cli_result = cli(**cli_args)
-    merged_result = merged_ops(erroroutput=cli_result.output.erroroutput,
+    merged_result = merged_ops(stdout=cli_result.output.stdout,
+                               stderr=cli_result.output.stderr,
                                returncode=cli_result.output.returncode,
                                file=output_files,
                                **kwargs)
index 3d2465d0272dcfd6afb95d65ed7873509157e53e..f5dd6c33558b909d60cd003608ab0dd4004d9878 100644 (file)
@@ -70,7 +70,7 @@ from .exceptions import FeatureNotAvailableError
 
 # TODO: Version management policy and procedures.
 _major = 0
-_minor = 2
+_minor = 3
 _micro = 0
 _suffix = 'b1'
 
index ff010604193ddac5b9e75d6f3e0dd1840e047bbf..612f5d8c16970b59fca71e366248a5b1d9b6ceb3 100644 (file)
@@ -155,7 +155,7 @@ setup(
     name='gmxapi',
 
     # TODO: single-source version information (currently repeated in gmxapi/version.py and CMakeLists.txt)
-    version='0.2.0b1',
+    version='0.3.0a1',
     python_requires='>=3.6',
     install_requires=['networkx>=2.0',
                       'numpy>=1'],
index aa9d69a2b0ecfd277c288873b86fd667f735447f..b80c21d4392ecc6044903236b1997e44a91f458f 100644 (file)
@@ -94,7 +94,7 @@ def spc_water_box(gmxcli, remove_tempdir):
         assert os.path.exists(topfile)
 
         if solvate.output.returncode.result() != 0:
-            logging.debug(solvate.output.erroroutput.result())
+            logging.debug(solvate.output.stderr.result())
             raise RuntimeError('solvate failed in spc_water_box testing fixture.')
 
         # Choose an exactly representable dt of 2^-9 ps (approximately 0.002)
@@ -130,7 +130,7 @@ def spc_water_box(gmxcli, remove_tempdir):
                                            output_files={'-o': tprfile})
         tprfilename = grompp.output.file['-o'].result()
         if grompp.output.returncode.result() != 0:
-            logging.debug(grompp.output.erroroutput.result())
+            logging.debug(grompp.output.stderr.result())
             raise RuntimeError('grompp failed in spc_water_box testing fixture.')
 
         # TODO: more inspection of grompp errors...
index 9aa5dbd4b4eb8d08d318596f18092c7262597892..b5dd1838fe056390d9715f37a712e9c6b2a1aa59 100644 (file)
@@ -60,15 +60,12 @@ class SimpleCliTestCase(unittest.TestCase):
         command = shutil.which('true')
         operation = commandline.cli(command=[command], shell=False)
 
-        # Note: 'stdout' and 'stderr' not mapped.
         # Note: getitem not implemented.
-        # assert not 'stdout' in operation.output
-        # assert not 'stderr' in operation.output
-        assert not hasattr(operation.output, 'stdout')
-        assert not hasattr(operation.output, 'stderr')
-
-        # Check for the attributes that we _do_ expect.
-        assert hasattr(operation.output, 'erroroutput')
+        # assert 'stdout' in operation.output
+        # assert 'stderr' in operation.output
+        assert hasattr(operation.output, 'stdout')
+        assert hasattr(operation.output, 'stderr')
+        assert not hasattr(operation.output, 'erroroutput')
         assert hasattr(operation.output, 'returncode')
 
         operation.run()
@@ -118,14 +115,13 @@ class CommandLineOperationSimpleTestCase(unittest.TestCase):
 
     def test_true(self):
         operation = commandline.commandline_operation(executable='true')
-        # Note: 'stdout' and 'stderr' not mapped.
         # Note: getitem not implemented.
-        # assert not 'stdout' in operation.output
-        # assert not 'stderr' in operation.output
-        assert not hasattr(operation.output, 'stdout')
-        assert not hasattr(operation.output, 'stderr')
+        # assert 'stdout' in operation.output
+        # assert 'stderr' in operation.output
+        assert not hasattr(operation.output, 'erroroutput')
         assert hasattr(operation.output, 'file')
-        assert hasattr(operation.output, 'erroroutput')
+        assert hasattr(operation.output, 'stdout')
+        assert hasattr(operation.output, 'stderr')
         assert hasattr(operation.output, 'returncode')
         assert operation.output.returncode.result() == 0
 
@@ -134,7 +130,7 @@ class CommandLineOperationSimpleTestCase(unittest.TestCase):
         assert operation.output.returncode.result() == 1
 
     def test_echo(self):
-        # TODO: (FR5+) do we want to pipeline or checkpoint stdout somehow?
+        # TODO: (#3549) Check stdout, stderr.
         operation = commandline.commandline_operation(executable='echo',
                                                       arguments=['hi there'])
         assert operation.output.returncode.result() == 0
index 47b14d0ef62d6e2187695b6b7f01a4a563803390..00828e711cdf8d63a1116c7e1c11a15ef5ac0e3a 100644 (file)
@@ -41,7 +41,7 @@ endif()
 # This should be removable once object libraries can directly use target_link_libraries
 # with CMake 3.12, #3290
 target_include_directories(template SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
-target_link_libraries(template libgromacs ${GMX_EXE_LINKER_FLAGS})
+target_link_libraries(template libgromacs legacy_modules ${GMX_EXE_LINKER_FLAGS})
 
 set(DOCUMENTATION_HTTP_URL_BASE
     http://jenkins.gromacs.org/job/Documentation_Nightly_master/javadoc)
index b987bdb5e56b62b382ae91e729601ca99a94bdd8..aac191361c61439090c18ebf3fea22b638972b5b 100644 (file)
@@ -53,7 +53,7 @@ endif()
 # CMAKE_BUILD_TYPE is #included into buildinfo.h and populates the
 # fields e.g. printed to the log file.
 file(GENERATE
-    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/compilerflaginfo-$<CONFIG>-$<COMPILE_LANGUAGE>.h
+    OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/compilerflaginfo-$<CONFIG>-$<COMPILE_LANGUAGE>.h
     INPUT ${CMAKE_CURRENT_SOURCE_DIR}/compilerflaginfo.h.cmakein
     CONDITION $<CONFIG:${CMAKE_BUILD_TYPE}>
     )
@@ -114,6 +114,19 @@ if (GMX_CLANG_TIDY)
    mark_as_advanced(CLANG_TIDY_EXE)
 endif()
 
+# Create a basic target for the `src` section of the build tree to capture
+# the library-level shared details through CMake infrastructure. It is not
+# installed or exported, so it must only be used as a PRIVATE dependency by
+# installed targets.
+# Initially, this is just an INTERFACE target to provide include directory.
+# It should also absorb global variables and compiler/linker details to be
+# provided as transitive usage requirements.
+# It could expand to aggregate the module targets in the future.
+add_library(common INTERFACE)
+target_include_directories(common INTERFACE
+                           ${CMAKE_CURRENT_SOURCE_DIR}/include
+                           ${CMAKE_CURRENT_BINARY_DIR}/include)
+
 add_subdirectory(external)
 
 if (BUILD_TESTING)
@@ -139,9 +152,9 @@ add_subdirectory(api)
 # header file in both of the make stages. That's slow, and is useless
 # busy work for ccache, too.
 string(TOUPPER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE_UPPER)
-configure_file(config.h.cmakein config.h)
-configure_file(gmxpre-config.h.cmakein gmxpre-config.h)
+configure_file(config.h.cmakein include/config.h)
+configure_file(gmxpre-config.h.cmakein include/gmxpre-config.h)
 
 set(CMAKE_BUILD_CONFIGURATION_C_FLAGS   ${CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE_UPPER}})
 set(CMAKE_BUILD_CONFIGURATION_CXX_FLAGS ${CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE_UPPER}})
-configure_file(buildinfo.h.cmakein buildinfo.h ESCAPE_QUOTES)
+configure_file(buildinfo.h.cmakein include/buildinfo.h ESCAPE_QUOTES)
index a4430e9dd6b356d01de7f3b301ddda8994f4630d..8212a66a3daa871b404df9af8138c84496bc0c9e 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
@@ -188,6 +186,13 @@ if (GMX_GPU_CUDA)
 else()
     add_library(libgromacs ${LIBGROMACS_SOURCES})
 endif()
+target_link_libraries(libgromacs PRIVATE $<BUILD_INTERFACE:common>)
+# As long as the libgromacs target has source files that reference headers from
+# modules that don't provide CMake targets, libgromacs needs to use `src/`
+# amongst its include directories (to support `#include "gromacs/module/header.h"`).
+add_library(legacy_modules INTERFACE)
+target_include_directories(legacy_modules INTERFACE $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/src>)
+target_link_libraries(libgromacs PRIVATE $<BUILD_INTERFACE:legacy_modules>)
 
 # Add these contents first because linking their tests can take a lot
 # of time, so we want lots of parallel work still available after
@@ -206,6 +211,7 @@ foreach(object_library ${libgromacs_object_library_dependencies})
         set_target_properties(${object_library} PROPERTIES POSITION_INDEPENDENT_CODE true)
     endif()
     target_include_directories(${object_library} SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
+    target_link_libraries(${object_library} PRIVATE common)
 
     # Add the sources from the object libraries to the main library.
     target_sources(libgromacs PRIVATE $<TARGET_OBJECTS:${object_library}>)
@@ -321,6 +327,60 @@ target_link_libraries(libgromacs
                       PUBLIC
                       ${GMX_PUBLIC_LIBRARIES}
                       )
+target_link_libraries(libgromacs PUBLIC legacy_api)
+# Dependencies from libgromacs to the modules are set up here, but
+# once the add_subdirectory() commands are re-ordered then
+# responsibility for setting this up will move to the respective
+# modules.
+target_link_libraries(libgromacs PRIVATE
+                      $<BUILD_INTERFACE:analysisdata>
+                      $<BUILD_INTERFACE:applied_forces>
+                      $<BUILD_INTERFACE:commandline>
+                      $<BUILD_INTERFACE:compat>
+                      $<BUILD_INTERFACE:coordinateio>
+                      $<BUILD_INTERFACE:correlationfunctions>
+                      $<BUILD_INTERFACE:domdec>
+#                      $<BUILD_INTERFACE:energyanalysis>
+                      $<BUILD_INTERFACE:essentialdynamics>
+                      $<BUILD_INTERFACE:ewald>
+                      $<BUILD_INTERFACE:fft>
+                      $<BUILD_INTERFACE:fileio>
+                      $<BUILD_INTERFACE:gmxana>
+                      $<BUILD_INTERFACE:gmxlib>
+                      $<BUILD_INTERFACE:gmxpreprocess>
+                      $<BUILD_INTERFACE:gpu_utils>
+                      $<BUILD_INTERFACE:hardware>
+                      $<BUILD_INTERFACE:imd>
+                      $<BUILD_INTERFACE:linearalgebra>
+                      $<BUILD_INTERFACE:listed_forces>
+                      $<BUILD_INTERFACE:math>
+                      $<BUILD_INTERFACE:mdlib>
+                      $<BUILD_INTERFACE:mdrun>
+                      $<BUILD_INTERFACE:mdrunutility>
+                      $<BUILD_INTERFACE:mdspan>
+                      $<BUILD_INTERFACE:mdtypes>
+                      $<BUILD_INTERFACE:mimic>
+                      $<BUILD_INTERFACE:modularsimulator>
+                      $<BUILD_INTERFACE:nbnxm>
+                      $<BUILD_INTERFACE:onlinehelp>
+                      $<BUILD_INTERFACE:options>
+                      $<BUILD_INTERFACE:pbcutil>
+                      $<BUILD_INTERFACE:pulling>
+                      $<BUILD_INTERFACE:random>
+                      $<BUILD_INTERFACE:restraint>
+                      $<BUILD_INTERFACE:selection>
+                      $<BUILD_INTERFACE:simd>
+                      $<BUILD_INTERFACE:statistics>
+                      $<BUILD_INTERFACE:swap>
+                      $<BUILD_INTERFACE:tables>
+                      $<BUILD_INTERFACE:taskassignment>
+                      $<BUILD_INTERFACE:timing>
+                      $<BUILD_INTERFACE:tools>
+                      $<BUILD_INTERFACE:topology>
+                      $<BUILD_INTERFACE:trajectory>
+                      $<BUILD_INTERFACE:trajectoryanalysis>
+                      $<BUILD_INTERFACE:utility>
+                      )
 if (GMX_OPENMP)
     target_link_libraries(libgromacs PUBLIC OpenMP::OpenMP_CXX)
 endif()
@@ -380,6 +440,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 +459,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 43b71d60ec8419f9b124bdf42e7f9211c16de451..c0541c80af83932d0eee74bed0790e2099598b56 100644 (file)
@@ -33,6 +33,7 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(analysisdata INTERFACE)
 file(GLOB ANALYSISDATA_SOURCES *.cpp modules/*.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${ANALYSISDATA_SOURCES} PARENT_SCOPE)
 
@@ -46,6 +47,37 @@ if(GMX_INSTALL_LEGACY_API)
             DESTINATION include/gromacs/analysisdata)
 endif()
 
+# Source files have the following private module dependencies.
+target_link_libraries(analysisdata PRIVATE
+#                      gmxlib
+#                      math
+#                      mdtypes
+#                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(analysisdata PUBLIC
+target_include_directories(analysisdata INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(analysisdata PUBLIC
+target_link_libraries(analysisdata INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when analysisdata is an OBJECT target
+#target_link_libraries(analysisdata PUBLIC legacy_api)
+#target_link_libraries(analysisdata PRIVATE common)
+
+# Module dependencies
+# analysisdata interfaces convey transitive dependence on these modules.
+#target_link_libraries(analysisdata PUBLIC
+target_link_libraries(analysisdata INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(analysisdata PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(analysisdata PRIVATE legacy_modules)
 
 add_subdirectory(modules)
 
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 498d44a220d3a56134a412990a8954b135cb83aa..92e40d38959c80ff450ee052afa191664ba487b4 100644 (file)
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(applied_forces INTERFACE)
+
+# Source files have the following private module dependencies.
+target_link_libraries(applied_forces PRIVATE
+                      #                      gmxlib
+                      #                      math
+                      #                      mdtypes
+                      #                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(applied_forces PUBLIC
+target_include_directories(applied_forces INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(applied_forces PUBLIC
+target_link_libraries(applied_forces INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(applied_forces PUBLIC legacy_api)
+#target_link_libraries(applied_forces PRIVATE common)
+
+# Module dependencies
+# This module convey transitive dependence on these modules.
+#target_link_libraries(applied_forces PUBLIC
+target_link_libraries(applied_forces INTERFACE
+                      #                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(applied_forces PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(applied_forces PRIVATE legacy_modules)
+
 gmx_add_libgromacs_sources(
     electricfield.cpp
     )
index 990e2f1233f6a283a19d0fdca5f2eaded86d699e..86078c36d79704de728a613d732e9b30d02c309c 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2012,2013,2014,2015,2019, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2019,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(commandline INTERFACE)
 file(GLOB COMMANDLINE_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${COMMANDLINE_SOURCES} PARENT_SCOPE)
 
+# Source files have the following private module dependencies.
+target_link_libraries(commandline PRIVATE
+#                      gmxlib
+#                      math
+#                      mdtypes
+#                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(commandline PUBLIC
+target_include_directories(commandline INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(commandline PUBLIC
+target_link_libraries(commandline INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when commandline is an OBJECT target
+#target_link_libraries(commandline PUBLIC legacy_api)
+#target_link_libraries(commandline PRIVATE common)
+
+# Module dependencies
+# commandline interfaces convey transitive dependence on these modules.
+#target_link_libraries(commandline PUBLIC
+target_link_libraries(commandline INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(commandline PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(commandline PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index 83326015337c60ce8d07a2a823d1ed62d957a109..8b4190ecf6e8b81fc6bd97c38bc20904c262ed9d 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.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(compat INTERFACE)
+
+# Source files have the following private module dependencies.
+target_link_libraries(compat PRIVATE
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(compat PUBLIC
+target_include_directories(compat INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(compat PUBLIC
+target_link_libraries(compat INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when compat is an OBJECT target
+#target_link_libraries(compat PUBLIC legacy_api)
+#target_link_libraries(compat PRIVATE common)
+
+# Module dependencies
+# compat interfaces convey transitive dependence on these modules.
+#target_link_libraries(compat PUBLIC
+target_link_libraries(compat INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(compat PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(compat PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index 6e73817f45daba4a5a815932a17f65c5761fcaa0..ffcc961f7322b8e0b9c3515c64244871fe67528d 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2019, by the GROMACS development team, led by
+# Copyright (c) 2019,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(coordinateio INTERFACE)
 file(GLOB COORDINATEIO_SOURCES *.cpp outputadapters/*.cpp)
-
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${COORDINATEIO_SOURCES} PARENT_SCOPE)
 
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(coordinateio PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(coordinateio PUBLIC
+target_include_directories(coordinateio INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(coordinateio PUBLIC
+target_link_libraries(coordinateio INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when coordinateio is an OBJECT target
+#target_link_libraries(coordinateio PUBLIC legacy_api)
+#target_link_libraries(coordinateio PRIVATE common)
+
+# Module dependencies
+# coordinateio interfaces convey transitive dependence on these modules.
+#target_link_libraries(coordinateio PUBLIC
+target_link_libraries(coordinateio INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(coordinateio PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(coordinateio PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
      add_subdirectory(tests)
 endif()
index 564c52f14018b0430123051b31e89a3091f1a25b..8822da78994f1869c730165c08d02e2e376dc598 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(correlationfunctions INTERFACE)
+
 file(GLOB GMXCORRFUNC_SOURCES *.cpp)
 
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${GMXCORRFUNC_SOURCES} PARENT_SCOPE)
+
+# Source files have the following private module dependencies.
+target_link_libraries(correlationfunctions PRIVATE
+                      #                      gmxlib
+                      #                      math
+                      #                      mdtypes
+                      #                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(correlationfunctions PUBLIC
+target_include_directories(correlationfunctions INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(correlationfunctions PUBLIC
+target_link_libraries(correlationfunctions INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(correlationfunctions PUBLIC legacy_api)
+#target_link_libraries(correlationfunctions PRIVATE common)
+
+# Module dependencies
+# This module convey transitive dependence on these modules.
+#target_link_libraries(correlationfunctions PUBLIC
+target_link_libraries(correlationfunctions INTERFACE
+                      #                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(correlationfunctions PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(correlationfunctions PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index d57300371103bb1f17b690a93ac1716f31560432..48fca9eebf94efc4d3d885c364acca8bee4595d1 100644 (file)
@@ -32,6 +32,8 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(domdec INTERFACE)
 file(GLOB DOMDEC_SOURCES *.cpp)
 
 if(GMX_GPU_CUDA)
@@ -40,6 +42,36 @@ endif()
 
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${DOMDEC_SOURCES} ${DOMDEC_CUDA_SOURCES} PARENT_SCOPE)
 
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(domdec PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(domdec PUBLIC
+target_include_directories(domdec INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(domdec PUBLIC
+target_link_libraries(domdec INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when domdec is an OBJECT target
+#target_link_libraries(domdec PUBLIC legacy_api)
+#target_link_libraries(domdec PRIVATE common)
+
+# Module dependencies
+# domdec interfaces convey transitive dependence on these modules.
+#target_link_libraries(domdec PUBLIC
+target_link_libraries(domdec INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(domdec PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(domdec PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index 1edaf7a796dc55c901aa7ae376905af4fe4a2153..3f5304064b2c2375b998240a63bb171eedadcd9e 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(essentialdynamics INTERFACE)
+
 file(GLOB ESSENTIALDYNAMICS_SOURCES *.cpp)
+
+# Source files have the following private module dependencies.
+target_link_libraries(essentialdynamics PRIVATE
+                      #                      gmxlib
+                      #                      math
+                      #                      mdtypes
+                      #                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(essentialdynamics PUBLIC
+target_include_directories(essentialdynamics INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(essentialdynamics PUBLIC
+target_link_libraries(essentialdynamics INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(fileio PUBLIC legacy_api)
+#target_link_libraries(fileio PRIVATE common)
+
+# Module dependencies
+# fileio interfaces convey transitive dependence on these modules.
+#target_link_libraries(essentialdynamics PUBLIC
+target_link_libraries(essentialdynamics INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(essentialdynamics PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(essentialdynamics PRIVATE legacy_modules)
+
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${ESSENTIALDYNAMICS_SOURCES} PARENT_SCOPE)
 
 if (BUILD_TESTING)
index ba9faa378e93ad6155e43b81cd1681610c33c8c6..5699d5265129cbbdf9483581e198f374875d8d61 100644 (file)
@@ -33,6 +33,8 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(ewald INTERFACE)
 gmx_add_libgromacs_sources(
     calculate_spline_moduli.cpp
     ewald.cpp
@@ -101,6 +103,38 @@ else()
         )
 endif()
 
+# Source files have the following private module dependencies.
+target_link_libraries(ewald PRIVATE
+                      #                      gmxlib
+                      #                      math
+                      #                      mdtypes
+                      #                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(ewald PUBLIC
+target_include_directories(ewald INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(ewald PUBLIC
+target_link_libraries(ewald INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(ewald PUBLIC legacy_api)
+#target_link_libraries(ewald PRIVATE common)
+
+# Module dependencies
+# This module convey transitive dependence on these modules.
+#target_link_libraries(ewald PUBLIC
+target_link_libraries(ewald INTERFACE
+                      #                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(ewald PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(ewald PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index a1eaabc71569b03b1a183af09358289f50d5db75..bbcd6972a8a2505eca7473d1929a71d1f7e5a966 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2013,2014,2015,2018,2019, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2018,2019,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -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.
 
+# Set up the module library
+add_library(fft INTERFACE)
+
 gmx_add_libgromacs_sources(
      calcgrid.cpp
      fft.cpp
@@ -51,6 +54,38 @@ if (GMX_FFT_MKL)
     gmx_add_libgromacs_sources(fft_mkl.cpp)
 endif()
 
+# Source files have the following private module dependencies.
+target_link_libraries(fft PRIVATE
+                      #                      gmxlib
+                      #                      math
+                      #                      mdtypes
+                      #                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(fft PUBLIC
+target_include_directories(fft INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(fft PUBLIC
+target_link_libraries(fft INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when fft is an OBJECT target
+#target_link_libraries(fft PUBLIC legacy_api)
+#target_link_libraries(fft PRIVATE common)
+
+# Module dependencies
+# This module convey transitive dependence on these modules.
+#target_link_libraries(fft PUBLIC
+target_link_libraries(fft INTERFACE
+                      #                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(fft PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(fft PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
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..16c4892c79de83f2dcfca2b70740aa78fbee9a2e 100644 (file)
@@ -32,6 +32,8 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(fileio INTERFACE)
 file(GLOB FILEIO_SOURCES *.cpp)
 
 if(GMX_USE_PLUGINS)
@@ -47,18 +49,39 @@ else()
     list(FILTER FILEIO_SOURCES EXCLUDE REGEX ".*vmdio.cpp$")
 endif()
 
-target_sources(libgromacs PRIVATE ${FILEIO_SOURCES})
+# Source files have the following private module dependencies.
+target_link_libraries(fileio PRIVATE
+#                      gmxlib
+#                      math
+#                      mdtypes
+#                      tng_io
+                      )
 
-if(GMX_INSTALL_LEGACY_API)
-  install(FILES
-          oenv.h
-         confio.h
-          pdbio.h
-          tpxio.h
-          trxio.h
-         filetypes.h
-          DESTINATION include/gromacs/fileio)
-endif()
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(fileio PUBLIC
+target_include_directories(fileio INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(fileio PUBLIC
+target_link_libraries(fileio INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(fileio PUBLIC legacy_api)
+#target_link_libraries(fileio PRIVATE common)
+
+# Module dependencies
+# fileio interfaces convey transitive dependence on these modules.
+#target_link_libraries(fileio PUBLIC
+target_link_libraries(fileio INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(fileio PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(fileio PRIVATE legacy_modules)
+
+target_sources(libgromacs PRIVATE ${FILEIO_SOURCES})
 
 if (BUILD_TESTING)
      add_subdirectory(tests)
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 b1f3a82014f34fe862d64fd769e5beba5d337688..2f20e18c5f57e41f7f233f3913cd7ba2b4919d35 100644 (file)
@@ -37,7 +37,7 @@
  */
 #include "gmxpre.h"
 
-#include "trxio.h"
+#include "gromacs/fileio/trxio.h"
 
 #include "config.h"
 
index 3a3a581a95e2f48bf84dd1e7244091917f616d80..1c3f989f34539b0b6b2cfa59fa2317138e2feebc 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2013,2014,2015,2017,2019, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2017,2019,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(gmxana INTERFACE)
+
 file(GLOB GMXANA_SOURCES *.cpp)
 
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${GMXANA_SOURCES} PARENT_SCOPE)
 
+# Source files have the following private module dependencies.
+target_link_libraries(gmxana PRIVATE
+        )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(gmxana PUBLIC
+target_include_directories(gmxana INTERFACE
+        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(gmxana PUBLIC
+target_link_libraries(gmxana INTERFACE
+        legacy_api
+        )
+
+# TODO: when gmxana is an OBJECT target
+#target_link_libraries(gmxana PUBLIC legacy_api)
+#target_link_libraries(gmxana PRIVATE common)
+
+# Module dependencies
+# gmxana interfaces convey transitive dependence on these modules.
+#target_link_libraries(gmxana PUBLIC
+target_link_libraries(gmxana INTERFACE
+        utility
+        )
+
 if(BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index 2e20112e902b41ba22604617ff0fbbc286cb981e..3b830d5e1a0a5ced6e79a1a4522cb65a8253b8f2 100644 (file)
@@ -33,6 +33,8 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(gmxlib INTERFACE)
+
 add_subdirectory(nonbonded)
 
 # The nonbonded directory contains subdirectories that are only
@@ -41,6 +43,38 @@ file(GLOB GMXLIB_SOURCES *.cpp)
 
 set(GMXLIB_SOURCES ${GMXLIB_SOURCES} ${NONBONDED_SOURCES} PARENT_SCOPE)
 
+# Source files have the following private module dependencies.
+target_link_libraries(gmxlib PRIVATE
+                      #                      gmxlib
+                      #                      math
+                      #                      mdtypes
+                      #                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(gmxlib PUBLIC
+target_include_directories(gmxlib INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(gmxlib PUBLIC
+target_link_libraries(gmxlib INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(gmxlib PUBLIC legacy_api)
+#target_link_libraries(gmxlib PRIVATE common)
+
+# Module dependencies
+# fileio interfaces convey transitive dependence on these modules.
+#target_link_libraries(gmxlib PUBLIC
+target_link_libraries(gmxlib INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(gmxlib PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(gmxlib PRIVATE legacy_modules)
+
 # if(BUILD_TESTING)
 #     add_subdirectory(tests)
 # endif()
index 8dd9c8aad8791d0b71f09189b7b7cc34451748b4..ad4abac97b8b98e65024a3b2fb898f04530d2547 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2011,2013,2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2011,2013,2014,2015,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(gmxpreprocess INTERFACE)
+
 file(GLOB GMXPREPROCESS_SOURCES *.cpp)
 
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${GMXPREPROCESS_SOURCES} PARENT_SCOPE)
 
+# Source files have the following private module dependencies.
+target_link_libraries(gmxpreprocess PRIVATE
+                      #                      gmxlib
+                      #                      math
+                      #                      mdtypes
+                      #                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(gmxpreprocess PUBLIC
+target_include_directories(gmxpreprocess INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(gmxpreprocess PUBLIC
+target_link_libraries(gmxpreprocess INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when is an OBJECT target
+#target_link_libraries(gmxpreprocess PUBLIC legacy_api)
+#target_link_libraries(gmxpreprocess PRIVATE common)
+
+# Module dependencies
+# This module convey transitive dependence on these modules.
+#target_link_libraries(gmxpreprocess PUBLIC
+target_link_libraries(gmxpreprocess INTERFACE
+                      #                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(gmxpreprocess PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(gmxpreprocess PRIVATE legacy_modules)
+
 if(BUILD_TESTING)
     add_subdirectory(tests)
 endif()
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 ca34184f832a664253cb9cdcdd5be93df83fdf00..7958f18c1309580b10de272403aaab5265d8b1dc 100644 (file)
@@ -36,6 +36,8 @@
 # the incidence of textual clashes when adding/moving files that
 # otherwise make the end of the list a hotspot.
 
+add_library(gpu_utils INTERFACE)
+
 gmx_add_libgromacs_sources(
         clfftinitializer.cpp
         device_stream_manager.cpp
@@ -81,6 +83,38 @@ else()
     )
 endif()
 
+# Source files have the following private module dependencies.
+target_link_libraries(gpu_utils PRIVATE
+#                      gmxlib
+#                      math
+#                      mdtypes
+#                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(gpu_utils PUBLIC
+target_include_directories(gpu_utils INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(gpu_utils PUBLIC
+target_link_libraries(gpu_utils INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when gpu_utils is an OBJECT target
+#target_link_libraries(gpu_utils PUBLIC legacy_api)
+#target_link_libraries(gpu_utils PRIVATE common)
+
+# Module dependencies
+# gpu_utils interfaces convey transitive dependence on these modules.
+#target_link_libraries(gpu_utils PUBLIC
+target_link_libraries(gpu_utils INTERFACE
+#                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(gpu_utils PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(gpu_utils PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index 668e6ab1867766ba4c3e9694cec5d09e89686ead..da2653807048bba4c78a84d931a786046d1c977b 100644 (file)
@@ -32,6 +32,7 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(hardware INTERFACE)
 gmx_add_libgromacs_sources(
     cpuinfo.cpp
     detecthardware.cpp
@@ -72,6 +73,34 @@ else()
     )
 endif()
 
+# Source files have the following private module dependencies.
+target_link_libraries(hardware PRIVATE
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(hardware PUBLIC
+target_include_directories(hardware INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(hardware PUBLIC
+target_link_libraries(hardware INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when hardware is an OBJECT target
+#target_link_libraries(hardware PUBLIC legacy_api)
+#target_link_libraries(hardware PRIVATE common)
+
+# Module dependencies
+# hardware interfaces convey transitive dependence on these modules.
+#target_link_libraries(hardware PUBLIC
+target_link_libraries(hardware INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(hardware PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(hardware PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index f81a6f027998424c6aef3bcfb62f916552ad9eb8..0c49696d9253a50eec14965c7867f6057cc70883 100644 (file)
@@ -1168,11 +1168,28 @@ const std::string& CpuInfo::featureString(Feature f)
 
 bool cpuIsX86Nehalem(const CpuInfo& cpuInfo)
 {
-    return (cpuInfo.vendor() == gmx::CpuInfo::Vendor::Intel && cpuInfo.family() == 6
+    return (cpuInfo.vendor() == CpuInfo::Vendor::Intel && cpuInfo.family() == 6
             && (cpuInfo.model() == 0x2E || cpuInfo.model() == 0x1A || cpuInfo.model() == 0x1E
                 || cpuInfo.model() == 0x2F || cpuInfo.model() == 0x2C || cpuInfo.model() == 0x25));
 }
 
+bool cpuIsAmdZen1(const CpuInfo& cpuInfo)
+{
+    /* Both Zen/Zen+/Zen2 have family==23
+     * Model numbers for Zen:
+     * 1)  Naples, Whitehaven, Summit Ridge, and Snowy Owl;
+     * 17) Raven Ridge.
+     * Model numbers for Zen+:
+     * 8)  Pinnacle Ridge;
+     * 24) Picasso.
+     * Hygon got license for Zen1, but not Zen2 (https://www.tomshardware.com/news/amd-zen-china-x86-ip-license,39573.html)
+     */
+    return (cpuInfo.vendor() == CpuInfo::Vendor::Amd && cpuInfo.family() == 23
+            && (cpuInfo.model() == 1 || cpuInfo.model() == 17 || cpuInfo.model() == 8
+                || cpuInfo.model() == 24))
+           || (cpuInfo.vendor() == CpuInfo::Vendor::Hygon);
+}
+
 } // namespace gmx
 
 #ifdef GMX_CPUINFO_STANDALONE
index fe09e27807a74b899ee1d321f3ff5a9aa7a2305c..00158fd4dc479f7094d75c2712c9e3dfd7020e04 100644 (file)
@@ -273,6 +273,14 @@ private:
  */
 bool cpuIsX86Nehalem(const CpuInfo& cpuInfo);
 
+/*! \brief Return true if the CPU is a first generation AMD Zen (produced by AMD or Hygon)
+ *
+ * \param cpuInfo  Object with cpu information
+ *
+ * \returns  True if running on a first generation AMD Zen
+ */
+bool cpuIsAmdZen1(const CpuInfo& cpuInfo);
+
 } // namespace gmx
 
 #endif // GMX_HARDWARE_CPUINFO_H
index d808249678abdb704be7cdbb13562ce846b41ae7..690457fc52e6a41a6ebb0ea7c6a96ed2216d9eb8 100644 (file)
@@ -209,10 +209,7 @@ static void gmx_collect_hardware_mpi(const gmx::CpuInfo&             cpuInfo,
      * - family=23 with the below listed models;
      * - Hygon as vendor.
      */
-    const bool cpuIsAmdZen1 = ((cpuInfo.vendor() == CpuInfo::Vendor::Amd && cpuInfo.family() == 23
-                                && (cpuInfo.model() == 1 || cpuInfo.model() == 17
-                                    || cpuInfo.model() == 8 || cpuInfo.model() == 24))
-                               || cpuInfo.vendor() == CpuInfo::Vendor::Hygon);
+    const bool cpuIsAmdZen1 = gmx::cpuIsAmdZen1(cpuInfo);
 
     int numCompatibleDevices = getCompatibleDevices(hardwareInfo->deviceInfoList).size();
 #if GMX_LIB_MPI
index 0b47f378724845a9cd171351ca54eb332c6fae50..e48c21f9a06a855e7ca76e88f94e34b3634a6c92 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(imd INTERFACE)
 file(GLOB IMD_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${IMD_SOURCES} PARENT_SCOPE)
+
+# Source files have the following private module dependencies.
+target_link_libraries(imd PRIVATE
+#                      gmxlib
+#                      math
+#                      mdtypes
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(imd PUBLIC
+target_include_directories(imd INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(imd PUBLIC
+target_link_libraries(imd INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when imd is an OBJECT target
+#target_link_libraries(imd PUBLIC legacy_api)
+#target_link_libraries(imd PRIVATE common)
+
+# Module dependencies
+# imd interfaces convey transitive dependence on these modules.
+#target_link_libraries(imd PUBLIC
+target_link_libraries(imd INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(imd PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(imd PRIVATE legacy_modules)
index 4c0ab0c09ca8794ec055ab1fc288bac34be96f64..f908f019822483f1d400889fb896862dd06f05c1 100644 (file)
@@ -47,6 +47,11 @@ set(LINEARALGEBRA_SOURCES
     ${LINEARALGEBRA_SOURCES} ${BLAS_SOURCES} ${LAPACK_SOURCES})
 
 add_library(linearalgebra OBJECT ${LINEARALGEBRA_SOURCES})
+# TODO: Only expose the module's public headers.
+target_include_directories(linearalgebra INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+target_include_directories(linearalgebra PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+
 gmx_target_compile_options(linearalgebra)
 target_compile_definitions(linearalgebra PRIVATE HAVE_CONFIG_H)
 # The linearalgebra code is all considered external, and we will
@@ -62,5 +67,9 @@ 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)
+target_link_libraries(linearalgebra PRIVATE common)
+# TODO: Link specific modules.
+target_link_libraries(linearalgebra PRIVATE legacy_modules)
 list(APPEND libgromacs_object_library_dependencies linearalgebra)
 set(libgromacs_object_library_dependencies ${libgromacs_object_library_dependencies} PARENT_SCOPE)
index fa1fa07902081be0d7027030b1aa0903dd2a58a2..c1de86e14b582b06edfbd3ef6ebb55cf97610291 100644 (file)
@@ -32,6 +32,7 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(listed_forces INTERFACE)
 gmx_add_libgromacs_sources(
     bonded.cpp
     disre.cpp
@@ -52,6 +53,37 @@ if(GMX_GPU_CUDA)
        )
 endif()
 
+# Source files have the following private module dependencies.
+target_link_libraries(listed_forces PRIVATE
+#                      gmxlib
+#                      math
+#                      mdtypes
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(listed_forces PUBLIC
+target_include_directories(listed_forces INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(listed_forces PUBLIC
+target_link_libraries(listed_forces INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when listed_forces is an OBJECT target
+#target_link_libraries(listed_forces PUBLIC legacy_api)
+#target_link_libraries(listed_forces PRIVATE common)
+
+# Module dependencies
+# listed_forces interfaces convey transitive dependence on these modules.
+#target_link_libraries(listed_forces PUBLIC
+target_link_libraries(listed_forces INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(listed_forces PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(listed_forces PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
      add_subdirectory(tests)
 endif()
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..4323f44e6cb1d28e275210a799ba15169f5d9e16 100644 (file)
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(math INTERFACE)
+
 file(GLOB MATH_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${MATH_SOURCES} PARENT_SCOPE)
 
-# TODO: (https://gitlab.com/gromacs/gromacs/-/issues/988) Find a new convention for defining public API.
-install(FILES
-       do_fit.h
-       functions.h
-       units.h
-       utilities.h
-       vec.h
-        vectypes.h
-        DESTINATION include/gromacs/math)
-
-if(GMX_INSTALL_LEGACY_API)
-  install(FILES
-         do_fit.h
-         units.h
-         utilities.h
-          DESTINATION include/gromacs/math)
-endif()
+# Source files have the following private module dependencies.
+target_link_libraries(math PRIVATE
+                      #                      gmxlib
+                      #                      math
+                      #                      mdtypes
+                      #                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(math PUBLIC
+target_include_directories(math INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(math PUBLIC
+target_link_libraries(math INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(math PUBLIC legacy_api)
+#target_link_libraries(math PRIVATE common)
+
+# Module dependencies
+# fileio interfaces convey transitive dependence on these modules.
+#target_link_libraries(math PUBLIC
+target_link_libraries(math INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(math PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(math PRIVATE legacy_modules)
 
 
 if (BUILD_TESTING)
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 949a3057972b5275f3aab35af1667cb72af66f78..f1d575bfbe2e6fdfaad97d5215e54201e3ef4666 100644 (file)
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(mdlib INTERFACE)
+
 file(GLOB MDLIB_SOURCES *.cpp)
 # To avoid listing all the necessary files manually, we will remove SYCL-specfific one here:
 list(REMOVE_ITEM MDLIB_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/leapfrog_gpu_sycl.cpp)
 
 set(MDLIB_SOURCES ${MDLIB_SOURCES} PARENT_SCOPE)
-if (BUILD_TESTING)
-    add_subdirectory(tests)
-endif()
 if(GMX_GPU_CUDA)
     gmx_add_libgromacs_sources(
        leapfrog_gpu.cu
@@ -50,6 +49,7 @@ if(GMX_GPU_CUDA)
        gpuforcereduction_impl.cu
        )
 endif()
+
 if(GMX_GPU_SYCL)
     gmx_add_libgromacs_sources(
         leapfrog_gpu_sycl.cpp
@@ -58,3 +58,39 @@ if(GMX_GPU_SYCL)
         leapfrog_gpu_sycl.cpp
     )
 endif()
+
+# Source files have the following private module dependencies.
+target_link_libraries(mdlib PRIVATE
+#                      gmxlib
+#                      math
+#                      mdtypes
+#                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(mdlib PUBLIC
+target_include_directories(mdlib INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(mdlib PUBLIC
+target_link_libraries(mdlib INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when mdlib is an OBJECT target
+#target_link_libraries(mdlib PUBLIC legacy_api)
+#target_link_libraries(mdlib PRIVATE common)
+
+# Module dependencies
+# mdlib interfaces convey transitive dependence on these modules.
+#target_link_libraries(mdlib PUBLIC
+target_link_libraries(mdlib INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(mdlib PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(mdlib PRIVATE legacy_modules)
+
+if (BUILD_TESTING)
+    add_subdirectory(tests)
+endif()
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 75b691ef07813703da3cc1bdb0e9febe4a82a10c..6c74a5a989d5e4cbe7aeb07336084071ae477ef8 100644 (file)
@@ -73,6 +73,24 @@ namespace test
 namespace
 {
 
+// Define the set of PBCs to run the test for
+const std::vector<t_pbc> c_pbcs = [] {
+    std::vector<t_pbc> pbcs;
+    t_pbc              pbc;
+
+    // Infinitely small box
+    matrix boxNone = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
+    set_pbc(&pbc, PbcType::No, boxNone);
+    pbcs.emplace_back(pbc);
+
+    // Rectangular box
+    matrix boxXyz = { { 10.0, 0.0, 0.0 }, { 0.0, 20.0, 0.0 }, { 0.0, 0.0, 15.0 } };
+    set_pbc(&pbc, PbcType::Xyz, boxXyz);
+    pbcs.emplace_back(pbc);
+
+    return pbcs;
+}();
+
 /*! \brief Test fixture for constraints.
  *
  * The fixture uses following test systems:
@@ -91,37 +109,9 @@ namespace
  * For some systems, the value for scaled virial tensor is checked against
  * pre-computed data.
  */
-class ConstraintsTest : public ::testing::TestWithParam<std::string>
+class ConstraintsTest : public ::testing::TestWithParam<t_pbc>
 {
 public:
-    //! PBC setups
-    std::unordered_map<std::string, t_pbc> pbcs_;
-
-    /*! \brief Test setup function.
-     *
-     * Setting up the pbcs and algorithms. Note, that corresponding string keywords
-     * have to be explicitly added at the end of this file when the tests are called.
-     *
-     */
-    void SetUp() override
-    {
-
-        //
-        // PBC initialization
-        //
-        t_pbc pbc;
-
-        // Infinitely small box
-        matrix boxNone = { { 0, 0, 0 }, { 0, 0, 0 }, { 0, 0, 0 } };
-        set_pbc(&pbc, PbcType::No, boxNone);
-        pbcs_["PBCNone"] = pbc;
-
-        // Rectangular box
-        matrix boxXyz = { { 10.0, 0.0, 0.0 }, { 0.0, 20.0, 0.0 }, { 0.0, 0.0, 15.0 } };
-        set_pbc(&pbc, PbcType::Xyz, boxXyz);
-        pbcs_["PBCXYZ"] = pbc;
-    }
-
     /*! \brief
      * The test on the final length of constrained bonds.
      *
@@ -338,14 +328,13 @@ TEST_P(ConstraintsTest, SingleConstraint)
             real(0.0), real(0.001), x, xPrime, v, shakeTolerance, shakeUseSOR, lincsNIter,
             lincslincsExpansionOrder, lincsWarnAngle);
 
-    std::string pbcName = GetParam();
-    t_pbc       pbc     = pbcs_.at(pbcName);
+    t_pbc pbc = GetParam();
 
     // Cycle through all available runners
     for (const auto& runner : getRunners())
     {
-        SCOPED_TRACE(formatString("Testing %s with %s using %s.", testData->title_.c_str(),
-                                  pbcName.c_str(), runner->name().c_str()));
+        SCOPED_TRACE(formatString("Testing %s with %s PBC using %s.", testData->title_.c_str(),
+                                  c_pbcTypeNames[pbc.pbcType].c_str(), runner->name().c_str()));
 
         testData->reset();
 
@@ -397,14 +386,13 @@ TEST_P(ConstraintsTest, TwoDisjointConstraints)
             real(0.0), real(0.001), x, xPrime, v, shakeTolerance, shakeUseSOR, lincsNIter,
             lincslincsExpansionOrder, lincsWarnAngle);
 
-    std::string pbcName = GetParam();
-    t_pbc       pbc     = pbcs_.at(pbcName);
+    t_pbc pbc = GetParam();
 
     // Cycle through all available runners
     for (const auto& runner : getRunners())
     {
-        SCOPED_TRACE(formatString("Testing %s with %s using %s.", testData->title_.c_str(),
-                                  pbcName.c_str(), runner->name().c_str()));
+        SCOPED_TRACE(formatString("Testing %s with %s PBC using %s.", testData->title_.c_str(),
+                                  c_pbcTypeNames[pbc.pbcType].c_str(), runner->name().c_str()));
 
         testData->reset();
 
@@ -456,14 +444,13 @@ TEST_P(ConstraintsTest, ThreeSequentialConstraints)
             real(0.0), real(0.001), x, xPrime, v, shakeTolerance, shakeUseSOR, lincsNIter,
             lincslincsExpansionOrder, lincsWarnAngle);
 
-    std::string pbcName = GetParam();
-    t_pbc       pbc     = pbcs_.at(pbcName);
+    t_pbc pbc = GetParam();
 
     // Cycle through all available runners
     for (const auto& runner : getRunners())
     {
-        SCOPED_TRACE(formatString("Testing %s with %s using %s.", testData->title_.c_str(),
-                                  pbcName.c_str(), runner->name().c_str()));
+        SCOPED_TRACE(formatString("Testing %s with %s PBC using %s.", testData->title_.c_str(),
+                                  c_pbcTypeNames[pbc.pbcType].c_str(), runner->name().c_str()));
 
         testData->reset();
 
@@ -516,14 +503,13 @@ TEST_P(ConstraintsTest, ThreeConstraintsWithCentralAtom)
             real(0.0), real(0.001), x, xPrime, v, shakeTolerance, shakeUseSOR, lincsNIter,
             lincslincsExpansionOrder, lincsWarnAngle);
 
-    std::string pbcName = GetParam();
-    t_pbc       pbc     = pbcs_.at(pbcName);
+    t_pbc pbc = GetParam();
 
     // Cycle through all available runners
     for (const auto& runner : getRunners())
     {
-        SCOPED_TRACE(formatString("Testing %s with %s using %s.", testData->title_.c_str(),
-                                  pbcName.c_str(), runner->name().c_str()));
+        SCOPED_TRACE(formatString("Testing %s with %s PBC using %s.", testData->title_.c_str(),
+                                  c_pbcTypeNames[pbc.pbcType].c_str(), runner->name().c_str()));
 
         testData->reset();
 
@@ -575,14 +561,13 @@ TEST_P(ConstraintsTest, FourSequentialConstraints)
             real(0.0), real(0.001), x, xPrime, v, shakeTolerance, shakeUseSOR, lincsNIter,
             lincslincsExpansionOrder, lincsWarnAngle);
 
-    std::string pbcName = GetParam();
-    t_pbc       pbc     = pbcs_.at(pbcName);
+    t_pbc pbc = GetParam();
 
     // Cycle through all available runners
     for (const auto& runner : getRunners())
     {
-        SCOPED_TRACE(formatString("Testing %s with %s using %s.", testData->title_.c_str(),
-                                  pbcName.c_str(), runner->name().c_str()));
+        SCOPED_TRACE(formatString("Testing %s with %s PBC using %s.", testData->title_.c_str(),
+                                  c_pbcTypeNames[pbc.pbcType].c_str(), runner->name().c_str()));
 
         testData->reset();
 
@@ -633,14 +618,13 @@ TEST_P(ConstraintsTest, TriangleOfConstraints)
             real(0.0), real(0.001), x, xPrime, v, shakeTolerance, shakeUseSOR, lincsNIter,
             lincslincsExpansionOrder, lincsWarnAngle);
 
-    std::string pbcName = GetParam();
-    t_pbc       pbc     = pbcs_.at(pbcName);
+    t_pbc pbc = GetParam();
 
     // Cycle through all available runners
     for (const auto& runner : getRunners())
     {
-        SCOPED_TRACE(formatString("Testing %s with %s using %s.", testData->title_.c_str(),
-                                  pbcName.c_str(), runner->name().c_str()));
+        SCOPED_TRACE(formatString("Testing %s with %s PBC using %s.", testData->title_.c_str(),
+                                  c_pbcTypeNames[pbc.pbcType].c_str(), runner->name().c_str()));
 
         testData->reset();
 
@@ -656,8 +640,7 @@ TEST_P(ConstraintsTest, TriangleOfConstraints)
     }
 }
 
-
-INSTANTIATE_TEST_CASE_P(WithParameters, ConstraintsTest, ::testing::Values("PBCNone", "PBCXYZ"));
+INSTANTIATE_TEST_CASE_P(WithParameters, ConstraintsTest, ::testing::ValuesIn(c_pbcs));
 
 } // namespace
 } // namespace test
diff --git a/src/gromacs/mdlib/update_vv.cpp b/src/gromacs/mdlib/update_vv.cpp
new file mode 100644 (file)
index 0000000..afc6b4d
--- /dev/null
@@ -0,0 +1,367 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team.
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+#include "gmxpre.h"
+
+#include "update_vv.h"
+
+#include <cmath>
+#include <cstdio>
+
+#include <algorithm>
+#include <memory>
+
+#include "gromacs/domdec/partition.h"
+#include "gromacs/gmxlib/nrnb.h"
+#include "gromacs/math/units.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/mdlib/constr.h"
+#include "gromacs/mdlib/coupling.h"
+#include "gromacs/mdlib/enerdata_utils.h"
+#include "gromacs/mdlib/mdatoms.h"
+#include "gromacs/mdlib/md_support.h"
+#include "gromacs/mdlib/stat.h"
+#include "gromacs/mdlib/tgroup.h"
+#include "gromacs/mdlib/update.h"
+#include "gromacs/mdtypes/commrec.h"
+#include "gromacs/mdtypes/enerdata.h"
+#include "gromacs/mdtypes/fcdata.h"
+#include "gromacs/mdtypes/forcebuffers.h"
+#include "gromacs/mdtypes/forcerec.h"
+#include "gromacs/mdtypes/group.h"
+#include "gromacs/mdtypes/inputrec.h"
+#include "gromacs/mdtypes/mdatom.h"
+#include "gromacs/mdtypes/state.h"
+#include "gromacs/pulling/pull.h"
+#include "gromacs/timing/wallcycle.h"
+#include "gromacs/topology/topology.h"
+
+void integrateVVFirstStep(int64_t                   step,
+                          bool                      bFirstStep,
+                          bool                      bInitStep,
+                          gmx::StartingBehavior     startingBehavior,
+                          int                       nstglobalcomm,
+                          t_inputrec*               ir,
+                          t_forcerec*               fr,
+                          t_commrec*                cr,
+                          t_state*                  state,
+                          t_mdatoms*                mdatoms,
+                          const t_fcdata&           fcdata,
+                          t_extmass*                MassQ,
+                          t_vcm*                    vcm,
+                          const gmx_mtop_t*         top_global,
+                          const gmx_localtop_t&     top,
+                          gmx_enerdata_t*           enerd,
+                          gmx_ekindata_t*           ekind,
+                          gmx_global_stat*          gstat,
+                          real*                     last_ekin,
+                          bool                      bCalcVir,
+                          tensor                    total_vir,
+                          tensor                    shake_vir,
+                          tensor                    force_vir,
+                          tensor                    pres,
+                          matrix                    M,
+                          bool                      do_log,
+                          bool                      do_ene,
+                          bool                      bCalcEner,
+                          bool                      bGStat,
+                          bool                      bStopCM,
+                          bool                      bTrotter,
+                          bool                      bExchanged,
+                          bool*                     bSumEkinhOld,
+                          bool*                     shouldCheckNumberOfBondedInteractions,
+                          real*                     saved_conserved_quantity,
+                          gmx::ForceBuffers*        f,
+                          gmx::Update*              upd,
+                          gmx::Constraints*         constr,
+                          gmx::SimulationSignaller* nullSignaller,
+                          std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
+                          t_nrnb*                                  nrnb,
+                          const gmx::MDLogger&                     mdlog,
+                          FILE*                                    fplog,
+                          gmx_wallcycle*                           wcycle)
+{
+    if (!bFirstStep || startingBehavior == gmx::StartingBehavior::NewSimulation)
+    {
+        /*  ############### START FIRST UPDATE HALF-STEP FOR VV METHODS############### */
+        rvec* vbuf = nullptr;
+
+        wallcycle_start(wcycle, ewcUPDATE);
+        if (ir->eI == eiVV && bInitStep)
+        {
+            /* if using velocity verlet with full time step Ekin,
+             * take the first half step only to compute the
+             * virial for the first step. From there,
+             * revert back to the initial coordinates
+             * so that the input is actually the initial step.
+             */
+            snew(vbuf, state->natoms);
+            copy_rvecn(state->v.rvec_array(), vbuf, 0,
+                       state->natoms); /* should make this better for parallelizing? */
+        }
+        else
+        {
+            /* this is for NHC in the Ekin(t+dt/2) version of vv */
+            trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, MassQ, trotter_seq, ettTSEQ1);
+        }
+
+        upd->update_coords(*ir, step, mdatoms, state, f->view().forceWithPadding(), fcdata, ekind,
+                           M, etrtVELOCITY1, cr, constr != nullptr);
+
+        wallcycle_stop(wcycle, ewcUPDATE);
+        constrain_velocities(constr, do_log, do_ene, step, state, nullptr, bCalcVir, shake_vir);
+        wallcycle_start(wcycle, ewcUPDATE);
+        /* if VV, compute the pressure and constraints */
+        /* For VV2, we strictly only need this if using pressure
+         * control, but we really would like to have accurate pressures
+         * printed out.
+         * Think about ways around this in the future?
+         * For now, keep this choice in comments.
+         */
+        /*bPres = (ir->eI==eiVV || inputrecNptTrotter(ir)); */
+        /*bTemp = ((ir->eI==eiVV &&(!bInitStep)) || (ir->eI==eiVVAK && inputrecNptTrotter(ir)));*/
+        bool bPres = TRUE;
+        bool bTemp = ((ir->eI == eiVV && (!bInitStep)) || (ir->eI == eiVVAK));
+        if (bCalcEner && ir->eI == eiVVAK)
+        {
+            *bSumEkinhOld = TRUE;
+        }
+        /* for vv, the first half of the integration actually corresponds to the previous step.
+            So we need information from the last step in the first half of the integration */
+        if (bGStat || do_per_step(step - 1, nstglobalcomm))
+        {
+            wallcycle_stop(wcycle, ewcUPDATE);
+            int totalNumberOfBondedInteractions = -1;
+            compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+                            makeConstArrayRef(state->v), state->box, mdatoms, nrnb, vcm, wcycle,
+                            enerd, force_vir, shake_vir, total_vir, pres, constr, nullSignaller,
+                            state->box, &totalNumberOfBondedInteractions, bSumEkinhOld,
+                            (bGStat ? CGLO_GSTAT : 0) | (bCalcEner ? CGLO_ENERGY : 0)
+                                    | (bTemp ? CGLO_TEMPERATURE : 0) | (bPres ? CGLO_PRESSURE : 0)
+                                    | (bPres ? CGLO_CONSTRAINT : 0) | (bStopCM ? CGLO_STOPCM : 0)
+                                    | (*shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
+                                                                              : 0)
+                                    | CGLO_SCALEEKIN);
+            /* explanation of above:
+                a) We compute Ekin at the full time step
+                if 1) we are using the AveVel Ekin, and it's not the
+                initial step, or 2) if we are using AveEkin, but need the full
+                time step kinetic energy for the pressure (always true now, since we want accurate statistics).
+                b) If we are using EkinAveEkin for the kinetic energy for the temperature control, we still feed in
+                EkinAveVel because it's needed for the pressure */
+            checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions, top_global,
+                                            &top, makeConstArrayRef(state->x), state->box,
+                                            shouldCheckNumberOfBondedInteractions);
+            if (bStopCM)
+            {
+                process_and_stopcm_grp(fplog, vcm, *mdatoms, makeArrayRef(state->x),
+                                       makeArrayRef(state->v));
+                inc_nrnb(nrnb, eNR_STOPCM, mdatoms->homenr);
+            }
+            wallcycle_start(wcycle, ewcUPDATE);
+        }
+        /* temperature scaling and pressure scaling to produce the extended variables at t+dt */
+        if (!bInitStep)
+        {
+            if (bTrotter)
+            {
+                m_add(force_vir, shake_vir, total_vir); /* we need the un-dispersion corrected total vir here */
+                trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, MassQ,
+                               trotter_seq, ettTSEQ2);
+
+                /* TODO This is only needed when we're about to write
+                 * a checkpoint, because we use it after the restart
+                 * (in a kludge?). But what should we be doing if
+                 * the startingBehavior is NewSimulation or bInitStep are true? */
+                if (inputrecNptTrotter(ir) || inputrecNphTrotter(ir))
+                {
+                    copy_mat(shake_vir, state->svir_prev);
+                    copy_mat(force_vir, state->fvir_prev);
+                }
+                if (inputrecNvtTrotter(ir) && ir->eI == eiVV)
+                {
+                    /* update temperature and kinetic energy now that step is over - this is the v(t+dt) point */
+                    enerd->term[F_TEMP] = sum_ekin(&(ir->opts), ekind, nullptr, (ir->eI == eiVV), FALSE);
+                    enerd->term[F_EKIN] = trace(ekind->ekin);
+                }
+            }
+            else if (bExchanged)
+            {
+                wallcycle_stop(wcycle, ewcUPDATE);
+                /* We need the kinetic energy at minus the half step for determining
+                 * the full step kinetic energy and possibly for T-coupling.*/
+                /* This may not be quite working correctly yet . . . . */
+                compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+                                makeConstArrayRef(state->v), state->box, mdatoms, nrnb, vcm, wcycle,
+                                enerd, nullptr, nullptr, nullptr, nullptr, constr, nullSignaller,
+                                state->box, nullptr, bSumEkinhOld, CGLO_GSTAT | CGLO_TEMPERATURE);
+                wallcycle_start(wcycle, ewcUPDATE);
+            }
+        }
+        /* if it's the initial step, we performed this first step just to get the constraint virial */
+        if (ir->eI == eiVV && bInitStep)
+        {
+            copy_rvecn(vbuf, state->v.rvec_array(), 0, state->natoms);
+            sfree(vbuf);
+        }
+        wallcycle_stop(wcycle, ewcUPDATE);
+    }
+
+    /* compute the conserved quantity */
+    *saved_conserved_quantity = NPT_energy(ir, state, MassQ);
+    if (ir->eI == eiVV)
+    {
+        *last_ekin = enerd->term[F_EKIN];
+    }
+    if ((ir->eDispCorr != edispcEnerPres) && (ir->eDispCorr != edispcAllEnerPres))
+    {
+        *saved_conserved_quantity -= enerd->term[F_DISPCORR];
+    }
+    /* sum up the foreign kinetic energy and dK/dl terms for vv.  currently done every step so that dhdl is correct in the .edr */
+    if (ir->efep != efepNO)
+    {
+        accumulateKineticLambdaComponents(enerd, state->lambda, *ir->fepvals);
+    }
+}
+
+void integrateVVSecondStep(int64_t                                  step,
+                           t_inputrec*                              ir,
+                           t_forcerec*                              fr,
+                           t_commrec*                               cr,
+                           t_state*                                 state,
+                           t_mdatoms*                               mdatoms,
+                           const t_fcdata&                          fcdata,
+                           t_extmass*                               MassQ,
+                           t_vcm*                                   vcm,
+                           pull_t*                                  pull_work,
+                           gmx_enerdata_t*                          enerd,
+                           gmx_ekindata_t*                          ekind,
+                           gmx_global_stat*                         gstat,
+                           real*                                    dvdl_constr,
+                           bool                                     bCalcVir,
+                           tensor                                   total_vir,
+                           tensor                                   shake_vir,
+                           tensor                                   force_vir,
+                           tensor                                   pres,
+                           matrix                                   M,
+                           matrix                                   lastbox,
+                           bool                                     do_log,
+                           bool                                     do_ene,
+                           bool                                     bGStat,
+                           bool*                                    bSumEkinhOld,
+                           gmx::ForceBuffers*                       f,
+                           std::vector<gmx::RVec>*                  cbuf,
+                           gmx::Update*                             upd,
+                           gmx::Constraints*                        constr,
+                           gmx::SimulationSignaller*                nullSignaller,
+                           std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
+                           t_nrnb*                                  nrnb,
+                           gmx_wallcycle*                           wcycle)
+{
+    /* velocity half-step update */
+    upd->update_coords(*ir, step, mdatoms, state, f->view().forceWithPadding(), fcdata, ekind, M,
+                       etrtVELOCITY2, cr, constr != nullptr);
+
+
+    /* Above, initialize just copies ekinh into ekin,
+     * it doesn't copy position (for VV),
+     * and entire integrator for MD.
+     */
+
+    if (ir->eI == eiVVAK)
+    {
+        cbuf->resize(state->x.size());
+        std::copy(state->x.begin(), state->x.end(), cbuf->begin());
+    }
+
+    if (ir->bPull && ir->pull->bSetPbcRefToPrevStepCOM)
+    {
+        updatePrevStepPullCom(pull_work, state);
+    }
+
+    upd->update_coords(*ir, step, mdatoms, state, f->view().forceWithPadding(), fcdata, ekind, M,
+                       etrtPOSITION, cr, constr != nullptr);
+
+    wallcycle_stop(wcycle, ewcUPDATE);
+
+    constrain_coordinates(constr, do_log, do_ene, step, state, upd->xp()->arrayRefWithPadding(),
+                          dvdl_constr, bCalcVir, shake_vir);
+
+    upd->update_sd_second_half(*ir, step, dvdl_constr, mdatoms, state, cr, nrnb, wcycle, constr,
+                               do_log, do_ene);
+    upd->finish_update(*ir, mdatoms, state, wcycle, constr != nullptr);
+
+    if (ir->eI == eiVVAK)
+    {
+        /* erase F_EKIN and F_TEMP here? */
+        /* just compute the kinetic energy at the half step to perform a trotter step */
+        compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
+                        makeConstArrayRef(state->v), state->box, mdatoms, nrnb, vcm, wcycle, enerd,
+                        force_vir, shake_vir, total_vir, pres, constr, nullSignaller, lastbox,
+                        nullptr, bSumEkinhOld, (bGStat ? CGLO_GSTAT : 0) | CGLO_TEMPERATURE);
+        wallcycle_start(wcycle, ewcUPDATE);
+        trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, MassQ, trotter_seq, ettTSEQ4);
+        /* now we know the scaling, we can compute the positions again */
+        std::copy(cbuf->begin(), cbuf->end(), state->x.begin());
+
+        upd->update_coords(*ir, step, mdatoms, state, f->view().forceWithPadding(), fcdata, ekind,
+                           M, etrtPOSITION, cr, constr != nullptr);
+        wallcycle_stop(wcycle, ewcUPDATE);
+
+        /* do we need an extra constraint here? just need to copy out of as_rvec_array(state->v.data()) to upd->xp? */
+        /* are the small terms in the shake_vir here due
+         * to numerical errors, or are they important
+         * physically? I'm thinking they are just errors, but not completely sure.
+         * For now, will call without actually constraining, constr=NULL*/
+        upd->finish_update(*ir, mdatoms, state, wcycle, false);
+    }
+    /* this factor or 2 correction is necessary
+        because half of the constraint force is removed
+        in the vv step, so we have to double it.  See
+        the Issue #1255.  It is not yet clear
+        if the factor of 2 is exact, or just a very
+        good approximation, and this will be
+        investigated.  The next step is to see if this
+        can be done adding a dhdl contribution from the
+        rattle step, but this is somewhat more
+        complicated with the current code. Will be
+        investigated, hopefully for 4.6.3. However,
+        this current solution is much better than
+        having it completely wrong.
+        */
+    enerd->term[F_DVDL_CONSTR] += 2 * *dvdl_constr;
+}
diff --git a/src/gromacs/mdlib/update_vv.h b/src/gromacs/mdlib/update_vv.h
new file mode 100644 (file)
index 0000000..8699f6b
--- /dev/null
@@ -0,0 +1,238 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team.
+ * Copyright (c) 2013,2014,2015,2016,2017 by the GROMACS development team.
+ * Copyright (c) 2018,2019,2020, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+#ifndef GMX_MDLIB_UPDATE_VV_H
+#define GMX_MDLIB_UPDATE_VV_H
+
+#include <vector>
+
+#include "gromacs/math/vectypes.h"
+#include "gromacs/mdrunutility/handlerestart.h"
+#include "gromacs/mdtypes/md_enums.h"
+
+struct gmx_ekindata_t;
+struct gmx_enerdata_t;
+struct gmx_global_stat;
+struct gmx_localtop_t;
+struct gmx_mtop_t;
+struct gmx_wallcycle;
+struct pull_t;
+struct t_commrec;
+struct t_extmass;
+struct t_fcdata;
+struct t_forcerec;
+struct t_inputrec;
+struct t_mdatoms;
+struct t_nrnb;
+class t_state;
+struct t_vcm;
+
+namespace gmx
+{
+class Constraints;
+class ForceBuffers;
+class MDLogger;
+class SimulationSignaller;
+class Update;
+} // namespace gmx
+
+/*! \brief Make the first step of Velocity Verlet integration
+ *
+ * \param[in]  step              Current timestep.
+ * \param[in]  bFirstStep        Is it a first step.
+ * \param[in]  bInitStep         Is it an initialization step.
+ * \param[in]  startingBehavior  Describes whether this is a restart appending to output files.
+ * \param[in]  nstglobalcomm     Will globals be computed on this step.
+ * \param[in]  ir                Input record.
+ * \param[in]  fr                Force record.
+ * \param[in]  cr                Comunication record.
+ * \param[in]  state             Simulation state.
+ * \param[in]  mdatoms           MD atoms data.
+ * \param[in]  fcdata            Force calculation data.
+ * \param[in]  MassQ             Mass/pressure data.
+ * \param[in]  vcm               Center of mass motion removal.
+ * \param[in]  top_global        Global topology.
+ * \param[in]  top               Local topology.
+ * \param[in]  enerd             Energy data.
+ * \param[in]  ekind             Kinetic energy data.
+ * \param[in]  gstat             Storage of thermodynamic parameters data.
+ * \param[out] last_ekin         Kinetic energies of the last step.
+ * \param[in]  bCalcVir          If the virial is computed on this step.
+ * \param[in]  total_vir         Total virial tensor.
+ * \param[in]  shake_vir         Constraints virial.
+ * \param[in]  force_vir         Force virial.
+ * \param[in]  pres              Pressure tensor.
+ * \param[in]  M                 Parrinello-Rahman velocity scaling matrix.
+ * \param[in]  do_log            Do logging on this step.
+ * \param[in]  do_ene            Print energies on this step.
+ * \param[in]  bCalcEner         Compute energies on this step.
+ * \param[in]  bGStat            Collect globals this step.
+ * \param[in]  bStopCM           Stop the center of mass motion on this step.
+ * \param[in]  bTrotter          Do trotter routines this step.
+ * \param[in]  bExchanged        If this is a replica exchange step.
+ * \param[out] bSumEkinhOld      Old kinetic energies will need to be summed up.
+ * \param[out] shouldCheckNumberOfBondedInteractions  If checks for missing bonded
+ *                                                    interactions will be needed.
+ * \param[out] saved_conserved_quantity  Place to store the conserved energy.
+ * \param[in]  f                 Force buffers.
+ * \param[in]  upd               Update object.
+ * \param[in]  constr            Constraints object.
+ * \param[in]  nullSignaller     Simulation signaller.
+ * \param[in]  trotter_seq       NPT variables.
+ * \param[in]  nrnb              Cycle counters.
+ * \param[in]  mdlog             Logger.
+ * \param[in]  fplog             Another logger.
+ * \param[in]  wcycle            Wall-clock cycle counter.
+ */
+void integrateVVFirstStep(int64_t                   step,
+                          bool                      bFirstStep,
+                          bool                      bInitStep,
+                          gmx::StartingBehavior     startingBehavior,
+                          int                       nstglobalcomm,
+                          t_inputrec*               ir,
+                          t_forcerec*               fr,
+                          t_commrec*                cr,
+                          t_state*                  state,
+                          t_mdatoms*                mdatoms,
+                          const t_fcdata&           fcdata,
+                          t_extmass*                MassQ,
+                          t_vcm*                    vcm,
+                          const gmx_mtop_t*         top_global,
+                          const gmx_localtop_t&     top,
+                          gmx_enerdata_t*           enerd,
+                          gmx_ekindata_t*           ekind,
+                          gmx_global_stat*          gstat,
+                          real*                     last_ekin,
+                          bool                      bCalcVir,
+                          tensor                    total_vir,
+                          tensor                    shake_vir,
+                          tensor                    force_vir,
+                          tensor                    pres,
+                          matrix                    M,
+                          bool                      do_log,
+                          bool                      do_ene,
+                          bool                      bCalcEner,
+                          bool                      bGStat,
+                          bool                      bStopCM,
+                          bool                      bTrotter,
+                          bool                      bExchanged,
+                          bool*                     bSumEkinhOld,
+                          bool*                     shouldCheckNumberOfBondedInteractions,
+                          real*                     saved_conserved_quantity,
+                          gmx::ForceBuffers*        f,
+                          gmx::Update*              upd,
+                          gmx::Constraints*         constr,
+                          gmx::SimulationSignaller* nullSignaller,
+                          std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
+                          t_nrnb*                                  nrnb,
+                          const gmx::MDLogger&                     mdlog,
+                          FILE*                                    fplog,
+                          gmx_wallcycle*                           wcycle);
+
+
+/*! \brief Make the second step of Velocity Verlet integration
+ *
+ * \param[in]  step              Current timestep.
+ * \param[in]  ir                Input record.
+ * \param[in]  fr                Force record.
+ * \param[in]  cr                Comunication record.
+ * \param[in]  state             Simulation state.
+ * \param[in]  mdatoms           MD atoms data.
+ * \param[in]  fcdata            Force calculation data.
+ * \param[in]  MassQ             Mass/pressure data.
+ * \param[in]  vcm               Center of mass motion removal.
+ * \param[in]  pull_work         Pulling data.
+ * \param[in]  enerd             Energy data.
+ * \param[in]  ekind             Kinetic energy data.
+ * \param[in]  gstat             Storage of thermodynamic parameters data.
+ * \param[out] dvdl_constr       FEP data for constraints.
+ * \param[in]  bCalcVir          If the virial is computed on this step.
+ * \param[in]  total_vir         Total virial tensor.
+ * \param[in]  shake_vir         Constraints virial.
+ * \param[in]  force_vir         Force virial.
+ * \param[in]  pres              Pressure tensor.
+ * \param[in]  M                 Parrinello-Rahman velocity scaling matrix.
+ * \param[in]  lastbox           Last recorded PBC box.
+ * \param[in]  do_log            Do logging on this step.
+ * \param[in]  do_ene            Print energies on this step.
+ * \param[in]  bGStat            Collect globals this step.
+ * \param[out] bSumEkinhOld      Old kinetic energies need to be summed up.
+ * \param[in]  f                 Force buffers.
+ * \param[in]  cbuf              Buffer to store intermediate coordinates
+ * \param[in]  upd               Update object.
+ * \param[in]  constr            Constraints object.
+ * \param[in]  nullSignaller     Simulation signaller.
+ * \param[in]  trotter_seq       NPT variables.
+ * \param[in]  nrnb              Cycle counters.
+ * \param[in]  wcycle            Wall-clock cycle counter.
+ */
+void integrateVVSecondStep(int64_t                                  step,
+                           t_inputrec*                              ir,
+                           t_forcerec*                              fr,
+                           t_commrec*                               cr,
+                           t_state*                                 state,
+                           t_mdatoms*                               mdatoms,
+                           const t_fcdata&                          fcdata,
+                           t_extmass*                               MassQ,
+                           t_vcm*                                   vcm,
+                           pull_t*                                  pull_work,
+                           gmx_enerdata_t*                          enerd,
+                           gmx_ekindata_t*                          ekind,
+                           gmx_global_stat*                         gstat,
+                           real*                                    dvdl_constr,
+                           bool                                     bCalcVir,
+                           tensor                                   total_vir,
+                           tensor                                   shake_vir,
+                           tensor                                   force_vir,
+                           tensor                                   pres,
+                           matrix                                   M,
+                           matrix                                   lastbox,
+                           bool                                     do_log,
+                           bool                                     do_ene,
+                           bool                                     bGStat,
+                           bool*                                    bSumEkinhOld,
+                           gmx::ForceBuffers*                       f,
+                           std::vector<gmx::RVec>*                  cbuf,
+                           gmx::Update*                             upd,
+                           gmx::Constraints*                        constr,
+                           gmx::SimulationSignaller*                nullSignaller,
+                           std::array<std::vector<int>, ettTSEQMAX> trotter_seq,
+                           t_nrnb*                                  nrnb,
+                           gmx_wallcycle*                           wcycle);
+
+
+#endif // GMX_MDLIB_UPDATE_VV_H
index cb714aff3de0a1a9ba8be7ea25c49bb626f4ce61..d5ddaf1a78b2c6fdc6706e0ff95c314c949b99a7 100644 (file)
@@ -32,6 +32,7 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(mdrun INTERFACE)
 gmx_add_libgromacs_sources(
     legacymdrunoptions.cpp
     legacysimulator.cpp
@@ -51,6 +52,38 @@ gmx_add_libgromacs_sources(
     tpi.cpp
     )
 
+# Source files have the following private module dependencies.
+target_link_libraries(mdrun PRIVATE
+#                      gmxlib
+#                      math
+#                      mdtypes
+#                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(mdrun PUBLIC
+target_include_directories(mdrun INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(mdrun PUBLIC
+target_link_libraries(mdrun INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when mdrun is an OBJECT target
+#target_link_libraries(mdrun PUBLIC legacy_api)
+#target_link_libraries(mdrun PRIVATE common)
+
+# Module dependencies
+# mdrun interfaces convey transitive dependence on these modules.
+#target_link_libraries(mdrun PUBLIC
+target_link_libraries(mdrun INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(mdrun PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(mdrun PRIVATE legacy_modules)
+
 # TODO: Find a home for this header and a scheme for installation.
 # This header straddles the installed libraries and is a transitive interface
 # from libgromacs to libgmxapi to libgmxapi clients. Near term efforts are
index caa25a7a43c484d0214eb2c4a1e4f779f6f800db..9d866de3803ec73969f1614e00bb1ec57e95c5a0 100644 (file)
 #include "gromacs/mdlib/trajectory_writing.h"
 #include "gromacs/mdlib/update.h"
 #include "gromacs/mdlib/update_constrain_gpu.h"
+#include "gromacs/mdlib/update_vv.h"
 #include "gromacs/mdlib/vcm.h"
 #include "gromacs/mdlib/vsite.h"
 #include "gromacs/mdrunutility/handlerestart.h"
@@ -178,7 +179,7 @@ void gmx::LegacySimulator::do_md()
     gmx_global_stat_t gstat;
     gmx_shellfc_t*    shellfc;
     gmx_bool          bSumEkinhOld, bDoReplEx, bExchanged, bNeedRepartition;
-    gmx_bool          bTemp, bPres, bTrotter;
+    gmx_bool          bTrotter;
     real              dvdl_constr;
     std::vector<RVec> cbuf;
     matrix            lastbox;
@@ -858,7 +859,6 @@ void gmx::LegacySimulator::do_md()
 
         if (bExchanged)
         {
-
             /* We need the kinetic energy at minus the half step for determining
              * the full step kinetic energy and possibly for T-coupling.*/
             /* This may not be quite working correctly yet . . . . */
@@ -953,151 +953,15 @@ void gmx::LegacySimulator::do_md()
         // if it is the first step after starting from a checkpoint.
         // That is, the half step is needed on all other steps, and
         // also the first step when starting from a .tpr file.
-        if (EI_VV(ir->eI) && (!bFirstStep || startingBehavior == StartingBehavior::NewSimulation))
-        /*  ############### START FIRST UPDATE HALF-STEP FOR VV METHODS############### */
-        {
-            rvec* vbuf = nullptr;
-
-            wallcycle_start(wcycle, ewcUPDATE);
-            if (ir->eI == eiVV && bInitStep)
-            {
-                /* if using velocity verlet with full time step Ekin,
-                 * take the first half step only to compute the
-                 * virial for the first step. From there,
-                 * revert back to the initial coordinates
-                 * so that the input is actually the initial step.
-                 */
-                snew(vbuf, state->natoms);
-                copy_rvecn(state->v.rvec_array(), vbuf, 0,
-                           state->natoms); /* should make this better for parallelizing? */
-            }
-            else
-            {
-                /* this is for NHC in the Ekin(t+dt/2) version of vv */
-                trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, &MassQ,
-                               trotter_seq, ettTSEQ1);
-            }
-
-            upd.update_coords(*ir, step, mdatoms, state, f.view().forceWithPadding(), fcdata, ekind,
-                              M, etrtVELOCITY1, cr, constr != nullptr);
-
-            wallcycle_stop(wcycle, ewcUPDATE);
-            constrain_velocities(constr, do_log, do_ene, step, state, nullptr, bCalcVir, shake_vir);
-            wallcycle_start(wcycle, ewcUPDATE);
-            /* if VV, compute the pressure and constraints */
-            /* For VV2, we strictly only need this if using pressure
-             * control, but we really would like to have accurate pressures
-             * printed out.
-             * Think about ways around this in the future?
-             * For now, keep this choice in comments.
-             */
-            /*bPres = (ir->eI==eiVV || inputrecNptTrotter(ir)); */
-            /*bTemp = ((ir->eI==eiVV &&(!bInitStep)) || (ir->eI==eiVVAK && inputrecNptTrotter(ir)));*/
-            bPres = TRUE;
-            bTemp = ((ir->eI == eiVV && (!bInitStep)) || (ir->eI == eiVVAK));
-            if (bCalcEner && ir->eI == eiVVAK)
-            {
-                bSumEkinhOld = TRUE;
-            }
-            /* for vv, the first half of the integration actually corresponds to the previous step.
-               So we need information from the last step in the first half of the integration */
-            if (bGStat || do_per_step(step - 1, nstglobalcomm))
-            {
-                wallcycle_stop(wcycle, ewcUPDATE);
-                compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
-                                makeConstArrayRef(state->v), state->box, mdatoms, nrnb, &vcm, wcycle,
-                                enerd, force_vir, shake_vir, total_vir, pres, constr, &nullSignaller,
-                                state->box, &totalNumberOfBondedInteractions, &bSumEkinhOld,
-                                (bGStat ? CGLO_GSTAT : 0) | (bCalcEner ? CGLO_ENERGY : 0)
-                                        | (bTemp ? CGLO_TEMPERATURE : 0) | (bPres ? CGLO_PRESSURE : 0)
-                                        | (bPres ? CGLO_CONSTRAINT : 0) | (bStopCM ? CGLO_STOPCM : 0)
-                                        | (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS
-                                                                                 : 0)
-                                        | CGLO_SCALEEKIN);
-                /* explanation of above:
-                   a) We compute Ekin at the full time step
-                   if 1) we are using the AveVel Ekin, and it's not the
-                   initial step, or 2) if we are using AveEkin, but need the full
-                   time step kinetic energy for the pressure (always true now, since we want accurate statistics).
-                   b) If we are using EkinAveEkin for the kinetic energy for the temperature control, we still feed in
-                   EkinAveVel because it's needed for the pressure */
-                checkNumberOfBondedInteractions(mdlog, cr, totalNumberOfBondedInteractions,
-                                                top_global, &top, makeConstArrayRef(state->x),
-                                                state->box, &shouldCheckNumberOfBondedInteractions);
-                if (bStopCM)
-                {
-                    process_and_stopcm_grp(fplog, &vcm, *mdatoms, makeArrayRef(state->x),
-                                           makeArrayRef(state->v));
-                    inc_nrnb(nrnb, eNR_STOPCM, mdatoms->homenr);
-                }
-                wallcycle_start(wcycle, ewcUPDATE);
-            }
-            /* temperature scaling and pressure scaling to produce the extended variables at t+dt */
-            if (!bInitStep)
-            {
-                if (bTrotter)
-                {
-                    m_add(force_vir, shake_vir,
-                          total_vir); /* we need the un-dispersion corrected total vir here */
-                    trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, &MassQ,
-                                   trotter_seq, ettTSEQ2);
-
-                    /* TODO This is only needed when we're about to write
-                     * a checkpoint, because we use it after the restart
-                     * (in a kludge?). But what should we be doing if
-                     * the startingBehavior is NewSimulation or bInitStep are true? */
-                    if (inputrecNptTrotter(ir) || inputrecNphTrotter(ir))
-                    {
-                        copy_mat(shake_vir, state->svir_prev);
-                        copy_mat(force_vir, state->fvir_prev);
-                    }
-                    if (inputrecNvtTrotter(ir) && ir->eI == eiVV)
-                    {
-                        /* update temperature and kinetic energy now that step is over - this is the v(t+dt) point */
-                        enerd->term[F_TEMP] =
-                                sum_ekin(&(ir->opts), ekind, nullptr, (ir->eI == eiVV), FALSE);
-                        enerd->term[F_EKIN] = trace(ekind->ekin);
-                    }
-                }
-                else if (bExchanged)
-                {
-                    wallcycle_stop(wcycle, ewcUPDATE);
-                    /* We need the kinetic energy at minus the half step for determining
-                     * the full step kinetic energy and possibly for T-coupling.*/
-                    /* This may not be quite working correctly yet . . . . */
-                    compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
-                                    makeConstArrayRef(state->v), state->box, mdatoms, nrnb, &vcm, wcycle,
-                                    enerd, nullptr, nullptr, nullptr, nullptr, constr, &nullSignaller,
-                                    state->box, nullptr, &bSumEkinhOld, CGLO_GSTAT | CGLO_TEMPERATURE);
-                    wallcycle_start(wcycle, ewcUPDATE);
-                }
-            }
-            /* if it's the initial step, we performed this first step just to get the constraint virial */
-            if (ir->eI == eiVV && bInitStep)
-            {
-                copy_rvecn(vbuf, state->v.rvec_array(), 0, state->natoms);
-                sfree(vbuf);
-            }
-            wallcycle_stop(wcycle, ewcUPDATE);
-        }
-
-        /* compute the conserved quantity */
         if (EI_VV(ir->eI))
         {
-            saved_conserved_quantity = NPT_energy(ir, state, &MassQ);
-            if (ir->eI == eiVV)
-            {
-                last_ekin = enerd->term[F_EKIN];
-            }
-            if ((ir->eDispCorr != edispcEnerPres) && (ir->eDispCorr != edispcAllEnerPres))
-            {
-                saved_conserved_quantity -= enerd->term[F_DISPCORR];
-            }
-            /* sum up the foreign kinetic energy and dK/dl terms for vv.  currently done every step so that dhdl is correct in the .edr */
-            if (ir->efep != efepNO)
-            {
-                accumulateKineticLambdaComponents(enerd, state->lambda, *ir->fepvals);
-            }
+            integrateVVFirstStep(step, bFirstStep, bInitStep, startingBehavior, nstglobalcomm, ir,
+                                 fr, cr, state, mdatoms, fcdata, &MassQ, &vcm, top_global, top, enerd,
+                                 ekind, gstat, &last_ekin, bCalcVir, total_vir, shake_vir, force_vir,
+                                 pres, M, do_log, do_ene, bCalcEner, bGStat, bStopCM, bTrotter,
+                                 bExchanged, &bSumEkinhOld, &shouldCheckNumberOfBondedInteractions,
+                                 &saved_conserved_quantity, &f, &upd, constr, &nullSignaller,
+                                 trotter_seq, nrnb, mdlog, fplog, wcycle);
         }
 
         /* ########  END FIRST UPDATE STEP  ############## */
@@ -1226,24 +1090,6 @@ void gmx::LegacySimulator::do_md()
             update_pcouple_before_coordinates(fplog, step, ir, state, pressureCouplingMu, M, bInitStep);
         }
 
-        if (EI_VV(ir->eI))
-        {
-            /* velocity half-step update */
-            upd.update_coords(*ir, step, mdatoms, state, f.view().forceWithPadding(), fcdata, ekind,
-                              M, etrtVELOCITY2, cr, constr != nullptr);
-        }
-
-        /* Above, initialize just copies ekinh into ekin,
-         * it doesn't copy position (for VV),
-         * and entire integrator for MD.
-         */
-
-        if (ir->eI == eiVVAK)
-        {
-            cbuf.resize(state->x.size());
-            std::copy(state->x.begin(), state->x.end(), cbuf.begin());
-        }
-
         /* With leap-frog type integrators we compute the kinetic energy
          * at a whole time step as the average of the half-time step kinetic
          * energies of two subsequent steps. Therefore we need to compute the
@@ -1257,131 +1103,105 @@ void gmx::LegacySimulator::do_md()
         const bool doParrinelloRahman = (ir->epc == epcPARRINELLORAHMAN
                                          && do_per_step(step + ir->nstpcouple - 1, ir->nstpcouple));
 
-        if (useGpuForUpdate)
+        if (EI_VV(ir->eI))
+        {
+            GMX_ASSERT(!useGpuForUpdate, "GPU update is not supported with VVAK integrator.");
+
+            integrateVVSecondStep(step, ir, fr, cr, state, mdatoms, fcdata, &MassQ, &vcm, pull_work,
+                                  enerd, ekind, gstat, &dvdl_constr, bCalcVir, total_vir, shake_vir,
+                                  force_vir, pres, M, lastbox, do_log, do_ene, bGStat, &bSumEkinhOld,
+                                  &f, &cbuf, &upd, constr, &nullSignaller, trotter_seq, nrnb, wcycle);
+        }
+        else
         {
-            if (bNS && (bFirstStep || DOMAINDECOMP(cr)))
+            if (useGpuForUpdate)
             {
-                integrator->set(stateGpu->getCoordinates(), stateGpu->getVelocities(),
-                                stateGpu->getForces(), top.idef, *mdatoms, ekind->ngtc);
 
-                // Copy data to the GPU after buffers might have being reinitialized
-                stateGpu->copyVelocitiesToGpu(state->v, AtomLocality::Local);
-                stateGpu->copyCoordinatesToGpu(state->x, AtomLocality::Local);
-            }
+                wallcycle_stop(wcycle, ewcUPDATE);
 
-            if (simulationWork.useGpuPme && !runScheduleWork->simulationWork.useGpuPmePpCommunication
-                && !thisRankHasDuty(cr, DUTY_PME))
-            {
-                // The PME forces were recieved to the host, so have to be copied
-                stateGpu->copyForcesToGpu(f.view().force(), AtomLocality::All);
-            }
-            else if (!runScheduleWork->stepWork.useGpuFBufferOps)
-            {
-                // The buffer ops were not offloaded this step, so the forces are on the
-                // host and have to be copied
-                stateGpu->copyForcesToGpu(f.view().force(), AtomLocality::Local);
-            }
+                if (bNS && (bFirstStep || DOMAINDECOMP(cr)))
+                {
+                    integrator->set(stateGpu->getCoordinates(), stateGpu->getVelocities(),
+                                    stateGpu->getForces(), top.idef, *mdatoms, ekind->ngtc);
 
-            const bool doTemperatureScaling =
-                    (ir->etc != etcNO && do_per_step(step + ir->nsttcouple - 1, ir->nsttcouple));
+                    // Copy data to the GPU after buffers might have being reinitialized
+                    stateGpu->copyVelocitiesToGpu(state->v, AtomLocality::Local);
+                    stateGpu->copyCoordinatesToGpu(state->x, AtomLocality::Local);
+                }
 
-            // This applies Leap-Frog, LINCS and SETTLE in succession
-            integrator->integrate(stateGpu->getForcesReadyOnDeviceEvent(
-                                          AtomLocality::Local, runScheduleWork->stepWork.useGpuFBufferOps),
-                                  ir->delta_t, true, bCalcVir, shake_vir, doTemperatureScaling,
-                                  ekind->tcstat, doParrinelloRahman, ir->nstpcouple * ir->delta_t, M);
+                if (simulationWork.useGpuPme && !runScheduleWork->simulationWork.useGpuPmePpCommunication
+                    && !thisRankHasDuty(cr, DUTY_PME))
+                {
+                    // The PME forces were recieved to the host, so have to be copied
+                    stateGpu->copyForcesToGpu(f.view().force(), AtomLocality::All);
+                }
+                else if (!runScheduleWork->stepWork.useGpuFBufferOps)
+                {
+                    // The buffer ops were not offloaded this step, so the forces are on the
+                    // host and have to be copied
+                    stateGpu->copyForcesToGpu(f.view().force(), AtomLocality::Local);
+                }
 
-            // Copy velocities D2H after update if:
-            // - Globals are computed this step (includes the energy output steps).
-            // - Temperature is needed for the next step.
-            if (bGStat || needHalfStepKineticEnergy)
-            {
-                stateGpu->copyVelocitiesFromGpu(state->v, AtomLocality::Local);
-                stateGpu->waitVelocitiesReadyOnHost(AtomLocality::Local);
-            }
-        }
-        else
-        {
-            /* With multiple time stepping we need to do an additional normal
-             * update step to obtain the virial, as the actual MTS integration
-             * using an acceleration where the slow forces are multiplied by mtsFactor.
-             * Using that acceleration would result in a virial with the slow
-             * force contribution would be a factor mtsFactor too large.
-             */
-            if (fr->useMts && bCalcVir && constr != nullptr)
-            {
-                upd.update_for_constraint_virial(*ir, *mdatoms, *state, f.view().forceWithPadding(), *ekind);
+                const bool doTemperatureScaling =
+                        (ir->etc != etcNO && do_per_step(step + ir->nsttcouple - 1, ir->nsttcouple));
 
-                constrain_coordinates(constr, do_log, do_ene, step, state,
-                                      upd.xp()->arrayRefWithPadding(), &dvdl_constr, bCalcVir, shake_vir);
-            }
+                // This applies Leap-Frog, LINCS and SETTLE in succession
+                integrator->integrate(
+                        stateGpu->getForcesReadyOnDeviceEvent(
+                                AtomLocality::Local, runScheduleWork->stepWork.useGpuFBufferOps),
+                        ir->delta_t, true, bCalcVir, shake_vir, doTemperatureScaling, ekind->tcstat,
+                        doParrinelloRahman, ir->nstpcouple * ir->delta_t, M);
 
-            ArrayRefWithPadding<const RVec> forceCombined =
-                    (fr->useMts && step % ir->mtsLevels[1].stepFactor == 0)
-                            ? f.view().forceMtsCombinedWithPadding()
-                            : f.view().forceWithPadding();
-            upd.update_coords(*ir, step, mdatoms, state, forceCombined, fcdata, ekind, M,
-                              etrtPOSITION, cr, constr != nullptr);
+                // Copy velocities D2H after update if:
+                // - Globals are computed this step (includes the energy output steps).
+                // - Temperature is needed for the next step.
+                if (bGStat || needHalfStepKineticEnergy)
+                {
+                    stateGpu->copyVelocitiesFromGpu(state->v, AtomLocality::Local);
+                    stateGpu->waitVelocitiesReadyOnHost(AtomLocality::Local);
+                }
+            }
+            else
+            {
+                /* With multiple time stepping we need to do an additional normal
+                 * update step to obtain the virial, as the actual MTS integration
+                 * using an acceleration where the slow forces are multiplied by mtsFactor.
+                 * Using that acceleration would result in a virial with the slow
+                 * force contribution would be a factor mtsFactor too large.
+                 */
+                if (fr->useMts && bCalcVir && constr != nullptr)
+                {
+                    upd.update_for_constraint_virial(*ir, *mdatoms, *state,
+                                                     f.view().forceWithPadding(), *ekind);
 
-            wallcycle_stop(wcycle, ewcUPDATE);
+                    constrain_coordinates(constr, do_log, do_ene, step, state,
+                                          upd.xp()->arrayRefWithPadding(), &dvdl_constr, bCalcVir,
+                                          shake_vir);
+                }
 
-            constrain_coordinates(constr, do_log, do_ene, step, state, upd.xp()->arrayRefWithPadding(),
-                                  &dvdl_constr, bCalcVir && !fr->useMts, shake_vir);
+                ArrayRefWithPadding<const RVec> forceCombined =
+                        (fr->useMts && step % ir->mtsLevels[1].stepFactor == 0)
+                                ? f.view().forceMtsCombinedWithPadding()
+                                : f.view().forceWithPadding();
+                upd.update_coords(*ir, step, mdatoms, state, forceCombined, fcdata, ekind, M,
+                                  etrtPOSITION, cr, constr != nullptr);
 
-            upd.update_sd_second_half(*ir, step, &dvdl_constr, mdatoms, state, cr, nrnb, wcycle,
-                                      constr, do_log, do_ene);
-            upd.finish_update(*ir, mdatoms, state, wcycle, constr != nullptr);
-        }
+                wallcycle_stop(wcycle, ewcUPDATE);
 
-        if (ir->bPull && ir->pull->bSetPbcRefToPrevStepCOM)
-        {
-            updatePrevStepPullCom(pull_work, state);
-        }
+                constrain_coordinates(constr, do_log, do_ene, step, state,
+                                      upd.xp()->arrayRefWithPadding(), &dvdl_constr,
+                                      bCalcVir && !fr->useMts, shake_vir);
 
-        if (ir->eI == eiVVAK)
-        {
-            /* erase F_EKIN and F_TEMP here? */
-            /* just compute the kinetic energy at the half step to perform a trotter step */
-            compute_globals(gstat, cr, ir, fr, ekind, makeConstArrayRef(state->x),
-                            makeConstArrayRef(state->v), state->box, mdatoms, nrnb, &vcm, wcycle, enerd,
-                            force_vir, shake_vir, total_vir, pres, constr, &nullSignaller, lastbox,
-                            nullptr, &bSumEkinhOld, (bGStat ? CGLO_GSTAT : 0) | CGLO_TEMPERATURE);
-            wallcycle_start(wcycle, ewcUPDATE);
-            trotter_update(ir, step, ekind, enerd, state, total_vir, mdatoms, &MassQ, trotter_seq, ettTSEQ4);
-            /* now we know the scaling, we can compute the positions again */
-            std::copy(cbuf.begin(), cbuf.end(), state->x.begin());
+                upd.update_sd_second_half(*ir, step, &dvdl_constr, mdatoms, state, cr, nrnb, wcycle,
+                                          constr, do_log, do_ene);
+                upd.finish_update(*ir, mdatoms, state, wcycle, constr != nullptr);
+            }
 
-            upd.update_coords(*ir, step, mdatoms, state, f.view().forceWithPadding(), fcdata, ekind,
-                              M, etrtPOSITION, cr, constr != nullptr);
-            wallcycle_stop(wcycle, ewcUPDATE);
+            if (ir->bPull && ir->pull->bSetPbcRefToPrevStepCOM)
+            {
+                updatePrevStepPullCom(pull_work, state);
+            }
 
-            /* do we need an extra constraint here? just need to copy out of as_rvec_array(state->v.data()) to upd->xp? */
-            /* are the small terms in the shake_vir here due
-             * to numerical errors, or are they important
-             * physically? I'm thinking they are just errors, but not completely sure.
-             * For now, will call without actually constraining, constr=NULL*/
-            upd.finish_update(*ir, mdatoms, state, wcycle, false);
-        }
-        if (EI_VV(ir->eI))
-        {
-            /* this factor or 2 correction is necessary
-               because half of the constraint force is removed
-               in the vv step, so we have to double it.  See
-               the Issue #1255.  It is not yet clear
-               if the factor of 2 is exact, or just a very
-               good approximation, and this will be
-               investigated.  The next step is to see if this
-               can be done adding a dhdl contribution from the
-               rattle step, but this is somewhat more
-               complicated with the current code. Will be
-               investigated, hopefully for 4.6.3. However,
-               this current solution is much better than
-               having it completely wrong.
-             */
-            enerd->term[F_DVDL_CONSTR] += 2 * dvdl_constr;
-        }
-        else
-        {
             enerd->term[F_DVDL_CONSTR] += dvdl_constr;
         }
 
index b1d76c52792e4a3fd635c99a483e0425e2f8fc4b..7ca19227bc37f2f5fad8741ccdec19bb47acf115 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2015,2016,2019, by the GROMACS development team, led by
+# Copyright (c) 2015,2016,2019,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -32,6 +32,7 @@
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(mdrunutility INTERFACE)
 gmx_add_libgromacs_sources(
     handlerestart.cpp
     logging.cpp
@@ -40,6 +41,38 @@ gmx_add_libgromacs_sources(
     threadaffinity.cpp
     )
 
+# Source files have the following private module dependencies.
+target_link_libraries(mdrunutility PRIVATE
+#                      gmxlib
+#                      math
+#                      mdtypes
+#                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(mdrunutility PUBLIC
+target_include_directories(mdrunutility INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(mdrunutility PUBLIC
+target_link_libraries(mdrunutility INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when mdrunutility is an OBJECT target
+#target_link_libraries(mdrunutility PUBLIC legacy_api)
+#target_link_libraries(mdrunutility PRIVATE common)
+
+# Module dependencies
+# mdrunutility interfaces convey transitive dependence on these modules.
+#target_link_libraries(mdrunutility PUBLIC
+target_link_libraries(mdrunutility INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(mdrunutility PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(mdrunutility PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index e538b8ffeddf3529ba31202757571cc24022d46f..900eee12c590946b3a46ac6defbd29f5af3dcc87 100644 (file)
@@ -34,6 +34,8 @@
 
 gmx_add_unit_test_library(mdrunutility-test-shared
                           threadaffinitytest.cpp)
+target_link_libraries(mdrunutility-test-shared PRIVATE common)
+target_link_libraries(mdrunutility-test-shared PUBLIC legacy_api)
 
 gmx_add_unit_test(MdrunUtilityUnitTests mdrunutility-test
     CPP_SOURCE_FILES
index 7af2f8f080f505abc1ef9f3a9c5015fd5ca70607..a9640d1d0eaeee9476816bc10a96be6de4f8f052 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2018, by the GROMACS development team, led by
+# Copyright (c) 2018,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(mdspan INTERFACE)
+
+# Public interface for modules, including dependencies and interfaces
+target_include_directories(mdspan INTERFACE
+        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index 79e8dc9776474dd51f6a032e066896fe31a0bc41..d0dd1b6239a8cffa0a1472dcd1721dd0f2a1adf7 100644 (file)
@@ -40,3 +40,4 @@ gmx_add_unit_test(MDSpanTests mdspan-test
         layouts.cpp
         mdspan.cpp
         )
+target_link_libraries(mdspan-test PRIVATE mdspan)
index 8f60ea640a7eec3b1004a1f52c56f1751682efac..f4517b6cdcddf3f9a4123c865014bd3113eee829 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.
 
+# Set up the module library
+add_library(mdtypes INTERFACE)
+
 file(GLOB MDTYPES_SOURCES
     checkpointdata.cpp
     df_history.cpp
@@ -66,6 +69,38 @@ else()
       )
 endif()
 
+# Source files have the following private module dependencies.
+target_link_libraries(mdtypes PRIVATE
+                      #                      gmxlib
+                      #                      math
+                      #                      mdtypes
+                      #                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(mdtypes PUBLIC
+target_include_directories(mdtypes INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(mdtypes PUBLIC
+target_link_libraries(mdtypes INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when fileio is an OBJECT target
+#target_link_libraries(mdtypes PUBLIC legacy_api)
+#target_link_libraries(mdtypes PRIVATE common)
+
+# Module dependencies
+# fileio interfaces convey transitive dependence on these modules.
+#target_link_libraries(mdtypes PUBLIC
+target_link_libraries(mdtypes INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(mdtypes PRIVATE tng_io)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(mdtypes PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index 65eef2ff80294259cfa8b9b8a8c5cc400b9a5fbf..0fdb10091be0c4c7f800452a477635f146ec238d 100644 (file)
@@ -39,7 +39,7 @@
 
 #include "md_enums.h"
 
-const char* enum_name(int index, int max_index, const char* names[])
+const char* enum_name(int index, int max_index, const char* const names[])
 {
     if (index < 0 || index >= max_index)
     {
index 508a94f6bf16f2314cca7425277b46a6c5724563..763143361219702ba8f278bca6f678038527c7c1 100644 (file)
@@ -58,7 +58,7 @@
  * \param[in] names     The array
  * \return the correct string or "no name defined"
  */
-const char* enum_name(int index, int max_index, const char* names[]);
+const char* enum_name(int index, int max_index, const char* const names[]);
 
 //! Boolean strings no or yes
 extern const char* yesno_names[BOOL_NR + 1];
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 143271e29f787da3cbff19f52d05016e1a5b8f5c..84040bd4c7173dfcd59cac6ea45d8a41984a0572 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.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
-gmx_add_libgromacs_sources(
-        communicator.cpp
-        utilities.cpp
+# Set up the module library
+add_library(mimic INTERFACE)
+file(GLOB MIMIC_SOURCES *.cpp)
+set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${MIMIC_SOURCES} PARENT_SCOPE)
+
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(mimic PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(mimic PUBLIC
+target_include_directories(mimic INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(mimic PUBLIC
+target_link_libraries(mimic INTERFACE
+                      legacy_api
 )
 
+# TODO: when mimic is an OBJECT target
+#target_link_libraries(mimic PUBLIC legacy_api)
+#target_link_libraries(mimic PRIVATE common)
+
+# Module dependencies
+# mimic interfaces convey transitive dependence on these modules.
+#target_link_libraries(mimic PUBLIC
+target_link_libraries(mimic INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(mimic PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(mimic PRIVATE legacy_modules)
+
index ac50973e41ceb9cd2278ad4afb69a58d2050a519..327f2de5e2aec3a97e6a543830384878ff4aa273 100644 (file)
 file(GLOB MODULARSIMULATOR_SOURCES *.cpp)
 
 add_library(modularsimulator OBJECT ${MODULARSIMULATOR_SOURCES})
-target_include_directories(modularsimulator SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
-gmx_target_compile_options(modularsimulator)
-target_compile_definitions(modularsimulator PRIVATE HAVE_CONFIG_H)
-# Should be possible to remove this when resolving #3290
-target_include_directories(modularsimulator SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
 
-if(GMX_OPENMP)
+if (GMX_OPENMP)
     # Explicitly set properties for modular simulator module to compile with openmp
     set_target_properties(modularsimulator PROPERTIES COMPILE_OPTIONS $<TARGET_PROPERTY:OpenMP::OpenMP_CXX,INTERFACE_COMPILE_OPTIONS>)
-endif()
+endif ()
 
 if (WIN32)
     gmx_target_warning_suppression(modularsimulator /wd4244 HAS_NO_MSVC_LOSSY_CONVERSION)
     gmx_target_warning_suppression(modularsimulator /wd4996 HAS_NO_MSVC_UNSAFE_FUNCTION)
-else()
+else ()
     # Several std::move uses are redundant in C++14, but clang before
     # 3.9 had a bug that needed them. gcc 9 can warn about their use,
     # which we need to supress. This suppression should be removed
     # when GROMACS requires clang 3.9 or higher.
     gmx_target_warning_suppression(modularsimulator "-Wno-redundant-move" HAS_NO_REDUNDANT_MOVE)
-endif()
+endif ()
+
+target_include_directories(modularsimulator SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
+gmx_target_compile_options(modularsimulator)
+target_compile_definitions(modularsimulator PRIVATE HAVE_CONFIG_H)
+# Should be possible to remove this when resolving #3290
+target_include_directories(modularsimulator SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
+
+# Source files have the following private external dependencies.
+target_link_libraries(modularsimulator PRIVATE tng_io)
+
+# Source files have the following private infrastructure dependencies.
+target_link_libraries(modularsimulator PRIVATE common)
+
+# Source files have the following private module dependencies.
+# TODO: Explicitly link specific modules.
+target_link_libraries(modularsimulator PRIVATE legacy_modules)
+target_link_libraries(modularsimulator PRIVATE
+                      gmxlib
+                      math
+                      mdtypes
+                      tng_io
+                      )
+
+# Public interface for modules, including dependencies and interfaces
+target_include_directories(modularsimulator PUBLIC
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+target_link_libraries(modularsimulator PUBLIC
+                      legacy_api
+                      )
+
+# Module dependencies
+# This module convey transitive dependence on these modules.
+target_link_libraries(modularsimulator PUBLIC
+                      utility
+                      )
 
 list(APPEND libgromacs_object_library_dependencies modularsimulator)
 set(libgromacs_object_library_dependencies ${libgromacs_object_library_dependencies} PARENT_SCOPE)
index c576b8558d34a2831f7876d08ff661671b25e9a8..bca3f88df9297385469193e9bc2eedd6c4535739 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.
 
+# Set up the module library
+add_library(nbnxm INTERFACE)
+
 add_subdirectory(kernels_simd_4xm)
 add_subdirectory(kernels_simd_2xmm)
 
@@ -76,3 +79,28 @@ if(GMX_GPU_OPENCL)
 endif()
 
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${NBNXM_SOURCES} PARENT_SCOPE)
+
+
+# Source files have the following private module dependencies.
+target_link_libraries(nbnxm PRIVATE
+        )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(nbnxm PUBLIC
+target_include_directories(nbnxm INTERFACE
+        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(nbnxm PUBLIC
+target_link_libraries(nbnxm INTERFACE
+        legacy_api
+        )
+
+# TODO: when nbnxm is an OBJECT target
+#target_link_libraries(nbnxm PUBLIC legacy_api)
+#target_link_libraries(nbnxm PRIVATE common)
+
+# Module dependencies
+# nbnxm interfaces convey transitive dependence on these modules.
+#target_link_libraries(nbnxm PUBLIC
+target_link_libraries(nbnxm INTERFACE
+        utility
+        )
\ No newline at end of file
index dd4eddd0ca38ca1c9c3ebd903256047cc9145b2b..76b394c98b5bbd00ba95ba80e47d191c9e54d8ab 100644 (file)
@@ -52,6 +52,7 @@
 #include "gromacs/math/vec.h"
 #include "gromacs/mdlib/gmx_omp_nthreads.h"
 #include "gromacs/mdtypes/forcerec.h" // only for GET_CGINFO_*
+#include "gromacs/mdtypes/md_enums.h"
 #include "gromacs/nbnxm/nbnxm.h"
 #include "gromacs/pbcutil/ishift.h"
 #include "gromacs/simd/simd.h"
@@ -71,6 +72,8 @@
 
 using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
 
+const char* const c_ljcrNames[ljcrNR + 1] = { "none", "geometric", "Lorentz-Berthelot", nullptr };
+
 void nbnxn_atomdata_t::resizeCoordinateBuffer(int numAtoms)
 {
     numAtoms_ = numAtoms;
@@ -580,9 +583,8 @@ static void nbnxn_atomdata_params_init(const gmx::MDLogger&      mdlog,
                 }
                 else
                 {
-                    mesg = gmx::formatString(
-                            "Using %s Lennard-Jones combination rule",
-                            params->comb_rule == ljcrGEOM ? "geometric" : "Lorentz-Berthelot");
+                    mesg = gmx::formatString("Using %s Lennard-Jones combination rule",
+                                             enum_name(params->comb_rule, ljcrNR, c_ljcrNames));
                 }
                 GMX_LOG(mdlog.info).asParagraph().appendText(mesg);
             }
index df3362b11489ed1de4dcef1a53880ea8b32a3d6c..6f988eb14f3cd02377418a7b64b1f5f81e4b3037 100644 (file)
@@ -164,6 +164,9 @@ enum
     ljcrNR
 };
 
+//! String corresponding to LJ combination rule
+extern const char* const c_ljcrNames[ljcrNR + 1];
+
 /*! \internal
  * \brief Struct that stores atom related data for the nbnxn module
  *
index 48f02fde9e55783bef5f8592247c5499d8c020b7..29ec2288a94bc176495445e701450e2b787ccef4 100644 (file)
@@ -164,7 +164,7 @@ static inline int calc_nb_kernel_nblock(int nwork_units, const DeviceInformation
  */
 
 /*! Force-only kernel function pointers. */
-static const nbnxn_cu_kfunc_ptr_t nb_kfunc_noener_noprune_ptr[eelTypeNR][evdwTypeNR] = {
+static const nbnxn_cu_kfunc_ptr_t nb_kfunc_noener_noprune_ptr[c_numElecTypes][c_numVdwTypes] = {
     { nbnxn_kernel_ElecCut_VdwLJ_F_cuda, nbnxn_kernel_ElecCut_VdwLJCombGeom_F_cuda,
       nbnxn_kernel_ElecCut_VdwLJCombLB_F_cuda, nbnxn_kernel_ElecCut_VdwLJFsw_F_cuda,
       nbnxn_kernel_ElecCut_VdwLJPsw_F_cuda, nbnxn_kernel_ElecCut_VdwLJEwCombGeom_F_cuda,
@@ -192,7 +192,7 @@ static const nbnxn_cu_kfunc_ptr_t nb_kfunc_noener_noprune_ptr[eelTypeNR][evdwTyp
 };
 
 /*! Force + energy kernel function pointers. */
-static const nbnxn_cu_kfunc_ptr_t nb_kfunc_ener_noprune_ptr[eelTypeNR][evdwTypeNR] = {
+static const nbnxn_cu_kfunc_ptr_t nb_kfunc_ener_noprune_ptr[c_numElecTypes][c_numVdwTypes] = {
     { nbnxn_kernel_ElecCut_VdwLJ_VF_cuda, nbnxn_kernel_ElecCut_VdwLJCombGeom_VF_cuda,
       nbnxn_kernel_ElecCut_VdwLJCombLB_VF_cuda, nbnxn_kernel_ElecCut_VdwLJFsw_VF_cuda,
       nbnxn_kernel_ElecCut_VdwLJPsw_VF_cuda, nbnxn_kernel_ElecCut_VdwLJEwCombGeom_VF_cuda,
@@ -220,7 +220,7 @@ static const nbnxn_cu_kfunc_ptr_t nb_kfunc_ener_noprune_ptr[eelTypeNR][evdwTypeN
 };
 
 /*! Force + pruning kernel function pointers. */
-static const nbnxn_cu_kfunc_ptr_t nb_kfunc_noener_prune_ptr[eelTypeNR][evdwTypeNR] = {
+static const nbnxn_cu_kfunc_ptr_t nb_kfunc_noener_prune_ptr[c_numElecTypes][c_numVdwTypes] = {
     { nbnxn_kernel_ElecCut_VdwLJ_F_prune_cuda, nbnxn_kernel_ElecCut_VdwLJCombGeom_F_prune_cuda,
       nbnxn_kernel_ElecCut_VdwLJCombLB_F_prune_cuda, nbnxn_kernel_ElecCut_VdwLJFsw_F_prune_cuda,
       nbnxn_kernel_ElecCut_VdwLJPsw_F_prune_cuda, nbnxn_kernel_ElecCut_VdwLJEwCombGeom_F_prune_cuda,
@@ -250,7 +250,7 @@ static const nbnxn_cu_kfunc_ptr_t nb_kfunc_noener_prune_ptr[eelTypeNR][evdwTypeN
 };
 
 /*! Force + energy + pruning kernel function pointers. */
-static const nbnxn_cu_kfunc_ptr_t nb_kfunc_ener_prune_ptr[eelTypeNR][evdwTypeNR] = {
+static const nbnxn_cu_kfunc_ptr_t nb_kfunc_ener_prune_ptr[c_numElecTypes][c_numVdwTypes] = {
     { nbnxn_kernel_ElecCut_VdwLJ_VF_prune_cuda, nbnxn_kernel_ElecCut_VdwLJCombGeom_VF_prune_cuda,
       nbnxn_kernel_ElecCut_VdwLJCombLB_VF_prune_cuda, nbnxn_kernel_ElecCut_VdwLJFsw_VF_prune_cuda,
       nbnxn_kernel_ElecCut_VdwLJPsw_VF_prune_cuda, nbnxn_kernel_ElecCut_VdwLJEwCombGeom_VF_prune_cuda,
@@ -282,17 +282,18 @@ static const nbnxn_cu_kfunc_ptr_t nb_kfunc_ener_prune_ptr[eelTypeNR][evdwTypeNR]
 };
 
 /*! Return a pointer to the kernel version to be executed at the current step. */
-static inline nbnxn_cu_kfunc_ptr_t select_nbnxn_kernel(int                     eeltype,
-                                                       int                     evdwtype,
+static inline nbnxn_cu_kfunc_ptr_t select_nbnxn_kernel(enum ElecType           elecType,
+                                                       enum VdwType            vdwType,
                                                        bool                    bDoEne,
                                                        bool                    bDoPrune,
                                                        const DeviceInformation gmx_unused* deviceInfo)
 {
-    nbnxn_cu_kfunc_ptr_t res;
+    const int elecTypeIdx = static_cast<int>(elecType);
+    const int vdwTypeIdx  = static_cast<int>(vdwType);
 
-    GMX_ASSERT(eeltype < eelTypeNR,
+    GMX_ASSERT(elecTypeIdx < c_numElecTypes,
                "The electrostatics type requested is not implemented in the CUDA kernels.");
-    GMX_ASSERT(evdwtype < evdwTypeNR,
+    GMX_ASSERT(vdwTypeIdx < c_numVdwTypes,
                "The VdW type requested is not implemented in the CUDA kernels.");
 
     /* assert assumptions made by the kernels */
@@ -306,26 +307,24 @@ static inline nbnxn_cu_kfunc_ptr_t select_nbnxn_kernel(int                     e
     {
         if (bDoPrune)
         {
-            res = nb_kfunc_ener_prune_ptr[eeltype][evdwtype];
+            return nb_kfunc_ener_prune_ptr[elecTypeIdx][vdwTypeIdx];
         }
         else
         {
-            res = nb_kfunc_ener_noprune_ptr[eeltype][evdwtype];
+            return nb_kfunc_ener_noprune_ptr[elecTypeIdx][vdwTypeIdx];
         }
     }
     else
     {
         if (bDoPrune)
         {
-            res = nb_kfunc_noener_prune_ptr[eeltype][evdwtype];
+            return nb_kfunc_noener_prune_ptr[elecTypeIdx][vdwTypeIdx];
         }
         else
         {
-            res = nb_kfunc_noener_noprune_ptr[eeltype][evdwtype];
+            return nb_kfunc_noener_noprune_ptr[elecTypeIdx][vdwTypeIdx];
         }
     }
-
-    return res;
 }
 
 /*! \brief Calculates the amount of shared memory required by the nonbonded kernel in use. */
@@ -344,7 +343,7 @@ static inline int calc_shmem_required_nonbonded(const int               num_thre
     /* cj in shared memory, for each warp separately */
     shmem += num_threads_z * c_nbnxnGpuClusterpairSplit * c_nbnxnGpuJgroupSize * sizeof(int);
 
-    if (nbp->vdwtype == evdwTypeCUTCOMBGEOM || nbp->vdwtype == evdwTypeCUTCOMBLB)
+    if (nbp->vdwType == VdwType::CutCombGeom || nbp->vdwType == VdwType::CutCombLB)
     {
         /* i-atom LJ combination parameters in shared memory */
         shmem += c_nbnxnGpuNumClusterPerSupercluster * c_clSize * sizeof(float2);
@@ -562,7 +561,7 @@ void gpu_launch_kernel(NbnxmGpu* nb, const gmx::StepWorkload& stepWork, const In
 
     auto*      timingEvent = bDoTime ? t->interaction[iloc].nb_k.fetchNextEvent() : nullptr;
     const auto kernel =
-            select_nbnxn_kernel(nbp->eeltype, nbp->vdwtype, stepWork.computeEnergy,
+            select_nbnxn_kernel(nbp->elecType, nbp->vdwType, stepWork.computeEnergy,
                                 (plist->haveFreshList && !nb->timers->interaction[iloc].didPrune),
                                 &nb->deviceContext_->deviceInfo());
     const auto kernelArgs =
@@ -817,9 +816,9 @@ void cuda_set_cacheconfig()
 {
     cudaError_t stat;
 
-    for (int i = 0; i < eelTypeNR; i++)
+    for (int i = 0; i < c_numElecTypes; i++)
     {
-        for (int j = 0; j < evdwTypeNR; j++)
+        for (int j = 0; j < c_numVdwTypes; j++)
         {
             /* Default kernel 32/32 kB Shared/L1 */
             cudaFuncSetCacheConfig(nb_kfunc_ener_prune_ptr[i][j], cudaFuncCachePreferEqual);
index b1d6774a26eb329362fc11cee409be22644c11a8..65ec216351faf5fb408fbb1e3ba772f5969a46ff 100644 (file)
@@ -124,9 +124,7 @@ static void init_nbparam(NBParamGpu*                     nbp,
                          const nbnxn_atomdata_t::Params& nbatParams,
                          const DeviceContext&            deviceContext)
 {
-    int ntypes;
-
-    ntypes = nbatParams.numTypes;
+    const int ntypes = nbatParams.numTypes;
 
     set_cutoff_parameters(nbp, ic, listParams);
 
@@ -139,80 +137,19 @@ static void init_nbparam(NBParamGpu*                     nbp,
      * combination is rarely used. LJ force-switch with LB rule is more common,
      * but gives only 1% speed-up.
      */
-    if (ic->vdwtype == evdwCUT)
-    {
-        switch (ic->vdw_modifier)
-        {
-            case eintmodNONE:
-            case eintmodPOTSHIFT:
-                switch (nbatParams.comb_rule)
-                {
-                    case ljcrNONE: nbp->vdwtype = evdwTypeCUT; break;
-                    case ljcrGEOM: nbp->vdwtype = evdwTypeCUTCOMBGEOM; break;
-                    case ljcrLB: nbp->vdwtype = evdwTypeCUTCOMBLB; break;
-                    default:
-                        gmx_incons(
-                                "The requested LJ combination rule is not implemented in the CUDA "
-                                "GPU accelerated kernels!");
-                }
-                break;
-            case eintmodFORCESWITCH: nbp->vdwtype = evdwTypeFSWITCH; break;
-            case eintmodPOTSWITCH: nbp->vdwtype = evdwTypePSWITCH; break;
-            default:
-                gmx_incons(
-                        "The requested VdW interaction modifier is not implemented in the CUDA GPU "
-                        "accelerated kernels!");
-        }
-    }
-    else if (ic->vdwtype == evdwPME)
-    {
-        if (ic->ljpme_comb_rule == ljcrGEOM)
-        {
-            assert(nbatParams.comb_rule == ljcrGEOM);
-            nbp->vdwtype = evdwTypeEWALDGEOM;
-        }
-        else
-        {
-            assert(nbatParams.comb_rule == ljcrLB);
-            nbp->vdwtype = evdwTypeEWALDLB;
-        }
-    }
-    else
-    {
-        gmx_incons(
-                "The requested VdW type is not implemented in the CUDA GPU accelerated kernels!");
-    }
-
-    if (ic->eeltype == eelCUT)
-    {
-        nbp->eeltype = eelTypeCUT;
-    }
-    else if (EEL_RF(ic->eeltype))
-    {
-        nbp->eeltype = eelTypeRF;
-    }
-    else if ((EEL_PME(ic->eeltype) || ic->eeltype == eelEWALD))
-    {
-        nbp->eeltype = nbnxn_gpu_pick_ewald_kernel_type(*ic);
-    }
-    else
-    {
-        /* Shouldn't happen, as this is checked when choosing Verlet-scheme */
-        gmx_incons(
-                "The requested electrostatics type is not implemented in the CUDA GPU accelerated "
-                "kernels!");
-    }
+    nbp->vdwType  = nbnxmGpuPickVdwKernelType(ic, nbatParams.comb_rule);
+    nbp->elecType = nbnxmGpuPickElectrostaticsKernelType(ic);
 
     /* generate table for PME */
     nbp->coulomb_tab = nullptr;
-    if (nbp->eeltype == eelTypeEWALD_TAB || nbp->eeltype == eelTypeEWALD_TAB_TWIN)
+    if (nbp->elecType == ElecType::EwaldTab || nbp->elecType == ElecType::EwaldTabTwin)
     {
         GMX_RELEASE_ASSERT(ic->coulombEwaldTables, "Need valid Coulomb Ewald correction tables");
         init_ewald_coulomb_force_table(*ic->coulombEwaldTables, nbp, deviceContext);
     }
 
     /* set up LJ parameter lookup table */
-    if (!useLjCombRule(nbp->vdwtype))
+    if (!useLjCombRule(nbp->vdwType))
     {
         initParamLookupTable(&nbp->nbfp, &nbp->nbfp_texobj, nbatParams.nbfp.data(),
                              2 * ntypes * ntypes, deviceContext);
@@ -412,7 +349,7 @@ void gpu_init_atomdata(NbnxmGpu* nb, const nbnxn_atomdata_t* nbat)
 
         allocateDeviceBuffer(&d_atdat->f, nalloc, deviceContext);
         allocateDeviceBuffer(&d_atdat->xq, nalloc, deviceContext);
-        if (useLjCombRule(nb->nbparam->vdwtype))
+        if (useLjCombRule(nb->nbparam->vdwType))
         {
             allocateDeviceBuffer(&d_atdat->lj_comb, nalloc, deviceContext);
         }
@@ -434,7 +371,7 @@ void gpu_init_atomdata(NbnxmGpu* nb, const nbnxn_atomdata_t* nbat)
         nbnxn_cuda_clear_f(nb, nalloc);
     }
 
-    if (useLjCombRule(nb->nbparam->vdwtype))
+    if (useLjCombRule(nb->nbparam->vdwType))
     {
         static_assert(sizeof(d_atdat->lj_comb[0]) == sizeof(float2),
                       "Size of the LJ parameters element should be equal to the size of float2.");
@@ -471,7 +408,7 @@ void gpu_free(NbnxmGpu* nb)
     nbparam = nb->nbparam;
 
     if ((!nbparam->coulomb_tab)
-        && (nbparam->eeltype == eelTypeEWALD_TAB || nbparam->eeltype == eelTypeEWALD_TAB_TWIN))
+        && (nbparam->elecType == ElecType::EwaldTab || nbparam->elecType == ElecType::EwaldTabTwin))
     {
         destroyParamLookupTable(&nbparam->coulomb_tab, nbparam->coulomb_tab_texobj);
     }
@@ -483,12 +420,12 @@ void gpu_free(NbnxmGpu* nb)
 
     delete nb->timers;
 
-    if (!useLjCombRule(nb->nbparam->vdwtype))
+    if (!useLjCombRule(nb->nbparam->vdwType))
     {
         destroyParamLookupTable(&nbparam->nbfp, nbparam->nbfp_texobj);
     }
 
-    if (nbparam->vdwtype == evdwTypeEWALDGEOM || nbparam->vdwtype == evdwTypeEWALDLB)
+    if (nbparam->vdwType == VdwType::EwaldGeom || nbparam->vdwType == VdwType::EwaldLB)
     {
         destroyParamLookupTable(&nbparam->nbfp_comb, nbparam->nbfp_comb_texobj);
     }
index a472cb437dabaf08cc4b8603cdf692614000ca85..763482badd75de8702c62632fde035a5c74964ef 100644 (file)
@@ -50,6 +50,8 @@
 #include "gromacs/gpu_utils/gpu_macros.h"
 #include "gromacs/mdtypes/locality.h"
 
+#include "nbnxm.h"
+
 struct NbnxmGpu;
 struct DeviceInformation;
 struct gmx_wallclock_gpu_nbnxn_t;
@@ -124,6 +126,16 @@ int gpu_min_ci_balanced(NbnxmGpu gmx_unused* nb) GPU_FUNC_TERM_WITH_RETURN(-1);
 GPU_FUNC_QUALIFIER
 bool gpu_is_kernel_ewald_analytical(const NbnxmGpu gmx_unused* nb) GPU_FUNC_TERM_WITH_RETURN(FALSE);
 
+/** Return the enum value of electrostatics kernel type for given interaction parameters \p ic. */
+GPU_FUNC_QUALIFIER
+enum ElecType nbnxmGpuPickElectrostaticsKernelType(const interaction_const_t gmx_unused* ic)
+        GPU_FUNC_TERM_WITH_RETURN(ElecType::Count);
+
+/** Return the enum value of VdW kernel type for given \p ic and \p combRule. */
+GPU_FUNC_QUALIFIER
+enum VdwType nbnxmGpuPickVdwKernelType(const interaction_const_t gmx_unused* ic, int gmx_unused combRule)
+        GPU_FUNC_TERM_WITH_RETURN(VdwType::Count);
+
 /** Returns an opaque pointer to the GPU command stream
  *  Note: CUDA only.
  */
index 9166a3e50a2497cfedbbee4c4a09ef4de12034e5..57d791be2a85f7d4945f9bd1db2173336ee677ee 100644 (file)
@@ -47,6 +47,7 @@
 #include "gromacs/mdtypes/locality.h"
 #include "gromacs/utility/enumerationhelpers.h"
 
+#include "nbnxm.h"
 #include "pairlist.h"
 
 #if GMX_GPU_OPENCL
 struct NBParamGpu
 {
 
-    //! type of electrostatics, takes values from #eelType
-    int eeltype;
-    //! type of VdW impl., takes values from #evdwType
-    int vdwtype;
+    //! type of electrostatics
+    enum Nbnxm::ElecType elecType;
+    //! type of VdW impl.
+    enum Nbnxm::VdwType vdwType;
 
     //! charge multiplication factor
     float epsfac;
index 2596350e52dc8096590c8278f4583ca0ec68f77f..bf94b022e72916a3a5f32f16ac2152e19d54f7da 100644 (file)
@@ -155,13 +155,62 @@ class StepWorkload;
 class UpdateGroupsCog;
 } // namespace gmx
 
+//! Namespace for non-bonded kernels
 namespace Nbnxm
 {
 enum class KernelType;
-}
 
-namespace Nbnxm
+/*! \brief Nbnxm electrostatic GPU kernel flavors.
+ *
+ *  Types of electrostatics implementations available in the GPU non-bonded
+ *  force kernels. These represent both the electrostatics types implemented
+ *  by the kernels (cut-off, RF, and Ewald - a subset of what's defined in
+ *  enums.h) as well as encode implementation details analytical/tabulated
+ *  and single or twin cut-off (for Ewald kernels).
+ *  Note that the cut-off and RF kernels have only analytical flavor and unlike
+ *  in the CPU kernels, the tabulated kernels are ATM Ewald-only.
+ *
+ *  The row-order of pointers to different electrostatic kernels defined in
+ *  nbnxn_cuda.cu by the nb_*_kfunc_ptr function pointer table
+ *  should match the order of enumerated types below.
+ */
+enum class ElecType : int
+{
+    Cut,          //!< Plain cut-off
+    RF,           //!< Reaction field
+    EwaldTab,     //!< Tabulated Ewald with single cut-off
+    EwaldTabTwin, //!< Tabulated Ewald with twin cut-off
+    EwaldAna,     //!< Analytical Ewald with single cut-off
+    EwaldAnaTwin, //!< Analytical Ewald with twin cut-off
+    Count         //!< Number of valid values
+};
+
+//! Number of possible \ref ElecType values.
+constexpr int c_numElecTypes = static_cast<int>(ElecType::Count);
+
+/*! \brief Nbnxm VdW GPU kernel flavors.
+ *
+ * The enumerates values correspond to the LJ implementations in the GPU non-bonded
+ * kernels.
+ *
+ * The column-order of pointers to different electrostatic kernels defined in
+ * nbnxn_cuda_ocl.cpp/.cu by the nb_*_kfunc_ptr function pointer table
+ * should match the order of enumerated types below.
+ */
+enum class VdwType : int
 {
+    Cut,         //!< Plain cut-off
+    CutCombGeom, //!< Cut-off with geometric combination rules
+    CutCombLB,   //!< Cut-off with Lorentz-Berthelot combination rules
+    FSwitch,     //!< Smooth force switch
+    PSwitch,     //!< Smooth potential switch
+    EwaldGeom,   //!< Ewald with geometric combination rules
+    EwaldLB,     //!< Ewald with Lorentz-Berthelot combination rules
+    Count        //!< Number of valid values
+};
+
+//! Number of possible \ref VdwType values.
+constexpr int c_numVdwTypes = static_cast<int>(VdwType::Count);
 
 /*! \brief Nonbonded NxN kernel types: plain C, CPU SIMD, GPU, GPU emulation */
 enum class KernelType : int
@@ -236,8 +285,6 @@ public:
     //! Return whether the pairlist is of simple, CPU type
     bool pairlistIsSimple() const { return !useGpu() && !emulateGpu(); }
 
-    //! Initialize the pair list sets, TODO this should be private
-    void initPairlistSets(bool haveMultipleDomains);
 
     //! Returns the order of the local atoms on the grid
     gmx::ArrayRef<const int> getLocalAtomOrder() const;
@@ -342,22 +389,6 @@ public:
      */
     void atomdata_add_nbat_f_to_f(gmx::AtomLocality locality, gmx::ArrayRef<gmx::RVec> force);
 
-    /*! \brief Add the forces stored in nbat to total force using GPU buffer opse
-     *
-     * \param [in]     locality             Local or non-local
-     * \param [in,out] totalForcesDevice    Force to be added to
-     * \param [in]     forcesPmeDevice      Device buffer with PME forces
-     * \param[in]      dependencyList       List of synchronizers that represent the dependencies the reduction task needs to sync on.
-     * \param [in]     useGpuFPmeReduction  Whether PME forces should be added
-     * \param [in]     accumulateForce      If the total force buffer already contains data
-     */
-    void atomdata_add_nbat_f_to_f_gpu(gmx::AtomLocality                          locality,
-                                      DeviceBuffer<gmx::RVec>                    totalForcesDevice,
-                                      void*                                      forcesPmeDevice,
-                                      gmx::ArrayRef<GpuEventSynchronizer* const> dependencyList,
-                                      bool useGpuFPmeReduction,
-                                      bool accumulateForce);
-
     /*! \brief Get the number of atoms for a given locality
      *
      * \param [in] locality   Local or non-local
index b18d16a7a46a2ed2b874bcad2038d44df3c6edc3..034b0f656243b63727b0eba1c4825d17a2359121 100644 (file)
@@ -51,6 +51,8 @@
 #include "gromacs/utility/basedefinitions.h"
 #include "gromacs/utility/real.h"
 
+#include "nbnxm.h"
+
 struct interaction_const_t;
 struct nbnxn_atomdata_t;
 struct gmx_wallcycle;
@@ -62,52 +64,6 @@ class GpuBonded;
 class StepWorkload;
 } // namespace gmx
 
-/*! \brief Nbnxm electrostatic GPU kernel flavors.
- *
- *  Types of electrostatics implementations available in the GPU non-bonded
- *  force kernels. These represent both the electrostatics types implemented
- *  by the kernels (cut-off, RF, and Ewald - a subset of what's defined in
- *  enums.h) as well as encode implementation details analytical/tabulated
- *  and single or twin cut-off (for Ewald kernels).
- *  Note that the cut-off and RF kernels have only analytical flavor and unlike
- *  in the CPU kernels, the tabulated kernels are ATM Ewald-only.
- *
- *  The row-order of pointers to different electrostatic kernels defined in
- *  nbnxn_cuda.cu by the nb_*_kfunc_ptr function pointer table
- *  should match the order of enumerated types below.
- */
-enum eelType : int
-{
-    eelTypeCUT,
-    eelTypeRF,
-    eelTypeEWALD_TAB,
-    eelTypeEWALD_TAB_TWIN,
-    eelTypeEWALD_ANA,
-    eelTypeEWALD_ANA_TWIN,
-    eelTypeNR
-};
-
-/*! \brief Nbnxm VdW GPU kernel flavors.
- *
- * The enumerates values correspond to the LJ implementations in the GPU non-bonded
- * kernels.
- *
- * The column-order of pointers to different electrostatic kernels defined in
- * nbnxn_cuda_ocl.cpp/.cu by the nb_*_kfunc_ptr function pointer table
- * should match the order of enumerated types below.
- */
-enum evdwType : int
-{
-    evdwTypeCUT,
-    evdwTypeCUTCOMBGEOM,
-    evdwTypeCUTCOMBLB,
-    evdwTypeFSWITCH,
-    evdwTypePSWITCH,
-    evdwTypeEWALDGEOM,
-    evdwTypeEWALDLB,
-    evdwTypeNR
-};
-
 namespace Nbnxm
 {
 
@@ -115,14 +71,14 @@ class Grid;
 
 /*! \brief Returns true if LJ combination rules are used in the non-bonded kernels.
  *
- *  \param[in] vdwType  The VdW interaction/implementation type as defined by evdwType
+ *  \param[in] vdwType  The VdW interaction/implementation type as defined by VdwType
  *                      enumeration.
  *
  * \returns Whether combination rules are used by the run.
  */
-static inline bool useLjCombRule(const int vdwType)
+static inline bool useLjCombRule(const enum VdwType vdwType)
 {
-    return (vdwType == evdwTypeCUTCOMBGEOM || vdwType == evdwTypeCUTCOMBLB);
+    return (vdwType == VdwType::CutCombGeom || vdwType == VdwType::CutCombLB);
 }
 
 /*! \brief
index 0c3586f7d68e510a7d4611e7820a8a8399470095..e98651f1adab6611e932cb430d0c9bd52c08911d 100644 (file)
@@ -58,6 +58,7 @@
 
 #include "nbnxm_gpu_data_mgmt.h"
 
+#include "gromacs/mdtypes/interaction_const.h"
 #include "gromacs/nbnxm/gpu_data_mgmt.h"
 #include "gromacs/timing/gpu_timing.h"
 #include "gromacs/utility/cstringutil.h"
@@ -95,10 +96,9 @@ void inline printEnvironmentVariableDeprecationMessage(bool               isEnvi
     }
 }
 
-int nbnxn_gpu_pick_ewald_kernel_type(const interaction_const_t& ic)
+enum ElecType nbnxn_gpu_pick_ewald_kernel_type(const interaction_const_t& ic)
 {
     bool bTwinCut = (ic.rcoulomb != ic.rvdw);
-    int  kernel_type;
 
     /* Benchmarking/development environment variables to force the use of
        analytical or tabulated Ewald kernel. */
@@ -155,14 +155,12 @@ int nbnxn_gpu_pick_ewald_kernel_type(const interaction_const_t& ic)
        forces it (use it for debugging/benchmarking only). */
     if (!bTwinCut && !forceTwinCutoffEwald)
     {
-        kernel_type = bUseAnalyticalEwald ? eelTypeEWALD_ANA : eelTypeEWALD_TAB;
+        return bUseAnalyticalEwald ? ElecType::EwaldAna : ElecType::EwaldTab;
     }
     else
     {
-        kernel_type = bUseAnalyticalEwald ? eelTypeEWALD_ANA_TWIN : eelTypeEWALD_TAB_TWIN;
+        return bUseAnalyticalEwald ? ElecType::EwaldAnaTwin : ElecType::EwaldTabTwin;
     }
-
-    return kernel_type;
 }
 
 void set_cutoff_parameters(NBParamGpu* nbp, const interaction_const_t* ic, const PairlistParams& listParams)
@@ -198,7 +196,7 @@ void gpu_pme_loadbal_update_param(const nonbonded_verlet_t* nbv, const interacti
 
     set_cutoff_parameters(nbp, ic, nbv->pairlistSets().params());
 
-    nbp->eeltype = nbnxn_gpu_pick_ewald_kernel_type(*ic);
+    nbp->elecType = nbnxn_gpu_pick_ewald_kernel_type(*ic);
 
     GMX_RELEASE_ASSERT(ic->coulombEwaldTables, "Need valid Coulomb Ewald correction tables");
     init_ewald_coulomb_force_table(*ic->coulombEwaldTables, nbp, *nb->deviceContext_);
@@ -329,7 +327,82 @@ void gpu_reset_timings(nonbonded_verlet_t* nbv)
 
 bool gpu_is_kernel_ewald_analytical(const NbnxmGpu* nb)
 {
-    return ((nb->nbparam->eeltype == eelTypeEWALD_ANA) || (nb->nbparam->eeltype == eelTypeEWALD_ANA_TWIN));
+    return ((nb->nbparam->elecType == ElecType::EwaldAna)
+            || (nb->nbparam->elecType == ElecType::EwaldAnaTwin));
+}
+
+enum ElecType nbnxmGpuPickElectrostaticsKernelType(const interaction_const_t* ic)
+{
+    if (ic->eeltype == eelCUT)
+    {
+        return ElecType::Cut;
+    }
+    else if (EEL_RF(ic->eeltype))
+    {
+        return ElecType::RF;
+    }
+    else if ((EEL_PME(ic->eeltype) || ic->eeltype == eelEWALD))
+    {
+        return nbnxn_gpu_pick_ewald_kernel_type(*ic);
+    }
+    else
+    {
+        /* Shouldn't happen, as this is checked when choosing Verlet-scheme */
+        GMX_THROW(gmx::InconsistentInputError(
+                gmx::formatString("The requested electrostatics type %s (%d) is not implemented in "
+                                  "the GPU accelerated kernels!",
+                                  EELTYPE(ic->eeltype), ic->eeltype)));
+    }
+}
+
+
+enum VdwType nbnxmGpuPickVdwKernelType(const interaction_const_t* ic, int combRule)
+{
+    if (ic->vdwtype == evdwCUT)
+    {
+        switch (ic->vdw_modifier)
+        {
+            case eintmodNONE:
+            case eintmodPOTSHIFT:
+                switch (combRule)
+                {
+                    case ljcrNONE: return VdwType::Cut;
+                    case ljcrGEOM: return VdwType::CutCombGeom;
+                    case ljcrLB: return VdwType::CutCombLB;
+                    default:
+                        GMX_THROW(gmx::InconsistentInputError(gmx::formatString(
+                                "The requested LJ combination rule %s (%d) is not implemented in "
+                                "the GPU accelerated kernels!",
+                                enum_name(combRule, ljcrNR, c_ljcrNames), combRule)));
+                }
+            case eintmodFORCESWITCH: return VdwType::FSwitch;
+            case eintmodPOTSWITCH: return VdwType::PSwitch;
+            default:
+                GMX_THROW(gmx::InconsistentInputError(
+                        gmx::formatString("The requested VdW interaction modifier %s (%d) is not "
+                                          "implemented in the GPU accelerated kernels!",
+                                          INTMODIFIER(ic->vdw_modifier), ic->vdw_modifier)));
+        }
+    }
+    else if (ic->vdwtype == evdwPME)
+    {
+        if (ic->ljpme_comb_rule == ljcrGEOM)
+        {
+            assert(combRule == ljcrGEOM);
+            return VdwType::EwaldGeom;
+        }
+        else
+        {
+            assert(combRule == ljcrLB);
+            return VdwType::EwaldLB;
+        }
+    }
+    else
+    {
+        GMX_THROW(gmx::InconsistentInputError(gmx::formatString(
+                "The requested VdW type %s (%d) is not implemented in the GPU accelerated kernels!",
+                EVDWTYPE(ic->vdwtype), ic->vdwtype)));
+    }
 }
 
 } // namespace Nbnxm
index 761737ddf0c50a2f19a1c335796bb4e0434ac85c..e0e65e562b886157dee6738d27da0672f279b68b 100644 (file)
@@ -68,7 +68,7 @@ void init_ewald_coulomb_force_table(const EwaldCorrectionTables& tables,
                                     const DeviceContext&         deviceContext);
 
 /*! \brief Selects the Ewald kernel type, analytical or tabulated, single or twin cut-off. */
-int nbnxn_gpu_pick_ewald_kernel_type(const interaction_const_t gmx_unused& ic);
+enum ElecType nbnxn_gpu_pick_ewald_kernel_type(const interaction_const_t gmx_unused& ic);
 
 /*! \brief Copies all parameters related to the cut-off from ic to nbp
  */
index 48e8ed03ad37e1189abc522330af67ef03932779..affbad0811729cdd7ec9e0f4dd5a4ceac5d81cdf 100644 (file)
@@ -162,7 +162,7 @@ static inline void validate_global_work_size(const KernelLaunchConfig& config,
  */
 
 /*! \brief Force-only kernel function names. */
-static const char* nb_kfunc_noener_noprune_ptr[eelTypeNR][evdwTypeNR] = {
+static const char* nb_kfunc_noener_noprune_ptr[c_numElecTypes][c_numVdwTypes] = {
     { "nbnxn_kernel_ElecCut_VdwLJ_F_opencl", "nbnxn_kernel_ElecCut_VdwLJCombGeom_F_opencl",
       "nbnxn_kernel_ElecCut_VdwLJCombLB_F_opencl", "nbnxn_kernel_ElecCut_VdwLJFsw_F_opencl",
       "nbnxn_kernel_ElecCut_VdwLJPsw_F_opencl", "nbnxn_kernel_ElecCut_VdwLJEwCombGeom_F_opencl",
@@ -196,7 +196,7 @@ static const char* nb_kfunc_noener_noprune_ptr[eelTypeNR][evdwTypeNR] = {
 };
 
 /*! \brief Force + energy kernel function pointers. */
-static const char* nb_kfunc_ener_noprune_ptr[eelTypeNR][evdwTypeNR] = {
+static const char* nb_kfunc_ener_noprune_ptr[c_numElecTypes][c_numVdwTypes] = {
     { "nbnxn_kernel_ElecCut_VdwLJ_VF_opencl", "nbnxn_kernel_ElecCut_VdwLJCombGeom_VF_opencl",
       "nbnxn_kernel_ElecCut_VdwLJCombLB_VF_opencl", "nbnxn_kernel_ElecCut_VdwLJFsw_VF_opencl",
       "nbnxn_kernel_ElecCut_VdwLJPsw_VF_opencl", "nbnxn_kernel_ElecCut_VdwLJEwCombGeom_VF_opencl",
@@ -231,7 +231,7 @@ static const char* nb_kfunc_ener_noprune_ptr[eelTypeNR][evdwTypeNR] = {
 };
 
 /*! \brief Force + pruning kernel function pointers. */
-static const char* nb_kfunc_noener_prune_ptr[eelTypeNR][evdwTypeNR] = {
+static const char* nb_kfunc_noener_prune_ptr[c_numElecTypes][c_numVdwTypes] = {
     { "nbnxn_kernel_ElecCut_VdwLJ_F_prune_opencl",
       "nbnxn_kernel_ElecCut_VdwLJCombGeom_F_prune_opencl",
       "nbnxn_kernel_ElecCut_VdwLJCombLB_F_prune_opencl",
@@ -272,7 +272,7 @@ static const char* nb_kfunc_noener_prune_ptr[eelTypeNR][evdwTypeNR] = {
 };
 
 /*! \brief Force + energy + pruning kernel function pointers. */
-static const char* nb_kfunc_ener_prune_ptr[eelTypeNR][evdwTypeNR] = {
+static const char* nb_kfunc_ener_prune_ptr[c_numElecTypes][c_numVdwTypes] = {
     { "nbnxn_kernel_ElecCut_VdwLJ_VF_prune_opencl",
       "nbnxn_kernel_ElecCut_VdwLJCombGeom_VF_prune_opencl",
       "nbnxn_kernel_ElecCut_VdwLJCombLB_VF_prune_opencl",
@@ -341,41 +341,45 @@ static inline cl_kernel selectPruneKernel(cl_kernel kernel_pruneonly[], bool fir
  *  OpenCL kernel objects are cached in nb. If the requested kernel is not
  *  found in the cache, it will be created and the cache will be updated.
  */
-static inline cl_kernel select_nbnxn_kernel(NbnxmGpu* nb, int eeltype, int evdwtype, bool bDoEne, bool bDoPrune)
+static inline cl_kernel
+select_nbnxn_kernel(NbnxmGpu* nb, enum ElecType elecType, enum VdwType vdwType, bool bDoEne, bool bDoPrune)
 {
     const char* kernel_name_to_run;
     cl_kernel*  kernel_ptr;
     cl_int      cl_error;
 
-    GMX_ASSERT(eeltype < eelTypeNR,
+    const int elecTypeIdx = static_cast<int>(elecType);
+    const int vdwTypeIdx  = static_cast<int>(vdwType);
+
+    GMX_ASSERT(elecTypeIdx < c_numElecTypes,
                "The electrostatics type requested is not implemented in the OpenCL kernels.");
-    GMX_ASSERT(evdwtype < evdwTypeNR,
+    GMX_ASSERT(vdwTypeIdx < c_numVdwTypes,
                "The VdW type requested is not implemented in the OpenCL kernels.");
 
     if (bDoEne)
     {
         if (bDoPrune)
         {
-            kernel_name_to_run = nb_kfunc_ener_prune_ptr[eeltype][evdwtype];
-            kernel_ptr         = &(nb->kernel_ener_prune_ptr[eeltype][evdwtype]);
+            kernel_name_to_run = nb_kfunc_ener_prune_ptr[elecTypeIdx][vdwTypeIdx];
+            kernel_ptr         = &(nb->kernel_ener_prune_ptr[elecTypeIdx][vdwTypeIdx]);
         }
         else
         {
-            kernel_name_to_run = nb_kfunc_ener_noprune_ptr[eeltype][evdwtype];
-            kernel_ptr         = &(nb->kernel_ener_noprune_ptr[eeltype][evdwtype]);
+            kernel_name_to_run = nb_kfunc_ener_noprune_ptr[elecTypeIdx][vdwTypeIdx];
+            kernel_ptr         = &(nb->kernel_ener_noprune_ptr[elecTypeIdx][vdwTypeIdx]);
         }
     }
     else
     {
         if (bDoPrune)
         {
-            kernel_name_to_run = nb_kfunc_noener_prune_ptr[eeltype][evdwtype];
-            kernel_ptr         = &(nb->kernel_noener_prune_ptr[eeltype][evdwtype]);
+            kernel_name_to_run = nb_kfunc_noener_prune_ptr[elecTypeIdx][vdwTypeIdx];
+            kernel_ptr         = &(nb->kernel_noener_prune_ptr[elecTypeIdx][vdwTypeIdx]);
         }
         else
         {
-            kernel_name_to_run = nb_kfunc_noener_noprune_ptr[eeltype][evdwtype];
-            kernel_ptr         = &(nb->kernel_noener_noprune_ptr[eeltype][evdwtype]);
+            kernel_name_to_run = nb_kfunc_noener_noprune_ptr[elecTypeIdx][vdwTypeIdx];
+            kernel_ptr         = &(nb->kernel_noener_noprune_ptr[elecTypeIdx][vdwTypeIdx]);
         }
     }
 
@@ -392,7 +396,7 @@ static inline cl_kernel select_nbnxn_kernel(NbnxmGpu* nb, int eeltype, int evdwt
 
 /*! \brief Calculates the amount of shared memory required by the nonbonded kernel in use.
  */
-static inline int calc_shmem_required_nonbonded(int vdwType, bool bPrefetchLjParam)
+static inline int calc_shmem_required_nonbonded(enum VdwType vdwType, bool bPrefetchLjParam)
 {
     int shmem;
 
@@ -438,7 +442,7 @@ static void fillin_ocl_structures(NBParamGpu* nbp, cl_nbparam_params_t* nbparams
     nbparams_params->coulomb_tab_scale = nbp->coulomb_tab_scale;
     nbparams_params->c_rf              = nbp->c_rf;
     nbparams_params->dispersion_shift  = nbp->dispersion_shift;
-    nbparams_params->eeltype           = nbp->eeltype;
+    nbparams_params->elecType          = nbp->elecType;
     nbparams_params->epsfac            = nbp->epsfac;
     nbparams_params->ewaldcoeff_lj     = nbp->ewaldcoeff_lj;
     nbparams_params->ewald_beta        = nbp->ewald_beta;
@@ -451,7 +455,7 @@ static void fillin_ocl_structures(NBParamGpu* nbp, cl_nbparam_params_t* nbparams
     nbparams_params->sh_ewald          = nbp->sh_ewald;
     nbparams_params->sh_lj_ewald       = nbp->sh_lj_ewald;
     nbparams_params->two_k_rf          = nbp->two_k_rf;
-    nbparams_params->vdwtype           = nbp->vdwtype;
+    nbparams_params->vdwType           = nbp->vdwType;
     nbparams_params->vdw_switch        = nbp->vdw_switch;
 }
 
@@ -637,7 +641,7 @@ void gpu_launch_kernel(NbnxmGpu* nb, const gmx::StepWorkload& stepWork, const Nb
     /* kernel launch config */
 
     KernelLaunchConfig config;
-    config.sharedMemorySize = calc_shmem_required_nonbonded(nbp->vdwtype, nb->bPrefetchLjParam);
+    config.sharedMemorySize = calc_shmem_required_nonbonded(nbp->vdwType, nb->bPrefetchLjParam);
     config.blockSize[0]     = c_clSize;
     config.blockSize[1]     = c_clSize;
     config.gridSize[0]      = plist->nsci;
@@ -660,14 +664,14 @@ void gpu_launch_kernel(NbnxmGpu* nb, const gmx::StepWorkload& stepWork, const Nb
     auto*          timingEvent  = bDoTime ? t->interaction[iloc].nb_k.fetchNextEvent() : nullptr;
     constexpr char kernelName[] = "k_calc_nb";
     const auto     kernel =
-            select_nbnxn_kernel(nb, nbp->eeltype, nbp->vdwtype, stepWork.computeEnergy,
+            select_nbnxn_kernel(nb, nbp->elecType, nbp->vdwType, stepWork.computeEnergy,
                                 (plist->haveFreshList && !nb->timers->interaction[iloc].didPrune));
 
 
     // The OpenCL kernel takes int as second to last argument because bool is
     // not supported as a kernel argument type (sizeof(bool) is implementation defined).
     const int computeFshift = static_cast<int>(stepWork.computeVirial);
-    if (useLjCombRule(nb->nbparam->vdwtype))
+    if (useLjCombRule(nb->nbparam->vdwType))
     {
         const auto kernelArgs = prepareGpuKernelArguments(
                 kernel, config, &nbparams_params, &adat->xq, &adat->f, &adat->e_lj, &adat->e_el,
index 29989c8095b5bbf0a0117b39902e223c45739db8..8197c72cf91e13034c52021ab2d632dacfef619a 100644 (file)
@@ -124,77 +124,6 @@ static void init_atomdata_first(cl_atomdata_t* ad, int ntypes, const DeviceConte
     ad->nalloc = -1;
 }
 
-/*! \brief Returns the kinds of electrostatics and Vdw OpenCL
- *  kernels that will be used.
- *
- * Respectively, these values are from enum eelOcl and enum
- * evdwOcl. */
-static void map_interaction_types_to_gpu_kernel_flavors(const interaction_const_t* ic,
-                                                        int                        combRule,
-                                                        int*                       gpu_eeltype,
-                                                        int*                       gpu_vdwtype)
-{
-    if (ic->vdwtype == evdwCUT)
-    {
-        switch (ic->vdw_modifier)
-        {
-            case eintmodNONE:
-            case eintmodPOTSHIFT:
-                switch (combRule)
-                {
-                    case ljcrNONE: *gpu_vdwtype = evdwTypeCUT; break;
-                    case ljcrGEOM: *gpu_vdwtype = evdwTypeCUTCOMBGEOM; break;
-                    case ljcrLB: *gpu_vdwtype = evdwTypeCUTCOMBLB; break;
-                    default:
-                        gmx_incons(
-                                "The requested LJ combination rule is not implemented in the "
-                                "OpenCL GPU accelerated kernels!");
-                }
-                break;
-            case eintmodFORCESWITCH: *gpu_vdwtype = evdwTypeFSWITCH; break;
-            case eintmodPOTSWITCH: *gpu_vdwtype = evdwTypePSWITCH; break;
-            default:
-                gmx_incons(
-                        "The requested VdW interaction modifier is not implemented in the GPU "
-                        "accelerated kernels!");
-        }
-    }
-    else if (ic->vdwtype == evdwPME)
-    {
-        if (ic->ljpme_comb_rule == ljcrGEOM)
-        {
-            *gpu_vdwtype = evdwTypeEWALDGEOM;
-        }
-        else
-        {
-            *gpu_vdwtype = evdwTypeEWALDLB;
-        }
-    }
-    else
-    {
-        gmx_incons("The requested VdW type is not implemented in the GPU accelerated kernels!");
-    }
-
-    if (ic->eeltype == eelCUT)
-    {
-        *gpu_eeltype = eelTypeCUT;
-    }
-    else if (EEL_RF(ic->eeltype))
-    {
-        *gpu_eeltype = eelTypeRF;
-    }
-    else if ((EEL_PME(ic->eeltype) || ic->eeltype == eelEWALD))
-    {
-        *gpu_eeltype = nbnxn_gpu_pick_ewald_kernel_type(*ic);
-    }
-    else
-    {
-        /* Shouldn't happen, as this is checked when choosing Verlet-scheme */
-        gmx_incons(
-                "The requested electrostatics type is not implemented in the GPU accelerated "
-                "kernels!");
-    }
-}
 
 /*! \brief Initializes the nonbonded parameter data structure.
  */
@@ -206,7 +135,8 @@ static void init_nbparam(NBParamGpu*                     nbp,
 {
     set_cutoff_parameters(nbp, ic, listParams);
 
-    map_interaction_types_to_gpu_kernel_flavors(ic, nbatParams.comb_rule, &(nbp->eeltype), &(nbp->vdwtype));
+    nbp->vdwType  = nbnxmGpuPickVdwKernelType(ic, nbatParams.comb_rule);
+    nbp->elecType = nbnxmGpuPickElectrostaticsKernelType(ic);
 
     if (ic->vdwtype == evdwPME)
     {
@@ -221,7 +151,7 @@ static void init_nbparam(NBParamGpu*                     nbp,
     }
     /* generate table for PME */
     nbp->coulomb_tab = nullptr;
-    if (nbp->eeltype == eelTypeEWALD_TAB || nbp->eeltype == eelTypeEWALD_TAB_TWIN)
+    if (nbp->elecType == ElecType::EwaldTab || nbp->elecType == ElecType::EwaldTabTwin)
     {
         GMX_RELEASE_ASSERT(ic->coulombEwaldTables, "Need valid Coulomb Ewald correction tables");
         init_ewald_coulomb_force_table(*ic->coulombEwaldTables, nbp, deviceContext);
@@ -517,7 +447,7 @@ void gpu_init_atomdata(NbnxmGpu* nb, const nbnxn_atomdata_t* nbat)
         allocateDeviceBuffer(&d_atdat->f, nalloc * DIM, deviceContext);
         allocateDeviceBuffer(&d_atdat->xq, nalloc * (DIM + 1), deviceContext);
 
-        if (useLjCombRule(nb->nbparam->vdwtype))
+        if (useLjCombRule(nb->nbparam->vdwType))
         {
             // Two Lennard-Jones parameters per atom
             allocateDeviceBuffer(&d_atdat->lj_comb, nalloc * 2, deviceContext);
@@ -540,7 +470,7 @@ void gpu_init_atomdata(NbnxmGpu* nb, const nbnxn_atomdata_t* nbat)
         nbnxn_ocl_clear_f(nb, nalloc);
     }
 
-    if (useLjCombRule(nb->nbparam->vdwtype))
+    if (useLjCombRule(nb->nbparam->vdwType))
     {
         GMX_ASSERT(sizeof(float) == sizeof(*nbat->params().lj_comb.data()),
                    "Size of the LJ parameters element should be equal to the size of float2.");
index 18c583937b6e50caf78c994d0ea3c59461b0b4b3..4717e1601cd7c96e0287e01246aedc2c2c3ec19c 100644 (file)
@@ -99,18 +99,18 @@ static const char* kernel_VdW_family_definitions[] = {
 
 /*! \brief Returns a string with the compiler defines required to avoid all flavour generation
  *
- * For example if flavour eelTypeRF with evdwTypeFSWITCH, the output will be such that the corresponding
+ * For example if flavour ElecType::RF with VdwType::FSwitch, the output will be such that the corresponding
  * kernel flavour is generated:
  * -DGMX_OCL_FASTGEN          (will replace flavour generator nbnxn_ocl_kernels.clh with nbnxn_ocl_kernels_fastgen.clh)
- * -DEL_RF                    (The eelTypeRF flavour)
+ * -DEL_RF                    (The ElecType::RF flavour)
  * -DEELNAME=_ElecRF          (The first part of the generated kernel name )
- * -DLJ_EWALD_COMB_GEOM       (The evdwTypeFSWITCH flavour)
+ * -DLJ_EWALD_COMB_GEOM       (The VdwType::FSwitch flavour)
  * -DVDWNAME=_VdwLJEwCombGeom (The second part of the generated kernel name )
  *
  * prune/energy are still generated as originally. It is only the flavour-level that has changed, so that
  * only the required flavour for the simulation is compiled.
  *
- * If eeltype is single-range Ewald, then we need to add the
+ * If elecType is single-range Ewald, then we need to add the
  * twin-cutoff flavour kernels to the JIT, because PME tuning might
  * need it. This path sets -DGMX_OCL_FASTGEN_ADD_TWINCUT, which
  * triggers the use of nbnxn_ocl_kernels_fastgen_add_twincut.clh. This
@@ -122,19 +122,22 @@ static const char* kernel_VdW_family_definitions[] = {
  * JIT defaults to compiling all kernel flavours.
  *
  * \param[in]  bFastGen    Whether FastGen should be used
- * \param[in]  eeltype     Electrostatics kernel flavour for FastGen
- * \param[in]  vdwtype     VDW kernel flavour for FastGen
+ * \param[in]  elecType    Electrostatics kernel flavour for FastGen
+ * \param[in]  vdwType     VDW kernel flavour for FastGen
  * \return                 String with the defines if FastGen is active
  *
  * \throws std::bad_alloc if out of memory
  */
-static std::string makeDefinesForKernelTypes(bool bFastGen, int eeltype, int vdwtype)
+static std::string makeDefinesForKernelTypes(bool                 bFastGen,
+                                             enum Nbnxm::ElecType elecType,
+                                             enum Nbnxm::VdwType  vdwType)
 {
+    using Nbnxm::ElecType;
     std::string defines_for_kernel_types;
 
     if (bFastGen)
     {
-        bool bIsEwaldSingleCutoff = (eeltype == eelTypeEWALD_TAB || eeltype == eelTypeEWALD_ANA);
+        bool bIsEwaldSingleCutoff = (elecType == ElecType::EwaldTab || elecType == ElecType::EwaldAna);
 
         if (bIsEwaldSingleCutoff)
         {
@@ -146,8 +149,8 @@ static std::string makeDefinesForKernelTypes(bool bFastGen, int eeltype, int vdw
                nbnxn_ocl_kernels_fastgen.clh. */
             defines_for_kernel_types += "-DGMX_OCL_FASTGEN";
         }
-        defines_for_kernel_types += kernel_electrostatic_family_definitions[eeltype];
-        defines_for_kernel_types += kernel_VdW_family_definitions[vdwtype];
+        defines_for_kernel_types += kernel_electrostatic_family_definitions[static_cast<int>(elecType)];
+        defines_for_kernel_types += kernel_VdW_family_definitions[static_cast<int>(vdwType)];
     }
 
     return defines_for_kernel_types;
@@ -182,7 +185,7 @@ void nbnxn_gpu_compile_kernels(NbnxmGpu* nb)
     try
     {
         std::string extraDefines =
-                makeDefinesForKernelTypes(bFastGen, nb->nbparam->eeltype, nb->nbparam->vdwtype);
+                makeDefinesForKernelTypes(bFastGen, nb->nbparam->elecType, nb->nbparam->vdwType);
 
         /* Here we pass macros and static const/constexpr int variables defined
          * in include files outside the opencl as macros, to avoid
index 46c08c2d715020cb014767e2d35c37e37686cf89..d0482aa7c85368766a8a5930c0e535bd47c5016e 100644 (file)
@@ -156,10 +156,10 @@ typedef struct
 typedef struct cl_nbparam_params
 {
 
-    //! type of electrostatics, takes values from #eelCu
-    int eeltype;
-    //! type of VdW impl., takes values from #evdwCu
-    int vdwtype;
+    //! type of electrostatics, takes values from #ElecType
+    int elecType;
+    //! type of VdW impl., takes values from #VdwType
+    int vdwType;
 
     //! charge multiplication factor
     float epsfac;
index a517c2fd04eb3a0539e582fcd4d4cd28cacffa05..d1adddb205b14d4b899ad299aa18bbdc0492e914 100644 (file)
@@ -153,10 +153,10 @@ typedef struct cl_atomdata
 typedef struct cl_nbparam_params
 {
 
-    //! type of electrostatics, takes values from #eelType
-    int eeltype;
-    //! type of VdW impl., takes values from #evdwType
-    int vdwtype;
+    //! type of electrostatics
+    enum Nbnxm::ElecType elecType;
+    //! type of VdW impl.
+    enum Nbnxm::VdwType vdwType;
 
     //! charge multiplication factor
     float epsfac;
@@ -166,7 +166,7 @@ typedef struct cl_nbparam_params
     float two_k_rf;
     //! Ewald/PME parameter
     float ewald_beta;
-    //! Ewald/PME correction term substracted from the direct-space potential
+    //! Ewald/PME correction term subtracted from the direct-space potential
     float sh_ewald;
     //! LJ-Ewald/PME correction term added to the correction potential
     float sh_lj_ewald;
@@ -219,10 +219,10 @@ struct NbnxmGpu
     /**< Pointers to non-bonded kernel functions
      * organized similar with nb_kfunc_xxx arrays in nbnxn_ocl.cpp */
     ///@{
-    cl_kernel kernel_noener_noprune_ptr[eelTypeNR][evdwTypeNR] = { { nullptr } };
-    cl_kernel kernel_ener_noprune_ptr[eelTypeNR][evdwTypeNR]   = { { nullptr } };
-    cl_kernel kernel_noener_prune_ptr[eelTypeNR][evdwTypeNR]   = { { nullptr } };
-    cl_kernel kernel_ener_prune_ptr[eelTypeNR][evdwTypeNR]     = { { nullptr } };
+    cl_kernel kernel_noener_noprune_ptr[Nbnxm::c_numElecTypes][Nbnxm::c_numVdwTypes] = { { nullptr } };
+    cl_kernel kernel_ener_noprune_ptr[Nbnxm::c_numElecTypes][Nbnxm::c_numVdwTypes] = { { nullptr } };
+    cl_kernel kernel_noener_prune_ptr[Nbnxm::c_numElecTypes][Nbnxm::c_numVdwTypes] = { { nullptr } };
+    cl_kernel kernel_ener_prune_ptr[Nbnxm::c_numElecTypes][Nbnxm::c_numVdwTypes] = { { nullptr } };
     ///@}
     //! prune kernels, ePruneKind defined the kernel kinds
     cl_kernel kernel_pruneonly[ePruneNR] = { nullptr };
index c34de31cc06950baecba9262bd219fdd62bd2a03..9f92f29f4e26409bfd91d1e59e44332d9863f63b 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(onlinehelp INTERFACE)
 file(GLOB ONLINEHELP_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${ONLINEHELP_SOURCES} PARENT_SCOPE)
 
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(onlinehelp PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(onlinehelp PUBLIC
+target_include_directories(onlinehelp INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(onlinehelp PUBLIC
+target_link_libraries(onlinehelp INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when onlinehelp is an OBJECT target
+#target_link_libraries(onlinehelp PUBLIC legacy_api)
+#target_link_libraries(onlinehelp PRIVATE common)
+
+# Module dependencies
+# onlinehelp interfaces convey transitive dependence on these modules.
+#target_link_libraries(onlinehelp PUBLIC
+target_link_libraries(onlinehelp INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(onlinehelp PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(onlinehelp PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index ad53c3b6ddb9fa2528a29c0bc9dd616a86073494..a22b6e83cddb15da2218e92301a1cd177b422c92 100644 (file)
@@ -34,6 +34,7 @@
 
 gmx_add_unit_test_library(onlinehelp-test-shared
                           mock_helptopic.cpp)
+target_link_libraries(onlinehelp-test-shared PUBLIC common)
 
 gmx_add_unit_test(OnlineHelpUnitTests onlinehelp-test
     CPP_SOURCE_FILES
index d67ef3fa03bc27b18aec9f14624ab06734f56b92..29e80ddc8a9ef2d6353a8915510cfa4903958533 100644 (file)
@@ -33,6 +33,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.
 
+# Set up the module library
+add_library(options INTERFACE)
+
 gmx_add_libgromacs_sources(
     abstractoption.cpp
     abstractsection.cpp
@@ -65,6 +68,30 @@ if(GMX_INSTALL_LEGACY_API)
             DESTINATION include/gromacs/options)
 endif()
 
+# Source files have the following private module dependencies.
+target_link_libraries(options PRIVATE
+               )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(options PUBLIC
+target_include_directories(options INTERFACE
+               $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(options PUBLIC
+target_link_libraries(options INTERFACE
+               legacy_api
+               )
+
+# TODO: when options is an OBJECT target
+#target_link_libraries(options PUBLIC legacy_api)
+#target_link_libraries(options PRIVATE common)
+
+# Module dependencies
+# options interfaces convey transitive dependence on these modules.
+#target_link_libraries(options PUBLIC
+target_link_libraries(options INTERFACE
+                      utility
+               )
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index 63a5dacfcb851d02010ba126a500d65bed456dc3..57ddbc882592f2ab2db913ab8c60d8a3860defc2 100644 (file)
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(pbcutil INTERFACE)
 file(GLOB PBCUTIL_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${PBCUTIL_SOURCES} PARENT_SCOPE)
 
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(pbcutil PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(pbcutil PUBLIC
+target_include_directories(pbcutil INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(pbcutil PUBLIC
+target_link_libraries(pbcutil INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when pbcutil is an OBJECT target
+#target_link_libraries(pbcutil PUBLIC legacy_api)
+#target_link_libraries(pbcutil PRIVATE common)
+
+# Module dependencies
+# pbcutil interfaces convey transitive dependence on these modules.
+#target_link_libraries(pbcutil PUBLIC
+target_link_libraries(pbcutil INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(pbcutil PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(pbcutil PRIVATE legacy_modules)
+
 if(GMX_INSTALL_LEGACY_API)
   install(FILES
           pbc.h
index 2cd5293920680734507fc31ebd8500c022acb590..88fa1a8a50038b9d94f41ced6f6adaca3cbcd70e 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2016,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(pulling INTERFACE)
 file(GLOB PULLING_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${PULLING_SOURCES} PARENT_SCOPE)
 
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(pulling PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(pulling PUBLIC
+target_include_directories(pulling INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(pulling PUBLIC
+target_link_libraries(pulling INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when pulling is an OBJECT target
+#target_link_libraries(pulling PUBLIC legacy_api)
+#target_link_libraries(pulling PRIVATE common)
+
+# Module dependencies
+# pulling interfaces convey transitive dependence on these modules.
+#target_link_libraries(pulling PUBLIC
+target_link_libraries(pulling INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(pulling PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(pulling PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
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 fbdf2dabdff2caeec346a280359dd4556c3eb505..9605699e3a5b3451e3fd4bf385b18bf8d940bbfc 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2015,2016,2019, by the GROMACS development team, led by
+# Copyright (c) 2015,2016,2019,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(random INTERFACE)
 file(GLOB RANDOM_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${RANDOM_SOURCES} PARENT_SCOPE)
 
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(random PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(random PUBLIC
+target_include_directories(random INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(random PUBLIC
+target_link_libraries(random INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when random is an OBJECT target
+#target_link_libraries(random PUBLIC legacy_api)
+#target_link_libraries(random PRIVATE common)
+
+# Module dependencies
+# random interfaces convey transitive dependence on these modules.
+#target_link_libraries(random PUBLIC
+target_link_libraries(random INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(random PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(random PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index 06a082e57fdd4005f2d62ec91472474fc2bd5405..d2d52f521dc9e27e39edc77c0e0440e374030024 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.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(restraint INTERFACE)
+file(GLOB RESTRAINT_SOURCES *.cpp)
+set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${RESTRAINT_SOURCES} PARENT_SCOPE)
 
-gmx_add_libgromacs_sources(
-    manager.cpp
-    restraintmdmodule.cpp
-    )
-# TODO this is a hacky way to expose things for the API and needs to be changed to something proper
-install(FILES restraintpotential.h DESTINATION include/gromacs/restraint)
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(restraint PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(restraint PUBLIC
+target_include_directories(restraint INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(restraint PUBLIC
+target_link_libraries(restraint INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when restraint is an OBJECT target
+#target_link_libraries(restraint PUBLIC legacy_api)
+#target_link_libraries(restraint PRIVATE common)
+
+# Module dependencies
+# restraint interfaces convey transitive dependence on these modules.
+#target_link_libraries(restraint PUBLIC
+target_link_libraries(restraint INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(restraint PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(restraint PRIVATE legacy_modules)
 
 if (BUILD_TESTING)
     add_subdirectory(tests)
index e621fa58813b9033bb42c1d709a304e2ffe9c414..90a4648243030c4190e635b1422682cb9e9aeb04 100644 (file)
@@ -33,6 +33,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.
 
+# Set up the module library
+add_library(selection INTERFACE)
+
 file(GLOB SELECTION_SOURCES *.cpp)
 file(GLOB SCANNER_SOURCES scanner.cpp parser.cpp)
 list(REMOVE_ITEM SELECTION_SOURCES ${SCANNER_SOURCES})
@@ -56,9 +59,43 @@ 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)
+# TODO: Use explicit module dependencies.
+target_link_libraries(scanner PRIVATE legacy_modules)
+
 list(APPEND libgromacs_object_library_dependencies scanner)
 set(libgromacs_object_library_dependencies ${libgromacs_object_library_dependencies} PARENT_SCOPE)
 
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(selection PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(selection PUBLIC
+target_include_directories(selection INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(selection PUBLIC
+target_link_libraries(selection INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when selection is an OBJECT target
+#target_link_libraries(selection PUBLIC legacy_api)
+#target_link_libraries(selection PRIVATE common)
+
+# Module dependencies
+# selection interfaces convey transitive dependence on these modules.
+#target_link_libraries(selection PUBLIC
+target_link_libraries(selection INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(selection PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(selection PRIVATE legacy_modules)
+
 if(GMX_INSTALL_LEGACY_API)
     install(FILES
            indexutil.h
index 341d9cc90b4de756859cf98ce781a9cea71730ab..44179a030414c7312ec52cdd34469758109b0f21 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(simd INTERFACE)
 file(GLOB SIMD_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${SIMD_SOURCES} PARENT_SCOPE)
 
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(simd PUBLIC
+target_include_directories(simd INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(simd PUBLIC
+target_link_libraries(simd INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when simd is an OBJECT target
+#target_link_libraries(simd PUBLIC legacy_api)
+#target_link_libraries(simd PRIVATE common)
+
+# Module dependencies
+# simd interfaces convey transitive dependence on these modules.
+#target_link_libraries(simd PUBLIC
+target_link_libraries(simd INTERFACE
+                      utility
+                      )
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index 0d1f9fd850a50b3bcd42f27b5995bdce5e153ca4..47fe1b582fde44ae9068248f2df11c5e78bc6460 100644 (file)
@@ -94,28 +94,6 @@ const std::string& simdString(SimdType s)
     return name.at(s);
 }
 
-namespace
-{
-
-
-//! Helper to detect correct AMD Zen architecture.
-bool cpuIsAmdZen1(const CpuInfo& cpuInfo)
-{
-    // Both Zen/Zen+/Zen2 have family==23
-    // Model numbers for Zen:
-    // 1)  Naples, Whitehaven, Summit ridge, and Snowy Owl
-    // 17) Raven ridge
-    // Model numbers for Zen+:
-    // 8)  Pinnacle Ridge
-    // 24) Picasso
-    return (cpuInfo.vendor() == gmx::CpuInfo::Vendor::Amd && cpuInfo.family() == 23
-            && (cpuInfo.model() == 1 || cpuInfo.model() == 17 || cpuInfo.model() == 8
-                || cpuInfo.model() == 24));
-}
-
-} // namespace
-
-
 SimdType simdSuggested(const CpuInfo& c)
 {
     SimdType suggested = SimdType::None;
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 1fce039188965e71e37c5495edc303c45718e378..963749925f62e37b001c0bc409c8360a41eed2d5 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(statistics INTERFACE)
 file(GLOB STATISTICS_SOURCES *.cpp)
-
 set(LIBGROMACS_SOURCES
     ${LIBGROMACS_SOURCES} ${STATISTICS_SOURCES} PARENT_SCOPE)
 
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(statistics PUBLIC
+target_include_directories(statistics INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(statistics PUBLIC
+target_link_libraries(statistics INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when statistics is an OBJECT target
+#target_link_libraries(statistics PUBLIC legacy_api)
+#target_link_libraries(statistics PRIVATE common)
+
+# Module dependencies
+# statistics interfaces convey transitive dependence on these modules.
+#target_link_libraries(statistics PUBLIC
+target_link_libraries(statistics INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(statistics PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(statistics PRIVATE legacy_modules)
index 8ebac9a96cd7136be475c54eb55ca9b6aa1a206a..eb7dea6d04523dd885ca0f85c49486cd6deb42bb 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(swap INTERFACE)
 file(GLOB SWAP_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${SWAP_SOURCES} PARENT_SCOPE)
 
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(swap PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(swap PUBLIC
+target_include_directories(swap INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(swap PUBLIC
+target_link_libraries(swap INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when swap is an OBJECT target
+#target_link_libraries(swap PUBLIC legacy_api)
+#target_link_libraries(swap PRIVATE common)
+
+# Module dependencies
+# swap interfaces convey transitive dependence on these modules.
+#target_link_libraries(swap PUBLIC
+target_link_libraries(swap INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(swap PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(swap PRIVATE legacy_modules)
index 935f31a0fc268117063fce3563c00b889753a826..1bb2374cc987251555fb096d6e4ef4530f4cefac 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2015,2016,200, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(tables INTERFACE)
 file(GLOB TABLE_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TABLE_SOURCES} PARENT_SCOPE)
 
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(tables PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(tables PUBLIC
+target_include_directories(tables INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(tables PUBLIC
+target_link_libraries(tables INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when tables is an OBJECT target
+#target_link_libraries(tables PUBLIC legacy_api)
+#target_link_libraries(tables PRIVATE common)
+
+# Module dependencies
+# tables interfaces convey transitive dependence on these modules.
+#target_link_libraries(tables PUBLIC
+target_link_libraries(tables INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(tables PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(tables PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index 22a1c70eec9ad851df1f6fe19f4d761d3e3a645c..f3db1e1e3c5c1c192082434e9e9900d59796f065 100644 (file)
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(taskassignment INTERFACE)
+file(GLOB TASKASSIGNMENT_SOURCES *.cpp)
+set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TASKASSIGNMENT_SOURCES} PARENT_SCOPE)
+
 # Note that this is a higher-level module that should not need
 # special compilation to suit e.g. GPU or MPI dependencies.
 # If you find you want to do that, consider a preliminary
 # refactoring.
-gmx_add_libgromacs_sources(
-    decidegpuusage.cpp
-    decidesimulationworkload.cpp
-    findallgputasks.cpp
-    reportgpuusage.cpp
-    resourcedivision.cpp
-    taskassignment.cpp
-    usergpuids.cpp
-    )
+
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(taskassignment PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(taskassignment PUBLIC
+target_include_directories(taskassignment INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(taskassignment PUBLIC
+target_link_libraries(taskassignment INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when taskassignment is an OBJECT target
+#target_link_libraries(taskassignment PUBLIC legacy_api)
+#target_link_libraries(taskassignment PRIVATE common)
+
+# Module dependencies
+# taskassignment interfaces convey transitive dependence on these modules.
+#target_link_libraries(taskassignment PUBLIC
+target_link_libraries(taskassignment INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(taskassignment PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(taskassignment PRIVATE legacy_modules)
 
 if (BUILD_TESTING)
     add_subdirectory(tests)
index cf359bd487d5c933a92a5fbc1b47b64b80aedc72..84617fcdebb381778017f57667d9292fccc70049 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2013,2014,2015,2019, by the GROMACS development team, led by
+# Copyright (c) 2013,2014,2015,2019,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(timing INTERFACE)
 file(GLOB TIMING_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TIMING_SOURCES} PARENT_SCOPE)
 
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(timing PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(timing PUBLIC
+target_include_directories(timing INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(timing PUBLIC
+target_link_libraries(timing INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when timing is an OBJECT target
+#target_link_libraries(timing PUBLIC legacy_api)
+#target_link_libraries(timing PRIVATE common)
+
+# Module dependencies
+# timing interfaces convey transitive dependence on these modules.
+#target_link_libraries(timing PUBLIC
+target_link_libraries(timing INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(timing PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(timing PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
 #    add_subdirectory(tests)
 endif()
index 442b77b234837fa9b31f0f6d6cac5abb958577e6..747d39cbb13b01a399521bf91239cab1a54f67dc 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014,2015,2018, by the GROMACS development team, led by
+# Copyright (c) 2014,2015,2018,2020, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(tools INTERFACE)
 file(GLOB TOOLS_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TOOLS_SOURCES} PARENT_SCOPE)
 
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(tools PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(tools PUBLIC
+target_include_directories(tools INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(tools PUBLIC
+target_link_libraries(tools INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when tools is an OBJECT target
+#target_link_libraries(tools PUBLIC legacy_api)
+#target_link_libraries(tools PRIVATE common)
+
+# Module dependencies
+# tools interfaces convey transitive dependence on these modules.
+#target_link_libraries(tools PUBLIC
+target_link_libraries(tools INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(tools PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(tools PRIVATE legacy_modules)
+
+
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
index 547af12c8dfef7b86ded7e64a3a621d03ec1c6ee..e6e2232e7cd16ad879a18a312bcb18e1370e1fbe 100644 (file)
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(topology INTERFACE)
+
 file(GLOB TOPOLOGY_SOURCES *.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TOPOLOGY_SOURCES} PARENT_SCOPE)
 
-if (BUILD_TESTING)
-    add_subdirectory(tests)
-endif()
-
 if(GMX_INSTALL_LEGACY_API)
   install(FILES
          atomprop.h
-          atoms.h
-          block.h
-          forcefieldparameters.h
-          idef.h
-          ifunc.h
+         atoms.h
+         block.h
+         forcefieldparameters.h
+         idef.h
+         ifunc.h
          index.h
-          symtab.h
-          topology.h
-          DESTINATION include/gromacs/topology)
+         symtab.h
+         topology.h
+         DESTINATION include/gromacs/topology)
 endif()
+
+# Source files have the following private module dependencies.
+target_link_libraries(options PRIVATE
+               )
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(topology PUBLIC
+target_include_directories(topology INTERFACE
+        $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(topology PUBLIC
+target_link_libraries(topology INTERFACE
+        legacy_api
+        )
+
+# TODO: when topology is an OBJECT target
+#target_link_libraries(topology PUBLIC legacy_api)
+#target_link_libraries(topology PRIVATE common)
+
+# Module dependencies
+# topology interfaces convey transitive dependence on these modules.
+#target_link_libraries(topology PUBLIC
+target_link_libraries(topology INTERFACE
+                      utility
+        )
+
+if (BUILD_TESTING)
+       add_subdirectory(tests)
+endif()
\ No newline at end of file
index af69089313949cde1dfeca2fc0d1fdbde8596075..2a3c613419f6a82ce2619394ef23e1f18d0ac131 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.
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
-gmx_add_libgromacs_sources(
-    energyframe.cpp
-    trajectoryframe.cpp
-    )
+# Set up the module library
+add_library(trajectory INTERFACE)
+file(GLOB TRAJECTORY_SOURCES *.cpp)
+set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TRAJECTORY_SOURCES} PARENT_SCOPE)
+
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(trajectory PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(trajectory PUBLIC
+target_include_directories(trajectory INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(trajectory PUBLIC
+target_link_libraries(trajectory INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when trajectory is an OBJECT target
+#target_link_libraries(trajectory PUBLIC legacy_api)
+#target_link_libraries(trajectory PRIVATE common)
+
+# Module dependencies
+# trajectory interfaces convey transitive dependence on these modules.
+#target_link_libraries(trajectory PUBLIC
+target_link_libraries(trajectory INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(trajectory PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(trajectory PRIVATE legacy_modules)
 
 if(GMX_INSTALL_LEGACY_API)
   install(FILES trajectoryframe.h
index 9065899640aa867f90ee23c6fbf5f83008f016a2..09ac59bfe47f8eb941880345b5f6f9a79c4979f0 100644 (file)
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+# Set up the module library
+add_library(trajectoryanalysis INTERFACE)
 file(GLOB TRAJECTORYANALYSIS_SOURCES *.cpp modules/*.cpp)
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${TRAJECTORYANALYSIS_SOURCES} PARENT_SCOPE)
 
+# Source files have the following dependencies on library infrastructure.
+#target_link_libraries(trajectoryanalysis PRIVATE
+#                      common
+#                      legacy_modules
+#)
+
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(trajectoryanalysis PUBLIC
+target_include_directories(trajectoryanalysis INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(trajectoryanalysis PUBLIC
+target_link_libraries(trajectoryanalysis INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when trajectoryanalysis is an OBJECT target
+#target_link_libraries(trajectoryanalysis PUBLIC legacy_api)
+#target_link_libraries(trajectoryanalysis PRIVATE common)
+
+# Module dependencies
+# trajectoryanalysis interfaces convey transitive dependence on these modules.
+#target_link_libraries(trajectoryanalysis PUBLIC
+target_link_libraries(trajectoryanalysis INTERFACE
+                      utility
+                      )
+# Source files have the following private module dependencies.
+#target_link_libraries(trajectoryanalysis PRIVATE NOTHING)
+# TODO: Explicitly link specific modules.
+#target_link_libraries(trajectoryanalysis PRIVATE legacy_modules)
+
 if(GMX_INSTALL_LEGACY_API)
     install(FILES
            analysismodule.h
index cca089f3142ff98ed90e13d79063cfa6eb832d7c..ec69fddd66cf2d7fcede23fed5cbb70329d17082 100644 (file)
@@ -56,6 +56,12 @@ gmx_add_gtest_executable(trajectoryanalysis-test
         )
 gmx_register_gtest_test(TrajectoryAnalysisUnitTests trajectoryanalysis-test SLOW_TEST)
 target_link_libraries(trajectoryanalysis-test PRIVATE analysisdata-test-shared)
+target_link_libraries(trajectoryanalysis-test PRIVATE common)
 
 add_executable(test_selection ${UNITTEST_TARGET_OPTIONS} test_selection.cpp)
-target_link_libraries(test_selection PRIVATE libgromacs ${GMX_EXE_LINKER_FLAGS})
+target_link_libraries(test_selection PRIVATE
+                      common
+                      libgromacs
+                      ${GMX_EXE_LINKER_FLAGS})
+# TODO: Explicitly link to module dependencies.
+target_link_libraries(test_selection PRIVATE legacy_modules)
index 93e82808cde05fa4fe50da929ba1f9a2f8eb29b3..342b7eecebafa3cde366a7cbf861af135f19d61f 100644 (file)
 # To help us fund GROMACS development, we humbly ask that you cite
 # the research papers on the package. Check out http://www.gromacs.org.
 
+add_library(utility INTERFACE)
+
 file(GLOB UTILITY_SOURCES *.cpp)
 if (GMX_GPU_CUDA)
     gmx_add_libgromacs_sources(cuda_version_information.cu)
 endif()
 set(LIBGROMACS_SOURCES ${LIBGROMACS_SOURCES} ${UTILITY_SOURCES} PARENT_SCOPE)
 
-# TODO: (https://gitlab.com/gromacs/gromacs/-/issues/988) Find a new convention for defining public API.
-install(FILES
-        basedefinitions.h
-        current_function.h
-        gmxassert.h
-        real.h
-        DESTINATION include/gromacs/utility)
-
 if(GMX_INSTALL_LEGACY_API)
   install(FILES
-          arrayref.h
           baseversion.h
           classhelpers.h
           enumerationhelpers.h
-          exceptions.h
-          listoflists.h
          fileptr.h
          futil.h
          flags.h
@@ -67,6 +58,23 @@ if(GMX_INSTALL_LEGACY_API)
           DESTINATION include/gromacs/utility)
 endif()
 
+# Public interface for modules, including dependencies and interfaces
+#target_include_directories(utility PUBLIC
+target_include_directories(utility INTERFACE
+                           $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>)
+#target_link_libraries(utility PUBLIC
+target_link_libraries(utility INTERFACE
+                      legacy_api
+                      )
+
+# TODO: when utility is an OBJECT target
+#target_link_libraries(utility PUBLIC legacy_api)
+#target_link_libraries(utility PRIVATE common)
+
+# Source files have the following private module dependencies.
+# TODO: Explicitly link specific modules.
+#target_link_libraries(utility PRIVATE legacy_modules)
+
 if (BUILD_TESTING)
     add_subdirectory(tests)
 endif()
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 8bbbc308f2b4e8959d50dffc9d3335befc1274d1..6c9f47a028da308137b694f12b9ce11265cb5535 100644 (file)
@@ -59,6 +59,8 @@ gmx_add_unit_test(UtilityUnitTests utility-test
         textwriter.cpp
         typetraits.cpp
         )
+# TODO: Explicitly link specific modules.
+target_link_libraries(utility-test PRIVATE legacy_modules)
 
 gmx_add_mpi_unit_test(UtilityMpiUnitTests utility-mpi-test 4
     CPP_SOURCE_FILES
similarity index 98%
rename from src/gmxpre.h
rename to src/include/gmxpre.h
index 10353266f1ab3413e1dc930ef242265c41bb334e..514932f3a024076109fad7db97912d0ee80e9d09 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
index b07d01d09ceb6d4024a5b429dd9d9891faa67efe..aa8a144a22c497aec57b2d4bb5b624242f80b6f3 100644 (file)
@@ -41,13 +41,17 @@ 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 common)
+target_link_libraries(mdrun_objlib PRIVATE legacy_api)
+# TODO: Explicitly link specific modules.
+target_link_libraries(mdrun_objlib PRIVATE legacy_modules)
 
 if(GMX_FAHCORE)
     # The lack of a real source file here alongside the object library
     # may break some generators, according to CMake documentation. If
     # so, we can consider adding some dummy file to make it work.
     add_library(fahcore $<TARGET_OBJECTS:mdrun_objlib>)
-    target_link_libraries(fahcore PRIVATE ${GMX_COMMON_LIBRARIES})
+    target_link_libraries(fahcore PRIVATE ${GMX_COMMON_LIBRARIES} legacy_api)
 elseif(GMX_BUILD_MDRUN_ONLY)
     add_executable(mdrun $<TARGET_OBJECTS:mdrun_objlib> mdrun_main.cpp)
     gmx_target_compile_options(mdrun)
@@ -75,7 +79,13 @@ 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 common legacy_api)
+    # TODO: Explicitly link specific modules.
+    target_link_libraries(view_objlib PRIVATE legacy_modules)
     add_library(gmx_objlib OBJECT ${GMX_MAIN_SOURCES})
+    target_link_libraries(gmx_objlib PRIVATE common legacy_api)
+    # TODO: Explicitly link specific modules.
+    target_link_libraries(gmx_objlib PRIVATE legacy_modules)
     target_include_directories(gmx_objlib SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/src/external)
     target_include_directories(gmx_objlib SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
     add_executable(gmx
@@ -85,9 +95,11 @@ 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
+                          common
+                          libgromacs
+                          ${GMX_COMMON_LIBRARIES}
+                          ${GMX_EXE_LINKER_FLAGS})
     if(GMX_X11)
         target_link_libraries(gmx ${X11_LIBRARIES})
     endif()
index b051068c0670184835bd4dda10d283a2b7e00d10..4a7774237f16fb8d09fbae753fc90c7beb4b1dd9 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
@@ -230,4 +231,6 @@ gmx_add_gtest_executable(${exename}
         $<TARGET_OBJECTS:mdrun_objlib>
 )
 target_link_libraries(${exename} PRIVATE mdrun_test_infrastructure)
+# TODO: Link specific modules: topology
+target_link_libraries(${exename} PRIVATE legacy_modules)
 gmx_register_gtest_test(${testname} ${exename} OPENMP_THREADS 2 INTEGRATION_TEST IGNORE_LEAKS)
index e932e692b077e4bb5f06138433150b8648aaae1f..fa52d3c8403a55ba1dca08fb1b2dfc812b833f7d 100644 (file)
@@ -38,42 +38,12 @@ if (NOT GMX_BUILD_UNITTESTS)
     return()
 endif()
 
-set(TESTUTILS_SOURCES
-    cmdlinetest.cpp
-    conftest.cpp
-    filematchers.cpp
-    interactivetest.cpp
-    loggertest.cpp
-    mpi_printer.cpp
-    mpitest.cpp
-    refdata.cpp
-    refdata_xml.cpp
-    simulationdatabase.cpp
-    stdiohelper.cpp
-    stringtest.cpp
-    testasserts.cpp
-    testfilemanager.cpp
-    testfileredirector.cpp
-    test_device.cpp
-    test_hardware_environment.cpp
-    testinit.cpp
-    testmatchers.cpp
-    testoptions.cpp
-    textblockmatchers.cpp
-    tprfilegenerator.cpp
-    xvgtest.cpp
-    )
-
-if(NOT HAVE_TINYXML2)
-    list(APPEND TESTUTILS_SOURCES ../external/tinyxml2/tinyxml2.cpp)
-endif()
-
 if (GMX_GPU_CUDA)
     # Work around FindCUDA that prevents using target_link_libraries()
     # with keywords otherwise...
     set(CUDA_LIBRARIES PRIVATE ${CUDA_LIBRARIES})
     if (NOT GMX_CLANG_CUDA)
-        gmx_cuda_add_library(testutils ${TESTUTILS_SOURCES})
+        gmx_cuda_add_library(testutils)
     else()
         set_source_files_properties(test_device.cpp PROPERTIES CUDA_SOURCE_PROPERTY_FORMAT OBJ)
         gmx_compile_cuda_file_with_clang(test_device.cpp)
@@ -82,9 +52,54 @@ if (GMX_GPU_CUDA)
     endif()
     target_link_libraries(testutils PRIVATE ${CUDA_CUFFT_LIBRARIES})
 else()
-    add_library(testutils STATIC ${UNITTEST_TARGET_OPTIONS} ${TESTUTILS_SOURCES})
+    add_library(testutils STATIC ${UNITTEST_TARGET_OPTIONS})
+endif()
+
+# Module interface / provided facilities
+target_include_directories(testutils PUBLIC include)
+
+# Executable targets for tests based on `testutils` acquire the source for
+# their entry point from unittest_main.cpp when linking to the `testutils` target.
+target_sources(testutils INTERFACE unittest_main.cpp)
+
+
+target_sources(testutils PRIVATE
+               cmdlinetest.cpp
+               conftest.cpp
+               filematchers.cpp
+               interactivetest.cpp
+               loggertest.cpp
+               mpi_printer.cpp
+               mpitest.cpp
+               refdata.cpp
+               refdata_xml.cpp
+               simulationdatabase.cpp
+               stdiohelper.cpp
+               stringtest.cpp
+               testasserts.cpp
+               testfilemanager.cpp
+               testfileredirector.cpp
+               test_device.cpp
+               test_hardware_environment.cpp
+               testinit.cpp
+               testmatchers.cpp
+               testoptions.cpp
+               textblockmatchers.cpp
+               tprfilegenerator.cpp
+               xvgtest.cpp
+               )
+
+
+if(HAVE_TINYXML2)
+    target_include_directories(testutils SYSTEM PRIVATE ${TinyXML2_INCLUDE_DIR})
+    target_link_libraries(testutils PRIVATE ${TinyXML2_LIBRARIES})
+else()
+    target_include_directories(testutils SYSTEM BEFORE PRIVATE ${CMAKE_SOURCE_DIR}/src/external/tinyxml2)
+    target_sources(testutils PRIVATE ${CMAKE_SOURCE_DIR}/src/external/tinyxml2/tinyxml2.cpp)
 endif()
 
+target_include_directories(testutils PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
+
 if (GMX_GPU_SYCL)
     set_source_files_properties(test_device.cpp
       PROPERTIES COMPILE_FLAGS "${SYCL_CXX_FLAGS}")
@@ -94,13 +109,12 @@ gmx_target_compile_options(testutils)
 target_compile_definitions(testutils PRIVATE HAVE_CONFIG_H)
 target_include_directories(testutils SYSTEM BEFORE PRIVATE ${PROJECT_SOURCE_DIR}/src/external/thread_mpi/include)
 target_link_libraries(testutils PRIVATE libgromacs ${GMX_COMMON_LIBRARIES} gmock)
+target_link_libraries(testutils PUBLIC common)
 
-if(HAVE_TINYXML2)
-    include_directories(SYSTEM ${TinyXML2_INCLUDE_DIR})
-    target_link_libraries(testutils PRIVATE ${TinyXML2_LIBRARIES})
-else()
-    include_directories(BEFORE SYSTEM "../external/tinyxml2")
-endif()
+# GROMACS module dependencies.
+# Note that testutils conveys transitive dependencies on some modules.
+# TODO: Explicitly link specific modules with minimal exposure.
+target_link_libraries(testutils PUBLIC legacy_modules)
 
 # TODO Use gmx_add_missing_tests_notice() instead of the messages below.
 set(GMX_CAN_RUN_MPI_TESTS 1)
@@ -128,8 +142,6 @@ elseif (NOT GMX_THREAD_MPI)
     set(GMX_CAN_RUN_MPI_TESTS 0)
 endif()
 
-set(TESTUTILS_DIR ${CMAKE_CURRENT_SOURCE_DIR})
-set(TESTUTILS_DIR ${TESTUTILS_DIR} PARENT_SCOPE)
 set(GMX_CAN_RUN_MPI_TESTS ${GMX_CAN_RUN_MPI_TESTS} PARENT_SCOPE)
 
 add_subdirectory(tests)
index 70dd60e0364012ebc6ee69948859c61fdf783273..5f29e65402c3fa165fbd912982ad04b8282f775b 100644 (file)
@@ -119,12 +119,10 @@ function (gmx_add_gtest_executable EXENAME)
             cuda_add_executable(${EXENAME} ${UNITTEST_TARGET_OPTIONS}
                 ${ARG_CPP_SOURCE_FILES}
                 ${ARG_CUDA_CU_SOURCE_FILES}
-                ${ARG_GPU_CPP_SOURCE_FILES}
-                ${TESTUTILS_DIR}/unittest_main.cpp)
+                ${ARG_GPU_CPP_SOURCE_FILES})
         else()
             add_executable(${EXENAME} ${UNITTEST_TARGET_OPTIONS}
-                ${ARG_CPP_SOURCE_FILES}
-                ${TESTUTILS_DIR}/unittest_main.cpp)
+                ${ARG_CPP_SOURCE_FILES})
         endif()
 
         if (GMX_GPU_CUDA)
@@ -169,7 +167,7 @@ function (gmx_add_gtest_executable EXENAME)
         endif()
 
         target_link_libraries(${EXENAME} PRIVATE
-            testutils libgromacs gmock
+            testutils common libgromacs gmock
             ${GMX_COMMON_LIBRARIES} ${GMX_EXE_LINKER_FLAGS})
 
         if(GMX_CLANG_TIDY)
index 1c6bdc0f9f8b1b20f53199be6e238e7cc35305f8..9746d3ba511b95aeba2165f2e4df0796cd66e8b8 100644 (file)
@@ -42,7 +42,7 @@
  */
 #include "gmxpre.h"
 
-#include "cmdlinetest.h"
+#include "testutils/cmdlinetest.h"
 
 #include <cstdlib>
 #include <cstring>
index e7be0564a97ceff73cb746090844407eaa296f8a..3fd50276cbfc93c058bef27e6c502842c4c94ca5 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.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "conftest.h"
+#include "testutils/conftest.h"
 
 #include <cstdio>
 #include <cstdlib>
index d836f4e6fcb3fc04a4b68e0e2ffcab2aaec3c890..a312dddd0ff6fd2eb701680a8523d431a9462f16 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.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "filematchers.h"
+#include "testutils/filematchers.h"
 
 #include "gromacs/utility/filestream.h"
 
similarity index 97%
rename from src/testutils/conftest.h
rename to src/testutils/include/testutils/conftest.h
index c8c7c14dc3be41a80878c79cffc1a114bbb8191c..d22033c53790bfc697fb2293077da3e9863bb1ea 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.
similarity index 98%
rename from src/testutils/filematchers.h
rename to src/testutils/include/testutils/filematchers.h
index 84201794a5b460982f407f8c60fdbe1077dbc502..921d44709fe0399faa21030da065e6e647a6e76d 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.
similarity index 98%
rename from src/testutils/interactivetest.h
rename to src/testutils/include/testutils/interactivetest.h
index 6e0e279deb1ab12dd74746735c56d3699f3cea0b..eeed955928995881ca73ae714b25b0102679f44e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2017,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
similarity index 97%
rename from src/testutils/loggertest.h
rename to src/testutils/include/testutils/loggertest.h
index 5fe63949ce5fc3bfabbf6b342ca84d1333d7af6d..29c5ee5335726c7ff2ab0f09a1bc0ee63cb79d6d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
similarity index 98%
rename from src/testutils/mpitest.h
rename to src/testutils/include/testutils/mpitest.h
index dbb640a9336ea975cc080a8072ea57af5d410679..e769fbfa907679ad38f3d1ddbf24e48a97136020 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
similarity index 97%
rename from src/testutils/setenv.h
rename to src/testutils/include/testutils/setenv.h
index 588d93f921793cad7b9419ce8e1294c3b98bc170..fc577ee3d45ad81ea6625945dc51ab38d8edb9ea 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
similarity index 98%
rename from src/testutils/simulationdatabase.h
rename to src/testutils/include/testutils/simulationdatabase.h
index 11b1e428d9701a96b8f3cb3da35f4753aca0c9dc..04f89b0a468137d187bbadeedabd03b33da126a0 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/testutils/stdiohelper.h
rename to src/testutils/include/testutils/stdiohelper.h
index 6cb8b68947ebe466906c5be3e95d490809013209..c46df9bf5fd53bab15b4d188f256995fcdf664cb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013,2014,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2017,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
similarity index 97%
rename from src/testutils/stringtest.h
rename to src/testutils/include/testutils/stringtest.h
index edf09974a114e239f027c10f8eeb26256844cce3..597078d536cf291b61d0c1596d826acddbfc22dc 100644 (file)
@@ -120,7 +120,7 @@ public:
      * \param[in] refFilename   File with the expected contents.
      * \param[in] testFilename  File with the contents to be tested.
      */
-    void testFilesEqual(const std::string& refFilename, const std::string& testFilename);
+    static void testFilesEqual(const std::string& refFilename, const std::string& testFilename);
 
 private:
     class Impl;
similarity index 97%
rename from src/testutils/testexceptions.h
rename to src/testutils/include/testutils/testexceptions.h
index edbdd6b6fa4cda9c4e87ba6558e9d6c391d807b1..86ea316a942165ab724d3a2df3c9c98b1e92cdc3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2011,2012,2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2015,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
similarity index 98%
rename from src/testutils/testfileredirector.h
rename to src/testutils/include/testutils/testfileredirector.h
index 5e34af133bcf9d67c134d17bfc55fe152ebb551c..19dfa499f4ce5d94b7f6b6d07b10a7847b0d756b 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
similarity index 98%
rename from src/testutils/textblockmatchers.h
rename to src/testutils/include/testutils/textblockmatchers.h
index 6eb6be88e9f4b4b4ed641e233caf63ec5ce775b7..67cb5b95bbe5057c8818ebca3206a09b81ce45c7 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
similarity index 97%
rename from src/testutils/tprfilegenerator.h
rename to src/testutils/include/testutils/tprfilegenerator.h
index 2073eccfd6945a61bd89be84bd8aa740f9f9ad84..ece2bfe3fac071bd7e250f3f95bf427ac180fa7d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
similarity index 98%
rename from src/testutils/xvgtest.h
rename to src/testutils/include/testutils/xvgtest.h
index 1812cc328d61bb2a571e94b7a32d30f6efc6d56b..5783fff1ed56e1db527f23180b8085388fafc7f1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
index 897a01660ec9c16a99e8d0e7dde20b32ab1559c5..e28dbd751df4fefd94e9fecadfdd6475f02db40d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "interactivetest.h"
+#include "testutils/interactivetest.h"
 
 #include <string>
 #include <utility>
index c090c3b2f75dded5864d2e2beec0bf7e8e25c4e1..c534f3c0a93a2cda1790f178dc13f9d6df1eccb3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "loggertest.h"
+#include "testutils/loggertest.h"
 
 #include <gmock/gmock.h>
 
index 63b04b9ce69fcd4dbbfb78dd8bb609d9f3a6d3c4..7c11477f541dcaf2ef0fff9572371db5be562e0d 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "mpitest.h"
+#include "testutils/mpitest.h"
 
 #include "config.h"
 
index 8c92d6754f5e4256d2bdd0ab53dee71690222523..6f44673a64e1e7c77eed24e133557b4ba39db988 100644 (file)
@@ -42,7 +42,7 @@
  */
 #include "gmxpre.h"
 
-#include "refdata.h"
+#include "testutils/refdata.h"
 
 #include <cctype>
 #include <cstdlib>
 #include "gromacs/utility/real.h"
 #include "gromacs/utility/stringutil.h"
 
-#include "testutils/refdata_checkers.h"
-#include "testutils/refdata_impl.h"
-#include "testutils/refdata_xml.h"
 #include "testutils/testasserts.h"
 #include "testutils/testexceptions.h"
 #include "testutils/testfilemanager.h"
 
+#include "refdata_checkers.h"
+#include "refdata_impl.h"
+#include "refdata_xml.h"
+
 namespace gmx
 {
 namespace test
index f8c69f791a6cfd1a522fbb31d58db16b4fabda63..9b5c7c2faa7dfe6b1eab4bae2981a53f44a34607 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
 #include "gromacs/utility/strconvert.h"
 #include "gromacs/utility/stringutil.h"
 
-#include "testutils/refdata_impl.h"
 #include "testutils/testasserts.h"
 #include "testutils/testexceptions.h"
 
+#include "refdata_impl.h"
+
 namespace gmx
 {
 namespace test
index 4d2a71775ddbd7bea4f2d174f7e285dab4fae515..aa8dac17b89669599fdfd4373891d0488873fc67 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
 
 #include "gromacs/utility/exceptions.h"
 
-#include "testutils/refdata_impl.h"
 #include "testutils/testexceptions.h"
 
+#include "refdata_impl.h"
+
 namespace gmx
 {
 namespace test
index d2a9707ccf9c9b84c361a996259b7e32c821698b..546d87903fe39f5bf6619dbd72af6ff08cae767f 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -44,7 +44,7 @@
 
 #include <string>
 
-#include "testutils/refdata_impl.h"
+#include "refdata_impl.h"
 
 namespace gmx
 {
index b8edf036824a120219559e9e2d0e56fb2cd85f1b..52d866f2582ca173079a2809069cea16ed5d6018 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "simulationdatabase.h"
+#include "testutils/simulationdatabase.h"
 
 #include <algorithm>
 #include <map>
index 4afb9ba460474ca45a246152c50a7e6713697177..8bceb0c9238b0741a5a030e66ed8b1075354f7bb 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2013,2014,2015,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2017,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "stdiohelper.h"
+#include "testutils/stdiohelper.h"
 
 #include <cerrno>
 #include <cstdio>
index 452c300435d9ae72e4d1a0c3e385a282dccf1e1d..4e5e8b0ae2927fb709b110fa4fa735d4f2720975 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "stringtest.h"
+#include "testutils/stringtest.h"
 
 #include <string>
 
index 8d3865eee0a8920e4588a631230cfa175cf5a544..6865e949845440dfb00e00f478dea368f5290e13 100644 (file)
@@ -43,7 +43,7 @@
  */
 #include "gmxpre.h"
 
-#include "test_device.h"
+#include "testutils/test_device.h"
 
 #include <memory>
 
index 5a06c351318f4ad0d88848e12b741ee4087db4d1..c42f02d9e91ca741d13b005bb2c89d0fcfb4047d 100644 (file)
@@ -44,7 +44,7 @@
 
 #include "gmxpre.h"
 
-#include "test_hardware_environment.h"
+#include "testutils/test_hardware_environment.h"
 
 #include <memory>
 
index acf173cd957aa2a762d83e1fdbf3bb21cd062b1b..83fbf5568cba4478bb5ca501aab9e6ec8b8b39fd 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2014,2015,2016,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2014,2015,2016,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "testasserts.h"
+#include "testutils/testasserts.h"
 
 #include <cmath>
 #include <cstdio>
index cb0a1ceeb5b1203298b6762c562ff8c7f3187397..99748ff77fbc39c64e18e54ffb71a357e6b16c02 100644 (file)
@@ -42,7 +42,7 @@
  */
 #include "gmxpre.h"
 
-#include "testfilemanager.h"
+#include "testutils/testfilemanager.h"
 
 #include <cstdio>
 
@@ -214,11 +214,8 @@ std::string TestFileManager::getInputFilePath(const char* filename)
         // Assume file is in global directory for simulation input files.
         return Path::join(getTestSimulationDatabaseDirectory(), filename);
     }
-    else
-    {
-        // Assume file is present locally without full name (e.g. extension).
-        return Path::join(getInputDataDirectory(), filename);
-    }
+    // Assume file is present locally without full name (e.g. extension).
+    return Path::join(getInputDataDirectory(), filename);
 }
 
 std::string TestFileManager::getInputFilePath(const std::string& filename)
index da0e74ae216395ea4e4cbc3b029f36d14553127f..d233ae017851335f68a9dd8ec3e80fc8e9d8a7c1 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "testfileredirector.h"
+#include "testutils/testfileredirector.h"
 
 #include <memory>
 #include <set>
index 753b814a0f3669d90f5a31ef8b80b335b47d1ccc..330e2563b6bc7e925f8ebbcd1afbf32a7494dc29 100644 (file)
@@ -42,7 +42,7 @@
  */
 #include "gmxpre.h"
 
-#include "testinit.h"
+#include "testutils/testinit.h"
 
 #include <cstdio>
 #include <cstdlib>
 #include "gromacs/utility/programcontext.h"
 #include "gromacs/utility/textwriter.h"
 
-#include "testutils/mpi_printer.h"
 #include "testutils/refdata.h"
 #include "testutils/test_hardware_environment.h"
 #include "testutils/testfilemanager.h"
 #include "testutils/testoptions.h"
 
+#include "mpi_printer.h"
+
 namespace gmx
 {
 namespace test
index 9a4446847ebd8e8e87b2fe40f444235bd42ca7f5..782d0bd162468fb04f748f717b946a77d2fda5ce 100644 (file)
@@ -42,7 +42,7 @@
  */
 #include "gmxpre.h"
 
-#include "testmatchers.h"
+#include "testutils/testmatchers.h"
 
 #include <memory>
 
index 02749d82596e62df18b5585d397ff80fce3ad4be..f2805afe245f3a358634875514ba35461cfe34d6 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2012,2013,2014,2015,2019, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "testoptions.h"
+#include "testutils/testoptions.h"
 
 #include <list>
 
index 7a6d651ab43e09df488764b9644772482ae9d6b7..8a1030852713f5d6811975cd0aad3e10f96aa01b 100644 (file)
@@ -39,8 +39,10 @@ gmx_add_unit_test(TestUtilsUnitTests testutils-test
         testasserts_tests.cpp
         xvgtest_tests.cpp
         )
+target_link_libraries(testutils-test PRIVATE testutils)
 
 gmx_add_mpi_unit_test(TestUtilsMpiUnitTests testutils-mpi-test 2
     CPP_SOURCE_FILES
         mpitest.cpp
         )
+target_link_libraries(testutils-test PRIVATE testutils)
index 7dd2f7ca6c9a2b4a62f1896b457c50431b12fb67..0a9ec10a68cf3e8439e1b3aa27d7e29f2981ea1a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -41,7 +41,7 @@
  */
 #include "gmxpre.h"
 
-#include "textblockmatchers.h"
+#include "testutils/textblockmatchers.h"
 
 #include <memory>
 #include <regex>
index 872703eef14aa64a24ff11630ebb913ff173a837..9321f9ef7a945dacae246acbe8ac4ddeccf12c3a 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -42,7 +42,7 @@
 
 #include "gmxpre.h"
 
-#include "tprfilegenerator.h"
+#include "testutils/tprfilegenerator.h"
 
 #include "gromacs/gmxpreprocess/grompp.h"
 #include "gromacs/utility/textwriter.h"
index eb73e8fb2721f0564693086f48a75d929419320f..437f046a0f6a3c53b77be597bd5a4941e9ee86dc 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017,2018,2019, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018,2019,2020, by the GROMACS development team, led by
  * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
  * and including many others, as listed in the AUTHORS file in the
  * top-level source directory and at http://www.gromacs.org.
@@ -42,7 +42,7 @@
  */
 #include "gmxpre.h"
 
-#include "xvgtest.h"
+#include "testutils/xvgtest.h"
 
 #include <cerrno>
 #include <cstdlib>