set_target_properties(libgromacs PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_EXE};--checks=\
-clang-analyzer-security.insecureAPI.strcpy,-clang-analyzer-core.NullDereference,\
bugprone-*,misc-*,readability-*,performance-*,mpi-*,-bugprone-integer-division,\
- -readability-redundant-smartptr-get,-readability-redundant-string-cstr,-readability-simplify-boolean-expr,\
-misc-misplaced-widening-cast,-readability-named-parameter,-performance-noexcept-move-constructor,\
- -readability-misleading-indentation,-readability-container-size-empty,-misc-suspicious-string-compare,\
+ -readability-misleading-indentation,-misc-suspicious-string-compare,\
-readability-redundant-control-flow,-performance-unnecessary-value-param,\
-readability-static-definition-in-anonymous-namespace,-misc-suspicious-missing-comma,\
-readability-redundant-member-init,-misc-misplaced-const,\
/*
* 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
+ * Copyright (c) 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.
output_env_init(&oenv, getProgramContext(), time_unit, FALSE, xvg_format, 0);
const unique_cptr<gmx_output_env_t, output_env_done> oenvGuard(oenv);
impl_->fp_ = xvgropen(impl_->filename_.c_str(), impl_->title_.c_str(),
- impl_->xlabel_.c_str(), impl_->ylabel_.c_str(),
+ impl_->xlabel_, impl_->ylabel_,
oenv);
const SelectionCollection *selections
= impl_->settings_.selectionCollection();
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
xScalar *= x;
}
- GMX_ASSERT(xArray.size() > 0, "We should have a non-empty input array");
+ GMX_ASSERT(!xArray.empty(), "We should have a non-empty input array");
xScalar = std::pow(xScalar, 1.0/xArray.size());
/* Look up zeta(x) */
filename.c_str());
gmx::TextLineWrapper wrapper;
wrapper.settings().setLineLength(c_linewidth);
- correctFormatMessage = wrapper.wrapToString(correctFormatMessage).c_str();
+ correctFormatMessage = wrapper.wrapToString(correctFormatMessage);
double **data;
int numColumns;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
gmx::ThreeFry2x64<0> rng(seed, gmx::RandomDomain::AwhBiasing);
gmx::UniformRealDistribution<real> uniformRealDistr;
- GMX_RELEASE_ASSERT(distr.size() > 0, "We need a non-zero length distribution to sample from");
+ GMX_RELEASE_ASSERT(!distr.empty(), "We need a non-zero length distribution to sample from");
/* Generate the cumulative probability distribution function */
std::vector<double> cumulativeDistribution(distr.size());
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,2015,2016,2017,2018, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and Erik Lindahl,
* and including many others, as listed in the AUTHORS file in the
* top-level source directory and at http://www.gromacs.org.
bool isAcceptableLibraryPathPrefix(const std::string &path)
{
std::string testPath = Path::join(path, DATA_INSTALL_DIR, "top");
- if (isAcceptableLibraryPath(testPath))
- {
- return true;
- }
- return false;
+ return isAcceptableLibraryPath(testPath);
}
/*! \brief
}
else
{
- AtomDistribution &ma = *dd->ma.get();
+ AtomDistribution &ma = *dd->ma;
/* Copy the master coordinates to the global array */
const t_block &cgs_gl = dd->comm->cgs_gl;
if (DDMASTER(dd))
{
- AtomDistribution &ma = *dd->ma.get();
+ AtomDistribution &ma = *dd->ma;
get_commbuffer_counts(&ma, &sendCounts, &displacements);
const t_block *cgs, rvec pos[],
gmx_domdec_t *dd)
{
- AtomDistribution &ma = *dd->ma.get();
+ AtomDistribution &ma = *dd->ma;
/* Clear the count */
for (int rank = 0; rank < dd->nnodes; rank++)
snew(ed->edpar, 1);
// If we start from a checkpoint file, we already have an edsamHistory struct
- if (oh->edsamHistory.get() == nullptr)
+ if (oh->edsamHistory == nullptr)
{
oh->edsamHistory = std::unique_ptr<edsamhistory_t>(new edsamhistory_t {});
}
}
int flags_awhh = 0;
- if (state->awhHistory != nullptr && state->awhHistory->bias.size() > 0)
+ if (state->awhHistory != nullptr && !state->awhHistory->bias.empty())
{
flags_awhh |= ( (1 << eawhhIN_INITIAL) |
(1 << eawhhEQUILIBRATEHISTOGRAM) |
{
GMX_RELEASE_ASSERT(awhOutputFile_ != nullptr, "awhOutputFile() called without initialized AWH output file");
- return *awhOutputFile_.get();
+ return *awhOutputFile_;
}
//! Return the a pointer to the friction output file data, can return nullptr
bool madeTable = false;
for (size_t j = 0; j < tabbfnm.size() && !madeTable; ++j)
{
- if (gmx::endsWith(tabbfnm[j].c_str(), patternToFind))
+ if (gmx::endsWith(tabbfnm[j], patternToFind))
{
// Finally read the table from the file found
tab[i] = make_bonded_table(fplog, tabbfnm[j].c_str(), NRAL(ftype1)-2);
return nullptr;
}
- if (!GMX_LIB_MPI && multidirs.size() >= 1)
+ if (!GMX_LIB_MPI && !multidirs.empty())
{
gmx_fatal(FARGS, "mdrun -multidir is only supported when GROMACS has been "
"configured with a proper external MPI library.");
for (int t = 0; t < vsite->nthreads; t++)
{
/* Do we write to the force buffer of task t? */
- if (idTask->atomIndex[t].atom.size() > 0)
+ if (!idTask->atomIndex[t].atom.empty())
{
idTask->spreadTask.push_back(t);
}
/* Does task t write to our force buffer? */
- if (vsite->tData[t]->idTask.atomIndex[thread].atom.size() > 0)
+ if (!vsite->tData[t]->idTask.atomIndex[thread].atom.empty())
{
idTask->reduceTask.push_back(t);
}
{
restore_energyhistory_from_state(mdebin, observablesHistory->energyHistory.get());
}
- else if (observablesHistory->energyHistory.get() != nullptr)
+ else if (observablesHistory->energyHistory != nullptr)
{
/* We might have read an energy history from checkpoint.
* As we are not appending, we want to restart the statistics.
observablesHistory->energyHistory = {};
}
}
- if (observablesHistory->energyHistory.get() == nullptr)
+ if (observablesHistory->energyHistory == nullptr)
{
observablesHistory->energyHistory = std::unique_ptr<energyhistory_t>(new energyhistory_t {});
}
/*
* 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
+ * Copyright (c) 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.
std::string StringOptionStorage::processValue(const std::string &value) const
{
- if (allowed_.size() > 0)
+ if (!allowed_.empty())
{
return *findEnumValue(this->allowed_, value);
}
/*
* 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.
bSetNo = true;
}
- *param->val.u.b = bSetNo ? false : true;
+ *param->val.u.b = !bSetNo;
}
/*! \brief
/*
* 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.
{
int i, bi, bj;
- if (pc->bEval == true && !(pc->flags & POS_MASKONLY))
+ if (pc->bEval && !(pc->flags & POS_MASKONLY))
{
return;
}
/*
* 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
+ * Copyright (c) 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.
void SelectionOptionStorage::processSetValues(ValueList *values)
{
- if (values->size() == 0)
+ if (values->empty())
{
manager_.requestOptionDelayedParsing(this);
}
{
// PME can run well on a GPU shared with NB, and we permit
// mdrun to default to try that.
- return gpuIdsToUse.size() >= 1;
+ return !gpuIdsToUse.empty();
}
if (numRanksPerSimulation < 1)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 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.
//! Post-processes the output string to not end in a line feed.
void removeTerminatingLineFeed()
{
- if (result_.size() > 0U)
+ if (!result_.empty())
{
result_.erase(result_.size() - 1);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015,2016,2017, by the GROMACS development team, led by
+ * Copyright (c) 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.
*/
bool Path::isAbsolute(const char *path)
{
- if (isDirSeparator(path[0]))
- {
- return true;
- }
#if GMX_NATIVE_WINDOWS
return path[0] != '\0' && path[1] == ':' && isDirSeparator(path[2]);
#else
- return false;
+ return isDirSeparator(path[0]);
#endif
}