Merge branch release-5-1 into release-2016
authorMark Abraham <mark.j.abraham@gmail.com>
Tue, 7 Jun 2016 23:14:01 +0000 (01:14 +0200)
committerSzilárd Páll <pall.szilard@gmail.com>
Wed, 8 Jun 2016 00:33:33 +0000 (02:33 +0200)
Conflicts:
CMakeLists.txt

Adjacent unrelated changes, trivial resolution

cmake/gmxDetectSimd.cmake

Two unrelated fixes, managing the new GMX_STDLIB_LIBRARIES better, and
working around the fact that we can't use try_run with noisy
compilers. The new context invalidates the suggestion to use try_run
once we require CMake 2.8.11.

cmake/gmxSetBuildInformation.cmake

As above.

src/gromacs/commandline/filenm.h

Adjacent changes caused by introducing Doxygen

src/gromacs/fileio/filetypes.cpp

As above

src/gromacs/legacyheaders/force.h

Change to function signature to pass const char *fn.

src/gromacs/mdlib/forcerec.cpp

Minor clashes from reorganized include files.

TODO make_bonded_tables was refactored in release-5-1 to need
t_filenm, which reintroduces a dependency on
commandline/filenm.h. Decide what to do about this.

src/gromacs/mdlib/mdatoms.cpp

git was confused about the frozen-atom fix because of the indenting
change, but the merge is straightforward in terms of code logic.

src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda.cu

New Doxygen in release-2016 clashed with introducing support for CUDA
6.0/6.1.

src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh

As above

src/gromacs/tables/forcetable.cpp

Change to function signature to pass const char *fn.

src/programs/mdrun/tests/CMakeLists.txt

Adjacent new files introduceed in both branches

Change-Id: Iaaffacc186aa5ff67c83522d2c07b05afeec75b2

28 files changed:
CMakeLists.txt
cmake/gmxBuildTypeReference.cmake
cmake/gmxBuildTypeReleaseWithAssert.cmake
cmake/gmxDetectSimd.cmake
cmake/gmxManageNvccConfig.cmake
cmake/gmxSetBuildInformation.cmake
docs/manual/forcefield.tex
src/gromacs/commandline/filenm.cpp
src/gromacs/commandline/filenm.h
src/gromacs/fileio/filetypes.cpp
src/gromacs/mdlib/forcerec.cpp
src/gromacs/mdlib/forcerec.h
src/gromacs/mdlib/mdatoms.cpp
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda.cu
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel.cuh
src/gromacs/mdlib/update.cpp
src/gromacs/tables/forcetable.cpp
src/gromacs/tables/forcetable.h
src/gromacs/utility/stringutil.h
src/programs/mdrun/mdrun.cpp
src/programs/mdrun/runner.cpp
src/programs/mdrun/tests/CMakeLists.txt
src/programs/mdrun/tests/butane1.gro [new file with mode: 0644]
src/programs/mdrun/tests/butane1.ndx [new file with mode: 0644]
src/programs/mdrun/tests/butane_a0.xvg [new file with mode: 0644]
src/programs/mdrun/tests/butane_b0.xvg [new file with mode: 0644]
src/programs/mdrun/tests/butane_d0.xvg [new file with mode: 0644]
src/programs/mdrun/tests/tabulated_bonded_interactions.cpp [new file with mode: 0644]

index b05d6867f2b6dc110631e38dd12880d20dba7ad8..849383540cdf3b2dae1cfef3f61b48a3f0b173a0 100644 (file)
@@ -412,6 +412,7 @@ endif()
 
 include(CheckLibraryExists)
 find_library(HAVE_LIBM m)
+mark_as_advanced(HAVE_LIBM)
 check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
 check_library_exists(m feenableexcept "" HAVE_FEENABLEEXCEPT)
 
@@ -567,8 +568,12 @@ endif()
 # Note this relies on zlib detection having already run
 include(gmxManageTNG)
 
-# now that we have detected the dependencies, do the second GPU configure pass
-gmx_gpu_setup()
+if(GMX_GPU)
+    # now that we have detected the dependencies, do the second configure pass
+    gmx_gpu_setup()
+else()
+    mark_as_advanced(CUDA_HOST_COMPILER)
+endif()
 
 if(CYGWIN)
     set(GMX_CYGWIN 1)
index 56fefbfb88d8a298dcb90abaf4502d7c61792990..6c33a5fe99d96de2d849085162d85b500bbb7ee6 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -37,7 +37,7 @@
 set( CMAKE_CXX_FLAGS_REFERENCE "-O0 -g" CACHE STRING "C++ flags for regressiontests reference runs." FORCE)
 set( CMAKE_C_FLAGS_REFERENCE "-O0 -g" CACHE STRING "C flags for regressiontests reference runs." FORCE)
 set( CMAKE_EXE_LINKER_FLAGS_REFERENCE "" CACHE STRING "Linker flags for regressiontests reference runs.")
-mark_as_advanced( CMAKE_CXX_FLAGS_REFERENCE CMAKE_C_FLAGS_REFERENCE)
+mark_as_advanced( CMAKE_CXX_FLAGS_REFERENCE CMAKE_C_FLAGS_REFERENCE CMAKE_EXE_LINKER_FLAGS_REFERENCE)
 
 # turn off all fancy options for the regressiontests reference build
 if("${CMAKE_BUILD_TYPE}" STREQUAL "Reference")
