Merge "Merge release-2018 into master"
authorMark Abraham <mark.j.abraham@gmail.com>
Fri, 6 Jul 2018 13:32:27 +0000 (15:32 +0200)
committerMark Abraham <mark.j.abraham@gmail.com>
Fri, 6 Jul 2018 13:32:27 +0000 (15:32 +0200)
63 files changed:
CMakeLists.txt
README
admin/copyright.py
cmake/gmxVersionInfo.cmake
docs/CMakeLists.txt
docs/dev-manual/build-system.rst
docs/dev-manual/relocatable-binaries.rst
docs/install-guide/index.rst
docs/release-notes/2018/2018.2.rst
docs/release-notes/2018/2018.3.rst [new file with mode: 0644]
docs/release-notes/index.rst
scripts/CMakeLists.txt
scripts/GMXRC.bash.cmakein
scripts/GMXRC.cmakein
scripts/GMXRC.csh.cmakein
scripts/GMXRC.zsh.cmakein
share/CMakeLists.txt
share/template/CMakeLists.txt
src/buildinfo.h.cmakein
src/config.h.cmakein
src/external/build-fftw/CMakeLists.txt
src/gromacs/CMakeLists.txt
src/gromacs/InstallLibInfo.cmake
src/gromacs/awh/bias.cpp
src/gromacs/awh/biasparams.cpp
src/gromacs/awh/biasparams.h
src/gromacs/awh/biasstate.cpp
src/gromacs/awh/grid.cpp
src/gromacs/awh/read-params.cpp
src/gromacs/commandline/cmdlineprogramcontext.cpp
src/gromacs/fileio/confio.cpp
src/gromacs/fileio/pdbio.cpp
src/gromacs/fileio/pdbio.h
src/gromacs/fileio/trxio.cpp
src/gromacs/gmxana/gmx_do_dssp.cpp
src/gromacs/gmxana/gmx_editconf.cpp
src/gromacs/gmxana/gmx_enemat.cpp
src/gromacs/gmxana/gmx_mindist.cpp
src/gromacs/gmxpreprocess/solvate.cpp
src/gromacs/gpu_utils/gpu_utils.cu
src/gromacs/gpu_utils/gpu_utils.h
src/gromacs/gpu_utils/ocl_compiler.cpp
src/gromacs/hardware/detecthardware.cpp
src/gromacs/libgromacs.pc.cmakein
src/gromacs/mdlib/constr.cpp
src/gromacs/mdlib/gmx_omp_nthreads.cpp
src/gromacs/mdlib/gmx_omp_nthreads.h
src/gromacs/mdlib/md_support.cpp
src/gromacs/mdlib/nbnxn_cuda/nbnxn_cuda.cu
src/gromacs/mdlib/vcm.cpp
src/gromacs/mdlib/vcm.h
src/gromacs/mdrun/minimize.cpp
src/gromacs/mdrun/runner.cpp
src/gromacs/pbcutil/boxutilities.cpp
src/gromacs/pbcutil/boxutilities.h
src/gromacs/pbcutil/mshift.cpp
src/gromacs/pbcutil/mshift.h
src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_simd_double.h
src/gromacs/simd/impl_ibm_vsx/impl_ibm_vsx_util_double.h
src/gromacs/taskassignment/resourcedivision.cpp
src/gromacs/taskassignment/resourcedivision.h
src/gromacs/utility/datafilefinder.cpp
src/programs/CMakeLists.txt

index 1fa840d567f317757bd57cfb232472870cf9f004..ca0fc3531ac63842b1b8d9140dee585ad6e2f5c6 100644 (file)
@@ -805,36 +805,28 @@ else()
     set(GMX_SHARED_LINKER_FLAGS ${GMX_SHARED_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS})
 endif()
 
+
 ########################################################################
 # Specify install locations
 ########################################################################
 # Use GNUInstallDirs to set paths on multiarch systems.
 include(GNUInstallDirs)
 
-# Customization for the installation tree paths.
-set(GMX_LIB_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING
-    "Library installation directory (default: ${CMAKE_INSTALL_LIBDIR})")
-set(GMX_DATA_INSTALL_DIR gromacs CACHE STRING
-    "Data installation directory under share/ (default: gromacs)")
-mark_as_advanced(GMX_LIB_INSTALL_DIR GMX_DATA_INSTALL_DIR)
-
-# These variables are used internally to provide a central location for
-# customizing the install locations.
-set(LIB_INSTALL_DIR       ${GMX_LIB_INSTALL_DIR})
-set(BIN_INSTALL_DIR       bin)
-# This variable also gets written into config.h for use in finding the data
-# directories.
-set(DATA_INSTALL_DIR      share/${GMX_DATA_INSTALL_DIR})
-set(MAN_INSTALL_DIR       share/man)
+set(GMX_INSTALL_DATASUBDIR "gromacs" CACHE STRING "Subdirectory for GROMACS data under CMAKE_INSTALL_DATADIR")
+mark_as_advanced(GMX_INSTALL_DATASUBDIR)
+
+# Internal convenience so we do not have to join two path segments in the code
+set(GMX_INSTALL_GMXDATADIR ${CMAKE_INSTALL_DATADIR}/${GMX_INSTALL_DATASUBDIR})
+
 # If the nesting level wrt. the installation root is changed,
 # gromacs-config.cmake.cmakein needs to be adapted.
-set(CMAKE_INSTALL_DIR     share/cmake)
+set(GMX_INSTALL_CMAKEDIR  ${CMAKE_INSTALL_DATAROOTDIR}/cmake)
+
 # TODO: Make GMXRC adapt if this is changed
