Many useful clang warnings are not enabled with -Wall -Wextra.
Enable all with -Weverything and document which are disabled
for what reason. Only do this for the most recent released
version to avoid having false postives from multiple
versions.
Fix the 9 of the least common issued warnings:
class-varargs range-loop-analysis
unused-template implicit-fallthrough non-virtual-dtor
zero-as-null-pointer-constant
header-hygiene unused-member-function missing-noreturn
Change-Id: I70df6553aa715cbd99963dd66d4b4bbd55ffc64d
#
# This file is part of the GROMACS molecular simulation package.
#
-# Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+# Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
# Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
# and including many others, as listed in the AUTHORS file in the
# top-level source directory and at http://www.gromacs.org.
if(NOT GMX_OPENMP)
GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)
endif()
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "7.0.0")
+ GMX_TEST_CXXFLAG(CXXFLAGS_ATTRIBUTE "-Wno-attributes" GMXC_CXXFLAGS)
+ endif()
if (GMX_COMPILER_WARNINGS)
GMX_TEST_CXXFLAG(CXXFLAGS_WARN "-Wall" GMXC_CXXFLAGS)
# Problematic with CUDA
if(NOT GMX_OPENMP)
GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-wd3180" GMXC_CXXFLAGS)
endif()
+ GMX_TEST_CXXFLAG(CXXFLAGS_ATTRIBUTE "-Wno-attributes" GMXC_CXXFLAGS)
if (GMX_COMPILER_WARNINGS)
if (GMX_GPU)
# Suppress warnings from CUDA headers
# unreferenced local variable (only C)
# conversion from 'size_t' to 'int', possible loss of data
# conversion from 'const char*' to 'void*', different 'const' qualifiers (only C)
+ # attributes are ignored in this context
+ # attribute '' is not recognized
if(NOT CMAKE_CONFIGURATION_TYPES)
GMX_TEST_CFLAG(CFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4101 /wd4267 /wd4090" GMXC_CFLAGS)
- GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4267" GMXC_CXXFLAGS)
+ GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4267 /wd5030 /wd4649" GMXC_CXXFLAGS)
else() #Projects only use the C++ flags
- GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4101 /wd4267 /wd4090" GMXC_CXXFLAGS)
+ GMX_TEST_CXXFLAG(CXXFLAGS_WARN "/wd4800 /wd4355 /wd4996 /wd4305 /wd4244 /wd4101 /wd4267 /wd4090 /wd5030 /wd4649" GMXC_CXXFLAGS)
endif()
endif()
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS "3.9.0")
+ GMX_TEST_CXXFLAG(CXXFLAGS_ATTRIBUTE "-Wno-attributes" GMXC_CXXFLAGS)
+ endif()
if(NOT GMX_OPENMP)
GMX_TEST_CXXFLAG(CXXFLAGS_PRAGMA "-Wno-unknown-pragmas" GMXC_CXXFLAGS)
endif()
gmx_manage_lmfit()
target_link_libraries(libgromacs PRIVATE lmfit)
+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
+ #Following ones are undecided/TODO
+ "-Wno-missing-field-initializers"
+ "-Wno-sign-conversion"
+ "-Wno-disabled-macro-expansion"
+ "-Wno-cast-align"
+ "-Wno-undefined-reinterpret-cast"
+ "-Wno-covered-switch-default"
+ "-Wno-reserved-id-macro"
+ "-Wno-global-constructors"
+ "-Wno-unreachable-code"
+ "-Wno-comma"
+ "-Wno-unreachable-code-return"
+ "-Wno-exit-time-destructors"
+ "-Wno-unused-macros"
+ "-Wno-weak-vtables"
+ "-Wno-extra-semi"
+ "-Wno-switch-enum"
+ "-Wno-shadow-field-in-constructor"
+ "-Wno-unreachable-code-break"
+ "-Wno-conditional-uninitialized"
+ "-Wno-missing-variable-declarations"
+ "-Wno-float-conversion"
+ "-Wno-format-nonliteral"
+ "-Wno-shadow"
+ "-Wno-cast-qual"
+ "-Wno-shorten-64-to-32"
+ "-Wno-documentation"
+ "-Wno-used-but-marked-unused"
+ "-Wno-padded"
+ "-Wno-float-equal"
+ "-Wno-old-style-cast"
+ "-Wno-conversion"
+ "-Wno-double-promotion")
+string(REPLACE " " ";" IGNORED_CLANG_ALL_WARNINGS "${IGNORED_CLANG_ALL_WARNINGS}")
+if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND CMAKE_CXX_COMPILER_VERSION MATCHES "^6\.0")
+ target_compile_options(libgromacs PRIVATE $<$<COMPILE_LANGUAGE:CXX>:-Weverything ${IGNORED_CLANG_ALL_WARNINGS}>)
+endif()
if (GMX_CLANG_TIDY)
set(CLANG_TIDY "clang-tidy" CACHE STRING "Name of clang-tidy executable")
find_program(CLANG_TIDY_EXE NAMES "${CLANG_TIDY}"
}
}
- /*! \brief Initiate the field values
- *
- * \param[in] a Amplitude
- * \param[in] omega Frequency
- * \param[in] t0 Peak of the pulse
- * \param[in] sigma Width of the pulse
- */
- void setField(real a, real omega, real t0, real sigma)
- {
- a_ = a;
- omega_ = omega;
- t0_ = t0;
- sigma_ = sigma;
- }
-
//! Return the amplitude
real a() const { return a_; }
- //! Return the frequency
- real omega() const { return omega_; }
- //! Return the time for the peak of the pulse
- real t0() const { return t0_; }
- //! Return the width of the pulse (0 means inifinite)
- real sigma() const { return sigma_; }
private:
//! Coeffient (V / nm)
*/
real field(int dim, real t) const;
- /*! \brief Return amplitude of field
- *
- * \param[in] dim Direction of the field (XX, YY, ZZ)
- * \return Amplitude of the field
- */
- real a(int dim) const { return efield_[dim].a(); }
- /*! \brief Return frequency of field (1/ps)
- *
- * \param[in] dim Direction of the field (XX, YY, ZZ)
- * \return Frequency of the field
- */
- real omega(int dim) const { return efield_[dim].omega(); }
- /*! \brief Return time of pulse peak
- *
- * \param[in] dim Direction of the field (XX, YY, ZZ)
- * \return Time of pulse peak
- */
- real t0(int dim) const { return efield_[dim].t0(); }
- /*! \brief Return width of the pulse
- *
- * \param[in] dim Direction of the field (XX, YY, ZZ)
- * \return Width of the pulse
- */
- real sigma(int dim) const { return efield_[dim].sigma(); }
-
/*! \brief Print the field components to a file
*
* \param[in] t The time
comm = dd->comm;
- const RangePartitioning &atomGrouping = dd->atomGrouping();
+ const gmx::RangePartitioning &atomGrouping = dd->atomGrouping();
nzone = 1;
nat_tot = comm->atomRanges.numHomeAtoms();
comm = dd->comm;
- const RangePartitioning &atomGrouping = dd->atomGrouping();
+ const gmx::RangePartitioning &atomGrouping = dd->atomGrouping();
nzone = comm->zones.n/2;
nat_tot = comm->atomRanges.end(DDAtomRanges::Type::Zones);
comm = dd->comm;
- const RangePartitioning &atomGrouping = dd->atomGrouping();
+ const gmx::RangePartitioning &atomGrouping = dd->atomGrouping();
nzone = 1;
nat_tot = comm->atomRanges.numHomeAtoms();
comm->bInterCGMultiBody = FALSE;
}
- dd->bInterCGcons = inter_charge_group_constraints(*mtop);
- dd->bInterCGsettles = inter_charge_group_settles(*mtop);
+ dd->bInterCGcons = gmx::inter_charge_group_constraints(*mtop);
+ dd->bInterCGsettles = gmx::inter_charge_group_settles(*mtop);
if (ir->rlist == 0)
{
if (dd->bInterCGcons && options.constraintCommunicationRange <= 0)
{
/* There is a cell size limit due to the constraints (P-LINCS) */
- rconstr = constr_r_max(fplog, mtop, ir);
+ rconstr = gmx::constr_r_max(fplog, mtop, ir);
if (fplog)
{
fprintf(fplog,
}
}
-static void make_cell2at_index(gmx_domdec_comm_dim_t *cd,
- int nzone,
- int atomGroupStart,
- const RangePartitioning &atomGroups)
+static void make_cell2at_index(gmx_domdec_comm_dim_t *cd,
+ int nzone,
+ int atomGroupStart,
+ const gmx::RangePartitioning &atomGroups)
{
/* Store the atom block boundaries for easy copying of communication buffers
*/
/* In domdec_top.c */
/*! \brief Print error output when interactions are missing */
+[[ noreturn ]]
void dd_print_missing_interactions(FILE *fplog, struct t_commrec *cr,
int local_count,
const gmx_mtop_t *top_global,
comm->cell_x0[dim], comm->cell_x1[dim]);
}
+[[ noreturn ]]
static void cg_move_error(FILE *fplog,
gmx_domdec_t *dd,
gmx_int64_t step, int cg, int dim, int dir,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
* This code does not assume any memory alignment for the grid.
*/
{
+ using namespace gmx;
Simd4Real ty_S0(thy[0]);
Simd4Real ty_S1(thy[1]);
Simd4Real ty_S2(thy[2]);
* This code supports pme_order <= 5.
*/
{
+ using namespace gmx;
int offset;
int index;
Simd4Real ty_S0(thy[0]);
#include "pme-simd.h"
-using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
-
struct pme_spline_work
{
#ifdef PME_SIMD4_SPREAD_GATHER
/* Masks for 4-wide SIMD aligned spreading and gathering */
- Simd4Bool mask_S0[6], mask_S1[6];
+ gmx::Simd4Bool mask_S0[6], mask_S1[6];
#else
- int dummy; /* C89 requires that struct has at least one member */
+ int dummy; /* C89 requires that struct has at least one member */
#endif
};
std::string message = gmx::formatString(
"pme_order (%d) is larger than the maximum allowed value (%d). Modify and recompile the code if you really need such a high order.",
pme_order, PME_ORDER_MAX);
- GMX_THROW(InconsistentInputError(message));
+ GMX_THROW(gmx::InconsistentInputError(message));
}
const int minGridSize = minimalPmeGridSize(pme_order);
std::string message = gmx::formatString(
"The PME grid sizes need to be >= 2*(pme_order-1) (%d)",
minGridSize);
- GMX_THROW(InconsistentInputError(message));
+ GMX_THROW(gmx::InconsistentInputError(message));
}
/* Check for a limitation of the (current) sum_fftgrid_dd code.
fprintf(debug, "Creating PME data structures.\n");
}
- unique_cptr<gmx_pme_t, gmx_pme_destroy> pme(new gmx_pme_t());
+ gmx::unique_cptr<gmx_pme_t, gmx_pme_destroy> pme(new gmx_pme_t());
pme->sum_qgrid_tmp = nullptr;
pme->sum_qgrid_dd_tmp = nullptr;
fprintf(fp, "\nWARNING: Checkpoint file is corrupted or truncated\n\n");
}
-static void cp_error()
+[[ noreturn ]] static void cp_error()
{
gmx_fatal(FARGS, "Checkpoint file corrupted/truncated, or maybe you are out of disk space?");
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
/* output a data type error. */
+[[ noreturn ]]
static void gmx_fio_fe(t_fileio *fio, int eio, const char *desc,
const char *srcfile, int line)
{
copy_rvec(fr->f[ind[i]], fout[i]);
}
}
- // fallthrough
+ [[fallthrough]];
case efXTC:
if (fr->bX)
{
{
sfree(fout);
}
- // fallthrough
+ [[fallthrough]];
case efXTC:
sfree(xout);
break;
snew(fr, 1);
snew(native_lambda, 1);
- start_lambda.lc = nullptr;
+ start_lambda.lc = nullptr;
+ start_lambda.val = nullptr;
while (do_enx(fp, fr))
{
if (!lambda_vec_same(&start_lambda, native_lambda) )
{
gmx_fatal(FARGS, "Native lambda not constant in file %s: started at %f, and becomes %f at time %f",
- fn, native_lambda, start_lambda, start_time);
+ fn, native_lambda->val, start_lambda.val, start_time);
}
/* check the number of samples against the previous number */
if ( ((nblocks_raw+nblocks_hist) != nsamples) || (nlam != 1 ) )
/* Return the filename belonging to cmd-line option opt, or NULL when
* no such option or not running on master */
-void
+[[ noreturn ]] void
gmx_fatal_collective(int f_errno, const char *file, int line,
MPI_Comm comm, gmx_bool bMaster,
const char *fmt, ...);
virtual int run();
private:
- void loadSolute();
-
SelectionCollection selections_;
std::string inputConfFile_;
*/
GPU_FUNC_QUALIFIER
gmx_device_info_t *getDeviceInfo(const gmx_gpu_info_t &GPU_FUNC_ARGUMENT(gpu_info),
- int GPU_FUNC_ARGUMENT(deviceId)) GPU_FUNC_TERM_WITH_RETURN(NULL)
+ int GPU_FUNC_ARGUMENT(deviceId)) GPU_FUNC_TERM_WITH_RETURN(nullptr)
/*! \brief Returns the device ID of the CUDA GPU currently in use.
*
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
}
//! Convenience wrapper for gmx_bcast of a C-style array which needs allocation on non-master ranks.
template <typename T>
-static void nblock_abc(const t_commrec *cr, int numElements, T **v)
+void nblock_abc(const t_commrec *cr, int numElements, T **v)
{
snew_bc(cr, v, numElements);
nblock_bc(cr, numElements, *v);
}
//! Convenience wrapper for gmx_bcast of a std::vector which needs resizing on non-master ranks.
template <typename T>
-static void nblock_abc(const t_commrec *cr, int numElements, std::vector<T> *v)
+void nblock_abc(const t_commrec *cr, int numElements, std::vector<T> *v)
{
if (!MASTER(cr))
{
};
/*! \brief Generate a fatal error because of too many LINCS/SETTLE warnings. */
-void too_many_constraint_warnings(int eConstrAlg, int warncount);
+[[ noreturn ]] void too_many_constraint_warnings(int eConstrAlg, int warncount);
/*! \brief Returns whether constraint with parameter \p iparamsIndex is a flexible constraint */
static inline bool isConstraintFlexible(const t_iparams *iparams,
#include "gromacs/utility/arrayref.h"
#include "gromacs/utility/real.h"
-using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
-
struct gmx_domdec_zones_t;
std::vector<int> nsubc; /* The number of sub cells for each super cell */
/* Bounding boxes */
- std::vector<float> bbcz; /* Bounding boxes in z for the cells */
- std::vector < nbnxn_bb_t, AlignedAllocator < nbnxn_bb_t>> bb; /* 3D bounding boxes for the sub cells */
- std::vector < nbnxn_bb_t, AlignedAllocator < nbnxn_bb_t>> bbjStorage; /* 3D j-bounding boxes for the case where
- * the i- and j-cluster sizes are different */
- gmx::ArrayRef<nbnxn_bb_t> bbj; /* 3D j-bounding boxes */
- std::vector < float, AlignedAllocator < float>> pbb; /* 3D b. boxes in xxxx format per super cell */
+ std::vector<float> bbcz; /* Bounding boxes in z for the cells */
+ std::vector < nbnxn_bb_t, gmx::AlignedAllocator < nbnxn_bb_t>> bb; /* 3D bounding boxes for the sub cells */
+ std::vector < nbnxn_bb_t, gmx::AlignedAllocator < nbnxn_bb_t>> bbjStorage; /* 3D j-bounding boxes for the case where
+ * the i- and j-cluster sizes are different */
+ gmx::ArrayRef<nbnxn_bb_t> bbj; /* 3D j-bounding boxes */
+ std::vector < float, gmx::AlignedAllocator < float>> pbb; /* 3D b. boxes in xxxx format per super cell */
/* Bit-flag information */
std::vector<int> flags; /* Flags for properties of clusters in each cell */
/* The stride of all the atom data arrays is equal to half the SIMD width */
#define STRIDE UNROLLJ
-// TODO: Remove when all kernels are in the gmx namespace
-using namespace gmx;
-
#if !defined GMX_NBNXN_SIMD_2XNN && !defined GMX_NBNXN_SIMD_4XN
#error "Must define an NBNxN kernel flavour before including NBNxN kernel utility functions"
#endif
* a single SIMD register.
*/
static inline void
-add_ener_grp_halves(SimdReal e_S, real *v0, real *v1, const int *offset_jj)
+add_ener_grp_halves(gmx::SimdReal e_S, real *v0, real *v1, const int *offset_jj)
{
for (int jj = 0; jj < (UNROLLJ/2); jj++)
{
#endif
#if GMX_SIMD_HAVE_INT32_LOGICAL
-typedef SimdInt32 SimdBitMask;
+typedef gmx::SimdInt32 SimdBitMask;
#else
-typedef SimdReal SimdBitMask;
+typedef gmx::SimdReal SimdBitMask;
#endif
gmx_load_simd_2xnn_interactions(int excl,
SimdBitMask filter_S0,
SimdBitMask filter_S2,
- SimdBool *interact_S0,
- SimdBool *interact_S2)
+ gmx::SimdBool *interact_S0,
+ gmx::SimdBool *interact_S2)
{
+ using namespace gmx;
#if GMX_SIMD_HAVE_INT32_LOGICAL
SimdInt32 mask_pr_S(excl);
*interact_S0 = cvtIB2B( testBits( mask_pr_S & filter_S0 ) );
{
+ using namespace gmx;
const nbnxn_ci_t *nbln;
const nbnxn_cj_t *l_cj;
const real *q;
#elif !defined LJ_COMB_LB && !defined FIX_LJ_C
const real *nbfp0 = nbfp_ptr + type[sci ]*nbat->ntype*c_simdBestPairAlignment;
const real *nbfp1 = nbfp_ptr + type[sci+1]*nbat->ntype*c_simdBestPairAlignment;
- const real *nbfp2 = NULL, *nbfp3 = NULL;
+ const real *nbfp2 = nullptr, *nbfp3 = nullptr;
if (!half_LJ)
{
nbfp2 = nbfp_ptr + type[sci+2]*nbat->ntype*c_simdBestPairAlignment;
real rlistInner)
{
#ifdef GMX_NBNXN_SIMD_2XNN
+ using namespace gmx;
const nbnxn_ci_t * gmx_restrict ciOuter = nbl->ciOuter;
nbnxn_ci_t * gmx_restrict ciInner = nbl->ci;
#define STRIDE (UNROLLI)
#endif
-// TODO: Remove when all kernels are in the gmx namespace
-using namespace gmx;
#if !defined GMX_NBNXN_SIMD_2XNN && !defined GMX_NBNXN_SIMD_4XN
#error "Must define an NBNxN kernel flavour before including NBNxN kernel utility functions"
#ifdef UNROLLJ
/* Add energy register to possibly multiple terms in the energy array */
-static inline void add_ener_grp(SimdReal e_S, real *v, const int *offset_jj)
+static inline void add_ener_grp(gmx::SimdReal e_S, real *v, const int *offset_jj)
{
+ using namespace gmx;
int jj;
/* We need to balance the number of store operations with
#endif
#if GMX_SIMD_HAVE_INT32_LOGICAL
-typedef SimdInt32 SimdBitMask;
+typedef gmx::SimdInt32 SimdBitMask;
#else
-typedef SimdReal SimdBitMask;
+typedef gmx::SimdReal SimdBitMask;
#endif
static inline void gmx_simdcall
SimdBitMask gmx_unused filter_S2,
SimdBitMask gmx_unused filter_S3,
real gmx_unused *simd_interaction_array,
- SimdBool *interact_S0,
- SimdBool *interact_S1,
- SimdBool *interact_S2,
- SimdBool *interact_S3)
+ gmx::SimdBool *interact_S0,
+ gmx::SimdBool *interact_S1,
+ gmx::SimdBool *interact_S2,
+ gmx::SimdBool *interact_S3)
{
+ using namespace gmx;
#if GMX_SIMD_HAVE_INT32_LOGICAL
/* Load integer interaction mask */
SimdInt32 mask_pr_S(excl);
{
+ using namespace gmx;
const nbnxn_ci_t *nbln;
const nbnxn_cj_t *l_cj;
const real * q;
real rlistInner)
{
#ifdef GMX_NBNXN_SIMD_4XN
+ using namespace gmx;
const nbnxn_ci_t * gmx_restrict ciOuter = nbl->ciOuter;
nbnxn_ci_t * gmx_restrict ciInner = nbl->ci;
Gpu8x8x8 // i-cluster size 8, j-cluster size 8 + super-clustering
};
+#if GMX_SIMD
/* Returns the j-cluster size */
template <NbnxnLayout layout>
static constexpr int jClusterSize()
{
-#if GMX_SIMD
static_assert(layout == NbnxnLayout::NoSimd4x4 || layout == NbnxnLayout::Simd4xN || layout == NbnxnLayout::Simd2xNN, "Currently jClusterSize only supports CPU layouts");
return layout == NbnxnLayout::Simd4xN ? GMX_SIMD_REAL_WIDTH : (layout == NbnxnLayout::Simd2xNN ? GMX_SIMD_REAL_WIDTH/2 : NBNXN_CPU_CLUSTER_I_SIZE);
-#else
- static_assert(layout == NbnxnLayout::NoSimd4x4, "Currently without SIMD, jClusterSize only supports NoSimd4x4");
-
- return NBNXN_CPU_CLUSTER_I_SIZE;
-#endif
}
/* Returns the j-cluster index given the i-cluster index */
return cj*STRIDE_P8;
}
}
+#endif //GMX_SIMD
gmx_bool nbnxn_kernel_pairlist_simple(int nb_kernel_type)
{
* the research papers on the package. Check out http://www.gromacs.org.
*/
-using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
-
#if GMX_SIMD_REAL_WIDTH >= 2*NBNXN_CPU_CLUSTER_I_SIZE
#define STRIDE_S (GMX_SIMD_REAL_WIDTH/2)
#else
float rbb2,
int * gmx_restrict numDistanceChecks)
{
+ using namespace gmx;
const real * gmx_restrict x_ci_simd = nbl->work->x_ci_simd;
const nbnxn_bb_t * gmx_restrict bb_ci = nbl->work->bb_ci;
* the research papers on the package. Check out http://www.gromacs.org.
*/
-using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
-
#if GMX_SIMD_REAL_WIDTH >= NBNXN_CPU_CLUSTER_I_SIZE
#define STRIDE_S (GMX_SIMD_REAL_WIDTH)
#else
float rbb2,
int * gmx_restrict numDistanceChecks)
{
+ using namespace gmx;
const real * gmx_restrict x_ci_simd = nbl->work->x_ci_simd;
const nbnxn_bb_t * gmx_restrict bb_ci = nbl->work->bb_ci;
return (QMener);
}
+#if !(GMX_QMMM_MOPAC || GMX_QMMM_GAMESS || GMX_QMMM_GAUSSIAN || GMX_QMMM_ORCA)
+[[ noreturn ]]
+#endif
static void init_QMroutine(const t_commrec gmx_unused *cr, t_QMrec gmx_unused *qm, t_MMrec gmx_unused *mm)
{
/* makes a call to the requested QM routine (qm->QMmethod)
}
}
-static void pme_gpu_reduce_outputs(gmx_wallcycle_t wcycle,
- ForceWithVirial *forceWithVirial,
- ArrayRef<const gmx::RVec> pmeForces,
- gmx_enerdata_t *enerd,
- const tensor vir_Q,
- real Vlr_q)
+static void pme_gpu_reduce_outputs(gmx_wallcycle_t wcycle,
+ gmx::ForceWithVirial *forceWithVirial,
+ gmx::ArrayRef<const gmx::RVec> pmeForces,
+ gmx_enerdata_t *enerd,
+ const tensor vir_Q,
+ real Vlr_q)
{
wallcycle_start(wcycle, ewcPME_GPU_F_REDUCTION);
GMX_ASSERT(forceWithVirial, "Invalid force pointer");
static void pull_potential_wrapper(const t_commrec *cr,
const t_inputrec *ir,
- matrix box, ArrayRef<const RVec> x,
- ForceWithVirial *force,
+ matrix box, gmx::ArrayRef<const gmx::RVec> x,
+ gmx::ForceWithVirial *force,
const t_mdatoms *mdatoms,
gmx_enerdata_t *enerd,
real *lambda,
wallcycle_stop(wcycle, ewcPULLPOT);
}
-static void pme_receive_force_ener(const t_commrec *cr,
- ForceWithVirial *forceWithVirial,
- gmx_enerdata_t *enerd,
- gmx_wallcycle_t wcycle)
+static void pme_receive_force_ener(const t_commrec *cr,
+ gmx::ForceWithVirial *forceWithVirial,
+ gmx_enerdata_t *enerd,
+ gmx_wallcycle_t wcycle)
{
real e_q, e_lj, dvdl_q, dvdl_lj;
float cycles_ppdpme, cycles_seppme;
}
}
-static void post_process_forces(const t_commrec *cr,
- gmx_int64_t step,
- t_nrnb *nrnb,
- gmx_wallcycle_t wcycle,
- const gmx_localtop_t *top,
- matrix box,
- rvec x[],
- rvec f[],
- ForceWithVirial *forceWithVirial,
- tensor vir_force,
- const t_mdatoms *mdatoms,
- t_graph *graph,
- t_forcerec *fr,
- const gmx_vsite_t *vsite,
- int flags)
+static void post_process_forces(const t_commrec *cr,
+ gmx_int64_t step,
+ t_nrnb *nrnb,
+ gmx_wallcycle_t wcycle,
+ const gmx_localtop_t *top,
+ matrix box,
+ rvec x[],
+ rvec f[],
+ gmx::ForceWithVirial *forceWithVirial,
+ tensor vir_force,
+ const t_mdatoms *mdatoms,
+ t_graph *graph,
+ t_forcerec *fr,
+ const gmx_vsite_t *vsite,
+ int flags)
{
if (fr->haveDirectVirialContributions)
{
* \todo Convert all other algorithms called here to ForceProviders.
*/
static void
-computeSpecialForces(FILE *fplog,
- const t_commrec *cr,
- const t_inputrec *inputrec,
- gmx::Awh *awh,
- gmx_int64_t step,
- double t,
- gmx_wallcycle_t wcycle,
- ForceProviders *forceProviders,
- matrix box,
- ArrayRef<const RVec> x,
- const t_mdatoms *mdatoms,
- real *lambda,
- int forceFlags,
- ForceWithVirial *forceWithVirial,
- gmx_enerdata_t *enerd,
- const gmx_edsam *ed,
- gmx_bool bNS)
+computeSpecialForces(FILE *fplog,
+ const t_commrec *cr,
+ const t_inputrec *inputrec,
+ gmx::Awh *awh,
+ gmx_int64_t step,
+ double t,
+ gmx_wallcycle_t wcycle,
+ ForceProviders *forceProviders,
+ matrix box,
+ gmx::ArrayRef<const gmx::RVec> x,
+ const t_mdatoms *mdatoms,
+ real *lambda,
+ int forceFlags,
+ gmx::ForceWithVirial *forceWithVirial,
+ gmx_enerdata_t *enerd,
+ const gmx_edsam *ed,
+ gmx_bool bNS)
{
const bool computeForces = (forceFlags & GMX_FORCE_FORCES);
*/
if (computeForces)
{
- ForceProviderInput forceProviderInput(x, *mdatoms, t, box, *cr);
- ForceProviderOutput forceProviderOutput(forceWithVirial, enerd);
+ gmx::ForceProviderInput forceProviderInput(x, *mdatoms, t, box, *cr);
+ gmx::ForceProviderOutput forceProviderOutput(forceWithVirial, enerd);
/* Collect forces from modules */
forceProviders->calculateForces(forceProviderInput, &forceProviderOutput);
* \param[in] flags Force flags
* \param[in] wcycle The wallcycle structure
*/
-static void alternatePmeNbGpuWaitReduce(nonbonded_verlet_t *nbv,
- const gmx_pme_t *pmedata,
- gmx::PaddedArrayRef<gmx::RVec> *force,
- ForceWithVirial *forceWithVirial,
- rvec fshift[],
- gmx_enerdata_t *enerd,
- int flags,
- gmx_wallcycle_t wcycle)
+static void alternatePmeNbGpuWaitReduce(nonbonded_verlet_t *nbv,
+ const gmx_pme_t *pmedata,
+ gmx::PaddedArrayRef<gmx::RVec> *force,
+ gmx::ForceWithVirial *forceWithVirial,
+ rvec fshift[],
+ gmx_enerdata_t *enerd,
+ int flags,
+ gmx_wallcycle_t wcycle)
{
bool isPmeGpuDone = false;
bool isNbGpuDone = false;
}
/* forceWithVirial uses the local atom range only */
- ForceWithVirial forceWithVirial(forceRef, flags & GMX_FORCE_VIRIAL);
+ gmx::ForceWithVirial forceWithVirial(forceRef, flags & GMX_FORCE_VIRIAL);
if (inputrec->bPull && pull_have_constraint(inputrec->pull_work))
{
}
/* forceWithVirial might need the full force atom range */
- ForceWithVirial forceWithVirial(forceRef, flags & GMX_FORCE_VIRIAL);
+ gmx::ForceWithVirial forceWithVirial(forceRef, flags & GMX_FORCE_VIRIAL);
if (inputrec->bPull && pull_have_constraint(inputrec->pull_work))
{
}
-void do_constrain_first(FILE *fplog, Constraints *constr,
+void do_constrain_first(FILE *fplog, gmx::Constraints *constr,
t_inputrec *ir, t_mdatoms *md,
t_state *state)
{
as_rvec_array(state->x.data()), as_rvec_array(state->x.data()), nullptr,
state->box,
state->lambda[efptBONDED], &dvdl_dum,
- nullptr, nullptr, ConstraintVariable::Positions);
+ nullptr, nullptr, gmx::ConstraintVariable::Positions);
if (EI_VV(ir->eI))
{
/* constrain the inital velocity, and save it */
as_rvec_array(state->x.data()), as_rvec_array(state->v.data()), as_rvec_array(state->v.data()),
state->box,
state->lambda[efptBONDED], &dvdl_dum,
- nullptr, nullptr, ConstraintVariable::Velocities);
+ nullptr, nullptr, gmx::ConstraintVariable::Velocities);
}
/* constrain the inital velocities at t-dt/2 */
if (EI_STATE_VELOCITY(ir->eI) && ir->eI != eiVV)
as_rvec_array(state->x.data()), savex, nullptr,
state->box,
state->lambda[efptBONDED], &dvdl_dum,
- as_rvec_array(state->v.data()), nullptr, ConstraintVariable::Positions);
+ as_rvec_array(state->v.data()), nullptr, gmx::ConstraintVariable::Positions);
for (i = start; i < end; i++)
{
}
}
-static void wall_error(int a, const rvec *x, real r)
+[[ noreturn ]] static void wall_error(int a, const rvec *x, real r)
{
gmx_fatal(FARGS,
"An atom is beyond the wall: coordinates %f %f %f, distance %f\n"
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
//! \cond libapi
//! Initializes option properties with the given name.
explicit AbstractOptionSection(const char *name) : name_(name) {}
-
+ //! Destructor
+ virtual ~AbstractOptionSection() {}
/*! \brief
* Creates a storage object corresponding to this section.
*
#include "gromacs/pbcutil/pbc.h"
#include "gromacs/simd/simd.h"
-using namespace gmx; // TODO: Remove when this file is moved into gmx namespace
-
struct gmx_domdec_t;
/*! \brief Set the SIMD PBC data from a normal t_pbc struct.
* routine should be low. On e.g. Intel Haswell/Broadwell it takes 8 cycles.
*/
static inline void gmx_simdcall
-pbc_correct_dx_simd(SimdReal *dx,
- SimdReal *dy,
- SimdReal *dz,
- const real *pbc_simd)
+pbc_correct_dx_simd(gmx::SimdReal *dx,
+ gmx::SimdReal *dy,
+ gmx::SimdReal *dz,
+ const real *pbc_simd)
{
+ using namespace gmx;
SimdReal shz, shy, shx;
shz = round(*dz * load<SimdReal>(pbc_simd+0*GMX_SIMD_REAL_WIDTH)); // load inv_bzz
* This is the SIMD equivalent of the scalar version declared in pbc.h.
*/
static inline void gmx_simdcall
-pbc_dx_aiuc(const real *pbc_simd,
- const SimdReal *x1,
- const SimdReal *x2,
- SimdReal *dx)
+pbc_dx_aiuc(const real *pbc_simd,
+ const gmx::SimdReal *x1,
+ const gmx::SimdReal *x2,
+ gmx::SimdReal *dx)
{
for (int d = 0; d < DIM; d++)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
{
case gmx::PositionCalculationCollection::RequiredTopologyInfo::TopologyAndMasses:
method->flags |= SMETH_REQMASS;
- // fallthrough
+ [[fallthrough]];
case gmx::PositionCalculationCollection::RequiredTopologyInfo::Topology:
method->flags |= SMETH_REQTOP;
break;
/*! \brief
* Constructs an empty reference.
*/
- ArrayRef() : begin_(NULL), end_(NULL) {}
+ ArrayRef() : begin_(nullptr), end_(nullptr) {}
/*! \brief
* Constructs an empty reference.
*
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
virtual bool onError(UserInputError *ex, const KeyValueTreePath &context) = 0;
protected:
- ~IKeyValueTreeErrorHandler();
+ virtual ~IKeyValueTreeErrorHandler();
};
//! \cond libapi
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
static KeyValueTreeValue deserialize(ISerializer *serializer);
private:
- ValueSerializer();
+ ValueSerializer() = delete;
typedef void (*SerializerFunction)(const KeyValueTreeValue &value, ISerializer *serializer);
typedef void (*DeserializerFunction)(KeyValueTreeValueBuilder *builder, ISerializer *serializer);
SERIALIZER('f', float),
SERIALIZER('d', double),
};
- for (const auto item : s_serializers)
+ for (const auto &item : s_serializers)
{
s_deserializers[item.second.typeTag] = item.second.deserialize;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2011,2012,2013,2014,2015,2016,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
static void returnFalseOnError(const NotFoundInfo &info);
static void throwOnError(const NotFoundInfo &info);
- static void throwOnNotFound(const NotFoundInfo &info);
+ [[ noreturn ]] static void throwOnNotFound(const NotFoundInfo &info);
typedef void (*NotFoundHandler)(const NotFoundInfo &info);