index db66d44051b063f1c071a0e29081f2addfe28368..45e30829eb24654daf8db9d43ee3fc60d16cea30 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014, by the GROMACS development team, led by
+# Copyright (c) 2014,2016, 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.
@@ -38,5 +38,5 @@ string(REGEX REPLACE "[/-][dD][^/-]*NDEBUG" "" CMAKE_CXX_FLAGS_RELWITHASSERT_INI
 set( CMAKE_C_FLAGS_RELWITHASSERT "${CMAKE_C_FLAGS_RELWITHASSERT_INIT}" CACHE STRING "C flags for release with assert builds.")
 set( CMAKE_CXX_FLAGS_RELWITHASSERT "${CMAKE_CXX_FLAGS_RELWITHASSERT_INIT}" CACHE STRING "C++ flags for release with assert builds.")
 set( CMAKE_EXE_LINKER_FLAGS_RELWITHASSERT "" CACHE STRING "Linker flags for release with assert builds.")
-mark_as_advanced( CMAKE_CXX_FLAGS_RELWITHASSERT CMAKE_C_FLAGS_RELWITHASSERT)
+mark_as_advanced( CMAKE_CXX_FLAGS_RELWITHASSERT CMAKE_C_FLAGS_RELWITHASSERT CMAKE_EXE_LINKER_FLAGS_RELWITHASSERT)
 
index 4abf65e290faa90d884b89d2d79f2a9869156018..28fbdc21f63514e0b02692e0d08a4f482e0fc84d 100644 (file)
 include(gmxTestInlineASM)
 
 function(gmx_suggest_simd _suggested_simd)
+    if(${_suggested_simd})
+        # There's already been a suggestion made, which can't change
+        return()
+    endif()
 
     # for x86 we need inline asm to use cpuid
     gmx_test_inline_asm_gcc_x86(GMX_X86_GCC_INLINE_ASM)
@@ -69,74 +73,56 @@ function(gmx_suggest_simd _suggested_simd)
 
     # Get CPU SIMD properties information
     set(_compile_definitions "${GCC_INLINE_ASM_DEFINE} -I${CMAKE_SOURCE_DIR}/src -DGMX_CPUINFO_STANDALONE ${GMX_STDLIB_CXX_FLAGS}")
+    if(GMX_TARGET_X86)
+        set(_compile_definitions "${_compile_definitions} -DGMX_TARGET_X86")
+    endif()
+
+    # Prepare a default suggestion
+    set(OUTPUT_SIMD "None")
 
     # We need to execute the binary, so this only works if not cross-compiling.
     # However, note that we are NOT limited to x86.
     if(NOT CMAKE_CROSSCOMPILING)
-        # We can use try_run(... LINK_LIBRARIES ${GMX_STDLIB_LIBRARIES})
-        # once we require CMake at least 2.8.11. The code below works
-        # even when GMX_STDLIB_LIBRARIES is empty.
+        # TODO Extract this try_compile to a helper function, because
+        # it duplicates code in gmxDetectSimd.cmake
+        set(GMX_DETECTSIMD_BINARY "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/GmxDetectSimd${CMAKE_EXECUTABLE_SUFFIX}")
         set(LINK_LIBRARIES "${GMX_STDLIB_LIBRARIES}")
-        try_run(GMX_CPUINFO_RUN_SIMD GMX_CPUINFO_COMPILED
-                ${CMAKE_BINARY_DIR}
-                ${CMAKE_SOURCE_DIR}/src/gromacs/hardware/cpuinfo.cpp
-                COMPILE_DEFINITIONS ${_compile_definitions}
-                CMAKE_FLAGS "-DLINK_LIBRARIES=${LINK_LIBRARIES}"
-                RUN_OUTPUT_VARIABLE OUTPUT_TMP
-                COMPILE_OUTPUT_VARIABLE GMX_CPUINFO_COMPILE_OUTPUT
-                ARGS "-features")
-
-        if(NOT GMX_CPUINFO_COMPILED)
-            message(WARNING "Cannot compile cpuinfo code, which means no SIMD instructions.")
-            message(STATUS "Compile output: ${GMX_CPUINFO_COMPILE_OUTPUT}")
-            set(OUTPUT_TMP "None")
-        elseif(NOT GMX_CPUINFO_RUN_SIMD EQUAL 0)
-            message(WARNING "Cannot run cpuinfo code, which means no SIMD instructions.")
-            message(STATUS "Run output: ${OUTPUT_TMP}")
-            set(OUTPUT_TMP "None")
-        endif(NOT GMX_CPUINFO_COMPILED)
+        try_compile(GMX_DETECTSIMD_COMPILED
+            "${CMAKE_CURRENT_BINARY_DIR}"
+            "${CMAKE_CURRENT_SOURCE_DIR}/src/gromacs/hardware/cpuinfo.cpp"
+            COMPILE_DEFINITIONS "${_compile_definitions}"
+            CMAKE_FLAGS "-DLINK_LIBRARIES=${LINK_LIBRARIES}"
+            OUTPUT_VARIABLE GMX_DETECTSIMD_COMPILED_OUTPUT
+            COPY_FILE ${GMX_DETECTSIMD_BINARY})
+        unset(_compile_definitions)
 
-        set(OUTPUT_SIMD "None")
-        if(GMX_TARGET_X86)
-            if(OUTPUT_TMP MATCHES " avx512er ")
-                set(OUTPUT_SIMD "AVX_512_KNL")
-            elseif(OUTPUT_TMP MATCHES " avx512f ")
-                set(OUTPUT_SIMD "AVX_512")
-            elseif(OUTPUT_TMP MATCHES " avx2 ")
-                set(OUTPUT_SIMD "AVX2_256")
-            elseif(OUTPUT_TMP MATCHES " avx ")
-                if(OUTPUT_TMP MATCHES " fma4 ")
-                    # AMD that works better with avx-128-fma
-                set(OUTPUT_SIMD "AVX_128_FMA")
+        if(GMX_DETECTSIMD_COMPILED)
+            # TODO Extract this duplication of
+            # gmxSetBuildInformation.cmake to a helper function
+            if(NOT DEFINED GMX_DETECTSIMD_RUN)
+                execute_process(COMMAND ${GMX_DETECTSIMD_BINARY} "-simd"
+                    RESULT_VARIABLE GMX_DETECTSIMD_RUN
+                    OUTPUT_VARIABLE OUTPUT_TMP
+                    ERROR_QUIET)
+                set(GMX_DETECTSIMD_RUN "${GMX_DETECTSIMD_RUN}" CACHE INTERNAL "Result of running CPUID code with arg -simd")
+                if(GMX_DETECTSIMD_RUN EQUAL 0)
+                    # Make a concrete suggestion of SIMD level
+                    string(STRIP "${OUTPUT_TMP}" OUTPUT_SIMD)
+                    message(STATUS "Detected best SIMD instructions for this CPU - ${OUTPUT_SIMD}")
                 else()
-                    # Intel
-                set(OUTPUT_SIMD "AVX_256")
+                    message(WARNING "Cannot run CPUID code, which means no SIMD suggestion can be made.")
+                    message(STATUS "Run output: ${OUTPUT_TMP}")
                 endif()
-            elseif(OUTPUT_TMP MATCHES " sse4.1 ")
-                set(OUTPUT_SIMD "SSE4.1")
-            elseif(OUTPUT_TMP MATCHES " sse2 ")
-                set(OUTPUT_SIMD "SSE2")
             endif()
         else()
-            if(OUTPUT_TMP MATCHES " vsx ")
-                set(OUTPUT_SIMD "IBM_VSX")
-            elseif(OUTPUT_TMP MATCHES " vmx ")
-                set(OUTPUT_SIMD "IBM_VMX")
-            elseif(OUTPUT_TMP MATCHES " qpx ")
-                set(OUTPUT_SIMD "IBM_QPX")
-            elseif(OUTPUT_TMP MATCHES " neon_asimd ")
-                set(OUTPUT_SIMD "ARM_NEON_ASIMD")
-            elseif(OUTPUT_TMP MATCHES " neon ")
-                set(OUTPUT_SIMD "ARM_NEON")
-            endif()
+            message(WARNING "Cannot compile CPUID code, which means no SIMD instructions.")
+            message(STATUS "Compile output: ${GMX_CPUID_COMPILE_OUTPUT}")
         endif()
-
-        set(${_suggested_simd} "${OUTPUT_SIMD}" PARENT_SCOPE)
-        message(STATUS "Detected best SIMD instructions for this CPU - ${OUTPUT_SIMD}")
     else()
-        set(${_suggested_simd} "None" PARENT_SCOPE)
         message(WARNING "Cannot detect SIMD architecture for this cross-compile; you should check it manually.")
     endif()
+
+    set(${_suggested_simd} "${OUTPUT_SIMD}" CACHE INTERNAL "Suggested SIMD")
 endfunction()
 
 function(gmx_detect_simd _suggested_simd)
index a0281a99181cb1beeaad8e0b7ed973c3ce93a588..17ef7db1ed04c06a0fd2bc8f84019dbae35f4bbc 100644 (file)
@@ -125,6 +125,9 @@ else()
     #     => compile sm_20, sm_30, sm_35, sm_37 sm_50, SASS, and compute_50 PTX
     # - with CUDA >=7.0         CC 5.2 is supported (5.3, Tegra X1 we don't generate code for)
     #     => compile sm_20, sm_30, sm_35, sm_37, sm_50, & sm_52 SASS, and compute_52 PTX
+    # - with CUDA >=8.0         CC 6.0-6.2 is supported (but we know nothing about CC 6.2, so we won't generate code or it)
+    #     => compile sm_20, sm_30, sm_35, sm_37, sm_50, sm_52, sm_60, sm_61 SASS, and compute_60 and compute_61 PTX
+    #
     #
     #   Note that CUDA 6.5.19 second patch release supports cc 5.2 too, but
     #   CUDA_VERSION does not contain patch version and having PTX 5.0 JIT-ed is
@@ -142,6 +145,10 @@ else()
     if(NOT CUDA_VERSION VERSION_LESS "7.0") # >= 7.0
         list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_52,code=sm_52")
     endif()
+    if(NOT CUDA_VERSION VERSION_LESS "8.0") # >= 8.0
+        list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_60,code=sm_60")
+        list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_61,code=sm_61")
+    endif()
 
     # Next add flags that trigger PTX code generation for the newest supported virtual arch
     # that's useful to JIT to future architectures
@@ -149,8 +156,11 @@ else()
         list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_35,code=compute_35")
     elseif(CUDA_VERSION VERSION_LESS "7.0")
         list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_50,code=compute_50")
-    else() # version >= 7.0
+    elseif(CUDA_VERSION VERSION_LESS "8.0")
         list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_52,code=compute_52")
+    else() # version >= 8.0
+        list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_60,code=compute_60")
+        list (APPEND GMX_CUDA_NVCC_GENCODE_FLAGS "-gencode;arch=compute_61,code=compute_61")
     endif()
 endif()
 
index bf6551f9e824e7b4a75fc81d74697a913bf9cb56..e3d677ac57d191ca602ad456e88017d7cbce4d5f 100644 (file)
@@ -81,89 +81,108 @@ macro(gmx_set_build_information)
         message(STATUS "Setting build user & time - not on Unix, using anonymous")
     endif()
 
-    if(NOT CMAKE_CROSSCOMPILING)
-        # Get CPU information, e.g. for deciding what SIMD support exists
-        set(_compile_definitions "${GCC_INLINE_ASM_DEFINE} -I${CMAKE_SOURCE_DIR}/src -DGMX_CPUINFO_STANDALONE")
-        try_run(GMX_CPUINFO_RUN_VENDOR GMX_CPUINFO_COMPILED
-            ${CMAKE_BINARY_DIR}
-            ${CMAKE_SOURCE_DIR}/src/gromacs/hardware/cpuinfo.cpp
-            COMPILE_DEFINITIONS ${_compile_definitions}
-            RUN_OUTPUT_VARIABLE OUTPUT_CPU_VENDOR ARGS "-vendor")
-        try_run(GMX_CPUINFO_RUN_BRAND GMX_CPUINFO_COMPILED
-            ${CMAKE_BINARY_DIR}
-            ${CMAKE_SOURCE_DIR}/src/gromacs/hardware/cpuinfo.cpp
-            COMPILE_DEFINITIONS ${_compile_definitions}
-            RUN_OUTPUT_VARIABLE OUTPUT_CPU_BRAND ARGS "-brand")
-        try_run(GMX_CPUINFO_RUN_FAMILY GMX_CPUINFO_COMPILED
-            ${CMAKE_BINARY_DIR}
-            ${CMAKE_SOURCE_DIR}/src/gromacs/hardware/cpuinfo.cpp
-            COMPILE_DEFINITIONS ${_compile_definitions}
-            RUN_OUTPUT_VARIABLE OUTPUT_CPU_FAMILY ARGS "-family")
-        try_run(GMX_CPUINFO_RUN_MODEL GMX_CPUINFO_COMPILED
-            ${CMAKE_BINARY_DIR}
-            ${CMAKE_SOURCE_DIR}/src/gromacs/hardware/cpuinfo.cpp
-            COMPILE_DEFINITIONS ${_compile_definitions}
-            RUN_OUTPUT_VARIABLE OUTPUT_CPU_MODEL ARGS "-model")
-       try_run(GMX_CPUINFO_RUN_STEPPING GMX_CPUINFO_COMPILED
-            ${CMAKE_BINARY_DIR}
-            ${CMAKE_SOURCE_DIR}/src/gromacs/hardware/cpuinfo.cpp
-            COMPILE_DEFINITIONS ${_compile_definitions}
-            RUN_OUTPUT_VARIABLE OUTPUT_CPU_STEPPING ARGS "-stepping")
-        try_run(GMX_CPUINFO_RUN_FEATURES GMX_CPUINFO_COMPILED
-            ${CMAKE_BINARY_DIR}
-            ${CMAKE_SOURCE_DIR}/src/gromacs/hardware/cpuinfo.cpp
-            COMPILE_DEFINITIONS ${_compile_definitions}
-            RUN_OUTPUT_VARIABLE OUTPUT_CPU_FEATURES ARGS "-features")
-        unset(_compile_definitions)
-
-        string(STRIP "${OUTPUT_CPU_VENDOR}" OUTPUT_CPU_VENDOR)
-        string(STRIP "${OUTPUT_CPU_BRAND}" OUTPUT_CPU_BRAND)
-        string(STRIP "${OUTPUT_CPU_FAMILY}" OUTPUT_CPU_FAMILY)
-        string(STRIP "${OUTPUT_CPU_MODEL}" OUTPUT_CPU_MODEL)
-        string(STRIP "${OUTPUT_CPU_STEPPING}" OUTPUT_CPU_STEPPING)
-        string(STRIP "${OUTPUT_CPU_FEATURES}" OUTPUT_CPU_FEATURES)
+    # Set up some defaults that will usually be overridden
+    if(CMAKE_CROSSCOMPILING)
+        set(_reason ", cross-compiled")
+    endif()
+    set(OUTPUT_CPU_VENDOR   "Unknown${_reason}")
+    set(OUTPUT_CPU_BRAND    "Unknown${_reason}")
+    set(OUTPUT_CPU_FAMILY   "0")
+    set(OUTPUT_CPU_MODEL    "0")
+    set(OUTPUT_CPU_STEPPING "0")
+    set(OUTPUT_CPU_FEATURES "Unknown${_reason}")
+    unset(_reason)
 
-        if(GMX_CPUINFO_RUN_VENDOR EQUAL 0)
-            set(BUILD_CPU_VENDOR   "${OUTPUT_CPU_VENDOR}"   CACHE INTERNAL "Build CPU vendor")
-        else()
-            set(BUILD_CPU_VENDOR   "Unknown, detect failed" CACHE INTERNAL "Build CPU vendor")
-        endif()
-        if(GMX_CPUINFO_RUN_BRAND EQUAL 0)
-            set(BUILD_CPU_BRAND    "${OUTPUT_CPU_BRAND}"    CACHE INTERNAL "Build CPU brand")
-        else()
-            set(BUILD_CPU_BRAND    "Unknown, detect failed" CACHE INTERNAL "Build CPU brand")
-        endif()
-        if(GMX_CPUINFO_RUN_FAMILY EQUAL 0)
-            set(BUILD_CPU_FAMILY   "${OUTPUT_CPU_FAMILY}"   CACHE INTERNAL "Build CPU family")
-        else()
-            set(BUILD_CPU_FAMILY   "0"                     CACHE INTERNAL "Build CPU family")
-        endif()
-        if(GMX_CPUINFO_RUN_MODEL EQUAL 0)
-            set(BUILD_CPU_MODEL    "${OUTPUT_CPU_MODEL}"    CACHE INTERNAL "Build CPU model")
-        else()
-            set(BUILD_CPU_MODEL    "0"                     CACHE INTERNAL "Build CPU model")
-        endif()
-        if(GMX_CPUINFO_RUN_STEPPING EQUAL 0)
-            set(BUILD_CPU_STEPPING "${OUTPUT_CPU_STEPPING}" CACHE INTERNAL "Build CPU stepping")
-        else()
-            set(BUILD_CPU_STEPPING "0"                     CACHE INTERNAL "Build CPU stepping")
-        endif()
-            if(GMX_CPUINFO_RUN_FEATURES EQUAL 0)
-            set(BUILD_CPU_FEATURES "${OUTPUT_CPU_FEATURES}" CACHE INTERNAL "Build CPU features")
-        else()
-            set(BUILD_CPU_FEATURES ""                      CACHE INTERNAL "Build CPU features")
+    if(NOT CMAKE_CROSSCOMPILING)
+        # Get CPU information, e.g. for deciding what SIMD support probably exists
+        set(_compile_definitions "${GCC_INLINE_ASM_DEFINE} -I${CMAKE_SOURCE_DIR}/src -DGMX_CPUID_STANDALONE")
+        if(GMX_TARGET_X86)
+            set(_compile_definitions "${_compile_definitions} -DGMX_TARGET_X86")
         endif()
 
-    else()
-
-        set(BUILD_CPU_VENDOR   "Unknown, cross-compiled"   CACHE INTERNAL "Build CPU vendor")
-        set(BUILD_CPU_BRAND    "Unknown, cross-compiled"    CACHE INTERNAL "Build CPU brand")
-        set(BUILD_CPU_FAMILY   "0"   CACHE INTERNAL "Build CPU family")
-        set(BUILD_CPU_MODEL    "0"    CACHE INTERNAL "Build CPU model")
-        set(BUILD_CPU_STEPPING "0" CACHE INTERNAL "Build CPU stepping")
-        set(BUILD_CPU_FEATURES "" CACHE INTERNAL "Build CPU features")
+        set(GMX_BUILDINFORMATION_BINARY "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/GmxBuildInformation${CMAKE_EXECUTABLE_SUFFIX}")
+        # TODO Extract this try_compile to a helper function, because
+        # it duplicates code in gmxDetectSimd.cmake
+        try_compile(GMX_BUILDINFORMATION_COMPILED
+            "${CMAKE_CURRENT_BINARY_DIR}"
+            "${CMAKE_CURRENT_SOURCE_DIR}/src/gromacs/hardware/cpuinfo.cpp"
+            COMPILE_DEFINITIONS "${_compile_definitions}"
+            OUTPUT_VARIABLE GMX_BUILDINFORMATION_COMPILED_OUTPUT
+            COPY_FILE ${GMX_BUILDINFORMATION_BINARY})
+        unset(_compile_definitions)
 
+        if(GMX_BUILDINFORMATION_COMPILED)
+            # TODO Extract this duplication to a helper function (also
+            # from gmxDetectSimd.cmake)
+            if(NOT DEFINED GMX_BUILDINFORMATION_RUN_VENDOR)
+                execute_process(COMMAND ${GMX_BUILDINFORMATION_BINARY} "-vendor"
+                    RESULT_VARIABLE GMX_BUILDINFORMATION_RUN_VENDOR
+                    OUTPUT_VARIABLE OUTPUT_TMP
+                    ERROR_QUIET)
+                set(GMX_BUILDINFORMATION_RUN_VENDOR "${GMX_BUILDINFORMATION_RUN_VENDOR}" CACHE INTERNAL "Result of running CPUID code with arg -vendor")
+                if(GMX_BUILDINFORMATION_RUN_VENDOR EQUAL 0)
+                    string(STRIP "${OUTPUT_TMP}" OUTPUT_CPU_VENDOR)
+                endif()
+            endif()
+            if(NOT DEFINED GMX_BUILDINFORMATION_RUN_BRAND)
+                execute_process(COMMAND ${GMX_BUILDINFORMATION_BINARY} "-brand"
+                    RESULT_VARIABLE GMX_BUILDINFORMATION_RUN_BRAND
+                    OUTPUT_VARIABLE OUTPUT_TMP
+                    ERROR_QUIET)
+                set(GMX_BUILDINFORMATION_RUN_BRAND "${GMX_BUILDINFORMATION_RUN_BRAND}" CACHE INTERNAL "Result of running CPUID code with arg -brand")
+                if(GMX_BUILDINFORMATION_RUN_BRAND EQUAL 0)
+                    string(STRIP "${OUTPUT_TMP}" OUTPUT_CPU_BRAND)
+                endif()
+            endif()
+            if(NOT DEFINED GMX_BUILDINFORMATION_RUN_FAMILY)
+                execute_process(COMMAND ${GMX_BUILDINFORMATION_BINARY} "-family"
+                    RESULT_VARIABLE GMX_BUILDINFORMATION_RUN_FAMILY
+                    OUTPUT_VARIABLE OUTPUT_TMP
+                    ERROR_QUIET)
+                set(GMX_BUILDINFORMATION_RUN_FAMILY "${GMX_BUILDINFORMATION_RUN_FAMILY}" CACHE INTERNAL "Result of running CPUID code with arg -family")
+                if(GMX_BUILDINFORMATION_RUN_FAMILY EQUAL 0)
+                    string(STRIP "${OUTPUT_TMP}" OUTPUT_CPU_FAMILY)
+                endif()
+            endif()
+            if(NOT DEFINED GMX_BUILDINFORMATION_RUN_MODEL)
+                execute_process(COMMAND ${GMX_BUILDINFORMATION_BINARY} "-model"
+                    RESULT_VARIABLE GMX_BUILDINFORMATION_RUN_MODEL
+                    OUTPUT_VARIABLE OUTPUT_TMP
+                    ERROR_QUIET)
+                set(GMX_BUILDINFORMATION_RUN_MODEL "${GMX_BUILDINFORMATION_RUN_MODEL}" CACHE INTERNAL "Result of running CPUID code with arg -model")
+                if(GMX_BUILDINFORMATION_RUN_MODEL EQUAL 0)
+                    string(STRIP "${OUTPUT_TMP}" OUTPUT_CPU_MODEL)
+                endif()
+            endif()
+            if(NOT DEFINED GMX_BUILDINFORMATION_RUN_STEPPING)
+                execute_process(COMMAND ${GMX_BUILDINFORMATION_BINARY} "-stepping"
+                    RESULT_VARIABLE GMX_BUILDINFORMATION_RUN_STEPPING
+                    OUTPUT_VARIABLE OUTPUT_TMP
+                    ERROR_QUIET)
+                set(GMX_BUILDINFORMATION_RUN_STEPPING "${GMX_BUILDINFORMATION_RUN_STEPPING}" CACHE INTERNAL "Result of running CPUID code with arg -stepping")
+                if(GMX_BUILDINFORMATION_RUN_STEPPING EQUAL 0)
+                    string(STRIP "${OUTPUT_TMP}" OUTPUT_CPU_STEPPING)
+                endif()
+            endif()
+            if(NOT DEFINED GMX_BUILDINFORMATION_RUN_FEATURES)
+                execute_process(COMMAND ${GMX_BUILDINFORMATION_BINARY} "-features"
+                    RESULT_VARIABLE GMX_BUILDINFORMATION_RUN_FEATURES
+                    OUTPUT_VARIABLE OUTPUT_TMP
+                    ERROR_QUIET)
+                set(GMX_BUILDINFORMATION_RUN_FEATURES "${GMX_BUILDINFORMATION_RUN_FEATURES}" CACHE INTERNAL "Result of running CPUID code with arg -features")
+                if(GMX_BUILDINFORMATION_RUN_FEATURES EQUAL 0)
+                    string(STRIP "${OUTPUT_TMP}" OUTPUT_CPU_FEATURES)
+                endif()
+            endif()
+        endif()
     endif()
 
+    set(BUILD_CPU_VENDOR   "${OUTPUT_CPU_VENDOR}"   CACHE INTERNAL "Build CPU vendor")
+    set(BUILD_CPU_BRAND    "${OUTPUT_CPU_BRAND}"    CACHE INTERNAL "Build CPU brand")
+    set(BUILD_CPU_FAMILY   "${OUTPUT_CPU_FAMILY}"   CACHE INTERNAL "Build CPU family")
+    set(BUILD_CPU_MODEL    "${OUTPUT_CPU_MODEL}"    CACHE INTERNAL "Build CPU model")
+    set(BUILD_CPU_STEPPING "${OUTPUT_CPU_STEPPING}" CACHE INTERNAL "Build CPU stepping")
+    set(BUILD_CPU_FEATURES "${OUTPUT_CPU_FEATURES}" CACHE INTERNAL "Build CPU features")
+
     ENDIF(NOT DEFINED BUILD_USER)
 endmacro(gmx_set_build_information)
index 83a68e02ec37215ee41a0c8bfbd880a905c9be9b..7f8f922d83c5f36ff0869828545a704f694256ec 100644 (file)
@@ -973,13 +973,13 @@ and one that does not (type 9).
 For details see \tabref{topfile2}.
 The table files are supplied to the {\tt mdrun} program.
 After the table file name an underscore, the letter ``b'' for bonds,
-``a'' for angles or ``d'' for dihedrals and the table number are appended.
-For example, for a bond with $n=0$ (and using the default table file name)
-the table is read from the file {\tt table_b0.xvg}.  Multiple tables can be
-supplied simply by using different values of $n$, and are applied to the appropriate
+``a'' for angles or ``d'' for dihedrals and the table number must be appended.
+For example, a tabulated bond with $n=0$ can be read from the file {\tt table_b0.xvg}.
+Multiple tables can be
+supplied simply by adding files with different values of $n$, and are applied to the appropriate
 bonds, as specified in the topology (\tabref{topfile2}).
-The format for the table files is three columns with $x$, $f(x)$, $-f'(x)$,
-where $x$ should be uniformly-spaced. Requirements for entries in the topology
+The format for the table files is three fixed-format columns of any suitable width. These columns must contain $x$, $f(x)$, $-f'(x)$,
+and the values of $x$ should be uniformly spaced. Requirements for entries in the topology
 are given in~\tabref{topfile2}. 
 The setup of the tables is as follows:
 \\{\bf bonds}:
index b7f7d8b5a06e8e6c962ab8f69dbfe422880f96f4..f8b5e55282807846ec925b42e2ab0150194ee19b 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, 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.
 #define IS_SET(fn) ((fn.flag &ffSET) != 0)
 #define IS_OPT(fn) ((fn.flag &ffOPT) != 0)
 
+const t_filenm *getFilenm(const char *opt, int nfile, const t_filenm fnm[])
+{
+    int i;
+
+    for (i = 0; (i < nfile); i++)
+    {
+        if (strcmp(opt, fnm[i].opt) == 0)
+        {
+            return &fnm[i];
+        }
+    }
+
+    return NULL;
+}
+
 const char *opt2fn(const char *opt, int nfile, const t_filenm fnm[])
 {
     int i;
index 19c8f744de139c048f8540d78fc318df216a4fff..1ca8470663085dac0d7b56f5a09ddad402d11221 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, 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.
@@ -114,6 +114,12 @@ const char *opt2fn(const char *opt, int nfile, const t_filenm fnm[]);
 int opt2fns(char **fns[], const char *opt, int nfile,
             const t_filenm fnm[]);
 
+/*! \brief
+ * Return a pointer to the t_filenm data structure of filenames belonging to
+ * command-line option opt, or NULL when no such option was used.
+ */
+const t_filenm *getFilenm(const char *opt, int nfile, const t_filenm fnm[]);
+
 //! Returns a file pointer from the filename.
 #define opt2FILE(opt, nfile, fnm, mode) gmx_ffopen(opt2fn(opt, nfile, fnm), mode)
 
index 9886c35b56ee4af19a93017d7a07181c79162f09..2002498f344eb3a0493f2ec24207499497c09ed6 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, 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 6ed1608b207b1b98ee179d2b9574a017387924c0..703a1cd471ad50196031a097fa5ad0d9349ed62e 100644 (file)
@@ -48,6 +48,7 @@
 
 #include <algorithm>
 
+#include "gromacs/commandline/filenm.h"
 #include "gromacs/domdec/domdec.h"
 #include "gromacs/domdec/domdec_struct.h"
 #include "gromacs/ewald/ewald.h"
@@ -89,6 +90,7 @@
 #include "gromacs/topology/mtop_util.h"
 #include "gromacs/trajectory/trajectoryframe.h"
 #include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/exceptions.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/gmxassert.h"
 #include "gromacs/utility/pleasecite.h"
@@ -1353,6 +1355,19 @@ static void make_nbf_tables(FILE *fp,
     }
 }
 
+/*!\brief If there's bonded interactions of type \c ftype1 or \c
+ * ftype2 present in the topology, build an array of the number of
+ * interactions present for each bonded interaction index found in the
+ * topology.
+ *
+ * \c ftype1 or \c ftype2 may be set to -1 to disable seeking for a
+ * valid type with that parameter.
+ *
+ * \c count will be reallocated as necessary to fit the largest bonded
+ * interaction index found, and its current size will be returned in
+ * \c ncount. It will contain zero for every bonded interaction index
+ * for which no interactions are present in the topology.
+ */
 static void count_tables(int ftype1, int ftype2, const gmx_mtop_t *mtop,
                          int *ncount, int **count)
 {
@@ -1360,22 +1375,28 @@ static void count_tables(int ftype1, int ftype2, const gmx_mtop_t *mtop,
     const t_ilist       *il;
     int                  mt, ftype, stride, i, j, tabnr;
 
+    // Loop over all moleculetypes
     for (mt = 0; mt < mtop->nmoltype; mt++)
     {
         molt = &mtop->moltype[mt];
+        // Loop over all interaction types
         for (ftype = 0; ftype < F_NRE; ftype++)
         {
+            // If the current interaction type is one of the types whose tables we're trying to count...
             if (ftype == ftype1 || ftype == ftype2)
             {
                 il     = &molt->ilist[ftype];
                 stride = 1 + NRAL(ftype);
+                // ... and there are actually some interactions for this type
                 for (i = 0; i < il->nr; i += stride)
                 {
+                    // Find out which table index the user wanted
                     tabnr = mtop->ffparams.iparams[il->iatoms[i]].tab.table;
                     if (tabnr < 0)
                     {
                         gmx_fatal(FARGS, "A bonded table number is smaller than 0: %d\n", tabnr);
                     }
+                    // Make room for this index in the data structure
                     if (tabnr >= *ncount)
                     {
                         srenew(*count, tabnr+1);
@@ -1385,6 +1406,7 @@ static void count_tables(int ftype1, int ftype2, const gmx_mtop_t *mtop,
                         }
                         *ncount = tabnr+1;
                     }
+                    // Record that this table index is used and must have a valid file
                     (*count)[tabnr]++;
                 }
             }
@@ -1392,13 +1414,23 @@ static void count_tables(int ftype1, int ftype2, const gmx_mtop_t *mtop,
     }
 }
 
+/*!\brief If there's bonded interactions of flavour \c tabext and type
+ * \c ftype1 or \c ftype2 present in the topology, seek them in the
+ * list of filenames passed to mdrun, and make bonded tables from
+ * those files.
+ *
+ * \c ftype1 or \c ftype2 may be set to -1 to disable seeking for a
+ * valid type with that parameter.
+ *
+ * A fatal error occurs if no matching filename is found.
+ */
 static bondedtable_t *make_bonded_tables(FILE *fplog,
                                          int ftype1, int ftype2,
                                          const gmx_mtop_t *mtop,
-                                         const char *basefn, const char *tabext)
+                                         const t_filenm *tabbfnm,
+                                         const char *tabext)
 {
-    int            i, ncount, *count;
-    char           tabfn[STRLEN];
+    int            ncount, *count;
     bondedtable_t *tab;
 
     tab = NULL;
@@ -1407,17 +1439,41 @@ static bondedtable_t *make_bonded_tables(FILE *fplog,
     count  = NULL;
     count_tables(ftype1, ftype2, mtop, &ncount, &count);
 
+    // Are there any relevant tabulated bond interactions?
     if (ncount > 0)
     {
         snew(tab, ncount);
-        for (i = 0; i < ncount; i++)
+        for (int i = 0; i < ncount; i++)
         {
+            // Do any interactions exist that requires this table?
             if (count[i] > 0)
             {
-                sprintf(tabfn, "%s", basefn);
-                sprintf(tabfn + strlen(basefn) - strlen(ftp2ext(efXVG)) - 1, "_%s%d.%s",
-                        tabext, i, ftp2ext(efXVG));
-                tab[i] = make_bonded_table(fplog, tabfn, NRAL(ftype1)-2);
+                // This pattern enforces the current requirement that
+                // table filenames end in a characteristic sequence
+                // before the file type extension, and avoids table 13
+                // being recognized and used for table 1.
+                std::string patternToFind = gmx::formatString("_%s%d.%s", tabext, i, ftp2ext(efXVG));
+                bool        madeTable     = false;
+                for (int j = 0; j < tabbfnm->nfiles && !madeTable; ++j)
+                {
+                    std::string filename(tabbfnm->fns[j]);
+                    if (gmx::endsWith(filename, patternToFind))
+                    {
+                        // Finally read the table from the file found
+                        tab[i]    = make_bonded_table(fplog, tabbfnm->fns[j], NRAL(ftype1)-2);
+                        madeTable = true;
+                    }
+                }
+                if (!madeTable)
+                {
+                    bool isPlural = (ftype2 != -1);
+                    gmx_fatal(FARGS, "Tabulated interaction of type '%s%s%s' with index %d cannot be used because no table file whose name matched '%s' was passed via the gmx mdrun -tableb command-line option.",
+                              interaction_function[ftype1].longname,
+                              isPlural ? "' or '" : "",
+                              isPlural ? interaction_function[ftype2].longname : "",
+                              i,
+                              patternToFind.c_str());
+                }
             }
         }
         sfree(count);
@@ -2266,7 +2322,7 @@ void init_forcerec(FILE              *fp,
                    matrix             box,
                    const char        *tabfn,
                    const char        *tabpfn,
-                   const char        *tabbfn,
+                   const t_filenm    *tabbfnm,
                    const char        *nbpu_opt,
                    gmx_bool           bNoSolvOpt,
                    real               print_force)
@@ -3052,17 +3108,23 @@ void init_forcerec(FILE              *fp,
         make_wall_tables(fp, ir, tabfn, &mtop->groups, fr);
     }
 
-    if (fcd && tabbfn)
+    if (fcd && tabbfnm)
     {
-        fcd->bondtab  = make_bonded_tables(fp,
-                                           F_TABBONDS, F_TABBONDSNC,
-                                           mtop, tabbfn, "b");
-        fcd->angletab = make_bonded_tables(fp,
-                                           F_TABANGLES, -1,
-                                           mtop, tabbfn, "a");
-        fcd->dihtab   = make_bonded_tables(fp,
-                                           F_TABDIHS, -1,
-                                           mtop, tabbfn, "d");
+        // Need to catch std::bad_alloc
+        // TODO Don't need to catch this here, when merging with master branch
+        try
+        {
+            fcd->bondtab  = make_bonded_tables(fp,
+                                               F_TABBONDS, F_TABBONDSNC,
+                                               mtop, tabbfnm, "b");
+            fcd->angletab = make_bonded_tables(fp,
+                                               F_TABANGLES, -1,
+                                               mtop, tabbfnm, "a");
+            fcd->dihtab   = make_bonded_tables(fp,
+                                               F_TABDIHS, -1,
+                                               mtop, tabbfnm, "d");
+        }
+        GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
     }
     else
     {
index 9ff5b250c1418a086645fce6960ed04a6fde779a..274d909bf82446a41c62461e03acac7e2639f165 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, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016, 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.
@@ -46,6 +46,7 @@
 
 struct t_commrec;
 struct t_fcdata;
+struct t_filenm;
 
 /*! \brief Create a new forcerec structure */
 t_forcerec *mk_forcerec(void);
@@ -98,7 +99,7 @@ void init_interaction_const_tables(FILE                   *fp,
  * \param[in]  box         Simulation box
  * \param[in]  tabfn       Table potential file for non-bonded interactions
  * \param[in]  tabpfn      Table potential file for pair interactions
- * \param[in]  tabbfn      Table potential file for bonded interactions
+ * \param[in]  tabbfnm     Table potential files for bonded interactions
  * \param[in]  nbpu_opt    Nonbonded Processing Unit (GPU/CPU etc.)
  * \param[in]  bNoSolvOpt  Do not use solvent optimization
  * \param[in]  print_force Print forces for atoms with force >= print_force
@@ -112,7 +113,7 @@ void init_forcerec(FILE                   *fplog,
                    matrix                  box,
                    const char             *tabfn,
                    const char             *tabpfn,
-                   const char             *tabbfn,
+                   const t_filenm         *tabbfnm,
                    const char             *nbpu_opt,
                    gmx_bool                bNoSolvOpt,
                    real                    print_force);
index ffa5825bec61fec865ce2060ebab9732e8ba7b0f..63ff5e8b495b08bf6ed2715c681312d3aeaa1214 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,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016, 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.
@@ -301,14 +301,17 @@ void atoms2md(const gmx_mtop_t *mtop, const t_inputrec *ir,
                 g = md->cFREEZE[i];
                 if (opts->nFreeze[g][XX] && opts->nFreeze[g][YY] && opts->nFreeze[g][ZZ])
                 {
-                    /* Set the mass of completely frozen particles to ALMOST_ZERO iso 0
-                     * to avoid div by zero in lincs or shake.
-                     * Note that constraints can still move a partially frozen particle.
+                    /* Set the mass of completely frozen particles to ALMOST_ZERO
+                     * iso 0 to avoid div by zero in lincs or shake.
                      */
                     md->invmass[i]  = ALMOST_ZERO;
                 }
                 else
                 {
+                    /* Note: Partially frozen particles use the normal invmass.
+                     * If such particles are constrained, the frozen dimensions
+                     * should not be updated with the constrained coordinates.
+                     */
                     md->invmass[i]  = 1.0/mA;
                 }
             }
index 39464192315a153f2931594c615d404cce44c7ff..058680e11d6f18d096d93a4b4cefb05a0423656a 100644 (file)
@@ -73,6 +73,7 @@ texture<float, 1, cudaReadModeElementType> coulomb_tab_texref;
 
 
 /***** The kernel declarations/definitions come here *****/
+#include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_kernel_utils.cuh"
 
 /* Top-level kernel declaration generation: will generate through multiple
  * inclusion the following flavors for all kernel declarations:
@@ -423,7 +424,8 @@ void nbnxn_gpu_launch_kernel(gmx_nbnxn_cuda_t       *nb,
      * - The 1D block-grid contains as many blocks as super-clusters.
      */
     int num_threads_z = 1;
-    if (nb->dev_info->prop.major == 3 && nb->dev_info->prop.minor == 7)
+    if ((nb->dev_info->prop.major == 3 && nb->dev_info->prop.minor == 7) ||
+        (nb->dev_info->prop.major == 6 && nb->dev_info->prop.minor == 0))
     {
         num_threads_z = 2;
     }
index c63eda7f43bbb1f761d06018c4570a26482ea6a9..de26e947b75d943ae4ac337b55e3b325a726f5c6 100644 (file)
  * NTHREAD_Z > 1 results in excessive register spilling unless the minimum blocks
  * per multiprocessor is reduced proportionally to get the original number of max
  * threads in flight (and slightly lower performance).
- * - On CC 3.7 there are enough registers to double the number of threads; using
+ * - On CC 3.7 and 6.0 there are enough registers to double the number of threads; using
  * NTHREADS_Z == 2 is fastest with 16 blocks (TODO: test with RF and other kernels
  * with low-register use).
  *
 /* Kernel launch bounds for different compute capabilities. The value of NTHREAD_Z
  * determines the number of threads per block and it is chosen such that
  * 16 blocks/multiprocessor can be kept in flight.
- * - CC 2.x, 3.0, 3.5, 5.x: NTHREAD_Z=1, (64, 16) bounds
- * - CC 3.7:                NTHREAD_Z=2, (128, 16) bounds
+ * - CC 3.0/3.5/5.x, >=6.1: NTHREAD_Z=1, (64, 16) bounds
+ * - CC 3.7, 6.0:           NTHREAD_Z=2, (128, 16) bounds
+ *
+ * Note: convenience macros, need to be undef-ed at the end of the file.
  */
-#if GMX_PTX_ARCH == 370
+#if GMX_PTX_ARCH == 370 || GMX_PTX_ARCH == 600
     #define NTHREAD_Z           (2)
     #define MIN_BLOCKS_PER_MP   (16)
 #else
     #define NTHREAD_Z           (1)
     #define MIN_BLOCKS_PER_MP   (16)
-#endif /* GMX_PTX_ARCH == 370 */
+#endif /* GMX_PTX_ARCH == 370 || GMX_PTX_ARCH == 600 */
 #define THREADS_PER_BLOCK   (c_clSize*c_clSize*NTHREAD_Z)
 
 #if GMX_PTX_ARCH >= 350
index cbdd58649317e166a020f09ff0f279731eb7fd4f..0a65e04d0b396f68d1ab5fbb81558fe750e8ce76 100644 (file)
@@ -1435,6 +1435,42 @@ void update_constraints(FILE             *fplog,
          */
         wallcycle_start_nocount(wcycle, ewcUPDATE);
 
+        if (md->cFREEZE != NULL && constr != NULL)
+        {
+            /* If we have atoms that are frozen along some, but not all
+             * dimensions, the constraints will have moved them also along
+             * the frozen dimensions. To freeze such degrees of freedom
+             * we copy them back here to later copy them forward. It would
+             * be more elegant and slightly more efficient to copies zero
+             * times instead of twice, but the graph case below prevents this.
+             */
+            const ivec *nFreeze                     = inputrec->opts.nFreeze;
+            bool        partialFreezeAndConstraints = false;
+            for (int g = 0; g < inputrec->opts.ngfrz; g++)
+            {
+                int numFreezeDim = nFreeze[g][XX] + nFreeze[g][YY] + nFreeze[g][ZZ];
+                if (numFreezeDim > 0 && numFreezeDim < 3)
+                {
+                    partialFreezeAndConstraints = true;
+                }
+            }
+            if (partialFreezeAndConstraints)
+            {
+                for (int i = start; i < nrend; i++)
+                {
+                    int g = md->cFREEZE[i];
+
+                    for (int d = 0; d < DIM; d++)
+                    {
+                        if (nFreeze[g][d])
+                        {
+                            upd->xp[i][d] = state->x[i][d];
+                        }
+                    }
+                }
+            }
+        }
+
         if (graph && (graph->nnodes > 0))
         {
             unshift_x(graph, state->box, state->x, upd->xp);
index fa6a1987497a93e02dbf72f689bc3a30f8d87cd3..2b52c178a32c6f43df8d33d4a246ef9fd0900c7e 100644 (file)
@@ -729,14 +729,17 @@ static void read_tables(FILE *fp, const char *fn,
                 {
                     /* Take the centered difference */
                     numf = -(vp - vm)*0.5*tabscale;
-                    ssd += fabs(2*(f - numf)/(f + numf));
+                    if (f + numf != 0)
+                    {
+                        ssd += fabs(2*(f - numf)/(f + numf));
+                    }
                     ns++;
                 }
             }
             if (ns > 0)
             {
                 ssd /= ns;
-                sprintf(buf, "For the %d non-zero entries for table %d in %s the forces deviate on average %d%% from minus the numerical derivative of the potential\n", ns, k, libfn, (int)(100*ssd+0.5));
+                sprintf(buf, "For the %d non-zero entries for table %d in %s the forces deviate on average %lld%% from minus the numerical derivative of the potential\n", ns, k, libfn, (long long int)(100*ssd+0.5));
                 if (debug)
                 {
                     fprintf(debug, "%s", buf);
@@ -1539,7 +1542,7 @@ t_forcetable *make_gb_table(const t_forcerec              *fr)
 
 }
 
-bondedtable_t make_bonded_table(FILE *fplog, char *fn, int angle)
+bondedtable_t make_bonded_table(FILE *fplog, const char *fn, int angle)
 {
     t_tabledata   td;
     int           i;
index 7e68fdaf2c2375ec8edcdce74c671b40d6004eb4..9236b344057acce92dfd6264182329f8858cbb73 100644 (file)
@@ -84,7 +84,7 @@ t_forcetable *make_tables(FILE *fp,
                           const char *fn, real rtab, int flags);
 /* Return tables for inner loops. */
 
-bondedtable_t make_bonded_table(FILE *fplog, char *fn, int angle);
+bondedtable_t make_bonded_table(FILE *fplog, const char *fn, int angle);
 /* Return a table for bonded interactions,
  * angle should be: bonds 0, angles 1, dihedrals 2
  */
index 864f58f8b9da447ce71a7503168368bd10fb74b4..f54aedaa9ebf0b700b632e40e2c7f7ef04414bd2 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015,2016, 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.
@@ -114,6 +114,11 @@ static inline bool contains(const std::string &str, const char *substr)
 {
     return str.find(substr) != std::string::npos;
 }
+//! \copydoc contains(const std::string &str, const char *substr)
+static inline bool contains(const std::string &str, const std::string &substr)
+{
+    return str.find(substr) != std::string::npos;
+}
 
 /*!\brief Returns number of space-separated words in zero-terminated char ptr
  *
@@ -136,6 +141,12 @@ countWords(const char *s);
 std::size_t
 countWords(const std::string &str);
 
+//! \copydoc endsWith(const std::string &str, const char *suffix)
+static inline bool endsWith(const std::string &str, const std::string &suffix)
+{
+    return endsWith(str, suffix.c_str());
+}
+
 /*! \brief
  * Removes a suffix from a string.
  *
index 9458dfbf91803983e33b4ae66f8661057fb2d4db..e56c4a14530f5317f7679cb01a585b994a40d255 100644 (file)
@@ -134,10 +134,11 @@ int gmx_mdrun(int argc, char *argv[])
         "functions is read using the [TT]-tablep[tt] option.[PAR]",
         "When tabulated bonded functions are present in the topology,",
         "interaction functions are read using the [TT]-tableb[tt] option.",
-        "For each different tabulated interaction type the table file name is",
-        "modified in a different way: before the file extension an underscore is",
-        "appended, then a 'b' for bonds, an 'a' for angles or a 'd' for dihedrals",
-        "and finally the table number of the interaction type.[PAR]",
+        "For each different tabulated interaction type used, a table file name must",
+        "be given. For the topology to work, a file name given here must match a",
+        "character sequence before the file extension. That sequence is: an underscore,",
+        "then a 'b' for bonds, an 'a' for angles or a 'd' for dihedrals,",
+        "and finally the matching table number index used in the topology.[PAR]",
         "The options [TT]-px[tt] and [TT]-pf[tt] are used for writing pull COM",
         "coordinates and forces when pulling is selected",
         "in the [REF].mdp[ref] file.[PAR]",
@@ -239,7 +240,7 @@ int gmx_mdrun(int argc, char *argv[])
         { efXVG, "-field",  "field",    ffOPTWR },
         { efXVG, "-table",  "table",    ffOPTRD },
         { efXVG, "-tablep", "tablep",   ffOPTRD },
-        { efXVG, "-tableb", "table",    ffOPTRD },
+        { efXVG, "-tableb", "table",    ffOPTRDMULT },
         { efTRX, "-rerun",  "rerun",    ffOPTRD },
         { efXVG, "-tpi",    "tpi",      ffOPTWR },
         { efXVG, "-tpid",   "tpidist",  ffOPTWR },
index 3294776ff121cf4b9ee740de07be997e6636fe2d..969a3d9513503547578f12bcbfa06c9a893b6c40 100644 (file)
@@ -1153,7 +1153,7 @@ int mdrunner(gmx_hw_opt_t *hw_opt,
         init_forcerec(fplog, fr, fcd, inputrec, mtop, cr, box,
                       opt2fn("-table", nfile, fnm),
                       opt2fn("-tablep", nfile, fnm),
-                      opt2fn("-tableb", nfile, fnm),
+                      getFilenm("-tableb", nfile, fnm),
                       nbpu_opt,
                       FALSE,
                       pforce);
index c84a5d074ddb8fbed69aafbf167dadb94b42e6e2..cfbdb09568d3d5df5f3fae98d8c62d5026b7eafe 100644 (file)
@@ -38,6 +38,7 @@ set(exename "mdrun-test")
 gmx_add_gtest_executable(
     ${exename}
     # files with code for tests
+    tabulated_bonded_interactions.cpp
     energyreader.cpp
     grompp.cpp
     rerun.cpp
diff --git a/src/programs/mdrun/tests/butane1.gro b/src/programs/mdrun/tests/butane1.gro
new file mode 100644 (file)
index 0000000..4a244a0
--- /dev/null
@@ -0,0 +1,7 @@
+A single butane
+  4
+    1BUT     C1    1   1.382   1.573   1.482
+    1BUT     C2    2   1.281   1.559   1.596
+    1BUT     C3    3   1.292   1.422   1.663
+    1BUT     C4    4   1.189   1.407   1.775
+   2.46298   2.46298   2.46298
diff --git a/src/programs/mdrun/tests/butane1.ndx b/src/programs/mdrun/tests/butane1.ndx
new file mode 100644 (file)
index 0000000..779e460
--- /dev/null
@@ -0,0 +1,2 @@
+[ System ]
+   1    2    3    4
diff --git a/src/programs/mdrun/tests/butane_a0.xvg b/src/programs/mdrun/tests/butane_a0.xvg
new file mode 100644 (file)
index 0000000..b31e3ba
--- /dev/null
@@ -0,0 +1,186 @@
+# Table was made with:
+#
+# seq 0 1 180 | awk '{print $1" "$1*3.14159265358979323846/180}' | awk '{printf "%20g %20g %20g\n", $1,
+#    0.5*460.2  *($1-111)^2,
+# -1*0.5*406.2*2*($1-111)}'
+                   0          2.83506e+06              45088.2
+                   1          2.78421e+06                44682
+                   2          2.73382e+06              44275.8
+                   3          2.68389e+06              43869.6
+                   4          2.63441e+06              43463.4
+                   5           2.5854e+06              43057.2
+                   6          2.53685e+06                42651
+                   7          2.48876e+06              42244.8
+                   8          2.44113e+06              41838.6
+                   9          2.39396e+06              41432.4
+                  10          2.34725e+06              41026.2
+                  11            2.301e+06                40620
+                  12          2.25521e+06              40213.8
+                  13          2.20988e+06              39807.6
+                  14          2.16501e+06              39401.4
+                  15           2.1206e+06              38995.2
+                  16          2.07665e+06                38589
+                  17          2.03316e+06              38182.8
+                  18          1.99013e+06              37776.6
+                  19          1.94757e+06              37370.4
+                  20          1.90546e+06              36964.2
+                  21          1.86381e+06                36558
+                  22          1.82262e+06              36151.8
+                  23          1.78189e+06              35745.6
+                  24          1.74163e+06              35339.4
+                  25          1.70182e+06              34933.2
+                  26          1.66247e+06                34527
+                  27          1.62359e+06              34120.8
+                  28          1.58516e+06              33714.6
+                  29          1.54719e+06              33308.4
+                  30          1.50969e+06              32902.2
+                  31          1.47264e+06                32496
+                  32          1.43605e+06              32089.8
+                  33          1.39993e+06              31683.6
+                  34          1.36426e+06              31277.4
+                  35          1.32906e+06              30871.2
+                  36          1.29431e+06                30465
+                  37          1.26003e+06              30058.8
+                  38           1.2262e+06              29652.6
+                  39          1.19284e+06              29246.4
+                  40          1.15993e+06              28840.2
+                  41          1.12749e+06                28434
+                  42          1.09551e+06              28027.8
+                  43          1.06398e+06              27621.6
+                  44          1.03292e+06              27215.4
+                  45          1.00232e+06              26809.2
+                  46               972172                26403
+                  47               942490              25996.8
+                  48               913267              25590.6
+                  49               884504              25184.4
+                  50               856202              24778.2
+                  51               828360                24372
+                  52               800978              23965.8
+                  53               774056              23559.6
+                  54               747595              23153.4
+                  55               721594              22747.2
+                  56               696052                22341
+                  57               670972              21934.8
+                  58               646351              21528.6
+                  59               622190              21122.4
+                  60               598490              20716.2
+                  61               575250                20310
+                  62               552470              19903.8
+                  63               530150              19497.6
+                  64               508291              19091.4
+                  65               486892              18685.2
+                  66               465952                18279
+                  67               445474              17872.8
+                  68               425455              17466.6
+                  69               405896              17060.4
+                  70               386798              16654.2
+                  71               368160                16248
+                  72               349982              15841.8
+                  73               332264              15435.6
+                  74               315007              15029.4
+                  75               298210              14623.2
+                  76               281872                14217
+                  77               265996              13810.8
+                  78               250579              13404.6
+                  79               235622              12998.4
+                  80               221126              12592.2
+                  81               207090                12186
+                  82               193514              11779.8
+                  83               180398              11373.6
+                  84               167743              10967.4
+                  85               155548              10561.2
+                  86               143812                10155
+                  87               132538               9748.8
+                  88               121723               9342.6
+                  89               111368               8936.4
+                  90               101474               8530.2
+                  91                92040                 8124
+                  92              83066.1               7717.8
+                  93              74552.4               7311.6
+                  94              66498.9               6905.4
+                  95              58905.6               6499.2
+                  96              51772.5                 6093
+                  97              45099.6               5686.8
+                  98              38886.9               5280.6
+                  99              33134.4               4874.4
+                 100              27842.1               4468.2
+                 101                23010                 4062
+                 102              18638.1               3655.8
+                 103              14726.4               3249.6
+                 104              11274.9               2843.4
+                 105               8283.6               2437.2
+                 106               5752.5                 2031
+                 107               3681.6               1624.8
+                 108               2070.9               1218.6
+                 109                920.4                812.4
+                 110                230.1                406.2
+                 111                    0                   -0
+                 112                230.1               -406.2
+                 113                920.4               -812.4
+                 114               2070.9              -1218.6
+                 115               3681.6              -1624.8
+                 116               5752.5                -2031
+                 117               8283.6              -2437.2
+                 118              11274.9              -2843.4
+                 119              14726.4              -3249.6
+                 120              18638.1              -3655.8
+                 121                23010                -4062
+                 122              27842.1              -4468.2
+                 123              33134.4              -4874.4
+                 124              38886.9              -5280.6
+                 125              45099.6              -5686.8
+                 126              51772.5                -6093
+                 127              58905.6              -6499.2
+                 128              66498.9              -6905.4
+                 129              74552.4              -7311.6
+                 130              83066.1              -7717.8
+                 131                92040                -8124
+                 132               101474              -8530.2
+                 133               111368              -8936.4
+                 134               121723              -9342.6
+                 135               132538              -9748.8
+                 136               143812               -10155
+                 137               155548             -10561.2
+                 138               167743             -10967.4
+                 139               180398             -11373.6
+                 140               193514             -11779.8
+                 141               207090               -12186
+                 142               221126             -12592.2
+                 143               235622             -12998.4
+                 144               250579             -13404.6
+                 145               265996             -13810.8
+                 146               281872               -14217
+                 147               298210             -14623.2
+                 148               315007             -15029.4
+                 149               332264             -15435.6
+                 150               349982             -15841.8
+                 151               368160               -16248
+                 152               386798             -16654.2
+                 153               405896             -17060.4
+                 154               425455             -17466.6
+                 155               445474             -17872.8
+                 156               465952               -18279
+                 157               486892             -18685.2
+                 158               508291             -19091.4
+                 159               530150             -19497.6
+                 160               552470             -19903.8
+                 161               575250               -20310
+                 162               598490             -20716.2
+                 163               622190             -21122.4
+                 164               646351             -21528.6
+                 165               670972             -21934.8
+                 166               696052               -22341
+                 167               721594             -22747.2
+                 168               747595             -23153.4
+                 169               774056             -23559.6
+                 170               800978             -23965.8
+                 171               828360               -24372
+                 172               856202             -24778.2
+                 173               884504             -25184.4
+                 174               913267             -25590.6
+                 175               942490             -25996.8
+                 176               972172               -26403
+                 177          1.00232e+06             -26809.2
+                 178          1.03292e+06             -27215.4
+                 179          1.06398e+06             -27621.6
+                 180          1.09551e+06             -28027.8
diff --git a/src/programs/mdrun/tests/butane_b0.xvg b/src/programs/mdrun/tests/butane_b0.xvg
new file mode 100644 (file)
index 0000000..2acfd98
--- /dev/null
@@ -0,0 +1,306 @@
+# Table was made with:
+#
+# seq 0 0.001 0.3 | awk '{print $1" "$1*atan2(0,-1)/180}' | awk '{printf "%20g %20g %20g\n", $1,
+#    0.5*334700  *($1-0.153)^2,
+#-1*(0.5*334700*2*($1-0.153))}'
+                   0               3917.5              51209.1
+               0.001              3866.45              50874.4
+               0.002              3815.75              50539.7
+               0.003              3765.38                50205
+               0.004              3715.34              49870.3
+               0.005              3665.63              49535.6
+               0.006              3616.27              49200.9
+               0.007              3567.23              48866.2
+               0.008              3518.53              48531.5
+               0.009              3470.17              48196.8
+                0.01              3422.14              47862.1
+               0.011              3374.45              47527.4
+               0.012              3327.09              47192.7
+               0.013              3280.06                46858
+               0.014              3233.37              46523.3
+               0.015              3187.01              46188.6
+               0.016              3140.99              45853.9
+               0.017              3095.31              45519.2
+               0.018              3049.95              45184.5
+               0.019              3004.94              44849.8
+                0.02              2960.25              44515.1
+               0.021              2915.91              44180.4
+               0.022              2871.89              43845.7
+               0.023              2828.22                43511
+               0.024              2784.87              43176.3
+               0.025              2741.86              42841.6
+               0.026              2699.19              42506.9
+               0.027              2656.85              42172.2
+               0.028              2614.84              41837.5
+               0.029              2573.17              41502.8
+                0.03              2531.84              41168.1
+               0.031              2490.84              40833.4
+               0.032              2450.17              40498.7
+               0.033              2409.84                40164
+               0.034              2369.84              39829.3
+               0.035              2330.18              39494.6
+               0.036              2290.85              39159.9
+               0.037              2251.86              38825.2
+               0.038               2213.2              38490.5
+               0.039              2174.88              38155.8
+                0.04              2136.89              37821.1
+               0.041              2099.24              37486.4
+               0.042              2061.92              37151.7
+               0.043              2024.93                36817
+               0.044              1988.29              36482.3
+               0.045              1951.97              36147.6
+               0.046              1915.99              35812.9
+               0.047              1880.34              35478.2
+               0.048              1845.03              35143.5
+               0.049              1810.06              34808.8
+                0.05              1775.42              34474.1
+               0.051              1741.11              34139.4
+               0.052              1707.14              33804.7
+               0.053               1673.5                33470
+               0.054               1640.2              33135.3
+               0.055              1607.23              32800.6
+               0.056               1574.6              32465.9
+               0.057               1542.3              32131.2
+               0.058              1510.33              31796.5
+               0.059               1478.7              31461.8
+                0.06              1447.41              31127.1
+               0.061              1416.45              30792.4
+               0.062              1385.83              30457.7
+               0.063              1355.53                30123
+               0.064              1325.58              29788.3
+               0.065              1295.96              29453.6
+               0.066              1266.67              29118.9
+               0.067              1237.72              28784.2
+               0.068               1209.1              28449.5
+               0.069              1180.82              28114.8
+                0.07              1152.87              27780.1
+               0.071              1125.26              27445.4
+               0.072              1097.98              27110.7
+               0.073              1071.04                26776
+               0.074              1044.43              26441.3
+               0.075              1018.16              26106.6
+               0.076              992.218              25771.9
+               0.077              966.614              25437.2
+               0.078              941.344              25102.5
+               0.079              916.409              24767.8
+                0.08              891.808              24433.1
+               0.081              867.542              24098.4
+               0.082              843.611              23763.7
+               0.083              820.015                23429
+               0.084              796.753              23094.3
+               0.085              773.826              22759.6
+               0.086              751.234              22424.9
+               0.087              728.977              22090.2
+               0.088              707.054              21755.5
+               0.089              685.466              21420.8
+                0.09              664.212              21086.1
+               0.091              643.293              20751.4
+               0.092              622.709              20416.7
+               0.093               602.46                20082
+               0.094              582.545              19747.3
+               0.095              562.965              19412.6
+               0.096               543.72              19077.9
+               0.097               524.81              18743.2
+               0.098              506.234              18408.5
+               0.099              487.993              18073.8
+                 0.1              470.086              17739.1
+               0.101              452.514              17404.4
+               0.102              435.277              17069.7
+               0.103              418.375                16735
+               0.104              401.807              16400.3
+               0.105              385.574              16065.6
+               0.106              369.676              15730.9
+               0.107              354.113              15396.2
+               0.108              338.884              15061.5
+               0.109               323.99              14726.8
+                0.11               309.43              14392.1
+               0.111              295.205              14057.4
+               0.112              281.315              13722.7
+               0.113               267.76                13388
+               0.114              254.539              13053.3
+               0.115              241.653              12718.6
+               0.116              229.102              12383.9
+               0.117              216.886              12049.2
+               0.118              205.004              11714.5
+               0.119              193.457              11379.8
+                0.12              182.244              11045.1
+               0.121              171.366              10710.4
+               0.122              160.823              10375.7
+               0.123              150.615                10041
+               0.124              140.741               9706.3
+               0.125              131.202               9371.6
+               0.126              121.998               9036.9
+               0.127              113.129               8702.2
+               0.128              104.594               8367.5
+               0.129              96.3936               8032.8
+                0.13              88.5281               7698.1
+               0.131              80.9974               7363.4
+               0.132              73.8013               7028.7
+               0.133                66.94                 6694
+               0.134              60.4133               6359.3
+               0.135              54.2214               6024.6
+               0.136              48.3641               5689.9
+               0.137              42.8416               5355.2
+               0.138              37.6537               5020.5
+               0.139              32.8006               4685.8
+                0.14              28.2821               4351.1
+               0.141              24.0984               4016.4
+               0.142              20.2494               3681.7
+               0.143               16.735                 3347
+               0.144              13.5554               3012.3
+               0.145              10.7104               2677.6
+               0.146              8.20015               2342.9
+               0.147               6.0246               2008.2
+               0.148              4.18375               1673.5
+               0.149               2.6776               1338.8
+                0.15              1.50615               1004.1
+               0.151               0.6694                669.4
+               0.152              0.16735                334.7
+               0.153                    0                   -0
+               0.154              0.16735               -334.7
+               0.155               0.6694               -669.4
+               0.156              1.50615              -1004.1
+               0.157               2.6776              -1338.8
+               0.158              4.18375              -1673.5
+               0.159               6.0246              -2008.2
+                0.16              8.20015              -2342.9
+               0.161              10.7104              -2677.6
+               0.162              13.5554              -3012.3
+               0.163               16.735                -3347
+               0.164              20.2494              -3681.7
+               0.165              24.0984              -4016.4
+               0.166              28.2822              -4351.1
+               0.167              32.8006              -4685.8
+               0.168              37.6538              -5020.5
+               0.169              42.8416              -5355.2
+                0.17              48.3642              -5689.9
+               0.171              54.2214              -6024.6
+               0.172              60.4133              -6359.3
+               0.173                66.94                -6694
+               0.174              73.8013              -7028.7
+               0.175              80.9974              -7363.4
+               0.176              88.5281              -7698.1
+               0.177              96.3936              -8032.8
+               0.178              104.594              -8367.5
+               0.179              113.129              -8702.2
+                0.18              121.998              -9036.9
+               0.181              131.202              -9371.6
+               0.182              140.741              -9706.3
+               0.183              150.615               -10041
+               0.184              160.823             -10375.7
+               0.185              171.366             -10710.4
+               0.186              182.244             -11045.1
+               0.187              193.457             -11379.8
+               0.188              205.004             -11714.5
+               0.189              216.886             -12049.2
+                0.19              229.102             -12383.9
+               0.191              241.653             -12718.6
+               0.192              254.539             -13053.3
+               0.193               267.76               -13388
+               0.194              281.315             -13722.7
+               0.195              295.205             -14057.4
+               0.196               309.43             -14392.1
+               0.197               323.99             -14726.8
+               0.198              338.884             -15061.5
+               0.199              354.113             -15396.2
+                 0.2              369.676             -15730.9
+               0.201              385.574             -16065.6
+               0.202              401.807             -16400.3
+               0.203              418.375               -16735
+               0.204              435.277             -17069.7
+               0.205              452.514             -17404.4
+               0.206              470.086             -17739.1
+               0.207              487.993             -18073.8
+               0.208              506.234             -18408.5
+               0.209               524.81             -18743.2
+                0.21               543.72             -19077.9
+               0.211              562.965             -19412.6
+               0.212              582.545             -19747.3
+               0.213               602.46               -20082
+               0.214              622.709             -20416.7
+               0.215              643.293             -20751.4
+               0.216              664.212             -21086.1
+               0.217              685.466             -21420.8
+               0.218              707.054             -21755.5
+               0.219              728.977             -22090.2
+                0.22              751.234             -22424.9
+               0.221              773.826             -22759.6
+               0.222              796.753             -23094.3
+               0.223              820.015               -23429
+               0.224              843.611             -23763.7
+               0.225              867.542             -24098.4
+               0.226              891.808             -24433.1
+               0.227              916.409             -24767.8
+               0.228              941.344             -25102.5
+               0.229              966.614             -25437.2
+                0.23              992.218             -25771.9
+               0.231              1018.16             -26106.6
+               0.232              1044.43             -26441.3
+               0.233              1071.04               -26776
+               0.234              1097.98             -27110.7
+               0.235              1125.26             -27445.4
+               0.236              1152.87             -27780.1
+               0.237              1180.82             -28114.8
+               0.238               1209.1             -28449.5
+               0.239              1237.72             -28784.2
+                0.24              1266.67             -29118.9
+               0.241              1295.96             -29453.6
+               0.242              1325.58             -29788.3
+               0.243              1355.53               -30123
+               0.244              1385.83             -30457.7
+               0.245              1416.45             -30792.4
+               0.246              1447.41             -31127.1
+               0.247               1478.7             -31461.8
+               0.248              1510.33             -31796.5
+               0.249               1542.3             -32131.2
+                0.25               1574.6             -32465.9
+               0.251              1607.23             -32800.6
+               0.252               1640.2             -33135.3
+               0.253               1673.5               -33470
+               0.254              1707.14             -33804.7
+               0.255              1741.11             -34139.4
+               0.256              1775.42             -34474.1
+               0.257              1810.06             -34808.8
+               0.258              1845.03             -35143.5
+               0.259              1880.34             -35478.2
+                0.26              1915.99             -35812.9
+               0.261              1951.97             -36147.6
+               0.262              1988.29             -36482.3
+               0.263              2024.94               -36817
+               0.264              2061.92             -37151.7
+               0.265              2099.24             -37486.4
+               0.266              2136.89             -37821.1
+               0.267              2174.88             -38155.8
+               0.268               2213.2             -38490.5
+               0.269              2251.86             -38825.2
+                0.27              2290.85             -39159.9
+               0.271              2330.18             -39494.6
+               0.272              2369.84             -39829.3
+               0.273              2409.84               -40164
+               0.274              2450.17             -40498.7
+               0.275              2490.84             -40833.4
+               0.276              2531.84             -41168.1
+               0.277              2573.17             -41502.8
+               0.278              2614.84             -41837.5
+               0.279              2656.85             -42172.2
+                0.28              2699.19             -42506.9
+               0.281              2741.86             -42841.6
+               0.282              2784.87             -43176.3
+               0.283              2828.21               -43511
+               0.284              2871.89             -43845.7
+               0.285              2915.91             -44180.4
+               0.286              2960.25             -44515.1
+               0.287              3004.94             -44849.8
+               0.288              3049.95             -45184.5
+               0.289              3095.31             -45519.2
+                0.29              3140.99             -45853.9
+               0.291              3187.01             -46188.6
+               0.292              3233.37             -46523.3
+               0.293              3280.06               -46858
+               0.294              3327.09             -47192.7
+               0.295              3374.45             -47527.4
+               0.296              3422.14             -47862.1
+               0.297              3470.17             -48196.8
+               0.298              3518.53             -48531.5
+               0.299              3567.23             -48866.2
+                 0.3              3616.27             -49200.9
diff --git a/src/programs/mdrun/tests/butane_d0.xvg b/src/programs/mdrun/tests/butane_d0.xvg
new file mode 100644 (file)
index 0000000..d814ecc
--- /dev/null
@@ -0,0 +1,366 @@
+# Table was made with:
+#
+# seq -180 1 180 | awk '{print $1" "$1*3.14159265358979323846/180}' | awk '{printf "%20g %20g %20g\n", $1,
+#     9.2789 -12.156*cos($2) -13.12  *cos($2)^2       +3.0597          *cos($2)^3 +26.24          *cos($2)^4 +31.495          *cos($2)^5,
+# -1*(0.0    +12.156*sin($2) +13.12*2*sin($2)*cos($2) -3.0597*3*sin($2)*cos($2)^2 -26.24*4*sin($2)*cos($2)^3 -31.495*5*sin($2)*cos($2)^4)*3.14159265358979323846/180}'
+                -180               0.0002         -3.50958e-06
+                -179            0.0117364           -0.0230646
+                -178            0.0462849           -0.0460188
+                -177             0.103725           -0.0687729
+                -176             0.183725           -0.0911958
+                -175             0.285942            -0.113198
+                -174             0.409982            -0.134691
+                -173             0.555133            -0.155555
+                -172             0.720796            -0.175708
+                -171             0.906328            -0.195073
+                -170              1.11068            -0.213546
+                -169              1.33302             -0.23106
+                -168              1.57251            -0.247553
+                -167               1.8278            -0.262942
+                -166              2.09791            -0.277178
+                -165              2.38182            -0.290217
+                -164              2.67798            -0.302002
+                -163              2.98528            -0.312505
+                -162              3.30261            -0.321703
+                -161               3.6283            -0.329565
+                -160              3.96117            -0.336087
+                -159              4.30009            -0.341266
+                -158              4.64332              -0.3451
+                -157              4.98972            -0.347605
+                -156              5.33816            -0.348799
+                -155              5.68696            -0.348709
+                -154              6.03503            -0.347368
+                -153              6.38136            -0.344815
+                -152              6.72434            -0.341099
+                -151              7.06305            -0.336269
+                -150              7.39659            -0.330381
+                -149              7.72355            -0.323501
+                -148              8.04316            -0.315694
+                -147              8.35471            -0.307022
+                -146              8.65701             -0.29757
+                -145               8.9495            -0.287406
+                -144              9.23166              -0.2766
+                -143              9.50258            -0.265244
+                -142              9.76189            -0.253409
+                -141              10.0093            -0.241165
+                -140              10.2442            -0.228604
+                -139              10.4663            -0.215795
+                -138              10.6757            -0.202803
+                -137               10.872            -0.189716
+                -136              11.0551            -0.176593
+                -135              11.2252            -0.163492
+                -134              11.3821            -0.150489
+                -133              11.5262            -0.137633
+                -132              11.6575            -0.124966
+                -131              11.7762            -0.112551
+                -130              11.8826            -0.100421
+                -129              11.9772            -0.088605
+                -128                12.06           -0.0771457
+                -127              12.1315           -0.0660604
+                -126              12.1922           -0.0553611
+                -125              12.2424           -0.0450721
+                -124              12.2825           -0.0351936
+                -123              12.3129           -0.0257211
+                -122              12.3341           -0.0166606
+                -121              12.3464           -0.0079967
+                -120              12.3502          0.000285479
+                -119              12.3459            0.0082098
+                -118              12.3339            0.0157908
+                -117              12.3145            0.0230605
+                -116              12.2879            0.0300535
+                -115              12.2544            0.0367953
+                -114              12.2144            0.0433255
+                -113              12.1678            0.0496852
+                -112               12.115            0.0559055
+                -111              12.0561            0.0620291
+                -110               11.991            0.0680983
+                -109              11.9199            0.0741442
+                -108              11.8427            0.0802072
+                -107              11.7594            0.0863256
+                -106                11.67            0.0925247
+                -105              11.5744            0.0988373
+                -104              11.4723             0.105293
+                -103              11.3637             0.111905
+                -102              11.2485             0.118694
+                -101              11.1262             0.125676
+                -100               10.997             0.132848
+                 -99              10.8605             0.140216
+                 -98              10.7165             0.147777
+                 -97              10.5649             0.155511
+                 -96              10.4055             0.163403
+                 -95               10.238             0.171431
+                 -94              10.0626             0.179554
+                 -93              9.87895             0.187737
+                 -92              9.68703              0.19594
+                 -91              9.48705             0.204099
+                 -90              9.27894             0.212161
+                 -89              9.06273             0.220064
+                 -88              8.83886             0.227729
+                 -87              8.60746             0.235085
+                 -86              8.36877             0.242053
+                 -85              8.12347              0.24854
+                 -84              7.87197              0.25446
+                 -83              7.61472             0.259724
+                 -82              7.35273             0.264231
+                 -81              7.08664             0.267886
+                 -80              6.81722             0.270593
+                 -79              6.54575              0.27225
+                 -78               6.2732             0.272762
+                 -77              6.00059             0.272031
+                 -76              5.72953             0.269964
+                 -75              5.46124              0.26647
+                 -74              5.19705             0.261459
+                 -73               4.9388             0.254855
+                 -72              4.68799             0.246579
+                 -71              4.44618             0.236556
+                 -70              4.21543             0.224734
+                 -69              3.99742             0.211054
+                 -68              3.79392             0.195462
+                 -67              3.60709              0.17794
+                 -66              3.43876             0.158455
+                 -65              3.29082             0.136979
+                 -64              3.16543             0.113534
+                 -63              3.06446            0.0881168
+                 -62              2.98984            0.0607332
+                 -61               2.9436            0.0314479
+                 -60              2.92758          0.000292252
+                 -59              2.94364           -0.0326936
+                 -58              2.99354           -0.0673993
+                 -57              3.07898            -0.103762
+                 -56              3.20158            -0.141684
+                 -55              3.36283            -0.181048
+                 -54              3.56411            -0.221732
+                 -53              3.80668            -0.263602
+                 -52              4.09167            -0.306512
+                 -51                 4.42              -0.3503
+                 -50              4.79249            -0.394799
+                 -49              5.20979            -0.439836
+                 -48              5.67229            -0.485217
+                 -47              6.18026            -0.530751
+                 -46              6.73379             -0.57624
+                 -45              7.33267            -0.621471
+                 -44              7.97655            -0.666233
+                 -43              8.66488            -0.710312
+                 -42               9.3969            -0.753491
+                 -41              10.1715            -0.795545
+                 -40              10.9875            -0.836257
+                 -39              11.8435             -0.87541
+                 -38              12.7378            -0.912784
+                 -37              13.6684            -0.948167
+                 -36              14.6333            -0.981352
+                 -35              15.6303             -1.01214
+                 -34              16.6568             -1.04033
+                 -33                17.71             -1.06575
+                 -32              18.7873             -1.08821
+                 -31              19.8854             -1.10755
+                 -30              21.0013             -1.12362
+                 -29              22.1315             -1.13628
+                 -28              23.2727              -1.1454
+                 -27              24.4211             -1.15088
+                 -26              25.5732             -1.15263
+                 -25              26.7251             -1.15055
+                 -24               27.873             -1.14461
+                 -23               29.013             -1.13474
+                 -22              30.1412             -1.12093
+                 -21              31.2536             -1.10317
+                 -20              32.3462             -1.08149
+                 -19              33.4152             -1.05589
+                 -18              34.4567             -1.02645
+                 -17              35.4669            -0.993229
+                 -16              36.4419            -0.956317
+                 -15              37.3783            -0.915818
+                 -14              38.2724            -0.871864
+                 -13              39.1209            -0.824594
+                 -12              39.9205            -0.774168
+                 -11              40.6683            -0.720759
+                 -10              41.3611            -0.664564
+                  -9              41.9965            -0.605784
+                  -8              42.5719            -0.544635
+                  -7              43.0851            -0.481355
+                  -6               43.534            -0.416182
+                  -5              43.9169            -0.349366
+                  -4              44.2323            -0.281169
+                  -3              44.4789            -0.211859
+                  -2              44.6557            -0.141708
+                  -1              44.7621           -0.0709953
+                   0              44.7976                   -0
+                   1              44.7621            0.0709953
+                   2              44.6557             0.141708
+                   3              44.4789             0.211859
+                   4              44.2323             0.281169
+                   5              43.9169             0.349366
+                   6               43.534             0.416182
+                   7              43.0851             0.481355
+                   8              42.5719             0.544635
+                   9              41.9965             0.605784
+                  10              41.3611             0.664564
+                  11              40.6683             0.720759
+                  12              39.9205             0.774168
+                  13              39.1209             0.824594
+                  14              38.2724             0.871864
+                  15              37.3783             0.915818
+                  16              36.4419             0.956317
+                  17              35.4669             0.993229
+                  18              34.4567              1.02645
+                  19              33.4152              1.05589
+                  20              32.3462              1.08149
+                  21              31.2536              1.10317
+                  22              30.1412              1.12093
+                  23               29.013              1.13474
+                  24               27.873              1.14461
+                  25              26.7251              1.15055
+                  26              25.5732              1.15263
+                  27              24.4211              1.15088
+                  28              23.2727               1.1454
+                  29              22.1315              1.13628
+                  30              21.0013              1.12362
+                  31              19.8854              1.10755
+                  32              18.7873              1.08821
+                  33                17.71              1.06575
+                  34              16.6568              1.04033
+                  35              15.6303              1.01214
+                  36              14.6333             0.981352
+                  37              13.6684             0.948167
+                  38              12.7378             0.912784
+                  39              11.8435              0.87541
+                  40              10.9875             0.836257
+                  41              10.1715             0.795545
+                  42               9.3969             0.753491
+                  43              8.66488             0.710312
+                  44              7.97655             0.666233
+                  45              7.33267             0.621471
+                  46              6.73379              0.57624
+                  47              6.18026             0.530751
+                  48              5.67229             0.485217
+                  49              5.20979             0.439836
+                  50              4.79249             0.394799
+                  51                 4.42               0.3503
+                  52              4.09167             0.306512
+                  53              3.80668             0.263602
+                  54              3.56411             0.221732
+                  55              3.36283             0.181048
+                  56              3.20158             0.141684
+                  57              3.07898             0.103762
+                  58              2.99354            0.0673993
+                  59              2.94364            0.0326936
+                  60              2.92758         -0.000292252
+                  61               2.9436           -0.0314479
+                  62              2.98984           -0.0607332
+                  63              3.06446           -0.0881168
+                  64              3.16543            -0.113534
+                  65              3.29082            -0.136979
+                  66              3.43876            -0.158455
+                  67              3.60709             -0.17794
+                  68              3.79392            -0.195462
+                  69              3.99742            -0.211054
+                  70              4.21543            -0.224734
+                  71              4.44618            -0.236556
+                  72              4.68799            -0.246579
+                  73               4.9388            -0.254855
+                  74              5.19705            -0.261459
+                  75              5.46124             -0.26647
+                  76              5.72953            -0.269964
+                  77              6.00059            -0.272031
+                  78               6.2732            -0.272762
+                  79              6.54575             -0.27225
+                  80              6.81722            -0.270593
+                  81              7.08664            -0.267886
+                  82              7.35273            -0.264231
+                  83              7.61472            -0.259724
+                  84              7.87197             -0.25446
+                  85              8.12347             -0.24854
+                  86              8.36877            -0.242053
+                  87              8.60746            -0.235085
+                  88              8.83886            -0.227729
+                  89              9.06273            -0.220064
+                  90              9.27894            -0.212161
+                  91              9.48705            -0.204099
+                  92              9.68703             -0.19594
+                  93              9.87895            -0.187737
+                  94              10.0626            -0.179554
+                  95               10.238            -0.171431
+                  96              10.4055            -0.163403
+                  97              10.5649            -0.155511
+                  98              10.7165            -0.147777
+                  99              10.8605            -0.140216
+                 100               10.997            -0.132848
+                 101              11.1262            -0.125676
+                 102              11.2485            -0.118694
+                 103              11.3637            -0.111905
+                 104              11.4723            -0.105293
+                 105              11.5744           -0.0988373
+                 106                11.67           -0.0925247
+                 107              11.7594           -0.0863256
+                 108              11.8427           -0.0802072
+                 109              11.9199           -0.0741442
+                 110               11.991           -0.0680983
+                 111              12.0561           -0.0620291
+                 112               12.115           -0.0559055
+                 113              12.1678           -0.0496852
+                 114              12.2144           -0.0433255
+                 115              12.2544           -0.0367953
+                 116              12.2879           -0.0300535
+                 117              12.3145           -0.0230605
+                 118              12.3339           -0.0157908
+                 119              12.3459           -0.0082098
+                 120              12.3502         -0.000285479
+                 121              12.3464            0.0079967
+                 122              12.3341            0.0166606
+                 123              12.3129            0.0257211
+                 124              12.2825            0.0351936
+                 125              12.2424            0.0450721
+                 126              12.1922            0.0553611
+                 127              12.1315            0.0660604
+                 128                12.06            0.0771457
+                 129              11.9772             0.088605
+                 130              11.8826             0.100421
+                 131              11.7762             0.112551
+                 132              11.6575             0.124966
+                 133              11.5262             0.137633
+                 134              11.3821             0.150489
+                 135              11.2252             0.163492
+                 136              11.0551             0.176593
+                 137               10.872             0.189716
+                 138              10.6757             0.202803
+                 139              10.4663             0.215795
+                 140              10.2442             0.228604
+                 141              10.0093             0.241165
+                 142              9.76189             0.253409
+                 143              9.50258             0.265244
+                 144              9.23166               0.2766
+                 145               8.9495             0.287406
+                 146              8.65701              0.29757
+                 147              8.35471             0.307022
+                 148              8.04316             0.315694
+                 149              7.72355             0.323501
+                 150              7.39659             0.330381
+                 151              7.06305             0.336269
+                 152              6.72434             0.341099
+                 153              6.38136             0.344815
+                 154              6.03503             0.347368
+                 155              5.68696             0.348709
+                 156              5.33816             0.348799
+                 157              4.98972             0.347605
+                 158              4.64332               0.3451
+                 159              4.30009             0.341266
+                 160              3.96117             0.336087
+                 161               3.6283             0.329565
+                 162              3.30261             0.321703
+                 163              2.98528             0.312505
+                 164              2.67798             0.302002
+                 165              2.38182             0.290217
+                 166              2.09791             0.277178
+                 167               1.8278             0.262942
+                 168              1.57251             0.247553
+                 169              1.33302              0.23106
+                 170              1.11068             0.213546
+                 171             0.906328             0.195073
+                 172             0.720796             0.175708
+                 173             0.555133             0.155555
+                 174             0.409982             0.134691
+                 175             0.285942             0.113198
+                 176             0.183725            0.0911958
+                 177             0.103725            0.0687729
+                 178            0.0462849            0.0460188
+                 179            0.0117364            0.0230646
+                 180               0.0002          3.50958e-06
diff --git a/src/programs/mdrun/tests/tabulated_bonded_interactions.cpp b/src/programs/mdrun/tests/tabulated_bonded_interactions.cpp
new file mode 100644 (file)
index 0000000..4e18b66
--- /dev/null
@@ -0,0 +1,209 @@
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 2016, 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 tabulated bonded interactions
+ *
+ * \author Mark Abraham <mark.j.abraham@gmail.com>
+ * \ingroup module_mdrun_integration_tests
+ */
+#include "gmxpre.h"
+
+#include <gtest/gtest.h>
+
+#include "gromacs/utility/stringutil.h"
+#include "gromacs/utility/textwriter.h"
+
+#include "testutils/cmdlinetest.h"
+
+#include "moduletest.h"
+
+namespace gmx
+{
+namespace test
+{
+
+//! Format string for building a configurable .top file
+const char *g_butaneTopFileFormatString = "\
+[ defaults ]\n\
+; nbfunc       comb-rule       gen-pairs       fudgeLJ fudgeQQ\n\
+  1            1               no              1.0     1.0\n\
+\n\
+[ atomtypes ]\n\
+;name        mass      charge   ptype            c6           c12\n\
+  CH2    14.02700       0.000       A   0.90975E-02   0.35333E-04\n\
+  CH3    15.03500       0.000       A   0.88765E-02   0.26150E-04\n\
+\n\
+[ moleculetype ]\n\
+;             name    nrexcl\n\
+            butane   3\n\
+\n\
+[ atoms ]\n\
+;   nr    type   resnr  residu    atom    cgnr\n\
+     1     CH3       1     BUT      C1       1\n\
+     2     CH2       1     BUT      C2       2\n\
+     3     CH2       1     BUT      C3       3\n\
+     4     CH3       1     BUT      C4       4\n\
+\n\
+%s\n\
+\n\
+[ system ]\n\
+; The name of the system to be simulated\n\
+A single butane\n\
+\n\
+[ molecules ]\n\
+; Molname             Number\n\
+Butane                   1\n\
+";
+
+//! Test fixture for bonded interactions
+class BondedInteractionsTest : public gmx::test::MdrunTestFixture
+{
+    public:
+        //! Execute the trajectory writing test
+        void setupGrompp(const char *interaction)
+        {
+            runner_.topFileName_ = fileManager_.getTemporaryFilePath("butane1.top");
+            TextWriter::writeFileFromString(runner_.topFileName_, formatString(g_butaneTopFileFormatString, interaction));
+            runner_.groFileName_ = fileManager_.getInputFilePath("butane1.gro");
+            runner_.ndxFileName_ = fileManager_.getInputFilePath("butane1.ndx");
+            /* TODO Now that Verlet is the default, change the implementation
+               of useEmptyMdpFile() to do that. */
+            runner_.useStringAsMdpFile("");
+        }
+        //! Prepare an mdrun caller
+        CommandLine setupMdrun()
+        {
+            CommandLine rerunCaller;
+            rerunCaller.append("mdrun");
+            rerunCaller.addOption("-rerun", runner_.groFileName_);
+            return rerunCaller;
+        }
+        //! Check the output of mdrun
+        void checkMdrun()
+        {
+            // TODO verifying some energies and forces would be good,
+            // once other code in gerrit is reviewed
+        }
+};
+
+// This test ensures that a normal non-tabulated bond interaction works
+TEST_F(BondedInteractionsTest, NormalBondWorks)
+{
+    setupGrompp("[ bonds ]\n\
+;  ai    aj funct           c0           c1\n\
+    1     2     1 1.530000e-01 3.347000e+05");
+    EXPECT_EQ(0, runner_.callGrompp());
+
+    test::CommandLine rerunCaller = setupMdrun();
+    ASSERT_EQ(0, runner_.callMdrun(rerunCaller));
+    checkMdrun();
+}
+
+// This test ensures that a normal abulated bond interaction works
+TEST_F(BondedInteractionsTest, TabulatedBondWorks)
+{
+    setupGrompp("[ bonds ]\n\
+;  ai    aj funct  n     k\n\
+    1     2     8  0  1000");
+    EXPECT_EQ(0, runner_.callGrompp());
+
+    test::CommandLine rerunCaller   = setupMdrun();
+    std::string       tableFileName = fileManager_.getInputFilePath("butane_b0.xvg");
+    rerunCaller.addOption("-tableb", tableFileName);
+    ASSERT_EQ(0, runner_.callMdrun(rerunCaller));
+    checkMdrun();
+}
+
+// This test ensures that a normal non-tabulated angle interaction works
+TEST_F(BondedInteractionsTest, NormalAngleWorks)
+{
+    setupGrompp("[ angles ]\n\
+;  ai    aj    ak funct           c0           c1\n\
+    1     2     3     1 1.110000e+02 4.602000e+02");
+    EXPECT_EQ(0, runner_.callGrompp());
+
+    test::CommandLine rerunCaller = setupMdrun();
+    ASSERT_EQ(0, runner_.callMdrun(rerunCaller));
+    checkMdrun();
+}
+
+// This test ensures that a tabulated angle interaction works
+TEST_F(BondedInteractionsTest, TabulatedAngleWorks)
+{
+    setupGrompp("[ angles ]\n\
+;  ai    aj    ak funct  n     k\n\
+    1     2     3     8  0  1000");
+    EXPECT_EQ(0, runner_.callGrompp());
+
+    test::CommandLine rerunCaller   = setupMdrun();
+    std::string       tableFileName = fileManager_.getInputFilePath("butane_a0.xvg");
+    rerunCaller.addOption("-tableb", tableFileName);
+    ASSERT_EQ(0, runner_.callMdrun(rerunCaller));
+    checkMdrun();
+}
+
+// This test ensures that a normal non-tabulated dihedral interaction works
+TEST_F(BondedInteractionsTest, NormalDihedralWorks)
+{
+    setupGrompp("[ dihedrals ]\n \
+;  ai    aj    ak    al funct     c0     c1     c2      c3     c4      c5\n\
+    1     2     3     4     3 9.2789 12.156 -13.12 -3.0597  26.24 -31.495");
+    EXPECT_EQ(0, runner_.callGrompp());
+
+    test::CommandLine rerunCaller = setupMdrun();
+    ASSERT_EQ(0, runner_.callMdrun(rerunCaller));
+    checkMdrun();
+}
+
+// This test ensures that a tabulated dihedral interaction works
+TEST_F(BondedInteractionsTest, TabulatedDihedralWorks)
+{
+    setupGrompp("[ dihedrals ]\n\
+;  ai    aj    ak    al funct   n     k\n\
+    1     2     3     4     8   0  1000");
+    EXPECT_EQ(0, runner_.callGrompp());
+
+    test::CommandLine rerunCaller   = setupMdrun();
+    std::string       tableFileName = fileManager_.getInputFilePath("butane_d0.xvg");
+    rerunCaller.addOption("-tableb", tableFileName);
+    ASSERT_EQ(0, runner_.callMdrun(rerunCaller));
+    checkMdrun();
+}
+
+} // namespace
+
+} // namespace