set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
-# PROJECT_VERSION should have the following structure:
-# VERSION-dev[-SUFFIX] where the VERSION should have the for: vMajor.vMinor.vPatch
-#
-# The "-dev" suffix is important to keep because it makes possible to distinguish
-# between a build from official release and a build from git release branch on a
-# machine with no git.
-#
-# NOTE: when releasing the "-dev" suffix needs to be stripped off!
-# REGRESSIONTEST_VERSION and REGRESSIONTEST_BRANCH should always be
-# defined.
-set(PROJECT_VERSION "5.0.1-dev")
-# If this is a released tarball, "-dev" will not be present in
-# PROJECT_VERSION, and REGRESSIONTEST_VERSION specifies the version
-# number of the regressiontest tarball against which the code tarball
-# can be tested. This will be the version of the last patch release.
-set(REGRESSIONTEST_VERSION "5.0.1-dev")
-# The MD5 checksum of the regressiontest tarball. Only used if "-dev"
-# is not present in the PROJECT_VERSION
-set(REGRESSIONTEST_MD5SUM "a07524afebca5013540d4f2f72df2dce")
-# If this is not a released tarball, "-dev" will be present in
-# PROJECT_VERSION, and REGRESSIONTEST_BRANCH specifies the name of the
-# gerrit.gromacs.org branch whose HEAD can test this code, *if* this
-# code contains all recent fixes from the corresponding code branch.
-set(REGRESSIONTEST_BRANCH "refs/heads/release-5-0")
-
-set(CUSTOM_VERSION_STRING ""
- CACHE STRING "Custom version string (if empty, use hard-coded default)")
-mark_as_advanced(CUSTOM_VERSION_STRING)
-if (CUSTOM_VERSION_STRING)
- set(PROJECT_VERSION ${CUSTOM_VERSION_STRING})
-endif()
-set(LIBRARY_SOVERSION 0)
-set(LIBRARY_VERSION ${LIBRARY_SOVERSION}.0.0)
-# It is a bit irritating, but this has to be set separately for now!
-SET(CPACK_PACKAGE_VERSION_MAJOR "5")
-SET(CPACK_PACKAGE_VERSION_MINOR "0")
-#SET(CPACK_PACKAGE_VERSION_PATCH "0")
-
-# The numerical gromacs version. It is 40600 for 4.6.0.
-# The #define GMX_VERSION in gromacs/version.h is set to this value.
-math(EXPR NUM_VERSION
- "${CPACK_PACKAGE_VERSION_MAJOR}*10000 + ${CPACK_PACKAGE_VERSION_MINOR}*100")
-if(CPACK_PACKAGE_VERSION_PATCH)
- math(EXPR NUM_VERSION
- "${NUM_VERSION} + ${CPACK_PACKAGE_VERSION_PATCH}")
-endif()
-
-# The API version tracks the numerical Gromacs version (for now).
-# It is potentially different from the Gromacs version in the future, if
-# the programs/libraries diverge from the presumably more stable API.
-# The #define GMX_API_VERSION in version.h is set to this value to
-# provide backward compatibility of software written against the Gromacs API.
-set(API_VERSION ${NUM_VERSION})
+# Set up common version variables, as well as general information about
+# the build tree (whether the build is from a source package or from a git
+# repository). Also declares a few functions that will be used for generating
+# version info files later.
+include(gmxVersionInfo)
if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT AND UNIX)
set(CMAKE_INSTALL_PREFIX "/usr/local/gromacs" CACHE STRING "Installation prefix (installation will need write permissions here)" FORCE)
endif()
include(gmxBuildTypeReference)
+include(gmxBuildTypeProfile)
include(gmxBuildTypeTSAN)
include(gmxBuildTypeASAN)
include(gmxBuildTypeReleaseWithAssert)
if(NOT CMAKE_BUILD_TYPE)
- set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel Reference RelWithAssert." FORCE)
+ set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel Reference RelWithAssert Profile." FORCE)
# There's no need to offer a user the choice of ThreadSanitizer
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release"
- "MinSizeRel" "RelWithDebInfo" "Reference" "RelWithAssert")
+ "MinSizeRel" "RelWithDebInfo" "Reference" "RelWithAssert" "Profile")
endif()
if(CMAKE_CONFIGURATION_TYPES)
# Add appropriate GROMACS-specific build types for the Visual
"List of configuration types"
FORCE)
endif()
-set(build_types_with_explicit_flags RELEASE DEBUG RELWITHDEBUGINFO RELWITHASSERT MINSIZEREL)
-
-enable_language(C)
-enable_language(CXX)
+set(build_types_with_explicit_flags RELEASE DEBUG RELWITHDEBUGINFO RELWITHASSERT MINSIZEREL PROFILE)
set(CPACK_PACKAGE_NAME "gromacs")
-set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION})
+set(CPACK_PACKAGE_VERSION_MAJOR ${GMX_VERSION_MAJOR})
+set(CPACK_PACKAGE_VERSION_MINOR ${GMX_VERSION_MINOR})
+set(CPACK_PACKAGE_VERSION_PATCH ${GMX_VERSION_PATCH})
+set(CPACK_PACKAGE_VERSION ${GMX_VERSION_STRING})
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
set(CPACK_PACKAGE_VENDOR "gromacs.org")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Gromacs - a toolkit for high-performance molecular simulation")
"File that contains suppressions for the memory checker")
include(CTest)
-set(SOURCE_IS_GIT_REPOSITORY OFF)
-set(SOURCE_IS_SOURCE_DISTRIBUTION OFF)
-if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
- set(SOURCE_IS_GIT_REPOSITORY ON)
-endif()
-if(NOT EXISTS "${CMAKE_SOURCE_DIR}/admin/.isreposource")
- set(SOURCE_IS_SOURCE_DISTRIBUTION ON)
-endif()
+# Variables that accumulate stuff influencing the installed headers
+set(INSTALLED_HEADER_INCLUDE_DIRS "")
+set(INSTALLED_HEADER_DEFINITIONS "")
########################################################################
# Check and warn if cache generated on a different host is being reused
option(GMX_USE_TNG "Use the TNG library for trajectory I/O" ON)
-option(GMX_GIT_VERSION_INFO "Generate git version information" ${SOURCE_IS_GIT_REPOSITORY})
-mark_as_advanced(GMX_GIT_VERSION_INFO)
-
if(UNIX)
option(GMX_SYMLINK_OLD_BINARY_NAMES "Create symbolic links for pre-5.0 binary names" ON)
endif()
endif()
-
-set(PKG_CFLAGS "")
if(GMX_DOUBLE)
add_definitions(-DGMX_DOUBLE)
- set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_DOUBLE")
+ list(APPEND INSTALLED_HEADER_DEFINITIONS "-DGMX_DOUBLE")
endif()
if(GMX_SOFTWARE_INVSQRT)
- set(PKG_CFLAGS "${PKG_CFLAGS} -DGMX_SOFTWARE_INVSQRT")
+ list(APPEND INSTALLED_HEADER_DEFINITIONS "-DGMX_SOFTWARE_INVSQRT")
endif()
if(WIN32 AND NOT CYGWIN)
add_definitions(-DNOMINMAX)
endif()
-# only bother with finding git and using version.h if the source is a git repo
-if(GMX_GIT_VERSION_INFO)
- if (NOT SOURCE_IS_GIT_REPOSITORY)
- message(FATAL_ERROR
- "Cannot generate git version information from source tree not under git. "
- "Set GMX_GIT_VERSION_INFO=OFF to proceed.")
- endif()
- # We need at least git v1.5.3 be able to parse git's date output. If not
- # found or the version is too small, we can't generate version information.
- find_package(Git)
-
- if(NOT GIT_FOUND OR GIT_VERSION_STRING VERSION_LESS "1.5.3")
- message(FATAL_ERROR
- "No compatible git version found (>= 1.5.3 required). "
- "Won't be able to generate development version information. "
- "Set GMX_GIT_VERSION_INFO=OFF to proceed.")
- endif()
-endif()
-
# Detect boost unless GMX_EXTERNAL_BOOST is explicitly OFF
# Used for default if GMX_EXTERNAL_BOOST is not defined (first CMake pass)
if(NOT DEFINED GMX_EXTERNAL_BOOST OR GMX_EXTERNAL_BOOST)
"Either set GMX_BUILD_UNITTESTS=OFF or tell CMake how to find a working version of libxml2.")
endif()
-########################################################################
-# Generate development version info for cache
-########################################################################
-# set(GEN_VERSION_INFO_INTERNAL "ON")
-# include(gmxGenerateVersionString)
-
+ if(GMX_USE_TNG AND NOT GMX_EXTERNAL_TNG)
+ # TNG wants zlib if it is available
+ find_package(ZLIB QUIET)
+ include(gmxTestZLib)
+ gmx_test_zlib(HAVE_ZLIB)
+ endif()
+
########################################################################
# Our own GROMACS tests
########################################################################
include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src/external/thread_mpi/include)
# Required for config.h, maybe should only be set in src/CMakeLists.txt
include_directories(BEFORE ${CMAKE_BINARY_DIR}/src)
-# Required for gmx_header_config_gen.h to be found before installation
-include_directories(BEFORE ${CMAKE_BINARY_DIR}/src/gromacs/utility)
-# Required for now to make old code compile
-include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src/gromacs/legacyheaders)
include(gmxTestInlineASM)
gmx_test_inline_asm_gcc_x86(GMX_X86_GCC_INLINE_ASM)
set(GMX_EXE_LINKER_FLAGS ${GMX_EXE_LINKER_FLAGS} ${OpenMP_LINKER_FLAGS})
set(GMX_SHARED_LINKER_FLAGS ${GMX_SHARED_LINKER_FLAGS} ${OpenMP_SHARED_LINKER_FLAGS})
endif()
-set(PKG_CFLAGS "${PKG_CFLAGS} ${OpenMP_C_FLAGS}")
########################################################################
# Specify install locations
# 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)
-set(DATA_INSTALL_DIR share/${GMX_DATA_INSTALL_DIR})
-set(MAN_INSTALL_DIR share/man)
-set(INCL_INSTALL_DIR include)
+set(LIB_INSTALL_DIR ${GMX_LIB_INSTALL_DIR})
+set(BIN_INSTALL_DIR bin)
+set(DATA_INSTALL_DIR share/${GMX_DATA_INSTALL_DIR})
+set(MAN_INSTALL_DIR share/man)
+# If the nesting level wrt. the installation root is changed,
+# gromacs-config.cmake.cmakein needs to be adapted.
+set(CMAKE_INSTALL_DIR share/cmake)
+# TODO: Make GMXRC adapt if this is changed
+set(PKGCONFIG_INSTALL_DIR ${LIB_INSTALL_DIR}/pkgconfig)
+set(INCL_INSTALL_DIR include)
# These variables get written into config.h for use in finding the data
# directories.
set(GMXLIB_SEARCH_DIR share/${GMX_DATA_INSTALL_DIR}/top)
set(GMXLIB_FALLBACK ${CMAKE_INSTALL_PREFIX}/${DATA_INSTALL_DIR}/top)
+list(APPEND INSTALLED_HEADER_INCLUDE_DIRS ${INCL_INSTALL_DIR})
+
# Binary and library suffix options
include(gmxManageSuffixes)
if(GMX_EXTERNAL_BOOST)
include_directories(${Boost_INCLUDE_DIRS})
- set(PKG_CFLAGS "${PKG_CFLAGS} -I${Boost_INCLUDE_DIRS}")
+ list(APPEND INSTALLED_HEADER_INCLUDE_DIRS ${Boost_INCLUDE_DIRS})
else()
include_directories(BEFORE ${CMAKE_SOURCE_DIR}/src/external/boost)
+ list(APPEND INSTALLED_HEADER_INCLUDE_DIRS ${INCL_INSTALL_DIR}/gromacs/external/boost)
+ list(APPEND INSTALLED_HEADED_DEFINITIONS "-DBOOST_NO_TYPEID")
# typeid not supported for minimal internal version
# (would add significant amount of code)
add_definitions(-DBOOST_NO_TYPEID)
- # TODO: Propagate the above settings to the installed CMakeFiles.txt template
- # (from share/template/)
- set(PKG_CFLAGS "${PKG_CFLAGS} -DBOOST_NO_TYPEID -I${CMAKE_INSTALL_PREFIX}/${INCL_INSTALL_DIR}/gromacs/external/boost")
if (NOT GMX_BUILD_MDRUN_ONLY)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/src/external/boost/boost
DESTINATION ${INCL_INSTALL_DIR}/gromacs/external/boost
# be set up elsewhere and passed to this function, but it is
# inconvenient in CMake to pass more than one list, and such a
# list is only used here.
- foreach(build_type RELWITHDEBUGINFO RELWITHASSERT MINSIZEREL)
+ foreach(build_type RELWITHDEBUGINFO RELWITHASSERT MINSIZEREL PROFILE)
set(GMXC_${language}FLAGS_${build_type} "${GMXC_${language}FLAGS_RELEASE}")
endforeach()
# Copy the flags that are only used by the real Release build
# Since 4.8 on by default. For previous version disabling is a no-op. Only disabling for Release because with assert
# the warnings are OK.
GMX_TEST_CFLAG(CFLAGS_WARN_REL "-Wno-array-bounds" GMXC_CFLAGS_RELEASE_ONLY)
- # Since gcc 4.8 strict - false postives with old gmx_fatal. TODO: Remove in master
- GMX_TEST_CFLAG(CFLAGS_WARN_UNINIT "-Wno-maybe-uninitialized" GMXC_CFLAGS)
if(CYGWIN)
GMX_TEST_CFLAG(CFLAGS_WARN_SUBSCRIPT "-Wno-char-subscripts" GMXC_CFLAGS)
endif()
# new in gcc 4.5
GMX_TEST_CFLAG(CFLAGS_EXCESS_PREC "-fexcess-precision=fast" GMXC_CFLAGS_RELEASE)
- GMX_TEST_CFLAG(CFLAGS_COPT "-fomit-frame-pointer -funroll-all-loops"
+ GMX_TEST_CFLAG(CFLAGS_COPT "-funroll-all-loops"
GMXC_CFLAGS_RELEASE)
GMX_TEST_CFLAG(CFLAGS_NOINLINE "-fno-inline" GMXC_CFLAGS_DEBUG)
endif()
GMX_TEST_CFLAG(CXXFLAGS_WARN_REL "-Wno-array-bounds" GMXC_CXXFLAGS_RELEASE_ONLY)
# new in gcc 4.5
GMX_TEST_CXXFLAG(CXXFLAGS_EXCESS_PREC "-fexcess-precision=fast" GMXC_CXXFLAGS_RELEASE)
- GMX_TEST_CXXFLAG(CXXFLAGS_COPT "-fomit-frame-pointer -funroll-all-loops"
+ GMX_TEST_CXXFLAG(CXXFLAGS_COPT "-funroll-all-loops"
GMXC_CXXFLAGS_RELEASE)
GMX_TEST_CXXFLAG(CXXFLAGS_NOINLINE "-fno-inline" GMXC_CXXFLAGS_DEBUG)
endif()
endif()
# xlc
+ # The suppressions below stop information messages about -O3
+ # causing non-strict IEEE compliance that changes the semantics of
+ # the program (duh; 1500-036), warnings about correct PBC-related use of
+ # maximum array indices of DIM-sized C arrays (1500-010).
if (CMAKE_C_COMPILER_ID MATCHES "XL")
GMX_TEST_CFLAG(CFLAGS_OPT "-qarch=auto -qtune=auto" GMXC_CFLAGS)
GMX_TEST_CFLAG(CFLAGS_LANG "-qlanglvl=extc99" GMXC_CFLAGS)
+ GMX_TEST_CFLAG(CFLAGS_LANG "-qsuppress=1500-036 -qsuppress=1500-010" GMXC_CFLAGS)
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "XL")
GMX_TEST_CXXFLAG(CXXFLAGS_OPT "-qarch=auto -qtune=auto" GMXC_CXXFLAGS)
+ GMX_TEST_CXXFLAG(CFLAGS_LANG "-qsuppress=1500-036 -qsuppress=1500-010" GMXC_CXXFLAGS)
endif()
# msvc
message(STATUS "Detecting best SIMD instructions for this CPU")
# Get CPU SIMD properties information
- set(_compile_definitions "@GCC_INLINE_ASM_DEFINE@ -I${CMAKE_SOURCE_DIR}/src -DGMX_CPUID_STANDALONE")
- set(_compile_definitions "${GCC_INLINE_ASM_DEFINE} -I${CMAKE_SOURCE_DIR}/src/gromacs/legacyheaders -DGMX_CPUID_STANDALONE")
++ set(_compile_definitions "${GCC_INLINE_ASM_DEFINE} -I${CMAKE_SOURCE_DIR}/src -DGMX_CPUID_STANDALONE")
if(GMX_TARGET_X86)
set(_compile_definitions "${_compile_definitions} -DGMX_TARGET_X86")
endif()
set(OUTPUT_TMP "None")
endif(NOT GMX_CPUID_COMPILED)
- string(STRIP "@OUTPUT_TMP@" OUTPUT_SIMD)
+ string(STRIP "${OUTPUT_TMP}" OUTPUT_SIMD)
- set(${_suggested_simd} "@OUTPUT_SIMD@" PARENT_SCOPE)
- message(STATUS "Detected best SIMD instructions for this CPU - @OUTPUT_SIMD@")
+ set(${_suggested_simd} "${OUTPUT_SIMD}" PARENT_SCOPE)
+ message(STATUS "Detected best SIMD instructions for this CPU - ${OUTPUT_SIMD}")
endfunction()
function(gmx_detect_simd _suggested_simd)
execute_process( COMMAND date OUTPUT_VARIABLE TMP_TIME OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process( COMMAND whoami OUTPUT_VARIABLE TMP_USER OUTPUT_STRIP_TRAILING_WHITESPACE)
execute_process( COMMAND hostname OUTPUT_VARIABLE TMP_HOSTNAME OUTPUT_STRIP_TRAILING_WHITESPACE)
- set(BUILD_USER "@TMP_USER@\@@TMP_HOSTNAME@ [CMAKE]" CACHE INTERNAL "Build user")
- set(BUILD_TIME "@TMP_TIME@" CACHE INTERNAL "Build date & time")
+ set(BUILD_USER "${TMP_USER}\@${TMP_HOSTNAME} [CMAKE]" CACHE INTERNAL "Build user")
+ set(BUILD_TIME "${TMP_TIME}" CACHE INTERNAL "Build date & time")
execute_process( COMMAND uname -srm OUTPUT_VARIABLE TMP_HOST OUTPUT_STRIP_TRAILING_WHITESPACE)
- set(BUILD_HOST "@TMP_HOST@" CACHE INTERNAL "Build host & architecture")
+ set(BUILD_HOST "${TMP_HOST}" CACHE INTERNAL "Build host & architecture")
message(STATUS "Setting build user & time - OK")
else()
- set(BUILD_USER "Anonymous@unknown [CMAKE]" CACHE INTERNAL "Build user")
+ set(BUILD_USER "Anonymous\@unknown [CMAKE]" CACHE INTERNAL "Build user")
set(BUILD_TIME "Unknown date" CACHE INTERNAL "Build date & time")
- set(BUILD_HOST "@CMAKE_HOST_SYSTEM@ @CMAKE_HOST_SYSTEM_PROCESSOR@" CACHE INTERNAL "Build host & architecture")
+ set(BUILD_HOST "${CMAKE_HOST_SYSTEM} ${CMAKE_HOST_SYSTEM_PROCESSOR}" CACHE INTERNAL "Build host & architecture")
message(STATUS "Setting build user & time - not on Unix, using anonymous")
endif()
if(NOT CMAKE_CROSSCOMPILING)
# Get CPU information, e.g. for deciding what SIMD support exists
- set(_compile_definitions "@GCC_INLINE_ASM_DEFINE@ -I${CMAKE_SOURCE_DIR}/src -DGMX_CPUID_STANDALONE")
- set(_compile_definitions "${GCC_INLINE_ASM_DEFINE} -I${CMAKE_SOURCE_DIR}/src/gromacs/legacyheaders -DGMX_CPUID_STANDALONE")
++ set(_compile_definitions "${GCC_INLINE_ASM_DEFINE} -I${CMAKE_SOURCE_DIR}/src -DGMX_CPUID_STANDALONE")
if(GMX_TARGET_X86)
set(_compile_definitions "${_compile_definitions} -DGMX_TARGET_X86")
endif()
RUN_OUTPUT_VARIABLE OUTPUT_CPU_FEATURES ARGS "-features")
unset(_compile_definitions)
- string(STRIP "@OUTPUT_CPU_VENDOR@" OUTPUT_CPU_VENDOR)
- string(STRIP "@OUTPUT_CPU_BRAND@" OUTPUT_CPU_BRAND)
- string(STRIP "@OUTPUT_CPU_FAMILY@" OUTPUT_CPU_FAMILY)
- string(STRIP "@OUTPUT_CPU_MODEL@" OUTPUT_CPU_MODEL)
- string(STRIP "@OUTPUT_CPU_STEPPING@" OUTPUT_CPU_STEPPING)
- string(STRIP "@OUTPUT_CPU_FEATURES@" OUTPUT_CPU_FEATURES)
+ string(STRIP "${OUTPUT_CPU_VENDOR}" OUTPUT_CPU_VENDOR)
+ string(STRIP "${OUTPUT_CPU_BRAND}" OUTPUT_CPU_BRAND)
+ string(STRIP "${OUTPUT_CPU_FAMILY}" OUTPUT_CPU_FAMILY)
+ string(STRIP "${OUTPUT_CPU_MODEL}" OUTPUT_CPU_MODEL)
+ string(STRIP "${OUTPUT_CPU_STEPPING}" OUTPUT_CPU_STEPPING)
+ string(STRIP "${OUTPUT_CPU_FEATURES}" OUTPUT_CPU_FEATURES)
if(GMX_CPUID_RUN_VENDOR EQUAL 0)
- set(BUILD_CPU_VENDOR "@OUTPUT_CPU_VENDOR@" CACHE INTERNAL "Build CPU vendor")
+ set(BUILD_CPU_VENDOR "${OUTPUT_CPU_VENDOR}" CACHE INTERNAL "Build CPU vendor")
else()
set(BUILD_CPU_VENDOR "Unknown, detect failed" CACHE INTERNAL "Build CPU vendor")
endif()
if(GMX_CPUID_RUN_BRAND EQUAL 0)
- set(BUILD_CPU_BRAND "@OUTPUT_CPU_BRAND@" CACHE INTERNAL "Build CPU brand")
+ set(BUILD_CPU_BRAND "${OUTPUT_CPU_BRAND}" CACHE INTERNAL "Build CPU brand")
else()
set(BUILD_CPU_BRAND "Unknown, detect failed" CACHE INTERNAL "Build CPU brand")
endif()
if(GMX_CPUID_RUN_FAMILY EQUAL 0)
- set(BUILD_CPU_FAMILY "@OUTPUT_CPU_FAMILY@" CACHE INTERNAL "Build CPU family")
+ set(BUILD_CPU_FAMILY "${OUTPUT_CPU_FAMILY}" CACHE INTERNAL "Build CPU family")
else()
set(BUILD_CPU_FAMILY "0" CACHE INTERNAL "Build CPU family")
endif()
if(GMX_CPUID_RUN_MODEL EQUAL 0)
- set(BUILD_CPU_MODEL "@OUTPUT_CPU_MODEL@" CACHE INTERNAL "Build CPU model")
+ set(BUILD_CPU_MODEL "${OUTPUT_CPU_MODEL}" CACHE INTERNAL "Build CPU model")
else()
set(BUILD_CPU_MODEL "0" CACHE INTERNAL "Build CPU model")
endif()
if(GMX_CPUID_RUN_STEPPING EQUAL 0)
- set(BUILD_CPU_STEPPING "@OUTPUT_CPU_STEPPING@" CACHE INTERNAL "Build CPU stepping")
+ set(BUILD_CPU_STEPPING "${OUTPUT_CPU_STEPPING}" CACHE INTERNAL "Build CPU stepping")
else()
set(BUILD_CPU_STEPPING "0" CACHE INTERNAL "Build CPU stepping")
endif()
if(GMX_CPUID_RUN_FEATURES EQUAL 0)
- set(BUILD_CPU_FEATURES "@OUTPUT_CPU_FEATURES@" CACHE INTERNAL "Build CPU features")
+ set(BUILD_CPU_FEATURES "${OUTPUT_CPU_FEATURES}" CACHE INTERNAL "Build CPU features")
else()
set(BUILD_CPU_FEATURES "" CACHE INTERNAL "Build CPU features")
endif()
is determined by CMake.
The name of the directory can be changed using `GMX_LIB_INSTALL_DIR` CMake
variable.
+`lib/pkgconfig/`
+ : Information about the installed `libgromacs` library for `pkg-config` is
+ installed here. The `lib/` part adapts to the installation location of the
+ libraries. The installed files contain the installation prefix as absolute
+ paths.
+`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
You need to arrange for FFTW to be installed correctly, following the
above instructions.
- `mpicc` is used for compiling and linking. This can make it awkward to
+ MPI wrapper compilers should be used for compiling and linking. Both
+ xlc and bgclang are supported back ends - either might prove to be
+ faster in practice. The MPI wrapper compilers can make it awkward to
attempt to use IBM's optimized BLAS/LAPACK called ESSL (see the
- section on
- [linear algebra libraries](#linear-algebra-libraries)). Since mdrun is
- the only part of GROMACS that should normally run on the compute
- nodes, and there is nearly no need for linear algebra support for
- mdrun, it is recommended to use the GROMACS built-in linear algebra
- routines - it is rare for this to run slowly.
+ section on [linear algebra
+ libraries](#linear-algebra-libraries)). Since mdrun is the only part
+ of GROMACS that should normally run on the compute nodes, and there is
+ nearly no need for linear algebra support for mdrun, it is recommended
+ to use the GROMACS built-in linear algebra routines - this is never
+ a problem for normal simulations.
The recommended configuration is to use
- cmake .. -DCMAKE_TOOLCHAIN_FILE=Platform/BlueGeneQ-static-XL-CXX \
+ cmake .. -DCMAKE_C_COMPILER=mpicc \
+ -DCMAKE_CXX_COMPILER=mpicxx \
+ -DCMAKE_TOOLCHAIN_FILE=Platform/BlueGeneQ-static-XL-CXX \
-DCMAKE_PREFIX_PATH=/your/fftw/installation/prefix \
-DGMX_MPI=ON \
-DGMX_BUILD_MDRUN_ONLY=ON
make install
which will build a statically-linked MPI-enabled mdrun for the compute
- nodes. Otherwise, GROMACS default configuration behaviour applies.
+ nodes. Or use the Platform/BlueGeneQ-static-bgclang-cxx
+ toolchain file if compiling with bgclang. Otherwise, GROMACS default configuration
+ behaviour applies.
It is possible to configure and make the remaining GROMACS tools with
the compute-node toolchain, but as none of those tools are MPI-aware
/* Binary directory for the build */
#cmakedefine CMAKE_BINARY_DIR "@CMAKE_BINARY_DIR@"
-/* Turn off water-water neighborlist optimization only - not used right now */
-#cmakedefine DISABLE_WATERWATER_NLIST
-
-/* Turn off all water neighborlist optimization - not used right now */
-#cmakedefine DISABLE_WATER_NLIST
-
/* IEEE754 floating-point format. Memory layout is defined by macros
* GMX_IEEE754_BIG_ENDIAN_BYTE_ORDER and GMX_IEEE754_BIG_ENDIAN_WORD_ORDER.
*/
/* Target platform is BlueGene/Q */
#cmakedefine GMX_TARGET_BGQ
+/** Define if we are building for Cygwin */
+#cmakedefine GMX_CYGWIN
+
+/** Define if we have sufficient C++11 support */
+#cmakedefine GMX_CXX11
+
/* GCC bug in AVX maskload/maskstore arguments - worked around internally */
#cmakedefine GMX_SIMD_X86_AVX_GCC_MASKLOAD_BUG
/* Define if SIGUSR1 is present */
#cmakedefine HAVE_SIGUSR1
-/* Define to 1 to make fseeko visible on some hosts (e.g. glibc 2.2). */
-#cmakedefine _LARGEFILE_SOURCE
-
-/* Define for large files, on AIX-style hosts. */
-#cmakedefine _LARGE_FILES
-
-/* Some systems requires this to be set to 64 for large file support */
-#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@
-
-/* Build special-purpose mdrun library */
-#cmakedefine GMX_FAHCORE
-
/* Enable gromacs quotes */
#cmakedefine GMX_COOL_QUOTES
-#ifdef GMX_FAHCORE
-#define FULLINDIRECT 1
-#define USE_FAH_XDR 1
-#include "swindirect.h"
-#endif
-
/* default name mangling maybe wrong on exotic plattforms */
#define F77_FUNC(name,NAME) name ## _
/* Define if we have pipes */
#cmakedefine HAVE_PIPES
+ /* Define if we have zlib */
+ #cmakedefine HAVE_ZLIB
+
/*! \endcond */
include_directories(${TNG_IO_INCLUDE_DIRS})
endif()
if(NOT GMX_EXTERNAL_TNG)
- # TNG wants zlib if it is available
- find_package(ZLIB QUIET)
- include(gmxTestZLib)
- gmx_test_zlib(HAVE_ZLIB)
-
include(${CMAKE_SOURCE_DIR}/src/external/tng_io/BuildTNG.cmake)
tng_get_source_list(TNG_SOURCES TNG_IO_DEFINITIONS)
list(APPEND LIBGROMACS_SOURCES ${TNG_SOURCES})
add_subdirectory(random)
add_subdirectory(onlinehelp)
add_subdirectory(options)
+add_subdirectory(pbcutil)
add_subdirectory(timing)
+add_subdirectory(topology)
add_subdirectory(utility)
add_subdirectory(fileio)
add_subdirectory(swap)
tmpi_get_source_list(THREAD_MPI_SOURCES ${CMAKE_SOURCE_DIR}/src/external/thread_mpi/src)
list(APPEND LIBGROMACS_SOURCES ${THREAD_MPI_SOURCES})
-file(GLOB LIBGROMACS_HEADERS *.h)
+set(LIBGROMACS_HEADERS
+ analysisdata.h
+ commandline.h
+ options.h
+ selection.h
+ trajectoryanalysis.h
+ utility.h)
configure_file(version.h.cmakein version.h)
gmx_install_headers("" ${LIBGROMACS_HEADERS})
gmx_install_headers("" ${CMAKE_CURRENT_BINARY_DIR}/version.h)
-# Add target that generates baseversion-gen.c every time make is run
-# if git version info is requested, or create it statically.
-# This code is here instead of utility/CMakeLists.txt because CMake
-# ignores set_source_file_properties from subdirectories.
-set(GENERATED_VERSION_FILE
- ${CMAKE_CURRENT_BINARY_DIR}/utility/baseversion-gen.c)
-set(GENERATED_VERSION_FILE_SOURCE
- ${CMAKE_CURRENT_SOURCE_DIR}/utility/baseversion-gen.c.cmakein)
-if (GMX_GIT_VERSION_INFO)
- add_custom_target(gmx-version ALL
- COMMAND ${CMAKE_COMMAND}
- -D GIT_EXECUTABLE="${GIT_EXECUTABLE}"
- -D PROJECT_VERSION="${PROJECT_VERSION}"
- -D PROJECT_SOURCE_DIR="${PROJECT_SOURCE_DIR}"
- -D VERSION_CMAKEIN=${GENERATED_VERSION_FILE_SOURCE}
- -D VERSION_OUT=${GENERATED_VERSION_FILE}
- -P ${CMAKE_SOURCE_DIR}/cmake/gmxGenerateVersionInfo.cmake
- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- DEPENDS ${GENERATED_VERSION_FILE_SOURCE}
- COMMENT "Generating git version information")
- set_source_files_properties(${GENERATED_VERSION_FILE}
- PROPERTIES GENERATED true)
-else()
- set(GMX_PROJECT_VERSION_STR ${PROJECT_VERSION})
- configure_file(${GENERATED_VERSION_FILE_SOURCE} ${GENERATED_VERSION_FILE})
-endif()
+# This code is here instead of utility/CMakeLists.txt, because CMake
+# custom commands and source file properties can only be set in the directory
+# that contains the target that uses them.
+# TODO: Generate a header instead that can be included from baseversion.c.
+# That probably simplifies things somewhat.
+set(GENERATED_VERSION_FILE utility/baseversion-gen.c)
+gmx_configure_version_file(
+ utility/baseversion-gen.c.cmakein ${GENERATED_VERSION_FILE}
+ REMOTE_HASH SOURCE_FILE)
list(APPEND LIBGROMACS_SOURCES ${GENERATED_VERSION_FILE})
# apply gcc 4.4.x bug workaround
gmx_apply_gcc44_bug_workaround("mdlib/constr.c")
endif()
-add_library(libgromacs ${LIBGROMACS_SOURCES})
-if (GMX_GIT_VERSION_INFO)
- add_dependencies(libgromacs gmx-version)
+if (GMX_GPU)
+ cuda_add_library(libgromacs ${LIBGROMACS_SOURCES}
+ OPTIONS
+ RELWITHDEBINFO -g
+ DEBUG -g -D_DEBUG_=1)
+else()
+ add_library(libgromacs ${LIBGROMACS_SOURCES})
endif()
# Recent versions of gcc and clang give warnings on scanner.cpp, which
target_link_libraries(libgromacs
${EXTRAE_LIBRARIES}
- ${GMX_GPU_LIBRARIES}
${GMX_EXTRA_LIBRARIES}
${TNG_IO_LIBRARIES}
${FFT_LIBRARIES} ${LINEAR_ALGEBRA_LIBRARIES}
# Only install the library in mdrun-only mode if it is actually necessary
# for the binary
if (NOT GMX_BUILD_MDRUN_ONLY OR BUILD_SHARED_LIBS)
- install(TARGETS libgromacs DESTINATION ${LIB_INSTALL_DIR} COMPONENT libraries)
+ install(TARGETS libgromacs
+ EXPORT libgromacs
+ DESTINATION ${LIB_INSTALL_DIR}
+ COMPONENT libraries)
endif()
if (NOT GMX_BUILD_MDRUN_ONLY)
- configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libgromacs.pc.cmakein
- ${CMAKE_CURRENT_BINARY_DIR}/libgromacs.pc @ONLY)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libgromacs.pc
- DESTINATION ${LIB_INSTALL_DIR}/pkgconfig
- RENAME "libgromacs${GMX_LIBS_SUFFIX}.pc"
- COMPONENT development)
+ include(InstallLibInfo.cmake)
endif()
if (INSTALL_CUDART_LIB) #can be set manual by user
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+#include "gmxpre.h"
+
#include "mdoutf.h"
-#include "gromacs/legacyheaders/xvgr.h"
#include "gromacs/legacyheaders/mdrun.h"
#include "gromacs/legacyheaders/types/commrec.h"
#include "gromacs/legacyheaders/mvdata.h"
#include "xtcio.h"
#include "tngio.h"
#include "trajectory_writing.h"
-#include "checkpoint.h"
-#include "copyrite.h"
+#include "gromacs/legacyheaders/checkpoint.h"
+#include "gromacs/legacyheaders/copyrite.h"
-#include "gromacs/legacyheaders/gmx_fatal.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
+ #include "gromacs/timing/wallcycle.h"
struct gmx_mdoutf {
t_fileio *fp_trn;
int natoms_global;
int natoms_x_compressed;
gmx_groups_t *groups; /* for compressed position writing */
+ gmx_wallcycle_t wcycle;
};
gmx_mdoutf_t init_mdoutf(FILE *fplog, int nfile, const t_filenm fnm[],
int mdrun_flags, const t_commrec *cr,
const t_inputrec *ir, gmx_mtop_t *top_global,
- const output_env_t oenv)
+ const output_env_t oenv, gmx_wallcycle_t wcycle)
{
gmx_mdoutf_t of;
char filemode[3];
of->elamstats = ir->expandedvals->elamstats;
of->simulation_part = ir->simulation_part;
of->x_compression_precision = ir->x_compression_precision;
+ of->wcycle = wcycle;
if (MASTER(cr))
{
return of->fp_dhdl;
}
+ gmx_wallcycle_t mdoutf_get_wcycle(gmx_mdoutf_t of)
+ {
+ return of->wcycle;
+ }
+
void mdoutf_write_to_trajectory_files(FILE *fplog, t_commrec *cr,
gmx_mdoutf_t of,
int mdof_flags,
}
}
+ void mdoutf_tng_close(gmx_mdoutf_t of)
+ {
+ if (of->tng || of->tng_low_prec)
+ {
+ wallcycle_start(of->wcycle, ewcTRAJ);
+ gmx_tng_close(&of->tng);
+ gmx_tng_close(&of->tng_low_prec);
+ wallcycle_stop(of->wcycle, ewcTRAJ);
+ }
+ }
+
void done_mdoutf(gmx_mdoutf_t of)
{
if (of->fp_ene != NULL)
{
gmx_fio_fclose(of->fp_field);
}
+
gmx_tng_close(&of->tng);
gmx_tng_close(&of->tng_low_prec);
#define GMX_FILEIO_MDOUTF_H
#include <stdio.h>
-#include "../legacyheaders/types/simple.h"
-#include "../legacyheaders/types/topology.h"
+
#include "../legacyheaders/types/inputrec.h"
#include "../legacyheaders/types/oenv.h"
#include "../legacyheaders/network.h"
+
+#include "../math/vectypes.h"
++#include "../timing/wallcycle.h"
+#include "../utility/basedefinitions.h"
#include "filenm.h"
#include "enxio.h"
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+struct gmx_mtop_t;
+
typedef struct gmx_mdoutf *gmx_mdoutf_t;
/*! \brief Allocate and initialize object to manager trajectory writing output
int mdrun_flags,
const t_commrec *cr,
const t_inputrec *ir,
- gmx_mtop_t *mtop,
+ struct gmx_mtop_t *mtop,
- const output_env_t oenv);
+ const output_env_t oenv,
+ gmx_wallcycle_t wcycle);
/*! \brief Getter for file pointer */
FILE *mdoutf_get_fp_field(gmx_mdoutf_t of);
/*! \brief Getter for file pointer */
FILE *mdoutf_get_fp_dhdl(gmx_mdoutf_t of);
+ /*! \brief Getter for wallcycle timer */
+ gmx_wallcycle_t mdoutf_get_wcycle(gmx_mdoutf_t of);
+
+ /*! \brief Close TNG files if they are open.
+ *
+ * This also measures the time it takes to close the TNG
+ * files.
+ */
+ void mdoutf_tng_close(gmx_mdoutf_t of);
+
/*! \brief Close all open output files and free the of pointer */
void done_mdoutf(gmx_mdoutf_t of);
void mdoutf_write_to_trajectory_files(FILE *fplog, t_commrec *cr,
gmx_mdoutf_t of,
int mdof_flags,
- gmx_mtop_t *top_global,
+ struct gmx_mtop_t *top_global,
gmx_int64_t step, double t,
t_state *state_local, t_state *state_global,
rvec *f_local, rvec *f_global);
#define MDOF_CPT (1<<4)
#define MDOF_IMD (1<<5)
+#ifdef __cplusplus
+}
+#endif
#endif /* GMX_FILEIO_MDOUTF_H */
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+#include "gmxpre.h"
+
#include "tngio.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include "gromacs/legacyheaders/copyrite.h"
-#include "gromacs/legacyheaders/gmx_fatal.h"
-#include "gromacs/legacyheaders/main.h"
-#include "gromacs/legacyheaders/physics.h"
+#include "gromacs/legacyheaders/types/ifunc.h"
+
+#include "gromacs/fileio/gmxfio.h"
+#include "gromacs/math/units.h"
#include "gromacs/math/utilities.h"
+#include "gromacs/topology/topology.h"
+#include "gromacs/utility/basenetwork.h"
#include "gromacs/utility/common.h"
+#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/programcontext.h"
-#include "gmxfio.h"
static const char *modeToVerb(char mode)
{
#ifdef HAVE_UNISTD_H
char username[256];
- getlogin_r(username, 256);
- if (mode == 'w')
+ if (!getlogin_r(username, 256))
{
- tng_first_user_name_set(*tng, username);
+ if (mode == 'w')
+ {
+ tng_first_user_name_set(*tng, username);
+ }
}
/* TODO: This should be implemented when the above fixme is done (adding data to
* the header). */
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+#include "gmxpre.h"
+
#include "tngio_for_tools.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#include <math.h>
#include "tng/tng_io.h"
#endif
-#include "gromacs/legacyheaders/types/atoms.h"
-#include "gromacs/legacyheaders/physics.h"
-#include "gromacs/legacyheaders/gmx_fatal.h"
-
+#include "gromacs/math/units.h"
#include "gromacs/utility/common.h"
+#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/smalloc.h"
void gmx_prepare_tng_writing(const char *filename,
"FORCES", "LAMBDAS"
};
+ typedef tng_function_status (*set_writing_interval_func_pointer)(tng_trajectory_t,
+ const gmx_int64_t,
+ const gmx_int64_t,
+ const gmx_int64_t,
+ const char*,
+ const char,
+ const char);
+ #ifdef GMX_DOUBLE
+ set_writing_interval_func_pointer set_writing_interval = tng_util_generic_write_interval_double_set;
+ #else
+ set_writing_interval_func_pointer set_writing_interval = tng_util_generic_write_interval_set;
+ #endif
gmx_tng_open(filename, mode, output);
{
case TNG_TRAJ_POSITIONS:
case TNG_TRAJ_VELOCITIES:
- tng_util_generic_write_interval_set(*output, interval, 3, fallbackIds[i],
- fallbackNames[i], TNG_PARTICLE_BLOCK_DATA,
- compression_type);
+ set_writing_interval(*output, interval, 3, fallbackIds[i],
+ fallbackNames[i], TNG_PARTICLE_BLOCK_DATA,
+ compression_type);
break;
case TNG_TRAJ_FORCES:
- tng_util_generic_write_interval_set(*output, interval, 3, fallbackIds[i],
- fallbackNames[i], TNG_PARTICLE_BLOCK_DATA,
- TNG_GZIP_COMPRESSION);
+ set_writing_interval(*output, interval, 3, fallbackIds[i],
+ fallbackNames[i], TNG_PARTICLE_BLOCK_DATA,
+ TNG_GZIP_COMPRESSION);
break;
case TNG_TRAJ_BOX_SHAPE:
- tng_util_generic_write_interval_set(*output, interval, 9, fallbackIds[i],
- fallbackNames[i], TNG_NON_PARTICLE_BLOCK_DATA,
- TNG_GZIP_COMPRESSION);
+ set_writing_interval(*output, interval, 9, fallbackIds[i],
+ fallbackNames[i], TNG_NON_PARTICLE_BLOCK_DATA,
+ TNG_GZIP_COMPRESSION);
break;
case TNG_GMX_LAMBDA:
- tng_util_generic_write_interval_set(*output, interval, 1, fallbackIds[i],
- fallbackNames[i], TNG_NON_PARTICLE_BLOCK_DATA,
- TNG_GZIP_COMPRESSION);
+ set_writing_interval(*output, interval, 1, fallbackIds[i],
+ fallbackNames[i], TNG_NON_PARTICLE_BLOCK_DATA,
+ TNG_GZIP_COMPRESSION);
default:
continue;
}
size = sizeof(double);
break;
default:
- size = 0; /* Just to make the compiler happy. */
gmx_incons("Illegal datatype of box shape values!");
}
for (int i = 0; i < DIM; i++)
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "config.h"
-#include "typedefs.h"
+#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/utility/smalloc.h"
-#include "sysstuff.h"
-#include "vec.h"
-#include "sim_util.h"
-#include "mdrun.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/legacyheaders/sim_util.h"
+#include "gromacs/legacyheaders/mdrun.h"
#include "confio.h"
#include "trajectory_writing.h"
#include "mdoutf.h"
+#include "gromacs/legacyheaders/types/commrec.h"
#include "gromacs/timing/wallcycle.h"
void
gmx_ekindata_t *ekind,
rvec *f,
rvec *f_global,
- gmx_wallcycle_t wcycle,
int *nchkpt,
gmx_bool bCPT,
gmx_bool bRerunMD,
if (mdof_flags != 0)
{
- wallcycle_start(wcycle, ewcTRAJ);
+ wallcycle_start(mdoutf_get_wcycle(outf), ewcTRAJ);
if (bCPT)
{
if (MASTER(cr))
if (bCPT)
{
(*nchkpt)++;
- bCPT = FALSE;
}
debug_gmx();
if (bLastStep && step_rel == ir->nsteps &&
ir->ePBC, state->box);
debug_gmx();
}
- wallcycle_stop(wcycle, ewcTRAJ);
+ wallcycle_stop(mdoutf_get_wcycle(outf), ewcTRAJ);
}
}
#define GMX_FILEIO_TRAJECTORY_WRITING_H
#include <stdio.h>
+
+#include "../legacyheaders/types/commrec_fwd.h"
+#include "../legacyheaders/mdebin.h"
+#include "../timing/wallcycle.h"
+
#include "filenm.h"
#include "mdoutf.h"
-#include "../legacyheaders/typedefs.h"
-#include "../legacyheaders/mdebin.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
/*! \brief Wrapper routine for writing trajectories during mdrun
*
gmx_ekindata_t *ekind,
rvec *f,
rvec *f_global,
- gmx_wallcycle_t wcycle,
int *nchkpt,
gmx_bool bCPT,
gmx_bool bRerunMD,
);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* GMX_FILEIO_TRAJECTORY_WRITING_H */
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "config.h"
-#include <math.h>
-#include <string.h>
#include <ctype.h>
-#include <math.h>
#include <float.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
-#include "sysstuff.h"
-#include "typedefs.h"
+#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/utility/smalloc.h"
-#include "gromacs/fileio/futil.h"
+#include "gromacs/utility/futil.h"
#include "gromacs/commandline/pargs.h"
-#include "macros.h"
+#include "gromacs/legacyheaders/macros.h"
#include "gromacs/fileio/enxio.h"
-#include "physics.h"
-#include "gmx_fatal.h"
-#include "xvgr.h"
+#include "gromacs/math/units.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/legacyheaders/viewit.h"
#include "gmx_ana.h"
#include "gromacs/math/utilities.h"
#include "gromacs/utility/cstringutil.h"
-#include "names.h"
-#include "mdebin.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/legacyheaders/mdebin.h"
/* Structure for the names of lambda vector components */
str += sprintf(str, "dH/dl");
if (strlen(lv->lc->names[lv->dhdl]) > 0)
{
- str += sprintf(str, " (%s)", lv->lc->names[lv->dhdl]);
+ sprintf(str, " (%s)", lv->lc->names[lv->dhdl]);
}
}
}
xvgrclose(fp);
}
+ static int
+ snprint_lambda_vec(char *str, int sz, const char *label, lambda_vec_t *lambda)
+ {
+ int n = 0;
+
+ n += snprintf(str+n, sz-n, "lambda vector [%s]: ", label);
+ if (lambda->index >= 0)
+ {
+ n += snprintf(str+n, sz-n, " init-lambda-state=%d", lambda->index);
+ }
+ if (lambda->dhdl >= 0)
+ {
+ n += snprintf(str+n, sz-n, " dhdl index=%d", lambda->dhdl);
+ }
+ else
+ {
+ int i;
+ for (i = 0; i < lambda->lc->N; i++)
+ {
+ n += snprintf(str+n, sz-n, " (%s) l=%g", lambda->lc->names[i], lambda->val[i]);
+ }
+ }
+ return n;
+ }
+
/* create a collection (array) of barres_t object given a ordered linked list
of barlamda_t sample collections */
static barres_t *barres_list_create(sim_data_t *sd, int *nres,
}
else if (!scprev && !sc)
{
- gmx_fatal(FARGS, "There is no path from lambda=%f -> %f that is covered by foreign lambdas:\ncannot proceed with BAR.\nUse thermodynamic integration of dH/dl by calculating the averages of dH/dl\nwith g_analyze and integrating them.\nAlternatively, use the -extp option if (and only if) the Hamiltonian\ndepends linearly on lambda, which is NOT normally the case.\n", bl->prev->lambda, bl->lambda);
+ char descX[STRLEN], descY[STRLEN];
+ snprint_lambda_vec(descX, STRLEN, "X", bl->prev->lambda);
+ snprint_lambda_vec(descY, STRLEN, "Y", bl->lambda);
+
+ gmx_fatal(FARGS, "There is no path between the states X & Y below that is covered by foreign lambdas:\ncannot proceed with BAR.\nUse thermodynamic integration of dH/dl by calculating the averages of dH/dl\nwith g_analyze and integrating them.\nAlternatively, use the -extp option if (and only if) the Hamiltonian\ndepends linearly on lambda, which is NOT normally the case.\n\n%s\n%s\n", descX, descY);
}
/* normal delta H */
if (!scprev)
{
- gmx_fatal(FARGS, "Could not find a set for foreign lambda = %f\nin the files for lambda = %f", bl->lambda, bl->prev->lambda);
+ char descX[STRLEN], descY[STRLEN];
+ snprint_lambda_vec(descX, STRLEN, "X", bl->lambda);
+ snprint_lambda_vec(descY, STRLEN, "Y", bl->prev->lambda);
+ gmx_fatal(FARGS, "Could not find a set for foreign lambda (state X below)\nin the files for main lambda (state Y below)\n\n%s\n%s\n", descX, descY);
}
if (!sc)
{
- gmx_fatal(FARGS, "Could not find a set for foreign lambda = %f\nin the files for lambda = %f", bl->prev->lambda, bl->lambda);
+ char descX[STRLEN], descY[STRLEN];
+ snprint_lambda_vec(descX, STRLEN, "X", bl->prev->lambda);
+ snprint_lambda_vec(descY, STRLEN, "Y", bl->lambda);
+ gmx_fatal(FARGS, "Could not find a set for foreign lambda (state X below)\nin the files for main lambda (state Y below)\n\n%s\n%s\n", descX, descY);
}
br->a = scprev;
br->b = sc;
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "config.h"
#include <math.h>
#include <string.h>
#endif
#include "gromacs/commandline/pargs.h"
-#include "sysstuff.h"
-#include "typedefs.h"
+#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/utility/smalloc.h"
-#include "macros.h"
-#include "vec.h"
-#include "pbc.h"
-#include "gromacs/fileio/futil.h"
-#include "index.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/utility/futil.h"
+#include "gromacs/topology/index.h"
#include "gromacs/fileio/confio.h"
#include "gromacs/fileio/trnio.h"
-#include "mshift.h"
-#include "xvgr.h"
-#include "rmpbc.h"
-#include "txtdump.h"
+#include "gromacs/fileio/xvgr.h"
+#include "gromacs/pbcutil/rmpbc.h"
+#include "gromacs/legacyheaders/txtdump.h"
#include "gromacs/fileio/matio.h"
#include "eigio.h"
-#include "physics.h"
#include "gmx_ana.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/linearalgebra/eigensolver.h"
#include "gromacs/math/do_fit.h"
-#include "gromacs/legacyheaders/gmx_fatal.h"
+#include "gromacs/utility/fatalerror.h"
int gmx_covar(int argc, char *argv[])
{
{ "-pbc", FALSE, etBOOL, {&bPBC},
"Apply corrections for periodic boundary conditions" }
};
- FILE *out;
+ FILE *out = NULL; /* initialization makes all compilers happy */
t_trxstatus *status;
t_trxstatus *trjout;
t_topology top;
};
#define NFILE asize(fnm)
- if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT | PCA_BE_NICE,
+ if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT,
NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
{
return 0;
fprintf(stderr, "\nWARNING: eigenvalue sum deviates from the trace of the covariance matrix\n");
}
- fprintf(stderr, "\nWriting eigenvalues to %s\n", eigvalfile);
-
- sprintf(str, "(%snm\\S2\\N)", bM ? "u " : "");
- out = xvgropen(eigvalfile,
- "Eigenvalues of the covariance matrix",
- "Eigenvector index", str, oenv);
- for (i = 0; (i < end); i++)
- {
- fprintf (out, "%10d %g\n", (int)i+1, eigenvalues[ndim-1-i]);
- }
- gmx_ffclose(out);
-
+ /* Set 'end', the maximum eigenvector and -value index used for output */
if (end == -1)
{
if (nframes-1 < ndim)
end = ndim;
}
}
+
+ fprintf(stderr, "\nWriting eigenvalues to %s\n", eigvalfile);
+
+ sprintf(str, "(%snm\\S2\\N)", bM ? "u " : "");
+ out = xvgropen(eigvalfile,
+ "Eigenvalues of the covariance matrix",
+ "Eigenvector index", str, oenv);
+ for (i = 0; (i < end); i++)
+ {
+ fprintf (out, "%10d %g\n", (int)i+1, eigenvalues[ndim-1-i]);
+ }
+ gmx_ffclose(out);
+
if (bFit)
{
/* misuse lambda: 0/1 mass weighted analysis no/yes */
* \author Jochen Hub <jhub@gwdg.de>
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "config.h"
#include <ctype.h>
#include <stdio.h>
#include <sstream>
#include "gromacs/commandline/pargs.h"
-#include "typedefs.h"
+#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/utility/smalloc.h"
-#include "vec.h"
-#include "copyrite.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/legacyheaders/copyrite.h"
#include "gromacs/fileio/tpxio.h"
-#include "names.h"
+#include "gromacs/legacyheaders/names.h"
#include "gromacs/random/random.h"
#include "gmx_ana.h"
-#include "macros.h"
+#include "gromacs/legacyheaders/macros.h"
#include "gromacs/utility/cstringutil.h"
-#include "xvgr.h"
+#include "gromacs/fileio/xvgr.h"
-#include "gmx_fatal.h"
+#include "gromacs/utility/fatalerror.h"
//! longest file names allowed in input files
#define WHAM_MAXFILELEN 2048
+ /*! \brief
+ * x-axis legend for output files
+ */
+ static const char *xlabel = "\\xx\\f{} (nm)";
+
/*! \brief
* enum for energy units
*/
snew(fn, strlen(fnhist)+10);
snew(buf, strlen(fnhist)+10);
sprintf(fn, "%s_cumul.xvg", strncpy(buf, fnhist, strlen(fnhist)-4));
- fp = xvgropen(fn, "CDFs of umbrella windows", "z", "CDF", opt->oenv);
+ fp = xvgropen(fn, "CDFs of umbrella windows", xlabel, "CDF", opt->oenv);
}
nbin = opt->bins;
strcpy(title, "Umbrella histograms");
}
- fp = xvgropen(fn, title, "z", "count", opt->oenv);
+ fp = xvgropen(fn, title, xlabel, "count", opt->oenv);
bins = opt->bins;
/* Write histograms */
}
/* do bootstrapping */
- fp = xvgropen(fnprof, "Boot strap profiles", "z", ylabel, opt->oenv);
+ fp = xvgropen(fnprof, "Boot strap profiles", xlabel, ylabel, opt->oenv);
for (ib = 0; ib < opt->nBootStrap; ib++)
{
printf(" *******************************************\n"
gmx_ffclose(fp);
/* write average and stddev */
- fp = xvgropen(fnres, "Average and stddev from bootstrapping", "z", ylabel, opt->oenv);
+ fp = xvgropen(fnres, "Average and stddev from bootstrapping", xlabel, ylabel, opt->oenv);
if (output_env_get_print_xvgr_codes(opt->oenv))
{
fprintf(fp, "@TYPE xydy\n");
}
/* plot IACT along reaction coordinate */
- fp = xvgropen(fn, "Integrated autocorrelation times", "z", "IACT [ps]", opt->oenv);
+ fp = xvgropen(fn, "Integrated autocorrelation times", xlabel, "IACT [ps]", opt->oenv);
if (output_env_get_print_xvgr_codes(opt->oenv))
{
fprintf(fp, "@ s0 symbol 1\n@ s0 symbol size 0.5\n@ s0 line linestyle 0\n");
nHist++;
fAv += window[i].forceAv[ig];
}
- /* at the same time, rememer closest histogram */
+ /* at the same time, remember closest histogram */
if (dist < distmin)
{
winmin = i;
}
if (opt->verbose)
{
- fp = xvgropen("pmfintegrated.xvg", "PMF from force integration", "z", "PMF [kJ/mol]", opt->oenv);
+ fp = xvgropen("pmfintegrated.xvg", "PMF from force integration", xlabel, "PMF (kJ/mol)", opt->oenv);
for (j = 0; j < opt->bins; ++j)
{
fprintf(fp, "%g %g\n", (j+0.5)*dz+opt->min, pot[j]);
opt.stepchange = 100;
opt.stepUpdateContrib = 100;
- if (!parse_common_args(&argc, argv, PCA_BE_NICE,
+ if (!parse_common_args(&argc, argv, 0,
NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &opt.oenv))
{
return 0;
/* write histograms */
histout = xvgropen(opt2fn("-hist", NFILE, fnm), "Umbrella histograms",
- "z", "count", opt.oenv);
+ xlabel, "count", opt.oenv);
for (l = 0; l < opt.bins; ++l)
{
fprintf(histout, "%e\t", (double)(l+0.5)/opt.bins*(opt.max-opt.min)+opt.min);
}
/* write profile or density of states */
- profout = xvgropen(opt2fn("-o", NFILE, fnm), title, "z", ylabel, opt.oenv);
+ profout = xvgropen(opt2fn("-o", NFILE, fnm), title, xlabel, ylabel, opt.oenv);
for (i = 0; i < opt.bins; ++i)
{
fprintf(profout, "%e\t%e\n", (double)(i+0.5)/opt.bins*(opt.max-opt.min)+opt.min, profile[i]);
* \author Mark Abraham <mark.j.abraham@gmail.com>
*/
+#include "gmxpre.h"
+
#include "gromacs/gmxana/gmx_ana.h"
#include "testutils/integrationtests.h"
#include "testutils/cmdlinetest.h"
#include "gromacs/utility/arrayref.h"
+ #include "config.h"
+
namespace
{
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#include "copyrite.h"
+#include "gmxpre.h"
+
+#include "gromacs/legacyheaders/copyrite.h"
-#ifdef HAVE_CONFIG_H
#include "config.h"
-#endif
#include <stdio.h>
#include <stdlib.h>
/* This file is completely threadsafe - keep it that way! */
#include "gromacs/legacyheaders/macros.h"
-#include "gromacs/legacyheaders/vec.h"
#include "gromacs/fft/fft.h"
-#include "gromacs/fileio/futil.h"
#include "gromacs/fileio/strdb.h"
+#include "gromacs/math/vec.h"
#include "gromacs/random/random.h"
#include "gromacs/utility/baseversion.h"
#include "gromacs/utility/cstringutil.h"
#include "gromacs/utility/exceptions.h"
+#include "gromacs/utility/futil.h"
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/programcontext.h"
#include "gromacs/utility/smalloc.h"
const char *ShortProgram(void)
{
+ const char *programName = NULL;
+
try
{
// TODO: Use the display name once it doesn't break anything.
- return gmx::getProgramContext().programName();
+ programName = gmx::getProgramContext().programName();
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
+
+ return programName;
}
const char *Program(void)
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#include "oenv.h"
+#include "gmxpre.h"
+
+#include "gromacs/legacyheaders/oenv.h"
#include "gromacs/utility/smalloc.h"
view = FALSE;
xvg_format = exvgNONE;
verbosity = 0;
- debug_level = 0;
}
const gmx::ProgramContextInterface &programContext;
xvg_format_t xvg_format;
/* The level of verbosity for this program */
int verbosity;
- /* the debug level */
- int debug_level;
};
/* The source code in this file should be thread-safe.
void output_env_init(output_env_t *oenvp,
const gmx::ProgramContextInterface &context,
time_unit_t tmu, gmx_bool view, xvg_format_t xvg_format,
- int verbosity, int debug_level)
+ int verbosity)
{
try
{
oenv->view = view;
oenv->xvg_format = xvg_format;
oenv->verbosity = verbosity;
- oenv->debug_level = debug_level;
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
}
return oenv->verbosity;
}
-int output_env_get_debug_level(const output_env_t oenv)
-{
- return oenv->debug_level;
-}
-
const char *output_env_get_time_unit(const output_env_t oenv)
{
return time_units_str[oenv->time_unit];
return oenv->xvg_format;
}
-const char *output_env_get_program_name(const output_env_t oenv)
+const char *output_env_get_program_display_name(const output_env_t oenv)
{
- const char *programName = NULL;
++ const char *displayName = NULL;
+
try
{
- return oenv->programContext.displayName();
- programName = oenv->programContext.fullBinaryPath();
++ displayName = oenv->programContext.displayName();
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
- return programName;
+
++ return displayName;
}
-const char *output_env_get_short_program_name(const output_env_t oenv)
+const gmx::ProgramContextInterface &
+output_env_get_program_context(const output_env_t oenv)
{
- const char *programName = NULL;
-
- try
- {
- // TODO: Use the display name once it doesn't break anything.
- programName = oenv->programContext.programName();
- }
- GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
-
- return programName;
-}
-
-const char *output_env_get_cmd_line(const output_env_t oenv)
-{
- const char *commandLine = NULL;
-
- try
- {
- commandLine = oenv->programContext.commandLine();
- }
- GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
-
- return commandLine;
+ return oenv->programContext;
}
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "config.h"
#include <assert.h>
+#include <math.h>
+#include <stdlib.h>
#include <sys/types.h>
-#include <math.h>
-#include "typedefs.h"
-#include "physics.h"
-#include "gromacs/utility/smalloc.h"
-#include "gmx_fatal.h"
-#include "macros.h"
-#include "vec.h"
-#include "coulomb.h"
+
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/math/units.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/legacyheaders/coulomb.h"
#include "calc_verletbuf.h"
#include "../mdlib/nbnxn_consts.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
+
#ifdef GMX_NBNXN_SIMD
/* The include below sets the SIMD instruction type (precision+width)
* for all nbnxn SIMD search and non-bonded kernel code.
for (i = 0; i < il->nr; i += 1+NRAL(ft))
{
const t_iparams *ip;
- real cam[5], inv_mass, m_aj;
+ real cam[5] = {0}, inv_mass, m_aj;
int a1, j, aj, coeff;
ip = &ffparams->iparams[il->iatoms[i]];
inv_mass += coeff*coeff/m_aj;
}
vsite_m[a1] = 1/inv_mass;
+ /* Correct for loop increment of i */
+ i += j - 1 - NRAL(ft);
break;
default:
/* Use the mass of the lightest constructing atom.
add_at(&att, &natt, &prop[a], nmol);
}
+ /* cppcheck-suppress uninitvar Fixed in cppcheck 1.65 */
sfree(vsite_m);
sfree(prop);
}
#ifndef _sim_util_h
#define _sim_util_h
-#include "typedefs.h"
-#include "mdebin.h"
-#include "update.h"
-#include "vcm.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/mdebin.h"
+#include "gromacs/legacyheaders/update.h"
+#include "gromacs/legacyheaders/vcm.h"
#include "../fileio/enxio.h"
#include "../fileio/mdoutf.h"
+#include "../timing/wallcycle.h"
#include "../timing/walltime_accounting.h"
#ifdef __cplusplus
extern "C" {
#endif
+struct t_graph;
+
typedef struct gmx_global_stat *gmx_global_stat_t;
void do_pbc_first(FILE *log, matrix box, t_forcerec *fr,
- t_graph *graph, rvec x[]);
+ struct t_graph *graph, rvec x[]);
void do_pbc_first_mtop(FILE *fplog, int ePBC, matrix box,
gmx_mtop_t *mtop, rvec x[]);
t_inputrec *inputrec,
t_nrnb nrnb[], gmx_wallcycle_t wcycle,
gmx_walltime_accounting_t walltime_accounting,
- wallclock_gpu_t *gputimes,
+ struct nonbonded_verlet_t *nbv,
gmx_bool bWriteStat);
void calc_enervirdiff(FILE *fplog, int eDispCorr, t_forcerec *fr);
-void calc_dispcorr(FILE *fplog, t_inputrec *ir, t_forcerec *fr,
- gmx_int64_t step, int natoms,
+void calc_dispcorr(t_inputrec *ir, t_forcerec *fr,
+ int natoms,
matrix box, real lambda, tensor pres, tensor virial,
real *prescorr, real *enercorr, real *dvdlcorr);
gmx_mdoutf_t *outf, t_mdebin **mdebin,
tensor force_vir, tensor shake_vir,
rvec mu_tot,
- gmx_bool *bSimAnn, t_vcm **vcm, unsigned long Flags);
+ gmx_bool *bSimAnn, t_vcm **vcm, unsigned long Flags,
+ gmx_wallcycle_t wcycle);
/* Routine in sim_util.c */
+gmx_bool use_GPU(const struct nonbonded_verlet_t *nbv);
+
#ifdef __cplusplus
}
#endif
#define _vsite_h
#include <stdio.h>
-#include "typedefs.h"
+
+#include "gromacs/legacyheaders/typedefs.h"
+#include "../pbcutil/ishift.h"
#ifdef __cplusplus
extern "C" {
int th_ind_nalloc; /* Size of th_ind */
} gmx_vsite_t;
+struct t_graph;
+
void construct_vsites(gmx_vsite_t *vsite,
rvec x[],
real dt, rvec v[],
rvec x[], rvec f[], rvec *fshift,
gmx_bool VirCorr, matrix vir,
t_nrnb *nrnb, t_idef *idef,
- int ePBC, gmx_bool bMolPBC, t_graph *g, matrix box,
+ int ePBC, gmx_bool bMolPBC, struct t_graph *g, matrix box,
t_commrec *cr);
/* Spread the force operating on the vsite atoms on the surrounding atoms.
* If fshift!=NULL also update the shift forces.
*/
void split_vsites_over_threads(const t_ilist *ilist,
+ const t_iparams *ip,
const t_mdatoms *mdatoms,
gmx_bool bLimitRange,
gmx_vsite_t *vsite);
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "config.h"
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
#include <assert.h>
-#include "typedefs.h"
-#include "gromacs/utility/smalloc.h"
-#include "gmx_fatal.h"
-#include "gmx_fatal_collective.h"
-#include "vec.h"
-#include "domdec.h"
-#include "domdec_network.h"
-#include "nrnb.h"
-#include "pbc.h"
-#include "chargegroup.h"
-#include "constr.h"
-#include "mdatoms.h"
-#include "names.h"
-#include "force.h"
-#include "pme.h"
-#include "mdrun.h"
-#include "nsgrid.h"
-#include "shellfc.h"
-#include "mtop_util.h"
-#include "gmx_ga2la.h"
-#include "macros.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/legacyheaders/domdec.h"
+#include "gromacs/legacyheaders/domdec_network.h"
+#include "gromacs/legacyheaders/nrnb.h"
+#include "gromacs/legacyheaders/chargegroup.h"
+#include "gromacs/legacyheaders/constr.h"
+#include "gromacs/legacyheaders/mdatoms.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/legacyheaders/force.h"
+#include "gromacs/legacyheaders/pme.h"
+#include "gromacs/legacyheaders/mdrun.h"
+#include "gromacs/legacyheaders/nsgrid.h"
+#include "gromacs/legacyheaders/shellfc.h"
+#include "gromacs/topology/mtop_util.h"
+#include "gromacs/legacyheaders/gmx_ga2la.h"
+#include "gromacs/legacyheaders/macros.h"
#include "nbnxn_search.h"
-#include "bondf.h"
-#include "gmx_omp_nthreads.h"
-#include "gpu_utils.h"
+#include "gromacs/legacyheaders/bondf.h"
+#include "gromacs/legacyheaders/gmx_omp_nthreads.h"
+#include "gromacs/legacyheaders/gpu_utils.h"
-#include "gromacs/fileio/futil.h"
+#include "gromacs/utility/futil.h"
#include "gromacs/fileio/gmxfio.h"
#include "gromacs/fileio/pdbio.h"
+#include "gromacs/imd/imd.h"
+#include "gromacs/mdlib/nb_verlet.h"
+#include "gromacs/pbcutil/ishift.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/pulling/pull.h"
+#include "gromacs/pulling/pull_rotation.h"
+#include "gromacs/swap/swapcoords.h"
#include "gromacs/timing/wallcycle.h"
+#include "gromacs/utility/basenetwork.h"
+#include "gromacs/utility/fatalerror.h"
#include "gromacs/utility/gmxmpi.h"
-#include "gromacs/swap/swapcoords.h"
#include "gromacs/utility/qsort_threadsafe.h"
-#include "gromacs/pulling/pull.h"
-#include "gromacs/pulling/pull_rotation.h"
-#include "gromacs/imd/imd.h"
+#include "gromacs/utility/smalloc.h"
#define DDRANK(dd, rank) (rank)
#define DDMASTERRANK(dd) (dd->masterrank)
snew(grid_r, 2*dd->nnodes);
}
- dd_gather(dd, 2*sizeof(rvec), grid_s[0], DDMASTER(dd) ? grid_r[0] : NULL);
+ dd_gather(dd, 2*sizeof(rvec), grid_s, DDMASTER(dd) ? grid_r : NULL);
if (DDMASTER(dd))
{
if (vsite != NULL)
{
/* Now we have updated mdatoms, we can do the last vsite bookkeeping */
- split_vsites_over_threads(top_local->idef.il, mdatoms, FALSE, vsite);
+ split_vsites_over_threads(top_local->idef.il, top_local->idef.iparams,
+ mdatoms, FALSE, vsite);
}
if (shellfc)
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "config.h"
+#include <math.h>
#include <string.h>
#include <time.h>
-#include <math.h>
-#include "sysstuff.h"
-#include "gromacs/utility/cstringutil.h"
-#include "network.h"
-#include "gromacs/utility/smalloc.h"
-#include "nrnb.h"
-#include "main.h"
-#include "force.h"
-#include "macros.h"
-#include "names.h"
-#include "gmx_fatal.h"
-#include "txtdump.h"
-#include "typedefs.h"
-#include "update.h"
-#include "constr.h"
-#include "vec.h"
-#include "tgroup.h"
-#include "mdebin.h"
-#include "vsite.h"
-#include "force.h"
-#include "mdrun.h"
-#include "md_support.h"
-#include "sim_util.h"
-#include "domdec.h"
-#include "mdatoms.h"
-#include "ns.h"
-#include "mtop_util.h"
-#include "pme.h"
-#include "bondf.h"
-#include "gmx_omp_nthreads.h"
-#include "md_logging.h"
+
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/legacyheaders/nrnb.h"
+#include "gromacs/legacyheaders/force.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/legacyheaders/txtdump.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/update.h"
+#include "gromacs/legacyheaders/constr.h"
+#include "gromacs/legacyheaders/tgroup.h"
+#include "gromacs/legacyheaders/mdebin.h"
+#include "gromacs/legacyheaders/vsite.h"
+#include "gromacs/legacyheaders/force.h"
+#include "gromacs/legacyheaders/mdrun.h"
+#include "gromacs/legacyheaders/md_support.h"
+#include "gromacs/legacyheaders/sim_util.h"
+#include "gromacs/legacyheaders/domdec.h"
+#include "gromacs/legacyheaders/mdatoms.h"
+#include "gromacs/legacyheaders/ns.h"
+#include "gromacs/topology/mtop_util.h"
+#include "gromacs/legacyheaders/pme.h"
+#include "gromacs/legacyheaders/bondf.h"
+#include "gromacs/legacyheaders/gmx_omp_nthreads.h"
+#include "gromacs/legacyheaders/md_logging.h"
#include "gromacs/fileio/confio.h"
+#include "gromacs/fileio/mtxio.h"
#include "gromacs/fileio/trajectory_writing.h"
-#include "gromacs/linearalgebra/mtxio.h"
+#include "gromacs/imd/imd.h"
+#include "gromacs/legacyheaders/types/commrec.h"
#include "gromacs/linearalgebra/sparsematrix.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/pbcutil/mshift.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/timing/walltime_accounting.h"
-#include "gromacs/imd/imd.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
typedef struct {
t_state s;
gmx_vsite_t *vsite, gmx_constr_t constr,
int nfile, const t_filenm fnm[],
gmx_mdoutf_t *outf, t_mdebin **mdebin,
- int imdport, unsigned long gmx_unused Flags)
+ int imdport, unsigned long gmx_unused Flags,
+ gmx_wallcycle_t wcycle)
{
int i;
real dvdl_constr;
*gstat = global_stat_init(ir);
}
- *outf = init_mdoutf(fplog, nfile, fnm, 0, cr, ir, top_global, NULL);
+ *outf = init_mdoutf(fplog, nfile, fnm, 0, cr, ir, top_global, NULL, wcycle);
snew(*enerd, 1);
init_enerdata(top_global->groups.grps[egcENER].nr, ir->fepvals->n_lambda,
}
/* Calculate long range corrections to pressure and energy */
- calc_dispcorr(fplog, inputrec, fr, count, top_global->natoms, ems->s.box, ems->s.lambda[efptVDW],
+ calc_dispcorr(inputrec, fr, top_global->natoms, ems->s.box, ems->s.lambda[efptVDW],
pres, force_vir, &prescorr, &enercorr, &dvdlcorr);
enerd->term[F_DISPCORR] = enercorr;
enerd->term[F_EPOT] += enercorr;
ems->s.x, ems->f, ems->f, fr->bMolPBC, ems->s.box,
ems->s.lambda[efptBONDED], &dvdl_constr,
NULL, &shake_vir, nrnb, econqForceDispl, FALSE, 0, 0);
- if (fr->bSepDVDL && fplog)
- {
- gmx_print_sepdvdl(fplog, "Constraints", t, dvdl_constr);
- }
enerd->term[F_DVDL_CONSTR] += dvdl_constr;
m_add(force_vir, shake_vir, vir);
wallcycle_stop(wcycle, ewcCONSTR);
init_em(fplog, CG, cr, inputrec,
state_global, top_global, s_min, &top, &f, &f_global,
nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat, vsite, constr,
- nfile, fnm, &outf, &mdebin, imdport, Flags);
+ nfile, fnm, &outf, &mdebin, imdport, Flags, wcycle);
/* Print to log file */
print_em_start(fplog, cr, walltime_accounting, wcycle, CG);
init_em(fplog, LBFGS, cr, inputrec,
state, top_global, &ems, &top, &f, &f_global,
nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat, vsite, constr,
- nfile, fnm, &outf, &mdebin, imdport, Flags);
+ nfile, fnm, &outf, &mdebin, imdport, Flags, wcycle);
/* Do_lbfgs is not completely updated like do_steep and do_cg,
* so we free some memory again.
*/
}
stepsize = 1.0/fnorm;
- converged = FALSE;
/* Start the loop over BFGS steps.
* Each successful step is counted, and we continue until
init_em(fplog, SD, cr, inputrec,
state_global, top_global, s_try, &top, &f, &f_global,
nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat, vsite, constr,
- nfile, fnm, &outf, &mdebin, imdport, Flags);
+ nfile, fnm, &outf, &mdebin, imdport, Flags, wcycle);
/* Print to log file */
print_em_start(fplog, cr, walltime_accounting, wcycle, SD);
state_global, top_global, state_work, &top,
&f, &f_global,
nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat, vsite, constr,
- nfile, fnm, &outf, NULL, imdport, Flags);
+ nfile, fnm, &outf, NULL, imdport, Flags, wcycle);
natoms = top_global->natoms;
snew(fneg, natoms);
* /Erik 001109
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+#include "config.h"
+
+#include <assert.h>
+#include <math.h>
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
-#include <math.h>
-#include <assert.h>
-#include "typedefs.h"
-#include "txtdump.h"
-#include "vec.h"
+
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/txtdump.h"
+#include "gromacs/math/vec.h"
#include "gromacs/utility/smalloc.h"
-#include "coulomb.h"
-#include "gmx_fatal.h"
-#include "pme.h"
-#include "network.h"
-#include "physics.h"
-#include "nrnb.h"
-#include "macros.h"
+#include "gromacs/legacyheaders/coulomb.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/legacyheaders/pme.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/math/units.h"
+#include "gromacs/legacyheaders/nrnb.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/legacyheaders/types/commrec.h"
#include "gromacs/fft/parallel_3dfft.h"
-#include "gromacs/fileio/futil.h"
+#include "gromacs/utility/futil.h"
#include "gromacs/fileio/pdbio.h"
#include "gromacs/math/gmxcomplex.h"
#include "gromacs/timing/cyclecounter.h"
{
/* s2g0 the local interpolation grid start.
* s2g1 the local interpolation grid end.
- * Because grid overlap communication only goes forward,
- * the grid the slabs for fft's should be rounded down.
+ * Since in calc_pidx we divide particles, and not grid lines,
+ * spatially uniform along dimension x or y, we need to round
+ * s2g0 down and s2g1 up.
*/
ol->s2g0[i] = ( i *ndata + 0 )/nnodes;
ol->s2g1[i] = ((i+1)*ndata + nnodes-1)/nnodes + norder - 1;
int fft_my, fft_mz;
int buf_my = -1;
int nsx, nsy, nsz;
- ivec ne;
+ ivec localcopy_end;
int offx, offy, offz, x, y, z, i0, i0t;
int sx, sy, sz, fx, fy, fz, tx1, ty1, tz1, ox, oy, oz;
gmx_bool bClearBufX, bClearBufY, bClearBufXY, bClearBuf;
for (d = 0; d < DIM; d++)
{
- ne[d] = min(pmegrid->offset[d]+pmegrid->n[d]-(pmegrid->order-1),
- local_fft_ndata[d]);
+ /* Determine up to where our thread needs to copy from the
+ * thread-local charge spreading grid to the rank-local FFT grid.
+ * This is up to our spreading grid end minus order-1 and
+ * not beyond the local FFT grid.
+ */
+ localcopy_end[d] =
+ min(pmegrid->offset[d]+pmegrid->n[d]-(pmegrid->order-1),
+ local_fft_ndata[d]);
}
offx = pmegrid->offset[XX];
pmegrid_g = &pmegrids->grid_th[fx*pmegrids->nc[YY]*pmegrids->nc[ZZ]];
ox += pmegrid_g->offset[XX];
/* Determine the end of our part of the source grid */
- tx1 = min(ox + pmegrid_g->n[XX], ne[XX]);
+ if (!bCommX)
+ {
+ /* Use our thread local source grid and target grid part */
+ tx1 = min(ox + pmegrid_g->n[XX], localcopy_end[XX]);
+ }
+ else
+ {
+ /* Use our thread local source grid and the spreading range */
+ tx1 = min(ox + pmegrid_g->n[XX], pme->pme_order);
+ }
for (sy = 0; sy >= -pmegrids->nthread_comm[YY]; sy--)
{
pmegrid_g = &pmegrids->grid_th[fy*pmegrids->nc[ZZ]];
oy += pmegrid_g->offset[YY];
/* Determine the end of our part of the source grid */
- ty1 = min(oy + pmegrid_g->n[YY], ne[YY]);
+ if (!bCommY)
+ {
+ /* Use our thread local source grid and target grid part */
+ ty1 = min(oy + pmegrid_g->n[YY], localcopy_end[YY]);
+ }
+ else
+ {
+ /* Use our thread local source grid and the spreading range */
+ ty1 = min(oy + pmegrid_g->n[YY], pme->pme_order);
+ }
for (sz = 0; sz >= -pmegrids->nthread_comm[ZZ]; sz--)
{
}
pmegrid_g = &pmegrids->grid_th[fz];
oz += pmegrid_g->offset[ZZ];
- tz1 = min(oz + pmegrid_g->n[ZZ], ne[ZZ]);
+ tz1 = min(oz + pmegrid_g->n[ZZ], localcopy_end[ZZ]);
if (sx == 0 && sy == 0 && sz == 0)
{
if (bCommY)
{
commbuf = commbuf_y;
- /* The y-size of the communication buffer is order-1 */
- buf_my = pmegrid->order - 1;
+ /* The y-size of the communication buffer is set by
+ * the overlap of the grid part of our local slab
+ * with the part starting at the next slab.
+ */
+ buf_my =
+ pme->overlap[1].s2g1[pme->nodeid_minor] -
+ pme->overlap[1].s2g0[pme->nodeid_minor+1];
if (bCommX)
{
/* We index commbuf modulo the local grid size */
sendptr = overlap->sendbuf + send_index0*local_fft_ndata[ZZ];
recvptr = overlap->recvbuf;
+ if (debug != NULL)
+ {
+ fprintf(debug, "PME fftgrid comm y %2d x %2d x %2d\n",
+ local_fft_ndata[XX], send_nindex, local_fft_ndata[ZZ]);
+ }
+
#ifdef GMX_MPI
MPI_Sendrecv(sendptr, send_size_y*datasize, GMX_MPI_REAL,
send_id, ipulse,
if (debug != NULL)
{
- fprintf(debug, "PME fftgrid comm %2d x %2d x %2d\n",
+ fprintf(debug, "PME fftgrid comm x %2d x %2d x %2d\n",
send_nindex, local_fft_ndata[YY], local_fft_ndata[ZZ]);
}
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "config.h"
#include <assert.h>
#include <math.h>
#include <sys/time.h>
#endif
-#include "typedefs.h"
+#include "gromacs/legacyheaders/typedefs.h"
#include "gromacs/utility/cstringutil.h"
-#include "gromacs/utility/smalloc.h"
-#include "names.h"
-#include "txtdump.h"
-#include "pbc.h"
-#include "chargegroup.h"
-#include "vec.h"
-#include "nrnb.h"
-#include "mshift.h"
-#include "mdrun.h"
-#include "sim_util.h"
-#include "update.h"
-#include "physics.h"
-#include "main.h"
-#include "mdatoms.h"
-#include "force.h"
-#include "bondf.h"
-#include "pme.h"
-#include "disre.h"
-#include "orires.h"
-#include "network.h"
-#include "calcmu.h"
-#include "constr.h"
-#include "xvgr.h"
-#include "copyrite.h"
-#include "domdec.h"
-#include "genborn.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/legacyheaders/txtdump.h"
+#include "gromacs/pbcutil/pbc.h"
+#include "gromacs/legacyheaders/chargegroup.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/legacyheaders/nrnb.h"
+#include "gromacs/legacyheaders/mdrun.h"
+#include "gromacs/legacyheaders/sim_util.h"
+#include "gromacs/legacyheaders/update.h"
+#include "gromacs/math/units.h"
+#include "gromacs/legacyheaders/mdatoms.h"
+#include "gromacs/legacyheaders/force.h"
+#include "gromacs/legacyheaders/bondf.h"
+#include "gromacs/legacyheaders/pme.h"
+#include "gromacs/legacyheaders/disre.h"
+#include "gromacs/legacyheaders/orires.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/legacyheaders/calcmu.h"
+#include "gromacs/legacyheaders/constr.h"
+#include "gromacs/legacyheaders/copyrite.h"
+#include "gromacs/legacyheaders/domdec.h"
+#include "gromacs/legacyheaders/genborn.h"
#include "nbnxn_atomdata.h"
#include "nbnxn_search.h"
#include "nbnxn_kernels/nbnxn_kernel_ref.h"
#include "nbnxn_kernels/simd_4xn/nbnxn_kernel_simd_4xn.h"
#include "nbnxn_kernels/simd_2xnn/nbnxn_kernel_simd_2xnn.h"
#include "nbnxn_kernels/nbnxn_kernel_gpu_ref.h"
-#include "nonbonded.h"
+#include "gromacs/legacyheaders/nonbonded.h"
#include "../gmxlib/nonbonded/nb_kernel.h"
#include "../gmxlib/nonbonded/nb_free_energy.h"
+#include "gromacs/legacyheaders/types/commrec.h"
+#include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_data_mgmt.h"
+#include "gromacs/pbcutil/ishift.h"
+#include "gromacs/pbcutil/mshift.h"
#include "gromacs/timing/wallcycle.h"
#include "gromacs/timing/walltime_accounting.h"
#include "gromacs/utility/gmxmpi.h"
+#include "gromacs/utility/smalloc.h"
#include "gromacs/essentialdynamics/edsam.h"
#include "gromacs/pulling/pull.h"
#include "gromacs/pulling/pull_rotation.h"
#include "gromacs/imd/imd.h"
#include "adress.h"
-#include "qmmm.h"
+#include "gromacs/legacyheaders/qmmm.h"
-#include "gmx_omp_nthreads.h"
+#include "gromacs/legacyheaders/gmx_omp_nthreads.h"
-#include "nbnxn_cuda_data_mgmt.h"
#include "nbnxn_cuda/nbnxn_cuda.h"
+#include "nb_verlet.h"
+
void print_time(FILE *out,
gmx_walltime_accounting_t walltime_accounting,
gmx_int64_t step,
}
}
-static void posres_wrapper(FILE *fplog,
- int flags,
- gmx_bool bSepDVDL,
+static void posres_wrapper(int flags,
t_inputrec *ir,
t_nrnb *nrnb,
gmx_localtop_t *top,
ir->ePBC == epbcNONE ? NULL : &pbc,
lambda[efptRESTRAINT], &dvdl,
fr->rc_scaling, fr->ePBC, fr->posres_com, fr->posres_comB);
- if (bSepDVDL)
- {
- gmx_print_sepdvdl(fplog, interaction_function[F_POSRES].longname, v, dvdl);
- }
enerd->term[F_POSRES] += v;
/* If just the force constant changes, the FEP term is linear,
* but if k changes, it is not.
inc_nrnb(nrnb, eNR_FBPOSRES, top->idef.il[F_FBPOSRES].nr/2);
}
-static void pull_potential_wrapper(FILE *fplog,
- gmx_bool bSepDVDL,
- t_commrec *cr,
+static void pull_potential_wrapper(t_commrec *cr,
t_inputrec *ir,
matrix box, rvec x[],
rvec f[],
enerd->term[F_COM_PULL] +=
pull_potential(ir->ePull, ir->pull, mdatoms, &pbc,
cr, t, lambda[efptRESTRAINT], x, f, vir_force, &dvdl);
- if (bSepDVDL)
- {
- gmx_print_sepdvdl(fplog, "Com pull", enerd->term[F_COM_PULL], dvdl);
- }
enerd->dvdl_lin[efptRESTRAINT] += dvdl;
wallcycle_stop(wcycle, ewcPULLPOT);
}
-static void pme_receive_force_ener(FILE *fplog,
- gmx_bool bSepDVDL,
- t_commrec *cr,
+static void pme_receive_force_ener(t_commrec *cr,
gmx_wallcycle_t wcycle,
gmx_enerdata_t *enerd,
t_forcerec *fr)
gmx_pme_receive_f(cr, fr->f_novirsum, fr->vir_el_recip, &e_q,
fr->vir_lj_recip, &e_lj, &dvdl_q, &dvdl_lj,
&cycles_seppme);
- if (bSepDVDL)
- {
- gmx_print_sepdvdl(fplog, "Electrostatic PME mesh", e_q, dvdl_q);
- gmx_print_sepdvdl(fplog, "Lennard-Jones PME mesh", e_lj, dvdl_lj);
- }
enerd->term[F_COUL_RECIP] += e_q;
enerd->term[F_LJ_RECIP] += e_lj;
enerd->dvdl_lin[efptCOUL] += dvdl_q;
wallcycle_sub_stop(wcycle, ewcsNONBONDED);
}
+gmx_bool use_GPU(const nonbonded_verlet_t *nbv)
+{
+ return nbv != NULL && nbv->bUseGPU;
+}
+
void do_force_cutsVERLET(FILE *fplog, t_commrec *cr,
t_inputrec *inputrec,
gmx_int64_t step, t_nrnb *nrnb, gmx_wallcycle_t wcycle,
int start, homenr;
int nb_kernel_type;
double mu[2*DIM];
- gmx_bool bSepDVDL, bStateChanged, bNS, bFillGrid, bCalcCGCM, bBS;
+ gmx_bool bStateChanged, bNS, bFillGrid, bCalcCGCM, bBS;
gmx_bool bDoLongRange, bDoForces, bSepLRF, bUseGPU, bUseOrEmulGPU;
gmx_bool bDiffKernels = FALSE;
matrix boxs;
start = 0;
homenr = mdatoms->homenr;
- bSepDVDL = (fr->bSepDVDL && do_per_step(step, inputrec->nstlog));
-
clear_mat(vir_force);
cg0 = 0;
if ((flags & GMX_FORCE_BONDED) && top->idef.il[F_POSRES].nr > 0)
{
- posres_wrapper(fplog, flags, bSepDVDL, inputrec, nrnb, top, box, x,
+ posres_wrapper(flags, inputrec, nrnb, top, box, x,
enerd, lambda, fr);
}
}
/* Compute the bonded and non-bonded energies and optionally forces */
- do_force_lowlevel(fplog, step, fr, inputrec, &(top->idef),
+ do_force_lowlevel(fr, inputrec, &(top->idef),
cr, nrnb, wcycle, mdatoms,
x, hist, f, bSepLRF ? fr->f_twin : f, enerd, fcd, top, fr->born,
&(top->atomtypes), bBornRadii, box,
/* Since the COM pulling is always done mass-weighted, no forces are
* applied to vsites and this call can be done after vsite spreading.
*/
- pull_potential_wrapper(fplog, bSepDVDL, cr, inputrec, box, x,
+ pull_potential_wrapper(cr, inputrec, box, x,
f, vir_force, mdatoms, enerd, lambda, t,
wcycle);
}
/* In case of node-splitting, the PP nodes receive the long-range
* forces, virial and energy from the PME nodes here.
*/
- pme_receive_force_ener(fplog, bSepDVDL, cr, wcycle, enerd, fr);
+ pme_receive_force_ener(cr, wcycle, enerd, fr);
}
if (bDoForces)
int cg0, cg1, i, j;
int start, homenr;
double mu[2*DIM];
- gmx_bool bSepDVDL, bStateChanged, bNS, bFillGrid, bCalcCGCM, bBS;
+ gmx_bool bStateChanged, bNS, bFillGrid, bCalcCGCM, bBS;
gmx_bool bDoLongRangeNS, bDoForces, bDoPotential, bSepLRF;
gmx_bool bDoAdressWF;
matrix boxs;
start = 0;
homenr = mdatoms->homenr;
- bSepDVDL = (fr->bSepDVDL && do_per_step(step, inputrec->nstlog));
-
clear_mat(vir_force);
cg0 = 0;
if ((flags & GMX_FORCE_BONDED) && top->idef.il[F_POSRES].nr > 0)
{
- posres_wrapper(fplog, flags, bSepDVDL, inputrec, nrnb, top, box, x,
+ posres_wrapper(flags, inputrec, nrnb, top, box, x,
enerd, lambda, fr);
}
}
/* Compute the bonded and non-bonded energies and optionally forces */
- do_force_lowlevel(fplog, step, fr, inputrec, &(top->idef),
+ do_force_lowlevel(fr, inputrec, &(top->idef),
cr, nrnb, wcycle, mdatoms,
x, hist, f, bSepLRF ? fr->f_twin : f, enerd, fcd, top, fr->born,
&(top->atomtypes), bBornRadii, box,
if (inputrec->ePull == epullUMBRELLA || inputrec->ePull == epullCONST_F)
{
- pull_potential_wrapper(fplog, bSepDVDL, cr, inputrec, box, x,
+ pull_potential_wrapper(cr, inputrec, box, x,
f, vir_force, mdatoms, enerd, lambda, t,
wcycle);
}
/* In case of node-splitting, the PP nodes receive the long-range
* forces, virial and energy from the PME nodes here.
*/
- pme_receive_force_ener(fplog, bSepDVDL, cr, wcycle, enerd, fr);
+ pme_receive_force_ener(cr, wcycle, enerd, fr);
}
if (bDoForces)
}
}
-void calc_dispcorr(FILE *fplog, t_inputrec *ir, t_forcerec *fr,
- gmx_int64_t step, int natoms,
+void calc_dispcorr(t_inputrec *ir, t_forcerec *fr,
+ int natoms,
matrix box, real lambda, tensor pres, tensor virial,
real *prescorr, real *enercorr, real *dvdlcorr)
{
}
}
- if (fr->bSepDVDL && do_per_step(step, ir->nstlog))
- {
- gmx_print_sepdvdl(fplog, "Dispersion correction", *enercorr, dvdlambda);
- }
if (fr->efep != efepNO)
{
*dvdlcorr += dvdlambda;
t_inputrec *inputrec,
t_nrnb nrnb[], gmx_wallcycle_t wcycle,
gmx_walltime_accounting_t walltime_accounting,
- wallclock_gpu_t *gputimes,
+ nonbonded_verlet_t *nbv,
gmx_bool bWriteStat)
{
int i, j;
if (SIMMASTER(cr))
{
+ wallclock_gpu_t* gputimes = use_GPU(nbv) ?
+ nbnxn_cuda_get_timings(nbv->cu_nbv) : NULL;
wallcycle_print(fplog, cr->nnodes, cr->npmenodes,
elapsed_time_over_all_ranks,
wcycle, gputimes);
int nfile, const t_filenm fnm[],
gmx_mdoutf_t *outf, t_mdebin **mdebin,
tensor force_vir, tensor shake_vir, rvec mu_tot,
- gmx_bool *bSimAnn, t_vcm **vcm, unsigned long Flags)
+ gmx_bool *bSimAnn, t_vcm **vcm, unsigned long Flags,
+ gmx_wallcycle_t wcycle)
{
int i, j, n;
real tmpt, mod;
if (nfile != -1)
{
- *outf = init_mdoutf(fplog, nfile, fnm, Flags, cr, ir, mtop, oenv);
+ *outf = init_mdoutf(fplog, nfile, fnm, Flags, cr, ir, mtop, oenv, wcycle);
*mdebin = init_mdebin((Flags & MD_APPENDFILES) ? NULL : mdoutf_get_fp_ene(*outf),
mtop, ir, mdoutf_get_fp_dhdl(*outf));
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "gmxpre.h"
+
+#include "config.h"
#include <stdio.h>
-#include "typedefs.h"
-#include "vsite.h"
-#include "macros.h"
-#include "gromacs/utility/smalloc.h"
-#include "nrnb.h"
-#include "vec.h"
-#include "network.h"
-#include "mshift.h"
-#include "pbc.h"
-#include "domdec.h"
-#include "mtop_util.h"
-#include "gmx_omp_nthreads.h"
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/legacyheaders/types/commrec.h"
+#include "gromacs/legacyheaders/vsite.h"
+#include "gromacs/legacyheaders/macros.h"
+#include "gromacs/legacyheaders/nrnb.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/legacyheaders/domdec.h"
+#include "gromacs/topology/mtop_util.h"
+#include "gromacs/legacyheaders/gmx_omp_nthreads.h"
+
+#include "gromacs/pbcutil/ishift.h"
+#include "gromacs/pbcutil/mshift.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/utility/gmxomp.h"
+#include "gromacs/utility/smalloc.h"
/* Routines to send/recieve coordinates and force
* of constructing atoms.
}
void split_vsites_over_threads(const t_ilist *ilist,
+ const t_iparams *ip,
const t_mdatoms *mdatoms,
gmx_bool bLimitRange,
gmx_vsite_t *vsite)
vsite_atom_range = -1;
for (ftype = 0; ftype < F_NRE; ftype++)
{
- if ((interaction_function[ftype].flags & IF_VSITE) &&
- ftype != F_VSITEN)
+ if (interaction_function[ftype].flags & IF_VSITE)
{
- nral1 = 1 + NRAL(ftype);
- iat = ilist[ftype].iatoms;
- for (i = 0; i < ilist[ftype].nr; i += nral1)
+ if (ftype != F_VSITEN)
{
- for (j = i+1; j < i+nral1; j++)
+ nral1 = 1 + NRAL(ftype);
+ iat = ilist[ftype].iatoms;
+ for (i = 0; i < ilist[ftype].nr; i += nral1)
{
- vsite_atom_range = max(vsite_atom_range, iat[j]);
+ for (j = i + 1; j < i + nral1; j++)
+ {
+ vsite_atom_range = max(vsite_atom_range, iat[j]);
+ }
+ }
+ }
+ else
+ {
+ int vs_ind_end;
+
+ iat = ilist[ftype].iatoms;
+
+ i = 0;
+ while (i < ilist[ftype].nr)
+ {
+ /* The 3 below is from 1+NRAL(ftype)=3 */
+ vs_ind_end = i + ip[iat[i]].vsiten.n*3;
+
+ vsite_atom_range = max(vsite_atom_range, iat[i+1]);
+ while (i < vs_ind_end)
+ {
+ vsite_atom_range = max(vsite_atom_range, iat[i+2]);
+ i += 3;
+ }
}
}
}
for (ftype = 0; ftype < F_NRE; ftype++)
{
- if ((interaction_function[ftype].flags & IF_VSITE) &&
- ftype != F_VSITEN)
+ if (interaction_function[ftype].flags & IF_VSITE)
{
nral1 = 1 + NRAL(ftype);
inc = nral1;
*/
if (ftype != F_VSITEN)
{
- for (j = i+2; j < i+nral1; j++)
+ for (j = i + 2; j < i + nral1; j++)
{
if (th_ind[iat[j]] != th)
{
}
else
{
- inc = iat[i];
- for (j = i+2; j < i+inc; j += 3)
+ /* The 3 below is from 1+NRAL(ftype)=3 */
+ inc = ip[iat[i]].vsiten.n*3;
+ for (j = i + 2; j < i + inc; j += 3)
{
if (th_ind[iat[j]] != th)
{
}
/* Copy this vsite to the thread data struct of thread th */
il_th = &vsite->tdata[th].ilist[ftype];
- for (j = i; j < i+inc; j++)
+ for (j = i; j < i + inc; j++)
{
il_th->iatoms[il_th->nr++] = iat[j];
}
gmx_fatal(FARGS, "The combination of threading, virtual sites and charge groups is not implemented");
}
- split_vsites_over_threads(top->idef.il, md, !DOMAINDECOMP(cr), vsite);
+ split_vsites_over_threads(top->idef.il, top->idef.iparams,
+ md, !DOMAINDECOMP(cr), vsite);
}
}
--- /dev/null
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team.
+ * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+#include "gmxpre.h"
+
+#include "basenetwork.h"
+
+#include "config.h"
+
+#include <cctype>
+#include <cstdio>
+#include <cstdlib>
+#include <cstring>
+
+#include <algorithm>
+#include <exception>
+
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/gmxmpi.h"
+#include "gromacs/utility/programcontext.h"
+
+int gmx_gethostname(char *name, size_t len)
+{
+ if (len < 8)
+ {
+ gmx_incons("gmx_gethostname called with len<8");
+ }
+#if defined(HAVE_UNISTD_H) && !defined(__native_client__)
+ if (gethostname(name, len-1) != 0)
+ {
+ std::strncpy(name, "unknown", 8);
+ return -1;
+ }
+ return 0;
+#else
+ std::strncpy(name, "unknown", 8);
+ return -1;
+#endif
+}
+
+gmx_bool gmx_mpi_initialized(void)
+{
+#ifndef GMX_MPI
+ return 0;
+#else
+ int n;
+ MPI_Initialized(&n);
+
+ return n;
+#endif
+}
+
+int gmx_node_num(void)
+{
+#ifndef GMX_MPI
+ return 1;
+#else
+#ifdef GMX_THREAD_MPI
+ if (!gmx_mpi_initialized())
+ {
+ return 1;
+ }
+#endif
+ int i;
+ (void) MPI_Comm_size(MPI_COMM_WORLD, &i);
+ return i;
+#endif
+}
+
+int gmx_node_rank(void)
+{
+#ifndef GMX_MPI
+ return 0;
+#else
+#ifdef GMX_THREAD_MPI
+ if (!gmx_mpi_initialized())
+ {
+ return 0;
+ }
+#endif
+ int i;
+ (void) MPI_Comm_rank(MPI_COMM_WORLD, &i);
+ return i;
+#endif
+}
+
+static int mpi_hostname_hash(void)
+{
+ int hash_int;
+
+#ifndef GMX_LIB_MPI
+ /* We have a single physical node */
+ hash_int = 0;
+#else
+ int resultlen;
+ char mpi_hostname[MPI_MAX_PROCESSOR_NAME];
+
+ /* This procedure can only differentiate nodes with different names.
+ * Architectures where different physical nodes have identical names,
+ * such as IBM Blue Gene, should use an architecture specific solution.
+ */
+ MPI_Get_processor_name(mpi_hostname, &resultlen);
+
+ /* The string hash function returns an unsigned int. We cast to an int.
+ * Negative numbers are converted to positive by setting the sign bit to 0.
+ * This makes the hash one bit smaller.
+ * A 63-bit hash (with 64-bit int) should be enough for unique node hashes,
+ * even on a million node machine. 31 bits might not be enough though!
+ */
+ hash_int =
+ (int)gmx_string_fullhash_func(mpi_hostname, gmx_string_hash_init);
+ if (hash_int < 0)
+ {
+ hash_int -= INT_MIN;
+ }
+#endif
+
+ return hash_int;
+}
+
+#if defined GMX_LIB_MPI && defined GMX_TARGET_BGQ
++#ifdef __clang__
++/* IBM's declaration of this function in
++ * /bgsys/drivers/V1R2M2/ppc64/spi/include/kernel/process.h
++ * erroneously fails to specify __INLINE__, despite
++ * /bgsys/drivers/V1R2M2/ppc64/spi/include/kernel/cnk/process_impl.h
++ * specifiying __INLINE__, so bgclang thinks they are different enough
++ * to complain about. */
++static uint64_t Kernel_GetJobID();
++#endif
+#include <spi/include/kernel/location.h>
+
+static int bgq_nodenum(void)
+{
+ int hostnum;
+ Personality_t personality;
+ Kernel_GetPersonality(&personality, sizeof(personality));
+ /* Each MPI rank has a unique coordinate in a 6-dimensional space
+ (A,B,C,D,E,T), with dimensions A-E corresponding to different
+ physical nodes, and T within each node. Each node has sixteen
+ physical cores, each of which can have up to four hardware
+ threads, so 0 <= T <= 63 (but the maximum value of T depends on
+ the confituration of ranks and OpenMP threads per
+ node). However, T is irrelevant for computing a suitable return
+ value for gmx_hostname_num().
+ */
+ hostnum = personality.Network_Config.Acoord;
+ hostnum *= personality.Network_Config.Bnodes;
+ hostnum += personality.Network_Config.Bcoord;
+ hostnum *= personality.Network_Config.Cnodes;
+ hostnum += personality.Network_Config.Ccoord;
+ hostnum *= personality.Network_Config.Dnodes;
+ hostnum += personality.Network_Config.Dcoord;
+ hostnum *= personality.Network_Config.Enodes;
+ hostnum += personality.Network_Config.Ecoord;
+
+ if (debug)
+ {
+ std::fprintf(debug,
+ "Torus ID A: %d / %d B: %d / %d C: %d / %d D: %d / %d E: %d / %d\n"
+ "Node ID T: %d / %d core: %d / %d hardware thread: %d / %d\n",
+ personality.Network_Config.Acoord,
+ personality.Network_Config.Anodes,
+ personality.Network_Config.Bcoord,
+ personality.Network_Config.Bnodes,
+ personality.Network_Config.Ccoord,
+ personality.Network_Config.Cnodes,
+ personality.Network_Config.Dcoord,
+ personality.Network_Config.Dnodes,
+ personality.Network_Config.Ecoord,
+ personality.Network_Config.Enodes,
+ Kernel_ProcessorCoreID(),
+ 16,
+ Kernel_ProcessorID(),
+ 64,
+ Kernel_ProcessorThreadID(),
+ 4);
+ }
+ return hostnum;
+}
+#endif
+
+int gmx_physicalnode_id_hash(void)
+{
+ int hash;
+
+#ifndef GMX_MPI
+ hash = 0;
+#else
+#ifdef GMX_THREAD_MPI
+ /* thread-MPI currently puts the thread number in the process name,
+ * we might want to change this, as this is inconsistent with what
+ * most MPI implementations would do when running on a single node.
+ */
+ hash = 0;
+#else
+#ifdef GMX_TARGET_BGQ
+ hash = bgq_nodenum();
+#else
+ hash = mpi_hostname_hash();
+#endif
+#endif
+#endif
+
+ if (debug)
+ {
+ fprintf(debug, "In gmx_physicalnode_id_hash: hash %d\n", hash);
+ }
+
+ return hash;
+}
+
+#ifdef GMX_LIB_MPI
+void gmx_abort(int errorno)
+{
+ const char *programName = "GROMACS";
+ try
+ {
+ programName = gmx::getProgramContext().displayName();
+ }
+ catch (const std::exception &)
+ {
+ }
+ const int nnodes = gmx_node_num();
+ const int noderank = gmx_node_rank();
+ if (nnodes > 1)
+ {
+ std::fprintf(stderr, "Halting parallel program %s on rank %d out of %d\n",
+ programName, noderank, nnodes);
+ }
+ else
+ {
+ std::fprintf(stderr, "Halting program %s\n", programName);
+ }
+
+ MPI_Abort(MPI_COMM_WORLD, errorno);
+ std::exit(errorno);
+}
+#endif
--- /dev/null
- #define GMX_MPI_REAL MPI_DOUBLE
- #define GMX_REAL_EPS GMX_DOUBLE_EPS
- #define GMX_REAL_MIN GMX_DOUBLE_MIN
- #define GMX_REAL_MAX GMX_DOUBLE_MAX
+/*
+ * This file is part of the GROMACS molecular simulation package.
+ *
+ * Copyright (c) 1991-2000, University of Groningen, The Netherlands.
+ * Copyright (c) 2001-2004, The GROMACS development team.
+ * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
+ * and including many others, as listed in the AUTHORS file in the
+ * top-level source directory and at http://www.gromacs.org.
+ *
+ * GROMACS is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public License
+ * as published by the Free Software Foundation; either version 2.1
+ * of the License, or (at your option) any later version.
+ *
+ * GROMACS is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with GROMACS; if not, see
+ * http://www.gnu.org/licenses, or write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * If you want to redistribute modifications to GROMACS, please
+ * consider that scientific software is very special. Version
+ * control is crucial - bugs must be traceable. We will be happy to
+ * consider code for inclusion in the official distribution, but
+ * derived work must not be called official GROMACS. Details are found
+ * in the README & COPYING files - if they are missing, get the
+ * official version at http://www.gromacs.org.
+ *
+ * To help us fund GROMACS development, we humbly ask that you cite
+ * the research papers on the package. Check out http://www.gromacs.org.
+ */
+/*! \file
+ * \brief
+ * Declares `real` and related constants.
+ *
+ * \inpublicapi
+ * \ingroup module_utility
+ */
+#ifndef GMX_UTILITY_REAL_H
+#define GMX_UTILITY_REAL_H
+
+/*! \brief Double precision accuracy */
+#define GMX_DOUBLE_EPS 2.2204460492503131e-16
+
+/*! \brief Maximum double precision value - reduced 1 unit in last digit for MSVC */
+#define GMX_DOUBLE_MAX 1.7976931348623157e+308
+
+/*! \brief Minimum double precision value */
+#define GMX_DOUBLE_MIN 2.2250738585072014e-308
+
+/*! \brief Single precision accuracy */
+#define GMX_FLOAT_EPS 1.19209290e-07F
+
+/*! \brief Maximum single precision value - reduced 1 unit in last digit for MSVC */
+#define GMX_FLOAT_MAX 3.40282346E+38F
+
+/*! \brief Minimum single precision value */
+#define GMX_FLOAT_MIN 1.175494351E-38F
+
++#ifdef __PGI
++/* The portland group x86 C/C++ compilers do not treat negative zero initializers
++ * correctly, but "optimizes" them to positive zero, so we implement it explicitly.
++ * These constructs are optimized to simple loads at compile time. If you want to
++ * use them on other compilers those have to support gcc preprocessor extensions.
++ * Note: These initializers might be sensitive to the endianness (which can
++ * be different for byte and word order), so check that it works for your platform
++ * and add a separate section if necessary before adding to the ifdef above.
++ */
++# define GMX_DOUBLE_NEGZERO ({ const union { int di[2]; double d; } _gmx_dzero = {0, -2147483648}; _gmx_dzero.d; })
++# define GMX_FLOAT_NEGZERO ({ const union { int fi; float f; } _gmx_fzero = {-2147483648}; _gmx_fzero.f; })
++#else
++/*! \brief Negative zero in double */
++# define GMX_DOUBLE_NEGZERO (-0.0)
++
++/*! \brief Negative zero in float */
++# define GMX_FLOAT_NEGZERO (-0.0f)
++#endif
+
+/*! \typedef real
+ * \brief Precision-dependent \Gromacs floating-point type.
+ */
+/*! \def HAVE_REAL
+ * \brief Used to check whether `real` is already defined.
+ */
+/*! \def GMX_MPI_REAL
+ * \brief MPI data type for `real`.
+ */
+/*! \def GMX_REAL_EPS
+ * \brief Accuracy for `real`.
+ */
+/*! \def GMX_REAL_MIN
+ * \brief Smallest non-zero value for `real`.
+ */
+/*! \def GMX_REAL_MAX
+ * \brief Largest finite value for `real`.
+ */
++/*! \def GMX_REAL_NEGZERO
++ * \brief Negative zero for `real`.
++ */
+/*! \def gmx_real_fullprecision_pfmt
+ * \brief Format string for full `real` precision.
+ */
+#ifdef GMX_DOUBLE
+
+#ifndef HAVE_REAL
+typedef double real;
+#define HAVE_REAL
+#endif
+
- #define GMX_MPI_REAL MPI_FLOAT
- #define GMX_REAL_EPS GMX_FLOAT_EPS
- #define GMX_REAL_MIN GMX_FLOAT_MIN
- #define GMX_REAL_MAX GMX_FLOAT_MAX
++#define GMX_MPI_REAL MPI_DOUBLE
++#define GMX_REAL_EPS GMX_DOUBLE_EPS
++#define GMX_REAL_MIN GMX_DOUBLE_MIN
++#define GMX_REAL_MAX GMX_DOUBLE_MAX
++#define GMX_REAL_NEGZERO GMX_DOUBLE_NEGZERO
+#define gmx_real_fullprecision_pfmt "%21.14e"
+
+#else /* GMX_DOUBLE */
+
+#ifndef HAVE_REAL
+typedef float real;
+#define HAVE_REAL
+#endif
+
++#define GMX_MPI_REAL MPI_FLOAT
++#define GMX_REAL_EPS GMX_FLOAT_EPS
++#define GMX_REAL_MIN GMX_FLOAT_MIN
++#define GMX_REAL_MAX GMX_FLOAT_MAX
++#define GMX_REAL_NEGZERO GMX_FLOAT_NEGZERO
+#define gmx_real_fullprecision_pfmt "%14.7e"
+
+#endif /* GMX_DOUBLE */
+
+#endif
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
+#include "gmxpre.h"
+
#include "gromacs/utility/smalloc.h"
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
+#include "config.h"
#include <errno.h>
#include <stdio.h>
#include <dmalloc.h>
#endif
-#include "gromacs/legacyheaders/gmx_fatal.h"
+#include "thread_mpi/threads.h"
+#include "gromacs/utility/fatalerror.h"
#ifdef PRINT_ALLOC_KB
-#include "gromacs/legacyheaders/network.h"
++#include "gromacs/utility/basenetwork.h"
#include "gromacs/utility/gmxmpi.h"
#endif
-#ifdef DEBUG
-#include "thread_mpi/threads.h"
+static gmx_bool g_bOverAllocDD = FALSE;
+static tMPI_Thread_mutex_t g_over_alloc_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
+#ifdef DEBUG
static void log_action(int bMal, const char *what, const char *file, int line,
int nelem, int size, void *ptr)
{
else
{
#ifdef PRINT_ALLOC_KB
- int rank = 0;
if (nelem*elsize >= PRINT_ALLOC_KB*1024)
{
- #ifdef GMX_MPI
- MPI_Comm_rank(MPI_COMM_WORLD, &rank);
- #endif
+ int rank = gmx_node_rank();
printf("Allocating %.1f MB for %s (called from file %s, line %d on %d)\n",
nelem*elsize/1048576.0, name, file, line, rank);
}
else
{
#ifdef PRINT_ALLOC_KB
- int rank = 0;
if (size >= PRINT_ALLOC_KB*1024)
{
- #ifdef GMX_MPI
- MPI_Comm_rank(MPI_COMM_WORLD, &rank);
- #endif
+ int rank = gmx_node_rank();
printf("Reallocating %.1f MB for %s (called from file %s, line %d on %d)\n",
size/1048576.0, name, file, line, rank);
}
#ifdef PRINT_ALLOC_KB
if (nelem*elsize >= PRINT_ALLOC_KB*1024)
{
- printf("Allocating %.1f MB for %s\n",
- nelem*elsize/(PRINT_ALLOC_KB*1024.0), name);
+ int rank = gmx_node_rank();
+ printf("Allocating %.1f MB for %s (called from file %s, line %d on %d)\n",
+ nelem*elsize/1048576.0, name, file, line, rank);
}
#endif
- allocate_fail = FALSE; /* stop compiler warnings */
#ifdef HAVE_POSIX_MEMALIGN
allocate_fail = (0 != posix_memalign(&malloced, alignment, nelem*elsize));
#elif defined HAVE_MEMALIGN
#endif
}
}
+
+void set_over_alloc_dd(gmx_bool set)
+{
+ tMPI_Thread_mutex_lock(&g_over_alloc_mutex);
+ /* we just make sure that we don't set this at the same time.
+ We don't worry too much about reading this rarely-set variable */
+ g_bOverAllocDD = set;
+ tMPI_Thread_mutex_unlock(&g_over_alloc_mutex);
+}
+
+int over_alloc_dd(int n)
+{
+ if (g_bOverAllocDD)
+ {
+ return OVER_ALLOC_FAC*n + 100;
+ }
+ else
+ {
+ return n;
+ }
+}
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include "typedefs.h"
-#include "gromacs/utility/smalloc.h"
-#include "sysstuff.h"
-#include "vec.h"
-#include "vcm.h"
-#include "mdebin.h"
-#include "nrnb.h"
-#include "calcmu.h"
-#include "index.h"
-#include "vsite.h"
-#include "update.h"
-#include "ns.h"
-#include "mdrun.h"
-#include "md_support.h"
-#include "md_logging.h"
-#include "network.h"
-#include "xvgr.h"
-#include "physics.h"
-#include "names.h"
-#include "force.h"
-#include "disre.h"
-#include "orires.h"
-#include "pme.h"
-#include "mdatoms.h"
+#include "gmxpre.h"
+
+#include "config.h"
+
+#include <stdlib.h>
+
+#include "gromacs/legacyheaders/typedefs.h"
+#include "gromacs/math/vec.h"
+#include "gromacs/legacyheaders/vcm.h"
+#include "gromacs/legacyheaders/mdebin.h"
+#include "gromacs/legacyheaders/nrnb.h"
+#include "gromacs/legacyheaders/calcmu.h"
+#include "gromacs/legacyheaders/vsite.h"
+#include "gromacs/legacyheaders/update.h"
+#include "gromacs/legacyheaders/ns.h"
+#include "gromacs/legacyheaders/mdrun.h"
+#include "gromacs/legacyheaders/md_support.h"
+#include "gromacs/legacyheaders/md_logging.h"
+#include "gromacs/legacyheaders/network.h"
+#include "gromacs/legacyheaders/names.h"
+#include "gromacs/legacyheaders/force.h"
+#include "gromacs/legacyheaders/disre.h"
+#include "gromacs/legacyheaders/orires.h"
+#include "gromacs/legacyheaders/pme.h"
+#include "gromacs/legacyheaders/mdatoms.h"
#include "repl_ex.h"
#include "deform.h"
-#include "qmmm.h"
-#include "domdec.h"
-#include "domdec_network.h"
-#include "gromacs/gmxlib/topsort.h"
-#include "coulomb.h"
-#include "constr.h"
-#include "shellfc.h"
+#include "gromacs/legacyheaders/qmmm.h"
+#include "gromacs/legacyheaders/domdec.h"
+#include "gromacs/legacyheaders/domdec_network.h"
+#include "gromacs/legacyheaders/coulomb.h"
+#include "gromacs/legacyheaders/constr.h"
+#include "gromacs/legacyheaders/shellfc.h"
#include "gromacs/gmxpreprocess/compute_io.h"
-#include "checkpoint.h"
-#include "mtop_util.h"
-#include "sighandler.h"
-#include "txtdump.h"
+#include "gromacs/legacyheaders/checkpoint.h"
+#include "gromacs/topology/mtop_util.h"
+#include "gromacs/legacyheaders/sighandler.h"
+#include "gromacs/legacyheaders/txtdump.h"
#include "gromacs/utility/cstringutil.h"
#include "pme_loadbal.h"
-#include "bondf.h"
+#include "gromacs/legacyheaders/bondf.h"
#include "membed.h"
-#include "types/nlistheuristics.h"
-#include "types/iteratedconstraints.h"
-#include "nbnxn_cuda_data_mgmt.h"
+#include "gromacs/legacyheaders/types/nlistheuristics.h"
+#include "gromacs/legacyheaders/types/iteratedconstraints.h"
+#include "gromacs/mdlib/nbnxn_cuda/nbnxn_cuda_data_mgmt.h"
-#include "gromacs/utility/gmxmpi.h"
#include "gromacs/fileio/confio.h"
+#include "gromacs/fileio/mdoutf.h"
#include "gromacs/fileio/trajectory_writing.h"
#include "gromacs/fileio/trnio.h"
#include "gromacs/fileio/trxio.h"
#include "gromacs/fileio/xtcio.h"
-#include "gromacs/timing/wallcycle.h"
-#include "gromacs/timing/walltime_accounting.h"
+#include "gromacs/imd/imd.h"
+#include "gromacs/pbcutil/mshift.h"
+#include "gromacs/pbcutil/pbc.h"
#include "gromacs/pulling/pull.h"
#include "gromacs/swap/swapcoords.h"
-#include "gromacs/imd/imd.h"
+#include "gromacs/timing/wallcycle.h"
+#include "gromacs/timing/walltime_accounting.h"
+#include "gromacs/utility/gmxmpi.h"
+#include "gromacs/utility/smalloc.h"
#ifdef GMX_FAHCORE
#include "corewrap.h"
gmx_int64_t *step_rel, t_inputrec *ir,
gmx_wallcycle_t wcycle, t_nrnb *nrnb,
gmx_walltime_accounting_t walltime_accounting,
- nbnxn_cuda_ptr_t cu_nbv)
+ struct nonbonded_verlet_t *nbv)
{
char sbuf[STEPSTRSIZE];
md_print_warn(cr, fplog, "step %s: resetting all time and cycle counters\n",
gmx_step_str(step, sbuf));
- if (cu_nbv)
- {
- nbnxn_cuda_reset_timings(cu_nbv);
- }
+ nbnxn_cuda_reset_timings(nbv);
wallcycle_stop(wcycle, ewcRUN);
wallcycle_reset_all(wcycle);
rvec mu_tot;
t_vcm *vcm;
t_state *bufstate = NULL;
- matrix *scale_tot, pcoupl_mu, M, ebox;
+ matrix pcoupl_mu, M;
gmx_nlheur_t nlh;
t_trxframe rerun_fr;
gmx_repl_ex_t repl_ex = NULL;
gmx_ekindata_t *ekind, *ekind_save;
gmx_shellfc_t shellfc;
int count, nconverged = 0;
- real timestep = 0;
- double tcount = 0;
- gmx_bool bConverged = TRUE, bOK, bSumEkinhOld, bDoReplEx, bExchanged, bNeedRepartition;
- gmx_bool bAppend;
+ double tcount = 0;
+ gmx_bool bConverged = TRUE, bSumEkinhOld, bDoReplEx, bExchanged, bNeedRepartition;
gmx_bool bResetCountersHalfMaxH = FALSE;
gmx_bool bVV, bIterativeCase, bFirstIterate, bTemp, bPres, bTrotter;
gmx_bool bUpdateDoLR;
double cycles;
real saved_conserved_quantity = 0;
real last_ekin = 0;
- int iter_i;
t_extmass MassQ;
int **trotter_seq;
char sbuf[STEPSTRSIZE], sbuf2[STEPSTRSIZE];
/* Check for special mdrun options */
bRerunMD = (Flags & MD_RERUN);
- bAppend = (Flags & MD_APPENDFILES);
if (Flags & MD_RESETCOUNTERSHALFWAY)
{
if (ir->nsteps > 0)
&(state_global->fep_state), lam0,
nrnb, top_global, &upd,
nfile, fnm, &outf, &mdebin,
- force_vir, shake_vir, mu_tot, &bSimAnn, &vcm, Flags);
+ force_vir, shake_vir, mu_tot, &bSimAnn, &vcm, Flags, wcycle);
clear_mat(total_vir);
clear_mat(pres);
*/
if ((Flags & MD_TUNEPME) &&
EEL_PME(fr->eeltype) &&
- ( (fr->cutoff_scheme == ecutsVERLET && fr->nbv->bUseGPU) || !(cr->duty & DUTY_PME)) &&
+ ( use_GPU(fr->nbv) || !(cr->duty & DUTY_PME)) &&
!bRerunMD)
{
pme_loadbal_init(&pme_loadbal, ir, state->box, fr->ic, fr->pmedata);
bStateFromTPX = !bStateFromCP;
bInitStep = bFirstStep && (bStateFromTPX || bVV);
bStartingFromCpt = (Flags & MD_STARTFROMCPT) && bInitStep;
- bLastStep = FALSE;
bSumEkinhOld = FALSE;
- bDoReplEx = FALSE;
bExchanged = FALSE;
bNeedRepartition = FALSE;
step = ir->init_step;
step_rel = 0;
- if (ir->nstlist == -1)
- {
- init_nlistheuristics(&nlh, bGStatEveryStep, step);
- }
+ init_nlistheuristics(&nlh, bGStatEveryStep, step);
if (MULTISIM(cr) && (repl_ex_nst <= 0 ))
{
}
}
- bOK = TRUE;
if (!bRerunMD || rerun_fr.bV || bForceUpdate) /* Why is rerun_fr.bV here? Unclear. */
{
wallcycle_stop(wcycle, ewcUPDATE);
/* Correct the virial for multiple time stepping */
m_sub(shake_vir, fr->vir_twin_constr, shake_vir);
}
-
- if (!bOK)
- {
- gmx_fatal(FARGS, "Constraint error: Shake, Lincs or Settle could not solve the constrains");
- }
-
}
else if (graph)
{
do_md_trajectory_writing(fplog, cr, nfile, fnm, step, step_rel, t,
ir, state, state_global, top_global, fr,
outf, mdebin, ekind, f, f_global,
- wcycle, &nchkpt,
+ &nchkpt,
bCPT, bRerunMD, bLastStep, (Flags & MD_CONFOUT),
bSumEkinhOld);
/* Check if IMD step and do IMD communication, if bIMD is TRUE. */
*/
copy_mat(state->box, lastbox);
- bOK = TRUE;
dvdl_constr = 0;
if (!(bRerunMD && !rerun_fr.bV && !bForceUpdate))
FALSE, bCalcVir,
state->veta);
}
- if (!bOK)
- {
- gmx_fatal(FARGS, "Constraint error: Shake, Lincs or Settle could not solve the constrains");
- }
- if (fr->bSepDVDL && fplog && do_log)
- {
- gmx_print_sepdvdl(fplog, "Constraint dV/dl", 0.0, dvdl_constr);
- }
if (bVV)
{
/* this factor or 2 correction is necessary
{
/* Reset all the counters related to performance over the run */
reset_all_counters(fplog, cr, step, &step_rel, ir, wcycle, nrnb, walltime_accounting,
- fr->nbv != NULL && fr->nbv->bUseGPU ? fr->nbv->cu_nbv : NULL);
+ use_GPU(fr->nbv) ? fr->nbv : NULL);
wcycle_set_reset_counters(wcycle, -1);
if (!(cr->duty & DUTY_PME))
{
/* End of main MD loop */
debug_gmx();
+ /* Closing TNG files can include compressing data. Therefore it is good to do that
+ * before stopping the time measurements. */
+ mdoutf_tng_close(outf);
+
/* Stop measuring walltime */
walltime_accounting_end(walltime_accounting);
if (pme_loadbal != NULL)
{
pme_loadbal_done(pme_loadbal, cr, fplog,
- fr->nbv != NULL && fr->nbv->bUseGPU);
+ use_GPU(fr->nbv));
}
if (shellfc && fplog)
* \author Mark Abraham <mark.j.abraham@gmail.com>
* \ingroup module_mdrun
*/
+#include "gmxpre.h"
+
#include <gtest/gtest.h>
#include "moduletest.h"
#include "gromacs/options/filenameoption.h"
#include "testutils/cmdlinetest.h"
+ #include "config.h"
+
namespace
{
* version. */
const char *trajectoryFileNames[] = {
"../../../gromacs/gmxana/legacytests/spc2-traj.trr",
- #ifdef GMX_USE_TNG
+ #if defined GMX_USE_TNG && defined HAVE_ZLIB
"../../../gromacs/gmxana/legacytests/spc2-traj.tng",
#endif
"../../../gromacs/gmxana/legacytests/spc2-traj.xtc",
* \author Teemu Murtola <teemu.murtola@gmail.com>
* \ingroup module_testutils
*/
+#include "gmxpre.h"
+
#include "testutils/testasserts.h"
#include <gtest/gtest.h>
TEST(FloatingPointDifferenceTest, HandlesZerosOfDifferentSign)
{
- FloatingPointDifference diff(0.0, -0.0);
+ FloatingPointDifference diff(0.0, GMX_DOUBLE_NEGZERO);
EXPECT_FALSE(diff.isNaN());
EXPECT_EQ(0.0, diff.asAbsolute());
EXPECT_EQ(0U, diff.asUlps());
EXPECT_TRUE(diff.signsDiffer());
}
{
- FloatingPointDifference diff(-0.0, -1.2);
+ FloatingPointDifference diff(GMX_DOUBLE_NEGZERO, -1.2);
EXPECT_FALSE(diff.isNaN());
EXPECT_DOUBLE_EQ(1.2, diff.asAbsolute());
EXPECT_FALSE(diff.signsDiffer());
TEST(FloatingPointDifferenceTest, HandlesUlpDifferenceAcrossZero)
{
- const double first = addUlps(-0.0, 2);
+ const double first = addUlps(GMX_DOUBLE_NEGZERO, 2);
const double second = addUlps( 0.0, 2);
FloatingPointDifference diff(first, second);
EXPECT_FALSE(diff.isNaN());