Skip to content
Snippets Groups Projects
Commit 165ffe65 authored by carlocamilloni's avatar carlocamilloni
Browse files

GMX 2018.1 patch

it includes an additional modification to keep multisim in sync when using plumed
parent c25b856d
No related branches found
No related tags found
No related merge requests found
Showing
with 20021 additions and 0 deletions
...@@ -177,3 +177,8 @@ For developers: ...@@ -177,3 +177,8 @@ For developers:
- `plumed patch -p` command can be used twice without triggering an error. This will allow e.g. building again - `plumed patch -p` command can be used twice without triggering an error. This will allow e.g. building again
on MacPorts in cases where the build was interrupted. Notice that this only works for patches without special on MacPorts in cases where the build was interrupted. Notice that this only works for patches without special
after/before patch/revert functions. after/before patch/revert functions.
## Version 2.4.2 (unreleased)
For users:
- GROMACS patch for gromacs-2018.1.
function plumed_preliminary_test(){
# check if the README contains the word GROMACS and if gromacs has been already configured
grep -q GROMACS README 1>/dev/null 2>/dev/null
}
function plumed_patch_info(){
cat << EOF
PLUMED can be incorporated into gromacs using the standard patching procedure.
Patching must be done in the gromacs root directory _before_ the cmake command is invoked.
On clusters you may want to patch gromacs using the static version of plumed, in this case
building gromacs can result in multiple errors. One possible solution is to configure gromacs
with these additional options:
cmake -DBUILD_SHARED_LIBS=OFF -DGMX_PREFER_STATIC_LIBS=ON
To enable PLUMED in a gromacs simulation one should use
mdrun with an extra -plumed flag. The flag can be used to
specify the name of the PLUMED input file, e.g.:
gmx mdrun -plumed plumed.dat
For more information on gromacs you should visit http://www.gromacs.org
EOF
}
plumed_before_patch(){
plumed_patch_info
}
#
# This file is part of the GROMACS molecular simulation package.
#
# Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, 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(${CMAKE_SOURCE_DIR}/Plumed.cmake)
set(LIBGROMACS_SOURCES)
if (GMX_CLANG_CUDA)
include(gmxClangCudaUtils)
endif()
set_property(GLOBAL PROPERTY GMX_LIBGROMACS_SOURCES)
set_property(GLOBAL PROPERTY GMX_INSTALLED_HEADERS)
set_property(GLOBAL PROPERTY GMX_AVX_512_SOURCE)
function (_gmx_add_files_to_property PROPERTY)
foreach (_file ${ARGN})
if (IS_ABSOLUTE "${_file}")
set_property(GLOBAL APPEND PROPERTY ${PROPERTY} ${_file})
else()
set_property(GLOBAL APPEND PROPERTY ${PROPERTY}
${CMAKE_CURRENT_LIST_DIR}/${_file})
endif()
endforeach()
endfunction ()
function (gmx_add_libgromacs_sources)
_gmx_add_files_to_property(GMX_LIBGROMACS_SOURCES ${ARGN})
endfunction ()
function (gmx_install_headers)
if (NOT GMX_BUILD_MDRUN_ONLY)
file(RELATIVE_PATH _dest ${PROJECT_SOURCE_DIR}/src ${CMAKE_CURRENT_LIST_DIR})
install(FILES ${ARGN}
DESTINATION "${INCL_INSTALL_DIR}/${_dest}"
COMPONENT development)
endif()
_gmx_add_files_to_property(GMX_INSTALLED_HEADERS ${ARGN})
endfunction ()
function (gmx_write_installed_header_list)
get_property(_list GLOBAL PROPERTY GMX_INSTALLED_HEADERS)
string(REPLACE ";" "\n" _list "${_list}")
# TODO: Make this only update the file timestamp if the contents actually change.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/installed-headers.txt "${_list}")
endfunction()
add_subdirectory(gmxlib)
add_subdirectory(mdlib)
add_subdirectory(applied-forces)
add_subdirectory(listed-forces)
add_subdirectory(commandline)
add_subdirectory(domdec)
add_subdirectory(ewald)
add_subdirectory(fft)
add_subdirectory(gpu_utils)
add_subdirectory(hardware)
add_subdirectory(linearalgebra)
add_subdirectory(math)
add_subdirectory(mdrunutility)
add_subdirectory(mdtypes)
add_subdirectory(onlinehelp)
add_subdirectory(options)
add_subdirectory(pbcutil)
add_subdirectory(random)
add_subdirectory(tables)
add_subdirectory(taskassignment)
add_subdirectory(timing)
add_subdirectory(topology)
add_subdirectory(trajectory)
add_subdirectory(utility)
add_subdirectory(fileio)
add_subdirectory(swap)
add_subdirectory(essentialdynamics)
add_subdirectory(pulling)
add_subdirectory(awh)
add_subdirectory(simd)
add_subdirectory(imd)
if (NOT GMX_BUILD_MDRUN_ONLY)
add_subdirectory(gmxana)
add_subdirectory(gmxpreprocess)
add_subdirectory(correlationfunctions)
add_subdirectory(statistics)
add_subdirectory(analysisdata)
add_subdirectory(selection)
add_subdirectory(trajectoryanalysis)
add_subdirectory(energyanalysis)
add_subdirectory(tools)
endif()
get_property(PROPERTY_SOURCES GLOBAL PROPERTY GMX_LIBGROMACS_SOURCES)
list(APPEND LIBGROMACS_SOURCES ${GMXLIB_SOURCES} ${MDLIB_SOURCES} ${PROPERTY_SOURCES})
# This would be the standard way to include thread_mpi, but
# we want libgromacs to link the functions directly
#if(GMX_THREAD_MPI)
# add_subdirectory(thread_mpi)
#endif()
#target_link_libraries(gmx ${GMX_EXTRA_LIBRARIES} ${THREAD_MPI_LIB})
tmpi_get_source_list(THREAD_MPI_SOURCES ${CMAKE_SOURCE_DIR}/src/external/thread_mpi/src)
list(APPEND LIBGROMACS_SOURCES ${THREAD_MPI_SOURCES})
get_lmfit_properties(LMFIT_SOURCES LMFIT_LIBRARIES_TO_LINK LMFIT_INCLUDE_DIRECTORY LMFIT_INCLUDE_DIR_ORDER)
include_directories(${LMFIT_INCLUDE_DIR_ORDER} SYSTEM "${LMFIT_INCLUDE_DIRECTORY}")
list(APPEND LIBGROMACS_SOURCES ${LMFIT_SOURCES})
configure_file(version.h.cmakein version.h)
gmx_install_headers(
analysisdata.h
commandline.h
options.h
random.h
selection.h
trajectoryanalysis.h
utility.h
${CMAKE_CURRENT_BINARY_DIR}/version.h
)
# 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)
list(APPEND LIBGROMACS_SOURCES ${GENERATED_VERSION_FILE})
# set up CUDA compilation with clang
if (GMX_CLANG_CUDA)
foreach (_file ${LIBGROMACS_SOURCES})
get_filename_component(_ext ${_file} EXT)
if (${_ext} STREQUAL ".cu")
gmx_compile_cuda_file_with_clang(${_file})
endif()
endforeach()
endif()
if (GMX_USE_CUDA)
# Work around FindCUDA that prevents using target_link_libraries()
# with keywords otherwise...
set(CUDA_LIBRARIES PRIVATE ${CUDA_LIBRARIES})
if (NOT GMX_CLANG_CUDA)
cuda_add_library(libgromacs ${LIBGROMACS_SOURCES})
else()
add_library(libgromacs ${LIBGROMACS_SOURCES})
endif()
target_link_libraries(libgromacs PRIVATE ${CUDA_CUFFT_LIBRARIES})
else()
add_library(libgromacs ${LIBGROMACS_SOURCES})
endif()
# Recent versions of gcc and clang give warnings on scanner.cpp, which
# is a generated source file. These are awkward to suppress inline, so
# we do it in the compilation command (after testing that the compiler
# supports the suppressions).
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wno-unused HAS_NO_UNUSED)
if (HAS_NO_UNUSED)
set(_scanner_cpp_compiler_flags "${_scanner_cpp_compiler_flags} -Wno-unused-parameter -Wno-unused-function")
endif()
set_source_files_properties(selection/scanner.cpp PROPERTIES COMPILE_FLAGS "${_scanner_cpp_compiler_flags}")
if(SIMD_AVX_512_CXX_SUPPORTED)
# Since we might be overriding -march=core-avx2, add a flag so we don't warn for this specific file
set_source_files_properties(hardware/identifyavx512fmaunits.cpp PROPERTIES COMPILE_FLAGS "${SIMD_AVX_512_CXX_FLAGS} ${CXX_NO_UNUSED_OPTION_WARNING_FLAGS}")
endif()
gmx_setup_tng_for_libgromacs()
target_link_libraries(libgromacs
PRIVATE
${EXTRAE_LIBRARIES}
${GMX_EXTRA_LIBRARIES}
${GMX_COMMON_LIBRARIES}
${FFT_LIBRARIES} ${LINEAR_ALGEBRA_LIBRARIES}
${LMFIT_LIBRARIES_TO_LINK}
${THREAD_LIB} ${GMX_SHARED_LINKER_FLAGS} ${OPENCL_LIBRARIES}
${GMX_STDLIB_LIBRARIES}
PUBLIC
${GMX_PUBLIC_LIBRARIES}
${PLUMED_LOAD}
)
set_target_properties(libgromacs PROPERTIES
OUTPUT_NAME "gromacs${GMX_LIBS_SUFFIX}"
SOVERSION ${LIBRARY_SOVERSION_MAJOR}
VERSION ${LIBRARY_VERSION}
COMPILE_FLAGS "${OpenMP_C_FLAGS}")
gmx_write_installed_header_list()
# 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
EXPORT libgromacs
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
COMPONENT libraries)
endif()
if (NOT GMX_BUILD_MDRUN_ONLY)
include(InstallLibInfo.cmake)
endif()
# Technically, the user could want to do this for an OpenCL build
# using the CUDA runtime, but currently there's no reason to want to
# do that.
if (INSTALL_CUDART_LIB) #can be set manual by user
if (GMX_USE_CUDA)
foreach(CUDA_LIB ${CUDA_LIBRARIES})
string(REGEX MATCH "cudart" IS_CUDART ${CUDA_LIB})
if(IS_CUDART) #libcuda should not be installed
#install also name-links (linker uses those)
file(GLOB CUDA_LIBS ${CUDA_LIB}*)
install(FILES ${CUDA_LIBS} DESTINATION
${LIB_INSTALL_DIR} COMPONENT libraries)
endif()
endforeach()
else()
message(WARNING "INSTALL_CUDART_LIB only makes sense when configuring for CUDA support")
endif()
endif()
if(GMX_USE_OPENCL)
set(OPENCL_KERNELS ${MDLIB_OPENCL_KERNELS})
install(FILES ${OPENCL_KERNELS} DESTINATION
${OCL_INSTALL_DIR} COMPONENT libraries)
endif()
if (BUILD_TESTING)
add_subdirectory(compat/tests)
endif()
#
# This file is part of the GROMACS molecular simulation package.
#
# Copyright (c) 2010,2011,2012,2013,2014,2015,2016,2017, 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.
set(LIBGROMACS_SOURCES)
if (GMX_CLANG_CUDA)
include(gmxClangCudaUtils)
endif()
set_property(GLOBAL PROPERTY GMX_LIBGROMACS_SOURCES)
set_property(GLOBAL PROPERTY GMX_INSTALLED_HEADERS)
set_property(GLOBAL PROPERTY GMX_AVX_512_SOURCE)
function (_gmx_add_files_to_property PROPERTY)
foreach (_file ${ARGN})
if (IS_ABSOLUTE "${_file}")
set_property(GLOBAL APPEND PROPERTY ${PROPERTY} ${_file})
else()
set_property(GLOBAL APPEND PROPERTY ${PROPERTY}
${CMAKE_CURRENT_LIST_DIR}/${_file})
endif()
endforeach()
endfunction ()
function (gmx_add_libgromacs_sources)
_gmx_add_files_to_property(GMX_LIBGROMACS_SOURCES ${ARGN})
endfunction ()
function (gmx_install_headers)
if (NOT GMX_BUILD_MDRUN_ONLY)
file(RELATIVE_PATH _dest ${PROJECT_SOURCE_DIR}/src ${CMAKE_CURRENT_LIST_DIR})
install(FILES ${ARGN}
DESTINATION "${INCL_INSTALL_DIR}/${_dest}"
COMPONENT development)
endif()
_gmx_add_files_to_property(GMX_INSTALLED_HEADERS ${ARGN})
endfunction ()
function (gmx_write_installed_header_list)
get_property(_list GLOBAL PROPERTY GMX_INSTALLED_HEADERS)
string(REPLACE ";" "\n" _list "${_list}")
# TODO: Make this only update the file timestamp if the contents actually change.
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/installed-headers.txt "${_list}")
endfunction()
add_subdirectory(gmxlib)
add_subdirectory(mdlib)
add_subdirectory(applied-forces)
add_subdirectory(listed-forces)
add_subdirectory(commandline)
add_subdirectory(domdec)
add_subdirectory(ewald)
add_subdirectory(fft)
add_subdirectory(gpu_utils)
add_subdirectory(hardware)
add_subdirectory(linearalgebra)
add_subdirectory(math)
add_subdirectory(mdrunutility)
add_subdirectory(mdtypes)
add_subdirectory(onlinehelp)
add_subdirectory(options)
add_subdirectory(pbcutil)
add_subdirectory(random)
add_subdirectory(tables)
add_subdirectory(taskassignment)
add_subdirectory(timing)
add_subdirectory(topology)
add_subdirectory(trajectory)
add_subdirectory(utility)
add_subdirectory(fileio)
add_subdirectory(swap)
add_subdirectory(essentialdynamics)
add_subdirectory(pulling)
add_subdirectory(awh)
add_subdirectory(simd)
add_subdirectory(imd)
if (NOT GMX_BUILD_MDRUN_ONLY)
add_subdirectory(gmxana)
add_subdirectory(gmxpreprocess)
add_subdirectory(correlationfunctions)
add_subdirectory(statistics)
add_subdirectory(analysisdata)
add_subdirectory(selection)
add_subdirectory(trajectoryanalysis)
add_subdirectory(energyanalysis)
add_subdirectory(tools)
endif()
get_property(PROPERTY_SOURCES GLOBAL PROPERTY GMX_LIBGROMACS_SOURCES)
list(APPEND LIBGROMACS_SOURCES ${GMXLIB_SOURCES} ${MDLIB_SOURCES} ${PROPERTY_SOURCES})
# This would be the standard way to include thread_mpi, but
# we want libgromacs to link the functions directly
#if(GMX_THREAD_MPI)
# add_subdirectory(thread_mpi)
#endif()
#target_link_libraries(gmx ${GMX_EXTRA_LIBRARIES} ${THREAD_MPI_LIB})
tmpi_get_source_list(THREAD_MPI_SOURCES ${CMAKE_SOURCE_DIR}/src/external/thread_mpi/src)
list(APPEND LIBGROMACS_SOURCES ${THREAD_MPI_SOURCES})
get_lmfit_properties(LMFIT_SOURCES LMFIT_LIBRARIES_TO_LINK LMFIT_INCLUDE_DIRECTORY LMFIT_INCLUDE_DIR_ORDER)
include_directories(${LMFIT_INCLUDE_DIR_ORDER} SYSTEM "${LMFIT_INCLUDE_DIRECTORY}")
list(APPEND LIBGROMACS_SOURCES ${LMFIT_SOURCES})
configure_file(version.h.cmakein version.h)
gmx_install_headers(
analysisdata.h
commandline.h
options.h
random.h
selection.h
trajectoryanalysis.h
utility.h
${CMAKE_CURRENT_BINARY_DIR}/version.h
)
# 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)
list(APPEND LIBGROMACS_SOURCES ${GENERATED_VERSION_FILE})
# set up CUDA compilation with clang
if (GMX_CLANG_CUDA)
foreach (_file ${LIBGROMACS_SOURCES})
get_filename_component(_ext ${_file} EXT)
if (${_ext} STREQUAL ".cu")
gmx_compile_cuda_file_with_clang(${_file})
endif()
endforeach()
endif()
if (GMX_USE_CUDA)
# Work around FindCUDA that prevents using target_link_libraries()
# with keywords otherwise...
set(CUDA_LIBRARIES PRIVATE ${CUDA_LIBRARIES})
if (NOT GMX_CLANG_CUDA)
cuda_add_library(libgromacs ${LIBGROMACS_SOURCES})
else()
add_library(libgromacs ${LIBGROMACS_SOURCES})
endif()
target_link_libraries(libgromacs PRIVATE ${CUDA_CUFFT_LIBRARIES})
else()
add_library(libgromacs ${LIBGROMACS_SOURCES})
endif()
# Recent versions of gcc and clang give warnings on scanner.cpp, which
# is a generated source file. These are awkward to suppress inline, so
# we do it in the compilation command (after testing that the compiler
# supports the suppressions).
include(CheckCXXCompilerFlag)
check_cxx_compiler_flag(-Wno-unused HAS_NO_UNUSED)
if (HAS_NO_UNUSED)
set(_scanner_cpp_compiler_flags "${_scanner_cpp_compiler_flags} -Wno-unused-parameter -Wno-unused-function")
endif()
set_source_files_properties(selection/scanner.cpp PROPERTIES COMPILE_FLAGS "${_scanner_cpp_compiler_flags}")
if(SIMD_AVX_512_CXX_SUPPORTED)
# Since we might be overriding -march=core-avx2, add a flag so we don't warn for this specific file
set_source_files_properties(hardware/identifyavx512fmaunits.cpp PROPERTIES COMPILE_FLAGS "${SIMD_AVX_512_CXX_FLAGS} ${CXX_NO_UNUSED_OPTION_WARNING_FLAGS}")
endif()
gmx_setup_tng_for_libgromacs()
target_link_libraries(libgromacs
PRIVATE
${EXTRAE_LIBRARIES}
${GMX_EXTRA_LIBRARIES}
${GMX_COMMON_LIBRARIES}
${FFT_LIBRARIES} ${LINEAR_ALGEBRA_LIBRARIES}
${LMFIT_LIBRARIES_TO_LINK}
${THREAD_LIB} ${GMX_SHARED_LINKER_FLAGS} ${OPENCL_LIBRARIES}
${GMX_STDLIB_LIBRARIES}
PUBLIC
${GMX_PUBLIC_LIBRARIES}
)
set_target_properties(libgromacs PROPERTIES
OUTPUT_NAME "gromacs${GMX_LIBS_SUFFIX}"
SOVERSION ${LIBRARY_SOVERSION_MAJOR}
VERSION ${LIBRARY_VERSION}
COMPILE_FLAGS "${OpenMP_C_FLAGS}")
gmx_write_installed_header_list()
# 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
EXPORT libgromacs
LIBRARY DESTINATION ${LIB_INSTALL_DIR}
RUNTIME DESTINATION ${BIN_INSTALL_DIR}
ARCHIVE DESTINATION ${LIB_INSTALL_DIR}
COMPONENT libraries)
endif()
if (NOT GMX_BUILD_MDRUN_ONLY)
include(InstallLibInfo.cmake)
endif()
# Technically, the user could want to do this for an OpenCL build
# using the CUDA runtime, but currently there's no reason to want to
# do that.
if (INSTALL_CUDART_LIB) #can be set manual by user
if (GMX_USE_CUDA)
foreach(CUDA_LIB ${CUDA_LIBRARIES})
string(REGEX MATCH "cudart" IS_CUDART ${CUDA_LIB})
if(IS_CUDART) #libcuda should not be installed
#install also name-links (linker uses those)
file(GLOB CUDA_LIBS ${CUDA_LIB}*)
install(FILES ${CUDA_LIBS} DESTINATION
${LIB_INSTALL_DIR} COMPONENT libraries)
endif()
endforeach()
else()
message(WARNING "INSTALL_CUDART_LIB only makes sense when configuring for CUDA support")
endif()
endif()
if(GMX_USE_OPENCL)
set(OPENCL_KERNELS ${MDLIB_OPENCL_KERNELS})
install(FILES ${OPENCL_KERNELS} DESTINATION
${OCL_INSTALL_DIR} COMPONENT libraries)
endif()
if (BUILD_TESTING)
add_subdirectory(compat/tests)
endif()
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* 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) 2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* GROMACS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* GROMACS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GROMACS; if not, see
* http://www.gnu.org/licenses, or write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* If you want to redistribute modifications to GROMACS, please
* consider that scientific software is very special. Version
* control is crucial - bugs must be traceable. We will be happy to
* consider code for inclusion in the official distribution, but
* derived work must not be called official GROMACS. Details are found
* in the README & COPYING files - if they are missing, get the
* official version at http://www.gromacs.org.
*
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
#ifndef _repl_ex_h
#define _repl_ex_h
#include <cstdio>
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
struct gmx_enerdata_t;
struct gmx_multisim_t;
struct t_commrec;
struct t_inputrec;
class t_state;
/* The parameters for the replica exchange algorithm */
struct ReplicaExchangeParameters
{
ReplicaExchangeParameters() :
exchangeInterval(0),
numExchanges(0),
randomSeed(-1)
{
};
int exchangeInterval; /* Interval in steps at which to attempt exchanges, 0 means no replica exchange */
int numExchanges; /* The number of exchanges to attempt at an exchange step */
int randomSeed; /* The random seed, -1 means generate a seed */
};
/* Abstract type for replica exchange */
typedef struct gmx_repl_ex *gmx_repl_ex_t;
gmx_repl_ex_t
init_replica_exchange(FILE *fplog,
const gmx_multisim_t *ms,
int numAtomsInSystem,
const t_inputrec *ir,
const ReplicaExchangeParameters &replExParams);
/* Should only be called on the master ranks */
gmx_bool replica_exchange(FILE *fplog,
const t_commrec *cr,
gmx_repl_ex_t re,
t_state *state, const gmx_enerdata_t *enerd,
t_state *state_local,
gmx_int64_t step, real time);
/* Attempts replica exchange, should be called on all ranks.
* Returns TRUE if this state has been exchanged.
* When running each replica in parallel,
* this routine collects the state on the master rank before exchange.
* With domain decomposition, the global state after exchange is stored
* in state and still needs to be redistributed over the ranks.
*/
void print_replica_exchange_statistics(FILE *fplog, gmx_repl_ex_t re);
/* Should only be called on the master ranks */
/* PLUMED HREX */
extern int replica_exchange_get_repl(const gmx_repl_ex_t re);
extern int replica_exchange_get_nrepl(const gmx_repl_ex_t re);
extern void pd_collect_state(const t_commrec *cr, t_state *state);
extern void exchange_state(const gmx_multisim_t *ms, int b, t_state *state);
extern void copy_state_serial(const t_state *src, t_state *dest);
/* END PLUMED HREX */
#endif /* _repl_ex_h */
/*
* 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) 2011,2012,2013,2014,2015,2017, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
*
* GROMACS is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public License
* as published by the Free Software Foundation; either version 2.1
* of the License, or (at your option) any later version.
*
* GROMACS is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with GROMACS; if not, see
* http://www.gnu.org/licenses, or write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*
* If you want to redistribute modifications to GROMACS, please
* consider that scientific software is very special. Version
* control is crucial - bugs must be traceable. We will be happy to
* consider code for inclusion in the official distribution, but
* derived work must not be called official GROMACS. Details are found
* in the README & COPYING files - if they are missing, get the
* official version at http://www.gromacs.org.
*
* To help us fund GROMACS development, we humbly ask that you cite
* the research papers on the package. Check out http://www.gromacs.org.
*/
#ifndef _repl_ex_h
#define _repl_ex_h
#include <cstdio>
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
struct gmx_enerdata_t;
struct gmx_multisim_t;
struct t_commrec;
struct t_inputrec;
class t_state;
/* The parameters for the replica exchange algorithm */
struct ReplicaExchangeParameters
{
ReplicaExchangeParameters() :
exchangeInterval(0),
numExchanges(0),
randomSeed(-1)
{
};
int exchangeInterval; /* Interval in steps at which to attempt exchanges, 0 means no replica exchange */
int numExchanges; /* The number of exchanges to attempt at an exchange step */
int randomSeed; /* The random seed, -1 means generate a seed */
};
/* Abstract type for replica exchange */
typedef struct gmx_repl_ex *gmx_repl_ex_t;
gmx_repl_ex_t
init_replica_exchange(FILE *fplog,
const gmx_multisim_t *ms,
int numAtomsInSystem,
const t_inputrec *ir,
const ReplicaExchangeParameters &replExParams);
/* Should only be called on the master ranks */
gmx_bool replica_exchange(FILE *fplog,
const t_commrec *cr,
gmx_repl_ex_t re,
t_state *state, const gmx_enerdata_t *enerd,
t_state *state_local,
gmx_int64_t step, real time);
/* Attempts replica exchange, should be called on all ranks.
* Returns TRUE if this state has been exchanged.
* When running each replica in parallel,
* this routine collects the state on the master rank before exchange.
* With domain decomposition, the global state after exchange is stored
* in state and still needs to be redistributed over the ranks.
*/
void print_replica_exchange_statistics(FILE *fplog, gmx_repl_ex_t re);
/* Should only be called on the master ranks */
#endif /* _repl_ex_h */
This diff is collapsed.
This diff is collapsed.
/*
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2015,2017, 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.
*/
/*! \libinternal \file
*
* \brief Declares the routine running the inetgrators.
*
* \author David van der Spoel <david.vanderspoel@icm.uu.se>
* \ingroup module_mdlib
*/
#ifndef GMX_MDLIB_RUNNER_H
#define GMX_MDLIB_RUNNER_H
#include <cstdio>
#include <array>
#include "gromacs/commandline/filenm.h"
#include "gromacs/domdec/domdec.h"
#include "gromacs/hardware/hw_info.h"
#include "gromacs/math/vec.h"
#include "gromacs/mdlib/mdrun.h"
#include "gromacs/utility/basedefinitions.h"
#include "gromacs/utility/real.h"
#include "repl_ex.h"
struct gmx_output_env_t;
struct ReplicaExchangeParameters;
struct t_commrec;
namespace gmx
{
/*! \libinternal \brief Runner object for supporting setup and execution of mdrun.
*
* This class has responsibility for the lifetime of data structures
* that exist for the life of the simulation, e.g. for logging and
* communication.
*
* \todo Most of the attributes should be declared by specific modules
* as command-line options. Accordingly, they do not conform to the
* naming scheme, because that would make for a lot of noise in the
* diff, only to have it change again when the options move to their
* modules.
*
* \todo Preparing logging and MPI contexts could probably be a
* higher-level responsibility, so that an Mdrunner would get made
* without needing to re-initialize these components (as currently
* happens always for the master rank, and differently for the spawned
* ranks with thread-MPI).
*/
class Mdrunner
{
private:
//! Parallelism-related user options.
gmx_hw_opt_t hw_opt;
//! Filenames and properties from command-line argument values.
std::array<t_filenm, 35> filenames =
{{{ efTPR, nullptr, nullptr, ffREAD },
{ efTRN, "-o", nullptr, ffWRITE },
{ efCOMPRESSED, "-x", nullptr, ffOPTWR },
{ efCPT, "-cpi", nullptr, ffOPTRD | ffALLOW_MISSING },
{ efCPT, "-cpo", nullptr, ffOPTWR },
{ efSTO, "-c", "confout", ffWRITE },
{ efEDR, "-e", "ener", ffWRITE },
{ efLOG, "-g", "md", ffWRITE },
{ efXVG, "-dhdl", "dhdl", ffOPTWR },
{ efXVG, "-field", "field", ffOPTWR },
{ efXVG, "-table", "table", ffOPTRD },
{ efXVG, "-tablep", "tablep", ffOPTRD },
{ efXVG, "-tableb", "table", ffOPTRDMULT },
{ efTRX, "-rerun", "rerun", ffOPTRD },
{ efXVG, "-tpi", "tpi", ffOPTWR },
{ efXVG, "-tpid", "tpidist", ffOPTWR },
{ efEDI, "-ei", "sam", ffOPTRD },
{ efXVG, "-eo", "edsam", ffOPTWR },
{ efXVG, "-devout", "deviatie", ffOPTWR },
{ efXVG, "-runav", "runaver", ffOPTWR },
{ efXVG, "-px", "pullx", ffOPTWR },
{ efXVG, "-pf", "pullf", ffOPTWR },
{ efXVG, "-ro", "rotation", ffOPTWR },
{ efLOG, "-ra", "rotangles", ffOPTWR },
{ efLOG, "-rs", "rotslabs", ffOPTWR },
{ efLOG, "-rt", "rottorque", ffOPTWR },
{ efMTX, "-mtx", "nm", ffOPTWR },
{ efRND, "-multidir", nullptr, ffOPTRDMULT},
{ efDAT, "-plumed", "plumed", ffOPTRD }, /* PLUMED */
{ efXVG, "-awh", "awhinit", ffOPTRD },
{ efDAT, "-membed", "membed", ffOPTRD },
{ efTOP, "-mp", "membed", ffOPTRD },
{ efNDX, "-mn", "membed", ffOPTRD },
{ efXVG, "-if", "imdforces", ffOPTWR },
{ efXVG, "-swap", "swapions", ffOPTWR }}};
/*! \brief Filename arguments.
*
* Provided for compatibility with old C-style code accessing
* command-line arguments that are file names. */
t_filenm *fnm = filenames.data();
/*! \brief Number of filename argument values.
*
* Provided for compatibility with old C-style code accessing
* command-line arguments that are file names. */
int nfile = filenames.size();
//! Output context for writing text files
gmx_output_env_t *oenv = nullptr;
//! Ongoing collection of mdrun options
MdrunOptions mdrunOptions;
//! Options for the domain decomposition.
DomdecOptions domdecOptions;
//! Target short-range interations for "cpu", "gpu", or "auto". Default is "auto".
const char *nbpu_opt = nullptr;
//! Target long-range interactions for "cpu", "gpu", or "auto". Default is "auto".
const char *pme_opt = nullptr;
//! Target long-range interactions FFT/solve stages for "cpu", "gpu", or "auto". Default is "auto".
const char *pme_fft_opt = nullptr;
//! Command-line override for the duration of a neighbor list with the Verlet scheme.
int nstlist_cmdline = 0;
//! Number of simulations in multi-simulation set.
int nmultisim = 0;
//! Parameters for replica-exchange simulations.
ReplicaExchangeParameters replExParams;
//! Print a warning if any force is larger than this (in kJ/mol nm).
real pforce = -1;
//! Handle to file used for logging.
FILE *fplog;
//! Handle to communication data structure.
t_commrec *cr;
public:
/*! \brief Defaulted constructor.
*
* Note that when member variables are not present in the constructor
* member initialization list (which is true for the default constructor),
* then they are initialized with any default member initializer specified
* when they were declared, or default initialized. */
Mdrunner() = default;
//! Start running mdrun by calling its C-style main function.
int mainFunction(int argc, char *argv[]);
/*! \brief Driver routine, that calls the different simulation methods. */
int mdrunner();
//! Called when thread-MPI spawns threads.
t_commrec *spawnThreads(int numThreadsToLaunch);
/*! \brief Re-initializes the object after threads spawn.
*
* \todo Can this be refactored so that the Mdrunner on a spawned thread is
* constructed ready to use? */
void reinitializeOnSpawnedThread();
};
} // namespace gmx
#endif // GMX_MDLIB_RUNNER_H
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment