# \author Sebastian Keller <keller@cscs.ch>
#
-# The following are copied directly from src/CMakeLists.txt
-set(IGNORED_CLANG_ALL_WARNINGS
- "-Wno-c++98-compat -Wno-c++98-compat-pedantic" #No intention of C++98 compability
- "-Wno-source-uses-openmp" #Don't warn for no-omp build
- "-Wno-c++17-extensions" #Allowed in attributes (compilers are required to ignore unknown attributes)
- "-Wno-documentation-unknown-command" #Custom commands are used
- "-Wno-covered-switch-default" #GCC gives maybe-uninitialized without default label and checks for illegal enum values.
- "-Wno-switch-enum" # default statement for enum is OK
-
- # These are all needed, mostly for testing code
- "-Wno-conversion"
- "-Wno-documentation"
- "-Wno-double-promotion"
- "-Wno-exit-time-destructors"
- "-Wno-float-equal"
- "-Wno-global-constructors"
- "-Wno-padded"
- "-Wno-reserved-id-macro"
- "-Wno-shadow"
- "-Wno-unused-macros"
- "-Wno-weak-vtables"
- )
-
-string(REPLACE " " ";" IGNORED_CLANG_ALL_WARNINGS "${IGNORED_CLANG_ALL_WARNINGS}")
-
set(TESTUTILS_DIR ${PROJECT_SOURCE_DIR}/src/testutils)
if (BUILD_TESTING)
if(NOT GMX_DEVELOPER_BUILD)
//! Number of atoms used in these tests.
constexpr int c_numAtoms = 4;
+namespace
+{
+
//! Coordinates for testing
std::vector<std::vector<gmx::RVec>> c_coordinatesForTests = {
{ { 0.0, 0.0, 0.0 }, { 0.0, 0.0, 0.2 }, { 0.005, 0.0, 0.1 }, { -0.001, 0.1, 0.0 } },
// Todo: update test setup to allow more than one interaction type and add the following to the inputs
// std::vector<std::vector<RyckaertBellemanDihedral>> c_InputDihs = { { RyckaertBellemanDihedral({ -7.35, 13.6, 8.4, -16.7, 1.3, 12.4 }) } };
+} // namespace
+
template<class Interaction>
class ListedForcesBase
{
namespace
{
-// This is defined in src/gromacs/mdtypes/forcerec.h but there is also a
-// legacy C6 macro defined there that conflicts with the nblib C6 type.
-// Todo: Once that C6 has been refactored into a regular function, this
-// file can just include forcerec.h
-//! Macro to set Van der Waals interactions to atoms
-#define SET_CGINFO_HAS_VDW(cgi) (cgi) = ((cgi) | (1 << 23))
-
TEST(NBlibTest, SpcMethanolForcesAreCorrect)
{
auto options = NBKernelOptions();
}
}
-// This is defined in src/gromacs/mdtypes/forcerec.h but there is also a
-// legacy C6 macro defined there that conflicts with the nblib C6 type.
-// Todo: Once that C6 has been refactored into a regular function, this
-// file can just include forcerec.h
-//! Macro to marks particles to have Van der Waals interactions
-#define SET_CGINFO_HAS_VDW(cgi) (cgi) = ((cgi) | (1 << 23))
-
TEST(NBlibTest, TopologyHasNumParticles)
{
WaterTopologyBuilder waters;
# 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(CheckCCompilerFlag)
+include(CheckCXXCompilerFlag)
+
# Test C flags FLAGS, and set VARIABLE to true if the work. Also add the
# flags to CFLAGSVAR.
MACRO(GMX_TEST_CFLAG VARIABLE FLAGS CFLAGSVAR)
endif()
endmacro()
+
+# Make sure we generate warnings (and hopefully fix) "everything"
+# reported by compilers that support that (ie recent clang and its
+# derivatives).
+function(gmx_warn_on_everything target)
+
+ # If the compiler suports warning on "everything" then we'll turn
+ # it on. Note that all warnings become errors for developer
+ # builds, but not for user builds.
+ gmx_target_warning_suppression(${target} "-Weverything" HAS_WARNING_EVERYTHING)
+
+ if (NOT HAS_WARNING_EVERYTHING)
+ # There's no need to suppress aspects of "-Weverything" if
+ # that warning is not supported.
+ return()
+ endif()
+
+ # We don't actually fix everything, so list the exceptions that we
+ # choose to make. We may be able to eliminate some of these over
+ # time.
+ #
+ # We check whether the flag is accepted first, so that we suppress
+ # such warnings also with compilers that don't directly identify
+ # as e.g. clang despite being based on it (e.g. most vendor
+ # compilers), and also don't fail to compile GROMACS when future
+ # versions of any such compiler changes how the warnings
+ # look/work.
+
+ # We have no intention of C++98 compability
+ gmx_target_warning_suppression(${target} "-Wno-c++98-compat" HAS_WARNING_NO_CPLUSPLUS98_COMPAT)
+ gmx_target_warning_suppression(${target} "-Wno-c++98-compat-pedantic" HAS_WARNING_NO_CPLUSPLUS98_COMPAT_PEDANTIC)
+
+ # Don't warn for use of OpenMP pragmas in no-omp build
+ gmx_target_warning_suppression(${target} "-Wno-source-uses-openmp" HAS_WARNING_NO_SOURCE_USED_OPENMP)
+
+ # Allowed in attributes (compilers are required to ignore unknown attributes)
+ gmx_target_warning_suppression(${target} "-Wno-c++17-extensions" HAS_WARNING_NO_CPLUSPLUS17_EXTENSIONS)
+
+ # Custom Doxygen commands are used
+ gmx_target_warning_suppression(${target} "-Wno-documentation-unknown-command" HAS_WARNING_NO_DOCUMENTATION_UNKNOWN_COMMAND)
+
+ # We need to use default labels in switch statements, because GCC gives
+ # maybe-uninitialized without default label and checks for illegal enum values.
+ gmx_target_warning_suppression(${target} "-Wno-covered-switch-default" HAS_WARNING_NO_COVERED_SWITCH_DEFAULT)
+
+ # Default statement for enum is OK.
+ # It's OK to not have branches for Count members of enum classes
+ gmx_target_warning_suppression(${target} "-Wno-switch-enum" HAS_WARNING_NO_SWITCH_ENUM)
+
+ # We need to use macros like
+ # GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR and
+ # CLANG_DIAGNOSTIC_IGNORE. Those will look strange if they don't
+ # have a semicolon after them, and might confuse tools like IDEs
+ # also.
+ gmx_target_warning_suppression(${target} "-Wno-extra-semi-stmt" HAS_WARNING_NO_EXTRA_SEMI_STMT)
+
+ # We intend to use fully inline classes with virtual methods
+ gmx_target_warning_suppression(${target} "-Wno-weak-vtables" HAS_WARNING_NO_WEAK_VTABLES)
+
+ # We intend to use constructor arguments that shadow member variables
+ gmx_target_warning_suppression(${target} "-Wno-shadow" HAS_WARNING_NO_SHADOW)
+
+ # Padding of structs is routine, we don't need to hear about it
+ gmx_target_warning_suppression(${target} "-Wno-padded" HAS_WARNING_NO_PADDED)
+
+ # Our uses of double underscores in macro names are OK
+ gmx_target_warning_suppression(${target} "-Wno-reserved-id-macro" HAS_WARNING_NO_RESERVED_ID_MACRO)
+
+ # Implicit conversion of float to double is fine
+ gmx_target_warning_suppression(${target} "-Wno-double-promotion" HAS_WARNING_NO_DOUBLE_PROMOTION)
+
+ # No resources in static variables need exit-time destructors
+ gmx_target_warning_suppression(${target} "-Wno-exit-time-destructors" HAS_WARNING_NO_EXIT_TIME_DESTRUCTORS)
+
+ # Global constructors are not needed
+ gmx_target_warning_suppression(${target} "-Wno-global-constructors" HAS_WARNING_NO_GLOBAL_CONSTRUCTORS)
+
+ # False positives are emitted
+ gmx_target_warning_suppression(${target} "-Wno-documentation" HAS_WARNING_NO_DOCUMENTATION)
+
+ # We intend to use format strings that we construct, even though that is a security risk
+ gmx_target_warning_suppression(${target} "-Wno-format-nonliteral" HAS_WARNING_NO_FORMAT_NONLITERAL)
+
+ # We do a lot of conditional compilation that sometimes uses a symbol and sometimes does not
+ gmx_target_warning_suppression(${target} "-Wno-used-but-marked-unused" HAS_WARNING_NO_USED_BUT_MARKED_UNUSED)
+
+ # It's only risky to compare floats for equality when they are the
+ # result of computation. Unfortunately it's hard to tell the
+ # difference and there's no good way to suppress this on a
+ # case-by-base basis.
+ gmx_target_warning_suppression(${target} "-Wno-float-equal" HAS_WARNING_NO_FLOAT_EQUAL)
+
+ #
+ # Exceptions we should consider fixing
+ #
+
+ # Much code in gmxana uses complex logic that may or may not be valid
+ gmx_target_warning_suppression(${target} "-Wno-conditional-uninitialized" HAS_WARNING_CONDITIONAL_UNINITIALIZED)
+
+ # We have many places implicit conversions still occur, most of which need fixing
+ gmx_target_warning_suppression(${target} "-Wno-conversion" HAS_WARNING_NO_CONVERSION)
+
+ # We use the Linux signal handlers in the intended way, but it triggers this warning.
+ # It would be better to localize this exception.
+ gmx_target_warning_suppression(${target} "-Wno-disabled-macro-expansion" HAS_WARNING_NO_DISABLED_MACRO_EXPANSION)
+
+ # The NBNXM simd kernels define lots of macros that are not used
+ # It would be better to localize this exception.
+ gmx_target_warning_suppression(${target} "-Wno-unused-macros" HAS_WARNING_NO_UNUSED_MACROS)
+
+endfunction()
#
# Copyright (c) 2009,2010,2011,2012,2013 by the GROMACS development team.
# Copyright (c) 2014,2015,2016,2017,2018 by the GROMACS development team.
-# Copyright (c) 2019,2020, by the GROMACS development team, led by
+# Copyright (c) 2019,2020,2021, 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.
)
####
-list(APPEND IGNORED_CLANG_ALL_WARNINGS
- "-Wno-c++98-compat" "-Wno-c++98-compat-pedantic" #No intention of C++98 compability
- "-Wno-source-uses-openmp" #Don't warn for no-omp build
- "-Wno-c++17-extensions" #Allowed in attributes (compilers are required to ignore unknown attributes)
- "-Wno-documentation-unknown-command" #Custom commands are used
- "-Wno-covered-switch-default" #GCC gives maybe-uninitialized without default label and checks for illegal enum values.
- "-Wno-switch-enum" # default statement for enum is OK
-
- # We need to use macros like
- # GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR. Those will look strange
- # if they don't have a semicolon after them, and might confuse
- # tools like IDEs also.
- "-Wno-extra-semi-stmt"
-
- #Following ones are undecided/TODO
- "-Wno-disabled-macro-expansion"
- "-Wno-cast-align"
- "-Wno-reserved-id-macro"
- "-Wno-global-constructors"
- "-Wno-exit-time-destructors"
- "-Wno-unused-macros"
- "-Wno-weak-vtables"
- "-Wno-conditional-uninitialized"
- "-Wno-format-nonliteral"
- "-Wno-shadow"
- "-Wno-cast-qual"
- "-Wno-documentation"
- "-Wno-used-but-marked-unused"
- "-Wno-padded"
- "-Wno-float-equal"
- "-Wno-old-style-cast"
- "-Wno-conversion"
- "-Wno-double-promotion")
option(GMX_CLANG_TIDY "Use clang-tidy" OFF)
if (GMX_CLANG_TIDY)
gmx_manage_lmfit()
target_link_libraries(libgromacs PRIVATE lmfit)
-# Make sure we fix "everything" found by more recent versions of clang.
-if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7")
- target_compile_options(libgromacs PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Weverything ${IGNORED_CLANG_ALL_WARNINGS}>)
-endif()
+# Make sure we fix "everything" found by compilers that support that
+gmx_warn_on_everything(libgromacs)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_options(libgromacs PRIVATE $<$<COMPILE_LANGUAGE:CXX>:/analyze /analyze:stacksize 70000
#Control flow warnings are disabled because the commond line output is insufficient. There is no tool
return dlbStateNames[enumValue];
}
-/* The size per atom group of the cggl_flag buffer in gmx_domdec_comm_t */
-#define DD_CGIBS 2
-
-/* The flags for the cggl_flag buffer in gmx_domdec_comm_t */
-#define DD_FLAG_NRCG 65535
-#define DD_FLAG_FW(d) (1 << (16 + (d)*2))
-#define DD_FLAG_BW(d) (1 << (16 + (d)*2 + 1))
-
/* The DD zone order */
static const ivec dd_zo[DD_MAXZONE] = { { 0, 0, 0 }, { 1, 0, 0 }, { 1, 1, 0 }, { 0, 1, 0 },
{ 0, 1, 1 }, { 0, 0, 1 }, { 1, 0, 1 }, { 1, 1, 1 } };
rvec grid_s[2], *grid_r = nullptr, cx, r;
char fname[STRLEN], buf[22];
FILE* out;
- int a, i, d, z, y, x;
+ int a, i, d, z, x;
matrix tric;
real vol;
}
for (z = 0; z < 2; z++)
{
- for (y = 0; y < 2; y++)
+ for (int y = 0; y < 2; y++)
{
for (x = 0; x < 2; x++)
{
{
for (x = 0; x < 4; x++)
{
+ int y = 0;
switch (d)
{
case 0: y = 1 + i * 8 + 2 * x; break;
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 1991-2003 David van der Spoel, Erik Lindahl, University of Groningen.
- * Copyright (c) 2013,2014,2015,2016,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2019,2020,2021, 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.
};
-int gmx_fft_init_1d(gmx_fft_t* pfft, int nx, gmx_fft_flag gmx_unused flags)
+int gmx_fft_init_1d(gmx_fft_t* pfft, int nxInt, gmx_fft_flag gmx_unused flags)
{
gmx_fft_t fft;
int d;
}
*pfft = nullptr;
- if ((fft = (gmx_fft_t)malloc(sizeof(struct gmx_fft))) == nullptr)
+ if ((fft = reinterpret_cast<gmx_fft_t>(malloc(sizeof(struct gmx_fft)))) == nullptr)
{
return ENOMEM;
}
fft->ooplace[3] = nullptr;
- status = DftiCreateDescriptor(&fft->inplace[0], GMX_DFTI_PREC, DFTI_COMPLEX, 1, (MKL_LONG)nx);
+ MKL_LONG nx = nxInt;
+ status = DftiCreateDescriptor(&fft->inplace[0], GMX_DFTI_PREC, DFTI_COMPLEX, 1, nx);
if (status == 0)
{
if (status == 0)
{
- status = DftiCreateDescriptor(&fft->ooplace[0], GMX_DFTI_PREC, DFTI_COMPLEX, 1, (MKL_LONG)nx);
+ status = DftiCreateDescriptor(&fft->ooplace[0], GMX_DFTI_PREC, DFTI_COMPLEX, 1, nx);
}
if (status == 0)
}
-int gmx_fft_init_1d_real(gmx_fft_t* pfft, int nx, gmx_fft_flag gmx_unused flags)
+int gmx_fft_init_1d_real(gmx_fft_t* pfft, int nxInt, gmx_fft_flag gmx_unused flags)
{
gmx_fft_t fft;
int d;
}
*pfft = nullptr;
- if ((fft = (gmx_fft_t)malloc(sizeof(struct gmx_fft))) == nullptr)
+ if ((fft = reinterpret_cast<gmx_fft_t>(malloc(sizeof(struct gmx_fft)))) == nullptr)
{
return ENOMEM;
}
}
fft->ooplace[3] = nullptr;
- status = DftiCreateDescriptor(&fft->inplace[0], GMX_DFTI_PREC, DFTI_REAL, 1, (MKL_LONG)nx);
+ MKL_LONG nx = nxInt;
+ status = DftiCreateDescriptor(&fft->inplace[0], GMX_DFTI_PREC, DFTI_REAL, 1, nx);
if (status == 0)
{
if (status == 0)
{
- status = DftiCreateDescriptor(&fft->ooplace[0], GMX_DFTI_PREC, DFTI_REAL, 1, (MKL_LONG)nx);
+ status = DftiCreateDescriptor(&fft->ooplace[0], GMX_DFTI_PREC, DFTI_REAL, 1, nx);
}
if (status == 0)
}
-int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nx, int ny, gmx_fft_flag gmx_unused flags)
+int gmx_fft_init_2d_real(gmx_fft_t* pfft, int nxInt, int nyInt, gmx_fft_flag gmx_unused flags)
{
gmx_fft_t fft;
int d;
}
*pfft = nullptr;
- if ((fft = (gmx_fft_t)malloc(sizeof(struct gmx_fft))) == nullptr)
+ if ((fft = reinterpret_cast<gmx_fft_t>(malloc(sizeof(struct gmx_fft)))) == nullptr)
{
return ENOMEM;
}
- nyc = (ny / 2 + 1);
+ nyc = (nyInt / 2 + 1);
/* Mark all handles invalid */
for (d = 0; d < 3; d++)
*/
/* In-place X FFT */
- status = DftiCreateDescriptor(&fft->inplace[0], GMX_DFTI_PREC, DFTI_COMPLEX, 1, (MKL_LONG)nx);
+ MKL_LONG nx = nxInt;
+ status = DftiCreateDescriptor(&fft->inplace[0], GMX_DFTI_PREC, DFTI_COMPLEX, 1, nx);
if (status == 0)
{
/* Out-of-place X FFT */
if (status == 0)
{
- status = DftiCreateDescriptor(&(fft->ooplace[0]), GMX_DFTI_PREC, DFTI_COMPLEX, 1, (MKL_LONG)nx);
+ status = DftiCreateDescriptor(&(fft->ooplace[0]), GMX_DFTI_PREC, DFTI_COMPLEX, 1, nx);
}
if (status == 0)
/* In-place Y FFT */
+ MKL_LONG ny = nyInt;
if (status == 0)
{
- status = DftiCreateDescriptor(&fft->inplace[1], GMX_DFTI_PREC, DFTI_REAL, 1, (MKL_LONG)ny);
+ status = DftiCreateDescriptor(&fft->inplace[1], GMX_DFTI_PREC, DFTI_REAL, 1, ny);
}
if (status == 0)
stride[1] = 1;
status = (DftiSetValue(fft->inplace[1], DFTI_PLACEMENT, DFTI_INPLACE)
- || DftiSetValue(fft->inplace[1], DFTI_NUMBER_OF_TRANSFORMS, (MKL_LONG)nx)
+ || DftiSetValue(fft->inplace[1], DFTI_NUMBER_OF_TRANSFORMS, nx)
|| DftiSetValue(fft->inplace[1], DFTI_INPUT_DISTANCE, 2 * nyc)
|| DftiSetValue(fft->inplace[1], DFTI_INPUT_STRIDES, stride)
|| DftiSetValue(fft->inplace[1], DFTI_OUTPUT_DISTANCE, 2 * nyc)
/* Out-of-place real-to-complex (affects output distance) Y FFT */
if (status == 0)
{
- status = DftiCreateDescriptor(&fft->ooplace[1], GMX_DFTI_PREC, DFTI_REAL, 1, (MKL_LONG)ny);
+ status = DftiCreateDescriptor(&fft->ooplace[1], GMX_DFTI_PREC, DFTI_REAL, 1, ny);
}
if (status == 0)
stride[1] = 1;
status = (DftiSetValue(fft->ooplace[1], DFTI_PLACEMENT, DFTI_NOT_INPLACE)
- || DftiSetValue(fft->ooplace[1], DFTI_NUMBER_OF_TRANSFORMS, (MKL_LONG)nx)
- || DftiSetValue(fft->ooplace[1], DFTI_INPUT_DISTANCE, (MKL_LONG)ny)
+ || DftiSetValue(fft->ooplace[1], DFTI_NUMBER_OF_TRANSFORMS, nx)
+ || DftiSetValue(fft->ooplace[1], DFTI_INPUT_DISTANCE, ny)
|| DftiSetValue(fft->ooplace[1], DFTI_INPUT_STRIDES, stride)
|| DftiSetValue(fft->ooplace[1], DFTI_OUTPUT_DISTANCE, 2 * nyc)
|| DftiSetValue(fft->ooplace[1], DFTI_OUTPUT_STRIDES, stride)
/* Out-of-place complex-to-real (affects output distance) Y FFT */
if (status == 0)
{
- status = DftiCreateDescriptor(&fft->ooplace[2], GMX_DFTI_PREC, DFTI_REAL, 1, (MKL_LONG)ny);
+ status = DftiCreateDescriptor(&fft->ooplace[2], GMX_DFTI_PREC, DFTI_REAL, 1, ny);
}
if (status == 0)
stride[1] = 1;
status = (DftiSetValue(fft->ooplace[2], DFTI_PLACEMENT, DFTI_NOT_INPLACE)
- || DftiSetValue(fft->ooplace[2], DFTI_NUMBER_OF_TRANSFORMS, (MKL_LONG)nx)
+ || DftiSetValue(fft->ooplace[2], DFTI_NUMBER_OF_TRANSFORMS, nx)
|| DftiSetValue(fft->ooplace[2], DFTI_INPUT_DISTANCE, 2 * nyc)
|| DftiSetValue(fft->ooplace[2], DFTI_INPUT_STRIDES, stride)
- || DftiSetValue(fft->ooplace[2], DFTI_OUTPUT_DISTANCE, (MKL_LONG)ny)
+ || DftiSetValue(fft->ooplace[2], DFTI_OUTPUT_DISTANCE, ny)
|| DftiSetValue(fft->ooplace[2], DFTI_OUTPUT_STRIDES, stride)
|| DftiCommitDescriptor(fft->ooplace[2]));
}
"?";
#define NMAP static_cast<long int>(sizeof(mapper) / sizeof(mapper[0]))
-#define MAX_XPM_LINELENGTH 4096
-
real** mk_matrix(int nx, int ny, gmx_bool b1D)
{
int i;
return pdbRecordTypeName[enumValue];
}
-#define REMARK_SIM_BOX "REMARK THIS IS A SIMULATION BOX"
-
void gmx_write_pdb_box(FILE* out, PbcType pbcType, const matrix box)
{
real alpha, beta, gamma;
};
#define NFTUPD asize(ftupd)
-/* Needed for backward compatibility */
-#define MAXNODES 256
-
/**************************************************************
*
* Now the higer level routines that do io of the structures and arrays
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
* Copyright (c) 2013,2014,2015,2016,2018 by the GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/futil.h"
#include "gromacs/utility/smalloc.h"
-#define BUFSIZE 128
-
static int nFloatSize(gmx_trr_header_t* sh)
{
int nflsize = 0;
{ "-subav", FALSE, etBOOL, { &bSubAv }, "Subtract the average before autocorrelating" },
{ "-oneacf", FALSE, etBOOL, { &bAverCorr }, "Calculate one ACF over all sets" },
};
-#define NPA asize(pa)
FILE* out;
int n, nlast, s, nset, i, j = 0;
gmx_output_env_t* oenv;
gmx_rmpbc_t gpbc = nullptr;
-#define NLEG asize(leg)
t_filenm fnm[] = {
{ efTRX, "-f", nullptr, ffREAD }, { efTPS, nullptr, nullptr, ffREAD },
{ efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-ol", "bun_len", ffWRITE },
"0000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000",
"0000000000000000000000000000000000000000000000000000000000000" };
-#define NPP asize(map)
- int x, y;
+ int x, y;
#define INDEX(ppp) (((static_cast<int>(360 + (ppp)*gmx::c_rad2Deg)) % 360) / 6)
x = INDEX(phi);
/* must correspond with enum in pp2shift.h:38 */
char* leg[edMax];
-#define NLEG asize(leg)
leg[0] = gmx_strdup("Phi");
leg[1] = gmx_strdup("Psi");
if (timecheck == 0)
{
-#define DONTSKIP(cnt) (skip) ? (((cnt) % skip) == 0) : TRUE
-
if (bCont)
{
fprintf(stderr, "\rRead frame: %d, Time: %.3f", teller, fr->t);
gmx_output_env_t* oenv;
gmx_rmpbc_t gpbc = nullptr;
-#define NLEG asize(leg)
t_filenm fnm[] = { { efTRX, "-f", nullptr, ffREAD },
{ efTPS, nullptr, nullptr, ffOPTRD },
{ efNDX, nullptr, nullptr, ffOPTRD },
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
static gmx_bool bDebug = FALSE;
-#define HB_NO 0
-#define HB_YES 1 << 0
-#define HB_INS 1 << 1
-#define HB_YESINS (HB_YES | HB_INS)
#define HB_NR (1 << 2)
#define MAXHYDRO 4
#define ISHB(h) ((h)&2)
#define ISDIST(h) ((h)&1)
-#define ISDIST2(h) ((h)&4)
-#define ISACC(h) ((h)&c_acceptorMask)
#define ISDON(h) ((h)&c_donorMask)
#define ISINGRP(h) ((h)&c_inGroupMask)
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
- * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020,2021, 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.
evMON,
evNr
};
-#define oldMAGIC 666
#define MAGIC 670
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2012,2013,2014,2015,2016 by the GROMACS development team.
- * Copyright (c) 2017,2018,2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2017,2018,2019,2020,2021, 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.
gmx_neutron_atomic_structurefactors_t* gnsf;
gmx_sans_t* gsans;
-#define NPA asize(pa)
-
t_pargs pa[] = {
{ "-bin", FALSE, etREAL, { &binwidth }, "[HIDDEN]Binwidth (nm)" },
{ "-mode", FALSE, etENUM, { emode }, "Mode for sans spectra calculation" },
real** tc;
gmx_output_env_t* oenv;
-#define NHISTO 360
-
t_filenm fnm[] = { { efTRN, "-f", nullptr, ffREAD }, { efTPS, nullptr, nullptr, ffOPTRD },
{ efNDX, nullptr, nullptr, ffOPTRD }, { efXVG, "-ot", "transcur", ffOPTWR },
{ efXVG, "-oa", "tcaf_all", ffWRITE }, { efXVG, "-o", "tcaf", ffWRITE },
real* normm = nullptr;
gmx_output_env_t* oenv;
-#define NHISTO 360
-
t_filenm fnm[] = { { efTRN, "-f", nullptr, ffREAD },
{ efTPS, nullptr, nullptr, ffOPTRD },
{ efNDX, nullptr, nullptr, ffOPTRD },
fprintf(fplog,
"Using two step summing over %d groups of on average %.1f ranks\n\n",
ng,
- (real)n / (real)ng);
+ real(n) / real(ng));
}
if (nc->rank_intra > 0)
{
acm[m] -= a0[m] / tm;
}
-#define PVEC(str, v) \
- fprintf(log, "%s[X]: %10.5e %s[Y]: %10.5e %s[Z]: %10.5e\n", str, (v)[0], str, (v)[1], str, (v)[2])
-#ifdef DEBUG
- PVEC("xcm", xcm);
- PVEC("acm", acm);
- PVEC("vcm", vcm);
-#endif
-
clear_mat(L);
for (i = 0; (i < natoms); i++)
{
L[YY][ZZ] += dx[YY] * dx[ZZ] * m0;
L[ZZ][ZZ] += dx[ZZ] * dx[ZZ] * m0;
}
-#ifdef DEBUG
- PVEC("L-x", L[XX]);
- PVEC("L-y", L[YY]);
- PVEC("L-z", L[ZZ]);
-#endif
return tm;
}
}
}
-#define safe_strdup(str) (((str) != NULL) ? gmx_strdup(str) : NULL)
-
static bool contains_char(const BondedInteraction& s, char c)
{
}
mergeAtomAndBondModifications(s, d);
}
-
-#undef safe_strdup
#include "gromacs/utility/stringutil.h"
#include "gromacs/utility/textwriter.h"
-#define MAXPTR 254
#define NOGID 255
using gmx::BasicVector;
* But since this is much larger than STRLEN, such a line can not be parsed.
* The real maximum is the number of names that fit in a string: STRLEN/2.
*/
-#define EGP_MAX (STRLEN / 2)
int j, k, nr;
bool bSet;
return converter.valueFrom(keyw);
}
-#define FATAL() gmx_fatal(FARGS, "Reading Termini Database: not enough items on line\n%s", line)
-
static void read_atom(char* line, bool bAdd, std::string* nname, t_atom* a, PreprocessingAtomTypes* atype, int* cgnr)
{
int nr, i;
#include "hackblock.h"
-#define MARGIN_FAC 1.1
-
static bool is_bond(int nnm, t_nm2type nmt[], char* ai, char* aj, real blen)
{
int i, j;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2020, by the GROMACS development team, led by
+ * Copyright (c) 2020,2021, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
#include "gromacs/utility/gmxassert.h"
#include "gromacs/utility/stringutil.h"
+#ifndef DOXYGEN
+
/*! \brief Copies of values from cl_driver_diagnostics_intel.h,
* which isn't guaranteed to be available. */
/**@{*/
-#define CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL 0x4106
-#define CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL 0x1
-#define CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL 0x2
-#define CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL 0x4
+# define CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL 0x4106
+# define CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL 0x1
+# define CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL 0x2
+# define CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL 0x4
/**@}*/
-#ifndef DOXYGEN
-
DeviceContext::DeviceContext(const DeviceInformation& deviceInfo) : deviceInfo_(deviceInfo)
{
cl_platform_id platformId = deviceInfo.oclPlatformId;
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/utility/gmxassert.h"
-#define XXXX 0
-#define XXYY 1
-#define XXZZ 2
-#define YYXX 3
-#define YYYY 4
-#define YYZZ 5
-#define ZZXX 6
-#define ZZYY 7
-#define ZZZZ 8
-
static void upd_vir(rvec vir, real dvx, real dvy, real dvz)
{
vir[XX] -= 0.5 * dvx;
/* for n=3, w0 = w2 = 1/(2-2^-(1/3)), w1 = 1-2*w0 */
/* for n=5, w0 = w1 = w3 = w4 = 1/(4-4^-(1/3)), w1 = 1-4*w0 */
-#define MAX_SUZUKI_YOSHIDA_NUM 5
#define SUZUKI_YOSHIDA_NUM 5
static const double sy_const_1[] = { 1. };
nbnxn_atomdata_copy_shiftvec(stepWork.haveDynamicBox, fr->shift_vec, nbv->nbat.get());
const bool pmeSendCoordinatesFromGpu =
- GMX_MPI && simulationWork.useGpuPmePpCommunication && !(stepWork.doNeighborSearch);
+ simulationWork.useGpuPmePpCommunication && !(stepWork.doNeighborSearch);
const bool reinitGpuPmePpComms =
- GMX_MPI && simulationWork.useGpuPmePpCommunication && (stepWork.doNeighborSearch);
+ simulationWork.useGpuPmePpCommunication && (stepWork.doNeighborSearch);
auto* localXReadyOnDevice = (stepWork.haveGpuPmeOnThisRank || simulationWork.useGpuBufferOps)
? stateGpu->getCoordinatesReadyOnDeviceEvent(
}
}
- if (GMX_MPI && !thisRankHasDuty(cr, DUTY_PME) && stepWork.computeSlowForces)
+ if (!thisRankHasDuty(cr, DUTY_PME) && stepWork.computeSlowForces)
{
/* Send particle coordinates to the pme nodes */
if (!pmeSendCoordinatesFromGpu && !stepWork.doNeighborSearch && simulationWork.useGpuUpdate)
{
DevelopmentFeatureFlags devFlags;
- // Some builds of GCC 5 give false positive warnings that these
- // getenv results are ignored when clearly they are used.
-#pragma GCC diagnostic push
-#pragma GCC diagnostic ignored "-Wunused-result"
-
devFlags.enableGpuBufferOps =
GMX_GPU_CUDA && useGpuForNonbonded && (getenv("GMX_USE_GPU_BUFFER_OPS") != nullptr);
- devFlags.enableGpuHaloExchange = GMX_GPU_CUDA && getenv("GMX_GPU_DD_COMMS") != nullptr;
+ devFlags.enableGpuHaloExchange = GMX_MPI && GMX_GPU_CUDA && getenv("GMX_GPU_DD_COMMS") != nullptr;
devFlags.forceGpuUpdateDefault = (getenv("GMX_FORCE_UPDATE_DEFAULT_GPU") != nullptr) || GMX_FAHCORE;
- devFlags.enableGpuPmePPComm = GMX_GPU_CUDA && getenv("GMX_GPU_PME_PP_COMMS") != nullptr;
-
-#pragma GCC diagnostic pop
+ devFlags.enableGpuPmePPComm = GMX_MPI && GMX_GPU_CUDA && getenv("GMX_GPU_PME_PP_COMMS") != nullptr;
// Direct GPU comm path is being used with CUDA_AWARE_MPI
// make sure underlying MPI implementation is CUDA-aware
int numColumnsMax,
bool mustInsertNonLocalDependency)
{
- GMX_ASSERT((bool)GMX_GPU_CUDA || (bool)GMX_GPU_SYCL,
+ GMX_ASSERT(bool(GMX_GPU_CUDA) || bool(GMX_GPU_SYCL),
"NBNXM X buffer operations only supported in CUDA and SYCL");
GMX_ASSERT(nb, "Need a valid nbnxn_gpu object");
gmx::InteractionLocality interactionLoc = gmx::atomToInteractionLocality(locality);
namespace Nbnxm
{
-/*! \brief Copies of values from cl_driver_diagnostics_intel.h,
- * which isn't guaranteed to be available. */
-/**@{*/
-#define CL_CONTEXT_SHOW_DIAGNOSTICS_INTEL 0x4106
-#define CL_CONTEXT_DIAGNOSTICS_LEVEL_GOOD_INTEL 0x1
-#define CL_CONTEXT_DIAGNOSTICS_LEVEL_BAD_INTEL 0x2
-#define CL_CONTEXT_DIAGNOSTICS_LEVEL_NEUTRAL_INTEL 0x4
-/**@}*/
-
/*! \brief This parameter should be determined heuristically from the
* kernel execution times
*
#include "nbnxm_ocl_types.h"
-/*! \brief Stringifies the input argument
- */
-#define STRINGIFY_PARAM(c) #c
-
-/*! \brief Stringifies the result of expansion of a macro argument
- */
-#define STRINGIFY_MACRO(c) STRINGIFY_PARAM(c)
-
/*! \brief Array of the defines needed to generate a specific eel flavour
*
* The twin-cutoff entries are not normally used, because those setups are
for (i = 0; i < simdWidth * 4; i++)
{
- EXPECT_EQ(src[i], (T)(1 + i)) << "Side effect on source memory, i = " << i;
+ EXPECT_EQ(src[i], T(1 + i)) << "Side effect on source memory, i = " << i;
if (dst + i < pCopyDst || dst + i >= pCopyDst + simdWidth)
{
- EXPECT_EQ(dst[i], (T)(-1 - i)) << "Side effect on destination memory, i = " << i;
+ EXPECT_EQ(dst[i], T(-1 - i)) << "Side effect on destination memory, i = " << i;
}
}
}
for (int i = endIndex - 1; i >= 0; i--)
{
- double x = i * spacing;
- double tmpFunctionValue;
- double tmpDerivativeValue;
- double nextHigherFunction;
- double nextHigherDerivative;
+ double x = i * spacing;
+ double tmpFunctionValue = 0;
+ double tmpDerivativeValue = 0;
+ double nextHigherFunction = 0;
+ double nextHigherDerivative = 0;
double Y, F, G, H;
if (range.first > 0 && i == 0)
for (int i = endIndex - 1; i >= 0; i--)
{
- double x = i * spacing;
- double tmpFunctionValue;
- double tmpDerivativeValue;
+ double x = i * spacing;
+ double tmpFunctionValue = 0;
+ double tmpDerivativeValue = 0;
if (range.first > 0 && i == 0)
{
set_target_properties(${NAME} PROPERTIES CXX_CLANG_TIDY
"${CLANG_TIDY_EXE};-warnings-as-errors=*;-header-filter=.*")
endif()
- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7")
- target_compile_options(${NAME} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Weverything ${IGNORED_CLANG_ALL_WARNINGS} -Wno-gnu-zero-variadic-macro-arguments -Wno-zero-as-null-pointer-constant -Wno-missing-variable-declarations>)
+ gmx_warn_on_everything(${NAME})
+ if (HAS_WARNING_EVERYTHING)
+ # Some false positives exist produced by GoogleTest implementation
+ gmx_target_warning_suppression(${NAME} "-Wno-zero-as-null-pointer-constant" HAS_WARNING_NO_ZERO_AS_NULL_POINTER_CONSTANT)
+ gmx_target_warning_suppression(${NAME} "-Wno-gnu-zero-variadic-macro-arguments" HAS_WARNING_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
endif()
-
endif()
endfunction ()
set_target_properties(${EXENAME} PROPERTIES CXX_CLANG_TIDY
"${CLANG_TIDY_EXE};-warnings-as-errors=*;-header-filter=.*")
endif()
- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "7")
- target_compile_options(${EXENAME} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Weverything ${IGNORED_CLANG_ALL_WARNINGS} -Wno-gnu-zero-variadic-macro-arguments -Wno-zero-as-null-pointer-constant -Wno-missing-variable-declarations>)
- endif()
- # clang-3.6 warns about a number of issues that are not reported by more modern compilers
- # and we know they are not real issues. So we only check that it can compile without error
- # but ignore all warnings.
- if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION MATCHES "^3\.6")
- target_compile_options(${EXENAME} PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-w>)
+ gmx_warn_on_everything(${EXENAME})
+ if (HAS_WARNING_EVERYTHING)
+ # Some false positives exist produced by GoogleTest implementation
+ gmx_target_warning_suppression(${EXENAME} "-Wno-zero-as-null-pointer-constant" HAS_WARNING_NO_ZERO_AS_NULL_POINTER_CONSTANT)
+ gmx_target_warning_suppression(${EXENAME} "-Wno-gnu-zero-variadic-macro-arguments" HAS_WARNING_NO_GNU_ZERO_VARIADIC_MACRO_ARGUMENTS)
endif()
endif()
endfunction()
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2010-2017, The GROMACS development team.
- * Copyright (c) 2019,2020, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020,2021, 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.
#ifndef TEST_DATA_PATH
//! Path to test input data directory (needs to be set by the build system).
-# define TEST_DATA_PATH 0
+# define TEST_DATA_PATH nullptr
#endif
#ifndef TEST_TEMP_PATH
//! Path to test output temporary directory (needs to be set by the build system).
-# define TEST_TEMP_PATH 0
+# define TEST_TEMP_PATH nullptr
#endif
#ifndef TEST_USES_MPI