-set(PKGCONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/pkgconfig)
-set(OCL_INSTALL_DIR       ${DATA_INSTALL_DIR}/opencl)
-set(INCL_INSTALL_DIR      include)
+set(GMX_INSTALL_PKGCONFIGDIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
+set(GMX_INSTALL_OCLDIR       ${GMX_INSTALL_GMXDATADIR}/opencl)
 
-list(APPEND INSTALLED_HEADER_INCLUDE_DIRS ${INCL_INSTALL_DIR})
+list(APPEND INSTALLED_HEADER_INCLUDE_DIRS ${CMAKE_INSTALL_INCLUDEDIR})
 
 # Binary and library suffix options
 include(gmxManageSuffixes)
@@ -852,7 +844,7 @@ else()
     # install to lib/, then the installation RPATH works also in the build
     # tree.  This makes installation slightly faster (no need to rewrite the
     # RPATHs), and makes the binaries in the build tree relocatable.
-    if(GMX_LIB_INSTALL_DIR STREQUAL "lib")
+    if(CMAKE_INSTALL_LIBDIR STREQUAL "lib")
         set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
         if(POLICY CMP0068)
             cmake_policy(SET CMP0068 NEW) # From CMake-3.9
@@ -862,10 +854,10 @@ else()
     # Set the RPATH as relative to the executable location to make the
     # binaries relocatable.
     if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") #Assume OS X >=10.5
-        set(CMAKE_INSTALL_RPATH "@executable_path/../${GMX_LIB_INSTALL_DIR}")
+        set(CMAKE_INSTALL_RPATH "@executable_path/../${CMAKE_INSTALL_LIBDIR}")
         set(CMAKE_INSTALL_NAME_DIR ${CMAKE_INSTALL_RPATH})
     else()
-        set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${GMX_LIB_INSTALL_DIR}")
+        set(CMAKE_INSTALL_RPATH "\$ORIGIN/../${CMAKE_INSTALL_LIBDIR}")
     endif()
     set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
     set(CMAKE_MACOSX_RPATH 1)
@@ -873,7 +865,7 @@ endif()
 
 #COPYING file: Only necessary for binary distributions.
 #Simpler to always install.
-install(FILES COPYING DESTINATION ${DATA_INSTALL_DIR} COMPONENT data)
+install(FILES COPYING DESTINATION ${GMX_INSTALL_GMXDATADIR} COMPONENT data)
 
 if (GMX_BUILD_FOR_COVERAGE)
     # Code heavy with asserts makes conditional coverage close to useless metric,
diff --git a/README b/README
index f2e3b302b1eea1f2c3fb66cc96ed30770096f544..808d71ae66f0b3d3beb91d3be59ddefae2379740 100644 (file)
--- a/README
+++ b/README
@@ -49,13 +49,13 @@ To help us fund development, we humbly ask that you cite the GROMACS papers:
 * GROMACS: A message-passing parallel molecular dynamics implementation
   H.J.C. Berendsen, D. van der Spoel and R. van Drunen
   Comp. Phys. Comm. 91, 43-56 (1995)
-  DOI: 10.1016/0010-4655(95)00042-E
+  DOI: https://doi.org/10.1016/0010-4655(95)00042-E
  
 * GROMACS 4: Algorithms for highly efficient, load-balanced, and scalable
   molecular simulation
   B. Hess and C. Kutzner and D. van der Spoel and E. Lindahl
   J. Chem. Theory Comput. 4 (2008) pp. 435-447
-  DOI: 10.1021/ct700301q
+  DOI: https://doi.org/10.1021/ct700301q
 
 * GROMACS 4.5: a high-throughput and highly parallel open source
   molecular simulation toolkit
@@ -63,14 +63,19 @@ To help us fund development, we humbly ask that you cite the GROMACS papers:
   Rossen Apostolov, Michael R. Shirts, Jeremy C. Smith, Peter M. Kasson,
   David van der Spoel, Berk Hess, Erik Lindahl.
   Bioinformatics 29 (2013) pp. 845-54
-  DOI: 10.1093/bioinformatics/btt055
+  DOI: https://doi.org/10.1093/bioinformatics/btt055
 
 * Tackling Exascale Software Challenges in Molecular Dynamics Simulations
   with GROMACS
   Szilárd Páll, Mark J. Abraham, Carsten Kutzner, Berk Hess, Erik Lindahl
   In S. Markidis & E. Laure (Eds.), Solving Software Challenges for Exascale,
-  8759 (2015) pp. 3–27
-  DOI: 10.1007/978-3-319-15976-8_1
+  Lecture Notes for Computer Science, 8759 (2015) pp. 3–27
+  DOI: https://doi.org/10.1007/978-3-319-15976-8_1
+
+* GROMACS: High performance molecular simulations through multi-level parallelism from laptops to supercomputers
+  M. J. Abraham, T. Murtola, R. Schulz, S. Páll, J. C. Smith, B. Hess, E. Lindahl,
+  SoftwareX, 1, (2015), 19-25
+  DOI: https://doi.org/10.1016/j.softx.2015.06.001
 
 There are a lot of cool features we'd like to include in future versions,
 but our resources are limited. All kinds of donations are welcome, both in 
index 1851cb0f8da322c0b0f56a824388901b7a5dfb1c..7e38ed8ab122de90634d4ca555a35b0e1bbc5e72 100755 (executable)
@@ -1,4 +1,4 @@
-#!/usr/bin/env python2
+#!/usr/bin/env python
 #
 # This file is part of the GROMACS molecular simulation package.
 #
index 109ebcbf05e224c73deb3921cd95feadfa1da709..88d40f548fd8945151cf4487d63281b82173d56b 100644 (file)
@@ -227,7 +227,12 @@ endif()
 
 set(REGRESSIONTEST_VERSION "${GMX_VERSION_STRING}")
 set(REGRESSIONTEST_BRANCH "refs/heads/release-2018")
-set(REGRESSIONTEST_MD5SUM "1a94916e2cf90e34fddb3514a65e0154" CACHE INTERNAL "MD5 sum of the regressiontests tarball")
+# Run the regressiontests packaging job with the correct pakage
+# version string, and the release box checked, in order to have it
+# build the regressiontests tarball with all the right naming. The
+# naming affects the md5sum that has to go here, and if it isn't right
+# release workflow will report a failure.
+set(REGRESSIONTEST_MD5SUM "135149af467a37714a92bc29801cafda" CACHE INTERNAL "MD5 sum of the regressiontests tarball for this GROMACS version")
 
 math(EXPR GMX_VERSION_NUMERIC
      "${GMX_VERSION_MAJOR}*10000 + ${GMX_VERSION_PATCH}")
index 49f188703d0fda88b3f36fee7d61d0eebd002593..cdf259d6af3e71f42467fe9fc32dcc0c721579cf 100644 (file)
@@ -319,6 +319,7 @@ if (SPHINX_FOUND)
         release-notes/removed-features.rst
         release-notes/portability.rst
         release-notes/miscellaneous.rst
+        release-notes/2018/2018.3.rst
         release-notes/2018/2018.2.rst
         release-notes/2018/2018.1.rst
         release-notes/2018/major/highlights.rst
@@ -533,7 +534,7 @@ if (MAN_PAGE_DIR)
     # Trailing slash on directory is significant for
     # install(DIRECTORY). See CMake docs.
     install(DIRECTORY ${MAN_PAGE_DIR}/
-        DESTINATION ${MAN_INSTALL_DIR}/man1
+        DESTINATION ${CMAKE_INSTALL_MANDIR}/man1
         COMPONENT man OPTIONAL
         FILES_MATCHING PATTERN "*.1")
 endif()
index 459a9a737a530df137b81c38035be4afa483f8c4..dd6a69a5a0d7a51b25b2d1933351cf23cb1ff645 100644 (file)
@@ -208,11 +208,12 @@ Variables affecting compilation/linking
    subcounters which are available.
    Defaults to ``OFF``.
 
-.. cmake:: GMX_DATA_INSTALL_DIR
+.. cmake:: GMX_INSTALL_DATASUBDIR
 
-   Sets the directory under :file:`share/` where data files are installed.
-   The default is ``gromacs``, which puts the files under
-   file:`share/gromacs/`.
+   Sets the subdirectory under CMAKE_INSTALL_DATADIR where GROMACS-specific
+   read-only architecture-independent data files are installed. The default
+   is ``gromacs``, which means the files will go under ``share/gromacs``.
+   To alter the ``share`` part, change CMAKE_INSTALL_DATADIR.
    See :doc:`relocatable-binaries` for how this influences the build.
 
 .. cmake:: GMX_DOUBLE
@@ -265,7 +266,7 @@ Variables affecting compilation/linking
 
     Pass additional CUDA-only compiler flags to clang using this variable.
 
-.. cmake:: GMX_LIB_INSTALL_DIR
+.. cmake:: CMAKE_INSTALL_LIBDIR
 
    Sets the installation directory for libraries (default is determined by
    standard CMake package ``GNUInstallDirs``).
index e29907d2d16e9154278c33035b16cb9f204aca76..732bde013f4f021a73b865ed77fc8caecd11c389 100644 (file)
@@ -113,10 +113,10 @@ implementation, which works like this:
    contains :file:`share/{gromacs}/top/gurgle.dat`, this directory is returned
    as the installation prefix.  The file name ``gurgle.dat`` and the location
    are considered unique enough to ensure that the correct directory has been
-   found.  The installation directory for the data files can be customized
-   during CMake configuration by setting ``GMX_DATA_INSTALL_DIR``, which
-   affects the *gromacs* part in the above path (both in the installation
-   structure and in this search logic).
+   found.  The installation directory for read-only architecture-independent
+   data files can be customized during CMake configuration by setting
+   ``CMAKE_INSTALL_DATADIR``, and the subdirectory under this that hosts the
+   GROMACS-specific data is set by ``GMX_INSTALL_DATASUBDIR``.
 
    Note that this search does not resolve symbolic links or normalize the input
    path beforehand: if there are ``..`` components *and* symbolic links in the
index 53246293ef5df748b15c51bfe26cd03e06a11800..1a32e8b2637cf2104e83f19592d9888a3d9f9873 100644 (file)
@@ -854,12 +854,14 @@ CMakeLists.txt.
     The standard location for executables and some scripts.
     Some of the scripts hardcode the absolute installation prefix, which needs
     to be changed if the scripts are relocated.
+    The name of the directory can be changed using ``CMAKE_INSTALL_BINDIR`` CMake
+    variable.
 ``include/gromacs/``
     The standard location for installed headers.
 ``lib/``
     The standard location for libraries. The default depends on the system, and
     is determined by CMake.
-    The name of the directory can be changed using ``GMX_LIB_INSTALL_DIR`` CMake
+    The name of the directory can be changed using ``CMAKE_INSTALL_LIBDIR`` CMake
     variable.
 ``lib/pkgconfig/``
     Information about the installed ``libgromacs`` library for ``pkg-config`` is
@@ -869,9 +871,10 @@ CMakeLists.txt.
 ``share/cmake/``
     CMake package configuration files are installed here.
 ``share/gromacs/``
-    Various data files and some documentation go here.
-    The ``gromacs`` part can be changed using ``GMX_DATA_INSTALL_DIR``. Using this
-    CMake variable is the preferred way of changing the installation path for
+    Various data files and some documentation go here. The first part can
+    be changed using ``CMAKE_INSTALL_DATADIR``, and the second by using
+    ``GMX_INSTALL_DATASUBDIR`` Using these CMake variables is the preferred
+    way of changing the installation path for
     ``share/gromacs/top/``, since the path to this directory is built into
     ``libgromacs`` as well as some scripts, both as a relative and as an absolute
     path (the latter as a fallback if everything else fails).
index 9d2c915723f354ba8aaac72032bd1c90efea3186..0c8a34264b7cf1b9c306b999920847bbff91cf7c 100644 (file)
@@ -1,21 +1,61 @@
 GROMACS 2018.2 release notes
 ----------------------------
 
-This version was released on TODO, 2018. These release notes document
+This version was released on June 14, 2018. These release notes document
 the changes that have taken place in GROMACS since version 2018.1, to fix known
-issues. It also incorporates all fixes made in version TODO and
+issues. It also incorporates all fixes made in version 2016.5 and
 earlier, which you can find described in the :ref:`release-notes`.
 
 Fixes where mdrun could behave incorrectly
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
-Prevent OpenCL timing memory leak
-"""""""""""""""""""""""""""""""""
+Prevented OpenCL timing memory leak
+"""""""""""""""""""""""""""""""""""
 
 When using OpenCL builds and timing, a memory leak would lead to all system memory being used up.
 
 :issue:`2470`
 
+Fixed MPI error after constraint failure during energy minimization
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+:issue:`2540`
+
+Fixed moving frozen atoms with constraints
+""""""""""""""""""""""""""""""""""""""""""
+
+Frozen atoms which also had bond constraints could move.
+
+:issue:`2542`
+
+Fixed COM removal moving frozen atoms
+"""""""""""""""""""""""""""""""""""""
+
+When frozen atoms were part of center of mass motion removal groups,
+they could accumulate momentum and move.
+
+:issue:`2551`
+
+Fixed AWH too infrequent checks for covering
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+For multidimensional AWH grids with many points relative to the number
+of samples required for covering the grid, the detection of covering
+could be delayed because of too infrequent checks.
+
+:issue:`2487`
+
+Fixed AWH continuation consistency checks
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+Some kinds of changes upon restarts are now disallowed, as intended.
+
+Fixed AWH awh-nsamples-update value checking
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+Zero is now forbidden, as intended.
+
+:issue:`2489`
+
 Fixes for ``gmx`` tools
 ^^^^^^^^^^^^^^^^^^^^^^^
 
@@ -27,15 +67,102 @@ during make check/test.
 
 :issue:`2465`
 
+Fixed infinite loop in gmx solvate
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+When provided with a PDB file that had no box information for the solvent,
+gmx solvate could be stuck in an infinite loop.
+Fixed by disallowing empty boxes for solvent PDB files.
+
+:issue:`2523`
+
+Fixed enemat when the .edr file had no matching energy groups
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+:issue:`2508`
+
+Fixed PQR file output
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+PQR files from gmx editconf violated the standard for the format because
+they were always written in fixed format. This commit fixes the issue by
+introducing a different output method for PQR files that follows the
+standard.
+
+:issue:`2511`
+
+Fixed crash in gmx solvate
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+gmx solvate would crash due to memory corruption when using multiple solvent
+molecule types.
+
+Added check for unallowed periodic setups
+"""""""""""""""""""""""""""""""""""""""""
+
+Long distances between atoms in bonded interactions could lead to incorrect
+periodicity removal. In such cases an inconsistent shift message was printed,
+but the run or analysis was not terminated and other, confusing, errors
+could be issued. Now an informative fatal error is issued.
+
+:issue:`2549`
+
 Fixes to improve portability
 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
+Fixed CUDA compilation on Windows.
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+:issue:`2509`
+
+Fixed SIMD support for POWER systems in double precision with gcc 8
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+:issue:`2421`
+
+
+Fixed possible illegal instruction on KNL with Intel compiler
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+:issue:`2504`
+
 Miscellaneous
 ^^^^^^^^^^^^^
 
+Information message about OMP_NUM_THREADS now sent to log file
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+Made it easier to track this information by writing it to the log file
+in a clear way, rather than to stderr.
+
+:issue:`2472`
+
 Fixed inadvertent disabling of SIMD version of the integrator
 """""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
 
-Fixed a bug so the SIMD version of the leap-frog integrator is chosen, when possible.
+Fixed a bug so the SIMD version of the leap-frog integrator is chosen,
+when possible. This may improve performance.
 
 :issue:`2497`
+
+Fixed own FFTW builds on certain AVX2/AVX512 hardware
+"""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+Version 3.3.8 of FFTW fixes some known gcc-8 errors for AVX2 by removing the 
+fast-math flag, and it also appears to fix an issue with failed unit tests on
+AVX512-capable hardware, so we have bumped the version we download to 3.3.8.
+
+:issue:`2541`
+
+Switched to using more standard CMake variables for installing on GNU systems
+"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+GnuInstallDirs.cmake is a better approach.
+
+Several documentation and output improvements
+""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
+
+* Updated top-level README file for latest GROMACS core publication.
+* Reporting about GPU detection has improved.
+* ``gmx mindist -pi`` docs improved.
+* Docs for mdp options relating to bonds improved.
+* Fixed various typos.
+* Removed a leftover mention of the twin-range scheme.
+* `gmx trjconv -ndec`` docs improved.
diff --git a/docs/release-notes/2018/2018.3.rst b/docs/release-notes/2018/2018.3.rst
new file mode 100644 (file)
index 0000000..b2f7355
--- /dev/null
@@ -0,0 +1,19 @@
+GROMACS 2018.3 release notes
+----------------------------
+
+This version was released on TODO, 2018. These release notes document
+the changes that have taken place in GROMACS since version 2018.2, to fix known
+issues. It also incorporates all fixes made in version TODO and
+earlier, which you can find described in the :ref:`release-notes`.
+
+Fixes where mdrun could behave incorrectly
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Fixes for ``gmx`` tools
+^^^^^^^^^^^^^^^^^^^^^^^
+
+Fixes to improve portability
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^
+
+Miscellaneous
+^^^^^^^^^^^^^
index de8222a2415fd95417534262d5be6480d236bbfb..76765191466f30aa367fce76b516fa9f84e4be1f 100644 (file)
@@ -48,6 +48,7 @@ Patch releases
 .. toctree::
    :maxdepth: 1
 
+   2018/2018.3
    2018/2018.2
    2018/2018.1
 
index 521589d2cf432911976e639c4df4107afd720870..43aebd6db8d94d845da34a21ba5a44b15a86f121 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2010,2014, by the GROMACS development team, led by
+# Copyright (c) 2010,2014,2018, 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,10 +37,10 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GMXRC.bash.cmakein ${CMAKE_CURRENT_BI
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GMXRC.csh.cmakein  ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.csh @ONLY)
 configure_file(${CMAKE_CURRENT_SOURCE_DIR}/GMXRC.zsh.cmakein  ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.zsh @ONLY)
 
-install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC      DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime)
-install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.bash DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime)
-install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.zsh  DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime)
-install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.csh  DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime)
+install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC      DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime)
+install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.bash DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime)
+install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.zsh  DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime)
+install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/GMXRC.csh  DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime)
 
-install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/demux.pl      DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime)
-install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/xplor2gmx.pl  DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime)
+install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/demux.pl      DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime)
+install(PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR}/xplor2gmx.pl  DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime)
index 18457a637735b89544c46224aacf6a8f68b62f31..7de4e848a8d274677d1f46da51cf651848381cf2 100644 (file)
@@ -51,10 +51,10 @@ MANPATH=$tmppath
 # If you move gromacs, change the first line.
 ##########################################################
 GMXPREFIX=@CMAKE_INSTALL_PREFIX@
-GMXBIN=${GMXPREFIX}/@BIN_INSTALL_DIR@
-GMXLDLIB=${GMXPREFIX}/@LIB_INSTALL_DIR@
-GMXMAN=${GMXPREFIX}/@MAN_INSTALL_DIR@
-GMXDATA=${GMXPREFIX}/@DATA_INSTALL_DIR@
+GMXBIN=${GMXPREFIX}/@CMAKE_INSTALL_BINDIR@
+GMXLDLIB=${GMXPREFIX}/@CMAKE_INSTALL_LIBDIR@
+GMXMAN=${GMXPREFIX}/@CMAKE_INSTALL_MANDIR@
+GMXDATA=${GMXPREFIX}/@GMX_INSTALL_GMXDATADIR@
 GROMACS_DIR=${GMXPREFIX}
 
 LD_LIBRARY_PATH=${GMXLDLIB}${LD_LIBRARY_PATH:+:}${LD_LIBRARY_PATH}
index 1ecf954885797f38d975eab5204677e8c9e72aeb..c141b2961551f2376d2702c02b7381d7228d37a0 100644 (file)
@@ -10,9 +10,9 @@
 echo $shell | grep -q csh && goto CSH
 
 # if we got here, shell is bsh/bash/zsh/ksh
-. @CMAKE_INSTALL_PREFIX@/@BIN_INSTALL_DIR@/GMXRC.bash
+. @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/GMXRC.bash
 return
 
 # csh/tcsh jump here
 CSH:
-source @CMAKE_INSTALL_PREFIX@/@BIN_INSTALL_DIR@/GMXRC.csh
+source @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/GMXRC.csh
index 16a85df5c36adc2263985934f88d57e305ac8bfb..315fccf812edb65bf7f5e95cd8f7824ae2a7301c 100644 (file)
@@ -71,10 +71,10 @@ setenv MANPATH $tmppath
 # If you move gromacs, change the first line.
 ##########################################################
 setenv GMXPREFIX @CMAKE_INSTALL_PREFIX@
-setenv GMXBIN ${GMXPREFIX}/@BIN_INSTALL_DIR@
-setenv GMXLDLIB ${GMXPREFIX}/@LIB_INSTALL_DIR@
-setenv GMXMAN ${GMXPREFIX}/@MAN_INSTALL_DIR@
-setenv GMXDATA ${GMXPREFIX}/@DATA_INSTALL_DIR@
+setenv GMXBIN ${GMXPREFIX}/@CMAKE_INSTALL_BINDIR@
+setenv GMXLDLIB ${GMXPREFIX}/@CMAKE_INSTALL_LIBDIR@
+setenv GMXMAN ${GMXPREFIX}/@CMAKE_INSTALL_MANDIR@
+setenv GMXDATA ${GMXPREFIX}/@GMX_INSTALL_GMXDATADIR@
 setenv GROMACS_DIR ${GMXPREFIX}
 
 #make them begin with :
index 97287547eafc45916006eff57c7bf959dbbb00e5..0558f350a949ca061503c78ac8195f3c06b50f90 100644 (file)
@@ -1,3 +1,3 @@
 # zsh configuration file for Gromacs
 # only kept for backwards compatibility
-source @CMAKE_INSTALL_PREFIX@/@BIN_INSTALL_DIR@/GMXRC.bash
+source @CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_BINDIR@/GMXRC.bash
index e82d2d5baa28ace039a4921e7d1fe824c7cd9dc0..29340032591c3b5d6de8ccb5e909b215d147e800 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2009,2010,2011,2012,2013,2014, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2011,2012,2013,2014,2018, 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.
@@ -35,9 +35,9 @@
 add_subdirectory(template)
 
 install(FILES README.tutor README_FreeEnergyModifications.txt
-    DESTINATION ${DATA_INSTALL_DIR}
+    DESTINATION ${GMX_INSTALL_GMXDATADIR}
     COMPONENT data)
 install(DIRECTORY top
-    DESTINATION ${DATA_INSTALL_DIR}
+    DESTINATION ${GMX_INSTALL_GMXDATADIR}
     COMPONENT data
     PATTERN "*~" EXCLUDE)
index feee762fddedb3d2089a09543baa423019bda38f..d33e783d9f16af925f6a726ba47482a010bcfde7 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2011,2012,2014,2016, by the GROMACS development team, led by
+# Copyright (c) 2011,2012,2014,2016,2018, by the GROMACS development team, led by
 # Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
 # and including many others, as listed in the AUTHORS file in the
 # top-level source directory and at http://www.gromacs.org.
@@ -44,14 +44,14 @@ endif()
 configure_file(README.cmakein README @ONLY)
 
 install(FILES CMakeLists.txt.template
-        DESTINATION ${DATA_INSTALL_DIR}/template
+        DESTINATION ${GMX_INSTALL_GMXDATADIR}/template
         RENAME CMakeLists.txt
         COMPONENT development)
 
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/README template.cpp Makefile.pkg
-        DESTINATION ${DATA_INSTALL_DIR}/template
+        DESTINATION ${GMX_INSTALL_GMXDATADIR}/template
         COMPONENT development)
 
 install(FILES cmake/FindGROMACS.cmake
-        DESTINATION ${DATA_INSTALL_DIR}/template/cmake
+        DESTINATION ${GMX_INSTALL_GMXDATADIR}/template/cmake
         COMPONENT development)
index 7712e6f46bcb56c9c4bf6c21fabcc2a80bb64058..22c63564829616a12c7dd182ffa82d9d87ef3997 100644 (file)
@@ -87,8 +87,8 @@
 /** Binary directory for the build */
 #define CMAKE_BINARY_DIR        "@CMAKE_BINARY_DIR@"
 
-/** Location of data files in the installation directory */
-#define DATA_INSTALL_DIR        "@DATA_INSTALL_DIR@"
+/** Location of GROMACS-specific data files */
+#define GMX_INSTALL_GMXDATADIR  "@GMX_INSTALL_GMXDATADIR@"
 
 /** CUDA compiler version information */
 #define CUDA_COMPILER_INFO "@CUDA_COMPILER_INFO@"
index d0c3c3504dafe3eaa1f522db80a7d36cb741022d..7645af8f27a6f8ddc119e12955c6c3652768ae19 100644 (file)
 #cmakedefine01 HAVE_NVML
 
 /* Define relative path to OpenCL kernels */
-#define OCL_INSTALL_DIR "@OCL_INSTALL_DIR@"
+#define GMX_INSTALL_OCLDIR "@GMX_INSTALL_OCLDIR@"
 
 /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */
 #cmakedefine01 HAVE_FSEEKO
index 5e77dfd7c9bf79cdfe803b6cb84f855f4c8879d3..968fb3046d53ffb52268fa19cfaf6944828acae1 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+# Copyright (c) 2012,2013,2014,2015,2016,2017,2018, 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.
@@ -93,12 +93,12 @@ if (TARGET_HOST)
 endif()
 
 # Machinery for running the external project
-set(EXTERNAL_FFTW_VERSION 3.3.7)
+set(EXTERNAL_FFTW_VERSION 3.3.8)
 # cmake make eats slashes //// -> //
 set(GMX_BUILD_OWN_FFTW_URL
     "http:////www.fftw.org/fftw-${EXTERNAL_FFTW_VERSION}.tar.gz" CACHE PATH
     "URL from where to download fftw (use an absolute path when offline, adjust GMX_BUILD_OWN_FFTW_MD5 if downloading other version than ${EXTERNAL_FFTW_VERSION})")
-set(GMX_BUILD_OWN_FFTW_MD5 0d5915d7d39b3253c1cc05030d79ac47 CACHE STRING
+set(GMX_BUILD_OWN_FFTW_MD5 8aac833c943d8e90d51b697b27d4384d CACHE STRING
     "Expected MD5 hash for the file at GMX_BUILD_OWN_FFTW_URL")
 mark_as_advanced(GMX_BUILD_OWN_FFTW_URL GMX_BUILD_OWN_FFTW_MD5)
 
index 5d87ea3b260ae84a3778fcf7c74f17689dc22e45..b9a0664057b2a1800694392dde4e250cc0d64931 100644 (file)
@@ -75,7 +75,7 @@ function (gmx_install_headers)
     if (NOT GMX_BUILD_MDRUN_ONLY)
         file(RELATIVE_PATH _dest ${PROJECT_SOURCE_DIR}/src ${CMAKE_CURRENT_LIST_DIR})
         install(FILES       ${ARGN}
-                DESTINATION "${INCL_INSTALL_DIR}/${_dest}"
+                DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${_dest}"
                 COMPONENT   development)
     endif()
     _gmx_add_files_to_property(GMX_INSTALLED_HEADERS ${ARGN})
@@ -239,8 +239,10 @@ if (HAS_NO_UNUSED)
 endif()
 set_source_files_properties(selection/scanner.cpp PROPERTIES COMPILE_FLAGS "${_scanner_cpp_compiler_flags}")
 
-if(SIMD_AVX_512_CXX_SUPPORTED)
-    # Since we might be overriding -march=core-avx2, add a flag so we don't warn for this specific file
+if(SIMD_AVX_512_CXX_SUPPORTED AND NOT ("${GMX_SIMD_ACTIVE}" STREQUAL "AVX_512_KNL"))
+    # Since we might be overriding -march=core-avx2, add a flag so we don't warn for this specific file.
+    # On KNL this can cause illegal instruction because the compiler might use non KNL AVX instructions
+    # with the SIMD_AVX_512_CXX_FLAGS flags.
     set_source_files_properties(hardware/identifyavx512fmaunits.cpp PROPERTIES COMPILE_FLAGS "${SIMD_AVX_512_CXX_FLAGS} ${CXX_NO_UNUSED_OPTION_WARNING_FLAGS}")
 endif()
 
@@ -340,9 +342,9 @@ gmx_write_installed_header_list()
 if (NOT GMX_BUILD_MDRUN_ONLY OR BUILD_SHARED_LIBS)
     install(TARGETS libgromacs
             EXPORT libgromacs
-            LIBRARY DESTINATION ${LIB_INSTALL_DIR}
-            RUNTIME DESTINATION ${BIN_INSTALL_DIR}
-            ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
+            LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
+            RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
+            ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
             COMPONENT libraries)
 endif()
 
@@ -361,7 +363,7 @@ if (INSTALL_CUDART_LIB) #can be set manual by user
                 #install also name-links (linker uses those)
                 file(GLOB CUDA_LIBS ${CUDA_LIB}*)
                 install(FILES ${CUDA_LIBS} DESTINATION
-                    ${LIB_INSTALL_DIR} COMPONENT libraries)
+                    ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries)
             endif()
         endforeach()
     else()
@@ -373,7 +375,7 @@ if(GMX_USE_OPENCL)
     set(OPENCL_KERNELS ${MDLIB_OPENCL_KERNELS})
 
     install(FILES ${OPENCL_KERNELS} DESTINATION
-        ${OCL_INSTALL_DIR} COMPONENT libraries)
+        ${GMX_INSTALL_OCLDIR} COMPONENT libraries)
 endif()
 
 if (BUILD_TESTING)
index ccc12719caa320a661366888750b6fd7a7383d84..af244430e990fe0b9b699edb295d4def410f093b 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2014,2016, by the GROMACS development team, led by
+# Copyright (c) 2014,2016,2018, 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.
@@ -51,7 +51,7 @@ function (do_pkgconfig)
     configure_file(libgromacs.pc.cmakein
                    libgromacs.pc @ONLY)
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgromacs.pc
-            DESTINATION ${PKGCONFIG_INSTALL_DIR}
+            DESTINATION ${GMX_INSTALL_PKGCONFIGDIR}
             RENAME "libgromacs${GMX_LIBS_SUFFIX}.pc"
             COMPONENT development)
 endfunction()
@@ -60,7 +60,7 @@ function (do_cmake_config)
     # Install everything into a subdirectory, because
     #  1. CMake expects things to be there for CMAKE_PREFIX_PATH to work, and
     #  2. This nicely isolates files for different suffixes from each other.
-    set(CMAKE_PACKAGE_DIR ${CMAKE_INSTALL_DIR}/gromacs${GMX_LIBS_SUFFIX})
+    set(GMX_INSTALL_CMAKEPKGDIR ${GMX_INSTALL_CMAKEDIR}/gromacs${GMX_LIBS_SUFFIX})
 
     # Install import definitions that take care of the library locations and
     # library dependencies.
@@ -70,7 +70,7 @@ function (do_cmake_config)
     endif()
     install(EXPORT libgromacs
             FILE ${EXPORT_FILE_NAME}
-            DESTINATION ${CMAKE_PACKAGE_DIR}
+            DESTINATION ${GMX_INSTALL_CMAKEPKGDIR}
             COMPONENT libraries)
 
     get_filename_component(GROMACS_CXX_COMPILER ${CMAKE_CXX_COMPILER} REALPATH)
@@ -83,11 +83,11 @@ function (do_cmake_config)
     # find_package(GROMACS NAMES gromacs_d) to find them, without also
     # specifying CONFIGS.
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gromacs-config.cmake
-            DESTINATION ${CMAKE_PACKAGE_DIR}
+            DESTINATION ${GMX_INSTALL_CMAKEPKGDIR}
             RENAME "gromacs${GMX_LIBS_SUFFIX}-config.cmake"
             COMPONENT development)
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gromacs-config-version.cmake
-            DESTINATION ${CMAKE_PACKAGE_DIR}
+            DESTINATION ${GMX_INSTALL_CMAKEPKGDIR}
             RENAME "gromacs${GMX_LIBS_SUFFIX}-config-version.cmake"
             COMPONENT development)
 endfunction()
index 1664e3c291ebff7bb95e238eda6b17ae6b0873da..1a18b0d18e154435fc92c0ef93cbc30a174e335f 100644 (file)
@@ -78,7 +78,7 @@ void Bias::warnForHistogramAnomalies(double t, gmx_int64_t step, FILE *fplog)
     const int    maxNumWarningsInRun   = 10;  /* The maximum number of warnings to print in a run */
 
     if (fplog == nullptr || numWarningsIssued_ >= maxNumWarningsInRun || state_.inInitialStage() ||
-        !params_.isCheckStep(state_.points().size(), step))
+        !params_.isCheckHistogramForAnomaliesStep(step))
     {
         return;
     }
@@ -208,6 +208,60 @@ Bias::calcForceAndUpdateBias(const awh_dvec        coordValue,
     return biasForce_;
 }
 
+/*! \brief
+ * Count the total number of samples / sample weight over all grid points.
+ *
+ * \param[in] pointState  The state of the points in a bias.
+ * \returns the total sample count.
+ */
+static gmx_int64_t countSamples(const std::vector<PointState> &pointState)
+{
+    double numSamples = 0;
+    for (const PointState &point : pointState)
+    {
+        numSamples += point.weightSumTot();
+    }
+
+    return static_cast<gmx_int64_t>(numSamples + 0.5);
+}
+
+/*! \brief
+ * Check if the state (loaded from checkpoint) and the run are consistent.
+ *
+ * When the state and the run setup are inconsistent, an exception is thrown.
+ *
+ * \param[in] params  The parameters of the bias.
+ * \param[in] state   The state of the bias.
+ */
+static void ensureStateAndRunConsistency(const BiasParams &params,
+                                         const BiasState  &state)
+{
+    gmx_int64_t numSamples            = countSamples(state.points());
+    gmx_int64_t numUpdatesFromSamples = numSamples/(params.numSamplesUpdateFreeEnergy_*params.numSharedUpdate);
+    gmx_int64_t numUpdatesExpected    = state.histogramSize().numUpdates();
+    if (numUpdatesFromSamples != numUpdatesExpected)
+    {
+        std::string mesg = gmx::formatString("The number of AWH updates in the checkpoint file (%ld) does not match the total number of AWH samples divided by the number of samples per update for %ld sharing AWH bias(es) (%ld/%ld=%ld)",
+                                             numUpdatesExpected,
+                                             params.numSharedUpdate,
+                                             numSamples,
+                                             params.numSamplesUpdateFreeEnergy_*params.numSharedUpdate,
+                                             numUpdatesFromSamples);
+        mesg += " Maybe you changed AWH parameters.";
+        /* Unfortunately we currently do not store the number of simulations
+         * sharing the bias or the state to checkpoint. But we can hint at
+         * a mismatch in the number of sharing simulations.
+         */
+        if (numUpdatesFromSamples % state.histogramSize().numUpdates() == 0)
+        {
+            mesg += gmx::formatString(" Or the run you continued from used %ld sharing simulations, whereas you now specified %d sharing simulations.",
+                                      numUpdatesFromSamples/state.histogramSize().numUpdates(),
+                                      params.numSharedUpdate);
+        }
+        GMX_THROW(InvalidInputError(mesg));
+    }
+}
+
 void Bias::restoreStateFromHistory(const AwhBiasHistory *biasHistory,
                                    const t_commrec      *cr)
 {
@@ -218,6 +272,12 @@ void Bias::restoreStateFromHistory(const AwhBiasHistory *biasHistory,
         GMX_RELEASE_ASSERT(biasHistory != nullptr, "On the master rank we need a valid history object to restore from");
         state_.restoreFromHistory(*biasHistory, grid_);
 
+        /* Ensure that the state is consistent with our current run setup,
+         * since the user can have changed AWH parameters or the number
+         * of simulations sharing the bias.
+         */
+        ensureStateAndRunConsistency(params_, state_);
+
         if (forceCorrelationGrid_ != nullptr)
         {
             forceCorrelationGrid_->restoreStateFromHistory(biasHistory->forceCorrelationGrid);
index c6608126607e98c61fa51a42531eca6596d51bd7..5e72ba4f90023d9e12cc34b79fff1dcfbee65c20 100644 (file)
 namespace gmx
 {
 
-bool BiasParams::isCheckStep(std::size_t numPointsInHistogram,
-                             gmx_int64_t step) const
-{
-    int numStepsUpdateFreeEnergy = numSamplesUpdateFreeEnergy_*numStepsSampleCoord_;
-    int numStepsCheck            = (1 + numPointsInHistogram/numSamplesUpdateFreeEnergy_)*numStepsUpdateFreeEnergy;
-
-    if (step > 0 && step % numStepsCheck == 0)
-    {
-        GMX_ASSERT(isUpdateFreeEnergyStep(step), "We should only check at free-energy update steps");
-
-        return true;
-    }
-    else
-    {
-        return false;
-    }
-}
-
 namespace
 {
 
@@ -130,6 +112,50 @@ gmx_int64_t calcTargetUpdateInterval(const AwhParams     &awhParams,
     return numStepsUpdateTarget;
 }
 
+/*! \brief Determines the step interval for checking for covering.
+ *
+ * \param[in] awhParams      AWH parameters.
+ * \param[in] dimParams         Parameters for the dimensions of the coordinate.
+ * \param[in] gridAxis          The Grid axes.
+ * \returns the check interval in steps.
+ */
+gmx_int64_t calcCheckCoveringInterval(const AwhParams              &awhParams,
+                                      const std::vector<DimParams> &dimParams,
+                                      const std::vector<GridAxis>  &gridAxis)
+{
+    /* Each sample will have a width of sigma. To cover the axis a
+       minimum number of samples of width sigma is required. */
+    int minNumSamplesCover = 0;
+    for (size_t d = 0; d < gridAxis.size(); d++)
+    {
+        GMX_RELEASE_ASSERT(dimParams[d].betak > 0, "Inverse temperature (beta) and force constant (k) should be positive.");
+        double sigma           = 1.0/std::sqrt(dimParams[d].betak);
+
+        /* The additional sample is here because to cover a discretized
+           axis of length sigma one needs two samples, one for each
+           end point. */
+        GMX_RELEASE_ASSERT(gridAxis[d].length()/sigma < std::numeric_limits<int>::max(), "The axis length in units of sigma should fit in an int");
+        int    numSamplesCover = static_cast<int>(std::ceil(gridAxis[d].length()/sigma)) + 1;
+
+        /* The minimum number of samples needed for simultaneously
+           covering all axes is limited by the axis requiring most
+           samples. */
+        minNumSamplesCover = std::max(minNumSamplesCover, numSamplesCover);
+    }
+
+    /* Convert to number of steps using the sampling frequency. The
+       check interval should be a multiple of the update step
+       interval. */
+    int       numStepsUpdate      = awhParams.numSamplesUpdateFreeEnergy*awhParams.nstSampleCoord;
+    GMX_RELEASE_ASSERT(awhParams.numSamplesUpdateFreeEnergy > 0, "When checking for AWH coverings, the number of samples per AWH update need to be > 0.");
+    int       numUpdatesCheck     = std::max(1, minNumSamplesCover/awhParams.numSamplesUpdateFreeEnergy);
+    int       numStepsCheck       = numUpdatesCheck*numStepsUpdate;
+
+    GMX_RELEASE_ASSERT(numStepsCheck % numStepsUpdate == 0, "Only check covering at free energy update steps");
+
+    return numStepsCheck;
+}
+
 /*! \brief
  * Returns an approximation of the geometry factor used for initializing the AWH update size.
  *
@@ -282,6 +308,7 @@ BiasParams::BiasParams(const AwhParams              &awhParams,
     numStepsSampleCoord_(awhParams.nstSampleCoord),
     numSamplesUpdateFreeEnergy_(awhParams.numSamplesUpdateFreeEnergy),
     numStepsUpdateTarget_(calcTargetUpdateInterval(awhParams, awhBiasParams)),
+    numStepsCheckCovering_(calcCheckCoveringInterval(awhParams, dimParams, gridAxis)),
     eTarget(awhBiasParams.eTarget),
     freeEnergyCutoffInKT(beta*awhBiasParams.targetCutoff),
     temperatureScaleFactor(awhBiasParams.targetBetaScaling),
index 3455fe54b745d7b21d04368d16b19d3f7dc1d4dd..be7e021843632e8a3aee320a2bcedf5c5916a92e 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, 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.
@@ -143,17 +143,39 @@ class BiasParams
         }
 
         /*! \brief
-         * Returns if to do checks, only returns true at free-energy update steps.
+         * Returns if to do checks for covering in the initial stage.
          *
-         * To avoid overhead due to expensive checks, we only do checks when we
-         * have taken at least as many samples as we have points.
+         * To avoid overhead due to expensive checks, we do not check
+         * at every free energy update. However, if checks are
+         * performed too rarely the detection of coverings will be
+         * delayed, ultimately affecting free energy convergence.
          *
-         * \param[in] numPointsInHistogram  The total number of points in the bias histogram.
          * \param[in] step                  Time step.
          * \returns true at steps where checks should be performed.
+         * \note  Only returns true at free energy update steps.
          */
-        bool isCheckStep(std::size_t numPointsInHistogram,
-                         gmx_int64_t step) const;
+        bool isCheckCoveringStep(gmx_int64_t step) const
+        {
+            return step % numStepsCheckCovering_ == 0;
+        }
+
+        /*! \brief
+         * Returns if to perform checks for anomalies in the histogram.
+         *
+         * To avoid overhead due to expensive checks, we do not check
+         * at every free energy update. These checks are only used for
+         * warning the user and can be made as infrequently as
+         * neccessary without affecting the algorithm itself.
+         *
+         * \param[in] step                  Time step.
+         * \returns true at steps where checks should be performed.
+         * \note Only returns true at free energy update steps.
+         * \todo Currently this function just calls isCheckCoveringStep but the checks could be done less frequently.
+         */
+        bool isCheckHistogramForAnomaliesStep(gmx_int64_t step) const
+        {
+            return isCheckCoveringStep(step);
+        }
 
         /*! \brief Constructor.
          *
@@ -192,8 +214,11 @@ class BiasParams
         const double      invBeta;                     /**< 1/beta = kT in kJ/mol */
     private:
         const gmx_int64_t numStepsSampleCoord_;        /**< Number of steps per coordinate value sample. */
+    public:
         const int         numSamplesUpdateFreeEnergy_; /**< Number of samples per free energy update. */
+    private:
         const gmx_int64_t numStepsUpdateTarget_;       /**< Number of steps per updating the target distribution. */
+        const gmx_int64_t numStepsCheckCovering_;      /**< Number of steps per checking for covering. */
     public:
         const int         eTarget;                     /**< Type of target distribution. */
         const double      freeEnergyCutoffInKT;        /**< Free energy cut-off in kT for cut-off target distribution. */
index 64394f9a883ac543ae4ff83135a22cc31d9c5e81..9cd6a2ec8a5cb6b975962bc4e2b5dfae371052f7 100644 (file)
@@ -1066,7 +1066,7 @@ void BiasState::updateFreeEnergyAndAddSamplesToHistogram(const std::vector<DimPa
     bool detectedCovering = false;
     if (inInitialStage())
     {
-        detectedCovering = (params.isCheckStep(points_.size(), step) &&
+        detectedCovering = (params.isCheckCoveringStep(step) &&
                             isSamplingRegionCovered(params, dimParams, grid,
                                                     commRecord, multiSimComm));
     }
@@ -1584,7 +1584,7 @@ static void readUserPmfAndTargetDistribution(const std::vector<DimParams> &dimPa
     if (targetDistributionIsZero)
     {
         std::string mesg = gmx::formatString("The target weights given in column %d in %s are all 0",
-                                             filename.c_str(), columnIndexTarget);
+                                             columnIndexTarget, filename.c_str());
         GMX_THROW(InvalidInputError(mesg));
     }
 
index 6af38a2cc7c25759fe936203fb352ce89d958b07..2aae84c0c56e697e3092c5f8807eec2cf1903d38 100644 (file)
@@ -689,9 +689,9 @@ GridAxis::GridAxis(double origin, double end,
     }
     else
     {
-        double lengthInPoints = length_*pointDensity;
-
-        numPoints_            = 1 + static_cast<int>(std::ceil(lengthInPoints));
+        /* An extra point is added here to account for the endpoints. The
+           minimum number of points for a non-zero interval is 2. */
+        numPoints_            = 1 + static_cast<int>(std::ceil(length_*pointDensity));
     }
 
     /* Set point spacing based on the number of points */
index 3b07f6cb179dad109bcb05002b1286c3ca937b87..414fbe8723e57760cc134094481fce1237b45398 100644 (file)
@@ -518,6 +518,12 @@ AwhParams *readAndCheckAwhParams(std::vector<t_inpfile> *inp, const t_inputrec *
     printStringNoNewline(inp, "Free energy and bias update interval in number of samples");
     sprintf(opt, "%s-nsamples-update", prefix);
     awhParams->numSamplesUpdateFreeEnergy = get_eint(inp, opt, 10, wi);
+    if (awhParams->numSamplesUpdateFreeEnergy <= 0)
+    {
+        char buf[STRLEN];
+        sprintf(buf, "%s needs to be an integer > 0", opt);
+        warning_error(wi, buf);
+    }
 
     printStringNoNewline(inp, "When true, biases with share-group>0 are shared between multiple simulations");
     sprintf(opt, "%s-share-multisim", prefix);
index d6954c1bb99fed4f027b17538581b31b44a62ae7..559a315b5e1410db87f34093dc268b737d0d6051 100644 (file)
@@ -186,7 +186,7 @@ bool isAcceptableLibraryPath(const std::string &path)
  */
 bool isAcceptableLibraryPathPrefix(const std::string &path)
 {
-    std::string testPath = Path::join(path, DATA_INSTALL_DIR, "top");
+    std::string testPath = Path::join(path, GMX_INSTALL_GMXDATADIR, "top");
     return isAcceptableLibraryPath(testPath);
 }
 
index 0eea8ba210e42470c93466fb5370a00d91ec56e8..29a2253d5673b0eb0bfdbee8820cb873216082eb 100644 (file)
@@ -101,7 +101,7 @@ void write_sto_conf_indexed(const char *outfile, const char *title,
         case efENT:
         case efPQR:
             out = gmx_fio_fopen(outfile, "w");
-            write_pdbfile_indexed(out, title, atoms, x, ePBC, box, ' ', -1, nindex, index, nullptr, TRUE);
+            write_pdbfile_indexed(out, title, atoms, x, ePBC, box, ' ', -1, nindex, index, nullptr, TRUE, TRUE);
             gmx_fio_fclose(out);
             break;
         case efESP:
index 761d1723d1fa18739134552e6dfff5b646312086..a943112965595847ec26aea9549c925b99895e1e 100644 (file)
@@ -259,11 +259,56 @@ static void read_cryst1(char *line, int *ePBC, matrix box)
     }
 }
 
+static int
+gmx_fprintf_pqr_atomline(FILE *            fp,
+                         enum PDB_record   record,
+                         int               atom_seq_number,
+                         const char *      atom_name,
+                         const char *      res_name,
+                         char              chain_id,
+                         int               res_seq_number,
+                         real              x,
+                         real              y,
+                         real              z,
+                         real              occupancy,
+                         real              b_factor)
+{
+    GMX_RELEASE_ASSERT(record == epdbATOM || record == epdbHETATM,
+                       "Can only print PQR atom lines as ATOM or HETATM records");
+
+    /* Check atom name */
+    GMX_RELEASE_ASSERT(atom_name != nullptr,
+                       "Need atom information to print pqr");
+
+    /* Check residue name */
+    GMX_RELEASE_ASSERT(res_name != nullptr,
+                       "Need residue information to print pqr");
+
+    /* Truncate integers so they fit */
+    atom_seq_number = atom_seq_number % 100000;
+    res_seq_number  = res_seq_number % 10000;
+
+    int n = fprintf(fp,
+                    "%s %d %s %s %c %d %8.3f %8.3f %8.3f %6.2f %6.2f\n",
+                    pdbtp[record],
+                    atom_seq_number,
+                    atom_name,
+                    res_name,
+                    chain_id,
+                    res_seq_number,
+                    x, y, z,
+                    occupancy,
+                    b_factor);
+
+    return n;
+}
+
 void write_pdbfile_indexed(FILE *out, const char *title,
                            const t_atoms *atoms, const rvec x[],
                            int ePBC, const matrix box, char chainid,
                            int model_nr, int nindex, const int index[],
-                           gmx_conect conect, gmx_bool bTerSepChains)
+                           gmx_conect conect, gmx_bool bTerSepChains,
+                           bool usePqrFormat)
 {
     gmx_conect_t     *gc = (gmx_conect_t *)conect;
     char              resnm[6], nm[6];
@@ -370,29 +415,44 @@ void write_pdbfile_indexed(FILE *out, const char *title,
         }
         occup = bOccup ? 1.0 : pdbinfo.occup;
         bfac  = pdbinfo.bfac;
-
-        gmx_fprintf_pdb_atomline(out,
-                                 type,
-                                 i+1,
-                                 nm,
-                                 altloc,
-                                 resnm,
-                                 ch,
-                                 resnr,
-                                 resic,
-                                 10*x[i][XX], 10*x[i][YY], 10*x[i][ZZ],
-                                 occup,
-                                 bfac,
-                                 atoms->atom[i].elem);
-
-        if (atoms->pdbinfo && atoms->pdbinfo[i].bAnisotropic)
+        if (!usePqrFormat)
+        {
+            gmx_fprintf_pdb_atomline(out,
+                                     type,
+                                     i+1,
+                                     nm,
+                                     altloc,
+                                     resnm,
+                                     ch,
+                                     resnr,
+                                     resic,
+                                     10*x[i][XX], 10*x[i][YY], 10*x[i][ZZ],
+                                     occup,
+                                     bfac,
+                                     atoms->atom[i].elem);
+
+            if (atoms->pdbinfo && atoms->pdbinfo[i].bAnisotropic)
+            {
+                fprintf(out, "ANISOU%5d  %-4.4s%4.4s%c%4d%c %7d%7d%7d%7d%7d%7d\n",
+                        (i+1)%100000, nm, resnm, ch, resnr,
+                        (resic == '\0') ? ' ' : resic,
+                        atoms->pdbinfo[i].uij[0], atoms->pdbinfo[i].uij[1],
+                        atoms->pdbinfo[i].uij[2], atoms->pdbinfo[i].uij[3],
+                        atoms->pdbinfo[i].uij[4], atoms->pdbinfo[i].uij[5]);
+            }
+        }
+        else
         {
-            fprintf(out, "ANISOU%5d  %-4.4s%4.4s%c%4d%c %7d%7d%7d%7d%7d%7d\n",
-                    (i+1)%100000, nm, resnm, ch, resnr,
-                    (resic == '\0') ? ' ' : resic,
-                    atoms->pdbinfo[i].uij[0], atoms->pdbinfo[i].uij[1],
-                    atoms->pdbinfo[i].uij[2], atoms->pdbinfo[i].uij[3],
-                    atoms->pdbinfo[i].uij[4], atoms->pdbinfo[i].uij[5]);
+            gmx_fprintf_pqr_atomline(out,
+                                     type,
+                                     i+1,
+                                     nm,
+                                     resnm,
+                                     ch,
+                                     resnr,
+                                     10*x[i][XX], 10*x[i][YY], 10*x[i][ZZ],
+                                     occup,
+                                     bfac);
         }
     }
 
@@ -422,7 +482,7 @@ void write_pdbfile(FILE *out, const char *title, const t_atoms *atoms, const rve
         index[i] = i;
     }
     write_pdbfile_indexed(out, title, atoms, x, ePBC, box, chainid, model_nr,
-                          atoms->nr, index, conect, bTerSepChains);
+                          atoms->nr, index, conect, bTerSepChains, false);
     sfree(index);
 }
 
index 27d5106d53b1faec01042e8392240b4e4a1cd886..c88a5c2834cb5ce45f8c94f9857258fff277d588 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, 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.
@@ -95,7 +95,8 @@ void gmx_write_pdb_box(FILE *out, int ePBC, const matrix box);
 void write_pdbfile_indexed(FILE *out, const char *title, const t_atoms *atoms,
                            const rvec x[], int ePBC, const matrix box, char chain,
                            int model_nr, int nindex, const int index[],
-                           gmx_conect conect, gmx_bool bTerSepChains);
+                           gmx_conect conect, gmx_bool bTerSepChains,
+                           bool usePqrFormat);
 /* REALLY low level */
 
 void write_pdbfile(FILE *out, const char *title, const t_atoms *atoms,
index d23b22747a008d32195301fa0add0dec28c20275..1fbdb4fb1870c1377c27bb35afe18cbb0757fff5 100644 (file)
@@ -427,7 +427,7 @@ int write_trxframe_indexed(t_trxstatus *status, const t_trxframe *fr, int nind,
             else
             {
                 write_pdbfile_indexed(gmx_fio_getfp(status->fio), title, fr->atoms,
-                                      fr->x, -1, fr->box, ' ', fr->step, nind, ind, gc, TRUE);
+                                      fr->x, -1, fr->box, ' ', fr->step, nind, ind, gc, TRUE, FALSE);
             }
             break;
         case efG96:
index 0ac6b72760de39ccf8079ae08df360bdd8e556f3..1d62dd050245cd1d1cdbbbc2eb7077b51f78064e 100644 (file)
@@ -660,7 +660,7 @@ int gmx_do_dssp(int argc, char *argv[])
         }
         gmx_rmpbc(gpbc, natoms, box, x);
         tapein = gmx_ffopen(pdbfile, "w");
-        write_pdbfile_indexed(tapein, nullptr, atoms, x, ePBC, box, ' ', -1, gnx, index, nullptr, TRUE);
+        write_pdbfile_indexed(tapein, nullptr, atoms, x, ePBC, box, ' ', -1, gnx, index, nullptr, TRUE, FALSE);
         gmx_ffclose(tapein);
 
         if (0 != system(dssp))
index 176a334a139c9d5421ce15cd56517f05c65ee232..d03f922cb1cf7dcb6ff950389bcacb02360e8bcd 100644 (file)
@@ -1265,7 +1265,7 @@ int gmx_editconf(int argc, char *argv[])
         if (outftp == efPDB)
         {
             out = gmx_ffopen(outfile, "w");
-            write_pdbfile_indexed(out, *top_tmp->name, &atoms, x, ePBC, box, ' ', 1, isize, index, conect, TRUE);
+            write_pdbfile_indexed(out, *top_tmp->name, &atoms, x, ePBC, box, ' ', 1, isize, index, conect, TRUE, FALSE);
             gmx_ffclose(out);
         }
         else
@@ -1311,7 +1311,18 @@ int gmx_editconf(int argc, char *argv[])
                     atoms.resinfo[atoms.atom[i].resind].chainid = label[0];
                 }
             }
-            write_pdbfile(out, *top_tmp->name, &atoms, x, ePBC, box, ' ', -1, conect, TRUE);
+            /* Need to bypass the regular write_pdbfile because I don't want to change
+             * all instances to include the boolean flag for writing out PQR files.
+             */
+            int *index;
+            snew(index, atoms.nr);
+            for (int i = 0; i < atoms.nr; i++)
+            {
+                index[i] = i;
+            }
+            write_pdbfile_indexed(out, *top_tmp->name, &atoms, x, ePBC, box, ' ', -1, atoms.nr, index, conect,
+                                  TRUE, outftp == efPQR);
+            sfree(index);
             if (bLegend)
             {
                 pdb_legend(out, atoms.nr, atoms.nres, &atoms, x);
index 676b2608efbb657795ce2e73e8255ab51bd0ffff..b8ac16387014075efdf18d4c7ff872e316c8ac47 100644 (file)
@@ -159,7 +159,7 @@ int gmx_enemat(int argc, char *argv[])
     gmx_bool          bCont, bRef;
     gmx_bool          bCutmax, bCutmin;
     real            **eneset, *time = nullptr;
-    int              *set, i, j, k, prevk, m = 0, n, nre, nset, nenergy;
+    int              *set, i, j, prevk, k, m = 0, n, nre, nset, nenergy;
     char            **groups = nullptr;
     char              groupname[255], fn[255];
     int               ngroups;
@@ -224,8 +224,6 @@ int gmx_enemat(int argc, char *argv[])
     prevk = 0;
     for (i = 0; (i < ngroups); i++)
     {
-        fprintf(stderr, "\rgroup %d", i);
-        fflush(stderr);
         for (j = i; (j < ngroups); j++)
         {
             for (m = 0; (m < egNR); m++)
@@ -233,21 +231,19 @@ int gmx_enemat(int argc, char *argv[])
                 if (egrp_use[m])
                 {
                     sprintf(groupname, "%s:%s-%s", egrp_nm[m], groups[i], groups[j]);
-#ifdef DEBUG
-                    fprintf(stderr, "\r%-15s %5d", groupname, n);
-                    fflush(stderr);
-#endif
+                    bool foundMatch = false;
                     for (k = prevk; (k < prevk+nre); k++)
                     {
-                        if (std::strcmp(enm[k%nre].name, groupname) == 0)
+                        if (std::strcmp(enm[k % nre].name, groupname) == 0)
                         {
-                            set[n++] = k;
+                            set[n++]   = k;
+                            foundMatch = true;
                             break;
                         }
                     }
-                    if (k == prevk+nre)
+                    if (!foundMatch)
                     {
-                        fprintf(stderr, "WARNING! could not find group %s (%d,%d)"
+                        fprintf(stderr, "WARNING! could not find group %s (%d,%d) "
                                 "in energy file\n", groupname, i, j);
                     }
                     else
@@ -259,6 +255,15 @@ int gmx_enemat(int argc, char *argv[])
         }
     }
     fprintf(stderr, "\n");
+    if (n == 0)
+    {
+        // Return an error, can't do what the user asked for
+        fprintf(stderr,
+                "None of the specified energy groups were found in this .edr file.\n"
+                "Perhaps you used the wrong groups, the wrong files, or didn't use a .tpr\n"
+                "that was made from an .mdp file that specified these energy groups.\n");
+        return 1;
+    }
     nset = n;
     snew(eneset, nset+1);
     fprintf(stderr, "Will select half-matrix of energies with %d elements\n", n);
index 8f9e57b06fbed0f9f8cf85090ea239c14fc32af3..84c04ff7dfccb5b1fd301113a6e9b604ac39a2b5 100644 (file)
@@ -660,7 +660,9 @@ int gmx_mindist(int argc, char *argv[])
         "With option [TT]-pi[tt] the minimum distance of a group to its",
         "periodic image is plotted. This is useful for checking if a protein",
         "has seen its periodic image during a simulation. Only one shift in",
-        "each direction is considered, giving a total of 26 shifts.",
+        "each direction is considered, giving a total of 26 shifts. Note",
+        "that periodicity information is required from the file supplied with",
+        "with [TT]-s[tt], either as a .tpr file or a .pdb file with CRYST1 fields.",
         "It also plots the maximum distance within the group and the lengths",
         "of the three box vectors.[PAR]",
         "Also [gmx-distance] and [gmx-pairdist] calculate distances."
index 046a849294d09e822c4090b2325d96408cbb05aa..b3c8b3ea69393edae489bdc5080dc2fe6aec9499 100644 (file)
@@ -206,10 +206,7 @@ static void sort_molecule(t_atoms **atoms_solvt, std::vector<RVec> *x,
         }
 
         /* put them back into the original arrays and throw away temporary arrays */
-        sfree(atoms->atomname);
-        sfree(atoms->resinfo);
-        sfree(atoms->atom);
-        sfree(atoms);
+        done_atom(atoms);
         *atoms_solvt = newatoms;
         std::swap(*x, newx);
         std::swap(*v, newv);
@@ -654,6 +651,11 @@ static void add_solv(const char *fn, t_topology *top,
     snew(top_solvt, 1);
     readConformation(filename, top_solvt, &x_solvt, !v->empty() ? &v_solvt : nullptr,
                      &ePBC_solvt, box_solvt, "solvent");
+    if (gmx::boxIsZero(box_solvt))
+    {
+        gmx_fatal(FARGS, "No box information for solvent in %s, please use a properly formatted file\n",
+                  filename);
+    }
     t_atoms *atoms_solvt = &top_solvt->atoms;
     if (0 == atoms_solvt->nr)
     {
index 4ed5cbefc1bd01a16ccbf3943353432d58548cbe..4f2656b18cdd1dfb7bacc44ca6074132260fc146 100644 (file)
@@ -683,8 +683,8 @@ bool canDetectGpus(std::string *errorMessage)
              * something wrong with the machine: driver-runtime
              * mismatch, all GPUs being busy in exclusive mode,
              * invalid CUDA_VISIBLE_DEVICES, or some other condition
-             * which should result in GROMACS issuing a warning a
-             * falling back to CPUs. */
+             * which should result in GROMACS issuing at least a
+             * warning. */
             errorMessage->assign(cudaGetErrorString(stat));
         }
 
index c4d15153cb43cc4f3c2cb498646523cc8f1f1d3e..01dcec9203a476eb05601ded924fb80400d563f5 100644 (file)
@@ -80,7 +80,12 @@ enum class GpuTaskCompletion
  * Returns true when this is a build of \Gromacs configured to support
  * GPU usage, and a valid device driver, ICD, and/or runtime was detected.
  *
- * \param[out] errorMessage  When returning false and non-nullptr was passed,
+ * This function is not intended to be called from build
+ * configurations that do not support GPUs, and there will be no
+ * descriptive message in that case.
+ *
+ * \param[out] errorMessage  When returning false on a build configured with
+ *                           GPU support and non-nullptr was passed,
  *                           the string contains a descriptive message about
  *                           why GPUs cannot be detected.
  *
index bfc1f1c2c588cddbd781135d220fb95514a63266..3107ac8f1b2b442c17c3510467bd3e1a0e97f216 100644 (file)
@@ -231,7 +231,7 @@ getSourceRootPath(const std::string &sourceRelativePath)
         InstallationPrefixInfo      info           = getProgramContext().installationPrefix();
         std::string                 dataPathSuffix = (info.bSourceLayout ?
                                                       sourceRelativePath :
-                                                      OCL_INSTALL_DIR);
+                                                      GMX_INSTALL_OCLDIR);
         sourceRootPath = Path::join(info.path, dataPathSuffix);
     }
     else
index ca2e9ca4176c02aa4abb207d001e8e97db574c26..a36d79579be587847ac275ddfc8d84dee04c336a 100644 (file)
@@ -143,9 +143,9 @@ static void gmx_detect_gpus(const gmx::MDLogger            &mdlog,
         if (!gpusCanBeDetected)
         {
             GMX_LOG(mdlog.warning).asParagraph().appendTextFormatted(
-                    "NOTE: GPUs cannot be detected:\n"
-                    "      %s\n"
-                    "      Can not use GPU acceleration, will fall back to CPU kernels.",
+                    "NOTE: Detection of GPUs failed. The API reported:\n"
+                    "      %s\n",
+                    "      GROMACS cannot run tasks on a GPU.",
                     errorMessage.c_str());
         }
     }
index 228845ea851f409141db4fff1a54405af7e83310..f4caaa51f6e0ab3b0082e217d87f6935df8cca8d 100644 (file)
@@ -1,4 +1,4 @@
-libdir=@CMAKE_INSTALL_PREFIX@/@LIB_INSTALL_DIR@
+libdir=@CMAKE_INSTALL_PREFIX@/@CMAKE_INSTALL_LIBDIR@
 
 Name: libgromacs@GMX_LIBS_SUFFIX@
 Description: Gromacs library
index 8a15aad14c329d320674175511b9d3ec481052dd..71bb29eb5e5386b3b9a5c4e0a2cdb7aef165d591 100644 (file)
@@ -682,6 +682,28 @@ Constraints::Impl::apply(bool                  bLog,
     }
     wallcycle_stop(wcycle, ewcCONSTR);
 
+    if (v != nullptr && md.cFREEZE)
+    {
+        /* Set the velocities of frozen dimensions to zero */
+
+        // cppcheck-suppress unreadVariable
+        int gmx_unused numThreads = gmx_omp_nthreads_get(emntUpdate);
+
+#pragma omp parallel for num_threads(numThreads) schedule(static)
+        for (int i = 0; i < md.homenr; i++)
+        {
+            int freezeGroup = md.cFREEZE[i];
+
+            for (int d = 0; d < DIM; d++)
+            {
+                if (ir.opts.nFreeze[freezeGroup][d])
+                {
+                    v[i][d] = 0;
+                }
+            }
+        }
+    }
+
     return bOK;
 }
 
index de97bf8689231af767dc9301d9684969841ed42a..b642651f44cea48a3eaee8cfb4e7fb7935544b2d 100644 (file)
@@ -175,8 +175,8 @@ static void pick_module_nthreads(const gmx::MDLogger &mdlog, int m,
     gmx_omp_nthreads_set(m, nth);
 }
 
-void gmx_omp_nthreads_read_env(int     *nthreads_omp,
-                               gmx_bool bIsSimMaster)
+void gmx_omp_nthreads_read_env(const gmx::MDLogger &mdlog,
+                               int                 *nthreads_omp)
 {
     char    *env;
     gmx_bool bCommandLineSetNthreadsOMP = *nthreads_omp > 0;
@@ -204,16 +204,14 @@ void gmx_omp_nthreads_read_env(int     *nthreads_omp,
 
         /* Output the results */
         sprintf(buffer,
-                "The number of OpenMP threads was set by environment variable OMP_NUM_THREADS to %d%s\n",
+                "\nThe number of OpenMP threads was set by environment variable OMP_NUM_THREADS to %d%s\n\n",
                 nt_omp,
                 bCommandLineSetNthreadsOMP ? " (and the command-line setting agreed with that)" : "");
-        if (bIsSimMaster)
-        {
-            /* This prints once per simulation for multi-simulations,
-             * which might help diagnose issues with inhomogenous
-             * cluster setups. */
-            fputs(buffer, stderr);
-        }
+
+        /* This prints once per simulation for multi-simulations,
+         * which might help diagnose issues with inhomogenous
+         * cluster setups. */
+        GMX_LOG(mdlog.info).appendTextFormatted(buffer);
         if (debug)
         {
             /* This prints once per process for real MPI (i.e. once
index 2fb02eef05436bbcbdd7553f35fcdbc5592db9a1..e7dd9907b5256e44d1291f4b6926f7e4ff80ffac 100644 (file)
@@ -117,7 +117,7 @@ void gmx_omp_nthreads_set(int mod, int nthreads);
 /*! \brief
  * Read the OMP_NUM_THREADS env. var. and check against the value set on the
  * command line. */
-void gmx_omp_nthreads_read_env(int     *nthreads_omp,
-                               gmx_bool bIsSimMaster);
+void gmx_omp_nthreads_read_env(const gmx::MDLogger &mdlog,
+                               int                 *nthreads_omp);
 
 #endif
index f6db75d091e295db4d0a5814402c172555e14388..d3decdb04b6a8a56f9bf95df3f0adf84fb96ddcf 100644 (file)
@@ -249,7 +249,7 @@ void compute_globals(FILE *fplog, gmx_global_stat *gstat, t_commrec *cr, t_input
         {
             xPtr = as_rvec_array(state->x.data());
         }
-        do_stopcm_grp(mdatoms->homenr, mdatoms->cVCM,
+        do_stopcm_grp(*mdatoms,
                       xPtr, as_rvec_array(state->v.data()), *vcm);
         inc_nrnb(nrnb, eNR_STOPCM, mdatoms->homenr);
     }
index ecfccb8621cadba6050f561930b346323830eef8..960649956abe6a938cd5566fdd9e7bd3344e72c8 100644 (file)
@@ -441,10 +441,11 @@ void nbnxn_gpu_launch_kernel(gmx_nbnxn_cuda_t       *nb,
         t->nb_k[iloc].closeTimingRegion(stream);
     }
 
-#if (defined(WIN32) || defined( _WIN32 ))
-    /* Windows: force flushing WDDM queue */
-    stat = cudaStreamQuery(stream);
-#endif
+    if (GMX_NATIVE_WINDOWS)
+    {
+        /* Windows: force flushing WDDM queue */
+        cudaStreamQuery(stream);
+    }
 }
 
 /*! Calculates the amount of shared memory required by the CUDA kernel in use. */
@@ -577,10 +578,11 @@ void nbnxn_gpu_launch_kernel_pruneonly(gmx_nbnxn_cuda_t       *nb,
         timer->closeTimingRegion(stream);
     }
 
-#if (defined(WIN32) || defined( _WIN32 ))
-    /* Windows: force flushing WDDM queue */
-    stat = cudaStreamQuery(stream);
-#endif
+    if (GMX_NATIVE_WINDOWS)
+    {
+        /* Windows: force flushing WDDM queue */
+        cudaStreamQuery(stream);
+    }
 }
 
 void nbnxn_gpu_launch_cpyback(gmx_nbnxn_cuda_t       *nb,
index 7d10937e68e19f076f0d92692bb1277407e2bd16..7f47953eb7dddaa654302ff008337c32714f627d 100644 (file)
@@ -117,6 +117,8 @@ t_vcm *init_vcm(FILE *fp, gmx_groups_t *groups, const t_inputrec *ir)
         snew(vcm->thread_vcm, gmx_omp_nthreads_get(emntDefault) * vcm->stride);
     }
 
+    vcm->nFreeze = ir->opts.nFreeze;
+
     return vcm;
 }
 
@@ -234,19 +236,38 @@ void calc_vcm_grp(int start, int homenr, t_mdatoms *md,
  * \note This routine should be called from within an OpenMP parallel region.
  *
  * \tparam numDimensions    Correct dimensions 0 to \p numDimensions-1
- * \param[in]     homenr    The number of atoms to correct
- * \param[in]     group_id  List of VCM group ids, when nullptr is passed all atoms are assumed to be in group 0
+ * \param[in]     mdatoms   The atom property and group information
  * \param[in,out] v         The velocities to correct
  * \param[in]     vcm       VCM data
  */
 template<int numDimensions>
 static void
-doStopComMotionLinear(int                   homenr,
-                      const unsigned short *group_id,
+doStopComMotionLinear(const t_mdatoms      &mdatoms,
                       rvec                 *v,
                       const t_vcm          &vcm)
 {
-    if (group_id == nullptr)
+    const int             homenr   = mdatoms.homenr;
+    const unsigned short *group_id = mdatoms.cVCM;
+
+    if (mdatoms.cFREEZE != nullptr)
+    {
+        GMX_RELEASE_ASSERT(vcm.nFreeze != nullptr, "Need freeze dimension info with freeze groups");
+
+#pragma omp for schedule(static)
+        for (int i = 0; i < homenr; i++)
+        {
+            unsigned short vcmGroup    = (group_id == nullptr ? 0 : group_id[i]);
+            unsigned short freezeGroup = mdatoms.cFREEZE[i];
+            for (int d = 0; d < numDimensions; d++)
+            {
+                if (vcm.nFreeze[freezeGroup][d] == 0)
+                {
+                    v[i][d] -= vcm.group_v[vcmGroup][d];
+                }
+            }
+        }
+    }
+    else if (group_id == nullptr)
     {
 #pragma omp for schedule(static)
         for (int i = 0; i < homenr; i++)
@@ -319,11 +340,14 @@ doStopComMotionAccelerationCorrection(int                   homenr,
     }
 }
 
-void do_stopcm_grp(int homenr, const unsigned short *group_id,
+void do_stopcm_grp(const t_mdatoms &mdatoms,
                    rvec x[], rvec v[], const t_vcm &vcm)
 {
     if (vcm.mode != ecmNO)
     {
+        const int             homenr   = mdatoms.homenr;
+        const unsigned short *group_id = mdatoms.cVCM;
+
         // cppcheck-suppress unreadVariable
         int gmx_unused nth = gmx_omp_nthreads_get(emntDefault);
 #pragma omp parallel num_threads(nth)
@@ -336,13 +360,13 @@ void do_stopcm_grp(int homenr, const unsigned short *group_id,
                 switch (vcm.ndim)
                 {
                     case 1:
-                        doStopComMotionLinear<1>(homenr, group_id, v, vcm);
+                        doStopComMotionLinear<1>(mdatoms, v, vcm);
                         break;
                     case 2:
-                        doStopComMotionLinear<2>(homenr, group_id, v, vcm);
+                        doStopComMotionLinear<2>(mdatoms, v, vcm);
                         break;
                     case 3:
-                        doStopComMotionLinear<3>(homenr, group_id, v, vcm);
+                        doStopComMotionLinear<3>(mdatoms, v, vcm);
                         break;
                 }
             }
index 7ffe477d8292b589abb0b2aa782cf1d9b5aa8d23..4ba0c360fd8effc3040f26d452210ef32392d610 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, 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 gmx_groups_t;
 struct t_inputrec;
+struct t_mdatoms;
 
 typedef struct {
     rvec      p;        /* Linear momentum                     */
@@ -71,6 +72,7 @@ typedef struct {
     tensor       *group_i;     /* Moment of inertia per group         */
     real         *group_mass;  /* Mass per group                      */
     char        **group_name;  /* These two are copies to pointers in */
+    ivec         *nFreeze;     /* Tells whether dimensions are frozen per freeze group */
     t_vcm_thread *thread_vcm;  /* Temporary data per thread and group */
 } t_vcm;
 
@@ -84,8 +86,7 @@ void calc_vcm_grp(int start, int homenr, t_mdatoms *md,
  *
  * With linear modes nullptr can be passed for x.
  */
-void do_stopcm_grp(int homenr,
-                   const unsigned short *group_id,
+void do_stopcm_grp(const t_mdatoms &mdatoms,
                    rvec x[], rvec v[], const t_vcm &vcm);
 
 void check_cm_grp(FILE *fp, t_vcm *vcm, t_inputrec *ir, real Temp_Max);
index b109ac7f1844bb9983c991b1cb679d71fd3aa954..35c7945e7ede2b42d49b1340f72e9e9f2e73cc38 100644 (file)
@@ -696,6 +696,17 @@ static bool do_em_step(const t_commrec *cr,
                           s2->lambda[efptBONDED], &dvdl_constr,
                           nullptr, nullptr, gmx::ConstraintVariable::Positions);
 
+        if (cr->nnodes > 1)
+        {
+            /* This global reduction will affect performance at high
+             * parallelization, but we can not really avoid it.
+             * But usually EM is not run at high parallelization.
+             */
+            int reductionBuffer = !validStep;
+            gmx_sumi(1, &reductionBuffer, cr);
+            validStep           = (reductionBuffer == 0);
+        }
+
         // We should move this check to the different minimizers
         if (!validStep && ir->eI != eiSteep)
         {
index 95f3632b28c10a70c9ace592259cfd029babd1d3..15d4f14df65b51cd52989c3ff2279e3088d876e7 100644 (file)
@@ -526,7 +526,7 @@ int Mdrunner::mdrunner()
     }
 
     /* Check and update the hardware options for internal consistency */
-    check_and_update_hw_opt_1(&hw_opt, cr, domdecOptions.numPmeRanks);
+    check_and_update_hw_opt_1(mdlog, &hw_opt, cr, domdecOptions.numPmeRanks);
 
     /* Early check for externally set process affinity. */
     gmx_check_thread_affinity_set(mdlog, cr,
index b2eab493f96196fa0932c8952ab78182fc1288ff..4ee39267ce6f00c2cea591cb84c3c2fa34f886a3 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, 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.
@@ -104,4 +104,14 @@ bool boxesAreEqual(const matrix box1, const matrix box2)
            && boxElementEqual(box1[ZZ][ZZ], box2[ZZ][ZZ]);
 }
 
+bool boxIsZero(const matrix box)
+{
+    return boxElementEqual(box[XX][XX], 0.0)
+           && boxElementEqual(box[YY][XX], 0.0)
+           && boxElementEqual(box[YY][YY], 0.0)
+           && boxElementEqual(box[ZZ][XX], 0.0)
+           && boxElementEqual(box[ZZ][YY], 0.0)
+           && boxElementEqual(box[ZZ][ZZ], 0.0);
+}
+
 } // namespace gmx
index 1261129a0c30115ddb9fdbd86e99908915f23833..d60f6bfb9983315f1502fe4d1e7f3205223fd7db 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * This file is part of the GROMACS molecular simulation package.
  *
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, 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.
@@ -55,6 +55,11 @@ namespace gmx
  */
 bool boxesAreEqual(const matrix box1, const matrix box2);
 
+/*! \brief
+ * Returns whether a box is only initialised to zero or not.
+ */
+bool boxIsZero(const matrix box);
+
 } // namespace gmx
 
 #endif
index 87f3396af5765998815be96fc0b189a2647cfb10..60bc72a243363e5a5594e0f4ad87b8be9d915eca 100644 (file)
@@ -48,6 +48,7 @@
 #include "gromacs/topology/ifunc.h"
 #include "gromacs/utility/fatalerror.h"
 #include "gromacs/utility/smalloc.h"
+#include "gromacs/utility/stringutil.h"
 
 /************************************************************
  *
@@ -86,13 +87,19 @@ static void add_gbond(t_graph *g, int a0, int a1)
     }
 }
 
-static void mk_igraph(t_graph *g, int ftype, const t_ilist *il,
+/* Make the actual graph for an ilist, returns whether an edge was added.
+ *
+ * When a non-null part array is supplied with part indices for each atom,
+ * edges are only added when atoms have a different part index.
+ */
+static bool mk_igraph(t_graph *g, int ftype, const t_ilist *il,
                       int at_start, int at_end,
                       const int *part)
 {
     t_iatom *ia;
     int      i, j, np;
     int      end;
+    bool     addedEdge = false;
 
     end = il->nr;
     ia  = il->iatoms;
@@ -102,7 +109,7 @@ static void mk_igraph(t_graph *g, int ftype, const t_ilist *il,
     {
         np = interaction_function[ftype].nratoms;
 
-        if (ia[1] >= at_start && ia[1] < at_end)
+        if (np > 1 && ia[1] >= at_start && ia[1] < at_end)
         {
             if (ia[np] >= at_end)
             {
@@ -119,6 +126,7 @@ static void mk_igraph(t_graph *g, int ftype, const t_ilist *il,
                 /* Bond all the atoms in the settle */
                 add_gbond(g, ia[1], ia[2]);
                 add_gbond(g, ia[1], ia[3]);
+                addedEdge = true;
             }
             else if (part == nullptr)
             {
@@ -127,6 +135,7 @@ static void mk_igraph(t_graph *g, int ftype, const t_ilist *il,
                 {
                     add_gbond(g, ia[j], ia[j+1]);
                 }
+                addedEdge = true;
             }
             else
             {
@@ -136,6 +145,7 @@ static void mk_igraph(t_graph *g, int ftype, const t_ilist *il,
                     if (part[ia[j]] != part[ia[j+1]])
                     {
                         add_gbond(g, ia[j], ia[j+1]);
+                        addedEdge = true;
                     }
                 }
             }
@@ -143,6 +153,8 @@ static void mk_igraph(t_graph *g, int ftype, const t_ilist *il,
         ia += np+1;
         i  += np+1;
     }
+
+    return addedEdge;
 }
 
 gmx_noreturn static void g_error(int line, const char *file)
@@ -378,8 +390,9 @@ void mk_graph_ilist(FILE *fplog,
      * some atoms are not connected by the graph, which runs from
      * g->at_start (>= g->at0) to g->at_end (<= g->at1).
      */
-    g->at0 = at_start;
-    g->at1 = at_end;
+    g->at0       = at_start;
+    g->at1       = at_end;
+    g->parts     = t_graph::BondedParts::Single;
 
     snew(nbond, at_end);
     nbtot = calc_start_end(fplog, g, ilist, at_start, at_end, nbond);
@@ -427,13 +440,25 @@ void mk_graph_ilist(FILE *fplog,
                  * but only when they connect parts of the graph
                  * that are not connected through IF_CHEMBOND interactions.
                  */
+                bool addedEdge = false;
                 for (i = 0; (i < F_NRE); i++)
                 {
                     if (!(interaction_function[i].flags & IF_CHEMBOND))
                     {
-                        mk_igraph(g, i, &(ilist[i]), at_start, at_end, nbond);
+                        bool addedEdgeForType =
+                            mk_igraph(g, i, &(ilist[i]), at_start, at_end, nbond);
+                        addedEdge = (addedEdge || addedEdgeForType);
                     }
                 }
+
+                if (addedEdge)
+                {
+                    g->parts = t_graph::BondedParts::MultipleConnected;
+                }
+                else
+                {
+                    g->parts = t_graph::BondedParts::MultipleDisconnected;
+                }
             }
 
             /* Removed all the unused space from the edge array */
@@ -716,6 +741,32 @@ static int first_colour(int fC, egCol Col, t_graph *g, const egCol egc[])
     return -1;
 }
 
+/* Returns the maximum length of the graph edges for coordinates x */
+static real maxEdgeLength(const t_graph g,
+                          int           ePBC,
+                          const matrix  box,
+                          const rvec    x[])
+{
+    t_pbc pbc;
+
+    set_pbc(&pbc, ePBC, box);
+
+    real maxEdgeLength2 = 0;
+
+    for (int node = 0; node < g.nnodes; node++)
+    {
+        for (int edge = 0; edge < g.nedge[node]; edge++)
+        {
+            int  nodeJ = g.edge[node][edge];
+            rvec dx;
+            pbc_dx(&pbc, x[g.at0 + node], x[g.at0 + nodeJ], dx);
+            maxEdgeLength2 = std::max(maxEdgeLength2, norm2(dx));
+        }
+    }
+
+    return std::sqrt(maxEdgeLength2);
+}
+
 void mk_mshift(FILE *log, t_graph *g, int ePBC,
                const matrix box, const rvec x[])
 {
@@ -817,6 +868,46 @@ void mk_mshift(FILE *log, t_graph *g, int ePBC,
     }
     if (nerror > 0)
     {
+        /* We use a threshold of 0.25*boxSize for generating a fatal error
+         * to allow removing PBC for systems with periodic molecules.
+         *
+         * TODO: Consider a better solution for systems with periodic
+         *       molecules. Ideally analysis tools should only ask to make
+         *       non-periodic molecules whole in a system with periodic mols.
+         */
+        constexpr real c_relativeDistanceThreshold = 0.25;
+
+        int            numPbcDimensions = ePBC2npbcdim(ePBC);
+        GMX_RELEASE_ASSERT(numPbcDimensions > 0, "Expect PBC with graph");
+        real           minBoxSize = norm(box[XX]);
+        for (int d = 1; d < numPbcDimensions; d++)
+        {
+            minBoxSize = std::min(minBoxSize, norm(box[d]));
+        }
+        real maxDistance = maxEdgeLength(*g, ePBC, box, x);
+        if (maxDistance >= c_relativeDistanceThreshold*minBoxSize)
+        {
+            std::string mesg = gmx::formatString("There are inconsistent shifts over periodic boundaries in a molecule type consisting of %d atoms. The longest distance involved in such interactions is %.3f nm which is %s half the box length.",
+                                                 g->at1 - g->at0, maxDistance,
+                                                 maxDistance >= 0.5*minBoxSize ? "above" : "close to");
+
+            switch (g->parts)
+            {
+                case t_graph::BondedParts::MultipleConnected:
+                    /* Ideally we should check if the long distances are
+                     * actually between the parts, but that would require
+                     * a lot of extra code.
+                     */
+                    mesg += " This molecule type consists of muliple parts, e.g. monomers, that are connected by interactions that are not chemical bonds, e.g. restraints. Such systems can not be treated. The only solution is increasing the box size.";
+                    break;
+                default:
+                    mesg += " Either you have excessively large distances between atoms in bonded interactions or your system is exploding.";
+            }
+            gmx_fatal(FARGS, mesg.c_str());
+        }
+
+        /* The most likely reason for arriving here is a periodic molecule. */
+
         nerror_tot++;
         if (nerror_tot <= 100)
         {
index c5540bc34b8647b20106b9793e5be8c37cdcd03f..aa33f3c4daad2ae3c54c105f12cf07a87416de86 100644 (file)
@@ -3,7 +3,7 @@
  *
  * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
  * Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2018, 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.
@@ -53,7 +53,18 @@ typedef enum {
     egcolWhite, egcolGrey, egcolBlack, egcolNR
 } egCol;
 
-typedef struct t_graph {
+struct t_graph
+{
+    /* Described the connectivity between, potentially, multiple parts of
+     * the ilist that are internally chemically bonded together.
+     */
+    enum class BondedParts
+    {
+        Single,               /* All atoms are connected through chemical bonds */
+        MultipleDisconnected, /* There are multiple parts, e.g. monomers, that are all disconnected */
+        MultipleConnected     /* There are multiple parts, e.g. monomers, that are partially or fully connected between each other by interactions other than chemical bonds */
+    };
+
     int          at0;       /* The first atom the graph was constructed for */
     int          at1;       /* The last atom the graph was constructed for  */
     int          nnodes;    /* The number of nodes, nnodes=at_end-at_start  */
@@ -66,7 +77,8 @@ typedef struct t_graph {
     ivec        *ishift;    /* Shift for each particle                      */
     int          negc;
     egCol       *egc;       /* color of each node */
-} t_graph;
+    BondedParts  parts;     /* How chemically bonded parts are connected    */
+};
 
 #define SHIFT_IVEC(g, i) ((g)->ishift[i])
 
index c35768f613239508e983b189a28af2354e80a78d..b70adf7333d8c47432aa41974ecf5ca4ca9b31da 100644 (file)
@@ -107,24 +107,44 @@ static inline SimdDouble gmx_simdcall
 simdLoad(const double *m, SimdDoubleTag = {})
 {
     return {
+#if defined(__ibmxl__)
+               vec_ld(0, m)
+#else
+#  if __GNUC__ < 7
                *reinterpret_cast<const __vector double *>(m)
+#  else
+               vec_vsx_ld(0, m)
+#  endif
+#endif
     };
 }
 
 static inline void gmx_simdcall
 store(double *m, SimdDouble a)
 {
+#if defined(__ibmxl__)
+    vec_st(a.simdInternal_, 0, m);
+#else
+#  if __GNUC__ < 7
     *reinterpret_cast<__vector double *>(m) = a.simdInternal_;
+#  else
+    vec_vsx_st(a.simdInternal_, 0, m);
+#  endif
+#endif
 }
 
 static inline SimdDouble gmx_simdcall
 simdLoadU(const double *m, SimdDoubleTag = {})
 {
     return {
-#if __GNUC__ < 7
-               *reinterpret_cast<const __vector double *>(m)
-#else
+#if defined(__ibmxl__)
                vec_xl(0, m)
+#else
+#  if __GNUC__ < 7
+               *reinterpret_cast<const __vector double *>(m)
+#  else
+               vec_vsx_ld(0, m)
+#  endif
 #endif
     };
 }
@@ -132,10 +152,14 @@ simdLoadU(const double *m, SimdDoubleTag = {})
 static inline void gmx_simdcall
 storeU(double *m, SimdDouble a)
 {
-#if __GNUC__ < 7
-    *reinterpret_cast<__vector double *>(m) = a.simdInternal_;
-#else
+#if defined(__ibmxl__)
     vec_xst(a.simdInternal_, 0, m);
+#else
+#  if __GNUC__ < 7
+    *reinterpret_cast<__vector double *>(m) = a.simdInternal_;
+#  else
+    vec_vsx_st(a.simdInternal_, 0, m);
+#  endif
 #endif
 }
 
index d413a5c73321fe9f883cffb1676d6756200e9eee..6d96e43ce4a7a9945dd40124a13f143f437dc5f9 100644 (file)
@@ -278,8 +278,12 @@ gatherLoadUBySimdIntTranspose(const double *  base,
 {
     alignas(GMX_SIMD_ALIGNMENT) std::int32_t ioffset[GMX_SIMD_DINT32_WIDTH];
 
-    store(ioffset, offset );
-    gatherLoadTranspose<align>(base, ioffset, v0, v1);
+    store(ioffset, offset);
+
+    SimdDouble t1     = simdLoadU(base + align * ioffset[0]);
+    SimdDouble t2     = simdLoadU(base + align * ioffset[1]);
+    v0->simdInternal_ = vec_mergeh(t1.simdInternal_, t2.simdInternal_);
+    v1->simdInternal_ = vec_mergel(t1.simdInternal_, t2.simdInternal_);
 }
 
 static inline double gmx_simdcall
index 9a980cbf6a89f521cbb12025145ec245b313708e..309d054f494f14e57332fe0316a116f0af366f73 100644 (file)
@@ -651,9 +651,10 @@ static void print_hw_opt(FILE *fp, const gmx_hw_opt_t *hw_opt)
             hw_opt->userGpuTaskAssignment.c_str());
 }
 
-void check_and_update_hw_opt_1(gmx_hw_opt_t    *hw_opt,
-                               const t_commrec *cr,
-                               int              nPmeRanks)
+void check_and_update_hw_opt_1(const gmx::MDLogger &mdlog,
+                               gmx_hw_opt_t        *hw_opt,
+                               const t_commrec     *cr,
+                               int                  nPmeRanks)
 {
     /* Currently hw_opt only contains default settings or settings supplied
      * by the user on the command line.
@@ -666,7 +667,7 @@ void check_and_update_hw_opt_1(gmx_hw_opt_t    *hw_opt,
     /* Check for OpenMP settings stored in environment variables, which can
      * potentially be different on different MPI ranks.
      */
-    gmx_omp_nthreads_read_env(&hw_opt->nthreads_omp, SIMMASTER(cr));
+    gmx_omp_nthreads_read_env(mdlog, &hw_opt->nthreads_omp);
 
     /* Check restrictions on the user supplied options before modifying them.
      * TODO: Put the user values in a const struct and preserve them.
index 91b6914862f0207e04af8d74be8c8fd9f6a95d81..5fcc64e6e40cf1f8d939c5aa0512ddb04e6dab7a 100644 (file)
@@ -98,9 +98,10 @@ void check_resource_division_efficiency(const gmx_hw_info_t *hwinfo,
                                         const gmx::MDLogger &mdlog);
 
 /*! \brief Checks we can do when we don't (yet) know the cut-off scheme */
-void check_and_update_hw_opt_1(gmx_hw_opt_t    *hw_opt,
-                               const t_commrec *cr,
-                               int              nPmeRanks);
+void check_and_update_hw_opt_1(const gmx::MDLogger &mdlog,
+                               gmx_hw_opt_t        *hw_opt,
+                               const t_commrec     *cr,
+                               int                  nPmeRanks);
 
 /*! \brief Checks we can do when we know the cut-off scheme */
 void check_and_update_hw_opt_2(gmx_hw_opt_t *hw_opt,
index 0ebd30a4f503902839fd5485185a25b396f9e21e..dd7c769483bc447c211c8bedb82e69d5ff89f942 100644 (file)
@@ -83,7 +83,7 @@ std::string DataFileFinder::Impl::getDefaultPath()
     if (!isNullOrEmpty(installPrefix.path))
     {
         const char *const dataPath
-            = installPrefix.bSourceLayout ? "share" : DATA_INSTALL_DIR;
+            = installPrefix.bSourceLayout ? "share" : GMX_INSTALL_GMXDATADIR;
         return Path::join(installPrefix.path, dataPath, "top");
     }
     return std::string();
index 81e7e293014bd0b990f8302a17d21feed4fe1029..d56eb87a25503404f17f3cbe7b754fbbcf57290b 100644 (file)
@@ -1,7 +1,7 @@
 #
 # This file is part of the GROMACS molecular simulation package.
 #
-# Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+# Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2018, 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.
@@ -52,11 +52,11 @@ elseif(GMX_BUILD_MDRUN_ONLY)
     set_target_properties(mdrun PROPERTIES
         OUTPUT_NAME "${BINARY_NAME}"
         COMPILE_FLAGS "${OpenMP_C_FLAGS}")
-    install(TARGETS mdrun DESTINATION ${BIN_INSTALL_DIR} COMPONENT mdrun)
+    install(TARGETS mdrun DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT mdrun)
     file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gmx-completion-${BINARY_NAME}.bash
          "complete -o nospace -F _gmx_mdrun_compl ${BINARY_NAME}")
     install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gmx-completion-${BINARY_NAME}.bash
-            DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime)
+            DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime)
 else()
     file(GLOB GMX_MAIN_SOURCES gmx.cpp legacymodules.cpp)
     if(GMX_X11)
@@ -81,7 +81,7 @@ else()
         OUTPUT_NAME "${BINARY_NAME}"
         COMPILE_FLAGS "${OpenMP_C_FLAGS}")
     install(TARGETS gmx
-            RUNTIME DESTINATION ${BIN_INSTALL_DIR})
+            RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
 
     ########################
     # Completion generation
@@ -108,11 +108,11 @@ else()
     endif()
     if (SOURCE_IS_SOURCE_DISTRIBUTION OR GMX_BUILD_HELP)
         install(DIRECTORY ${COMPLETION_DIR}/
-                DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime OPTIONAL)
+                DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime OPTIONAL)
         file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/gmx-completion-${BINARY_NAME}.bash
              "complete -o nospace -F _gmx_compl ${BINARY_NAME}")
         install(FILES ${CMAKE_CURRENT_BINARY_DIR}/gmx-completion-${BINARY_NAME}.bash
-                DESTINATION ${BIN_INSTALL_DIR} COMPONENT runtime)
+                DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT runtime)
     endif()
     gmx_cpack_add_generated_source_directory(completion)