/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
public:
//! Creates a handle associated with the given data object.
explicit AnalysisDataHandleImpl(AnalysisData *data)
- : data_(*data), currentFrame_(NULL)
+ : data_(*data), currentFrame_(nullptr)
{
}
*/
AnalysisDataHandle::AnalysisDataHandle()
- : impl_(NULL)
+ : impl_(nullptr)
{
}
void
AnalysisDataHandle::startFrame(int index, real x, real dx)
{
- GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used");
- GMX_RELEASE_ASSERT(impl_->currentFrame_ == NULL,
+ GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
+ GMX_RELEASE_ASSERT(impl_->currentFrame_ == nullptr,
"startFrame() called twice without calling finishFrame()");
impl_->currentFrame_ =
&impl_->data_.impl_->storage_.startFrame(index, x, dx);
void
AnalysisDataHandle::selectDataSet(int index)
{
- GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used");
- GMX_RELEASE_ASSERT(impl_->currentFrame_ != NULL,
+ GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
+ GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr,
"selectDataSet() called without calling startFrame()");
impl_->currentFrame_->selectDataSet(index);
}
void
AnalysisDataHandle::setPoint(int column, real value, bool bPresent)
{
- GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used");
- GMX_RELEASE_ASSERT(impl_->currentFrame_ != NULL,
+ GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
+ GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr,
"setPoint() called without calling startFrame()");
impl_->currentFrame_->setValue(column, value, bPresent);
}
void
AnalysisDataHandle::setPoint(int column, real value, real error, bool bPresent)
{
- GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used");
- GMX_RELEASE_ASSERT(impl_->currentFrame_ != NULL,
+ GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
+ GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr,
"setPoint() called without calling startFrame()");
impl_->currentFrame_->setValue(column, value, error, bPresent);
}
AnalysisDataHandle::setPoints(int firstColumn, int count, const real *values,
bool bPresent)
{
- GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used");
- GMX_RELEASE_ASSERT(impl_->currentFrame_ != NULL,
+ GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
+ GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr,
"setPoints() called without calling startFrame()");
for (int i = 0; i < count; ++i)
{
void
AnalysisDataHandle::finishPointSet()
{
- GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used");
+ GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
GMX_RELEASE_ASSERT(impl_->data_.isMultipoint(),
"finishPointSet() called for non-multipoint data");
- GMX_RELEASE_ASSERT(impl_->currentFrame_ != NULL,
+ GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr,
"finishPointSet() called without calling startFrame()");
impl_->currentFrame_->finishPointSet();
}
void
AnalysisDataHandle::finishFrame()
{
- GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used");
- GMX_RELEASE_ASSERT(impl_->currentFrame_ != NULL,
+ GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
+ GMX_RELEASE_ASSERT(impl_->currentFrame_ != nullptr,
"finishFrame() called without calling startFrame()");
AnalysisDataStorageFrame *frame = impl_->currentFrame_;
- impl_->currentFrame_ = NULL;
+ impl_->currentFrame_ = nullptr;
frame->finishFrame();
}
void
AnalysisDataHandle::finishData()
{
- GMX_RELEASE_ASSERT(impl_ != NULL, "Invalid data handle used");
+ GMX_RELEASE_ASSERT(impl_ != nullptr, "Invalid data handle used");
// Deletes the implementation pointer.
impl_->data_.finishData(*this);
- impl_ = NULL;
+ impl_ = nullptr;
}
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
AnalysisDataHandle();
//! Returns whether this data handle is valid.
- bool isValid() const { return impl_ != NULL; }
+ bool isValid() const { return impl_ != nullptr; }
/*! \brief
* Start data for a new frame.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,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.
: source_(*data), firstColumn_(firstColumn), columnSpan_(columnSpan),
bParallel_(false)
{
- GMX_RELEASE_ASSERT(data != NULL, "Source data must not be NULL");
+ GMX_RELEASE_ASSERT(data != nullptr, "Source data must not be NULL");
GMX_RELEASE_ASSERT(firstColumn >= 0 && columnSpan > 0, "Invalid proxy column");
setMultipoint(source_.isMultipoint());
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
*/
AnalysisDataStorageImpl::AnalysisDataStorageImpl()
- : data_(NULL), modules_(NULL),
+ : data_(nullptr), modules_(nullptr),
storageLimit_(0), pendingLimit_(1),
firstFrameLocation_(0), firstUnnotifiedIndex_(0), nextIndex_(0)
{
int index)
: storageImpl_(*storageImpl), header_(index, 0.0, 0.0), status_(eMissing)
{
- GMX_RELEASE_ASSERT(storageImpl->data_ != NULL,
+ GMX_RELEASE_ASSERT(storageImpl->data_ != nullptr,
"Storage frame constructed before data started");
// With non-multipoint data, the point set structure is static,
// so initialize it only once here.
AnalysisDataStorageFrame::AnalysisDataStorageFrame(
const AbstractAnalysisData &data)
- : data_(NULL), currentDataSet_(0), currentOffset_(0),
+ : data_(nullptr), currentDataSet_(0), currentOffset_(0),
columnCount_(data.columnCount(0)), bPointSetInProgress_(false)
{
int totalColumnCount = 0;
void
AnalysisDataStorageFrame::selectDataSet(int index)
{
- GMX_RELEASE_ASSERT(data_ != NULL, "Invalid frame accessed");
+ GMX_RELEASE_ASSERT(data_ != nullptr, "Invalid frame accessed");
const AbstractAnalysisData &baseData = data_->baseData();
GMX_RELEASE_ASSERT(index >= 0 && index < baseData.dataSetCount(),
"Out of range data set index");
void
AnalysisDataStorageFrame::finishPointSet()
{
- GMX_RELEASE_ASSERT(data_ != NULL, "Invalid frame accessed");
+ GMX_RELEASE_ASSERT(data_ != nullptr, "Invalid frame accessed");
GMX_RELEASE_ASSERT(data_->baseData().isMultipoint(),
"Should not be called for non-multipoint data");
if (bPointSetInProgress_)
void
AnalysisDataStorageFrame::finishFrame()
{
- GMX_RELEASE_ASSERT(data_ != NULL, "Invalid frame accessed");
+ GMX_RELEASE_ASSERT(data_ != nullptr, "Invalid frame accessed");
data_->storageImpl().finishFrame(data_->frameIndex());
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2016, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,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.
AnalysisDataDisplacementModule::Impl::Impl()
: nmax(0), tmax(0.0), ndim(3),
bFirst(true), t0(0.0), dt(0.0), t(0.0), ci(0),
- max_store(-1), nstored(0), oldval(NULL),
- histm(NULL)
+ max_store(-1), nstored(0), oldval(nullptr),
+ histm(nullptr)
{
}
AnalysisDataDisplacementModule::setMSDHistogram(
AnalysisDataBinAverageModulePointer histm)
{
- GMX_RELEASE_ASSERT(_impl->histm == NULL, "Can only set MSD histogram once");
+ GMX_RELEASE_ASSERT(_impl->histm == nullptr, "Can only set MSD histogram once");
_impl->histm = histm.get();
addModule(histm);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
*/
AnalysisDataPlotSettings::AnalysisDataPlotSettings()
- : selections_(NULL), timeUnit_(TimeUnit_Default), plotFormat_(1)
+ : selections_(nullptr), timeUnit_(TimeUnit_Default), plotFormat_(1)
{
}
};
AbstractPlotModule::Impl::Impl(const AnalysisDataPlotSettings &settings)
- : settings_(settings), fp_(NULL), bPlain_(false), bOmitX_(false),
+ : settings_(settings), fp_(nullptr), bPlain_(false), bOmitX_(false),
bErrorsAsSeparateColumn_(false), xscale_(1.0)
{
strcpy(xformat_, "%11.3f");
void
AbstractPlotModule::Impl::closeFile()
{
- if (fp_ != NULL)
+ if (fp_ != nullptr)
{
if (bPlain_)
{
{
xvgrclose(fp_);
}
- fp_ = NULL;
+ fp_ = nullptr;
}
}
GMX_RELEASE_ASSERT(width >= 0 && precision >= 0
&& width <= 99 && precision <= 99,
"Invalid width or precision");
- GMX_RELEASE_ASSERT(strchr("eEfFgG", format) != NULL,
+ GMX_RELEASE_ASSERT(strchr("eEfFgG", format) != nullptr,
"Invalid format specifier");
sprintf(impl_->xformat_, "%%%d.%d%c", width, precision, format);
}
GMX_RELEASE_ASSERT(width >= 0 && precision >= 0
&& width <= 99 && precision <= 99,
"Invalid width or precision");
- GMX_RELEASE_ASSERT(strchr("eEfFgG", format) != NULL,
+ GMX_RELEASE_ASSERT(strchr("eEfFgG", format) != nullptr,
"Invalid format specifier");
sprintf(impl_->yformat_, " %%%d.%d%c", width, precision, format);
}
oenv);
const SelectionCollection *selections
= impl_->settings_.selectionCollection();
- if (selections != NULL && output_env_get_xvg_format(oenv) != exvgNONE)
+ if (selections != nullptr && output_env_get_xvg_format(oenv) != exvgNONE)
{
selections->printXvgrInfo(impl_->fp_);
}
bool
AbstractPlotModule::isFileOpen() const
{
- return impl_->fp_ != NULL;
+ return impl_->fp_ != nullptr;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * 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.
void checkReferenceDataPoint(TestReferenceChecker *checker,
const AnalysisDataValue &value)
{
- TestReferenceChecker compound(checker->checkCompound("DataValue", NULL));
+ TestReferenceChecker compound(checker->checkCompound("DataValue", nullptr));
compound.checkReal(value.value(), "Value");
if (compound.checkPresent(value.hasError(), "Error"))
{
} // namespace
MockAnalysisDataModule::Impl::Impl(int flags)
- : source_(NULL), flags_(flags), frameIndex_(0)
+ : source_(nullptr), flags_(flags), frameIndex_(0)
{
}
if (frameChecker_)
{
TestReferenceChecker checker(
- frameChecker_.checkCompound("DataValues", NULL));
+ frameChecker_.checkCompound("DataValues", nullptr));
checker.checkInteger(points.columnCount(), "Count");
if (checker.checkPresent(source_->dataSetCount() > 1, "DataSet"))
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
*
* \ingroup module_commandline
*/
-const CommandLineHelpContext *g_globalContext = NULL;
+const CommandLineHelpContext *g_globalContext = nullptr;
} // namespace
Impl(TextWriter *writer, HelpOutputFormat format,
const HelpLinks *links)
: writerContext_(writer, format, links), moduleDisplayName_("gmx"),
- completionWriter_(NULL), bHidden_(false)
+ completionWriter_(nullptr), bHidden_(false)
{
}
//! Creates an implementation class from a low-level context.
explicit Impl(const HelpWriterContext &writerContext)
: writerContext_(writerContext),
- completionWriter_(NULL), bHidden_(false)
+ completionWriter_(nullptr), bHidden_(false)
{
}
CommandLineHelpContext::CommandLineHelpContext(
ShellCompletionWriter *writer)
- : impl_(new Impl(&writer->outputWriter(), eHelpOutputFormat_Other, NULL))
+ : impl_(new Impl(&writer->outputWriter(), eHelpOutputFormat_Other, nullptr))
{
impl_->completionWriter_ = writer;
}
bool CommandLineHelpContext::isCompletionExport() const
{
- return impl_->completionWriter_ != NULL;
+ return impl_->completionWriter_ != nullptr;
}
ShellCompletionWriter &CommandLineHelpContext::shellCompletionWriter() const
GlobalCommandLineHelpContext::GlobalCommandLineHelpContext(
const CommandLineHelpContext &context)
{
- GMX_RELEASE_ASSERT(g_globalContext == NULL,
+ GMX_RELEASE_ASSERT(g_globalContext == nullptr,
"Global context set more than once");
g_globalContext = &context;
}
GlobalCommandLineHelpContext::~GlobalCommandLineHelpContext()
{
- g_globalContext = NULL;
+ g_globalContext = nullptr;
}
} // namespace gmx
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
++topicName)
{
const IHelpTopic *topic = findSubTopic(topicName->c_str());
- GMX_RELEASE_ASSERT(topic != NULL, "Exported help topic no longer found");
+ GMX_RELEASE_ASSERT(topic != nullptr, "Exported help topic no longer found");
exporter->exportTopic(*topic);
}
// For now, the title is only set for the export to make it not appear in
CommandLineHelpContext
RootHelpTopic::createContext(const HelpWriterContext &context) const
{
- if (helpModule_.context_ != NULL)
+ if (helpModule_.context_ != nullptr)
{
return CommandLineHelpContext(*helpModule_.context_);
}
virtual bool hasSubTopics() const { return false; }
virtual const IHelpTopic *findSubTopic(const char * /*name*/) const
{
- return NULL;
+ return nullptr;
}
virtual void writeHelp(const HelpWriterContext &context) const;
for (module = modules.begin(); module != modules.end(); ++module)
{
int nameLength = static_cast<int>(module->first.length());
- if (module->second->shortDescription() != NULL
+ if (module->second->shortDescription() != nullptr
&& nameLength > maxNameLength)
{
maxNameLength = nameLength;
"Available commands:");
TextWriter &file = context.outputFile();
TextTableFormatter formatter;
- formatter.addColumn(NULL, maxNameLength + 1, false);
- formatter.addColumn(NULL, 72 - maxNameLength, true);
+ formatter.addColumn(nullptr, maxNameLength + 1, false);
+ formatter.addColumn(nullptr, 72 - maxNameLength, true);
formatter.setFirstColumnIndent(4);
for (module = modules.begin(); module != modules.end(); ++module)
{
const char *name = module->first.c_str();
const char *description = module->second->shortDescription();
- if (description != NULL)
+ if (description != nullptr)
{
formatter.clear();
formatter.addColumnLine(0, name);
}
virtual const char *name() const { return module_.name(); }
- virtual const char *title() const { return NULL; }
+ virtual const char *title() const { return nullptr; }
virtual bool hasSubTopics() const { return false; }
virtual const IHelpTopic *findSubTopic(const char * /*name*/) const
{
- return NULL;
+ return nullptr;
}
virtual void writeHelp(const HelpWriterContext &context) const;
module != helpModule.modules_.end();
++module)
{
- if (module->second->shortDescription() != NULL)
+ if (module->second->shortDescription() != nullptr)
{
std::string linkName("[gmx-" + module->first + "]");
const char *name = module->first.c_str();
const CommandLineModuleGroupList &groups)
: rootTopic_(*this), programContext_(programContext),
binaryName_(binaryName), modules_(modules), groups_(groups),
- context_(NULL), moduleOverride_(NULL), bHidden_(false),
+ context_(nullptr), moduleOverride_(nullptr), bHidden_(false),
outputRedirector_(&defaultFileOutputRedirector())
{
}
CommandLineModuleMap::const_iterator module;
for (module = modules_.begin(); module != modules_.end(); ++module)
{
- if (module->second->shortDescription() != NULL)
+ if (module->second->shortDescription() != nullptr)
{
const char *const moduleName = module->first.c_str();
std::string tag(formatString("%s-%s", program, moduleName));
CommandLineHelpContext context(&writer, eHelpOutputFormat_Console, &links,
impl_->binaryName_);
context.setShowHidden(impl_->bHidden_);
- if (impl_->moduleOverride_ != NULL)
+ if (impl_->moduleOverride_ != nullptr)
{
context.setModuleDisplayName(impl_->programContext_.displayName());
impl_->moduleOverride_->writeHelp(context);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
* Does not throw.
*/
OptionsFilter()
- : formatter_(NULL), filterType_(eSelectOtherOptions),
+ : formatter_(nullptr), filterType_(eSelectOtherOptions),
bShowHidden_(false)
{
}
return;
}
const FileNameOptionInfo *const fileOption = option.toType<FileNameOptionInfo>();
- if (fileOption != NULL && fileOption->isInputFile())
+ if (fileOption != nullptr && fileOption->isInputFile())
{
if (filterType_ == eSelectInputFileOptions)
{
}
return;
}
- if (fileOption != NULL && fileOption->isInputOutputFile())
+ if (fileOption != nullptr && fileOption->isInputOutputFile())
{
if (filterType_ == eSelectInputOutputFileOptions)
{
}
return;
}
- if (fileOption != NULL && fileOption->isOutputFile())
+ if (fileOption != nullptr && fileOption->isOutputFile())
{
if (filterType_ == eSelectOutputFileOptions)
{
const FloatOptionInfo *floatOption = option.toType<FloatOptionInfo>();
const DoubleOptionInfo *doubleOption = option.toType<DoubleOptionInfo>();
- if ((floatOption != NULL && floatOption->isTime())
- || (doubleOption != NULL && doubleOption->isTime()))
+ if ((floatOption != nullptr && floatOption->isTime())
+ || (doubleOption != nullptr && doubleOption->isTime()))
{
// TODO: It could be nicer to have this in basicoptions.cpp.
description = replaceAll(description, "%t", common.timeUnit);
private:
void writeSectionStartIfNecessary()
{
- if (title_ != NULL)
+ if (title_ != nullptr)
{
context_.writeTitle(title_);
- title_ = NULL;
+ title_ = nullptr;
}
if (!bDidOutput_)
{
- if (header_ != NULL)
+ if (header_ != nullptr)
{
context_.paragraphBreak();
context_.writeTextBlock(header_);
const CommonFormatterData &common,
const char *title)
: context_(context), common_(common),
- title_(title), header_(NULL), bDidOutput_(false)
+ title_(title), header_(nullptr), bDidOutput_(false)
{
}
std::string defaultValue(defaultOptionValue(option));
std::string info;
const FileNameOptionInfo *fileOption = option.toType<FileNameOptionInfo>();
- if (fileOption != NULL)
+ if (fileOption != nullptr)
{
const bool bAbbrev = (context_.outputFormat() == eHelpOutputFormat_Console);
info = fileOptionFlagsAsString(*fileOption, bAbbrev);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
void finalizeForCommandLine()
{
gmx::finalize();
- setLibraryFileFinder(NULL);
+ setLibraryFileFinder(nullptr);
g_libFileFinder.reset();
- setProgramContext(NULL);
+ setProgramContext(nullptr);
g_commandLineContext.reset();
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,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.
int argc = 1;
// TODO: The constness should not be cast away.
argv[0] = const_cast<char *>(name);
- argv[1] = NULL;
+ argv[1] = nullptr;
GlobalCommandLineHelpContext global(context);
mainFunction(argc, argv);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
CommandLineModuleManager::Impl::Impl(const char *binaryName,
CommandLineProgramContext *programContext)
: programContext_(*programContext),
- binaryName_(binaryName != NULL ? binaryName : ""),
- helpModule_(NULL), singleModule_(NULL),
+ binaryName_(binaryName != nullptr ? binaryName : ""),
+ helpModule_(nullptr), singleModule_(nullptr),
bQuiet_(false)
{
GMX_RELEASE_ASSERT(binaryName_.find('-') == std::string::npos,
void CommandLineModuleManager::Impl::ensureHelpModuleExists()
{
- if (helpModule_ == NULL)
+ if (helpModule_ == nullptr)
{
helpModule_ = new CommandLineHelpModule(programContext_, binaryName_,
modules_, moduleGroups_);
// TODO: It would be nice to propagate at least the -quiet option to
// the modules so that they can also be quiet in response to this.
- if (module == NULL)
+ if (module == nullptr)
{
// If not in single-module mode, process options to the wrapper binary.
// TODO: Ideally, this could be done by CommandLineParser.
// which path is taken: (*argv)[0] is the module name.
}
}
- if (module != NULL)
+ if (module != nullptr)
{
- if (singleModule_ == NULL)
+ if (singleModule_ == nullptr)
{
programContext_.setDisplayName(binaryName_ + " " + module->name());
}
}
if (!optionsHolder->finishOptions())
{
- return NULL;
+ return nullptr;
}
// If no module specified and no other action, show the help.
// Also explicitly specifying -h for the wrapper binary goes here.
- if (module == NULL || optionsHolder->shouldShowHelp())
+ if (module == nullptr || optionsHolder->shouldShowHelp())
{
ensureHelpModuleExists();
- if (module != NULL)
+ if (module != nullptr)
{
helpModule_->setModuleOverride(*module);
}
optionsHolder.binaryInfoSettings());
fprintf(out, "\n");
}
- if (module == NULL)
+ if (module == nullptr)
{
return 0;
}
CommandLineProgramContext &programContext = gmx::initForCommandLine(&argc, &argv);
try
{
- CommandLineModuleManager manager(NULL, &programContext);
+ CommandLineModuleManager manager(nullptr, &programContext);
manager.setSingleModule(module);
int rc = manager.run(argc, argv);
gmx::finalizeForCommandLine();
CommandLineModuleMap::const_iterator moduleIter = allModules_.find(name);
GMX_RELEASE_ASSERT(moduleIter != allModules_.end(),
"Non-existent module added to a group");
- if (description == NULL)
+ if (description == nullptr)
{
description = moduleIter->second->shortDescription();
- GMX_RELEASE_ASSERT(description != NULL,
+ GMX_RELEASE_ASSERT(description != nullptr,
"Module without a description added to a group");
}
std::string tag(formatString("%s-%s", binaryName_, name));
void CommandLineModuleGroup::addModule(const char *name)
{
- impl_->addModule(name, NULL);
+ impl_->addModule(name, nullptr);
}
void CommandLineModuleGroup::addModuleWithDescription(const char *name,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
if (!module_)
{
- GMX_RELEASE_ASSERT(factory_ != NULL, "Neither factory nor module provided");
+ GMX_RELEASE_ASSERT(factory_ != nullptr, "Neither factory nor module provided");
module_ = factory_();
}
module_->init(settings);
ICommandLineOptionsModule *module = module_.get();
if (!module)
{
- GMX_RELEASE_ASSERT(factory_ != NULL, "Neither factory nor module provided");
+ GMX_RELEASE_ASSERT(factory_ != nullptr, "Neither factory nor module provided");
moduleGuard = factory_();
module = moduleGuard.get();
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,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.
// Lone '-' or '--' is not an option.
if (arg[0] != '-' || arg[1] == '\0' || (arg[1] == '-' && arg[2] == '\0'))
{
- return NULL;
+ return nullptr;
}
// Something starting with '--' is always an option.
if (arg[1] == '-')
GMX_IGNORE_RETURN_VALUE(std::strtod(arg, &endptr));
if (*endptr == '\0')
{
- return NULL;
+ return nullptr;
}
return arg + 1;
}
{
const char *const arg = argv[i];
const char *const optionName = impl_->toOptionName(arg);
- if (optionName != NULL)
+ if (optionName != nullptr)
{
if (bInOption)
{
if (impl_->bSkipUnknown_)
{
*argc = newi;
- argv[newi] = NULL;
+ argv[newi] = nullptr;
}
// Finish the last option.
if (bInOption)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
*/
std::string quoteIfNecessary(const char *str)
{
- const bool bSpaces = (std::strchr(str, ' ') != NULL);
+ const bool bSpaces = (std::strchr(str, ' ') != nullptr);
if (bSpaces)
{
return formatString("'%s'", str);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
}
- return NULL;
+ return nullptr;
}
const char *opt2fn(const char *opt, int nfile, const t_filenm fnm[])
fprintf(stderr, "No option %s\n", opt);
- return NULL;
+ return nullptr;
}
int opt2fns(char **fns[], const char *opt, int nfile, const t_filenm fnm[])
}
fprintf(stderr, "ftp2fn: No filetype %s\n", ftp2ext_with_dot(ftp));
- return NULL;
+ return nullptr;
}
int ftp2fns(char **fns[], int ftp, int nfile, const t_filenm fnm[])
{
if (IS_OPT(fnm[i]) && !IS_SET(fnm[i]))
{
- return NULL;
+ return nullptr;
}
else
{
}
}
fprintf(stderr, "No option %s\n", opt);
- return NULL;
+ return nullptr;
}
const char *ftp2fn_null(int ftp, int nfile, const t_filenm fnm[])
{
if (IS_OPT(fnm[i]) && !IS_SET(fnm[i]))
{
- return NULL;
+ return nullptr;
}
else
{
}
}
fprintf(stderr, "ftp2fn: No filetype %s\n", ftp2ext_with_dot(ftp));
- return NULL;
+ return nullptr;
}
gmx_bool is_optional(const t_filenm *fnm)
}
else
{
- ret[i].opt = NULL;
+ ret[i].opt = nullptr;
}
if (tfn[i].fn)
}
else
{
- ret[i].fn = NULL;
+ ret[i].fn = nullptr;
}
if (tfn[i].nfiles > 0)
sfree(fnm[i].fns[j]);
}
sfree(fnm[i].fns);
- fnm[i].fns = NULL;
+ fnm[i].fns = nullptr;
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_fatal(FARGS, "No string option %s in pargs", option);
- return NULL;
+ return nullptr;
}
gmx_bool opt2parg_bSet(const char *option, int nparg, t_pargs pa[])
gmx_fatal(FARGS, "No such option %s in pargs", option);
- return NULL;
+ return nullptr;
}
/********************************************************************
int getDefaultXvgFormat(gmx::ConstArrayRef<const char *> xvgFormats)
{
const char *const select = getenv("GMX_VIEW_XVG");
- if (select != NULL)
+ if (select != nullptr)
{
ConstArrayRef<const char *>::const_iterator i =
std::find(xvgFormats.begin(), xvgFormats.end(), std::string(select));
struct FileNameData
{
//! Creates a conversion helper for a given `t_filenm` struct.
- explicit FileNameData(t_filenm *fnm) : fnm(fnm), optionInfo(NULL)
+ explicit FileNameData(t_filenm *fnm) : fnm(fnm), optionInfo(nullptr)
{
}
{
//! Creates a conversion helper for a given `t_pargs` struct.
explicit ProgramArgData(t_pargs *pa)
- : pa(pa), optionInfo(NULL), enumIndex(0), boolValue(false)
+ : pa(pa), optionInfo(nullptr), enumIndex(0), boolValue(false)
{
}
void OptionsAdapter::filenmToOptions(Options *options, t_filenm *fnm)
{
- if (fnm->opt == NULL)
+ if (fnm->opt == nullptr)
{
// Existing code may use opt2fn() instead of ftp2fn() for
// options that use the default option name, so we need to
const char *const name = &fnm->opt[1];
const char * defName = fnm->fn;
int defType = -1;
- if (defName == NULL)
+ if (defName == nullptr)
{
defName = ftp2defnm(fnm->ftp);
}
return;
case etSTR:
{
- const char *const defValue = (*pa->u.c != NULL ? *pa->u.c : "");
+ const char *const defValue = (*pa->u.c != nullptr ? *pa->u.c : "");
data.optionInfo = options->addOption(
StringOption(name).store(&data.stringValue)
.defaultValue(defValue)
return;
case etENUM:
{
- const int defaultIndex = (pa->u.c[0] != NULL ? nenum(pa->u.c) - 1 : 0);
+ const int defaultIndex = (pa->u.c[0] != nullptr ? nenum(pa->u.c) - 1 : 0);
data.optionInfo = options->addOption(
EnumIntOption(name).store(&data.enumIndex)
.defaultValue(defaultIndex)
const gmx::CommandLineHelpContext *context =
gmx::GlobalCommandLineHelpContext::get();
- if (context != NULL)
+ if (context != nullptr)
{
GMX_RELEASE_ASSERT(gmx_node_rank() == 0,
"Help output should be handled higher up and "
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
optionList_.append("-");
const BooleanOptionInfo *booleanOption
= option.toType<BooleanOptionInfo>();
- if (booleanOption != NULL && booleanOption->defaultValue())
+ if (booleanOption != nullptr && booleanOption->defaultValue())
{
optionList_.append("no");
}
return;
}
const FileNameOptionInfo *fileOption = option.toType<FileNameOptionInfo>();
- if (fileOption != NULL)
+ if (fileOption != nullptr)
{
if (fileOption->isDirectoryOption())
{
return;
}
const StringOptionInfo *stringOption = option.toType<StringOptionInfo>();
- if (stringOption != NULL && stringOption->isEnumerated())
+ if (stringOption != nullptr && stringOption->isEnumerated())
{
std::string completion("compgen -S ' ' -W $'");
completion.append(joinStrings(stringOption->allowedValues(), "\\n"));
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx::StringOutputStream stream;
gmx::TextWriter streamWriter(&stream);
gmx::CommandLineHelpContext context(&streamWriter, gmx::eHelpOutputFormat_Console,
- NULL, "test");
+ nullptr, "test");
context.setShowHidden(bHidden_);
writer->writeHelp(context);
stream.close();
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
};
CommandLine args(cmdline);
initManager(args, "g_module");
- MockModule mod(NULL, NULL);
+ MockModule mod(nullptr, nullptr);
manager().setSingleModule(&mod);
using ::testing::_;
EXPECT_CALL(mod, writeHelp(_));
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2016, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2013,2014,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.
EXPECT_STREQ("-opt2", args.arg(2));
EXPECT_STREQ("value", args.arg(3));
EXPECT_STREQ("-opt3", args.arg(4));
- EXPECT_TRUE(args.arg(5) == NULL);
+ EXPECT_TRUE(args.arg(5) == nullptr);
EXPECT_TRUE(flag_);
ASSERT_EQ(1U, ivalues_.size());
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
void testBinaryPathSearch(const char *argv0)
{
- ASSERT_TRUE(env_.get() != NULL);
+ ASSERT_TRUE(env_.get() != nullptr);
gmx::CommandLineProgramContext info(1, &argv0, move(env_));
EXPECT_EQ(expectedExecutable_, info.fullBinaryPath());
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
};
ParseCommonArgsTest()
- : oenv_(NULL), fileCount_(0)
+ : oenv_(nullptr), fileCount_(0)
{
}
virtual ~ParseCommonArgsTest()
bool bOk = parse_common_args(&args_.argc(), args_.argv(), flags,
fnm.size(), fnm.data(),
pa.size(), pa.data(),
- 0, NULL, 0, NULL, &oenv_);
+ 0, nullptr, 0, nullptr, &oenv_);
EXPECT_TRUE(bOk);
}
void parseFromArray(gmx::ConstArrayRef<const char *> cmdline,
{
std::string filename(tempFiles_.getTemporaryFilePath(extension));
gmx::TextWriter::writeFileFromString(filename, "Dummy file");
- if (name != NULL)
+ if (name != nullptr)
{
args_.append(name);
switch (type)
TEST_F(ParseCommonArgsTest, ParsesEnumArgs)
{
- const char *value1[] = {NULL, "none", "on", "off", NULL };
- const char *value2[] = {NULL, "def", "value", "value_other", NULL };
- const char *value3[] = {NULL, "default", "value", NULL };
+ const char *value1[] = {nullptr, "none", "on", "off", nullptr };
+ const char *value2[] = {nullptr, "def", "value", "value_other", nullptr };
+ const char *value3[] = {nullptr, "default", "value", nullptr };
t_pargs pa[] = {
{ "-s1", FALSE, etENUM, {value1}, "Description" },
{ "-s2", FALSE, etENUM, {value2}, "Description" },
EXPECT_STREQ("test.xvg", opt2fn_null("-o2", nfile(), fnm));
char **files;
EXPECT_EQ(2, opt2fns(&files, "-om", nfile(), fnm));
- EXPECT_TRUE(files != NULL);
- if (files != NULL)
+ EXPECT_TRUE(files != nullptr);
+ if (files != nullptr)
{
EXPECT_STREQ("test1.xvg", files[0]);
EXPECT_STREQ("test2.xvg", files[1]);
TEST_F(ParseCommonArgsTest, ParsesFileArgsWithDefaults)
{
t_filenm fnm[] = {
- { efTPS, NULL, NULL, ffWRITE },
- { efTRX, "-f2", NULL, ffOPTWR },
+ { efTPS, nullptr, nullptr, ffWRITE },
+ { efTRX, "-f2", nullptr, ffOPTWR },
{ efTRX, "-f3", "trj3", ffWRITE },
{ efXVG, "-o", "out", ffWRITE },
{ efXVG, "-om", "outm", ffWRMULT }
TEST_F(ParseCommonArgsTest, ParsesFileArgsWithDefaultFileName)
{
t_filenm fnm[] = {
- { efTPS, "-s", NULL, ffWRITE },
- { efTRX, "-f2", NULL, ffWRITE },
+ { efTPS, "-s", nullptr, ffWRITE },
+ { efTRX, "-f2", nullptr, ffWRITE },
{ efTRX, "-f3", "trj3", ffWRITE },
{ efXVG, "-o", "out", ffWRITE },
{ efXVG, "-om", "outm", ffWRMULT }
TEST_F(ParseCommonArgsTest, HandlesNonExistentInputFiles)
{
t_filenm fnm[] = {
- { efTPS, "-s", NULL, ffREAD },
+ { efTPS, "-s", nullptr, ffREAD },
{ efTRX, "-f", "trj", ffREAD },
{ efTRX, "-f2", "trj2", ffREAD },
{ efTRX, "-f3", "trj3", ffREAD },
TEST_F(ParseCommonArgsTest, HandlesNonExistentOptionalInputFiles)
{
t_filenm fnm[] = {
- { efTPS, "-s", NULL, ffOPTRD },
+ { efTPS, "-s", nullptr, ffOPTRD },
{ efTRX, "-f", "trj", ffOPTRD }
};
const char *const cmdline[] = {
TEST_F(ParseCommonArgsTest, HandlesCompressedFiles)
{
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efGRO, "-g", NULL, ffREAD }
+ { efTRX, "-f", nullptr, ffREAD },
+ { efGRO, "-g", nullptr, ffREAD }
};
args_.append("test");
std::string expectedF = addFileArg("-f", ".pdb.gz", efFull);
TEST_F(ParseCommonArgsTest, AcceptsUnknownTrajectoryExtension)
{
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD }
+ { efTRX, "-f", nullptr, ffREAD }
};
args_.append("test");
std::string expected = addFileArg("-f", ".foo", efFull);
TEST_F(ParseCommonArgsTest, CompletesExtensionFromExistingFile)
{
t_filenm fnm[] = {
- { efTRX, "-f1", NULL, ffREAD },
- { efTRX, "-f2", NULL, ffREAD },
- { efTRX, "-f3", NULL, ffREAD },
- { efTRX, "-f4", NULL, ffREAD }
+ { efTRX, "-f1", nullptr, ffREAD },
+ { efTRX, "-f2", nullptr, ffREAD },
+ { efTRX, "-f3", nullptr, ffREAD },
+ { efTRX, "-f4", nullptr, ffREAD }
};
args_.append("test");
std::string expected1 = addFileArg("-f1", "1.xtc", efNoExtension);
TEST_F(ParseCommonArgsTest, CompletesExtensionFromExistingFileWithDefaultFileName)
{
t_filenm fnm[] = {
- { efTRX, "-f1", NULL, ffREAD },
+ { efTRX, "-f1", nullptr, ffREAD },
{ efSTO, "-f2", "foo", ffREAD },
- { efTRX, "-f3", NULL, ffREAD },
- { efSTX, "-f4", NULL, ffREAD }
+ { efTRX, "-f3", nullptr, ffREAD },
+ { efSTX, "-f4", nullptr, ffREAD }
};
args_.append("test");
std::string expected1 = addFileArg("-f1", "1.trr", efNoExtension);
std::string expected2 = addFileArg("-f2", ".pdb", efEmptyValue);
std::string expected3 = addFileArg("-f3", ".trr", efEmptyValue);
- std::string expected4 = addFileArg(NULL, ".pdb", efEmptyValue);
+ std::string expected4 = addFileArg(nullptr, ".pdb", efEmptyValue);
std::string deffnm = gmx::Path::stripExtension(expected3);
args_.append("-deffnm");
args_.append(deffnm);
TEST_F(ParseCommonArgsTest, HandlesNonReadNode)
{
t_filenm fnm[] = {
- { efTPS, "-s", NULL, ffREAD },
- { efTRX, "-f", NULL, ffREAD },
- { efTRX, "-f2", NULL, ffREAD }
+ { efTPS, "-s", nullptr, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTRX, "-f2", nullptr, ffREAD }
};
const char *const cmdline[] = {
"test", "-f", "-f2", "other"
TEST_F(ParseCommonArgsTest, HandlesNonReadNodeWithDefaultFileName)
{
t_filenm fnm[] = {
- { efTPS, "-s", NULL, ffREAD },
- { efTRX, "-f", NULL, ffREAD },
- { efTRX, "-f2", NULL, ffREAD }
+ { efTPS, "-s", nullptr, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTRX, "-f2", nullptr, ffREAD }
};
const char *const cmdline[] = {
"test", "-deffnm", "def", "-f", "-f2", "other"
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
};
#define NVIEW asize(can_view_ftp)
static const char* view_program[] = {
- NULL,
- "ghostview", "display", NULL, "xterm -e rasmol"
+ nullptr,
+ "ghostview", "display", nullptr, "xterm -e rasmol"
};
static int can_view(int ftp)
if (output_env_get_view(oenv) && fn)
{
- if (getenv("DISPLAY") == NULL)
+ if (getenv("DISPLAY") == nullptr)
{
fprintf(stderr, "Can not view %s, no DISPLAY environment variable.\n", fn);
}
if (can_view(fnm[i].ftp) && is_output(&(fnm[i])) &&
( !is_optional(&(fnm[i])) || is_set(&(fnm[i])) ) )
{
- do_view(oenv, fnm[i].fns[0], NULL);
+ do_view(oenv, fnm[i].fns[0], nullptr);
}
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_bool bVerbose, real tbeginfit, real tendfit,
int eFitFn)
{
- FILE *fp, *gp = NULL;
+ FILE *fp, *gp = nullptr;
int i;
real *csum;
real *ctmp, *fit;
}
else
{
- fit = NULL;
- fp = NULL;
+ fit = nullptr;
+ fp = nullptr;
}
if (bAver)
{
if (eFitFn != effnNONE)
{
- fit_acf(nout, eFitFn, oenv, fn != NULL, tbeginfit, tendfit, dt, c1[0], fit);
+ fit_acf(nout, eFitFn, oenv, fn != nullptr, tbeginfit, tendfit, dt, c1[0], fit);
sum = print_and_integrate(fp, nout, dt, c1[0], fit, 1);
}
else
{
- sum = print_and_integrate(fp, nout, dt, c1[0], NULL, 1);
+ sum = print_and_integrate(fp, nout, dt, c1[0], nullptr, 1);
}
if (bVerbose)
{
}
if (eFitFn != effnNONE)
{
- fit_acf(nout, eFitFn, oenv, fn != NULL, tbeginfit, tendfit, dt, c1[i], fit);
+ fit_acf(nout, eFitFn, oenv, fn != nullptr, tbeginfit, tendfit, dt, c1[i], fit);
sum = print_and_integrate(fp, nout, dt, c1[i], fit, 1);
}
else
{
- sum = print_and_integrate(fp, nout, dt, c1[i], NULL, 1);
+ sum = print_and_integrate(fp, nout, dt, c1[i], nullptr, 1);
if (debug)
{
fprintf(debug,
}
/*! \brief Legend for selecting Legendre polynomials. */
-static const char *Leg[] = { NULL, "0", "1", "2", "3", NULL };
+static const char *Leg[] = { nullptr, "0", "1", "2", "3", nullptr };
t_pargs *add_acf_pargs(int *npargs, t_pargs *pa)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
* the array).
*/
const char *s_ffn[effnNR+2] = {
- NULL, "none", "exp", "aexp", "exp_exp",
+ nullptr, "none", "exp", "aexp", "exp_exp",
"exp5", "exp7", "exp9",
- NULL, NULL, NULL, NULL, NULL
+ nullptr, nullptr, nullptr, nullptr, nullptr
};
/*! \brief Long description for each fitting function type */
}
else
{
- return NULL;
+ return nullptr;
}
}
{
x[j] = ttt;
y[j] = c1[i];
- if (NULL == sig)
+ if (nullptr == sig)
{
// No weighting if all values are divided by 1.
dy[j] = 1;
}
}
/* Generate debug output */
- if (NULL != fn_fitted)
+ if (nullptr != fn_fitted)
{
fp = xvgropen(fn_fitted, "Data + Fit", "Time (ps)",
"Data (t)", oenv);
tendfit = ncorr*dt;
}
nf_int = std::min(ncorr, (int)(tendfit/dt));
- sum = print_and_integrate(debug, nf_int, dt, c1, NULL, 1);
+ sum = print_and_integrate(debug, nf_int, dt, c1, nullptr, 1);
if (bPrint)
{
}
nf_int = std::min(ncorr, (int)((tStart+1e-4)/dt));
- sum = print_and_integrate(debug, nf_int, dt, c1, NULL, 1);
- tail_corr = do_lmfit(ncorr, c1, sig, dt, NULL, tStart, tendfit, oenv,
- bDebugMode(), fitfn, fitparm, 0, NULL);
+ sum = print_and_integrate(debug, nf_int, dt, c1, nullptr, 1);
+ tail_corr = do_lmfit(ncorr, c1, sig, dt, nullptr, tStart, tendfit, oenv,
+ bDebugMode(), fitfn, fitparm, 0, nullptr);
sumtot = sum+tail_corr;
if (fit && ((jmax == 1) || (j == 1)))
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
std::string fileName = "testCOS3.xvg";
data_ = CorrelationDataSetPointer(new CorrelationDataSet(fileName));
nrFrames_ = data_->getNrLines();
- tempArgs_ = add_acf_pargs(&n, NULL);
+ tempArgs_ = add_acf_pargs(&n, nullptr);
}
static void TearDownTestCase()
{
sfree(tempArgs_);
- tempArgs_ = NULL;
+ tempArgs_ = nullptr;
gmx_fft_cleanup();
}
}
}
real *ptr = result.data();
- low_do_autocorr(0, 0, 0, nrFrames_, 1,
+ low_do_autocorr(nullptr, nullptr, nullptr, nrFrames_, 1,
get_acfnout(), &ptr, data_->getDt(), mode,
nrRestart, bAverage, bNormalize,
bVerbose, data_->getStartTime(), data_->getEndTime(),
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
for (int i = 0; i < nrColumns_; i++)
{
sfree(tempValues_[i]);
- tempValues_[i] = NULL;
+ tempValues_[i] = nullptr;
}
sfree(tempValues_);
- tempValues_ = NULL;
+ tempValues_ = nullptr;
}
real CorrelationDataSet::getValue(int set, int time) const
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
// Static initiation, only run once every test.
static void SetUpTestCase()
{
- double ** tempValues = NULL;
+ double ** tempValues = nullptr;
std::vector<std::string> fileName;
fileName.push_back(test::TestFileManager::getInputFilePath("testINVEXP.xvg"));
fileName.push_back(test::TestFileManager::getInputFilePath("testPRES.xvg"));
for (int j = 0; j < nrColumns; j++)
{
sfree(tempValues[j]);
- tempValues[j] = NULL;
+ tempValues[j] = nullptr;
}
sfree(tempValues);
- tempValues = NULL;
+ tempValues = nullptr;
}
}
output_env_init_default(&oenv);
do_lmfit(data_[testType].nrLines_,
&(data_[testType].y_[0]),
- NULL,
+ nullptr,
data_[testType].dt_,
&(data_[testType].x_[0]),
data_[testType].startTime_,
data_[testType].endTime_,
- oenv, false, type, result, 0, NULL);
+ oenv, false, type, result, 0, nullptr);
output_env_done(oenv);
checker_.setDefaultTolerance(test::relativeToleranceAsFloatingPoint(1, tolerance));
checker_.checkSequenceArray(nfitparm, result, "result");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2005,2006,2007,2008,2009,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.
{
int atnr;
- if (dd == NULL)
+ if (dd == nullptr)
{
atnr = i + 1;
}
static void vec_rvec_init(vec_rvec_t *v)
{
v->nalloc = 0;
- v->v = NULL;
+ v->v = nullptr;
}
static void vec_rvec_check_alloc(vec_rvec_t *v, int n)
consider PBC in the treatment of fshift */
bShiftForcesNeedPbc = (dd->ci[dd->dim[d]] == 0);
bScrew = (bShiftForcesNeedPbc && dd->bScrewPBC && dd->dim[d] == XX);
- if (fshift == NULL && !bScrew)
+ if (fshift == nullptr && !bScrew)
{
bShiftForcesNeedPbc = FALSE;
}
static void dd_collect_cg(gmx_domdec_t *dd,
t_state *state_local)
{
- gmx_domdec_master_t *ma = NULL;
- int buf2[2], *ibuf, i, ncg_home = 0, *cg = NULL, nat_home = 0;
+ gmx_domdec_master_t *ma = nullptr;
+ int buf2[2], *ibuf, i, ncg_home = 0, *cg = nullptr, nat_home = 0;
if (state_local->ddp_count == dd->comm->master_cg_ddp_count)
{
}
else
{
- ibuf = NULL;
+ ibuf = nullptr;
}
/* Collect the charge group and atom counts on the master */
dd_gather(dd, 2*sizeof(int), buf2, ibuf);
/* Collect the charge group indices on the master */
dd_gatherv(dd,
ncg_home*sizeof(int), cg,
- DDMASTER(dd) ? ma->ibuf : NULL,
- DDMASTER(dd) ? ma->ibuf+dd->nnodes : NULL,
- DDMASTER(dd) ? ma->cg : NULL);
+ DDMASTER(dd) ? ma->ibuf : nullptr,
+ DDMASTER(dd) ? ma->ibuf+dd->nnodes : nullptr,
+ DDMASTER(dd) ? ma->cg : nullptr);
dd->comm->master_cg_ddp_count = state_local->ddp_count;
}
{
gmx_domdec_master_t *ma;
int n, i, c, a, nalloc = 0;
- rvec *buf = NULL;
+ rvec *buf = nullptr;
t_block *cgs_gl;
ma = dd->ma;
const rvec *lv, rvec *v)
{
gmx_domdec_master_t *ma;
- int *rcounts = NULL, *disps = NULL;
+ int *rcounts = nullptr, *disps = nullptr;
int n, i, c, a;
- rvec *buf = NULL;
+ rvec *buf = nullptr;
t_block *cgs_gl;
ma = dd->ma;
}
}
- if (f != NULL)
+ if (f != nullptr)
{
(*f).resize(natoms + 1);
}
{
gmx_domdec_master_t *ma;
int n, i, c, a, nalloc = 0;
- rvec *buf = NULL;
+ rvec *buf = nullptr;
if (DDMASTER(dd))
{
rvec *v, rvec *lv)
{
gmx_domdec_master_t *ma;
- int *scounts = NULL, *disps = NULL;
+ int *scounts = nullptr, *disps = nullptr;
int n, i, c, a;
- rvec *buf = NULL;
+ rvec *buf = nullptr;
if (DDMASTER(dd))
{
static void dd_distribute_dfhist(gmx_domdec_t *dd, df_history_t *dfhist)
{
- if (dfhist == NULL)
+ if (dfhist == nullptr)
{
return;
}
copy_mat(state->boxv, state_local->boxv);
copy_mat(state->svir_prev, state_local->svir_prev);
copy_mat(state->fvir_prev, state_local->fvir_prev);
- if (state->dfhist != NULL)
+ if (state->dfhist != nullptr)
{
copy_df_history(state_local->dfhist, state->dfhist);
}
static void write_dd_grid_pdb(const char *fn, gmx_int64_t step,
gmx_domdec_t *dd, matrix box, gmx_ddbox_t *ddbox)
{
- rvec grid_s[2], *grid_r = NULL, cx, r;
+ rvec grid_s[2], *grid_r = nullptr, cx, r;
char fname[STRLEN], buf[22];
FILE *out;
int a, i, d, z, y, x;
snew(grid_r, 2*dd->nnodes);
}
- dd_gather(dd, 2*sizeof(rvec), grid_s, DDMASTER(dd) ? grid_r : NULL);
+ dd_gather(dd, 2*sizeof(rvec), grid_s, DDMASTER(dd) ? grid_r : nullptr);
if (DDMASTER(dd))
{
/* This assumes DD cells with identical x coordinates
* are numbered sequentially.
*/
- if (dd->comm->pmenodes == NULL)
+ if (dd->comm->pmenodes == nullptr)
{
if (sim_nodeid < dd->nnodes)
{
void get_pme_nnodes(const gmx_domdec_t *dd,
int *npmenodes_x, int *npmenodes_y)
{
- if (dd != NULL)
+ if (dd != nullptr)
{
*npmenodes_x = dd->comm->npmenodes_x;
*npmenodes_y = dd->comm->npmenodes_y;
int *cginfo;
int cg;
- if (fr != NULL)
+ if (fr != nullptr)
{
cginfo_mb = fr->cginfo_mb;
cginfo = fr->cginfo;
}
}
- if (bLocalCG != NULL)
+ if (bLocalCG != nullptr)
{
for (cg = cg0; cg < cg1; cg++)
{
int i, ngl, nerr;
nerr = 0;
- if (bLocalCG == NULL)
+ if (bLocalCG == nullptr)
{
return nerr;
}
{
cellsize_min[d] = ddbox->box_size[d]*ddbox->skew_fac[d];
npulse[d] = 1;
- if (dd->nc[d] == 1 || comm->slb_frac[d] == NULL)
+ if (dd->nc[d] == 1 || comm->slb_frac[d] == nullptr)
{
/* Uniform grid */
cell_dx = ddbox->box_size[d]/dd->nc[d];
for (d = 0; d < comm->npmedecompdim; d++)
{
set_pme_maxshift(dd, &comm->ddpme[d],
- comm->slb_frac[dd->dim[d]] == NULL, ddbox,
+ comm->slb_frac[dd->dim[d]] == nullptr, ddbox,
comm->ddpme[d].slb_dim_f);
}
}
srenew(cd->ind, np);
for (i = cd->np_nalloc; i < np; i++)
{
- cd->ind[i].index = NULL;
+ cd->ind[i].index = nullptr;
cd->ind[i].nalloc = 0;
}
cd->np_nalloc = np;
gmx_domdec_t *dd)
{
gmx_domdec_master_t *ma;
- int **tmp_ind = NULL, *tmp_nalloc = NULL;
+ int **tmp_ind = nullptr, *tmp_nalloc = nullptr;
int i, icg, j, k, k0, k1, d;
matrix tcm;
rvec cg_cm;
t_block *cgs, matrix box, gmx_ddbox_t *ddbox,
rvec pos[])
{
- gmx_domdec_master_t *ma = NULL;
+ gmx_domdec_master_t *ma = nullptr;
ivec npulse;
int i, cg_gl;
int *ibuf, buf2[2] = { 0, 0 };
}
else
{
- ibuf = NULL;
+ ibuf = nullptr;
}
dd_scatter(dd, 2*sizeof(int), ibuf, buf2);
}
dd_scatterv(dd,
- bMaster ? ma->ibuf : NULL,
- bMaster ? ma->ibuf+dd->nnodes : NULL,
- bMaster ? ma->cg : NULL,
+ bMaster ? ma->ibuf : nullptr,
+ bMaster ? ma->ibuf+dd->nnodes : nullptr,
+ bMaster ? ma->cg : nullptr,
dd->ncg_home*sizeof(int), dd->index_gl);
/* Determine the home charge group sizes */
gmx_bool bV = FALSE, bCGP = FALSE;
real pos_d;
matrix tcm;
- rvec *cg_cm = NULL, cell_x0, cell_x1, limitd, limit0, limit1;
+ rvec *cg_cm = nullptr, cell_x0, cell_x1, limitd, limit0, limit1;
int *cgindex;
cginfo_mb_t *cginfo_mb;
gmx_domdec_comm_t *comm;
* for the normal loops and again half it for water loops.
*/
name = nrnb_str(i);
- if (strstr(name, "W3") != NULL || strstr(name, "W4") != NULL)
+ if (strstr(name, "W3") != nullptr || strstr(name, "W4") != nullptr)
{
sum += nrnb->n[i]*0.25*cost_nrnb(i);
}
for (i = eNR_NBKERNEL_FREE_ENERGY; i <= eNR_NB14; i++)
{
name = nrnb_str(i);
- if (strstr(name, "W3") != NULL || strstr(name, "W4") != NULL)
+ if (strstr(name, "W3") != nullptr || strstr(name, "W4") != nullptr)
{
sum += nrnb->n[i]*cost_nrnb(i);
}
{
gmx_domdec_comm_t *comm;
domdec_load_t *load;
- domdec_root_t *root = NULL;
+ domdec_root_t *root = nullptr;
int d, dim, i, pos;
float cell_frac = 0, sbuf[DD_NLOAD_MAX];
gmx_bool bSepPME;
if (dd->nnodes <= GMX_DD_NNODES_SENDRECV)
{
- ma->vbuf = NULL;
+ ma->vbuf = nullptr;
}
else
{
* Real reordering is only supported on very few architectures,
* Blue Gene is one of them.
*/
- CartReorder = (getenv("GMX_NO_CART_REORDER") == NULL);
+ CartReorder = (getenv("GMX_NO_CART_REORDER") == nullptr);
if (cr->npmenodes > 0)
{
int i, n;
double dbl;
- slb_frac = NULL;
- if (nc > 1 && size_string != NULL)
+ slb_frac = nullptr;
+ if (nc > 1 && size_string != nullptr)
{
if (fplog)
{
int dim;
dd->ndim = 0;
- if (getenv("GMX_DD_ORDER_ZYX") != NULL)
+ if (getenv("GMX_DD_ORDER_ZYX") != nullptr)
{
/* Decomposition order z,y,x */
if (fplog)
}
comm->nalloc_int = 0;
- comm->buf_int = NULL;
+ comm->buf_int = nullptr;
vec_rvec_init(&comm->vbuf);
dd->bScrewPBC = (ir->ePBC == epbcSCREW);
dd->pme_recv_f_alloc = 0;
- dd->pme_recv_f_buf = NULL;
+ dd->pme_recv_f_buf = nullptr;
/* Initialize to GPU share count to 0, might change later */
comm->nrank_gpu_shared = 0;
}
else
{
- set_ddbox_cr(cr, NULL, ir, box, &comm->cgs_gl, x, ddbox);
+ set_ddbox_cr(cr, nullptr, ir, box, &comm->cgs_gl, x, ddbox);
/* We need to choose the optimal DD grid and possibly PME nodes */
real limit =
*/
if (dd->ndim >= 2 && dd->dim[0] == XX && dd->dim[1] == YY &&
comm->npmenodes > dd->nc[XX] && comm->npmenodes % dd->nc[XX] == 0 &&
- getenv("GMX_PMEONEDD") == NULL)
+ getenv("GMX_PMEONEDD") == nullptr)
{
comm->npmedecompdim = 2;
comm->npmenodes_x = dd->nc[XX];
else
{
/* Only communicate atoms based on cut-off */
- comm->cglink = NULL;
- comm->bLocalCG = NULL;
+ comm->cglink = nullptr;
+ comm->bLocalCG = nullptr;
}
}
real limit, shrink;
char buf[64];
- if (fplog == NULL)
+ if (fplog == nullptr)
{
return;
}
real r_comm2, r_bcomm2;
dd_corners_t corners;
ivec tric_dist;
- rvec *cg_cm, *normal, *v_d, *v_0 = NULL, *v_1 = NULL, *recv_vr;
+ rvec *cg_cm, *normal, *v_d, *v_0 = nullptr, *v_1 = nullptr, *recv_vr;
real skew_fac2_d, skew_fac_01;
rvec sf2_round;
int nsend, nat;
break;
default:
gmx_incons("unimplemented");
- cg_cm = NULL;
+ cg_cm = nullptr;
}
for (dim_ind = 0; dim_ind < dd->ndim; dim_ind++)
* So we pass NULL for the forcerec.
*/
dd_set_cginfo(dd->index_gl, dd->ncg_home, dd->ncg_tot,
- NULL, comm->bLocalCG);
+ nullptr, comm->bLocalCG);
}
if (debug)
{
int a, atot, cg, cg0, cg1, i;
- if (cgindex == NULL)
+ if (cgindex == nullptr)
{
/* Avoid the useless loop of the atoms within a cg */
order_vec_cg(ncg, sort, v, buf);
}
else
{
- cgindex = NULL;
+ cgindex = nullptr;
}
/* Remove the charge groups which are no longer at home here */
gmx_sumd(ddnatNR-ddnatZONE, comm->sum_nat, cr);
- if (fplog == NULL)
+ if (fplog == nullptr)
{
return;
}
comm->zones.dens_zone0,
fr->cginfo,
as_rvec_array(state_local->x.data()),
- ncg_moved, bRedist ? comm->moved : NULL,
+ ncg_moved, bRedist ? comm->moved : nullptr,
fr->nbv->grp[eintLocal].kernel_type,
fr->nbv->grp[eintLocal].nbat);
/* Update atom data for mdatoms and several algorithms */
mdAlgorithmsSetupAtomData(cr, ir, top_global, top_local, fr,
- NULL, mdatoms, vsite, NULL);
+ nullptr, mdatoms, vsite, nullptr);
if (ir->implicit_solvent)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,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.
}
}
- if (cr_sum != NULL)
+ if (cr_sum != nullptr)
{
for (d = 0; d < DIM; d++)
{
if (box[j][d] != 0)
{
ddbox->tric_dir[d] = 1;
- if (dd_nc != NULL && (*dd_nc)[j] > 1 && (*dd_nc)[d] == 1)
+ if (dd_nc != nullptr && (*dd_nc)[j] > 1 && (*dd_nc)[d] == 1)
{
gmx_fatal(FARGS, "Domain decomposition has not been implemented for box vectors that have non-zero components in directions that do not use domain decomposition: ncells = %d %d %d, box vector[%d] = %f %f %f",
(*dd_nc)[XX], (*dd_nc)[YY], (*dd_nc)[ZZ],
{
low_set_ddbox(ir, &dd->nc, box, bCalcUnboundedSize,
bMasterState ? cgs->nr : dd->ncg_home, cgs, x,
- bMasterState ? NULL : cr_sum,
+ bMasterState ? nullptr : cr_sum,
ddbox);
}
{
if (MASTER(cr))
{
- low_set_ddbox(ir, dd_nc, box, TRUE, cgs->nr, cgs, x, NULL, ddbox);
+ low_set_ddbox(ir, dd_nc, box, TRUE, cgs->nr, cgs, x, nullptr, ddbox);
}
gmx_bcast(sizeof(gmx_ddbox_t), ddbox, cr);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2006,2007,2008,2009,2010,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2006,2007,2008,2009,2010,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.
}
else
{
- return NULL;
+ return nullptr;
}
}
{
int a_gl = dd->gatindex[a];
int a_mol;
- mtopGetMolblockIndex(mtop, a_gl, &mb, NULL, &a_mol);
+ mtopGetMolblockIndex(mtop, a_gl, &mb, nullptr, &a_mol);
const gmx_molblock_t *molb = &mtop->molblock[mb];
int settle = at2settle_mt[molb->type][a_mol];
else
{
// Currently unreachable
- at2con_mt = NULL;
- ireq = NULL;
+ at2con_mt = nullptr;
+ ireq = nullptr;
}
if (dd->bInterCGsettles)
else
{
/* Settle works inside charge groups, we assigned them already */
- at2settle_mt = NULL;
+ at2settle_mt = nullptr;
}
- if (at2settle_mt == NULL)
+ if (at2settle_mt == nullptr)
{
atoms_to_constraints(dd, mtop, cginfo, at2con_mt, nrec,
ilc_local, ireq);
/* Do the constraints, if present, on the first thread.
* Do the settles on all other threads.
*/
- t0_set = ((at2con_mt != NULL && dc->nthread > 1) ? 1 : 0);
+ t0_set = ((at2con_mt != nullptr && dc->nthread > 1) ? 1 : 0);
#pragma omp parallel for num_threads(dc->nthread) schedule(static)
for (thread = 0; thread < dc->nthread; thread++)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2008,2009,2010,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.
* we can save some time (e.g. 3D DD with pbc=xyz).
* Here we ignore SIMD bondeds as they always do (fast) PBC.
*/
- count_bonded_distances(mtop, ir, &pbcdxr, NULL);
+ count_bonded_distances(mtop, ir, &pbcdxr, nullptr);
pbcdxr /= (double)mtop->natoms;
}
else
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2006,2007,2008,2009,2010,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2006,2007,2008,2009,2010,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.
spas = &spac->spas[d][dir];
/* Sum the buffer into the required forces */
- if (!bPBC || (!bScrew && fshift == NULL))
+ if (!bPBC || (!bScrew && fshift == nullptr))
{
for (i = 0; i < spas->nsend; i++)
{
rvec shift = {0, 0, 0};
nvec = 1;
- if (x1 != NULL)
+ if (x1 != nullptr)
{
nvec++;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2006,2007,2008,2009,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.
snew(count, nat_mt);
low_make_reverse_ilist(ilist, atoms->atom, vsite_pbc,
count,
- bConstr, bSettle, bBCheck, NULL, NULL,
+ bConstr, bSettle, bBCheck, nullptr, nullptr,
bLinkToAllAtoms, FALSE);
snew(ril_mt->index, nat_mt+1);
/* Make the atom to interaction list for this molecule type */
nint_mt[mt] =
make_reverse_ilist(molt->ilist, &molt->atoms,
- vsite_pbc_molt ? vsite_pbc_molt[mt] : NULL,
+ vsite_pbc_molt ? vsite_pbc_molt[mt] : nullptr,
rt->bConstr, rt->bSettle, rt->bBCheck, FALSE,
&rt->ril_mt[mt]);
{
t_atoms atoms_global;
- rt->ril_intermol.index = NULL;
- rt->ril_intermol.il = NULL;
+ rt->ril_intermol.index = nullptr;
+ rt->ril_intermol.il = nullptr;
atoms_global.nr = mtop->natoms;
- atoms_global.atom = NULL; /* Only used with virtual sites */
+ atoms_global.atom = nullptr; /* Only used with virtual sites */
*nint +=
make_reverse_ilist(mtop->intermolecular_ilist, &atoms_global,
- NULL,
+ nullptr,
rt->bConstr, rt->bSettle, rt->bBCheck, FALSE,
&rt->ril_intermol);
}
rt->nthread = gmx_omp_nthreads_get(emntDomdec);
snew(rt->th_work, rt->nthread);
- if (vsite_pbc_molt != NULL)
+ if (vsite_pbc_molt != nullptr)
{
for (thread = 0; thread < rt->nthread; thread++)
{
*/
dd->reverse_top = make_reverse_top(mtop, ir->efep != efepNO,
- vsite ? vsite->vsite_pbc_molt : NULL,
+ vsite ? vsite->vsite_pbc_molt : nullptr,
!dd->bInterCGcons, !dd->bInterCGsettles,
bBCheck, &dd->nbonded_global);
int nral1 = 0, ftv = 0;
vpbc = ((interaction_function[ftype].flags & IF_VSITE) &&
- vsite->vsite_pbc_loc != NULL);
+ vsite->vsite_pbc_loc != nullptr);
if (vpbc)
{
nral1 = 1 + NRAL(ftype);
}
else
{
- vsite_pbc = NULL;
- vsite_pbc_nalloc = NULL;
+ vsite_pbc = nullptr;
+ vsite_pbc_nalloc = nullptr;
}
rt->th_work[thread].nbonded =
real rc = -1;
ivec rcheck;
int d, nexcl;
- t_pbc pbc, *pbc_null = NULL;
+ t_pbc pbc, *pbc_null = nullptr;
if (debug)
{
}
else
{
- pbc_null = NULL;
+ pbc_null = nullptr;
}
}
}
for (i = 0; i < F_NRE; i++)
{
- top->idef.il[i].iatoms = NULL;
+ top->idef.il[i].iatoms = nullptr;
top->idef.il[i].nalloc = 0;
}
top->idef.ilsort = ilsortUNKNOWN;
t_atoms atoms;
atoms.nr = mtop->natoms;
- atoms.atom = NULL;
+ atoms.atom = nullptr;
make_reverse_ilist(mtop->intermolecular_ilist, &atoms,
- NULL, FALSE, FALSE, FALSE, TRUE, &ril_intermol);
+ nullptr, FALSE, FALSE, FALSE, TRUE, &ril_intermol);
}
snew(link, 1);
snew(link->index, ncg_mtop(mtop)+1);
link->nalloc_a = 0;
- link->a = NULL;
+ link->a = nullptr;
link->index[0] = 0;
cg_offset = 0;
* The constraints are discarded here.
*/
make_reverse_ilist(molt->ilist, &molt->atoms,
- NULL, FALSE, FALSE, FALSE, TRUE, &ril);
+ nullptr, FALSE, FALSE, FALSE, TRUE, &ril);
cgi_mb = &cginfo_mb[mb];
if (ePBC != epbcNONE)
{
- mk_mshift(NULL, graph, ePBC, box, x);
+ mk_mshift(nullptr, graph, ePBC, box, x);
shift_x(graph, box, x, xs);
/* By doing an extra mk_mshift the molecules that are broken
* will be made whole again. Such are the healing powers
* of GROMACS.
*/
- mk_mshift(NULL, graph, ePBC, box, xs);
+ mk_mshift(nullptr, graph, ePBC, box, xs);
}
else
{
if (vsite)
{
- construct_vsites(vsite, xs, 0.0, NULL,
+ construct_vsites(vsite, xs, 0.0, nullptr,
ffparams->iparams, molt->ilist,
- epbcNONE, TRUE, NULL, NULL);
+ epbcNONE, TRUE, nullptr, nullptr);
}
- calc_cgcm(NULL, 0, molt->cgs.nr, &molt->cgs, xs, cg_cm);
+ calc_cgcm(nullptr, 0, molt->cgs.nr, &molt->cgs, xs, cg_cm);
}
//! Returns whether \p molt has a virtual site
bExclRequired = inputrecExclForces(ir);
- vsite = init_vsite(mtop, NULL, TRUE);
+ vsite = init_vsite(mtop, nullptr, TRUE);
*r_2b = 0;
*r_mb = 0;
{
if (ir->ePBC != epbcNONE)
{
- mk_graph_ilist(NULL, molt->ilist, 0, molt->atoms.nr, FALSE, FALSE,
+ mk_graph_ilist(nullptr, molt->ilist, 0, molt->atoms.nr, FALSE, FALSE,
&graph);
}
for (mol = 0; mol < molb->nmol; mol++)
{
get_cgcm_mol(molt, &mtop->ffparams, ir->ePBC, &graph, box,
- have_vsite_molt(molt) ? vsite : NULL,
+ have_vsite_molt(molt) ? vsite : nullptr,
x+at_offset, xs, cg_cm);
bonded_distance_t bd_mol_2b = { 0, -1, -1, -1 };
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2006,2007,2008,2009,2010,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2006,2007,2008,2009,2010,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.
{
if (dd->vsite_comm)
{
- dd_move_x_specat(dd, dd->vsite_comm, box, x, NULL, FALSE);
+ dd_move_x_specat(dd, dd->vsite_comm, box, x, nullptr, FALSE);
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
hash->nalloc = over_alloc_dd(hash->mod);
srenew(hash->hash, hash->nalloc);
- if (debug != NULL)
+ if (debug != nullptr)
{
fprintf(debug, "Hash table mod %d nalloc %d\n", hash->mod, hash->nalloc);
}
if (hash->nkey > 0 &&
(4*hash->nkey < hash->mod || 3*hash->nkey > 2*hash->mod))
{
- if (debug != NULL)
+ if (debug != nullptr)
{
fprintf(debug, "Hash table size %d #key %d: resizing\n",
hash->mod, hash->nkey);
gmx_hash_t *hash;
snew(hash, 1);
- hash->hash = NULL;
+ hash->hash = nullptr;
gmx_hash_realloc(hash, nkey_used_estimate);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
struct t_do_edfit *loc;
gmx_bool bFirst;
- if (edi->buf->do_edfit != NULL)
+ if (edi->buf->do_edfit != nullptr)
{
bFirst = FALSE;
}
/* Allocate space for the ED data structure */
snew(ed, 1);
- if (*EDstatePtr == NULL)
+ if (*EDstatePtr == nullptr)
{
snew(*EDstatePtr, 1);
}
eof = fgets2 (line, STRLEN, file);
- if (eof == NULL)
+ if (eof == nullptr)
{
*bEOF = TRUE;
return -1;
}
eof = fgets2 (line, STRLEN, file);
- if (eof == NULL)
+ if (eof == nullptr)
{
*bEOF = TRUE;
return -1;
snew(edi->sref.anrs, edi->sref.nr);
snew(edi->sref.x, edi->sref.nr);
snew(edi->sref.x_old, edi->sref.nr);
- edi->sref.sqrtm = NULL;
+ edi->sref.sqrtm = nullptr;
read_edx(in, edi->sref.nr, edi->sref.anrs, edi->sref.x);
/* average positions. they define which atoms will be used for ED sampling */
{
snew(edi->star.anrs, edi->star.nr);
snew(edi->star.x, edi->star.nr);
- edi->star.sqrtm = NULL;
+ edi->star.sqrtm = nullptr;
read_edx(in, edi->star.nr, edi->star.anrs, edi->star.x);
}
}
snew(edi->sori.anrs, edi->sori.nr);
snew(edi->sori.x, edi->sori.nr);
- edi->sori.sqrtm = NULL;
+ edi->sori.sqrtm = nullptr;
read_edx(in, edi->sori.nr, edi->sori.anrs, edi->sori.x);
}
}
/* Terminate the edi group list with a NULL pointer: */
- last_edi->next_edi = NULL;
+ last_edi->next_edi = nullptr;
fprintf(stderr, "ED: Found %d ED group%s.\n", edi_nr, edi_nr > 1 ? "s" : "");
/* Allocate memory the first time this routine is called for each edi group */
- if (NULL == edi->buf->fit_to_ref)
+ if (nullptr == edi->buf->fit_to_ref)
{
snew(edi->buf->fit_to_ref, 1);
snew(edi->buf->fit_to_ref->xcopy, edi->sref.nr);
rvec vec_dum;
- if (edi->buf->do_radcon != NULL)
+ if (edi->buf->do_radcon != nullptr)
{
bFirst = FALSE;
}
int i;
- if (NULL == floodvecs->refproj0)
+ if (nullptr == floodvecs->refproj0)
{
snew(floodvecs->refproj0, floodvecs->neig);
}
* groups of the checkpoint file are consistent with the provided .edi file. */
static void crosscheck_edi_file_vs_checkpoint(gmx_edsam_t ed, edsamstate_t *EDstate)
{
- t_edpar *edi = NULL; /* points to a single edi data set */
+ t_edpar *edi = nullptr; /* points to a single edi data set */
int edinum;
- if (NULL == EDstate->nref || NULL == EDstate->nav)
+ if (nullptr == EDstate->nref || nullptr == EDstate->nav)
{
gmx_fatal(FARGS, "Essential dynamics and flooding can only be switched on (or off) at the\n"
"start of a new simulation. If a simulation runs with/without ED constraints,\n"
edi = ed->edpar;
edinum = 0;
- while (edi != NULL)
+ while (edi != nullptr)
{
/* Check number of atoms in the reference and average structures */
if (EDstate->nref[edinum] != edi->sref.nr)
/* Makes a legend for the xvg output file. Call on MASTER only! */
static void write_edo_legend(gmx_edsam_t ed, int nED, const gmx_output_env_t *oenv)
{
- t_edpar *edi = NULL;
+ t_edpar *edi = nullptr;
int i;
int nr_edi, nsets, n_flood, n_edsam;
const char **setname;
char buf[STRLEN];
- char *LegendStr = NULL;
+ char *LegendStr = nullptr;
edi = ed->edpar;
matrix box,
edsamstate_t *EDstate)
{
- t_edpar *edi = NULL; /* points to a single edi data set */
+ t_edpar *edi = nullptr; /* points to a single edi data set */
int i, nr_edi, avindex;
- rvec *x_pbc = NULL; /* positions of the whole MD system with pbc removed */
- rvec *xfit = NULL, *xstart = NULL; /* dummy arrays to determine initial RMSDs */
- rvec fit_transvec; /* translation ... */
- matrix fit_rotmat; /* ... and rotation from fit to reference structure */
- rvec *ref_x_old = NULL; /* helper pointer */
+ rvec *x_pbc = nullptr; /* positions of the whole MD system with pbc removed */
+ rvec *xfit = nullptr, *xstart = nullptr; /* dummy arrays to determine initial RMSDs */
+ rvec fit_transvec; /* translation ... */
+ matrix fit_rotmat; /* ... and rotation from fit to reference structure */
+ rvec *ref_x_old = nullptr; /* helper pointer */
if (MASTER(cr))
{
fprintf(stderr, "ED: Initializing essential dynamics constraints.\n");
- if (NULL == ed)
+ if (nullptr == ed)
{
gmx_fatal(FARGS, "The checkpoint file you provided is from an essential dynamics or\n"
"flooding simulation. Please also provide the correct .edi file with -ei.\n");
* as well, but will be done in the order given in the edi file, so
* expect different results for different order of edi file concatenation! */
edi = ed->edpar;
- while (edi != NULL)
+ while (edi != nullptr)
{
init_edi(mtop, edi);
init_flood(edi, ed, ir->delta_t);
/* Remove PBC, make molecule(s) subject to ED whole. */
snew(x_pbc, mtop->natoms);
copy_rvecn(x, x_pbc, 0, mtop->natoms);
- do_pbc_first_mtop(NULL, ir->ePBC, box, mtop, x_pbc);
+ do_pbc_first_mtop(nullptr, ir->ePBC, box, mtop, x_pbc);
}
/* Reset pointer to first ED data set which contains the actual ED data */
edi = ed->edpar;
/* Loop over all ED groups (usually one) */
edi = ed->edpar;
edinr = 0;
- while (edi != NULL)
+ while (edi != nullptr)
{
edinr++;
if (bNeedDoEdsam(edi))
/* dx is the ED correction to the positions: */
rvec_sub(x_unsh, xs[edi->sav.anrs_loc[i]], dx);
- if (v != NULL)
+ if (v != nullptr)
{
/* dv is the ED correction to the velocity: */
svmul(dt_1, dx, dv);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
(*et)->ny = ir->nky+1;
(*et)->nz = ir->nkz+1;
(*et)->kmax = std::max((*et)->nx, std::max((*et)->ny, (*et)->nz));
- (*et)->eir = NULL;
- (*et)->tab_xy = NULL;
- (*et)->tab_qxyz = NULL;
+ (*et)->eir = nullptr;
+ (*et)->tab_xy = nullptr;
+ (*et)->tab_qxyz = nullptr;
}
//! Calculates wave vectors.
real tmp, cs, ss, ak, akv, mx, my, mz, m2, scale;
gmx_bool bFreeEnergy;
- if (cr != NULL)
+ if (cr != nullptr)
{
if (PAR(cr))
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
grid->order = pme_order;
- if (ptr == NULL)
+ if (ptr == nullptr)
{
gridsize = grid->s[XX]*grid->s[YY]*grid->s[ZZ];
set_gridsize_alignment(&gridsize, pme_order);
}
env = getenv("GMX_PME_THREAD_DIVISION");
- if (env != NULL)
+ if (env != nullptr)
{
sscanf(env, "%20d %20d %20d", &nsub[XX], &nsub[YY], &nsub[ZZ]);
}
n_base[ZZ] = nz_base;
pmegrid_init(&grids->grid, 0, 0, 0, 0, 0, 0, n[XX], n[YY], n[ZZ], FALSE, pme_order,
- NULL);
+ nullptr);
grids->nthread = nthread;
}
else
{
- grids->grid_th = NULL;
+ grids->grid_th = nullptr;
}
snew(grids->g2t, DIM);
{
grids->nthread_comm[d]++;
}
- if (debug != NULL)
+ if (debug != nullptr)
{
fprintf(debug, "pmegrid thread grid communication range in %c: %d\n",
'x'+d, grids->nthread_comm[d]);
void pmegrids_destroy(pmegrids_t *grids)
{
- if (grids->grid.grid != NULL)
+ if (grids->grid.grid != nullptr)
{
sfree_aligned(grids->grid.grid);
sfree_aligned(newgrid->grid.grid);
newgrid->grid.grid = oldgrid->grid.grid;
- if (newgrid->grid_th != NULL && newgrid->nthread == oldgrid->nthread)
+ if (newgrid->grid_th != nullptr && newgrid->nthread == oldgrid->nthread)
{
sfree_aligned(newgrid->grid_all);
newgrid->grid_all = oldgrid->grid_all;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
* read bActive anywhere */
bool pme_loadbal_is_active(const pme_load_balancing_t *pme_lb)
{
- return pme_lb != NULL && pme_lb->bActive;
+ return pme_lb != nullptr && pme_lb->bActive;
}
void pme_loadbal_init(pme_load_balancing_t **pme_lb_p,
pme_lb->n++;
srenew(pme_lb->setup, pme_lb->n);
set = &pme_lb->setup[pme_lb->n-1];
- set->pmedata = NULL;
+ set->pmedata = nullptr;
get_pme_nnodes(dd, &npmeranks_x, &npmeranks_y);
fac *= 1.01;
clear_ivec(set->grid);
- sp = calc_grid(NULL, pme_lb->box_start,
+ sp = calc_grid(nullptr, pme_lb->box_start,
fac*pme_lb->setup[pme_lb->cur].spacing,
&set->grid[XX],
&set->grid[YY],
pre,
desc, set->grid[XX], set->grid[YY], set->grid[ZZ], set->rcut_coulomb,
buft);
- if (fp_err != NULL)
+ if (fp_err != nullptr)
{
fprintf(fp_err, "\r%s\n", buf);
fflush(fp_err);
}
- if (fp_log != NULL)
+ if (fp_log != nullptr)
{
fprintf(fp_log, "%s\n", buf);
}
gmx_step_str(step, sbuf),
pmelblim_str[pme_lb->elimited],
pme_lb->setup[pme_loadbal_end(pme_lb)-1].rcut_coulomb);
- if (fp_err != NULL)
+ if (fp_err != nullptr)
{
fprintf(fp_err, "\r%s\n", buf);
fflush(fp_err);
}
- if (fp_log != NULL)
+ if (fp_log != nullptr)
{
fprintf(fp_log, "%s\n", buf);
}
}
/* We always re-initialize the tables whether they are used or not */
- init_interaction_const_tables(NULL, ic, rtab);
+ init_interaction_const_tables(nullptr, ic, rtab);
nbnxn_gpu_pme_loadbal_update_param(nbv, ic);
if (!pme_lb->bSepPMERanks)
{
- if (pme_lb->setup[pme_lb->cur].pmedata == NULL)
+ if (pme_lb->setup[pme_lb->cur].pmedata == nullptr)
{
/* Generate a new PME data structure,
* copying part of the old pointers.
if (debug)
{
- print_grid(NULL, debug, "", "switched to", set, -1);
+ print_grid(nullptr, debug, "", "switched to", set, -1);
}
if (pme_lb->stage == pme_lb->nstage)
if (ir->eDispCorr != edispcNO)
{
- calc_enervirdiff(NULL, ir->eDispCorr, fr);
+ calc_enervirdiff(nullptr, ir->eDispCorr, fr);
}
}
const gmx::MDLogger &mdlog,
gmx_bool bNonBondedOnGPU)
{
- if (fplog != NULL && (pme_lb->cur > 0 || pme_lb->elimited != epmelblimNO))
+ if (fplog != nullptr && (pme_lb->cur > 0 || pme_lb->elimited != epmelblimNO))
{
print_pme_loadbal_settings(pme_lb, fplog, mdlog, bNonBondedOnGPU);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
struct gmx_pme_t **pme_ret)
{
int ind;
- struct gmx_pme_t *pme = NULL;
+ struct gmx_pme_t *pme = nullptr;
ind = 0;
while (ind < *npmedata)
int ret;
int natoms;
matrix box;
- rvec *x_pp = NULL, *f_pp = NULL;
- real *chargeA = NULL, *chargeB = NULL;
- real *c6A = NULL, *c6B = NULL;
- real *sigmaA = NULL, *sigmaB = NULL;
+ rvec *x_pp = nullptr, *f_pp = nullptr;
+ real *chargeA = nullptr, *chargeB = nullptr;
+ real *c6A = nullptr, *c6B = nullptr;
+ real *sigmaA = nullptr, *sigmaB = nullptr;
real lambda_q = 0;
real lambda_lj = 0;
int maxshift_x = 0, maxshift_y = 0;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
if (dd->pme_receive_vir_ener)
{
/* Peer PP node: communicate all data */
- if (dd->cnb == NULL)
+ if (dd->cnb == nullptr)
{
snew(dd->cnb, 1);
}
gmx_pme_send_coeffs_coords(cr, flags,
chargeA, chargeB,
sqrt_c6A, sqrt_c6B, sigmaA, sigmaB,
- NULL, NULL, 0, 0, maxshift_x, maxshift_y, -1);
+ nullptr, nullptr, 0, 0, maxshift_x, maxshift_y, -1);
}
void gmx_pme_send_coordinates(t_commrec *cr, matrix box, rvec *x,
{
flags |= PP_PME_ENER_VIR;
}
- gmx_pme_send_coeffs_coords(cr, flags, NULL, NULL, NULL, NULL, NULL, NULL,
+ gmx_pme_send_coeffs_coords(cr, flags, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr,
box, x, lambda_q, lambda_lj, 0, 0, step);
}
{
unsigned int flags = PP_PME_FINISH;
- gmx_pme_send_coeffs_coords(cr, flags, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0, 0, 0, 0, -1);
+ gmx_pme_send_coeffs_coords(cr, flags, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, 0, 0, 0, 0, -1);
}
void gmx_pme_send_switchgrid(t_commrec gmx_unused *cr,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
free_work(&(*work)[thread]);
}
sfree(*work);
- *work = NULL;
+ *work = nullptr;
}
void get_pme_ener_vir_q(struct pme_solve_work_t *work, int nthread,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int nx, ny, nz;
int *g2tx, *g2ty, *g2tz;
gmx_bool bThreads;
- int *thread_idx = NULL;
- thread_plist_t *tpl = NULL;
- int *tpl_n = NULL;
+ int *thread_idx = nullptr;
+ thread_plist_t *tpl = nullptr;
+ int *tpl_n = nullptr;
int thread_i;
nx = pme->nkx;
int thread_f;
const pmegrid_t *pmegrid, *pmegrid_g, *pmegrid_f;
const real *grid_th;
- real *commbuf = NULL;
+ real *commbuf = nullptr;
gmx_parallel_3dfft_real_limits(pme->pfft_setup[grid_index],
local_fft_ndata,
sendptr = overlap->sendbuf + send_index0*local_fft_ndata[ZZ];
recvptr = overlap->recvbuf;
- if (debug != NULL)
+ if (debug != nullptr)
{
fprintf(debug, "PME fftgrid comm y %2d x %2d x %2d\n",
local_fft_ndata[XX], send_nindex, local_fft_ndata[ZZ]);
recvptr = overlap->recvbuf;
- if (debug != NULL)
+ if (debug != nullptr)
{
fprintf(debug, "PME fftgrid comm x %2d x %2d x %2d\n",
send_nindex, local_fft_ndata[YY], local_fft_ndata[ZZ]);
try
{
splinedata_t *spline;
- pmegrid_t *grid = NULL;
+ pmegrid_t *grid = nullptr;
/* make local bsplines */
- if (grids == NULL || !pme->bUseThreads)
+ if (grids == nullptr || !pme->bUseThreads)
{
spline = &atc->spline[0];
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
nkx/(double)nnodes_major, pme_order);
}
- if (bValidSettings != NULL)
+ if (bValidSettings != nullptr)
{
*bValidSettings = TRUE;
}
real ewaldcoeff_lj,
int nthread)
{
- struct gmx_pme_t *pme = NULL;
+ struct gmx_pme_t *pme = nullptr;
int use_threads, sum_use_threads, i;
ivec ndata;
}
snew(pme, 1);
- pme->sum_qgrid_tmp = NULL;
- pme->sum_qgrid_dd_tmp = NULL;
+ pme->sum_qgrid_tmp = nullptr;
+ pme->sum_qgrid_dd_tmp = nullptr;
pme->buf_nalloc = 0;
pme->nnodes = 1;
pme->nkx = ir->nkx;
pme->nky = ir->nky;
pme->nkz = ir->nkz;
- pme->bP3M = (ir->coulombtype == eelP3M_AD || getenv("GMX_PME_P3M") != NULL);
+ pme->bP3M = (ir->coulombtype == eelP3M_AD || getenv("GMX_PME_P3M") != nullptr);
pme->pme_order = ir->pme_order;
pme->ewaldcoeff_q = ewaldcoeff_q;
pme->ewaldcoeff_lj = ewaldcoeff_lj;
pme->nnodes_minor,
pme->bUseThreads,
TRUE,
- NULL);
+ nullptr);
if (pme->nnodes > 1)
{
pme_realloc_atomcomm_things(&pme->atc[0]);
}
- pme->lb_buf1 = NULL;
- pme->lb_buf2 = NULL;
+ pme->lb_buf1 = nullptr;
+ pme->lb_buf2 = nullptr;
pme->lb_buf_nalloc = 0;
pme_init_all_work(&pme->solve_work, pme->nthread, pme->nkx);
atc = &pme->atc_energy;
atc->nthread = 1;
- if (atc->spline == NULL)
+ if (atc->spline == nullptr)
{
snew(atc->spline, atc->nthread);
}
grid = &pme->pmegrid[PME_GRID_QA];
/* Only calculate the spline coefficients, don't actually spread */
- spread_on_grid(pme, atc, NULL, TRUE, FALSE, pme->fftgrid[PME_GRID_QA], FALSE, PME_GRID_QA);
+ spread_on_grid(pme, atc, nullptr, TRUE, FALSE, pme->fftgrid[PME_GRID_QA], FALSE, PME_GRID_QA);
*V = gather_energy_bsplines(pme, grid->grid.grid, atc);
}
{
int d, i, j, npme, grid_index, max_grid_index;
int n_d;
- pme_atomcomm_t *atc = NULL;
- pmegrids_t *pmegrid = NULL;
- real *grid = NULL;
+ pme_atomcomm_t *atc = nullptr;
+ pmegrids_t *pmegrid = nullptr;
+ real *grid = nullptr;
rvec *f_d;
- real *coefficient = NULL;
+ real *coefficient = nullptr;
real energy_AB[4];
matrix vir_AB[4];
real scale, lambda;
fprintf(debug, "PME: number of ranks = %d, rank = %d\n",
cr->nnodes, cr->nodeid);
fprintf(debug, "Grid = %p\n", (void*)grid);
- if (grid == NULL)
+ if (grid == nullptr)
{
gmx_fatal(FARGS, "No grid!");
}
/* Loop over A- and B-state if we are doing FEP */
for (fep_state = 0; fep_state < fep_states_lj; ++fep_state)
{
- real *local_c6 = NULL, *local_sigma = NULL, *RedistC6 = NULL, *RedistSigma = NULL;
+ real *local_c6 = nullptr, *local_sigma = nullptr, *RedistC6 = nullptr, *RedistSigma = nullptr;
if (pme->nnodes == 1)
{
- if (pme->lb_buf1 == NULL)
+ if (pme->lb_buf1 == nullptr)
{
pme->lb_buf_nalloc = pme->atc[0].n;
snew(pme->lb_buf1, pme->lb_buf_nalloc);
sfree(pme->sum_qgrid_dd_tmp);
sfree(*pmedata);
- *pmedata = NULL;
+ *pmedata = nullptr;
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
if ((*nx <= 0) || (*ny <= 0) || (*nz <= 0))
{
- if (NULL != fp)
+ if (nullptr != fp)
{
fprintf(fp, "Calculating fourier grid dimensions for%s%s%s\n",
*nx > 0 ? "" : " X", *ny > 0 ? "" : " Y", *nz > 0 ? "" : " Z");
*nx = n[XX];
*ny = n[YY];
*nz = n[ZZ];
- if (NULL != fp)
+ if (nullptr != fp)
{
fprintf(fp, "Using a fourier grid of %dx%dx%d, spacing %.3f %.3f %.3f\n",
*nx, *ny, *nz, spacing[XX], spacing[YY], spacing[ZZ]);
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 1991-2003 Erik Lindahl, David van der Spoel, University of Groningen.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_fft_flag flags)
{
gmx_many_fft_t fft;
- if (pfft == NULL)
+ if (pfft == nullptr)
{
gmx_fatal(FARGS, "Invalid opaque FFT datatype pointer.");
return EINVAL;
}
- *pfft = NULL;
+ *pfft = nullptr;
- if ( (fft = (gmx_many_fft_t)malloc(sizeof(struct gmx_many_fft))) == NULL)
+ if ( (fft = (gmx_many_fft_t)malloc(sizeof(struct gmx_many_fft))) == nullptr)
{
return ENOMEM;
}
gmx_fft_flag flags)
{
gmx_many_fft_t fft;
- if (pfft == NULL)
+ if (pfft == nullptr)
{
gmx_fatal(FARGS, "Invalid opaque FFT datatype pointer.");
return EINVAL;
}
- *pfft = NULL;
+ *pfft = nullptr;
- if ( (fft = (gmx_many_fft_t)malloc(sizeof(struct gmx_many_fft))) == NULL)
+ if ( (fft = (gmx_many_fft_t)malloc(sizeof(struct gmx_many_fft))) == nullptr)
{
return ENOMEM;
}
gmx_many_fft_destroy(gmx_fft_t fft)
{
gmx_many_fft_t mfft = (gmx_many_fft_t)fft;
- if (mfft != NULL)
+ if (mfft != nullptr)
{
- if (mfft->fft != NULL)
+ if (mfft->fft != nullptr)
{
gmx_fft_destroy(mfft->fft);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,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.
int P[2], bMaster, prank[2], i, t;
int rNG, rMG, rKG;
- int *N0 = 0, *N1 = 0, *M0 = 0, *M1 = 0, *K0 = 0, *K1 = 0, *oN0 = 0, *oN1 = 0, *oM0 = 0, *oM1 = 0, *oK0 = 0, *oK1 = 0;
- int N[3], M[3], K[3], pN[3], pM[3], pK[3], oM[3], oK[3], *iNin[3] = {0}, *oNin[3] = {0}, *iNout[3] = {0}, *oNout[3] = {0};
+ int *N0 = nullptr, *N1 = nullptr, *M0 = nullptr, *M1 = nullptr, *K0 = nullptr, *K1 = nullptr, *oN0 = nullptr, *oN1 = nullptr, *oM0 = nullptr, *oM1 = nullptr, *oK0 = nullptr, *oK1 = nullptr;
+ int N[3], M[3], K[3], pN[3], pM[3], pK[3], oM[3], oK[3], *iNin[3] = {nullptr}, *oNin[3] = {nullptr}, *iNout[3] = {nullptr}, *oNout[3] = {nullptr};
int C[3], rC[3], nP[2];
int lsize;
- t_complex *lin = 0, *lout = 0, *lout2 = 0, *lout3 = 0;
+ t_complex *lin = nullptr, *lout = nullptr, *lout2 = nullptr, *lout3 = nullptr;
fft5d_plan plan;
int s;
{
printf("FFT5D: FATAL: Datasize cannot be zero in any dimension\n");
}
- return 0;
+ return nullptr;
}
rNG = NG; rMG = MG; rKG = KG;
if ((flags&FFT5D_REALCOMPLEX) && !(flags&FFT5D_BACKWARD))
{
plan->p3d = FFTW(plan_guru_dft_r2c)(/*rank*/ 3, dims,
- /*howmany*/ 0, /*howmany_dims*/ 0,
+ /*howmany*/ 0, /*howmany_dims*/ nullptr,
(real*)lin, (FFTW(complex) *) lout,
/*flags*/ fftwflags);
}
else if ((flags&FFT5D_REALCOMPLEX) && (flags&FFT5D_BACKWARD))
{
plan->p3d = FFTW(plan_guru_dft_c2r)(/*rank*/ 3, dims,
- /*howmany*/ 0, /*howmany_dims*/ 0,
+ /*howmany*/ 0, /*howmany_dims*/ nullptr,
(FFTW(complex) *) lin, (real*)lout,
/*flags*/ fftwflags);
}
else
{
plan->p3d = FFTW(plan_guru_dft)(/*rank*/ 3, dims,
- /*howmany*/ 0, /*howmany_dims*/ 0,
+ /*howmany*/ 0, /*howmany_dims*/ nullptr,
(FFTW(complex) *) lin, (FFTW(complex) *) lout,
/*sign*/ (flags&FFT5D_BACKWARD) ? 1 : -1, /*flags*/ fftwflags);
}
if (plan->iNin[s])
{
free(plan->iNin[s]);
- plan->iNin[s] = 0;
+ plan->iNin[s] = nullptr;
}
if (plan->oNin[s])
{
free(plan->oNin[s]);
- plan->oNin[s] = 0;
+ plan->oNin[s] = nullptr;
}
if (plan->iNout[s])
{
free(plan->iNout[s]);
- plan->iNout[s] = 0;
+ plan->iNout[s] = nullptr;
}
if (plan->oNout[s])
{
free(plan->oNout[s]);
- plan->oNout[s] = 0;
+ plan->oNout[s] = nullptr;
}
}
#if GMX_FFT_FFTW3
of processor dimensions*/
fft5d_plan fft5d_plan_3d_cart(int NG, int MG, int KG, MPI_Comm comm, int P0, int flags, t_complex** rlin, t_complex** rlout, t_complex** rlout2, t_complex** rlout3, int nthreads)
{
- MPI_Comm cart[2] = {0};
+ MPI_Comm cart[2] = {MPI_COMM_NULL, MPI_COMM_NULL};
#if GMX_MPI
int size = 1, prank = 0;
int P[2];
* 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, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
gmx_fft_t fft;
- if (pfft == NULL)
+ if (pfft == nullptr)
{
gmx_fatal(FARGS, "Invalid FFT opaque type pointer.");
return EINVAL;
}
- *pfft = NULL;
+ *pfft = nullptr;
- if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == NULL)
+ if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == nullptr)
{
return ENOMEM;
}
- fft->next = NULL;
+ fft->next = nullptr;
fft->n = nx;
/* Need 4*n storage for 1D complex FFT */
- if ( (fft->work = (real *)malloc(sizeof(real)*(4*nx))) == NULL)
+ if ( (fft->work = (real *)malloc(sizeof(real)*(4*nx))) == nullptr)
{
free(fft);
return ENOMEM;
{
gmx_fft_t fft;
- if (pfft == NULL)
+ if (pfft == nullptr)
{
gmx_fatal(FARGS, "Invalid FFT opaque type pointer.");
return EINVAL;
}
- *pfft = NULL;
+ *pfft = nullptr;
- if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == NULL)
+ if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == nullptr)
{
return ENOMEM;
}
- fft->next = NULL;
+ fft->next = nullptr;
fft->n = nx;
/* Need 2*n storage for 1D real FFT */
- if ((fft->work = (real *)malloc(sizeof(real)*(2*nx))) == NULL)
+ if ((fft->work = (real *)malloc(sizeof(real)*(2*nx))) == nullptr)
{
free(fft);
return ENOMEM;
int nyc = (ny/2 + 1);
int rc;
- if (pfft == NULL)
+ if (pfft == nullptr)
{
gmx_fatal(FARGS, "Invalid FFT opaque type pointer.");
return EINVAL;
}
- *pfft = NULL;
+ *pfft = nullptr;
/* Create the X transform */
- if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == NULL)
+ if ( (fft = (struct gmx_fft *)malloc(sizeof(struct gmx_fft))) == nullptr)
{
return ENOMEM;
}
/* Need 4*nx storage for 1D complex FFT, and another
* 2*nx*nyc elements for complex-to-real storage in our high-level routine.
*/
- if ( (fft->work = (real *)malloc(sizeof(real)*(4*nx+2*nx*nyc))) == NULL)
+ if ( (fft->work = (real *)malloc(sizeof(real)*(4*nx+2*nx*nyc))) == nullptr)
{
free(fft);
return ENOMEM;
void
gmx_fft_destroy(gmx_fft_t fft)
{
- if (fft != NULL)
+ if (fft != nullptr)
{
free(fft->work);
- if (fft->next != NULL)
+ if (fft->next != nullptr)
{
gmx_fft_destroy(fft->next);
}
* 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, by the GROMACS development team, led by
+ * Copyright (c) 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.
fftw_flags = (flags & GMX_FFT_FLAG_CONSERVATIVE) ? FFTW_ESTIMATE : FFTW_MEASURE;
- if (pfft == NULL)
+ if (pfft == nullptr)
{
gmx_fatal(FARGS, "Invalid opaque FFT datatype pointer.");
return EINVAL;
}
- *pfft = NULL;
+ *pfft = nullptr;
FFTW_LOCK;
- if ( (fft = (gmx_fft_t)FFTWPREFIX(malloc)(sizeof(struct gmx_fft))) == NULL)
+ if ( (fft = (gmx_fft_t)FFTWPREFIX(malloc)(sizeof(struct gmx_fft))) == nullptr)
{
FFTW_UNLOCK;
return ENOMEM;
/* allocate aligned, and extra memory to make it unaligned */
p1 = (FFTWPREFIX(complex) *) FFTWPREFIX(malloc)(sizeof(FFTWPREFIX(complex))*(nx+2)*howmany);
- if (p1 == NULL)
+ if (p1 == nullptr)
{
FFTWPREFIX(free)(fft);
FFTW_UNLOCK;
}
p2 = (FFTWPREFIX(complex) *) FFTWPREFIX(malloc)(sizeof(FFTWPREFIX(complex))*(nx+2)*howmany);
- if (p2 == NULL)
+ if (p2 == nullptr)
{
FFTWPREFIX(free)(p1);
FFTWPREFIX(free)(fft);
{
for (k = 0; k < 2; k++)
{
- if (fft->plan[i][j][k] == NULL)
+ if (fft->plan[i][j][k] == nullptr)
{
gmx_fatal(FARGS, "Error initializing FFTW3 plan.");
FFTW_UNLOCK;
fftw_flags = (flags & GMX_FFT_FLAG_CONSERVATIVE) ? FFTW_ESTIMATE : FFTW_MEASURE;
- if (pfft == NULL)
+ if (pfft == nullptr)
{
gmx_fatal(FARGS, "Invalid opaque FFT datatype pointer.");
return EINVAL;
}
- *pfft = NULL;
+ *pfft = nullptr;
FFTW_LOCK;
- if ( (fft = (gmx_fft_t) FFTWPREFIX(malloc)(sizeof(struct gmx_fft))) == NULL)
+ if ( (fft = (gmx_fft_t) FFTWPREFIX(malloc)(sizeof(struct gmx_fft))) == nullptr)
{
FFTW_UNLOCK;
return ENOMEM;
/* allocate aligned, and extra memory to make it unaligned */
p1 = (real *) FFTWPREFIX(malloc)(sizeof(real)*(nx/2+1)*2*howmany + 8);
- if (p1 == NULL)
+ if (p1 == nullptr)
{
FFTWPREFIX(free)(fft);
FFTW_UNLOCK;
}
p2 = (real *) FFTWPREFIX(malloc)(sizeof(real)*(nx/2+1)*2*howmany + 8);
- if (p2 == NULL)
+ if (p2 == nullptr)
{
FFTWPREFIX(free)(p1);
FFTWPREFIX(free)(fft);
fftw_complex *out, const int *onembed,
int ostride, int odist,
unsigned flag */
- fft->plan[0][0][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, up1, 0, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) up2, 0, 1, (nx/2+1), fftw_flags);
- fft->plan[0][1][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, up1, 0, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) up1, 0, 1, (nx/2+1), fftw_flags);
- fft->plan[1][0][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, p1, 0, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) p2, 0, 1, (nx/2+1), fftw_flags);
- fft->plan[1][1][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, p1, 0, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) p1, 0, 1, (nx/2+1), fftw_flags);
+ fft->plan[0][0][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, up1, nullptr, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) up2, nullptr, 1, (nx/2+1), fftw_flags);
+ fft->plan[0][1][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, up1, nullptr, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) up1, nullptr, 1, (nx/2+1), fftw_flags);
+ fft->plan[1][0][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, p1, nullptr, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) p2, nullptr, 1, (nx/2+1), fftw_flags);
+ fft->plan[1][1][1] = FFTWPREFIX(plan_many_dft_r2c)(1, &nx, howmany, p1, nullptr, 1, (nx/2+1) *2, (FFTWPREFIX(complex) *) p1, nullptr, 1, (nx/2+1), fftw_flags);
- fft->plan[0][0][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) up1, 0, 1, (nx/2+1), up2, 0, 1, (nx/2+1) *2, fftw_flags);
- fft->plan[0][1][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) up1, 0, 1, (nx/2+1), up1, 0, 1, (nx/2+1) *2, fftw_flags);
- fft->plan[1][0][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) p1, 0, 1, (nx/2+1), p2, 0, 1, (nx/2+1) *2, fftw_flags);
- fft->plan[1][1][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) p1, 0, 1, (nx/2+1), p1, 0, 1, (nx/2+1) *2, fftw_flags);
+ fft->plan[0][0][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) up1, nullptr, 1, (nx/2+1), up2, nullptr, 1, (nx/2+1) *2, fftw_flags);
+ fft->plan[0][1][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) up1, nullptr, 1, (nx/2+1), up1, nullptr, 1, (nx/2+1) *2, fftw_flags);
+ fft->plan[1][0][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) p1, nullptr, 1, (nx/2+1), p2, nullptr, 1, (nx/2+1) *2, fftw_flags);
+ fft->plan[1][1][0] = FFTWPREFIX(plan_many_dft_c2r)(1, &nx, howmany, (FFTWPREFIX(complex) *) p1, nullptr, 1, (nx/2+1), p1, nullptr, 1, (nx/2+1) *2, fftw_flags);
for (i = 0; i < 2; i++)
{
{
for (k = 0; k < 2; k++)
{
- if (fft->plan[i][j][k] == NULL)
+ if (fft->plan[i][j][k] == nullptr)
{
gmx_fatal(FARGS, "Error initializing FFTW3 plan.");
FFTW_UNLOCK;
fftw_flags = (flags & GMX_FFT_FLAG_CONSERVATIVE) ? FFTW_ESTIMATE : FFTW_MEASURE;
- if (pfft == NULL)
+ if (pfft == nullptr)
{
gmx_fatal(FARGS, "Invalid opaque FFT datatype pointer.");
return EINVAL;
}
- *pfft = NULL;
+ *pfft = nullptr;
FFTW_LOCK;
- if ( (fft = (gmx_fft_t) FFTWPREFIX(malloc)(sizeof(struct gmx_fft))) == NULL)
+ if ( (fft = (gmx_fft_t) FFTWPREFIX(malloc)(sizeof(struct gmx_fft))) == nullptr)
{
FFTW_UNLOCK;
return ENOMEM;
/* allocate aligned, and extra memory to make it unaligned */
p1 = (real *) FFTWPREFIX(malloc)(sizeof(real) *( nx*(ny/2+1)*2 + 2) );
- if (p1 == NULL)
+ if (p1 == nullptr)
{
FFTWPREFIX(free)(fft);
FFTW_UNLOCK;
}
p2 = (real *) FFTWPREFIX(malloc)(sizeof(real) *( nx*(ny/2+1)*2 + 2) );
- if (p2 == NULL)
+ if (p2 == nullptr)
{
FFTWPREFIX(free)(p1);
FFTWPREFIX(free)(fft);
{
for (k = 0; k < 2; k++)
{
- if (fft->plan[i][j][k] == NULL)
+ if (fft->plan[i][j][k] == nullptr)
{
gmx_fatal(FARGS, "Error initializing FFTW3 plan.");
FFTW_UNLOCK;
{
int i, j, k;
- if (fft != NULL)
+ if (fft != nullptr)
{
for (i = 0; i < 2; i++)
{
{
for (k = 0; k < 2; k++)
{
- if (fft->plan[i][j][k] != NULL)
+ if (fft->plan[i][j][k] != nullptr)
{
FFTW_LOCK;
FFTWPREFIX(destroy_plan)(fft->plan[i][j][k]);
FFTW_UNLOCK;
- fft->plan[i][j][k] = NULL;
+ fft->plan[i][j][k] = nullptr;
}
}
}
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 1991-2005 David van der Spoel, Erik Lindahl, University of Groningen.
- * Copyright (c) 2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,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.
(*pfft_setup)->p2 = fft5d_plan_3d(Nb, Mb, Kb, rcomm,
(flags|FFT5D_BACKWARD|FFT5D_NOMALLOC)^FFT5D_ORDER_YZ, complex_data, (t_complex**)real_data, &buf1, &buf2, nthreads);
- return (*pfft_setup)->p1 != 0 && (*pfft_setup)->p2 != 0;
+ return (*pfft_setup)->p1 != nullptr && (*pfft_setup)->p2 != nullptr;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,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.
class FFTTest : public BaseFFTTest
{
public:
- FFTTest() : fft_(NULL)
+ FFTTest() : fft_(nullptr)
{
}
~FFTTest()
class ManyFFTTest : public BaseFFTTest
{
public:
- ManyFFTTest() : fft_(NULL)
+ ManyFFTTest() : fft_(nullptr)
{
}
~ManyFFTTest()
class FFFTest3D : public BaseFFTTest
{
public:
- FFFTest3D() : fft_(NULL)
+ FFFTest3D() : fft_(nullptr)
{
}
~FFFTest3D()
std::copy(inputdata, inputdata+sizeInReals, in_.begin());
// Use memcpy to convert to t_complex easily
memcpy(rdata, in_.data(), sizeInBytes);
- gmx_parallel_3dfft_execute(fft_, GMX_FFT_REAL_TO_COMPLEX, 0, NULL);
+ gmx_parallel_3dfft_execute(fft_, GMX_FFT_REAL_TO_COMPLEX, 0, nullptr);
//TODO use std::complex and add checkComplex for it
checker_.checkSequenceArray(size*2,
reinterpret_cast<real*>(cdata), "forward");
std::copy(inputdata, inputdata+sizeInReals, in_.begin());
// Use memcpy to convert to t_complex easily
memcpy(cdata, in_.data(), sizeInBytes);
- gmx_parallel_3dfft_execute(fft_, GMX_FFT_COMPLEX_TO_REAL, 0, NULL);
+ gmx_parallel_3dfft_execute(fft_, GMX_FFT_COMPLEX_TO_REAL, 0, nullptr);
for (int i = 0; i < ndata[0]*ndata[1]; i++) //check sequence but skip unused data
{
checker_.checkSequenceArray(ndata[2], rdata+i*rsize[2],
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2008,2009,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.
case StatePart::freeEnergyHistory: return edfh_names[ecpt];
}
- return NULL;
+ return nullptr;
}
static void cp_warning(FILE *fp)
default: GMX_RELEASE_ASSERT(false, "XDR data type not implemented");
}
- return NULL;
+ return nullptr;
}
/*! \brief Lists or only reads an xdr vector from checkpoint file
std::vector<char> data(nf*elemSize);
res = xdr_vector(xd, data.data(), nf, elemSize, xdrProc(xdrType));
- if (list != NULL)
+ if (list != nullptr)
{
switch (xdrType)
{
T **v, std::vector<T> *vector,
FILE *list, CptElementType cptElementType)
{
- GMX_RELEASE_ASSERT(list != NULL || (v != NULL && vector == NULL) || (v == NULL && vector != NULL), "Without list, we should have exactly one of v and vector != NULL");
+ GMX_RELEASE_ASSERT(list != nullptr || (v != nullptr && vector == nullptr) || (v == nullptr && vector != nullptr), "Without list, we should have exactly one of v and vector != NULL");
bool_t res = 0;
int numElemInTheFile;
- if (list == NULL)
+ if (list == nullptr)
{
if (nval >= 0)
{
- GMX_RELEASE_ASSERT(nptr == NULL, "With nval>=0 we should have nptr==NULL");
+ GMX_RELEASE_ASSERT(nptr == nullptr, "With nval>=0 we should have nptr==NULL");
numElemInTheFile = nval;
}
else
{
- if (v != NULL)
+ if (v != nullptr)
{
- GMX_RELEASE_ASSERT(nptr != NULL, "With nval<0 we should have nptr!=NULL");
+ GMX_RELEASE_ASSERT(nptr != nullptr, "With nval<0 we should have nptr!=NULL");
// cppcheck-suppress nullPointer
numElemInTheFile = *nptr;
}
return -1;
}
- if (list == NULL && (sflags & (1 << ecpt)))
+ if (list == nullptr && (sflags & (1 << ecpt)))
{
if (nval >= 0)
{
gmx_fatal(FARGS, "Count mismatch for state entry %s, code count is %d, file count is %d\n", entryName(part, ecpt), nval, numElemInTheFile);
}
}
- else if (nptr != NULL)
+ else if (nptr != nullptr)
{
*nptr = numElemInTheFile;
}
}
T *vp;
- if (v != NULL)
+ if (v != nullptr)
{
- if (*v == NULL)
+ if (*v == nullptr)
{
snew(*v, numElemInTheFile);
}
static int doVector(XDR *xd, StatePart part, int ecpt, int sflags,
std::vector<T> *vector, FILE *list)
{
- return doVectorLow<T>(xd, part, ecpt, sflags, -1, NULL, NULL, vector, list, CptElementType::real);
+ return doVectorLow<T>(xd, part, ecpt, sflags, -1, nullptr, nullptr, vector, list, CptElementType::real);
}
//! \brief Read/Write an std::vector, on read checks the number of elements matches \p numElements
static int doVector(XDR *xd, StatePart part, int ecpt, int sflags,
int numElements, std::vector<T> *vector, FILE *list)
{
- return doVectorLow<T>(xd, part, ecpt, sflags, numElements, NULL, NULL, vector, list, CptElementType::real);
+ return doVectorLow<T>(xd, part, ecpt, sflags, numElements, nullptr, nullptr, vector, list, CptElementType::real);
}
//! \brief Read/Write a PaddedRVecVector, on read checks the number of elements matches \p numElements
{
rvec *v_rvec;
- if (list == NULL && (sflags & (1 << ecpt)))
+ if (list == nullptr && (sflags & (1 << ecpt)))
{
/* We resize the vector here to avoid pointer reallocation in
* do_cpte_reals_low. Note the we allocate 1 element extra for SIMD.
}
else
{
- v_rvec = NULL;
+ v_rvec = nullptr;
}
return doVectorLow<real>(xd, part, ecpt, sflags,
- numElements*DIM, NULL, (real **)(&v_rvec), NULL,
+ numElements*DIM, nullptr, (real **)(&v_rvec), nullptr,
list, CptElementType::real3);
}
static int do_cpte_reals(XDR *xd, StatePart part, int ecpt, int sflags,
int n, real **v, FILE *list)
{
- return doVectorLow<real>(xd, part, ecpt, sflags, n, NULL, v, NULL, list, CptElementType::real);
+ return doVectorLow<real>(xd, part, ecpt, sflags, n, nullptr, v, nullptr, list, CptElementType::real);
}
/* This function does the same as do_cpte_reals,
static int do_cpte_n_reals(XDR *xd, StatePart part, int ecpt, int sflags,
int *n, real **v, FILE *list)
{
- return doVectorLow<real>(xd, part, ecpt, sflags, -1, n, v, NULL, list, CptElementType::real);
+ return doVectorLow<real>(xd, part, ecpt, sflags, -1, n, v, nullptr, list, CptElementType::real);
}
static int do_cpte_real(XDR *xd, StatePart part, int ecpt, int sflags,
real *r, FILE *list)
{
- return doVectorLow<real>(xd, part, ecpt, sflags, 1, NULL, &r, NULL, list, CptElementType::real);
+ return doVectorLow<real>(xd, part, ecpt, sflags, 1, nullptr, &r, nullptr, list, CptElementType::real);
}
static int do_cpte_ints(XDR *xd, StatePart part, int ecpt, int sflags,
int n, int **v, FILE *list)
{
- return doVectorLow<int>(xd, part, ecpt, sflags, n, NULL, v, NULL, list, CptElementType::integer);
+ return doVectorLow<int>(xd, part, ecpt, sflags, n, nullptr, v, nullptr, list, CptElementType::integer);
}
static int do_cpte_int(XDR *xd, StatePart part, int ecpt, int sflags,
static int do_cpte_doubles(XDR *xd, StatePart part, int ecpt, int sflags,
int n, double **v, FILE *list)
{
- return doVectorLow<double>(xd, part, ecpt, sflags, n, NULL, v, NULL, list, CptElementType::real);
+ return doVectorLow<double>(xd, part, ecpt, sflags, n, nullptr, v, nullptr, list, CptElementType::real);
}
static int do_cpte_double(XDR *xd, StatePart part, int ecpt, int sflags,
vr = &(v[0][0]);
ret = doVectorLow<real>(xd, part, ecpt, sflags,
- DIM*DIM, NULL, &vr, NULL, NULL, CptElementType::matrix3x3);
+ DIM*DIM, nullptr, &vr, nullptr, nullptr, CptElementType::matrix3x3);
if (list && ret == 0)
{
char name[CPTSTRLEN];
ret = 0;
- if (v == NULL)
+ if (v == nullptr)
{
snew(v, n);
}
for (i = 0; i < n; i++)
{
- reti = doVectorLow<real>(xd, part, ecpt, sflags, n, NULL, &(v[i]), NULL, NULL, CptElementType::matrix3x3);
+ reti = doVectorLow<real>(xd, part, ecpt, sflags, n, nullptr, &(v[i]), nullptr, nullptr, CptElementType::matrix3x3);
if (list && reti == 0)
{
sprintf(name, "%s[%d]", entryName(part, ecpt), i);
int n, matrix **v, FILE *list)
{
bool_t res = 0;
- matrix *vp, *va = NULL;
+ matrix *vp, *va = nullptr;
real *vr;
int nf, i, j, k;
int ret;
{
return -1;
}
- if (list == NULL && nf != n)
+ if (list == nullptr && nf != n)
{
gmx_fatal(FARGS, "Count mismatch for state entry %s, code count is %d, file count is %d\n", entryName(part, ecpt), n, nf);
}
}
else
{
- if (*v == NULL)
+ if (*v == nullptr)
{
snew(*v, nf);
}
}
}
ret = doVectorLow<real>(xd, part, ecpt, sflags,
- nf*DIM*DIM, NULL, &vr, NULL, NULL,
+ nf*DIM*DIM, nullptr, &vr, nullptr, nullptr,
CptElementType::matrix3x3);
for (i = 0; i < nf; i++)
{
if (*file_version >= 12)
{
do_cpt_string_err(xd, bRead, "generating host", &fhost, list);
- if (list == NULL)
+ if (list == nullptr)
{
sfree(fhost);
}
/* The RNG entries are no longer written,
* the next 4 lines are only for reading old files.
*/
- case estLD_RNG: ret = do_cpte_ints(xd, part, i, sflags, 0, NULL, list); break;
- case estLD_RNGI: ret = do_cpte_ints(xd, part, i, sflags, 0, NULL, list); break;
- case estMC_RNG: ret = do_cpte_ints(xd, part, i, sflags, 0, NULL, list); break;
- case estMC_RNGI: ret = do_cpte_ints(xd, part, i, sflags, 0, NULL, list); break;
+ case estLD_RNG: ret = do_cpte_ints(xd, part, i, sflags, 0, nullptr, list); break;
+ case estLD_RNGI: ret = do_cpte_ints(xd, part, i, sflags, 0, nullptr, list); break;
+ case estMC_RNG: ret = do_cpte_ints(xd, part, i, sflags, 0, nullptr, list); break;
+ case estMC_RNGI: ret = do_cpte_ints(xd, part, i, sflags, 0, nullptr, list); break;
case estDISRE_INITF: ret = do_cpte_real (xd, part, i, sflags, &state->hist.disre_initf, list); break;
case estDISRE_RM3TAV: ret = do_cpte_n_reals(xd, part, i, sflags, &state->hist.ndisrepairs, &state->hist.disre_rm3tav, list); break;
case estORIRE_INITF: ret = do_cpte_real (xd, part, i, sflags, &state->hist.orire_initf, list); break;
return 0;
}
- if (*swapstatePtr == NULL)
+ if (*swapstatePtr == nullptr)
{
snew(*swapstatePtr, 1);
}
do_cpt_int_err(xd, "swap influx net p", gs->inflow_net_p[ic], list);
}
- if (bRead && (NULL == gs->nMolPast[ic]) )
+ if (bRead && (nullptr == gs->nMolPast[ic]) )
{
snew(gs->nMolPast[ic], swapstate->nAverage);
}
return 0;
}
- if (*dfhistPtr == NULL)
+ if (*dfhistPtr == nullptr)
{
snew(*dfhistPtr, 1);
(*dfhistPtr)->nlambda = nlambda;
return 0;
}
- if (*EDstatePtr == NULL)
+ if (*EDstatePtr == nullptr)
{
snew(*EDstatePtr, 1);
}
{
do_cpt_string_err(xd, bRead, "output filename", &buf, list);
std::strncpy(outputfiles[i].filename, buf, CPTSTRLEN-1);
- if (list == NULL)
+ if (list == nullptr)
{
sfree(buf);
}
do_cpt_header(gmx_fio_getxdr(fp), FALSE, &file_version,
&version, &btime, &buser, &bhost, &double_prec, &fprog, &ftime,
&eIntegrator, &simulation_part, &step, &t, &nppnodes,
- DOMAINDECOMP(cr) ? domdecCells : NULL, &npmenodes,
+ DOMAINDECOMP(cr) ? domdecCells : nullptr, &npmenodes,
&state->natoms, &state->ngtc, &state->nnhpres,
&state->nhchainlength, &nlambda, &state->flags, &flags_eks, &flags_enh, &flags_dfh,
&nED, &eSwapCoords,
- NULL);
+ nullptr);
sfree(version);
sfree(btime);
sfree(bhost);
sfree(fprog);
- if ((do_cpt_state(gmx_fio_getxdr(fp), state->flags, state, NULL) < 0) ||
- (do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, NULL) < 0) ||
- (do_cpt_enerhist(gmx_fio_getxdr(fp), FALSE, flags_enh, enerhist, NULL) < 0) ||
- (do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, NULL) < 0) ||
- (do_cpt_EDstate(gmx_fio_getxdr(fp), FALSE, nED, &state->edsamstate, NULL) < 0) ||
- (do_cpt_swapstate(gmx_fio_getxdr(fp), FALSE, eSwapCoords, &state->swapstate, NULL) < 0) ||
- (do_cpt_files(gmx_fio_getxdr(fp), FALSE, &outputfiles, &noutputfiles, NULL,
+ if ((do_cpt_state(gmx_fio_getxdr(fp), state->flags, state, nullptr) < 0) ||
+ (do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, nullptr) < 0) ||
+ (do_cpt_enerhist(gmx_fio_getxdr(fp), FALSE, flags_enh, enerhist, nullptr) < 0) ||
+ (do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, nullptr) < 0) ||
+ (do_cpt_EDstate(gmx_fio_getxdr(fp), FALSE, nED, &state->edsamstate, nullptr) < 0) ||
+ (do_cpt_swapstate(gmx_fio_getxdr(fp), FALSE, eSwapCoords, &state->swapstate, nullptr) < 0) ||
+ (do_cpt_files(gmx_fio_getxdr(fp), FALSE, &outputfiles, &noutputfiles, nullptr,
file_version) < 0))
{
gmx_file("Cannot read/write checkpoint; corrupt file, or maybe you are out of disk space?");
"Cannot fsync '%s'; maybe you are out of disk space?",
gmx_fio_getname(ret));
- if (getenv(GMX_IGNORE_FSYNC_FAILURE_ENV) == NULL)
+ if (getenv(GMX_IGNORE_FSYNC_FAILURE_ENV) == nullptr)
{
gmx_file(buf);
}
&nppnodes_f, dd_nc_f, &npmenodes_f,
&natoms, &ngtc, &nnhpres, &nhchainlength, &nlambda,
&fflags, &flags_eks, &flags_enh, &flags_dfh,
- &nED, &eSwapCoords, NULL);
+ &nED, &eSwapCoords, nullptr);
if (bAppendOutputFiles &&
file_version >= 13 && double_prec != GMX_DOUBLE)
gmx_fatal(FARGS, "Output file appending requested, but the code and checkpoint file precision (single/double) don't match");
}
- if (cr == NULL || MASTER(cr))
+ if (cr == nullptr || MASTER(cr))
{
fprintf(stderr, "\nReading checkpoint file %s generated: %s\n\n",
fn, ftime);
"You can try with the -noappend option, and get more info in the log file.\n");
}
- if (getenv("GMX_ALLOW_CPT_MISMATCH") == NULL)
+ if (getenv("GMX_ALLOW_CPT_MISMATCH") == nullptr)
{
gmx_fatal(FARGS, "You seem to have switched ensemble, integrator, T and/or P-coupling algorithm between the cpt and tpr file. The recommended way of doing this is passing the cpt file to grompp (with option -t) instead of to mdrun. If you know what you are doing, you can override this error by setting the env.var. GMX_ALLOW_CPT_MISMATCH");
}
reproducibilityRequested);
}
}
- ret = do_cpt_state(gmx_fio_getxdr(fp), fflags, state, NULL);
+ ret = do_cpt_state(gmx_fio_getxdr(fp), fflags, state, nullptr);
*init_fep_state = state->fep_state; /* there should be a better way to do this than setting it here.
Investigate for 5.0. */
if (ret)
{
cp_error();
}
- ret = do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, NULL);
+ ret = do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, nullptr);
if (ret)
{
cp_error();
((flags_eks & (1<<eeksEKINSCALEF)) | (flags_eks & (1<<eeksEKINSCALEH)) | (flags_eks & (1<<eeksVSCALE))));
ret = do_cpt_enerhist(gmx_fio_getxdr(fp), TRUE,
- flags_enh, enerhist, NULL);
+ flags_enh, enerhist, nullptr);
if (ret)
{
cp_error();
enerhist->nsum_sim = *step;
}
- ret = do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, NULL);
+ ret = do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, nullptr);
if (ret)
{
cp_error();
}
- ret = do_cpt_EDstate(gmx_fio_getxdr(fp), TRUE, nED, &state->edsamstate, NULL);
+ ret = do_cpt_EDstate(gmx_fio_getxdr(fp), TRUE, nED, &state->edsamstate, nullptr);
if (ret)
{
cp_error();
}
- ret = do_cpt_swapstate(gmx_fio_getxdr(fp), TRUE, eSwapCoords, &state->swapstate, NULL);
+ ret = do_cpt_swapstate(gmx_fio_getxdr(fp), TRUE, eSwapCoords, &state->swapstate, nullptr);
if (ret)
{
cp_error();
}
- ret = do_cpt_files(gmx_fio_getxdr(fp), TRUE, &outputfiles, &nfiles, NULL, file_version);
+ ret = do_cpt_files(gmx_fio_getxdr(fp), TRUE, &outputfiles, &nfiles, nullptr, file_version);
if (ret)
{
cp_error();
int nED, eSwapCoords;
t_fileio *fp;
- if (filename == NULL ||
+ if (filename == nullptr ||
!gmx_fexist(filename) ||
(!(fp = gmx_fio_open(filename, "r"))))
{
&eIntegrator, simulation_part, step, &t, &nppnodes, dd_nc, &npme,
&state.natoms, &state.ngtc, &state.nnhpres, &state.nhchainlength,
&nlambda, &state.flags, &flags_eks, &flags_enh, &flags_dfh,
- &nED, &eSwapCoords, NULL);
+ &nED, &eSwapCoords, nullptr);
gmx_fio_close(fp);
}
int flags_eks, flags_enh, flags_dfh;
int nED, eSwapCoords;
int nfiles_loc;
- gmx_file_position_t *files_loc = NULL;
+ gmx_file_position_t *files_loc = nullptr;
int ret;
do_cpt_header(gmx_fio_getxdr(fp), TRUE, &file_version,
&eIntegrator, simulation_part, step, t, &nppnodes, dd_nc, &npme,
&state->natoms, &state->ngtc, &state->nnhpres, &state->nhchainlength,
&nlambda, &state->flags, &flags_eks, &flags_enh, &flags_dfh,
- &nED, &eSwapCoords, NULL);
+ &nED, &eSwapCoords, nullptr);
ret =
- do_cpt_state(gmx_fio_getxdr(fp), state->flags, state, NULL);
+ do_cpt_state(gmx_fio_getxdr(fp), state->flags, state, nullptr);
if (ret)
{
cp_error();
}
- ret = do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, NULL);
+ ret = do_cpt_ekinstate(gmx_fio_getxdr(fp), flags_eks, &state->ekinstate, nullptr);
if (ret)
{
cp_error();
energyhistory_t enerhist;
ret = do_cpt_enerhist(gmx_fio_getxdr(fp), TRUE,
- flags_enh, &enerhist, NULL);
+ flags_enh, &enerhist, nullptr);
if (ret)
{
cp_error();
}
- ret = do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, NULL);
+ ret = do_cpt_df_hist(gmx_fio_getxdr(fp), flags_dfh, nlambda, &state->dfhist, nullptr);
if (ret)
{
cp_error();
}
- ret = do_cpt_EDstate(gmx_fio_getxdr(fp), TRUE, nED, &state->edsamstate, NULL);
+ ret = do_cpt_EDstate(gmx_fio_getxdr(fp), TRUE, nED, &state->edsamstate, nullptr);
if (ret)
{
cp_error();
}
- ret = do_cpt_swapstate(gmx_fio_getxdr(fp), TRUE, eSwapCoords, &state->swapstate, NULL);
+ ret = do_cpt_swapstate(gmx_fio_getxdr(fp), TRUE, eSwapCoords, &state->swapstate, nullptr);
if (ret)
{
cp_error();
ret = do_cpt_files(gmx_fio_getxdr(fp), TRUE,
&files_loc,
&nfiles_loc,
- NULL, file_version);
+ nullptr, file_version);
if (outputfiles != nullptr)
{
*outputfiles = files_loc;
t_fileio *fp;
fp = gmx_fio_open(fn, "r");
- read_checkpoint_data(fp, simulation_part, step, t, state, NULL, NULL);
+ read_checkpoint_data(fp, simulation_part, step, t, state, nullptr, nullptr);
if (gmx_fio_close(fp) != 0)
{
gmx_file("Cannot read/write checkpoint; corrupt file, or maybe you are out of disk space?");
init_state(&state, 0, 0, 0, 0, 0);
- read_checkpoint_data(fp, &simulation_part, &step, &t, &state, NULL, NULL);
+ read_checkpoint_data(fp, &simulation_part, &step, &t, &state, nullptr, nullptr);
fr->natoms = state.natoms;
fr->bTitle = FALSE;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
case efENT:
case efPQR:
out = gmx_fio_fopen(outfile, "w");
- write_pdbfile_indexed(out, title, atoms, x, ePBC, box, ' ', -1, nindex, index, NULL, TRUE);
+ write_pdbfile_indexed(out, title, atoms, x, ePBC, box, ' ', -1, nindex, index, nullptr, TRUE);
gmx_fio_fclose(out);
break;
case efESP:
fr.bBox = TRUE;
copy_mat(box, fr.box);
out = gmx_fio_fopen(outfile, "w");
- write_g96_conf(out, &fr, -1, NULL);
+ write_g96_conf(out, &fr, -1, nullptr);
gmx_fio_fclose(out);
break;
case efPDB:
case efBRK:
case efENT:
out = gmx_fio_fopen(outfile, "w");
- write_pdbfile(out, title, atoms, x, ePBC, box, ' ', -1, NULL, TRUE);
+ write_pdbfile(out, title, atoms, x, ePBC, box, ' ', -1, nullptr, TRUE);
gmx_fio_fclose(out);
break;
case efESP:
out = gmx_fio_fopen(outfile, "w");
- write_espresso_conf_indexed(out, title, atoms, atoms->nr, NULL, x, v, box);
+ write_espresso_conf_indexed(out, title, atoms, atoms->nr, nullptr, x, v, box);
gmx_fio_fclose(out);
break;
case efTPR:
case efG96:
{
in = gmx_fio_fopen(infile, "r");
- fr.title = NULL;
+ fr.title = nullptr;
fr.natoms = -1;
- fr.atoms = NULL;
- fr.x = NULL;
- fr.v = NULL;
- fr.f = NULL;
- *natoms = read_g96_conf(in, infile, &fr, NULL, g96_line);
+ fr.atoms = nullptr;
+ fr.x = nullptr;
+ fr.v = nullptr;
+ fr.f = nullptr;
+ *natoms = read_g96_conf(in, infile, &fr, nullptr, g96_line);
sfree(const_cast<char *>(fr.title));
gmx_fio_fclose(in);
break;
{
fprintf(stderr, "Warning: Number of atoms in %s is 0\n", infile);
}
- else if (atoms->atom == NULL)
+ else if (atoms->atom == nullptr)
{
gmx_mem("Uninitialized array atom");
}
gmx_gro_read_conf(infile, symtab, name, atoms, x, v, box);
break;
case efG96:
- fr.title = NULL;
+ fr.title = nullptr;
fr.natoms = atoms->nr;
fr.atoms = atoms;
fr.x = x;
fr.v = v;
- fr.f = NULL;
+ fr.f = nullptr;
in = gmx_fio_fopen(infile, "r");
read_g96_conf(in, infile, &fr, symtab, g96_line);
gmx_fio_fclose(in);
init_t_atoms(atoms, natoms, (fn2ftp(infile) == efPDB));
bool xIsNull = false;
- if (x == NULL)
+ if (x == nullptr)
{
snew(x, 1);
xIsNull = true;
}
read_stx_conf(infile,
symtab, name, atoms,
- *x, (v == NULL) ? NULL : *v, ePBC, box);
+ *x, (v == nullptr) ? nullptr : *v, ePBC, box);
if (xIsNull)
{
sfree(*x);
int *ePBC,
rvec **x, rvec **v, matrix box)
{
- GMX_RELEASE_ASSERT(mtop != NULL, "readConfAndTopology requires mtop!=NULL");
+ GMX_RELEASE_ASSERT(mtop != nullptr, "readConfAndTopology requires mtop!=NULL");
- if (ePBC != NULL)
+ if (ePBC != nullptr)
{
*ePBC = -1;
}
}
int natoms;
int ePBC_tmp
- = read_tpx(infile, NULL, box, &natoms,
- (x == NULL) ? NULL : *x, (v == NULL) ? NULL : *v, mtop);
- if (ePBC != NULL)
+ = read_tpx(infile, nullptr, box, &natoms,
+ (x == nullptr) ? nullptr : *x, (v == nullptr) ? nullptr : *v, mtop);
+ if (ePBC != nullptr)
{
*ePBC = ePBC_tmp;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
#else
sb->type = xdr_datatype_float;
#endif
- sb->fval = NULL;
- sb->dval = NULL;
- sb->ival = NULL;
- sb->lval = NULL;
- sb->cval = NULL;
- sb->sval = NULL;
+ sb->fval = nullptr;
+ sb->dval = nullptr;
+ sb->ival = nullptr;
+ sb->lval = nullptr;
+ sb->cval = nullptr;
+ sb->sval = nullptr;
sb->fval_alloc = 0;
sb->dval_alloc = 0;
sb->ival_alloc = 0;
{
sfree(sb->fval);
sb->fval_alloc = 0;
- sb->fval = NULL;
+ sb->fval = nullptr;
}
if (sb->dval_alloc)
{
sfree(sb->dval);
sb->dval_alloc = 0;
- sb->dval = NULL;
+ sb->dval = nullptr;
}
if (sb->ival_alloc)
{
sfree(sb->ival);
sb->ival_alloc = 0;
- sb->ival = NULL;
+ sb->ival = nullptr;
}
if (sb->lval_alloc)
{
sfree(sb->lval);
sb->lval_alloc = 0;
- sb->lval = NULL;
+ sb->lval = nullptr;
}
if (sb->cval_alloc)
{
sfree(sb->cval);
sb->cval_alloc = 0;
- sb->cval = NULL;
+ sb->cval = nullptr;
}
if (sb->sval_alloc)
{
}
sfree(sb->sval);
sb->sval_alloc = 0;
- sb->sval = NULL;
+ sb->sval = nullptr;
}
}
srenew(sb->sval, sb->nr);
for (i = sb->sval_alloc; i < sb->nr; i++)
{
- sb->sval[i] = NULL;
+ sb->sval[i] = nullptr;
}
sb->sval_alloc = sb->nr;
}
{
eb->id = enxOR;
eb->nsub = 0;
- eb->sub = NULL;
+ eb->sub = nullptr;
eb->nsub_alloc = 0;
}
}
sfree(eb->sub);
eb->nsub_alloc = 0;
- eb->sub = NULL;
+ eb->sub = nullptr;
}
}
void init_enxframe(t_enxframe *fr)
{
fr->e_alloc = 0;
- fr->ener = NULL;
+ fr->ener = nullptr;
/*fr->d_alloc=0;*/
/*fr->ndisre=0;*/
fr->nblock = 0;
fr->nblock_alloc = 0;
- fr->block = NULL;
+ fr->block = nullptr;
}
return &(ef->block[i]);
}
}
- return NULL;
+ return nullptr;
}
void add_subblocks_enxblock(t_enxblock *eb, int n)
static void enx_warning(const char *msg)
{
- if (getenv("GMX_ENX_NO_FATAL") != NULL)
+ if (getenv("GMX_ENX_NO_FATAL") != nullptr)
{
gmx_warning(msg);
}
int i;
gmx_enxnm_t *nm;
- if (*nms == NULL)
+ if (*nms == nullptr)
{
snew(*nms, n);
}
if (nm->name)
{
sfree(nm->name);
- nm->name = NULL;
+ nm->name = nullptr;
}
if (nm->unit)
{
sfree(nm->unit);
- nm->unit = NULL;
+ nm->unit = nullptr;
}
}
if (!xdr_string(xdr, &(nm->name), STRLEN))
void close_enx(ener_file_t ef)
{
- if (ef == NULL)
+ if (ef == nullptr)
{
// Nothing to do
return;
ener_file_t open_enx(const char *fn, const char *mode)
{
int nre;
- gmx_enxnm_t *nms = NULL;
+ gmx_enxnm_t *nms = nullptr;
int file_version = -1;
t_enxframe *fr;
gmx_bool bWrongPrecision, bOK = TRUE;
/*d_size = fr->ndisre*(sizeof(real)*2);*/
}
- if (!do_eheader(ef, &file_version, fr, -1, NULL, &bOK))
+ if (!do_eheader(ef, &file_version, fr, -1, nullptr, &bOK))
{
if (bRead)
{
int nre, nfr, i, j, ni, npcoupl;
char buf[STRLEN];
const char *bufi;
- gmx_enxnm_t *enm = NULL;
+ gmx_enxnm_t *enm = nullptr;
t_enxframe *fr;
ener_file_t in;
int nre, nre1, nre2;
ener_file_t in1, in2;
int i, j, maxener, *ind1, *ind2, *have;
- gmx_enxnm_t *enm1 = NULL, *enm2 = NULL;
+ gmx_enxnm_t *enm1 = nullptr, *enm2 = nullptr;
t_enxframe *fr1, *fr2;
gmx_bool b1, b2;
maxener = nre;
for (i = 0; i < nre; i++)
{
- if ((lastener != NULL) && (std::strstr(enm1[i].name, lastener) != NULL))
+ if ((lastener != nullptr) && (std::strstr(enm1[i].name, lastener) != nullptr))
{
maxener = i+1;
break;
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 2005, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
break;
case espTYPE:
r = get_espresso_word(fp, word);
- atoms->atom[i].type = std::strtol(word, NULL, 10);
+ atoms->atom[i].type = std::strtol(word, nullptr, 10);
break;
case espQ:
r = get_espresso_word(fp, word);
break;
case espMOLECULE:
r = get_espresso_word(fp, word);
- molnr = std::strtol(word, NULL, 10);
+ molnr = std::strtol(word, nullptr, 10);
if (i == 0 ||
atoms->resinfo[atoms->atom[i-1].resind].nr != molnr)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{ eftASC, ".mdp", "grompp", "-f", "grompp input file with MD parameters" },
{ eftGEN, ".???", "traj", "-f", "Trajectory", NTRXS, trxs },
{ eftGEN, ".???", "trajout", "-f", "Trajectory", NTROS, tros },
- { eftGEN, ".???", "traj", NULL,
+ { eftGEN, ".???", "traj", nullptr,
"Full precision trajectory", NTRNS, trns },
- { eftXDR, ".trr", "traj", NULL, "Trajectory in portable xdr format" },
- { eftGEN, ".???", "traj_comp", NULL,
+ { eftXDR, ".trr", "traj", nullptr, "Trajectory in portable xdr format" },
+ { eftGEN, ".???", "traj_comp", nullptr,
"Compressed trajectory (tng format or portable xdr format)", NTRCOMPRESSED, trcompressed},
- { eftXDR, ".xtc", "traj", NULL,
+ { eftXDR, ".xtc", "traj", nullptr,
"Compressed trajectory (portable xdr format): xtc" },
- { eftTNG, ".tng", "traj", NULL,
+ { eftTNG, ".tng", "traj", nullptr,
"Trajectory file (tng format)" },
- { eftXDR, ".edr", "ener", NULL, "Energy file"},
+ { eftXDR, ".edr", "ener", nullptr, "Energy file"},
{ eftGEN, ".???", "conf", "-c", "Structure file", NSTXS, stxs },
{ eftGEN, ".???", "out", "-o", "Structure file", NSTOS, stos },
{ eftASC, ".gro", "conf", "-c", "Coordinate file in Gromos-87 format" },
{ eftASC, ".out", "hello", "-o", "Generic output file"},
{ eftASC, ".ndx", "index", "-n", "Index file", },
{ eftASC, ".top", "topol", "-p", "Topology file"},
- { eftASC, ".itp", "topinc", NULL, "Include file for topology"},
+ { eftASC, ".itp", "topinc", nullptr, "Include file for topology"},
{ eftGEN, ".???", "topol", "-s", "Structure+mass(db)", NTPSS, tpss },
{ eftXDR, ".tpr", "topol", "-s", "Portable xdr run input file"},
{ eftASC, ".tex", "doc", "-o", "LaTeX file"},
- { eftASC, ".rtp", "residue", NULL, "Residue Type file used by pdb2gmx" },
- { eftASC, ".atp", "atomtp", NULL, "Atomtype file used by pdb2gmx" },
- { eftASC, ".hdb", "polar", NULL, "Hydrogen data base"},
- { eftASC, ".dat", "nnnice", NULL, "Generic data file"},
- { eftASC, ".dlg", "user", NULL, "Dialog Box data for ngmx"},
- { eftASC, ".map", "ss", NULL, "File that maps matrix data to colors" },
- { eftASC, ".eps", "plot", NULL, "Encapsulated PostScript (tm) file" },
- { eftASC, ".mat", "ss", NULL, "Matrix Data file"},
- { eftASC, ".m2p", "ps", NULL, "Input file for mat2ps"},
+ { eftASC, ".rtp", "residue", nullptr, "Residue Type file used by pdb2gmx" },
+ { eftASC, ".atp", "atomtp", nullptr, "Atomtype file used by pdb2gmx" },
+ { eftASC, ".hdb", "polar", nullptr, "Hydrogen data base"},
+ { eftASC, ".dat", "nnnice", nullptr, "Generic data file"},
+ { eftASC, ".dlg", "user", nullptr, "Dialog Box data for ngmx"},
+ { eftASC, ".map", "ss", nullptr, "File that maps matrix data to colors" },
+ { eftASC, ".eps", "plot", nullptr, "Encapsulated PostScript (tm) file" },
+ { eftASC, ".mat", "ss", nullptr, "Matrix Data file"},
+ { eftASC, ".m2p", "ps", nullptr, "Input file for mat2ps"},
{ eftXDR, ".mtx", "hessian", "-m", "Hessian matrix"},
- { eftASC, ".edi", "sam", NULL, "ED sampling input"},
- { eftASC, ".cub", "pot", NULL, "Gaussian cube file" },
- { eftASC, ".xpm", "root", NULL, "X PixMap compatible matrix file" },
- { eftASC, "", "rundir", NULL, "Run directory" }
+ { eftASC, ".edi", "sam", nullptr, "ED sampling input"},
+ { eftASC, ".cub", "pot", nullptr, "Gaussian cube file" },
+ { eftASC, ".xpm", "root", nullptr, "X PixMap compatible matrix file" },
+ { eftASC, "", "rundir", nullptr, "Run directory" }
};
const char *ftp2ext(int ftp)
}
else
{
- return 0;
+ return nullptr;
}
}
}
else
{
- return NULL;
+ return nullptr;
}
}
}
else
{
- return NULL;
+ return nullptr;
}
}
for (i = 0; (i < efNR); i++)
{
- if ((eptr = deffile[i].ext) != NULL)
+ if ((eptr = deffile[i].ext) != nullptr)
{
if (gmx_strcasecmp(feptr, eptr) == 0)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
nwanted = fr->natoms;
atoms = fr->atoms;
- if (atoms != NULL)
+ if (atoms != nullptr)
{
atoms->haveMass = FALSE;
atoms->haveCharge = FALSE;
{
fr->bTitle = (std::strcmp(line, "TITLE") == 0);
}
- if (fr->title == NULL)
+ if (fr->title == nullptr)
{
fgets2(line, STRLEN, fp);
fr->title = gmx_strdup(line);
fr->bTime = bTime;
do
{
- bFinished = (fgets2(line, STRLEN, fp) == NULL);
+ bFinished = (fgets2(line, STRLEN, fp) == nullptr);
}
while (!bFinished && (line[0] == '#'));
sscanf(line, "%15" GMX_SCNd64 "%15lf", &(fr->step), &db1);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
XDR *gmx_fio_getxdr(t_fileio *fio)
{
- XDR *ret = NULL;
+ XDR *ret = nullptr;
gmx_fio_lock(fio);
- GMX_RELEASE_ASSERT( fio->xdr != NULL, "Implementation error: NULL XDR pointers");
+ GMX_RELEASE_ASSERT( fio->xdr != nullptr, "Implementation error: NULL XDR pointers");
ret = fio->xdr;
gmx_fio_unlock(fio);
return ret;
double d = 0;
float f = 0;
- GMX_RELEASE_ASSERT( fio->xdr != NULL, "Implementation error: NULL XDR pointers");
+ GMX_RELEASE_ASSERT( fio->xdr != nullptr, "Implementation error: NULL XDR pointers");
gmx_fio_check_nitem(eio, nitem, srcfile, line);
switch (eio)
{
}
break;
case eioNRVEC:
- ptr = NULL;
+ ptr = nullptr;
res = 1;
for (j = 0; (j < nitem) && res; j++)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* the list of open files is a linked list, with a dummy element at its head;
it is initialized when the first file is opened. */
-static t_fileio *open_files = NULL;
+static t_fileio *open_files = nullptr;
/* this mutex locks the open_files structure so that no two threads can
if (!open_files)
{
snew(open_files, 1);
- open_files->fp = NULL;
- open_files->fn = NULL;
+ open_files->fp = nullptr;
+ open_files->fn = nullptr;
open_files->next = open_files;
open_files->prev = open_files;
tMPI_Lock_init(&(open_files->mtx));
if (ret == open_files)
{
/* after this, the open_file pointer should never change */
- ret = NULL;
+ ret = nullptr;
}
else
{
/* check if that was the last one */
if (fio->next == open_files)
{
- ret = NULL;
+ ret = nullptr;
tMPI_Thread_mutex_unlock(&open_file_mutex);
}
else
*****************************************************************/
t_fileio *gmx_fio_open(const char *fn, const char *mode)
{
- t_fileio *fio = NULL;
+ t_fileio *fio = nullptr;
char newmode[5];
gmx_bool bRead, bReadWrite;
tMPI_Lock_init(&(fio->mtx));
bRead = (newmode[0] == 'r' && newmode[1] != '+');
bReadWrite = (newmode[1] == '+');
- fio->fp = NULL;
- fio->xdr = NULL;
+ fio->fp = nullptr;
+ fio->xdr = nullptr;
if (fn)
{
if (fn2ftp(fn) == efTNG)
{
int rc = 0;
- if (fio->xdr != NULL)
+ if (fio->xdr != nullptr)
{
xdr_destroy(fio->xdr);
sfree(fio->xdr);
}
- if (fio->fp != NULL)
+ if (fio->fp != nullptr)
{
rc = gmx_ffclose(fio->fp); /* fclose returns 0 if happy */
{
int rc = 0;
gmx_fio_lock(fio);
- if (fio->xdr == NULL)
+ if (fio->xdr == nullptr)
{
rc = gmx_ffclose(fio->fp); /* fclose returns 0 if happy */
- fio->fp = NULL;
+ fio->fp = nullptr;
}
gmx_fio_unlock(fio);
t_fileio *gmx_fio_all_output_fsync(void)
{
- t_fileio *ret = NULL;
+ t_fileio *ret = nullptr;
t_fileio *cur;
cur = gmx_fio_get_first();
FILE *gmx_fio_getfp(t_fileio *fio)
{
- FILE *ret = NULL;
+ FILE *ret = nullptr;
gmx_fio_lock(fio);
if (fio->fp)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* just pray the arrays are big enough */
for (i = 0; (i < natoms); i++)
{
- if ((fgets2(line, STRLEN, in)) == NULL)
+ if ((fgets2(line, STRLEN, in)) == nullptr)
{
gmx_fatal(FARGS, "Unexpected end of file in file %s at line %d",
infile, i+2);
{
bFirst = FALSE;
p1 = strchr(line, '.');
- if (p1 == NULL)
+ if (p1 == nullptr)
{
gmx_fatal(FARGS, "A coordinate in file %s does not contain a '.'", infile);
}
p2 = strchr(&p1[1], '.');
- if (p2 == NULL)
+ if (p2 == nullptr)
{
gmx_fatal(FARGS, "A coordinate in file %s does not contain a '.'", infile);
}
*ndec = ddist - 5;
p3 = strchr(&p2[1], '.');
- if (p3 == NULL)
+ if (p3 == nullptr)
{
gmx_fatal(FARGS, "A coordinate in file %s does not contain a '.'", infile);
}
sfree(atoms.atomname);
done_symtab(&symtab);
- if ((p = strstr(title, "t=")) != NULL)
+ if ((p = strstr(title, "t=")) != nullptr)
{
p += 2;
if (sscanf(p, "%lf", &tt) == 1)
fprintf(out, "%s\n", (title && title[0]) ? title : gmx::bromacs().c_str());
fprintf(out, "%5d\n", nx);
- const char *format = get_hconf_format(v != NULL);
+ const char *format = get_hconf_format(v != nullptr);
for (i = 0; (i < nx); i++)
{
fprintf(out, "%s\n", (title && title[0]) ? title : gmx::bromacs().c_str());
fprintf(out, "%5d\n", mtop->natoms);
- const char *format = get_hconf_format(v != NULL);
+ const char *format = get_hconf_format(v != nullptr);
aloop = gmx_mtop_atomloop_all_init(mtop);
while (gmx_mtop_atomloop_all_next(aloop, &i, &atom))
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int xdr3dfcoord(XDR *xdrs, float *fp, int *size, float *precision)
{
- int *ip = NULL;
- int *buf = NULL;
+ int *ip = nullptr;
+ int *buf = nullptr;
gmx_bool bRead;
/* preallocate a small buffer and ip on the stack - if we need more
bufsize = static_cast<int>(size3 * 1.2);
ip = reinterpret_cast<int *>(malloc(size3 * sizeof(*ip)));
buf = reinterpret_cast<int *>(malloc(bufsize * sizeof(*buf)));
- if (ip == NULL || buf == NULL)
+ if (ip == nullptr || buf == nullptr)
{
fprintf(stderr, "malloc failed\n");
exit(1);
bufsize = static_cast<int>(size3 * 1.2);
ip = reinterpret_cast<int *>(malloc(size3 * sizeof(*ip)));
buf = reinterpret_cast<int *>(malloc(bufsize * sizeof(*buf)));
- if (ip == NULL || buf == NULL)
+ if (ip == nullptr || buf == nullptr)
{
fprintf(stderr, "malloc failed\n");
exit(1);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
sfree((*m)[i]);
}
sfree(*m);
- *m = NULL;
+ *m = nullptr;
}
gmx_bool matelmt_cmp(t_xpmelmt e1, t_xpmelmt e2)
double r, g, b;
t_mapping *m;
- if (fgets2(line, STRLEN-1, in) == NULL)
+ if (fgets2(line, STRLEN-1, in) == nullptr)
{
gmx_fatal(FARGS, "Not enough lines in colormap file %s"
"(just wanted to read number of entries)", fn);
snew(m, n);
for (i = 0; (i < n); i++)
{
- if (fgets2(line, STRLEN-1, in) == NULL)
+ if (fgets2(line, STRLEN-1, in) == nullptr)
{
gmx_fatal(FARGS, "Not enough lines in colormap file %s"
"(should be %d, found only %d)", fn, n+1, i);
{
int i;
- if (*line != NULL)
+ if (*line != nullptr)
{
while (((*line)[0] != '\"' ) && ( (*line)[0] != '\0' ))
{
if ((*line)[0] != '\"')
{
- return NULL;
+ return nullptr;
}
(*line)++;
if ((*line)[i] != '\"')
{
- *line = NULL;
+ *line = nullptr;
}
else
{
static void read_xpm_entry(FILE *in, t_matrix *mm)
{
t_mapping *map;
- char *line_buf = NULL, *line = NULL, *str, buf[256] = {0};
+ char *line_buf = nullptr, *line = nullptr, *str, buf[256] = {0};
int i, m, col_len, nch = 0, n_axis_x, n_axis_y, llmax;
int llalloc = 0;
unsigned int r, g, b;
mm->legend[0] = 0;
mm->label_x[0] = 0;
mm->label_y[0] = 0;
- mm->matrix = NULL;
- mm->axis_x = NULL;
- mm->axis_y = NULL;
+ mm->matrix = nullptr;
+ mm->axis_x = nullptr;
+ mm->axis_y = nullptr;
mm->bDiscrete = FALSE;
llmax = STRLEN;
- while ((NULL != fgetline(&line_buf, llmax, &llalloc, in)) &&
+ while ((nullptr != fgetline(&line_buf, llmax, &llalloc, in)) &&
(std::strncmp(line_buf, "static", 6) != 0))
{
line = line_buf;
/* Read sizes */
bGetOnWithIt = FALSE;
- while (!bGetOnWithIt && (NULL != fgetline(&line_buf, llmax, &llalloc, in)))
+ while (!bGetOnWithIt && (nullptr != fgetline(&line_buf, llmax, &llalloc, in)))
{
line = line_buf;
while (( line[0] != '\"' ) && ( line[0] != '\0' ))
/* Read color map */
snew(map, mm->nmap);
m = 0;
- while ((m < mm->nmap) && (NULL != fgetline(&line_buf, llmax, &llalloc, in)))
+ while ((m < mm->nmap) && (nullptr != fgetline(&line_buf, llmax, &llalloc, in)))
{
line = std::strchr(line_buf, '\"');
if (line)
{
line = std::strstr(line, "x-axis");
skipstr(line);
- if (mm->axis_x == NULL)
+ if (mm->axis_x == nullptr)
{
snew(mm->axis_x, mm->nx + 1);
}
{
line = std::strstr(line, "y-axis");
skipstr(line);
- if (mm->axis_y == NULL)
+ if (mm->axis_y == nullptr)
{
snew(mm->axis_y, mm->ny + 1);
}
}
}
}
- while ((line[0] != '\"') && (NULL != fgetline(&line_buf, llmax, &llalloc, in)));
+ while ((line[0] != '\"') && (nullptr != fgetline(&line_buf, llmax, &llalloc, in)));
/* Read matrix */
snew(mm->matrix, mm->nx);
m--;
}
}
- while ((m >= 0) && (NULL != fgetline(&line_buf, llmax, &llalloc, in)));
+ while ((m >= 0) && (nullptr != fgetline(&line_buf, llmax, &llalloc, in)));
if (m >= 0)
{
gmx_incons("Not enough rows in the matrix");
int read_xpm_matrix(const char *fnm, t_matrix **mat)
{
FILE *in;
- char *line = NULL;
+ char *line = nullptr;
int nmat;
int llalloc = 0;
in = gmx_fio_fopen(fnm, "r");
nmat = 0;
- while (NULL != fgetline(&line, STRLEN, &llalloc, in))
+ while (nullptr != fgetline(&line, STRLEN, &llalloc, in))
{
if (std::strstr(line, "/* XPM */"))
{
for (i = 0; i < nmap; i++)
{
- if ((map[i].desc == NULL) || (sscanf(map[i].desc, "%lf", &tmp) != 1))
+ if ((map[i].desc == nullptr) || (sscanf(map[i].desc, "%lf", &tmp) != 1))
{
fprintf(stderr, "Could not convert matrix to reals,\n"
"color map entry %d has a non-real description: \"%s\"\n",
i, map[i].desc);
sfree(rmap);
- return NULL;
+ return nullptr;
}
rmap[i] = tmp;
}
- if (out == NULL)
+ if (out == nullptr)
{
snew(out, in->nx);
for (i = 0; i < in->nx; i++)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
int i, j, prec;
size_t sz;
- if (full_matrix != NULL && sparse_matrix != NULL)
+ if (full_matrix != nullptr && sparse_matrix != nullptr)
{
gmx_fatal(FARGS, "Both full AND sparse matrix specified to gmx_mtxio_write().\n");
}
gmx_fio_do_int(fio, nrow);
gmx_fio_do_int(fio, ncol);
- if (full_matrix != NULL)
+ if (full_matrix != nullptr)
{
/* Full matrix storage format */
i = GMX_MTXIO_FULL_MATRIX;
gmx_fio_do_int(fio, i);
- if (i == GMX_MTXIO_FULL_MATRIX && NULL != full_matrix)
+ if (i == GMX_MTXIO_FULL_MATRIX && nullptr != full_matrix)
{
printf("Full matrix storage format, nrow=%d, ncols=%d\n", *nrow, *ncol);
snew((*full_matrix), sz);
gmx_fio_ndo_real(fio, (*full_matrix), sz);
}
- else if (NULL != sparse_matrix)
+ else if (nullptr != sparse_matrix)
{
/* Sparse storage */
printf("Sparse matrix storage format, nrow=%d, ncols=%d\n", *nrow, *ncol);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
static const real timefactors[] = { real(0), real(1e3), real(1), real(1e-3), real(1e-6), real(1e-9), real(1e-12), real(0) };
static const real timeinvfactors[] = { real(0), real(1e-3), real(1), real(1e3), real(1e6), real(1e9), real(1e12), real(0) };
static const char *time_units_str[] = {
- NULL, "fs", "ps", "ns", "us",
+ nullptr, "fs", "ps", "ns", "us",
"\\mus", "ms", "s"
};
static const char *time_units_xvgr[] = {
- NULL, "fs", "ps", "ns",
- "ms", "s", NULL
+ nullptr, "fs", "ps", "ns",
+ "ms", "s", nullptr
};
const char *output_env_get_program_display_name(const gmx_output_env_t *oenv)
{
- const char *displayName = NULL;
+ const char *displayName = nullptr;
try
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
sscanf(sg, "%c %d %d %d", &ident, &syma, &symb, &symc);
if (ident == 'P' && syma == 1 && symb <= 1 && symc <= 1)
{
- fc = strtod(sc, NULL)*0.1;
+ fc = strtod(sc, nullptr)*0.1;
ePBC_file = (fc > 0 ? epbcXYZ : epbcXY);
}
if (ident == 'P' && syma == 21 && symb == 1 && symc == 1)
if (box)
{
- fa = strtod(sa, NULL)*0.1;
- fb = strtod(sb, NULL)*0.1;
- fc = strtod(sc, NULL)*0.1;
+ fa = strtod(sa, nullptr)*0.1;
+ fb = strtod(sb, nullptr)*0.1;
+ fc = strtod(sc, nullptr)*0.1;
if (ePBC_file == epbcSCREW)
{
fa *= 0.5;
fprintf(out, "MODEL %8d\n", model_nr > 0 ? model_nr : 1);
lastchainnum = -1;
- p_restype = NULL;
+ p_restype = nullptr;
for (ii = 0; ii < nindex; ii++)
{
fprintf(out, "TER\n");
fprintf(out, "ENDMDL\n");
- if (NULL != gc)
+ if (nullptr != gc)
{
/* Write conect records */
for (i = 0; (i < gc->nconect); i++)
trim(anm);
/* Search backwards for number and name only */
- atomnr = std::strtol(anr, NULL, 10);
+ atomnr = std::strtol(anr, nullptr, 10);
for (i = natom-1; (i >= 0); i--)
{
if ((std::strcmp(anm, *(atoms->atomname[i])) == 0) &&
}
else
{
- ptr = NULL;
+ ptr = nullptr;
}
- std::strncpy(atoms->atom[i].elem, ptr == NULL ? "" : ptr, 4);
+ std::strncpy(atoms->atom[i].elem, ptr == nullptr ? "" : ptr, 4);
}
}
}
rnr[k] = nc;
trim(rnr);
- resnr = std::strtol(rnr, NULL, 10);
+ resnr = std::strtol(rnr, nullptr, 10);
resic = line[j];
j += 4;
atomn->atomnumber = atomnumber;
strncpy(atomn->elem, elem, 4);
}
- x[natom][XX] = strtod(xc, NULL)*0.1;
- x[natom][YY] = strtod(yc, NULL)*0.1;
- x[natom][ZZ] = strtod(zc, NULL)*0.1;
+ x[natom][XX] = strtod(xc, nullptr)*0.1;
+ x[natom][YY] = strtod(yc, nullptr)*0.1;
+ x[natom][ZZ] = strtod(zc, nullptr)*0.1;
if (atoms->pdbinfo)
{
atoms->pdbinfo[natom].type = type;
- atoms->pdbinfo[natom].atomnr = strtol(anr, NULL, 10);
+ atoms->pdbinfo[natom].atomnr = strtol(anr, nullptr, 10);
atoms->pdbinfo[natom].altloc = altloc;
strcpy(atoms->pdbinfo[natom].atomnm, anm_copy);
- atoms->pdbinfo[natom].bfac = strtod(bfac, NULL);
- atoms->pdbinfo[natom].occup = strtod(occup, NULL);
+ atoms->pdbinfo[natom].bfac = strtod(bfac, nullptr);
+ atoms->pdbinfo[natom].occup = strtod(occup, nullptr);
}
natom++;
/* Only assume pbc when there is a CRYST1 entry */
*ePBC = epbcNONE;
}
- if (box != NULL)
+ if (box != nullptr)
{
clear_mat(box);
}
atoms->haveCharge = FALSE;
atoms->haveType = FALSE;
atoms->haveBState = FALSE;
- atoms->havePdbInfo = (atoms->pdbinfo != NULL);
+ atoms->havePdbInfo = (atoms->pdbinfo != nullptr);
bCOMPND = FALSE;
title[0] = '\0';
natom = 0;
chainnum = 0;
- while (!bStop && (fgets2(line, STRLEN, in) != NULL))
+ while (!bStop && (fgets2(line, STRLEN, in) != nullptr))
{
line_type = line2type(line);
{
FILE *in = gmx_fio_fopen(infile, "r");
char title[STRLEN];
- read_pdbfile(in, title, NULL, atoms, symtab, x, ePBC, box, TRUE, NULL);
+ read_pdbfile(in, title, nullptr, atoms, symtab, x, ePBC, box, TRUE, nullptr);
*name = put_symtab(symtab, title);
gmx_fio_fclose(in);
}
}
/* Format atom name */
- if (atom_name != NULL)
+ if (atom_name != nullptr)
{
/* If the atom name is an element name with two chars, it should start already in column 13.
* Otherwise it should start in column 14, unless the name length is 4 chars.
*/
- if ( (element != NULL) && (std::strlen(element) >= 2) && (gmx_strncasecmp(atom_name, element, 2) == 0) )
+ if ( (element != nullptr) && (std::strlen(element) >= 2) && (gmx_strncasecmp(atom_name, element, 2) == 0) )
{
start_name_in_col13 = TRUE;
}
}
/* Format residue name */
- std::strncpy(tmp_resname, (res_name != NULL) ? res_name : "", 4);
+ std::strncpy(tmp_resname, (res_name != nullptr) ? res_name : "", 4);
/* Make sure the string is terminated if strlen was > 4 */
tmp_resname[4] = '\0';
/* String is properly terminated, so now we can use strcat. By adding a
x, y, z,
occupancy,
b_factor,
- (element != NULL) ? element : "");
+ (element != nullptr) ? element : "");
return n;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
FILE *in;
char buf[STRLEN], lbuf[STRLEN], rbuf[STRLEN], warn_buf[STRLEN];
char *ptr, *cptr;
- t_inpfile *inp = NULL;
+ t_inpfile *inp = nullptr;
int nin, lc, i, j, k;
// strchr, etc. rather than re-inventing wheels.
/* Strip comment */
- if ((cptr = std::strchr(buf, COMMENTSIGN)) != NULL)
+ if ((cptr = std::strchr(buf, COMMENTSIGN)) != nullptr)
{
*cptr = '\0';
}
{
int i;
- if (inp == NULL)
+ if (inp == nullptr)
{
return -1;
}
}
else
{
- (*inp)[(*ninp)-1].value = NULL;
+ (*inp)[(*ninp)-1].value = nullptr;
}
return def;
return 0;
}
- for (i = 0; (defs[i] != NULL); i++)
+ for (i = 0; (defs[i] != nullptr); i++)
{
if (gmx_strcasecmp_min(defs[i], (*inp)[ii].value) == 0)
{
}
}
- if (defs[i] == NULL)
+ if (defs[i] == nullptr)
{
n += sprintf(buf, "Invalid enum '%s' for variable %s, using '%s'\n",
(*inp)[ii].value, name, defs[0]);
n += sprintf(buf+n, " '%s'", defs[j]);
j++;
}
- if (wi != NULL)
+ if (wi != nullptr)
{
warning_error(wi, buf);
}
int get_eenum(int *ninp, t_inpfile **inp, const char *name, const char **defs)
{
- return get_eeenum(ninp, inp, name, defs, NULL);
+ return get_eeenum(ninp, inp, name, defs, nullptr);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
generateReferenceTopology();
generateReferenceCoordinates();
- testTop_ = NULL;
- testX_ = NULL;
+ testTop_ = nullptr;
+ testX_ = nullptr;
clear_mat(testBox_);
referenceFilename_ =
fileManager_.getTemporaryFilePath(getFileSuffix("ref"));
}
~StructureIORoundtripTest()
{
- if (testTop_ != NULL)
+ if (testTop_ != nullptr)
{
done_top(testTop_);
sfree(testTop_);
void writeReferenceFile()
{
write_sto_conf(referenceFilename_.c_str(), *refTop_->name,
- &refTop_->atoms, as_rvec_array(refX_.data()), NULL, -1,
+ &refTop_->atoms, as_rvec_array(refX_.data()), nullptr, -1,
refBox_);
}
snew(testTop_, 1);
int ePBC = -2;
read_tps_conf(referenceFilename_.c_str(), testTop_,
- &ePBC, &testX_, NULL, testBox_, FALSE);
+ &ePBC, &testX_, nullptr, testBox_, FALSE);
}
void testTopologies()
void writeTestFileAndTest()
{
write_sto_conf(testFilename_.c_str(), *testTop_->name,
- &testTop_->atoms, testX_, NULL, -1, testBox_);
+ &testTop_->atoms, testX_, nullptr, -1, testBox_);
testFilesEqual(referenceFilename_, testFilename_);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
public:
ReadTest() : numInputs_(1),
- inputField_(0),
+ inputField_(nullptr),
inpGuard_(),
wi_(),
wiGuard_()
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2016, by the GROMACS development team, led by
+ * Copyright (c) 2013,2014,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.
TEST_F(TngTest, CloseBeforeOpenIsNotFatal)
{
- tng_trajectory_t tng = NULL;
+ tng_trajectory_t tng = nullptr;
gmx_tng_close(&tng);
}
gmx_int64_t numMolecules,
tng_molecule_t *tngMol)
{
- tng_chain_t tngChain = NULL;
- tng_residue_t tngRes = NULL;
+ tng_chain_t tngChain = nullptr;
+ tng_residue_t tngRes = nullptr;
if (tng_molecule_add(tng, moleculeName, tngMol) != TNG_SUCCESS)
{
{
const t_resinfo *resInfo = &atoms->resinfo[at->resind];
char chainName[2] = {resInfo->chainid, 0};
- tng_atom_t tngAtom = NULL;
+ tng_atom_t tngAtom = nullptr;
t_atom *prevAtom;
if (atomIndex > 0)
}
else
{
- prevAtom = 0;
+ prevAtom = nullptr;
}
/* If this is the first atom or if the residue changed add the
for (int molIndex = 0; molIndex < mtop->nmolblock; molIndex++)
{
- tng_molecule_t tngMol = NULL;
+ tng_molecule_t tngMol = nullptr;
const gmx_moltype_t *molType =
&mtop->moltype[mtop->molblock[molIndex].type];
gmx_bool bOK = TRUE;
tng_function_status stat;
gmx_int64_t numberOfAtoms = -1, frameNumber = -1;
- gmx_int64_t nBlocks, blockId, *blockIds = NULL, codecId;
+ gmx_int64_t nBlocks, blockId, *blockIds = nullptr, codecId;
char datatype = -1;
- void *values = NULL;
+ void *values = nullptr;
double frameTime = -1.0;
int size, blockDependency;
double prec;
char datatype = -1;
gmx_int64_t codecId;
int blockDependency;
- void *data = 0;
+ void *data = nullptr;
double localPrec;
stat = tng_data_block_name_get(input, blockId, name, maxLen);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
else
{
- pcrd->externalPotentialProvider = NULL;
+ pcrd->externalPotentialProvider = nullptr;
}
}
else
{
if (bRead)
{
- pcrd->externalPotentialProvider = NULL;
+ pcrd->externalPotentialProvider = nullptr;
}
}
/* Note that we try to support adding new geometries without
else
{
fepvals->n_lambda = 0;
- fepvals->all_lambda = NULL;
+ fepvals->all_lambda = nullptr;
if (fepvals->init_lambda >= 0)
{
fepvals->separate_dvdl[efptFEP] = TRUE;
if (bClear)
{
ilist[j].nr = 0;
- ilist[j].iatoms = NULL;
+ ilist[j].iatoms = nullptr;
}
else
{
}
if (bRead)
{
- if ((block->nalloc_index > 0) && (NULL != block->index))
+ if ((block->nalloc_index > 0) && (nullptr != block->index))
{
sfree(block->index);
}
{
snew(groups->grpname, groups->ngrpname);
}
- atoms->pdbinfo = NULL;
+ atoms->pdbinfo = nullptr;
}
else
{
{
if (bRead)
{
- groups->grpnr[g] = NULL;
+ groups->grpnr[g] = nullptr;
}
}
else
else
{
symbuf = symtab->symbuf;
- while (symbuf != NULL)
+ while (symbuf != nullptr)
{
for (i = 0; (i < symbuf->bufsize) && (i < nr); i++)
{
{
mtop->ffparams.cmap_grid.ngrid = 0;
mtop->ffparams.cmap_grid.grid_spacing = 0;
- mtop->ffparams.cmap_grid.cmapdata = NULL;
+ mtop->ffparams.cmap_grid.cmapdata = nullptr;
}
if (file_version >= 57)
if (!bRead)
{
- GMX_RELEASE_ASSERT(x == NULL && v == NULL, "Passing separate x and v pointers to do_tpx() is not supported when writing");
+ GMX_RELEASE_ASSERT(x == nullptr && v == nullptr, "Passing separate x and v pointers to do_tpx() is not supported when writing");
tpx.natoms = state->natoms;
tpx.ngtc = state->ngtc;
tpx.fep_state = state->fep_state;
tpx.lambda = state->lambda[efptFEP];
- tpx.bIr = (ir != NULL);
- tpx.bTop = (mtop != NULL);
+ tpx.bIr = (ir != nullptr);
+ tpx.bTop = (mtop != nullptr);
tpx.bX = (state->flags & (1 << estX));
tpx.bV = (state->flags & (1 << estV));
tpx.bF = FALSE;
}
else
{
- GMX_RELEASE_ASSERT(!(x == NULL && v != NULL), "Passing x==NULL and v!=NULL is not supported");
+ GMX_RELEASE_ASSERT(!(x == nullptr && v != nullptr), "Passing x==NULL and v!=NULL is not supported");
}
- TopOnlyOK = (ir == NULL);
+ TopOnlyOK = (ir == nullptr);
int fileVersion; /* Version number of the code that wrote the file */
int fileGeneration; /* Generation version number of the code that wrote the file */
if (bRead)
{
state->flags = 0;
- if (x != NULL)
+ if (x != nullptr)
{
init_state(state, 0, tpx.ngtc, 0, 0, 0);
}
}
}
- if (x == NULL)
+ if (x == nullptr)
{
x = as_rvec_array(state->x.data());
v = as_rvec_array(state->v.data());
}
if (fileGeneration <= tpx_generation && ir)
{
- do_inputrec(fio, ir, bRead, fileVersion, mtop ? &mtop->ffparams.fudgeQQ : NULL);
+ do_inputrec(fio, ir, bRead, fileVersion, mtop ? &mtop->ffparams.fudgeQQ : nullptr);
if (fileVersion < 51)
{
set_box_rel(ir, state);
t_fileio *fio;
fio = open_tpx(fn, "r");
- do_tpxheader(fio, TRUE, tpx, TopOnlyOK, NULL, NULL);
+ do_tpxheader(fio, TRUE, tpx, TopOnlyOK, nullptr, nullptr);
close_tpx(fio);
}
fio = open_tpx(fn, "w");
do_tpx(fio, FALSE,
const_cast<t_inputrec *>(ir),
- const_cast<t_state *>(state), NULL, NULL,
+ const_cast<t_state *>(state), nullptr, nullptr,
const_cast<gmx_mtop_t *>(mtop));
close_tpx(fio);
}
t_fileio *fio;
fio = open_tpx(fn, "r");
- do_tpx(fio, TRUE, ir, state, NULL, NULL, mtop);
+ do_tpx(fio, TRUE, ir, state, nullptr, nullptr, mtop);
close_tpx(fio);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
static void status_init(t_trxstatus *status)
{
status->flags = 0;
- status->xframe = NULL;
- status->fio = NULL;
+ status->xframe = nullptr;
+ status->fio = nullptr;
status->__frame = -1;
status->t0 = 0;
status->tf = 0;
- status->persistent_line = NULL;
- status->tng = NULL;
+ status->persistent_line = nullptr;
+ status->tng = nullptr;
}
{
fr->bDouble = FALSE;
fr->natoms = -1;
- fr->title = NULL;
+ fr->title = nullptr;
fr->step = 0;
fr->time = 0;
fr->lambda = 0;
fr->fep_state = 0;
- fr->atoms = NULL;
+ fr->atoms = nullptr;
fr->prec = 0;
- fr->x = NULL;
- fr->v = NULL;
- fr->f = NULL;
+ fr->x = nullptr;
+ fr->v = nullptr;
+ fr->f = nullptr;
clear_mat(fr->box);
fr->bPBC = FALSE;
fr->ePBC = -1;
const int *ind, gmx_conect gc)
{
char title[STRLEN];
- rvec *xout = NULL, *vout = NULL, *fout = NULL;
+ rvec *xout = nullptr, *vout = nullptr, *fout = nullptr;
int i, ftp = -1;
real prec;
if (ftp == efGRO)
{
write_hconf_indexed_p(gmx_fio_getfp(status->fio), title, fr->atoms, nind, ind,
- fr->x, fr->bV ? fr->v : NULL, fr->box);
+ fr->x, fr->bV ? fr->v : nullptr, fr->box);
}
else
{
gmx_incons("Sorry, can only prepare for TNG output.");
}
- if (*out == NULL)
+ if (*out == nullptr)
{
snew((*out), 1);
}
status_init(*out);
- if (in != NULL)
+ if (in != nullptr)
{
gmx_prepare_tng_writing(filename,
filemode,
break;
case efTRR:
gmx_trr_write_frame(status->fio, fr->step, fr->time, fr->lambda, fr->box, fr->natoms,
- fr->bX ? fr->x : NULL, fr->bV ? fr->v : NULL, fr->bF ? fr->f : NULL);
+ fr->bX ? fr->x : nullptr, fr->bV ? fr->v : nullptr, fr->bF ? fr->f : nullptr);
break;
case efGRO:
case efPDB:
if (gmx_fio_getftp(status->fio) == efGRO)
{
write_hconf_p(gmx_fio_getfp(status->fio), title, fr->atoms,
- fr->x, fr->bV ? fr->v : NULL, fr->box);
+ fr->x, fr->bV ? fr->v : nullptr, fr->box);
}
else
{
}
break;
case efG96:
- write_g96_conf(gmx_fio_getfp(status->fio), fr, -1, NULL);
+ write_g96_conf(gmx_fio_getfp(status->fio), fr, -1, nullptr);
break;
default:
gmx_fatal(FARGS, "Sorry, write_trxframe can not write %s",
fr.step = step;
fr.bTime = TRUE;
fr.time = time;
- fr.bAtoms = atoms != NULL;
+ fr.bAtoms = atoms != nullptr;
fr.atoms = const_cast<t_atoms *>(atoms);
fr.bX = TRUE;
fr.x = x;
- fr.bV = v != NULL;
+ fr.bV = v != nullptr;
fr.v = v;
fr.bBox = TRUE;
copy_mat(box, fr.box);
fr->bBox = sh.box_size > 0;
if (status->flags & (TRX_READ_X | TRX_NEED_X))
{
- if (fr->x == NULL)
+ if (fr->x == nullptr)
{
snew(fr->x, sh.natoms);
}
}
if (status->flags & (TRX_READ_V | TRX_NEED_V))
{
- if (fr->v == NULL)
+ if (fr->v == nullptr)
{
snew(fr->v, sh.natoms);
}
}
if (status->flags & (TRX_READ_F | TRX_NEED_F))
{
- if (fr->f == NULL)
+ if (fr->f == nullptr)
{
snew(fr->f, sh.natoms);
}
double dbl;
atoms.nr = fr->natoms;
- atoms.atom = NULL;
- atoms.pdbinfo = NULL;
+ atoms.atom = nullptr;
+ atoms.pdbinfo = nullptr;
/* the other pointers in atoms should not be accessed if these are NULL */
snew(symtab, 1);
open_symtab(symtab);
- na = read_pdbfile(fp, title, &model_nr, &atoms, symtab, fr->x, &ePBC, boxpdb, TRUE, NULL);
+ na = read_pdbfile(fp, title, &model_nr, &atoms, symtab, fr->x, &ePBC, boxpdb, TRUE, nullptr);
free_symtab(symtab);
sfree(symtab);
set_trxframe_ePBC(fr, ePBC);
t_symtab *symtab;
snew(symtab, 1);
open_symtab(symtab);
- read_g96_conf(gmx_fio_getfp(status->fio), NULL, fr,
+ read_g96_conf(gmx_fio_getfp(status->fio), nullptr, fr,
symtab, status->persistent_line);
free_symtab(symtab);
bRet = (fr->natoms > 0);
}
break;
case efTNG:
- bRet = gmx_read_next_tng_frame(status->tng, fr, NULL, 0);
+ bRet = gmx_read_next_tng_frame(status->tng, fr, nullptr, 0);
break;
case efPDB:
bRet = pdb_next_x(status, gmx_fio_getfp(status->fio), fr);
break;
case efTNG:
fr->step = -1;
- if (!gmx_read_next_tng_frame((*status)->tng, fr, NULL, 0))
+ if (!gmx_read_next_tng_frame((*status)->tng, fr, nullptr, 0))
{
fr->not_ok = DATA_NOT_OK;
fr->natoms = 0;
t_topology *top;
snew(top, 1);
- epbc = read_tpx_top(fn, NULL, NULL, &natoms, NULL, NULL, top);
+ epbc = read_tpx_top(fn, nullptr, nullptr, &natoms, nullptr, nullptr, top);
if (ePBC)
{
*ePBC = epbc;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,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.
}
/* in case this library does not support the filetype, close it */
- if (vmdplugin->api == NULL)
+ if (vmdplugin->api == nullptr)
{
vmddlclose(handle);
}
sprintf(defpathenv, "%s\\University of Illinois\\VMD\\plugins\\WIN32\\molfile", progfolder);
#endif
- vmdplugin->api = NULL;
+ vmdplugin->api = nullptr;
vmdplugin->filetype = strrchr(fn, '.');
if (!vmdplugin->filetype)
{
* given at configure time. This last might be hard-coded to the
* default for VMD installs. */
pathenv = getenv("VMD_PLUGIN_PATH");
- if (pathenv == NULL)
+ if (pathenv == nullptr)
{
pathenv = getenv("VMDDIR");
- if (NULL == pathenv)
+ if (nullptr == pathenv)
{
printf("\nNeither VMD_PLUGIN_PATH or VMDDIR set. ");
printf("Using default location:\n%s\n", defpathenv);
strncpy(pathname, pathenv, sizeof(pathname));
#if !GMX_NATIVE_WINDOWS
strcat(pathname, "/*.so");
- glob(pathname, 0, NULL, &globbuf);
+ glob(pathname, 0, nullptr, &globbuf);
if (globbuf.gl_pathc == 0)
{
printf("\nNo VMD Plugins found\n"
"The architecture (e.g. 32bit versus 64bit) of GROMACS and VMD has to match.\n");
return 0;
}
- for (size_t i = 0; i < globbuf.gl_pathc && vmdplugin->api == NULL; i++)
+ for (size_t i = 0; i < globbuf.gl_pathc && vmdplugin->api == nullptr; i++)
{
/* FIXME: Undefined which plugin is chosen if more than one plugin
can read a certain file ending. Requires some additional command
return 0;
}
- if (vmdplugin->api == NULL)
+ if (vmdplugin->api == nullptr)
{
printf("\nNo plugin for %s found\n", vmdplugin->filetype);
return 0;
int read_first_vmd_frame(const char *fn, gmx_vmdplugin_t **vmdpluginp, t_trxframe *fr)
{
- molfile_timestep_metadata_t *metadata = NULL;
+ molfile_timestep_metadata_t *metadata = nullptr;
gmx_vmdplugin_t *vmdplugin;
snew(vmdplugin, 1);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
void set_warning_line(warninp_t wi, const char *s, int line)
{
- if (s != NULL)
+ if (s != nullptr)
{
std::strcpy(wi->filenm, s);
}
char *temp, *temp2;
int i;
- if (s == NULL)
+ if (s == nullptr)
{
s = "Empty error message.";
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
ps->nrgb = 0;
ps->maxrgb = 0;
- ps->rgb = NULL;
+ ps->rgb = nullptr;
ps->gen_ybox = 0;
ps->ostack = 0;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
char *buf, int buflen)
{
/* Supported greek letter names and corresponding xmgrace/xmgr symbols */
- const char *sym[] = { "beta", "chi", "delta", "eta", "lambda", "mu", "omega", "phi", "psi", "rho", "theta", NULL };
+ const char *sym[] = { "beta", "chi", "delta", "eta", "lambda", "mu", "omega", "phi", "psi", "rho", "theta", nullptr };
const char symc[] = { 'b', 'c', 'd', 'h', 'l', 'm', 'w', 'f', 'y', 'r', 'q', '\0' };
int xvgf;
gmx_bool bXVGR;
{
/* Check for special symbol */
i = 0;
- while (sym[i] != NULL &&
+ while (sym[i] != nullptr &&
gmx_strncasecmp(sym[i], gmx+g, std::strlen(sym[i])) != 0)
{
i++;
}
- if (sym[i] != NULL)
+ if (sym[i] != nullptr)
{
c = symc[i];
if (std::isupper(gmx[g]))
curp = 0;
}
}
- if (fgets(*ptr + curp, len_remaining, fp) == NULL)
+ if (fgets(*ptr + curp, len_remaining, fp) == nullptr)
{
/* if last line, skip */
- return NULL;
+ return nullptr;
}
curp += len_remaining-1; /* overwrite the nul char in next iteration */
len_remaining = 1;
}
- while ((std::strchr(*ptr, '\n') == NULL) && (!feof(fp)));
+ while ((std::strchr(*ptr, '\n') == nullptr) && (!feof(fp)));
if (*len + STRLEN >= maxlen)
{
- return NULL; /* this line was too long */
+ return nullptr; /* this line was too long */
}
if (feof(fp))
{
/* We reached EOF before '\n', skip this last line. */
- return NULL;
+ return nullptr;
}
{
/* now remove newline */
int cur = 0;
#define prev (1-cur)
- if (NULL != ptr)
+ if (nullptr != ptr)
{
for (i = 0; (ptr[i] != '\0'); i++)
{
char *str;
ptr0 = std::strchr(line, '"');
- if (ptr0 != NULL)
+ if (ptr0 != nullptr)
{
ptr0++;
ptr1 = std::strchr(ptr0, '"');
- if (ptr1 != NULL)
+ if (ptr1 != nullptr)
{
str = gmx_strdup(ptr0);
str[ptr1-ptr0] = '\0';
{
FILE *fp;
char *ptr;
- char *base = NULL;
- char *fmt = NULL;
+ char *base = nullptr;
+ char *fmt = nullptr;
int k, line = 0, nny, nx, maxx, rval, legend_nalloc, set, nchar;
double lf;
- double **yy = NULL;
+ double **yy = nullptr;
char *tmpbuf;
int len = STRLEN;
*ny = 0;
fp = gmx_fio_fopen(fn, "r");
snew(tmpbuf, len);
- if (subtitle != NULL)
+ if (subtitle != nullptr)
{
- *subtitle = NULL;
+ *subtitle = nullptr;
}
legend_nalloc = 0;
- if (legend != NULL)
+ if (legend != nullptr)
{
- *legend = NULL;
+ *legend = nullptr;
}
- while ((ptr = fgets3(fp, &tmpbuf, &len, 10*STRLEN)) != NULL && ptr[0] != '&')
+ while ((ptr = fgets3(fp, &tmpbuf, &len, 10*STRLEN)) != nullptr && ptr[0] != '&')
{
line++;
trim(ptr);
if (ptr[0] == '@')
{
- if (legend != NULL)
+ if (legend != nullptr)
{
ptr++;
trim(ptr);
if (std::strncmp(ptr, "subtitle", 8) == 0)
{
ptr += 8;
- if (subtitle != NULL)
+ if (subtitle != nullptr)
{
*subtitle = read_xvgr_string(ptr);
}
srenew(*legend, *ny-1);
for (set = legend_nalloc; set < *ny-1; set++)
{
- (*legend)[set] = NULL;
+ (*legend)[set] = nullptr;
}
}
}
int read_xvg(const char *fn, double ***y, int *ny)
{
- return read_xvg_legend(fn, y, ny, NULL, NULL);
+ return read_xvg_legend(fn, y, ny, nullptr, nullptr);
}
void write_xvg(const char *fn, const char *title, int nx, int ny, real **y,
real **val;
t_nalloc = 0;
- *t = NULL;
- val = NULL;
- val_nalloc = NULL;
+ *t = nullptr;
+ val = nullptr;
+ val_nalloc = nullptr;
*nset = 0;
*dt = 0;
fp = gmx_fio_fopen(fn, "r");
srenew(val, *nset);
srenew(val_nalloc, *nset);
val_nalloc[set] = 0;
- val[set] = NULL;
+ val[set] = nullptr;
}
}
if (set == -1)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* dihedrals to aromatic rings, COO, CONH2 or guanidinium are 2fold*/
if (Dih > edOmega && (dlist[i].atm.Cn[Dih-NONCHI+3] != -1))
{
- if ( ((std::strstr(name, "PHE") != NULL) && (Dih == edChi2)) ||
- ((std::strstr(name, "TYR") != NULL) && (Dih == edChi2)) ||
- ((std::strstr(name, "PTR") != NULL) && (Dih == edChi2)) ||
- ((std::strstr(name, "TRP") != NULL) && (Dih == edChi2)) ||
- ((std::strstr(name, "HIS") != NULL) && (Dih == edChi2)) ||
- ((std::strstr(name, "GLU") != NULL) && (Dih == edChi3)) ||
- ((std::strstr(name, "ASP") != NULL) && (Dih == edChi2)) ||
- ((std::strstr(name, "GLN") != NULL) && (Dih == edChi3)) ||
- ((std::strstr(name, "ASN") != NULL) && (Dih == edChi2)) ||
- ((std::strstr(name, "ARG") != NULL) && (Dih == edChi4)) )
+ if ( ((std::strstr(name, "PHE") != nullptr) && (Dih == edChi2)) ||
+ ((std::strstr(name, "TYR") != nullptr) && (Dih == edChi2)) ||
+ ((std::strstr(name, "PTR") != nullptr) && (Dih == edChi2)) ||
+ ((std::strstr(name, "TRP") != nullptr) && (Dih == edChi2)) ||
+ ((std::strstr(name, "HIS") != nullptr) && (Dih == edChi2)) ||
+ ((std::strstr(name, "GLU") != nullptr) && (Dih == edChi3)) ||
+ ((std::strstr(name, "ASP") != nullptr) && (Dih == edChi2)) ||
+ ((std::strstr(name, "GLN") != nullptr) && (Dih == edChi3)) ||
+ ((std::strstr(name, "ASN") != nullptr) && (Dih == edChi2)) ||
+ ((std::strstr(name, "ARG") != nullptr) && (Dih == edChi4)) )
{
multiplicity[j] = 2;
}
/* make a histogram pf culm. rotamer occupancy too */
snew(chi_prhist, nbin);
- make_histo(NULL, nframes, chi_prtrj, nbin, chi_prhist, 0, nbin);
+ make_histo(nullptr, nframes, chi_prtrj, nbin, chi_prhist, 0, nbin);
if (bAll)
{
sprintf(hisfile, "histo-chiprod%s.xvg", dlist[i].name);
total = 0;
teller = 0;
n_alloc = 0;
- *time = NULL;
- *trans_frac = NULL;
- *aver_angle = NULL;
+ *time = nullptr;
+ *trans_frac = nullptr;
+ *aver_angle = nullptr;
do
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
sfree((*m)->m_ind);
sfree((*m)->erow);
sfree(*m);
- *m = NULL;
+ *m = nullptr;
}
real mat_energy(t_mat *m)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_trr_read_frame_header(status, &head, &bOK);
*natoms = head.natoms;
snew(*xav, *natoms);
- gmx_trr_read_frame_data(status, &head, box, *xav, NULL, NULL);
+ gmx_trr_read_frame_data(status, &head, box, *xav, nullptr, nullptr);
if ((head.t >= -1.1) && (head.t <= -0.9))
{
{
fprintf(stderr, "Eigenvectors in %s were determined without fitting\n", file);
sfree(*xref);
- *xref = NULL;
+ *xref = nullptr;
}
gmx_trr_read_frame_header(status, &head, &bOK);
- gmx_trr_read_frame_data(status, &head, box, *xav, NULL, NULL);
+ gmx_trr_read_frame_data(status, &head, box, *xav, nullptr, nullptr);
}
else
{
*bFit = TRUE;
- *xref = NULL;
+ *xref = nullptr;
}
*bDMA = (head.lambda > 0.5);
if ((head.t <= -0.01) || (head.t >= 0.01))
*nvec = 0;
while (gmx_trr_read_frame_header(status, &head, &bOK))
{
- gmx_trr_read_frame_data(status, &head, box, x, NULL, NULL);
+ gmx_trr_read_frame_data(status, &head, box, x, nullptr, nullptr);
if (*nvec >= snew_size)
{
snew_size += 10;
if (WriteXref == eWXR_YES)
{
/* misuse lambda: 0/1 mass weighted fit no/yes */
- gmx_trr_write_frame(trrout, -1, -1, bDMR ? 1.0 : 0.0, zerobox, natoms, xref, NULL, NULL);
+ gmx_trr_write_frame(trrout, -1, -1, bDMR ? 1.0 : 0.0, zerobox, natoms, xref, nullptr, nullptr);
}
else if (WriteXref == eWXR_NOFIT)
{
/* misuse lambda: -1 no fit */
- gmx_trr_write_frame(trrout, -1, -1, -1.0, zerobox, natoms, x, NULL, NULL);
+ gmx_trr_write_frame(trrout, -1, -1, -1.0, zerobox, natoms, x, nullptr, nullptr);
}
/* misuse lambda: 0/1 mass weighted analysis no/yes */
- gmx_trr_write_frame(trrout, 0, 0, bDMA ? 1.0 : 0.0, zerobox, natoms, xav, NULL, NULL);
+ gmx_trr_write_frame(trrout, 0, 0, bDMA ? 1.0 : 0.0, zerobox, natoms, xav, nullptr, nullptr);
for (i = 0; i <= (end-begin); i++)
{
}
/* Store the eigenvalue in the time field */
- gmx_trr_write_frame(trrout, begin+i, eigval[vec], 0, zerobox, natoms, x, NULL, NULL);
+ gmx_trr_write_frame(trrout, begin+i, eigval[vec], 0, zerobox, natoms, x, nullptr, nullptr);
}
gmx_trr_close(trrout);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
rvec x[], int nca,
int caindex[], gmx_bool bFit)
{
- static rvec *xref = NULL;
- static real *mass = NULL;
+ static rvec *xref = nullptr;
+ static real *mass = nullptr;
const real d = 0.15; /* Rise per residue (nm) */
const real tw = 1.745; /* Twist per residue (rad) */
const real rad = 0.23; /* Radius of the helix (nm) */
gmx_fatal(FARGS, "Need at least 3 Calphas to fit to, (now %d)...\n", nca);
}
- if (xref == NULL)
+ if (xref == nullptr)
{
snew(xref, natoms);
snew(mass, natoms);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
snew(pdbf, 1);
t_topology top;
- read_tps_conf(fn, &top, &pdbf->ePBC, &pdbf->x, NULL, pdbf->box, FALSE);
+ read_tps_conf(fn, &top, &pdbf->ePBC, &pdbf->x, nullptr, pdbf->box, FALSE);
pdbf->atoms = top.atoms;
fp = gmx_ffopen(fn, "r");
char buf[256], *ptr;
- while ((ptr = fgets2(buf, 255, fp)) != NULL)
+ while ((ptr = fgets2(buf, 255, fp)) != nullptr)
{
- if (std::strstr(buf, "Intermolecular") != NULL)
+ if (std::strstr(buf, "Intermolecular") != nullptr)
{
ptr = std::strchr(buf, '=');
sscanf(ptr+1, "%lf", &e);
pdbf->edocked = e;
}
- else if (std::strstr(buf, "Estimated Free") != NULL)
+ else if (std::strstr(buf, "Estimated Free") != nullptr)
{
ptr = std::strchr(buf, '=');
sscanf(ptr+1, "%lf", &e);
static t_pdbfile **read_em_all(const char *fn, int *npdbf)
{
- t_pdbfile **pdbf = 0;
+ t_pdbfile **pdbf = nullptr;
int i, maxpdbf;
char buf[256], name[256];
gmx_bool bExist;
gmx_stats_add_point(ed, i-start, pdbf[i]->edocked, 0, 0);
gmx_stats_add_point(ef, i-start, pdbf[i]->efree, 0, 0);
}
- gmx_stats_get_ase(ed, &aver, &sigma, NULL);
+ gmx_stats_get_ase(ed, &aver, &sigma, nullptr);
fprintf(fp, " <%12s> = %8.3f (+/- %6.3f)\n", etitles[FALSE], aver, sigma);
- gmx_stats_get_ase(ef, &aver, &sigma, NULL);
+ gmx_stats_get_ase(ef, &aver, &sigma, nullptr);
fprintf(fp, " <%12s> = %8.3f (+/- %6.3f)\n", etitles[TRUE], aver, sigma);
gmx_stats_free(ed);
gmx_stats_free(ef);
"energy or average energy."
};
t_filenm fnm[] = {
- { efPDB, "-f", NULL, ffREAD },
+ { efPDB, "-f", nullptr, ffREAD },
{ efXVG, "-od", "edocked", ffWRITE },
{ efXVG, "-of", "efree", ffWRITE },
{ efLOG, "-g", "anadock", ffWRITE }
#define NPA asize(pa)
FILE *fp;
- t_pdbfile **pdbf = NULL;
+ t_pdbfile **pdbf = nullptr;
int npdbf;
if (!parse_common_args(&argc, argv, 0, NFILE, fnm, NPA, pa, asize(desc), desc, 0,
- NULL, &oenv))
+ nullptr, &oenv))
{
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
// better to be safe than sorry, so we check it with an assert.
// If we are in this comparison routine in the first place, neig2 should not be 0,
// so eigval2 should always be a valid pointer.
- GMX_RELEASE_ASSERT(eigval2 != NULL, "NULL pointer provided for eigval2");
+ GMX_RELEASE_ASSERT(eigval2 != nullptr, "NULL pointer provided for eigval2");
for (i = n; i < neig2; i++)
{
int noutvec, int *outvec, gmx_bool bSplit,
const gmx_output_env_t *oenv)
{
- FILE *xvgrout = NULL;
+ FILE *xvgrout = nullptr;
int nat, i, j, d, v, vec, nfr, nframes = 0, snew_size, frame;
- t_trxstatus *out = NULL;
+ t_trxstatus *out = nullptr;
t_trxstatus *status;
int noutvec_extr, imin, imax;
real *pmin, *pmax;
int *all_at;
matrix box;
rvec *xread, *x;
- real t, inp, **inprod = NULL;
+ real t, inp, **inprod = nullptr;
char str[STRLEN], str2[STRLEN], **ylabel, *c;
real fact;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
snew(x, natoms);
/* calculate x: a fitted struture of the selected atoms */
if (bFit)
{
- reset_x(nfit, ifit, nat, NULL, xread, w_rls);
+ reset_x(nfit, ifit, nat, nullptr, xread, w_rls);
do_fit(nat, w_rls, xref, xread);
}
for (i = 0; i < natoms; i++)
}
}
}
- write_trx(out, natoms, index, atoms, 0, t, box, xread, NULL, NULL);
+ write_trx(out, natoms, index, atoms, 0, t, box, xread, nullptr, nullptr);
}
nframes++;
}
if (projfile)
{
- GMX_RELEASE_ASSERT(inprod != NULL, "inprod must be non-NULL if projfile is non-NULL");
+ GMX_RELEASE_ASSERT(inprod != nullptr, "inprod must be non-NULL if projfile is non-NULL");
snew(ylabel, noutvec);
for (v = 0; v < noutvec; v++)
{
ylabel[v] = gmx_strdup(str);
}
sprintf(str, "projection on eigenvectors (%s)", proj_unit);
- write_xvgr_graphs(projfile, noutvec, 1, str, NULL, output_env_get_xvgr_tlabel(oenv),
+ write_xvgr_graphs(projfile, noutvec, 1, str, nullptr, output_env_get_xvgr_tlabel(oenv),
(const char **)ylabel,
- nframes, inprod[noutvec], inprod, NULL,
+ nframes, inprod[noutvec], inprod, nullptr,
output_env_get_time_factor(oenv), FALSE, bSplit, oenv);
}
{
t_atoms atoms;
rvec *x;
- real *b = NULL;
+ real *b = nullptr;
matrix box;
char *resnm, *atnm;
gmx_bool bPDB, b4D;
}
if ( ( b4D || bSplit ) && bPDB)
{
- GMX_RELEASE_ASSERT(inprod != NULL, "inprod must be non-NULL with 4D or split PDB output options");
+ GMX_RELEASE_ASSERT(inprod != nullptr, "inprod must be non-NULL with 4D or split PDB output options");
out = gmx_ffopen(threedplotfile, "w");
fprintf(out, "HEADER %s\n", str);
}
else
{
- write_sto_conf(threedplotfile, str, &atoms, x, NULL, ePBC, box);
+ write_sto_conf(threedplotfile, str, &atoms, x, nullptr, ePBC, box);
}
done_atom(&atoms);
}
snew(pmax, noutvec_extr);
if (extreme == 0)
{
- GMX_RELEASE_ASSERT(inprod != NULL, "inprod must be non-NULL");
+ GMX_RELEASE_ASSERT(inprod != nullptr, "inprod must be non-NULL");
fprintf(stderr, "%11s %17s %17s\n", "eigenvector", "Minimum", "Maximum");
fprintf(stderr,
"%11s %10s %10s %10s %10s\n", "", "value", "frame", "value", "frame");
*eigvec[outvec[v]][i][d]/sqrtm[i]);
}
}
- write_trx(out, natoms, index, atoms, 0, frame, topbox, xread, NULL, NULL);
+ write_trx(out, natoms, index, atoms, 0, frame, topbox, xread, nullptr, nullptr);
}
close_trx(out);
}
write_xvgr_graphs(outfile, noutvec, 4, "Eigenvector components",
"black: total, red: x, green: y, blue: z",
"Atom number", (const char **)ylabel,
- natoms, x, NULL, y, 1, FALSE, FALSE, oenv);
+ natoms, x, nullptr, y, 1, FALSE, FALSE, oenv);
fprintf(stderr, "\n");
}
y[g][i] = std::sqrt(eigval[eignr[v]]*norm2(eigvec[v][i]))/sqrtm[i];
}
}
- write_xvgr_graphs(outfile, noutvec, 1, "RMS fluctuation (nm) ", NULL,
+ write_xvgr_graphs(outfile, noutvec, 1, "RMS fluctuation (nm) ", nullptr,
"Atom number", (const char **)ylabel,
- natoms, x, y, NULL, 1, TRUE, FALSE, oenv);
+ natoms, x, y, nullptr, 1, TRUE, FALSE, oenv);
fprintf(stderr, "\n");
}
t_topology top;
int ePBC = -1;
- const t_atoms *atoms = NULL;
- rvec *xtop, *xref1, *xref2, *xrefp = NULL;
+ const t_atoms *atoms = nullptr;
+ rvec *xtop, *xref1, *xref2, *xrefp = nullptr;
gmx_bool bDMR1, bDMA1, bDMR2, bDMA2;
- int nvec1, nvec2, *eignr1 = NULL, *eignr2 = NULL;
- rvec *xav1, *xav2, **eigvec1 = NULL, **eigvec2 = NULL;
+ int nvec1, nvec2, *eignr1 = nullptr, *eignr2 = nullptr;
+ rvec *xav1, *xav2, **eigvec1 = nullptr, **eigvec2 = nullptr;
matrix topbox;
real totmass, *sqrtm, *w_rls, t;
int natoms;
const char *indexfile;
int i, j, d;
int nout, *iout, noutvec, *outvec, nfit;
- int *index = NULL, *ifit = NULL;
+ int *index = nullptr, *ifit = nullptr;
const char *VecFile, *Vec2File, *topfile;
const char *EigFile, *Eig2File;
const char *CompFile, *RmsfFile, *ProjOnVecFile;
const char *OverlapFile, *InpMatFile;
gmx_bool bFit1, bFit2, bM, bIndex, bTPS, bTop, bVec2, bProj;
gmx_bool bFirstToLast, bFirstLastSet, bTraj, bCompare, bPDB3D;
- real *eigval1 = NULL, *eigval2 = NULL;
+ real *eigval1 = nullptr, *eigval2 = nullptr;
int neig1, neig2;
double **xvgdata;
gmx_output_env_t *oenv;
t_filenm fnm[] = {
{ efTRN, "-v", "eigenvec", ffREAD },
{ efTRN, "-v2", "eigenvec2", ffOPTRD },
- { efTRX, "-f", NULL, ffOPTRD },
- { efTPS, NULL, NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffOPTRD },
+ { efTPS, nullptr, nullptr, ffOPTRD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXVG, "-eig", "eigenval", ffOPTRD },
{ efXVG, "-eig2", "eigenval2", ffOPTRD },
{ efXVG, "-comp", "eigcomp", ffOPTWR },
if (!parse_common_args(&argc, argv,
PCA_CAN_TIME | PCA_TIME_UNIT | PCA_CAN_VIEW,
- NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
neig1 = DIM*natoms;
/* Overwrite eigenvalues from separate files if the user provides them */
- if (EigFile != NULL)
+ if (EigFile != nullptr)
{
int neig_tmp = read_xvg(EigFile, &xvgdata, &i);
if (neig_tmp != neig1)
neig2 = 0;
}
- if (Eig2File != NULL)
+ if (Eig2File != nullptr)
{
neig2 = read_xvg(Eig2File, &xvgdata, &i);
srenew(eigval2, neig2);
{
bM = FALSE;
}
- if ((xref1 == NULL) && (bM || bTraj))
+ if ((xref1 == nullptr) && (bM || bTraj))
{
bTPS = TRUE;
}
- xtop = NULL;
+ xtop = nullptr;
nfit = 0;
- ifit = NULL;
- w_rls = NULL;
+ ifit = nullptr;
+ w_rls = nullptr;
if (!bTPS)
{
else
{
bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm),
- &top, &ePBC, &xtop, NULL, topbox, bM);
+ &top, &ePBC, &xtop, nullptr, topbox, bM);
atoms = &top.atoms;
gpbc = gmx_rmpbc_init(&top.idef, ePBC, atoms->nr);
gmx_rmpbc(gpbc, atoms->nr, topbox, xtop);
/* Fitting is only required for the projection */
if (bProj && bFit1)
{
- if (xref1 == NULL)
+ if (xref1 == nullptr)
{
printf("\nNote: the structure in %s should be the same\n"
" as the one used for the fit in g_covar\n", topfile);
}
snew(xrefp, atoms->nr);
- if (xref1 != NULL)
+ if (xref1 != nullptr)
{
/* Safety check between selected fit-group and reference structure read from the eigenvector file */
if (natoms != nfit)
{
copy_rvec(xtop[ifit[i]], xrefp[ifit[i]]);
}
- reset_x(nfit, ifit, atoms->nr, NULL, xrefp, w_rls);
+ reset_x(nfit, ifit, atoms->nr, nullptr, xrefp, w_rls);
}
}
gmx_rmpbc_done(gpbc);
{
printf("Select eigenvectors for output, end your selection with 0\n");
nout = -1;
- iout = NULL;
+ iout = nullptr;
do
{
if (bProj)
{
- project(bTraj ? opt2fn("-f", NFILE, fnm) : NULL,
- bTop ? &top : NULL, ePBC, topbox,
+ project(bTraj ? opt2fn("-f", NFILE, fnm) : nullptr,
+ bTop ? &top : nullptr, ePBC, topbox,
ProjOnVecFile, TwoDPlotFile, ThreeDPlotFile, FilterFile, skip,
ExtremeFile, bFirstLastSet, max, nextr, atoms, natoms, index,
bFit1, xrefp, nfit, ifit, w_rls,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
}
snew(a, nset-1);
- chi2 = multi_regression(NULL, n, y, nset-1, xx, a);
+ chi2 = multi_regression(nullptr, n, y, nset-1, xx, a);
printf("Fitting %d data points in %d sets\n", n, nset-1);
printf("chi2 = %g\n", chi2);
printf("A =");
FILE *fp;
int i, s, edge = 0;
double av, var, err;
- real *tmp = NULL;
+ real *tmp = nullptr;
fp = gmx_ffopen(avfile, "w");
if ((avbar_opt == avbarERROR) && (nset == 1))
fitparm[2] = std::sqrt(tau1_est*(n-1)*dt);
do_lmfit(nbs, ybs, fitsig, 0, tbs, 0, dt*n, oenv,
bDebugMode(), effnERREST, fitparm, 0,
- NULL);
+ nullptr);
}
if (bSingleExpFit || fitparm[0] < 0 || fitparm[2] < 0 || fitparm[1] < 0
|| (fitparm[1] > 1 && !bAllowNegLTCorr) || fitparm[2] > (n-1)*dt)
fitparm[2] = (n-1)*dt;
fprintf(stdout, "Will fix tau2 at the total time: %g\n", fitparm[2]);
do_lmfit(nbs, ybs, fitsig, 0, tbs, 0, dt*n, oenv, bDebugMode(),
- effnERREST, fitparm, 4, NULL);
+ effnERREST, fitparm, 4, nullptr);
}
if (bSingleExpFit || fitparm[0] < 0 || fitparm[1] < 0
|| (fitparm[1] > 1 && !bAllowNegLTCorr))
fitparm[1] = 1.0;
fitparm[2] = 0.0;
do_lmfit(nbs, ybs, fitsig, 0, tbs, 0, dt*n, oenv, bDebugMode(),
- effnERREST, fitparm, 6, NULL);
+ effnERREST, fitparm, 6, nullptr);
}
}
ee = optimal_error_estimate(sig[s], fitparm, n*dt);
fitsig[i] = 1;
}
}
- low_do_autocorr(NULL, oenv, NULL, n, 1, -1, &ac,
+ low_do_autocorr(nullptr, oenv, nullptr, n, 1, -1, &ac,
dt, eacNormal, 1, FALSE, TRUE,
FALSE, 0, 0, effnNONE);
ac_fit[0] = 0.5*acint;
ac_fit[1] = 0.95;
ac_fit[2] = 10*acint;
- do_lmfit(n/nb_min, ac, fitsig, dt, 0, 0, fitlen*dt, oenv,
- bDebugMode(), effnEXPEXP, ac_fit, 0, NULL);
+ do_lmfit(n/nb_min, ac, fitsig, dt, nullptr, 0, fitlen*dt, oenv,
+ bDebugMode(), effnEXPEXP, ac_fit, 0, nullptr);
ac_fit[3] = 1 - ac_fit[1];
fprintf(stdout, "Set %3d: ac erest %g a %g tau1 %g tau2 %g\n",
}
fprintf(debug, "RMS difference in derivatives is %g\n", std::sqrt(d2/nn));
}
- analyse_corr(nn, time, val[0], val[2], kt, NULL, NULL, NULL, fit_start,
+ analyse_corr(nn, time, val[0], val[2], kt, nullptr, nullptr, nullptr, fit_start,
temp);
sfree(kt);
}
int npargs, t_pargs *ppa, const gmx_output_env_t *oenv,
const char *fn_fitted)
{
- real *c1 = NULL, *sig = NULL;
+ real *c1 = nullptr, *sig = nullptr;
double *fitparm;
real tendfit, tbeginfit;
int i, efitfn, nparm;
}
else
{
- char *buf2 = NULL;
+ char *buf2 = nullptr;
int s, buflen = 0;
- if (NULL != fn_fitted)
+ if (nullptr != fn_fitted)
{
buflen = std::strlen(fn_fitted)+32;
snew(buf2, buflen);
}
for (s = 0; s < nset; s++)
{
- char *buf = NULL;
- if (NULL != fn_fitted)
+ char *buf = nullptr;
+ if (nullptr != fn_fitted)
{
snew(buf, buflen);
snprintf(buf, n, "%s_%d.xvg", buf2, s);
/* must correspond to enum avbar* declared at beginning of file */
static const char *avbar_opt[avbarNR+1] = {
- NULL, "none", "stddev", "error", "90", NULL
+ nullptr, "none", "stddev", "error", "90", nullptr
};
t_pargs pa[] = {
ppa = add_acf_pargs(&npargs, pa);
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW,
- NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv))
{
sfree(ppa);
return 0;
distfile = opt2fn_null("-dist", NFILE, fnm);
avfile = opt2fn_null("-av", NFILE, fnm);
eefile = opt2fn_null("-ee", NFILE, fnm);
- if (opt2parg_bSet("-fitfn", npargs, ppa) && acfile == NULL)
+ if (opt2parg_bSet("-fitfn", npargs, ppa) && acfile == nullptr)
{
fitfile = opt2fn("-g", NFILE, fnm);
}
{
for (s = 0; s < nset; s++)
{
- sum = evaluate_integral(n, t, val[s], NULL, aver_start, &stddev);
+ sum = evaluate_integral(n, t, val[s], nullptr, aver_start, &stddev);
printf("Integral %d %10.5f +/- %10.5f\n", s+1, sum, stddev);
}
}
}
- if (fitfile != NULL)
+ if (fitfile != nullptr)
{
print_fitted_function(fitfile,
opt2fn_null("-fitted", NFILE, fnm),
power_fit(n, nset, val, t);
}
- if (acfile != NULL)
+ if (acfile != nullptr)
{
if (bSubAv)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
}
}
- gmx_trr_write_frame(fio, i, time[i], 0, box, na, x, NULL, NULL);
+ gmx_trr_write_frame(fio, i, time[i], 0, box, na, x, nullptr, nullptr);
}
gmx_trr_close(fio);
sfree(x);
"records a histogram of the times between such transitions,",
"assuming the input trajectory frames are equally spaced in time."
};
- static const char *opt[] = { NULL, "angle", "dihedral", "improper", "ryckaert-bellemans", NULL };
+ static const char *opt[] = { nullptr, "angle", "dihedral", "improper", "ryckaert-bellemans", nullptr };
static gmx_bool bALL = FALSE, bChandler = FALSE, bAverCorr = FALSE, bPBC = TRUE;
static real binwidth = 1;
t_pargs pa[] = {
real aver, aver2, aversig; /* fraction trans dihedrals */
double tfrac = 0;
char title[256];
- real **dih = NULL; /* mega array with all dih. angles at all times*/
+ real **dih = nullptr; /* mega array with all dih. angles at all times*/
real *time, *trans_frac, *aver_angle;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efNDX, NULL, "angle", ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efNDX, nullptr, "angle", ffREAD },
{ efXVG, "-od", "angdist", ffWRITE },
{ efXVG, "-ov", "angaver", ffOPTWR },
{ efXVG, "-of", "dihfrac", ffOPTWR },
{ efXVG, "-ot", "dihtrans", ffOPTWR },
{ efXVG, "-oh", "trhisto", ffOPTWR },
{ efXVG, "-oc", "dihcorr", ffOPTWR },
- { efTRR, "-or", NULL, ffOPTWR }
+ { efTRR, "-or", nullptr, ffOPTWR }
};
#define NFILE asize(fnm)
int npargs;
maxang = 360.0;
bRb = FALSE;
- GMX_RELEASE_ASSERT(opt[0] != NULL, "Internal option inconsistency; opt[0]==NULL after processing");
+ GMX_RELEASE_ASSERT(opt[0] != nullptr, "Internal option inconsistency; opt[0]==NULL after processing");
switch (opt[0][0])
{
{
sprintf(title, "Dihedral Distribution: %s", grpname);
- calc_distribution_props(maxangstat, angstat, -180.0, 0, NULL, &S2);
+ calc_distribution_props(maxangstat, angstat, -180.0, 0, nullptr, &S2);
fprintf(stderr, "Order parameter S^2 = %g\n", S2);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,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.
{
return FALSE;
}
- if (name == NULL && lc->names[index] == NULL)
+ if (name == nullptr && lc->names[index] == nullptr)
{
return TRUE;
}
- if ((name == NULL) != (lc->names[index] == NULL))
+ if ((name == nullptr) != (lc->names[index] == nullptr))
{
return FALSE;
}
static void xvg_init(xvg_t *ba)
{
- ba->filename = NULL;
+ ba->filename = nullptr;
ba->nset = 0;
ba->np_alloc = 0;
- ba->np = NULL;
- ba->y = NULL;
+ ba->np = nullptr;
+ ba->y = nullptr;
}
static void samples_init(samples_t *s, lambda_vec_t *native_lambda,
s->derivative = derivative;
s->ndu = 0;
- s->du = NULL;
- s->t = NULL;
+ s->du = nullptr;
+ s->t = nullptr;
s->start_time = s->delta_time = 0;
- s->hist = NULL;
- s->du_alloc = NULL;
- s->t_alloc = NULL;
- s->hist_alloc = NULL;
+ s->hist = nullptr;
+ s->du_alloc = nullptr;
+ s->t_alloc = nullptr;
+ s->hist_alloc = nullptr;
s->ndu_alloc = 0;
s->nt_alloc = 0;
r->start = 0;
r->end = s->ndu;
r->use = TRUE;
- r->s = NULL;
+ r->s = nullptr;
}
static void sample_coll_init(sample_coll_t *sc, lambda_vec_t *native_lambda,
sc->temp = temp;
sc->nsamples = 0;
- sc->s = NULL;
- sc->r = NULL;
+ sc->s = nullptr;
+ sc->r = nullptr;
sc->nsamples_alloc = 0;
sc->ntot = 0;
- sc->next = sc->prev = NULL;
+ sc->next = sc->prev = nullptr;
}
static void sample_coll_destroy(sample_coll_t *sc)
l->lambda = native_lambda;
l->temp = temp;
- l->next = NULL;
- l->prev = NULL;
+ l->next = nullptr;
+ l->prev = nullptr;
l->sc = &(l->sc_head);
- sample_coll_init(l->sc, native_lambda, NULL, 0.);
+ sample_coll_init(l->sc, native_lambda, nullptr, 0.);
l->sc->next = l->sc;
l->sc->prev = l->sc;
}
br->dg_stddev = 0;
br->dg_stddev_err = 0;
- br->a = NULL;
- br->b = NULL;
+ br->a = nullptr;
+ br->b = nullptr;
}
sc = sc->next;
}
- return NULL;
+ return nullptr;
}
/* insert li into an ordered list of lambda_colls */
FILE *fp;
lambda_data_t *bl;
int nsets = 0;
- char **setnames = NULL;
+ char **setnames = nullptr;
gmx_bool first_set = FALSE;
/* histogram data: */
- int *hist = NULL;
+ int *hist = nullptr;
int nbin = 0;
int nbin_alloc = 0;
double dx = 0;
{
if (!first_set)
{
- xvgr_new_dataset(fp, 0, 0, NULL, oenv);
+ xvgr_new_dataset(fp, 0, 0, nullptr, oenv);
}
sample_coll_make_hist(sc, &hist, &nbin_alloc, &nbin, &dx, &minval,
gmx_bool name_end_found = FALSE;
/* if the string is a NULL pointer, return a NULL pointer. */
- if (str == NULL)
+ if (str == nullptr)
{
- return NULL;
+ return nullptr;
}
while (*str != '\0')
{
}
str++;
}
- return NULL;
+ return nullptr;
}
const char **end,
const char *fn)
{
- gmx_bool initialize_lc = FALSE; /* whether to initialize the lambda
- components, or to check them */
- gmx_bool start_reached = FALSE; /* whether the start of component names
- has been reached */
- gmx_bool vector = FALSE; /* whether there are multiple components */
- int n = 0; /* current component number */
- const char *val_start = NULL; /* start of the component name, or NULL
- if not in a value */
+ gmx_bool initialize_lc = FALSE; /* whether to initialize the lambda
+ components, or to check them */
+ gmx_bool start_reached = FALSE; /* whether the start of component names
+ has been reached */
+ gmx_bool vector = FALSE; /* whether there are multiple components */
+ int n = 0; /* current component number */
+ const char *val_start = nullptr; /* start of the component name, or NULL
+ if not in a value */
char *strtod_end;
gmx_bool OK = TRUE;
initialize_lc = TRUE;
}
- if (lc_in == NULL)
+ if (lc_in == nullptr)
{
lc_in = lc_out;
}
if (std::isspace(*str) || *str == ')' || *str == ',' || *str == '\0')
{
/* end of value */
- if (lv == NULL)
+ if (lv == nullptr)
{
if (initialize_lc)
{
}
}
/* reset for the next identifier */
- val_start = NULL;
+ val_start = nullptr;
n++;
if (!vector)
{
}
else
{
- GMX_RELEASE_ASSERT(lc_in != NULL, "Internal inconsistency? lc_in==NULL");
+ GMX_RELEASE_ASSERT(lc_in != nullptr, "Internal inconsistency? lc_in==NULL");
if (n == lc_in->N)
{
return OK;
}
- else if (lv == NULL)
+ else if (lv == nullptr)
{
return FALSE;
}
const char **end,
const char *fn)
{
- return read_lambda_compvec(str, NULL, NULL, lc, end, fn);
+ return read_lambda_compvec(str, nullptr, nullptr, lc, end, fn);
}
/* read an initialized lambda vector from a string */
const char **end,
const char *fn)
{
- return read_lambda_compvec(str, lv, lv->lc, NULL, end, fn);
+ return read_lambda_compvec(str, lv, lv->lc, nullptr, end, fn);
}
const char *legend,
lambda_vec_t *lam)
{
- const char *ptr = NULL, *ptr2 = NULL;
+ const char *ptr = nullptr, *ptr2 = nullptr;
gmx_bool ok = FALSE;
gmx_bool bdhdl = FALSE;
const char *tostr = " to ";
- if (legend == NULL)
+ if (legend == nullptr)
{
gmx_fatal(FARGS, "There is no legend in file '%s', can not deduce lambda", fn);
}
do
{
ptr2 = std::strstr(ptr2, tostr);
- if (ptr2 != NULL)
+ if (ptr2 != nullptr)
{
ptr = ptr2;
ptr2++;
}
}
- while (ptr2 != NULL && *ptr2 != '\0');
+ while (ptr2 != nullptr && *ptr2 != '\0');
if (ptr)
{
ok = TRUE;
bdhdl = TRUE;
}
- else if (std::strchr(legend, 'D') != NULL && std::strchr(legend, 'H') != NULL)
+ else if (std::strchr(legend, 'D') != nullptr && std::strchr(legend, 'H') != nullptr)
{
ok = TRUE;
bdhdl = FALSE;
if (!bdhdl)
{
ptr = find_value(ptr);
- if (!ptr || !read_lambda_vector(ptr, lam, NULL, fn))
+ if (!ptr || !read_lambda_vector(ptr, lam, nullptr, fn))
{
gmx_fatal(FARGS, "lambda vector '%s' %s faulty", legend, fn);
}
return FALSE;
}
lambda_vec_init(&(ba->native_lambda), lc);
- if (!read_lambda_vector(ptr, &(ba->native_lambda), NULL, fn))
+ if (!read_lambda_vector(ptr, &(ba->native_lambda), nullptr, fn))
{
gmx_fatal(FARGS, "lambda vector in %s faulty", fn);
}
/* compatibility mode: check for lambda in other ways. */
/* plain text lambda string */
ptr = std::strstr(subtitle, "lambda");
- if (ptr == NULL)
+ if (ptr == nullptr)
{
/* xmgrace formatted lambda string */
ptr = std::strstr(subtitle, "\\xl\\f{}");
}
- if (ptr == NULL)
+ if (ptr == nullptr)
{
/* xmgr formatted lambda string */
ptr = std::strstr(subtitle, "\\8l\\4");
}
- if (ptr != NULL)
+ if (ptr != nullptr)
{
ptr = std::strstr(ptr, "=");
}
- if (ptr != NULL)
+ if (ptr != nullptr)
{
bFound = (sscanf(ptr+1, "%lf", &(native_lambda)) == 1);
/* add the lambda component name as an empty string */
}
/* searching backward to find the second directory separator */
dirsep = 0;
- digitptr = NULL;
+ digitptr = nullptr;
while (ptr >= fn)
{
if (ptr[0] != DIR_SEPARATOR && ptr[1] == DIR_SEPARATOR)
}
ba->temp = -1;
- if (subtitle != NULL)
+ if (subtitle != nullptr)
{
/* try to extract temperature */
ptr = std::strstr(subtitle, "T =");
- if (ptr != NULL)
+ if (ptr != nullptr)
{
ptr += 3;
if (sscanf(ptr, "%lf", &ba->temp) == 1)
}
}
snew(ba->lambda, ba->nset);
- if (legend == NULL)
+ if (legend == nullptr)
{
/* Check if we have a single set, no legend, nset=1 means t and dH/dl */
if (ba->nset == 1)
gmx_fatal(FARGS, "File %s contains multiple sets but no indication of the native lambda", fn);
}
- if (legend != NULL)
+ if (legend != nullptr)
{
for (i = 0; i < ba->nset-1; i++)
{
nhist = blk->nsub-2;
if (nhist == 0)
{
- return NULL;
+ return nullptr;
}
if (nhist > 2)
{
ener_file_t fp;
t_enxframe *fr;
int nre;
- gmx_enxnm_t *enm = NULL;
+ gmx_enxnm_t *enm = nullptr;
double first_t = -1;
double last_t = -1;
- samples_t **samples_rawdh = NULL; /* contains samples for raw delta_h */
- int *nhists = NULL; /* array to keep count & print at end */
- int *npts = NULL; /* array to keep count & print at end */
- lambda_vec_t **lambdas = NULL; /* array to keep count & print at end */
+ samples_t **samples_rawdh = nullptr; /* contains samples for raw delta_h */
+ int *nhists = nullptr; /* array to keep count & print at end */
+ int *npts = nullptr; /* array to keep count & print at end */
+ lambda_vec_t **lambdas = nullptr; /* array to keep count & print at end */
lambda_vec_t *native_lambda;
int nsamples = 0;
lambda_vec_t start_lambda;
snew(fr, 1);
snew(native_lambda, 1);
- start_lambda.lc = NULL;
+ start_lambda.lc = nullptr;
while (do_enx(fp, fr))
{
{
nhists[i] = 0;
npts[i] = 0;
- lambdas[i] = NULL;
- samples_rawdh[i] = NULL; /* init to NULL so we know which
- ones contain values */
+ lambdas[i] = nullptr;
+ samples_rawdh[i] = nullptr; /* init to NULL so we know which
+ ones contain values */
}
}
else
// nsamples is always >0 here, so samples_rawdh must be a valid pointer. Unfortunately
// cppcheck does not understand the logic unless the assert is inside the loop, but
// this is not performance-sensitive code.
- GMX_RELEASE_ASSERT(samples_rawdh != NULL, "samples_rawdh==NULL with nsamples>0");
+ GMX_RELEASE_ASSERT(samples_rawdh != nullptr, "samples_rawdh==NULL with nsamples>0");
if (samples_rawdh[i])
{
/* insert it into the existing list */
samples_rawdh[i]);
/* and make sure we'll allocate a new one this time
around */
- samples_rawdh[i] = NULL;
+ samples_rawdh[i] = nullptr;
}
}
}
if (!parse_common_args(&argc, argv,
PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
- fpb = NULL;
+ fpb = nullptr;
if (opt2bSet("-o", NFILE, fnm))
{
sprintf(buf, "%s (%s)", "\\DeltaG", "kT");
"\\lambda", buf, exvggtXYDY, oenv);
}
- fpi = NULL;
+ fpi = nullptr;
if (opt2bSet("-oi", NFILE, fnm))
{
sprintf(buf, "%s (%s)", "\\DeltaG", "kT");
for (f = 0; f < nresults; f++)
{
- if (fpi != NULL)
+ if (fpi != nullptr)
{
lambda_vec_print_short(results[f].a->native_lambda, buf);
fprintf(fpi, xvg2format, buf, dg_tot);
}
- if (fpb != NULL)
+ if (fpb != nullptr)
{
lambda_vec_print_intermediate(results[f].a->native_lambda,
results[f].b->native_lambda,
printf("\n");
- if (fpi != NULL)
+ if (fpi != nullptr)
{
lambda_vec_print_short(results[nresults-1].b->native_lambda, buf);
fprintf(fpi, xvg2format, buf, dg_tot);
xvgrclose(fpi);
}
- if (fpb != NULL)
+ if (fpb != nullptr)
{
xvgrclose(fpb);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
t_bundle *bun)
{
t_trxframe frout;
- static rvec *xout = NULL;
+ static rvec *xout = nullptr;
int i;
- if (xout == NULL)
+ if (xout == nullptr)
{
snew(xout, outat->nr);
}
frout.natoms = outat->nr;
frout.atoms = outat;
frout.x = xout;
- write_trxframe(status, &frout, NULL);
+ write_trxframe(status, &frout, nullptr);
}
int gmx_bundle(int argc, char *argv[])
"Use the [IT]z[it]-axis as reference instead of the average axis" }
};
FILE *flen, *fdist, *fz, *ftilt, *ftiltr, *ftiltl;
- FILE *fkink = NULL, *fkinkr = NULL, *fkinkl = NULL;
+ FILE *fkink = nullptr, *fkinkr = nullptr, *fkinkl = nullptr;
t_trxstatus *status;
t_trxstatus *fpdb;
t_topology top;
gmx_bool bKink;
rvec va, vb, vc, vr, vl;
gmx_output_env_t *oenv;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
#define NLEG asize(leg)
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXVG, "-ol", "bun_len", ffWRITE },
{ efXVG, "-od", "bun_dist", ffWRITE },
{ efXVG, "-oz", "bun_z", ffWRITE },
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, TRUE);
bKink = opt2bSet("-ok", NFILE, fnm) || opt2bSet("-okr", NFILE, fnm)
|| opt2bSet("-okl", NFILE, fnm);
}
else
{
- fpdb = NULL;
+ fpdb = nullptr;
}
read_first_frame(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &fr, TRX_NEED_X);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
#define NKKKCHI asize(kkkchi1)
#define NJC (NKKKPHI+NKKKPSI+NKKKCHI)
- FILE *fp, *ssfp[3] = {NULL, NULL, NULL};
+ FILE *fp, *ssfp[3] = {nullptr, nullptr, nullptr};
const char *sss[3] = { "sheet", "helix", "coil" };
real S2;
real *normhisto;
real **Jc, **Jcsig;
- int ****his_aa_ss = NULL;
+ int ****his_aa_ss = nullptr;
int ***his_aa, *histmp;
int i, j, k, m, n, nn, Dih, nres, hindex, angle;
gmx_bool bBfac, bOccup;
- char hisfile[256], hhisfile[256], sshisfile[256], title[256], *ss_str = NULL;
+ char hisfile[256], hhisfile[256], sshisfile[256], title[256], *ss_str = nullptr;
char **leg;
const char *residue_name;
int rt_size;
}
break;
default: /* covers edOmega and higher Chis than Chi1 */
- calc_distribution_props(nbin, histmp, -M_PI, 0, NULL, &S2);
+ calc_distribution_props(nbin, histmp, -M_PI, 0, nullptr, &S2);
break;
}
dlist[i].S2[Dih] = S2;
static void do_rama(int nf, int nlist, t_dlist dlist[], real **dih,
gmx_bool bViol, gmx_bool bRamOmega, const gmx_output_env_t *oenv)
{
- FILE *fp, *gp = NULL;
+ FILE *fp, *gp = nullptr;
gmx_bool bOm;
char fn[256];
int i, j, k, Xi1, Xi2, Phi, Psi, Om = 0, nlevels;
#define NMAT 120
- real **mat = NULL, phi, psi, omega, axis[NMAT], lo, hi;
+ real **mat = nullptr, phi, psi, omega, axis[NMAT], lo, hi;
t_rgb rlo = { 1.0, 0.0, 0.0 };
t_rgb rmid = { 1.0, 1.0, 1.0 };
t_rgb rhi = { 0.0, 0.0, 1.0 };
}
xvgrclose(fp);
- if (NULL != pdbfn)
+ if (nullptr != pdbfn)
{
real x0, y0, z0;
atoms->havePdbInfo = TRUE;
- if (NULL == atoms->pdbinfo)
+ if (nullptr == atoms->pdbinfo)
{
snew(atoms->pdbinfo, atoms->nr);
}
fprintf(fp, "REMARK generated by g_chi\n");
fprintf(fp, "REMARK "
"B-factor field contains negative of dihedral order parameters\n");
- write_pdbfile(fp, NULL, atoms, x, ePBC, box, ' ', 0, NULL, TRUE);
+ write_pdbfile(fp, nullptr, atoms, x, ePBC, box, ' ', 0, nullptr, TRUE);
x0 = y0 = z0 = 1000.0;
for (i = 0; (i < atoms->nr); i++)
{
static gmx_bool bAll = FALSE;
static gmx_bool bPhi = FALSE, bPsi = FALSE, bOmega = FALSE;
static real bfac_init = -1.0, bfac_max = 0;
- static const char *maxchistr[] = { NULL, "0", "1", "2", "3", "4", "5", "6", NULL };
+ static const char *maxchistr[] = { nullptr, "0", "1", "2", "3", "4", "5", "6", nullptr };
static gmx_bool bRama = FALSE, bShift = FALSE, bViol = FALSE, bRamOmega = FALSE;
static gmx_bool bNormHisto = TRUE, bChiProduct = FALSE, bHChi = FALSE, bRAD = FALSE, bPBC = TRUE;
static real core_frac = 0.5;
int i, **chi_lookup, *multiplicity;
t_filenm fnm[] = {
- { efSTX, "-s", NULL, ffREAD },
- { efTRX, "-f", NULL, ffREAD },
+ { efSTX, "-s", nullptr, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
{ efXVG, "-o", "order", ffWRITE },
{ efPDB, "-p", "order", ffOPTWR },
{ efDAT, "-ss", "ssdump", ffOPTRD },
/* Find the chi angles using atoms struct and a list of amino acids */
t_topology *top;
snew(top, 1);
- read_tps_conf(ftp2fn(efSTX, NFILE, fnm), top, &ePBC, &x, NULL, box, FALSE);
+ read_tps_conf(ftp2fn(efSTX, NFILE, fnm), top, &ePBC, &x, nullptr, box, FALSE);
t_atoms &atoms = top->atoms;
- if (atoms.pdbinfo == NULL)
+ if (atoms.pdbinfo == nullptr)
{
snew(atoms.pdbinfo, atoms.nr);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int seed, real kT,
const char *conv, gmx_output_env_t *oenv)
{
- FILE *fp = NULL;
+ FILE *fp = nullptr;
real ecur, enext, emin, prob, enorm;
int i, j, iswap, jswap, nn, nuphill = 0;
t_mat *minimum;
minimum->nn = nn;
copy_t_mat(minimum, m);
- if (NULL != conv)
+ if (nullptr != conv)
{
fp = xvgropen(conv, "Convergence of the MC optimization",
"Energy", "Step", oenv);
fprintf(log, "Iter: %d Swapped %4d and %4d (energy: %g prob: %g)\n",
i, iswap, jswap, enext, prob);
- if (NULL != fp)
+ if (nullptr != fp)
{
fprintf(fp, "%6d %10g\n", i, enext);
}
(i < m->nn-1) ? m->mat[m->m_ind[i]][m->m_ind[i+1]] : 0);
}
- if (NULL != fp)
+ if (nullptr != fp)
{
xvgrclose(fp);
}
int **nnb;
int i, j, k, cid, diff, maxval;
gmx_bool bChange;
- real **mcpy = NULL;
+ real **mcpy = nullptr;
if (rmsdcut < 0)
{
max_nf = 0;
- xx = NULL;
- *time = NULL;
+ xx = nullptr;
+ *time = nullptr;
natom = read_first_x(oenv, &status, fn, &t, &x, box);
i = 0;
i0 = 0;
gmx_bool bFit, FILE *log, t_rgb rlo, t_rgb rhi,
const gmx_output_env_t *oenv)
{
- FILE *size_fp = NULL;
+ FILE *size_fp = nullptr;
char buf[STRLEN], buf1[40], buf2[40], buf3[40], *trxsfn;
- t_trxstatus *trxout = NULL;
- t_trxstatus *trxsout = NULL;
+ t_trxstatus *trxout = nullptr;
+ t_trxstatus *trxsout = nullptr;
int i, i1, cl, nstr, *structure, first = 0, midstr;
- gmx_bool *bWrite = NULL;
+ gmx_bool *bWrite = nullptr;
real r, clrmsd, midrmsd;
- rvec *xav = NULL;
+ rvec *xav = nullptr;
matrix zerobox;
clear_mat(zerobox);
ffprintf_d(stderr, log, buf, "\nFound %d clusters\n\n", clust->ncl);
- trxsfn = NULL;
+ trxsfn = nullptr;
if (trxfn)
{
/* do we write all structures? */
/* Prepare a reference structure for the orientation of the clusters */
if (bFit)
{
- reset_x(ifsize, fitidx, natom, NULL, xtps, mass);
+ reset_x(ifsize, fitidx, natom, nullptr, xtps, mass);
}
trxout = open_trx(trxfn, "w");
/* Calculate the average structure in each cluster, *
{
if (bFit)
{
- reset_x(ifsize, fitidx, natom, NULL, xx[i1], mass);
+ reset_x(ifsize, fitidx, natom, nullptr, xx[i1], mass);
}
if (nstr == 1)
{
if (bWrite[i])
{
write_trx(trxsout, iosize, outidx, atoms, i, time[structure[i]], zerobox,
- xx[structure[i]], NULL, NULL);
+ xx[structure[i]], nullptr, nullptr);
}
}
close_trx(trxsout);
}
if (bFit)
{
- reset_x(ifsize, fitidx, natom, NULL, xav, mass);
+ reset_x(ifsize, fitidx, natom, nullptr, xav, mass);
}
}
if (bFit)
{
do_fit(natom, mass, xtps, xav);
}
- write_trx(trxout, iosize, outidx, atoms, cl, time[midstr], zerobox, xav, NULL, NULL);
+ write_trx(trxout, iosize, outidx, atoms, cl, time[midstr], zerobox, xav, nullptr, nullptr);
}
}
/* clean up */
gmx_int64_t nrms = 0;
matrix box;
- rvec *xtps, *usextps, *x1, **xx = NULL;
+ rvec *xtps, *usextps, *x1, **xx = nullptr;
const char *fn, *trx_out_fn;
t_clusters clust;
- t_mat *rms, *orig = NULL;
+ t_mat *rms, *orig = nullptr;
real *eigenvalues;
t_topology top;
int ePBC;
t_atoms useatoms;
- t_matrix *readmat = NULL;
+ t_matrix *readmat = nullptr;
real *eigenvectors;
int isize = 0, ifsize = 0, iosize = 0;
- int *index = NULL, *fitidx = NULL, *outidx = NULL;
+ int *index = nullptr, *fitidx = nullptr, *outidx = nullptr;
char *grpname;
- real rmsd, **d1, **d2, *time = NULL, time_invfac, *mass = NULL;
+ real rmsd, **d1, **d2, *time = nullptr, time_invfac, *mass = nullptr;
char buf[STRLEN], buf1[80], title[STRLEN];
gmx_bool bAnalyze, bUseRmsdCut, bJP_RMSD = FALSE, bReadMat, bReadTraj, bPBC = TRUE;
int method, ncluster = 0;
static const char *methodname[] = {
- NULL, "linkage", "jarvis-patrick", "monte-carlo",
- "diagonalization", "gromos", NULL
+ nullptr, "linkage", "jarvis-patrick", "monte-carlo",
+ "diagonalization", "gromos", nullptr
};
enum {
m_null, m_linkage, m_jarvis_patrick,
static real kT = 1e-3;
static int M = 10, P = 3;
gmx_output_env_t *oenv;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
t_pargs pa[] = {
{ "-dista", FALSE, etBOOL, {&bRMSdist},
{ &bPBC }, "PBC check" }
};
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffOPTRD },
- { efTPS, "-s", NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffOPTRD },
+ { efTPS, "-s", nullptr, ffOPTRD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXPM, "-dm", "rmsd", ffOPTRD },
{ efXPM, "-om", "rmsd-raw", ffWRITE },
{ efXPM, "-o", "rmsd-clust", ffWRITE },
if (!parse_common_args(&argc, argv,
PCA_CAN_VIEW | PCA_CAN_TIME | PCA_TIME_UNIT,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL,
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr,
&oenv))
{
return 0;
}
else
{
- trx_out_fn = NULL;
+ trx_out_fn = nullptr;
}
if (bReadMat && output_env_get_time_factor(oenv) != 1)
{
if (bReadTraj)
{
/* don't read mass-database as masses (and top) are not used */
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtps, NULL, box,
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtps, nullptr, box,
TRUE);
if (bPBC)
{
{
for (i = 0; i < nf; i++)
{
- reset_x(ifsize, fitidx, isize, NULL, xx[i], mass);
+ reset_x(ifsize, fitidx, isize, nullptr, xx[i], mass);
}
}
}
useatoms.nr = isize;
analyze_clusters(nf, &clust, rms->mat, isize, &useatoms, usextps, mass, xx, time,
ifsize, fitidx, iosize, outidx,
- bReadTraj ? trx_out_fn : NULL,
+ bReadTraj ? trx_out_fn : nullptr,
opt2fn_null("-sz", NFILE, fnm),
opt2fn_null("-tr", NFILE, fnm),
opt2fn_null("-ntr", NFILE, fnm),
}
fprintf(stderr, "\n");
gmx_ffclose(fp);
- if (NULL != orig)
+ if (nullptr != orig)
{
fp = opt2FILE("-om", NFILE, fnm, "w");
sprintf(buf, "Time (%s)", output_env_get_time_unit(oenv));
do_view(oenv, opt2fn_null("-ntr", NFILE, fnm), "-nxy");
do_view(oenv, opt2fn_null("-clid", NFILE, fnm), "-nxy");
}
- do_view(oenv, opt2fn_null("-conv", NFILE, fnm), NULL);
+ do_view(oenv, opt2fn_null("-conv", NFILE, fnm), nullptr);
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2007, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
const gmx_output_env_t *oenv)
{
FILE *fp, *gp, *hp, *tp;
- int *index = NULL;
+ int *index = nullptr;
int nindex, natoms;
t_trxstatus *status;
- rvec *x = NULL, *v = NULL, dx;
+ rvec *x = nullptr, *v = nullptr, dx;
t_pbc pbc;
char *gname;
char timebuf[32];
/* Topology stuff */
t_trxframe fr;
t_tpxheader tpxh;
- gmx_mtop_t *mtop = NULL;
+ gmx_mtop_t *mtop = nullptr;
int ePBC = -1;
- t_block *mols = NULL;
+ t_block *mols = nullptr;
int ii, jj;
real temp, tfac;
/* Cluster size distribution (matrix) */
- real **cs_dist = NULL;
- real tf, dx2, cut2, *t_x = NULL, *t_y, cmid, cmax, cav, ekin;
+ real **cs_dist = nullptr;
+ real tf, dx2, cut2, *t_x = nullptr, *t_y, cmid, cmax, cav, ekin;
int i, j, k, ai, aj, ci, cj, nframe, nclust, n_x, max_size = 0;
int *clust_index, *clust_size, max_clust_size, max_clust_ind, nav, nhisto;
t_rgb rlo = { 1.0, 1.0, 1.0 };
gmx_fatal(FARGS, "tpr (%d atoms) and trajectory (%d atoms) do not match!",
tpxh.natoms, natoms);
}
- ePBC = read_tpx(tpr, NULL, NULL, &natoms, NULL, NULL, mtop);
+ ePBC = read_tpx(tpr, nullptr, nullptr, &natoms, nullptr, nullptr, mtop);
}
if (ndf <= -1)
{
printf("Using molecules rather than atoms. Not reading index file %s\n",
ndx);
}
- GMX_RELEASE_ASSERT(mtop != NULL, "Trying to access mtop->mols from NULL mtop pointer");
+ GMX_RELEASE_ASSERT(mtop != nullptr, "Trying to access mtop->mols from NULL mtop pointer");
mols = &(mtop->mols);
/* Make dummy index */
/* Compute distance */
if (bMol)
{
- GMX_RELEASE_ASSERT(mols != NULL, "Cannot access index[] from NULL mols pointer");
+ GMX_RELEASE_ASSERT(mols != nullptr, "Cannot access index[] from NULL mols pointer");
bSame = FALSE;
for (ii = mols->index[ai]; !bSame && (ii < mols->index[ai+1]); ii++)
{
{
if (bMol)
{
- GMX_RELEASE_ASSERT(mols != NULL, "Cannot access index[] from NULL mols pointer");
+ GMX_RELEASE_ASSERT(mols != nullptr, "Cannot access index[] from NULL mols pointer");
for (j = mols->index[i]; (j < mols->index[i+1]); j++)
{
fprintf(fp, "%d\n", j+1);
t_rgb rgblo, rgbhi;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPR, NULL, NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPR, nullptr, nullptr, ffOPTRD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXPM, "-o", "csize", ffWRITE },
{ efXPM, "-ow", "csizew", ffWRITE },
{ efXVG, "-nc", "nclust", ffWRITE },
if (!parse_common_args(&argc, argv,
PCA_CAN_VIEW | PCA_CAN_TIME | PCA_TIME_UNIT,
- NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
sfree(fit_x);
sfree(w_rls);
- w_rls = NULL;
+ w_rls = nullptr;
}
else
{
clear_rvec(xcm1);
clear_rvec(xcm2);
- w_rls = NULL;
+ w_rls = nullptr;
}
/* calculate the rms deviation */
fp = gmx_ffopen(outfile, "w");
if (!bOne)
{
- write_pdbfile(fp, *top1->name, atoms1, x1, ePBC1, box1, ' ', 1, NULL, TRUE);
+ write_pdbfile(fp, *top1->name, atoms1, x1, ePBC1, box1, ' ', 1, nullptr, TRUE);
}
- write_pdbfile(fp, *top2->name, atoms2, x2, ePBC2, box2, ' ', bOne ? -1 : 2, NULL, TRUE);
+ write_pdbfile(fp, *top2->name, atoms2, x2, ePBC2, box2, ' ', bOne ? -1 : 2, nullptr, TRUE);
gmx_ffclose(fp);
break;
case efGRO:
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
{ "-pbc", FALSE, etBOOL, {&bPBC},
"Apply corrections for periodic boundary conditions" }
};
- FILE *out = NULL; /* initialization makes all compilers happy */
+ FILE *out = nullptr; /* initialization makes all compilers happy */
t_trxstatus *status;
t_topology top;
int ePBC;
matrix box, zerobox;
real *sqrtm, *mat, *eigenvalues, sum, trace, inv_nframes;
real t, tstart, tend, **mat2;
- real xj, *w_rls = NULL;
+ real xj, *w_rls = nullptr;
real min, max, *axis;
int natoms, nat, nframes0, nframes, nlevels;
gmx_int64_t ndim, i, j, k, l;
t_rgb rlo, rmi, rhi;
real *eigenvectors;
gmx_output_env_t *oenv;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efXVG, NULL, "eigenval", ffWRITE },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efXVG, nullptr, "eigenval", ffWRITE },
{ efTRN, "-v", "eigenvec", ffWRITE },
{ efSTO, "-av", "average.pdb", ffWRITE },
- { efLOG, NULL, "covar", ffWRITE },
+ { efLOG, nullptr, "covar", ffWRITE },
{ efDAT, "-ascii", "covar", ffOPTWR },
{ efXPM, "-xpm", "covar", ffOPTWR },
{ efXPM, "-xpma", "covara", ffOPTWR }
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
xpmfile = opt2fn_null("-xpm", NFILE, fnm);
xpmafile = opt2fn_null("-xpma", NFILE, fnm);
- read_tps_conf(fitfile, &top, &ePBC, &xref, NULL, box, TRUE);
+ read_tps_conf(fitfile, &top, &ePBC, &xref, nullptr, box, TRUE);
atoms = &top.atoms;
if (bFit)
}
if (bFit)
{
- reset_x(nfit, ifit, atoms->nr, NULL, xref, w_rls);
+ reset_x(nfit, ifit, atoms->nr, nullptr, xref, w_rls);
}
snew(x, natoms);
}
if (bFit)
{
- reset_x(nfit, ifit, nat, NULL, xread, w_rls);
+ reset_x(nfit, ifit, nat, nullptr, xread, w_rls);
do_fit(nat, w_rls, xref, xread);
}
for (i = 0; i < natoms; i++)
}
}
write_sto_conf_indexed(opt2fn("-av", NFILE, fnm), "Average structure",
- atoms, xread, NULL, epbcNONE, zerobox, natoms, index);
+ atoms, xread, nullptr, epbcNONE, zerobox, natoms, index);
sfree(xread);
fprintf(stderr, "Constructing covariance matrix (%dx%d) ...\n", static_cast<int>(ndim), static_cast<int>(ndim));
}
if (bFit)
{
- reset_x(nfit, ifit, nat, NULL, xread, w_rls);
+ reset_x(nfit, ifit, nat, nullptr, xread, w_rls);
do_fit(nat, w_rls, xref, xread);
}
if (bRef)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2008,2009,2010,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.
int i, j;
int valloc, nalloc, nfr, nvfr;
int vshfr;
- real *xshfr = NULL;
- int *vfr = NULL;
+ real *xshfr = nullptr;
+ int *vfr = nullptr;
real refr = 0.0;
- real *cacf = NULL;
- real *time = NULL;
- real *djc = NULL;
+ real *cacf = nullptr;
+ real *time = nullptr;
+ real *djc = nullptr;
real corint = 0.0;
real prefactorav = 0.0;
real prefactor = 0.0;
rvec mja_tmp;
rvec mjd_tmp;
rvec mdvec;
- rvec *mu = NULL;
- rvec *xp = NULL;
- rvec *v0 = NULL;
- rvec *mjdsp = NULL;
- real *dsp2 = NULL;
+ rvec *mu = nullptr;
+ rvec *xp = nullptr;
+ rvec *v0 = nullptr;
+ rvec *mjdsp = nullptr;
+ real *dsp2 = nullptr;
real t0;
real rtmp;
rvec tmp;
- rvec *mtrans = NULL;
+ rvec *mtrans = nullptr;
/*
* Variables for the least-squares fit for Einstein-Helfand and Green-Kubo
real err = 0.0;
real *xfit;
real *yfit;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
/*
* indices for EH
xshfr[i] = 0.0;
}
}
- GMX_RELEASE_ASSERT(time != NULL, "Memory not allocated correctly - time array is NULL");
+ GMX_RELEASE_ASSERT(time != nullptr, "Memory not allocated correctly - time array is NULL");
if (nfr == 0)
{
printf("\n\nAverage translational dipole moment M_J [enm] after %d frames (|M|^2): %f %f %f (%f)\n", nfr, mja_tmp[XX], mja_tmp[YY], mja_tmp[ZZ], mj2);
printf("\n\nAverage molecular dipole moment M_D [enm] after %d frames (|M|^2): %f %f %f (%f)\n", nfr, mdvec[XX], mdvec[YY], mdvec[ZZ], md2);
- if (v0 != NULL)
+ if (v0 != nullptr)
{
if (bINT)
{
}
- if (v0 != NULL)
+ if (v0 != nullptr)
{
sfree(v0);
}
gmx_output_env_t *oenv;
t_topology top;
- char **grpname = NULL;
+ char **grpname = nullptr;
const char *indexfn;
t_trxframe fr;
- real *mass2 = NULL;
+ real *mass2 = nullptr;
matrix box;
int *index0;
- int *indexm = NULL;
+ int *indexm = nullptr;
int isize;
t_trxstatus *status;
int flags = 0;
int nmols;
int i;
real *qmol;
- FILE *outf = NULL;
- FILE *mcor = NULL;
- FILE *fmj = NULL;
- FILE *fmd = NULL;
- FILE *fmjdsp = NULL;
- FILE *fcur = NULL;
+ FILE *outf = nullptr;
+ FILE *mcor = nullptr;
+ FILE *fmj = nullptr;
+ FILE *fmd = nullptr;
+ FILE *fmjdsp = nullptr;
+ FILE *fcur = nullptr;
t_filenm fnm[] = {
- { efTPS, NULL, NULL, ffREAD }, /* this is for the topology */
- { efNDX, NULL, NULL, ffOPTRD },
- { efTRX, "-f", NULL, ffREAD }, /* and this for the trajectory */
+ { efTPS, nullptr, nullptr, ffREAD }, /* this is for the topology */
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD }, /* and this for the trajectory */
{ efXVG, "-o", "current", ffWRITE },
{ efXVG, "-caf", "caf", ffOPTWR },
{ efXVG, "-dsp", "dsp", ffWRITE },
/* At first the arguments will be parsed and the system information processed */
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
bACF = opt2bSet("-caf", NFILE, fnm);
bINT = opt2bSet("-mc", NFILE, fnm);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, NULL, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE);
indexfn = ftp2fn_null(efNDX, NFILE, fnm);
snew(grpname, 1);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_fatal(FARGS, "Couldn't open %s. Exiting.\n", fn);
}
- if (NULL == fgets(buffer, 255, in))
+ if (nullptr == fgets(buffer, 255, in))
{
gmx_fatal(FARGS, "Error reading from file %s", fn);
}
for (i = 0; i < nr; i++)
{
- if (fgets(buffer, 255, in) == NULL)
+ if (fgets(buffer, 255, in) == nullptr)
{
gmx_fatal(FARGS, "reading datafile. Check your datafile.\n");
}
t_electron *found; /* found by bsearch */
t_electron sought; /* thingie thought by bsearch */
real boxSz, aveBox;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
real t,
z;
(const void *)eltab, nr, sizeof(t_electron),
(int(*)(const void*, const void*))compare);
- if (found == NULL)
+ if (found == nullptr)
{
fprintf(stderr, "Couldn't find %s. Add it to the .dat file\n",
*(top->atoms.atomname[index[n][i]]));
real t,
z;
real boxSz, aveBox;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
if (axis < 0 || axis >= DIM)
{
const gmx_output_env_t *oenv)
{
FILE *den;
- const char *title = NULL;
- const char *xlabel = NULL;
- const char *ylabel = NULL;
+ const char *title = nullptr;
+ const char *xlabel = nullptr;
+ const char *ylabel = nullptr;
int slice, n;
real ddd;
real axispos;
gmx_output_env_t *oenv;
static const char *dens_opt[] =
- { NULL, "mass", "number", "charge", "electron", NULL };
+ { nullptr, "mass", "number", "charge", "electron", nullptr };
static int axis = 2; /* normal to memb. default z */
static const char *axtitle = "Z";
static int nslices = 50; /* nr of slices defined */
int i;
t_filenm fnm[] = { /* files for g_density */
- { efTRX, "-f", NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efTPR, NULL, NULL, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efTPR, nullptr, nullptr, ffREAD },
{ efDAT, "-ei", "electrons", ffOPTRD }, /* file with nr. of electrons */
{ efXVG, "-o", "density", ffWRITE },
};
return 0;
}
- GMX_RELEASE_ASSERT(dens_opt[0] != NULL, "Option setting inconsistency; dens_opt[0] is NULL");
+ GMX_RELEASE_ASSERT(dens_opt[0] != nullptr, "Option setting inconsistency; dens_opt[0] is NULL");
if (bSymmetrize && !bCenter)
{
else
{
ncenter = 0;
- index_center = NULL;
+ index_center = nullptr;
}
fprintf(stderr, "\nSelect %d group%s to calculate density for:\n", ngrps, (ngrps > 1) ? "s" : "");
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
static int n1 = 0, n2 = 0;
static real xmin = -1, xmax = -1, bin = 0.02, dmin = 0, dmax = 0, amax = 0, rmax = 0;
static gmx_bool bMirror = FALSE, bSums = FALSE;
- static const char *eaver[] = { NULL, "z", "y", "x", NULL };
- static const char *eunit[] = { NULL, "nm-3", "nm-2", "count", NULL };
+ static const char *eaver[] = { nullptr, "z", "y", "x", nullptr };
+ static const char *eunit[] = { nullptr, "nm-3", "nm-2", "count", nullptr };
t_pargs pa[] = {
{ "-bin", FALSE, etREAL, {&bin},
int cav = 0, c1 = 0, c2 = 0;
char **grpname, buf[STRLEN];
const char *unit;
- int i, j, k, l, ngrps, anagrp, *gnx = NULL, nindex, nradial = 0, nfr, nmpower;
- int **ind = NULL, *index;
+ int i, j, k, l, ngrps, anagrp, *gnx = nullptr, nindex, nradial = 0, nfr, nmpower;
+ int **ind = nullptr, *index;
real **grid, maxgrid, m1, m2, box1, box2, *tickx, *tickz, invcellvol;
real invspa = 0, invspz = 0, axial, r, vol_old, vol, rowsum;
int nlev = 51;
gmx_output_env_t *oenv;
const char *label[] = { "x (nm)", "y (nm)", "z (nm)" };
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffOPTRD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efDAT, "-od", "densmap", ffOPTWR },
{ efXPM, "-o", "densmap", ffWRITE }
};
npargs = asize(pa);
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, npargs, pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, npargs, pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
}
}
- GMX_RELEASE_ASSERT(eunit[0] != NULL, "Option setting inconsistency; eunit[0] is NULL");
+ GMX_RELEASE_ASSERT(eunit[0] != nullptr, "Option setting inconsistency; eunit[0] is NULL");
if (std::strcmp(eunit[0], "nm-3") == 0)
{
if (ftp2bSet(efTPS, NFILE, fnm) || !ftp2bSet(efNDX, NFILE, fnm))
{
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box,
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box,
bRadial);
}
if (!bRadial)
}
}
- GMX_RELEASE_ASSERT(eaver[0] != NULL, "Option setting inconsistency; eaver[0] is NULL");
+ GMX_RELEASE_ASSERT(eaver[0] != nullptr, "Option setting inconsistency; eaver[0] is NULL");
switch (eaver[0][0])
{
gmx_ffclose(fp);
}
- do_view(oenv, opt2fn("-o", NFILE, fnm), NULL);
+ do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr);
return 0;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
* grpn - group number in index
*/
t_trxstatus *status;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
matrix box; /* Box - 3x3 -each step*/
rvec *x0; /* List of Coord without PBC*/
int i, j, /* loop indices, checks etc*/
ax1 = 0, ax2 = 0, /* tangent directions */
framenr = 0, /* frame number in trajectory*/
slicex, slicey, slicez; /*slice # of x y z position */
- real ***Densslice = NULL; /* Density-slice in one frame*/
+ real ***Densslice = nullptr; /* Density-slice in one frame*/
real dscale; /*physical scaling factor*/
real t, x, y, z; /* time and coordinates*/
rvec bbww;
/*Initialize Densdevel and PBC-remove*/
gpbc = gmx_rmpbc_init(&top->idef, ePBC, top->atoms.nr);
- *Densdevel = NULL;
+ *Densdevel = nullptr;
do
{
/*Reset Densslice every nsttblock steps*/
/* The first conditional is for clang to understand that this branch is
* always taken the first time. */
- if (Densslice == NULL || framenr % nsttblock == 0)
+ if (Densslice == nullptr || framenr % nsttblock == 0)
{
snew(Densslice, *xslices);
for (i = 0; i < *xslices; i++)
real *sigma1, *sigma2;
double beginfit1[4];
double beginfit2[4];
- double *fit1 = NULL, *fit2 = NULL;
+ double *fit1 = nullptr, *fit2 = nullptr;
const double *avgfit1;
const double *avgfit2;
const real onehalf = 1.00/2.00;
- t_interf ***int1 = NULL, ***int2 = NULL; /*Interface matrices [t][x,y] - last index in row-major order*/
+ t_interf ***int1 = nullptr, ***int2 = nullptr; /*Interface matrices [t][x,y] - last index in row-major order*/
/*Create int1(t,xy) and int2(t,xy) arrays with correct number of interf_t elements*/
xysize = xslices*yslices;
snew(int1, tblocks);
/*Fit average density in z over whole trajectory to obtain tentative fit-parameters in fit1 and fit2*/
/*Fit 1st half of box*/
- do_lmfit(zslices, zDensavg, sigma1, binwidth, NULL, startpoint, splitpoint, oenv, FALSE, effnERF, beginfit1, 8, NULL);
+ do_lmfit(zslices, zDensavg, sigma1, binwidth, nullptr, startpoint, splitpoint, oenv, FALSE, effnERF, beginfit1, 8, nullptr);
/*Fit 2nd half of box*/
- do_lmfit(zslices, zDensavg, sigma2, binwidth, NULL, splitpoint, endpoint, oenv, FALSE, effnERF, beginfit2, 8, NULL);
+ do_lmfit(zslices, zDensavg, sigma2, binwidth, nullptr, splitpoint, endpoint, oenv, FALSE, effnERF, beginfit2, 8, nullptr);
/*Initialise the const arrays for storing the average fit parameters*/
avgfit1 = beginfit1;
fit2[k] = avgfit2[k];
}
/*Now fit and store in structures in row-major order int[n][i][j]*/
- do_lmfit(zslices, Densmap[n][i][j], sigma1, binwidth, NULL, startpoint, splitpoint, oenv, FALSE, effnERF, fit1, 0, NULL);
+ do_lmfit(zslices, Densmap[n][i][j], sigma1, binwidth, nullptr, startpoint, splitpoint, oenv, FALSE, effnERF, fit1, 0, nullptr);
int1[n][j+(yslices*i)]->Z = fit1[2];
int1[n][j+(yslices*i)]->t = fit1[3];
- do_lmfit(zslices, Densmap[n][i][j], sigma2, binwidth, NULL, splitpoint, endpoint, oenv, FALSE, effnERF, fit2, 0, NULL);
+ do_lmfit(zslices, Densmap[n][i][j], sigma2, binwidth, nullptr, splitpoint, endpoint, oenv, FALSE, effnERF, fit2, 0, nullptr);
int2[n][j+(yslices*i)]->Z = fit2[2];
int2[n][j+(yslices*i)]->t = fit2[3];
}
static gmx_bool b1d = FALSE;
static int nlevels = 100;
/*Densitymap - Densmap[t][x][y][z]*/
- real ****Densmap = NULL;
+ real ****Densmap = nullptr;
/* Surfaces surf[t][surf_x,surf_y]*/
t_interf ***surf1, ***surf2;
- static const char *meth[] = {NULL, "bisect", "functional", NULL};
+ static const char *meth[] = {nullptr, "bisect", "functional", nullptr};
int eMeth;
char **graphfiles, **rawfiles, **spectra; /* Filenames for xpm-surface maps, rawdata and powerspectra */
t_filenm fnm[] = {
- { efTPR, "-s", NULL, ffREAD }, /* this is for the topology */
- { efTRX, "-f", NULL, ffREAD }, /* and this for the trajectory */
- { efNDX, "-n", NULL, ffREAD}, /* this is to select groups */
+ { efTPR, "-s", nullptr, ffREAD }, /* this is for the topology */
+ { efTRX, "-f", nullptr, ffREAD }, /* and this for the trajectory */
+ { efNDX, "-n", nullptr, ffREAD}, /* this is to select groups */
{ efDAT, "-o", "Density4D", ffOPTWR}, /* This is for outputting the entire 4D densityfield in binary format */
- { efOUT, "-or", NULL, ffOPTWRMULT}, /* This is for writing out the entire information in the t_interf arrays */
+ { efOUT, "-or", nullptr, ffOPTWRMULT}, /* This is for writing out the entire information in the t_interf arrays */
{ efXPM, "-og", "interface", ffOPTWRMULT}, /* This is for writing out the interface meshes - one xpm-file per tblock*/
{ efOUT, "-Spect", "intfspect", ffOPTWRMULT}, /* This is for the trajectory averaged Fourier-spectra*/
};
/* This is the routine responsible for adding default options,
* calling the X/motif interface, etc. */
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
tmpfp = gmx_ffopen("integral_smth.xvg", "w");
- integralSmth = print_and_integrate(tmpfp, nx, x[1]-x[0], combined, NULL, 1);
+ integralSmth = print_and_integrate(tmpfp, nx, x[1]-x[0], combined, nullptr, 1);
printf("SMOOTH integral = %10.5e\n", integralSmth);
dy[0] = (combined[1]-combined[0])/(x[1]-x[0]);
};
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
snew(y[4], nx);
snew(y[5], nx);
- integral = print_and_integrate(NULL, calc_nbegin(nx, y[0], tbegin),
- dt, y[1], NULL, 1);
+ integral = print_and_integrate(nullptr, calc_nbegin(nx, y[0], tbegin),
+ dt, y[1], nullptr, 1);
integral += do_lmfit(nx, y[1], y[2], dt, y[0], tbegin, tend,
- oenv, TRUE, eFitFn, fitparms, fix, NULL);
+ oenv, TRUE, eFitFn, fitparms, fix, nullptr);
for (i = 0; i < nx; i++)
{
y[3][i] = fit_function(eFitFn, fitparms, y[0][i]);
nx-1, y[0], y[5], eps0, epsRF, oenv);
do_view(oenv, opt2fn("-o", NFILE, fnm), "-nxy");
- do_view(oenv, opt2fn("-c", NFILE, fnm), NULL);
+ do_view(oenv, opt2fn("-c", NFILE, fnm), nullptr);
do_view(oenv, opt2fn("-d", NFILE, fnm), "-nxy");
return 0;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
snew(gb, 1);
- if ((ptr = getenv("GMX_DIPOLE_SPACING")) != NULL)
+ if ((ptr = getenv("GMX_DIPOLE_SPACING")) != nullptr)
{
- double bw = strtod(ptr, NULL);
+ double bw = strtod(ptr, nullptr);
gb->spacing = bw;
}
else
sfree((*gb)->elem);
sfree((*gb)->count);
sfree((*gb));
- *gb = NULL;
+ *gb = nullptr;
}
static void add2gkr(t_gkrbin *gb, real r, real cosa, real phi)
int mindex[], rvec x[], rvec mu[],
int ePBC, const matrix box, const t_atom *atom, const int *nAtom)
{
- static rvec *xcm[2] = { NULL, NULL};
+ static rvec *xcm[2] = { nullptr, nullptr};
int gi, gj, j0, j1, i, j, k, n, grp0, grp1;
real qtot, q, cosa, rr, phi;
rvec dx;
};
#define NLEGADIP asize(leg_adip)
- FILE *outdd, *outmtot, *outaver, *outeps, *caver = NULL;
- FILE *dip3d = NULL, *adip = NULL;
- rvec *x, *dipole = NULL, mu_t, quad, *dipsp = NULL;
- t_gkrbin *gkrbin = NULL;
- gmx_enxnm_t *enm = NULL;
+ FILE *outdd, *outmtot, *outaver, *outeps, *caver = nullptr;
+ FILE *dip3d = nullptr, *adip = nullptr;
+ rvec *x, *dipole = nullptr, mu_t, quad, *dipsp = nullptr;
+ t_gkrbin *gkrbin = nullptr;
+ gmx_enxnm_t *enm = nullptr;
t_enxframe *fr;
int nframes = 1000, nre, timecheck = 0, ncolour = 0;
- ener_file_t fmu = NULL;
+ ener_file_t fmu = nullptr;
int i, n, m, natom = 0, gnx_tot, teller, tel3;
t_trxstatus *status;
int *dipole_bin, ndipbin, ibin, iVol, idim = -1;
double M_diff = 0, epsilon, invtel, vol_aver;
double mu_ave, mu_mol, M2_ave = 0, M_ave2 = 0, M_av[DIM], M_av2[DIM];
double M[3], M2[3], M4[3], Gk = 0, g_k = 0;
- gmx_stats_t *Qlsq, mulsq, muframelsq = NULL;
+ gmx_stats_t *Qlsq, mulsq, muframelsq = nullptr;
ivec iMu;
- real **muall = NULL;
- rvec *slab_dipoles = NULL;
- const t_atom *atom = NULL;
- const t_block *mols = NULL;
- gmx_rmpbc_t gpbc = NULL;
+ real **muall = nullptr;
+ rvec *slab_dipoles = nullptr;
+ const t_atom *atom = nullptr;
+ const t_block *mols = nullptr;
+ gmx_rmpbc_t gpbc = nullptr;
gnx_tot = gnx[0];
if (ncos > 1)
real mu_max = 5, mu_aver = -1, rcmax = 0;
real epsilonRF = 0.0, temp = 300;
gmx_bool bPairs = TRUE, bPhi = FALSE, bQuad = FALSE;
- const char *corrtype[] = {NULL, "none", "mol", "molsep", "total", NULL};
+ const char *corrtype[] = {nullptr, "none", "mol", "molsep", "total", nullptr};
const char *axtitle = "Z";
int nslices = 10; /* nr of slices defined */
int skip = 0, nFA = 0, nFB = 0, ncos = 1;
int *gnx;
int nFF[2];
int **grpindex;
- char **grpname = NULL;
+ char **grpname = nullptr;
gmx_bool bGkr, bMU, bSlab;
t_filenm fnm[] = {
- { efEDR, "-en", NULL, ffOPTRD },
- { efTRX, "-f", NULL, ffREAD },
- { efTPR, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efEDR, "-en", nullptr, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXVG, "-o", "Mtot", ffWRITE },
{ efXVG, "-eps", "epsilon", ffWRITE },
{ efXVG, "-a", "aver", ffWRITE },
npargs = asize(pa);
ppa = add_acf_pargs(&npargs, pa);
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv))
{
sfree(ppa);
return 0;
}
snew(top, 1);
- ePBC = read_tpx_top(ftp2fn(efTPR, NFILE, fnm), NULL, box,
- &natoms, NULL, NULL, top);
+ ePBC = read_tpx_top(ftp2fn(efTPR, NFILE, fnm), nullptr, box,
+ &natoms, nullptr, nullptr, top);
snew(gnx, ncos);
snew(grpname, ncos);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
real v;
} t_toppop;
-t_toppop *top = NULL;
+t_toppop *top = nullptr;
int ntop = 0;
typedef struct {
while (((i+n) < disres->nr) &&
(forceparams[forceatoms[i+n]].disres.label == label));
- calc_disres_R_6(NULL, n, &forceatoms[i],
- (const rvec*)x, pbc, fcd, NULL);
+ calc_disres_R_6(nullptr, n, &forceatoms[i],
+ (const rvec*)x, pbc, fcd, nullptr);
if (fcd->disres.Rt_6[0] <= 0)
{
snew(fshift, SHIFTS);
interaction_function[F_DISRES].ifunc(n, &forceatoms[i], forceparams,
(const rvec*)x, f, fshift,
- pbc, g, lam, &dvdl, NULL, fcd, NULL);
+ pbc, g, lam, &dvdl, nullptr, fcd, nullptr);
sfree(fshift);
viol = fcd->disres.sumviol;
real **matrix, *t_res, hi, *w_dr, rav, rviol;
t_rgb rlo = { 1, 1, 1 };
t_rgb rhi = { 0, 0, 0 };
- if (fn == NULL)
+ if (fn == nullptr)
{
return;
}
"Use inverse third power averaging or linear for matrix output" }
};
- FILE *out = NULL, *aver = NULL, *numv = NULL, *maxxv = NULL, *xvg = NULL;
+ FILE *out = nullptr, *aver = nullptr, *numv = nullptr, *maxxv = nullptr, *xvg = nullptr;
t_tpxheader header;
gmx_mtop_t mtop;
rvec *xtop;
gmx_localtop_t *top;
- t_atoms *atoms = NULL;
+ t_atoms *atoms = nullptr;
t_fcdata fcd;
t_nrnb nrnb;
t_graph *g;
int ntopatoms, natoms, i, j, kkk;
t_trxstatus *status;
real t;
- rvec *x, *xav = NULL;
+ rvec *x, *xav = nullptr;
rvec4 *f;
matrix box;
gmx_bool bPDB;
int isize;
- int *index = NULL, *ind_fit = NULL;
+ int *index = nullptr, *ind_fit = nullptr;
char *grpname;
- t_cluster_ndx *clust = NULL;
- t_dr_result dr, *dr_clust = NULL;
+ t_cluster_ndx *clust = nullptr;
+ t_dr_result dr, *dr_clust = nullptr;
char **leg;
- real *vvindex = NULL, *w_rls = NULL;
+ real *vvindex = nullptr, *w_rls = nullptr;
t_mdatoms *mdatoms;
t_pbc pbc, *pbc_null;
int my_clust;
FILE *fplog;
gmx_output_env_t *oenv;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
t_filenm fnm[] = {
- { efTPR, NULL, NULL, ffREAD },
- { efTRX, "-f", NULL, ffREAD },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
{ efXVG, "-ds", "drsum", ffWRITE },
{ efXVG, "-da", "draver", ffWRITE },
{ efXVG, "-dn", "drnum", ffWRITE },
{ efXVG, "-dm", "drmax", ffWRITE },
{ efXVG, "-dr", "restr", ffWRITE },
{ efLOG, "-l", "disres", ffWRITE },
- { efNDX, NULL, "viol", ffOPTRD },
+ { efNDX, nullptr, "viol", ffOPTRD },
{ efPDB, "-q", "viol", ffOPTWR },
{ efNDX, "-c", "clust", ffOPTRD },
{ efXPM, "-x", "matrix", ffOPTWR }
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
read_tpxheader(ftp2fn(efTPR, NFILE, fnm), &header, FALSE);
snew(xtop, header.natoms);
- read_tpx(ftp2fn(efTPR, NFILE, fnm), ir, box, &ntopatoms, xtop, NULL, &mtop);
+ read_tpx(ftp2fn(efTPR, NFILE, fnm), ir, box, &ntopatoms, xtop, nullptr, &mtop);
bPDB = opt2bSet("-q", NFILE, fnm);
if (bPDB)
{
snew(atoms, 1);
*atoms = gmx_mtop_global_atoms(&mtop);
- if (atoms->pdbinfo == NULL)
+ if (atoms->pdbinfo == nullptr)
{
snew(atoms->pdbinfo, atoms->nr);
}
top = gmx_mtop_generate_local_top(&mtop, ir->efep != efepNO);
- g = NULL;
- pbc_null = NULL;
+ g = nullptr;
+ pbc_null = nullptr;
if (ir->ePBC != epbcNONE)
{
if (ir->bPeriodicMols)
}
ir->dr_tau = 0.0;
- init_disres(fplog, &mtop, ir, NULL, &fcd, NULL, FALSE);
+ init_disres(fplog, &mtop, ir, nullptr, &fcd, nullptr, FALSE);
natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
snew(f, 5*natoms);
}
mdatoms = init_mdatoms(fplog, &mtop, ir->efep != efepNO);
- atoms2md(&mtop, ir, -1, NULL, mtop.natoms, mdatoms);
+ atoms2md(&mtop, ir, -1, nullptr, mtop.natoms, mdatoms);
update_mdatoms(mdatoms, ir->fepvals->init_lambda);
init_nrnb(&nrnb);
if (ir->ePBC != epbcNONE)
}
if (bPDB)
{
- reset_x(atoms->nr, ind_fit, atoms->nr, NULL, x, w_rls);
+ reset_x(atoms->nr, ind_fit, atoms->nr, nullptr, x, w_rls);
do_fit(atoms->nr, w_rls, x, x);
if (j == 0)
{
{
dump_stats(fplog, j, fcd.disres.nres, &(top->idef.il[F_DISRES]),
top->idef.iparams, &dr, isize, index,
- bPDB ? atoms : NULL);
+ bPDB ? atoms : nullptr);
if (bPDB)
{
write_sto_conf(opt2fn("-q", NFILE, fnm),
"Coloured by average violation in Angstrom",
- atoms, xav, NULL, ir->ePBC, box);
+ atoms, xav, nullptr, ir->ePBC, box);
}
dump_disre_matrix(opt2fn_null("-x", NFILE, fnm), &dr, fcd.disres.nres,
j, &top->idef, &mtop, max_dr, nlevels, bThird);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
fgets2(buf, STRLEN, tapeout);
}
- while (std::strstr(buf, "KAPPA") == NULL);
+ while (std::strstr(buf, "KAPPA") == nullptr);
if (bFirst)
{
/* Since we also have empty lines in the dssp output (temp) file,
nresidues = 0;
naccf = 0;
naccb = 0;
- for (nr = 0; (fgets2(buf, STRLEN, tapeout) != NULL); nr++)
+ for (nr = 0; (fgets2(buf, STRLEN, tapeout) != nullptr); nr++)
{
if (buf[13] == '!') /* Chain separator line has '!' at pos. 13 */
{
buf[39] = '\0';
/* Only calculate solvent accessible area if needed */
- if ((NULL != acc) && (buf[13] != '!'))
+ if ((nullptr != acc) && (buf[13] != '!'))
{
sscanf(&(buf[34]), "%d", &iacc);
acc[nr] = iacc;
if (bFirst)
{
- if (0 != acc)
+ if (nullptr != acc)
{
fprintf(stderr, "%d residues were classified as hydrophobic and %d as hydrophilic.\n", naccb, naccf);
}
{
mat->axis_y[i] = i+1;
}
- mat->axis_x = NULL;
- mat->matrix = NULL;
+ mat->axis_x = nullptr;
+ mat->matrix = nullptr;
xsize = 0;
frame = 0;
bFirst = FALSE;
}
newnmap = 0;
- newmap = NULL;
+ newmap = nullptr;
for (i = 0; i < mat->nmap; i++)
{
newnum[i] = -1;
int *index;
rvec *xp, *x;
int *average_area;
- real **accr, *accr_ptr = NULL, *av_area, *norm_av_area;
+ real **accr, *accr_ptr = nullptr, *av_area, *norm_av_area;
char pdbfile[32], tmpfile[32];
char dssp[256];
const char *dptr;
gmx_output_env_t *oenv;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efDAT, "-ssdump", "ssdump", ffOPTWR },
{ efMAP, "-map", "ss", ffLIBRD },
{ efXPM, "-o", "ss", ffWRITE },
if (!parse_common_args(&argc, argv,
PCA_CAN_TIME | PCA_CAN_VIEW | PCA_TIME_UNIT,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
fnAArea = opt2fn_null("-aa", NFILE, fnm);
bDoAccSurf = (fnArea || fnTArea || fnAArea);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xp, NULL, box, FALSE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xp, nullptr, box, FALSE);
atoms = &(top.atoms);
check_oo(atoms);
bPhbres = bPhobics(atoms);
std::strcpy(pdbfile, "ddXXXXXX");
gmx_tmpnam(pdbfile);
- if ((tmpf = fopen(pdbfile, "w")) == NULL)
+ if ((tmpf = fopen(pdbfile, "w")) == nullptr)
{
sprintf(pdbfile, "%ctmp%cfilterXXXXXX", DIR_SEPARATOR, DIR_SEPARATOR);
gmx_tmpnam(pdbfile);
- if ((tmpf = fopen(pdbfile, "w")) == NULL)
+ if ((tmpf = fopen(pdbfile, "w")) == nullptr)
{
gmx_fatal(FARGS, "Can not open tmp file %s", pdbfile);
}
std::strcpy(tmpfile, "ddXXXXXX");
gmx_tmpnam(tmpfile);
- if ((tmpf = fopen(tmpfile, "w")) == NULL)
+ if ((tmpf = fopen(tmpfile, "w")) == nullptr)
{
sprintf(tmpfile, "%ctmp%cfilterXXXXXX", DIR_SEPARATOR, DIR_SEPARATOR);
gmx_tmpnam(tmpfile);
- if ((tmpf = fopen(tmpfile, "w")) == NULL)
+ if ((tmpf = fopen(tmpfile, "w")) == nullptr)
{
gmx_fatal(FARGS, "Can not open tmp file %s", tmpfile);
}
fclose(tmpf);
}
- if ((dptr = getenv("DSSP")) == NULL)
+ if ((dptr = getenv("DSSP")) == nullptr)
{
dptr = "/usr/local/bin/dssp";
}
}
else
{
- fTArea = NULL;
+ fTArea = nullptr;
}
- mat.map = NULL;
+ mat.map = nullptr;
mat.nmap = readcmap(opt2fn("-map", NFILE, fnm), &(mat.map));
natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
snew(average_area, atoms->nres);
snew(av_area, atoms->nres);
snew(norm_av_area, atoms->nres);
- accr = NULL;
+ accr = nullptr;
naccr = 0;
gpbc = gmx_rmpbc_init(&top.idef, ePBC, natoms);
}
gmx_rmpbc(gpbc, natoms, box, x);
tapein = gmx_ffopen(pdbfile, "w");
- write_pdbfile_indexed(tapein, NULL, atoms, x, ePBC, box, ' ', -1, gnx, index, NULL, TRUE);
+ write_pdbfile_indexed(tapein, nullptr, atoms, x, ePBC, box, ' ', -1, gnx, index, nullptr, TRUE);
gmx_ffclose(tapein);
if (0 != system(dssp))
/*
* 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,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.
};
t_filenm fnm[] = {
- { efTRN, "-f", NULL, ffREAD },
- { efTPR, "-s", NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRN, "-f", nullptr, ffREAD },
+ { efTPR, "-s", nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXVG, "-vacf", "vacf", ffWRITE },
{ efXVG, "-mvacf", "mvacf", ffWRITE },
{ efXVG, "-dos", "dos", ffWRITE },
please_cite(fplog, "Pascal2011a");
please_cite(fplog, "Caleman2011b");
- read_tps_conf(ftp2fn(efTPR, NFILE, fnm), &top, &ePBC, NULL, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPR, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE);
/* Handle index groups */
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &grpNatoms, &index, &grpname);
snew(c1, gnx);
for (i = 0; (i < gnx); i++)
{
- c1[i] = NULL;
+ c1[i] = nullptr;
}
read_first_frame(oenv, &status, ftp2fn(efTRN, NFILE, fnm), &fr, TRX_NEED_V);
normalizeAutocorrelation = opt2parg_bool("-normalize", npargs, ppa);
/* Note that we always disable normalization here, regardless of user settings */
- low_do_autocorr(NULL, oenv, NULL, nframes, gnx, nframes, c1, dt, eacNormal, 0, FALSE,
+ low_do_autocorr(nullptr, oenv, nullptr, nframes, gnx, nframes, c1, dt, eacNormal, 0, FALSE,
FALSE, FALSE, -1, -1, 0);
snew(dos, DOS_NR);
for (j = 0; (j < DOS_NR); j++)
}
}
/* Normalize it */
- dostot = evaluate_integral(nframes/4, nu, dos[DOS], NULL, nframes/4, &stddev);
+ dostot = evaluate_integral(nframes/4, nu, dos[DOS], nullptr, nframes/4, &stddev);
if (bNormalizeDos)
{
for (j = 0; (j < nframes/4); j++)
dos[DOS_E][j] = (dos[DOS_DIFF][j]*wEdiff +
dos[DOS_SOLID][j]*wEsolid(nu[j], beta));
}
- DiffCoeff = evaluate_integral(nframes/2, tt, dos[VACF], NULL, nframes/2, &stddev);
+ DiffCoeff = evaluate_integral(nframes/2, tt, dos[VACF], nullptr, nframes/2, &stddev);
DiffCoeff = 1000*DiffCoeff/3.0;
fprintf(fplog, "Diffusion coefficient from VACF %g 10^-5 cm^2/s\n",
DiffCoeff);
fprintf(fplog, "Diffusion coefficient from DoS %g 10^-5 cm^2/s\n",
1000*DoS0/(12*tmass*beta));
- cP = BOLTZ * evaluate_integral(nframes/4, nu, dos[DOS_CP], NULL,
+ cP = BOLTZ * evaluate_integral(nframes/4, nu, dos[DOS_CP], nullptr,
nframes/4, &stddev);
fprintf(fplog, "Heat capacity %g J/mol K\n", 1000*cP/Nmol);
fprintf(fplog, "\nArrivederci!\n");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
t_filenm fnm[] =
{
- { efTRX, "-f", NULL, ffREAD },
- { efNDX, NULL, NULL, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffREAD },
{ efXVG, "-ot", "rkappa", ffOPTWR },
{ efXVG, "-oe", "insteff", ffOPTWR },
{ efDAT, "-o", "rkappa", ffOPTWR },
#define NFILE asize(fnm)
- const char *in_trajfile, *out_xvgrkfile = NULL, *out_xvginstefffile = NULL, *out_xvgrhistfile = NULL, *out_xvgkhistfile = NULL, *out_datfile = NULL;
+ const char *in_trajfile, *out_xvgrkfile = nullptr, *out_xvginstefffile = nullptr, *out_xvgrhistfile = nullptr, *out_xvgkhistfile = nullptr, *out_datfile = nullptr;
gmx_bool bHaveFirstFrame, bHaveNextFrame, indexOK = TRUE;
int ndon, nacc;
int *donindex, *accindex;
/*we rely on PBC autodetection (...currently)*/
int ePBC = -1;
- real *rvalues = NULL, *kappa2values = NULL, *rhist = NULL, *khist = NULL;
- t_pbc *pbc = NULL;
+ real *rvalues = nullptr, *kappa2values = nullptr, *rhist = nullptr, *khist = nullptr;
+ t_pbc *pbc = nullptr;
int i, bin;
- FILE *rkfp = NULL, *rhfp = NULL, *khfp = NULL, *datfp = NULL, *iefp = NULL;
+ FILE *rkfp = nullptr, *rhfp = nullptr, *khfp = nullptr, *datfp = nullptr, *iefp = nullptr;
gmx_bool bRKout, bRhistout, bKhistout, bDatout, bInstEffout, grident;
const char *rkleg[2] = { "R", "\\f{Symbol}k\\f{}\\S2\\N" };
int rkcount = 0, rblocksallocated = 0, kblocksallocated = 0;
if (!parse_common_args(&argc, argv, PCA_CAN_BEGIN | PCA_CAN_END | PCA_CAN_VIEW | PCA_TIME_UNIT,
- NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
}
printf("Select group with donor atom pairs defining the transition moment\n");
- get_index(NULL, ftp2fn_null(efNDX, NFILE, fnm), 1, &ndon, &donindex, &grpnm);
+ get_index(nullptr, ftp2fn_null(efNDX, NFILE, fnm), 1, &ndon, &donindex, &grpnm);
printf("Select group with acceptor atom pairs defining the transition moment\n");
- get_index(NULL, ftp2fn_null(efNDX, NFILE, fnm), 1, &nacc, &accindex, &grpnm);
+ get_index(nullptr, ftp2fn_null(efNDX, NFILE, fnm), 1, &nacc, &accindex, &grpnm);
/*check if groups are identical*/
grident = TRUE;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
};
int i, j, natoms, isize;
t_trxstatus *status;
- int *index = NULL, *index_all;
+ int *index = nullptr, *index_all;
char *grpname;
real angle, trans;
rvec *x, *v, *xout, *vout;
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa,
- asize(desc), desc, 0, NULL, &oenv))
+ asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
t_topology *top;
snew(top, 1);
- read_tps_conf(opt2fn("-f", NFILE, fnm), top, NULL, &x, &v, box, FALSE);
+ read_tps_conf(opt2fn("-f", NFILE, fnm), top, nullptr, &x, &v, box, FALSE);
t_atoms &atoms = top->atoms;
- if (atoms.pdbinfo == NULL)
+ if (atoms.pdbinfo == nullptr)
{
snew(atoms.pdbinfo, atoms.nr);
}
atoms.resinfo[atoms.atom[j].resind].chainid = label;
}
- write_trx(status, atoms.nr, index_all, &atoms, i, angle, box, xout, vout, NULL);
+ write_trx(status, atoms.nr, index_all, &atoms, i, angle, box, xout, vout, nullptr);
}
close_trx(status);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
calc_triclinic_images(box, img + 1);
- write_sto_conf(fn, "Images", &atoms, img, NULL, ePBC, box);
+ write_sto_conf(fn, "Images", &atoms, img, nullptr, ePBC, box);
done_atom(&atoms);
sfree(img);
resind_prev = -1;
for (i = 0; i < isize; i++)
{
- resind = atoms->atom[index == NULL ? i : index[i]].resind;
+ resind = atoms->atom[index == nullptr ? i : index[i]].resind;
if (resind != resind_prev)
{
atoms->resinfo[resind].nr = resnr_start;
{ 0, 0, 0 }, targetvec =
{ 0, 0, 0 };
static const char *btype[] =
- { NULL, "triclinic", "cubic", "dodecahedron", "octahedron", NULL },
+ { nullptr, "triclinic", "cubic", "dodecahedron", "octahedron", nullptr },
*label = "A";
static rvec visbox =
{ 0, 0, 0 };
FILE *out;
const char *infile, *outfile;
int outftp, inftp, natom, i, j, n_bfac, itype, ntype;
- double *bfac = NULL, c6, c12;
- int *bfac_nr = NULL;
- t_topology *top = NULL;
+ double *bfac = nullptr, c6, c12;
+ int *bfac_nr = nullptr;
+ t_topology *top = nullptr;
char *grpname, *sgrpname, *agrpname;
int isize, ssize, asize;
int *index, *sindex, *aindex;
gmx_output_env_t *oenv;
t_filenm fnm[] =
{
- { efSTX, "-f", NULL, ffREAD },
- { efNDX, "-n", NULL, ffOPTRD },
- { efSTO, NULL, NULL, ffOPTWR },
+ { efSTX, "-f", nullptr, ffREAD },
+ { efNDX, "-n", nullptr, ffOPTRD },
+ { efSTO, nullptr, nullptr, ffOPTWR },
{ efPQR, "-mead", "mead", ffOPTWR },
{ efDAT, "-bf", "bfact", ffOPTRD }
};
bScale = bScale || bRho;
bCalcGeom = bCenter || bRotate || bOrient || bScale;
- GMX_RELEASE_ASSERT(btype[0] != NULL, "Option setting inconsistency; btype[0] is NULL");
+ GMX_RELEASE_ASSERT(btype[0] != nullptr, "Option setting inconsistency; btype[0] is NULL");
bCalcDiam = (btype[0][0] == 'c' || btype[0][0] == 'd' || btype[0][0] == 'o');
read_tps_conf(infile, top_tmp, &ePBC, &x, &v, box, FALSE);
t_atoms &atoms = top_tmp->atoms;
natom = atoms.nr;
- if (atoms.pdbinfo == NULL)
+ if (atoms.pdbinfo == nullptr)
{
snew(atoms.pdbinfo, atoms.nr);
}
if (bMead || bGrasp || bCONECT)
{
- top = read_top(infile, NULL);
+ top = read_top(infile, nullptr);
}
if (bMead || bGrasp)
else
{
ssize = atoms.nr;
- sindex = NULL;
+ sindex = nullptr;
}
diam = calc_geom(ssize, sindex, x, gc, rmin, rmax, bCalcDiam);
rvec_sub(rmax, rmin, size);
get_index(&atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, &grpnames);
/* Orient the principal axes along the coordinate axes */
- orient_princ(&atoms, isize, index, natom, x, bHaveV ? v : NULL, NULL);
+ orient_princ(&atoms, isize, index, natom, x, bHaveV ? v : nullptr, nullptr);
sfree(index);
sfree(grpnames);
}
else
{
ssize = atoms.nr;
- sindex = NULL;
+ sindex = nullptr;
}
printf("Translating %d atoms (out of %d) by %g %g %g nm\n", ssize, natom,
translation[XX], translation[YY], translation[ZZ]);
}
}
- if ((btype[0] != NULL) && (bSetSize || bDist || (btype[0][0] == 't' && bSetAng)))
+ if ((btype[0] != nullptr) && (bSetSize || bDist || (btype[0][0] == 't' && bSetAng)))
{
ePBC = epbcXYZ;
if (!(bSetSize || bDist))
}
else
{
- conect = NULL;
+ conect = nullptr;
}
if (bIndex)
}
else
{
- write_sto_conf_indexed(outfile, *top_tmp->name, &atoms, x, bHaveV ? v : NULL, ePBC, box, isize, index);
+ write_sto_conf_indexed(outfile, *top_tmp->name, &atoms, x, bHaveV ? v : nullptr, ePBC, box, isize, index);
}
}
else
{
if (resnr_start >= 0)
{
- renum_resnr(&atoms, atoms.nr, NULL, resnr_start);
+ renum_resnr(&atoms, atoms.nr, nullptr, resnr_start);
}
if ((outftp == efPDB) || (outftp == efPQR))
}
else
{
- write_sto_conf(outfile, *top_tmp->name, &atoms, x, bHaveV ? v : NULL, ePBC, box);
+ write_sto_conf(outfile, *top_tmp->name, &atoms, x, bHaveV ? v : nullptr, ePBC, box);
}
}
gmx_atomprop_destroy(aps);
- do_view(oenv, outfile, NULL);
+ do_view(oenv, outfile, nullptr);
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int *set;
gmx_bool bVerbose = TRUE;
- if ((getenv("GMX_ENER_VERBOSE")) != NULL)
+ if ((getenv("GMX_ENER_VERBOSE")) != nullptr)
{
bVerbose = FALSE;
}
for (f = 0; f < nfiles; f++)
{
in = open_enx(fnms[f], "r");
- enm = NULL;
+ enm = nullptr;
do_enxnms(in, &nre, &enm);
if (f == 0)
fprintf(stderr,
"\nContinue conversion using only the first %d terms (n/y)?\n"
"(you should be sure that the energy terms match)\n", nremin);
- if (NULL == fgets(inputstring, STRLEN-1, stdin))
+ if (nullptr == fgets(inputstring, STRLEN-1, stdin))
{
gmx_fatal(FARGS, "Error reading user input");
}
ok = FALSE;
do
{
- if (NULL == fgets(inputstring, STRLEN-1, stdin))
+ if (nullptr == fgets(inputstring, STRLEN-1, stdin))
{
gmx_fatal(FARGS, "Error reading user input");
}
const char *bugs[] = {
"When combining trajectories the sigma and E^2 (necessary for statistics) are not updated correctly. Only the actual energy is correct. One thus has to compute statistics in another way."
};
- ener_file_t in = NULL, out = NULL;
- gmx_enxnm_t *enm = NULL;
+ ener_file_t in = nullptr, out = nullptr;
+ gmx_enxnm_t *enm = nullptr;
#if 0
ener_file_t in, out = NULL;
gmx_enxnm_t *enm = NULL;
t_energy *ee_sum;
gmx_int64_t lastfilestep, laststep, startstep_file = 0;
int noutfr;
- int nre, nremax, this_nre, nfile, f, i, kkk, nset, *set = NULL;
+ int nre, nremax, this_nre, nfile, f, i, kkk, nset, *set = nullptr;
double last_t;
char **fnms;
real *readtime, *settime, timestep, tadjust;
gmx_bool bNewFile, bFirst, bNewOutput;
gmx_output_env_t *oenv;
gmx_bool warned_about_dh = FALSE;
- t_enxblock *blocks = NULL;
+ t_enxblock *blocks = nullptr;
int nblocks = 0;
int nblocks_alloc = 0;
t_filenm fnm[] = {
- { efEDR, "-f", NULL, ffRDMULT },
+ { efEDR, "-f", nullptr, ffRDMULT },
{ efEDR, "-o", "fixed", ffWRITE },
};
bNewFile = TRUE;
bNewOutput = TRUE;
in = open_enx(fnms[f], "r");
- enm = NULL;
+ enm = nullptr;
do_enxnms(in, &this_nre, &enm);
if (f == 0)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
ener_file_t in;
FILE *out;
int timecheck = 0;
- gmx_enxnm_t *enm = NULL;
+ gmx_enxnm_t *enm = nullptr;
t_enxframe *fr;
int teller = 0;
real sum;
gmx_bool bCont, bRef;
gmx_bool bCutmax, bCutmin;
- real **eneset, *time = NULL;
+ real **eneset, *time = nullptr;
int *set, i, j, k, prevk, m = 0, n, nre, nset, nenergy;
- char **groups = NULL;
+ char **groups = nullptr;
char groupname[255], fn[255];
int ngroups;
t_rgb rlo, rhi, rmid;
real emax, emid, emin;
real ***emat, **etot, *groupnr;
- double beta, expE, **e, *eaver, *efree = NULL, edum;
+ double beta, expE, **e, *eaver, *efree = nullptr, edum;
char label[234];
- char **ereflines, **erefres = NULL;
- real *eref = NULL, *edif = NULL;
+ char **ereflines, **erefres = nullptr;
+ real *eref = nullptr, *edif = nullptr;
int neref = 0;
gmx_output_env_t *oenv;
t_filenm fnm[] = {
- { efEDR, "-f", NULL, ffOPTRD },
+ { efEDR, "-f", nullptr, ffOPTRD },
{ efDAT, "-groups", "groups", ffREAD },
{ efDAT, "-eref", "eref", ffOPTRD },
{ efXPM, "-emat", "emat", ffWRITE },
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
out = xvgropen(ftp2fn(efXVG, NFILE, fnm), "Mean Energy", "Residue", "kJ/mol",
oenv);
- xvgr_legend(out, 0, NULL, oenv);
+ xvgr_legend(out, 0, nullptr, oenv);
j = 0;
if (output_env_get_print_xvgr_codes(oenv))
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int *set;
gmx_bool bVerbose = TRUE;
- if ((getenv("GMX_ENER_VERBOSE")) != NULL)
+ if ((getenv("GMX_ENER_VERBOSE")) != nullptr)
{
bVerbose = FALSE;
}
char *ptr, buf[STRLEN];
const char *fm4 = "%3d %-14s";
const char *fm2 = "%3d %-34s";
- char **newnm = NULL;
+ char **newnm = nullptr;
- if ((getenv("GMX_ENER_VERBOSE")) != NULL)
+ if ((getenv("GMX_ENER_VERBOSE")) != nullptr)
{
bVerbose = FALSE;
}
{
newnm[k] = gmx_strdup(nm[k].name);
/* Insert dashes in all the names */
- while ((ptr = std::strchr(newnm[k], ' ')) != NULL)
+ while ((ptr = std::strchr(newnm[k], ' ')) != nullptr)
{
*ptr = '-';
}
}
}
/* Look for the first space, and remove spaces from there */
- if ((ptr = std::strchr(ptr, ' ')) != NULL)
+ if ((ptr = std::strchr(ptr, ' ')) != nullptr)
{
trim(ptr);
}
matrix box;
/* all we need is the ir to be able to write the label */
- read_tpx(topnm, ir, box, &natoms, NULL, NULL, &mtop);
+ read_tpx(topnm, ir, box, &natoms, nullptr, nullptr, &mtop);
}
static void get_orires_parms(const char *topnm, t_inputrec *ir,
int nb;
matrix box;
- read_tpx(topnm, ir, box, &natoms, NULL, NULL, &mtop);
+ read_tpx(topnm, ir, box, &natoms, nullptr, nullptr, &mtop);
top = gmx_mtop_generate_local_top(&mtop, ir->efep != efepNO);
ip = top->idef.iparams;
int nb, label1;
matrix box;
- read_tpx(topnm, ir, box, &natoms, NULL, NULL, mtop);
+ read_tpx(topnm, ir, box, &natoms, nullptr, nullptr, mtop);
snew(*ltop, 1);
top = gmx_mtop_generate_local_top(mtop, ir->efep != efepNO);
*ltop = top;
/* Subtract bounds from distances, to calculate violations */
calc_violations(violaver, violaver,
- nbounds, pair, bounds, NULL, &sumt, &sumaver);
+ nbounds, pair, bounds, nullptr, &sumt, &sumaver);
#ifdef DEBUG
fprintf(stdout, "\nSum of violations averaged over simulation: %g nm\n",
{
delta = edat->s[i].slope*dt;
- if (NULL != debug)
+ if (nullptr != debug)
{
fprintf(debug, "slope for set %d is %g\n", i, edat->s[i].slope);
}
fprintf(fp, "WARNING: Please verify that your simulations are converged and perform\n"
"a block-averaging error analysis (not implemented in g_energy yet)\n");
- if (debug != NULL)
+ if (debug != nullptr)
{
if (varv != NOTSET)
{
FILE *fp;
/* Check out the printed manual for equations! */
double Dt, aver, stddev, errest, delta_t, totaldrift;
- enerdata_t *esum = NULL;
+ enerdata_t *esum = nullptr;
real integral, intBulk, Temp = 0, Pres = 0;
real pr_aver, pr_stddev, pr_errest;
- double beta = 0, expE, expEtot, *fee = NULL;
+ double beta = 0, expE, expEtot, *fee = nullptr;
gmx_int64_t nsteps;
int nexact, nnotexact;
int i, j, nout;
fee[i] = std::log(expE/edat->nframes)/beta + aver/nmol;
}
- if (std::strstr(leg[i], "empera") != NULL)
+ if (std::strstr(leg[i], "empera") != nullptr)
{
Temp = aver;
}
- else if (std::strstr(leg[i], "olum") != NULL)
+ else if (std::strstr(leg[i], "olum") != nullptr)
{
Vaver = aver;
}
- else if (std::strstr(leg[i], "essure") != NULL)
+ else if (std::strstr(leg[i], "essure") != nullptr)
{
Pres = aver;
}
real aver, beta;
real **eneset2;
double dE, sum;
- gmx_enxnm_t *enm = NULL;
+ gmx_enxnm_t *enm = nullptr;
t_enxframe *fr;
char buf[22];
/* read second energy file */
snew(fr, 1);
- enm = NULL;
+ enm = nullptr;
enx = open_enx(ene2fn, "r");
do_enxnms(enx, &(fr->nre), &enm);
srenew(eneset2[i], maxenergy);
}
}
- GMX_RELEASE_ASSERT(time != NULL, "trying to dereference NULL time pointer");
+ GMX_RELEASE_ASSERT(time != nullptr, "trying to dereference NULL time pointer");
if (fr->t != time[nenergy2])
{
nenergy = std::min(edat->nframes, nenergy2);
/* calculate fe difference dF = -kT ln < exp(-(E_B-E_A)/kT) >_A */
- fp = NULL;
+ fp = nullptr;
if (runavgfn)
{
fp = xvgropen(runavgfn, "Running average free energy difference",
/* coll data */
double temp = 0, start_time = 0, delta_time = 0, start_lambda = 0;
static int setnr = 0;
- double *native_lambda_vec = NULL;
- const char **lambda_components = NULL;
+ double *native_lambda_vec = nullptr;
+ const char **lambda_components = nullptr;
int n_lambda_vec = 0;
bool firstPass = true;
"Volume", "Pressure"
};
- FILE *out = NULL, *fp_pairs = NULL, *fort = NULL, *fodt = NULL, *foten = NULL;
- FILE *fp_dhdl = NULL;
+ FILE *out = nullptr, *fp_pairs = nullptr, *fort = nullptr, *fodt = nullptr, *foten = nullptr;
+ FILE *fp_dhdl = nullptr;
ener_file_t fp;
int timecheck = 0;
gmx_mtop_t mtop;
- gmx_localtop_t *top = NULL;
+ gmx_localtop_t *top = nullptr;
enerdata_t edat;
- gmx_enxnm_t *enm = NULL;
- t_enxframe *frame, *fr = NULL;
+ gmx_enxnm_t *enm = nullptr;
+ t_enxframe *frame, *fr = nullptr;
int cur = 0;
#define NEXT (1-cur)
int nre, teller, teller_disre, nfr;
gmx_int64_t start_step;
int nor = 0, nex = 0, norfr = 0, enx_i = 0;
real start_t;
- real *bounds = NULL, *violaver = NULL, *oobs = NULL, *orient = NULL, *odrms = NULL;
- int *index = NULL, *pair = NULL, norsel = 0, *orsel = NULL, *or_label = NULL;
+ real *bounds = nullptr, *violaver = nullptr, *oobs = nullptr, *orient = nullptr, *odrms = nullptr;
+ int *index = nullptr, *pair = nullptr, norsel = 0, *orsel = nullptr, *or_label = nullptr;
int nbounds = 0, npairs;
gmx_bool bDisRe, bDRAll, bORA, bORT, bODA, bODR, bODT, bORIRE, bOTEN, bDHDL;
gmx_bool bFoundStart, bCont, bVisco;
double sum, sumaver, sumt, dbl;
- double *time = NULL;
+ double *time = nullptr;
real Vaver;
- int *set = NULL, i, j, k, nset, sss;
- gmx_bool *bIsEner = NULL;
+ int *set = nullptr, i, j, k, nset, sss;
+ gmx_bool *bIsEner = nullptr;
char **pairleg, **odtleg, **otenleg;
- char **leg = NULL;
+ char **leg = nullptr;
const char *anm_j, *anm_k, *resnm_j, *resnm_k;
int resnr_j, resnr_k;
const char *orinst_sub = "@ subtitle \"instantaneous\"\n";
char buf[256];
gmx_output_env_t *oenv;
- t_enxblock *blk = NULL;
- t_enxblock *blk_disre = NULL;
+ t_enxblock *blk = nullptr;
+ t_enxblock *blk_disre = nullptr;
int ndisre = 0;
int dh_blocks = 0, dh_hists = 0, dh_samples = 0, dh_lambdas = 0;
t_filenm fnm[] = {
- { efEDR, "-f", NULL, ffREAD },
- { efEDR, "-f2", NULL, ffOPTRD },
- { efTPR, "-s", NULL, ffOPTRD },
+ { efEDR, "-f", nullptr, ffREAD },
+ { efEDR, "-f2", nullptr, ffOPTRD },
+ { efTPR, "-s", nullptr, ffOPTRD },
{ efXVG, "-o", "energy", ffWRITE },
{ efXVG, "-viol", "violaver", ffOPTWR },
{ efXVG, "-pairs", "pairs", ffOPTWR },
ppa = add_acf_pargs(&npargs, pa);
if (!parse_common_args(&argc, argv,
PCA_CAN_VIEW | PCA_CAN_BEGIN | PCA_CAN_END,
- NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv))
{
sfree(ppa);
return 0;
gmx_fatal(FARGS, "Printing averages can only be done when a single set is selected");
}
- time = NULL;
+ time = nullptr;
if (bORIRE || bOTEN)
{
fprintf(stderr, "Select the orientation restraint labels you want (-1 is all)\n");
fprintf(stderr, "End your selection with 0\n");
j = -1;
- orsel = NULL;
+ orsel = nullptr;
do
{
j++;
edat.nsteps = 0;
edat.npoints = 0;
edat.nframes = 0;
- edat.step = NULL;
- edat.steps = NULL;
- edat.points = NULL;
+ edat.step = nullptr;
+ edat.steps = nullptr;
+ edat.points = nullptr;
edat.bHaveSums = TRUE;
snew(edat.s, nset);
* Define distance restraint legends. Can only be done after
* the first frame has been read... (Then we know how many there are)
*/
- blk_disre = find_block_id_enxframe(fr, enxDISRE, NULL);
+ blk_disre = find_block_id_enxframe(fr, enxDISRE, nullptr);
if (bDisRe && bDRAll && !leg && blk_disre)
{
t_iatom *fa;
*******************************************/
if (ndisre > 0)
{
- GMX_RELEASE_ASSERT(blk_disre != NULL, "Trying to dereference NULL blk_disre pointer");
+ GMX_RELEASE_ASSERT(blk_disre != nullptr, "Trying to dereference NULL blk_disre pointer");
#if !GMX_DOUBLE
float *disre_rt = blk_disre->sub[0].fval;
float *disre_rm3tav = blk_disre->sub[1].fval;
#endif
print_time(out, fr->t);
- if (violaver == NULL)
+ if (violaver == nullptr)
{
snew(violaver, ndisre);
}
fprintf(out, "\n");
}
}
- blk = find_block_id_enxframe(fr, enx_i, NULL);
+ blk = find_block_id_enxframe(fr, enx_i, nullptr);
if (bORIRE && blk)
{
#if !GMX_DOUBLE
}
norfr++;
}
- blk = find_block_id_enxframe(fr, enxORT, NULL);
+ blk = find_block_id_enxframe(fr, enxORT, nullptr);
if (bOTEN && blk)
{
#if !GMX_DOUBLE
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
char *grpname;
int isize;
int *index;
- real *w_rls = NULL;
+ real *w_rls = nullptr;
t_trxstatus *in;
t_trxstatus *outl, *outh;
int nffr, i, fr, nat, j, d, m;
real flen, *filt, sum, *t;
rvec xcmtop, xcm, **x, *ptr, *xf, *xn, *xp, hbox;
gmx_output_env_t *oenv;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
#define NLEG asize(leg)
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffOPTRD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efTRO, "-ol", "lowpass", ffOPTWR },
{ efTRO, "-oh", "highpass", ffOPTWR }
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
if (topfile)
{
bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC,
- &xtop, NULL, topbox, TRUE);
+ &xtop, nullptr, topbox, TRUE);
if (bTop)
{
gpbc = gmx_rmpbc_init(&top.idef, ePBC, top.atoms.nr);
}
else
{
- outl = 0;
+ outl = nullptr;
}
if (highfile)
{
}
else
{
- outh = 0;
+ outh = nullptr;
}
fr = 0;
}
if (outl && (bLowAll || fr % nf == nf - 1))
{
- write_trx(outl, nat, ind, topfile ? &(top.atoms) : NULL,
- 0, t[nf - 1], bFit ? topbox : boxf, xf, NULL, NULL);
+ write_trx(outl, nat, ind, topfile ? &(top.atoms) : nullptr,
+ 0, t[nf - 1], bFit ? topbox : boxf, xf, nullptr, nullptr);
}
if (outh)
{
boxf[j][d] = topbox[j][d] + box[nf - 1][j][d] - boxf[j][d];
}
}
- write_trx(outh, nat, ind, topfile ? &(top.atoms) : NULL,
- 0, t[nf - 1], bFit ? topbox : boxf, xf, NULL, NULL);
+ write_trx(outh, nat, ind, topfile ? &(top.atoms) : nullptr,
+ 0, t[nf - 1], bFit ? topbox : boxf, xf, nullptr, nullptr);
}
}
/* Cycle all the pointer and the box by one */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
int i, j, k, r, np, nn, starta, startr, npi, nni;
rvec *xt;
- char **pptr = NULL, **nptr = NULL, **paptr = NULL, **naptr = NULL;
+ char **pptr = nullptr, **nptr = nullptr, **paptr = nullptr, **naptr = nullptr;
snew(xt, atoms->nr);
const char *p_name, const char *n_name, char *grpname)
{
FILE *fpin, *fpout;
- char buf[STRLEN], buf2[STRLEN], *temp, **mol_line = NULL;
+ char buf[STRLEN], buf2[STRLEN], *temp, **mol_line = nullptr;
int line, i, nmol_line, sol_line, nsol_last;
gmx_bool bMolecules;
char temporary_filename[STRLEN];
{
line++;
std::strcpy(buf2, buf);
- if ((temp = std::strchr(buf2, '\n')) != NULL)
+ if ((temp = std::strchr(buf2, '\n')) != nullptr)
{
temp[0] = '\0';
}
if (buf2[0] == '[')
{
buf2[0] = ' ';
- if ((temp = std::strchr(buf2, '\n')) != NULL)
+ if ((temp = std::strchr(buf2, '\n')) != nullptr)
{
temp[0] = '\0';
}
int i, nw, nwa, nsa, nsalt, iqtot;
gmx_output_env_t *oenv;
t_filenm fnm[] = {
- { efTPR, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efSTO, "-o", NULL, ffWRITE },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efSTO, "-o", nullptr, ffWRITE },
{ efTOP, "-p", "topol", ffOPTRW }
};
#define NFILE asize(fnm)
}
sfree(atoms.pdbinfo);
- atoms.pdbinfo = NULL;
+ atoms.pdbinfo = nullptr;
}
- write_sto_conf(ftp2fn(efSTO, NFILE, fnm), *top.name, &atoms, x, NULL, ePBC, box);
+ write_sto_conf(ftp2fn(efSTO, NFILE, fnm), *top.name, &atoms, x, nullptr, ePBC, box);
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
#define npargs asize(pa)
gmx_output_env_t *oenv;
- t_atoms *atoms = NULL;
+ t_atoms *atoms = nullptr;
int i, j, k;
FILE *out;
int igrp;
char *gn_grp;
matrix box;
gmx_bool bFreeze;
- rvec dx, *x = NULL, *v = NULL;
+ rvec dx, *x = nullptr, *v = nullptr;
t_filenm fnm[] = {
- { efSTX, "-f", NULL, ffREAD },
- { efNDX, "-n", NULL, ffOPTRD },
+ { efSTX, "-f", nullptr, ffREAD },
+ { efNDX, "-n", nullptr, ffOPTRD },
{ efITP, "-o", "posre", ffWRITE },
{ efNDX, "-of", "freeze", ffOPTWR }
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, 0, NFILE, fnm, npargs, pa,
- asize(desc), desc, 0, NULL, &oenv))
+ asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
xfn = opt2fn_null("-f", NFILE, fnm);
nfn = opt2fn_null("-n", NFILE, fnm);
- if (( nfn == NULL ) && ( xfn == NULL))
+ if (( nfn == nullptr ) && ( xfn == nullptr))
{
gmx_fatal(FARGS, "no index file and no structure file supplied");
}
}
const char *title = "";
- if (xfn != NULL)
+ if (xfn != nullptr)
{
fprintf(stderr, "\nReading structure file\n");
- t_topology *top = NULL;
+ t_topology *top = nullptr;
snew(top, 1);
- read_tps_conf(xfn, top, NULL, &x, &v, box, FALSE);
+ read_tps_conf(xfn, top, nullptr, &x, &v, box, FALSE);
title = *top->name;
atoms = &top->atoms;
- if (atoms->pdbinfo == NULL)
+ if (atoms->pdbinfo == nullptr)
{
snew(atoms->pdbinfo, atoms->nr);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int gnx, int index[], t_atom atom[],
int nz, real time, FILE *out)
{
- static dvec *inertia = NULL;
- static double *tm = NULL;
+ static dvec *inertia = nullptr;
+ static double *tm = nullptr;
int i, ii, j, zi;
real zf, w, sdet, e1, e2;
- if (inertia == NULL)
+ if (inertia == nullptr)
{
snew(inertia, nz);
snew(tm, nz);
rvec xcm, gvec, gvec1;
matrix box, trans;
gmx_bool bACF;
- real **moi_trans = NULL;
+ real **moi_trans = nullptr;
int max_moi = 0, delta_moi = 100;
rvec d, d1; /* eigenvalues of inertia tensor */
real t, t0, tm, gyro;
int j, m, gnx, nam, mol;
int *index;
gmx_output_env_t *oenv;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
const char *leg[] = { "Rg", "Rg\\sX\\N", "Rg\\sY\\N", "Rg\\sZ\\N" };
const char *legI[] = { "Itot", "I1", "I2", "I3" };
#define NLEG asize(leg)
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efXVG, NULL, "gyrate", ffWRITE },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efXVG, nullptr, "gyrate", ffWRITE },
{ efXVG, "-acf", "moi-acf", ffOPTWR },
};
#define NFILE asize(fnm)
ppa = add_acf_pargs(&npargs, pa);
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv))
{
sfree(ppa);
return 0;
printf("Will print radius normalised by charge\n");
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, TRUE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
if (nmol > gnx || gnx % nmol != 0)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
i, j, teller = 0,
slice = 0, /* current slice number */
*count; /* nr. of atoms in one slice */
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
if ((natoms = read_first_x(oenv, &status, fn, &t, &x0, box)) == 0)
{
};
gmx_output_env_t *oenv;
- real *slOrder, /* av. cosine, per slice */
- slWidth = 0.0; /* width of a slice */
+ real *slOrder, /* av. cosine, per slice */
+ slWidth = 0.0; /* width of a slice */
rvec *slDipole;
- char *grpname, /* groupnames */
+ char *grpname, /* groupnames */
*micname;
- int ngx, /* nr. of atomsin sol group */
- nmic = 0; /* nr. of atoms in micelle */
- t_topology *top; /* topology */
+ int ngx, /* nr. of atomsin sol group */
+ nmic = 0; /* nr. of atoms in micelle */
+ t_topology *top; /* topology */
int ePBC;
- int *index, /* indices for solvent group */
- *micelle = NULL;
- gmx_bool bMicel = FALSE; /* think we're a micel */
- t_filenm fnm[] = { /* files for g_order */
- { efTRX, "-f", NULL, ffREAD }, /* trajectory file */
- { efNDX, NULL, NULL, ffREAD }, /* index file */
- { efNDX, "-nm", NULL, ffOPTRD }, /* index with micelle atoms */
- { efTPR, NULL, NULL, ffREAD }, /* topology file */
- { efXVG, "-o", "order", ffWRITE }, /* xvgr output file */
+ int *index, /* indices for solvent group */
+ *micelle = nullptr;
+ gmx_bool bMicel = FALSE; /* think we're a micel */
+ t_filenm fnm[] = { /* files for g_order */
+ { efTRX, "-f", nullptr, ffREAD }, /* trajectory file */
+ { efNDX, nullptr, nullptr, ffREAD }, /* index file */
+ { efNDX, "-nm", nullptr, ffOPTRD }, /* index with micelle atoms */
+ { efTPR, nullptr, nullptr, ffREAD }, /* topology file */
+ { efXVG, "-o", "order", ffWRITE }, /* xvgr output file */
};
#define NFILE asize(fnm)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
for (i = 0; (i < hb->d.nrd); i++)
{
snew(hb->hbmap[i], hb->a.nra);
- if (hb->hbmap[i] == NULL)
+ if (hb->hbmap[i] == nullptr)
{
gmx_fatal(FARGS, "Could not allocate enough memory for hbmap");
}
for (j = 0; (j > hb->a.nra); j++)
{
- hb->hbmap[i][j] = NULL;
+ hb->hbmap[i][j] = nullptr;
}
}
}
static void set_hb(t_hbdata *hb, int id, int ih, int ia, int frame, int ihb)
{
- unsigned int *ghptr = NULL;
+ unsigned int *ghptr = nullptr;
if (ihb == hbHB)
{
{
try
{
- if (hb->hbmap[id][ia] == NULL)
+ if (hb->hbmap[id][ia] == nullptr)
{
snew(hb->hbmap[id][ia], 1);
snew(hb->hbmap[id][ia]->h, hb->maxhydro);
sfree(g[z]);
}
sfree(g);
- g = NULL;
+ g = nullptr;
}
static void pbc_correct_gem(rvec dx, matrix box, rvec hbox)
}
sfree(hb1->h[0]);
sfree(hb1->g[0]);
- hb1->h[0] = NULL;
- hb1->g[0] = NULL;
+ hb1->h[0] = nullptr;
+ hb1->g[0] = nullptr;
hb1->history[0] = hbNo;
}
}
real k = 1, kp = 1, kow = 1;
real Q = 0, chi2, tau_hb, dtau, tau_rlx, e_1, sigma_k, sigma_kp, ddg;
double tmp, sn2 = 0, sc2 = 0, sk2 = 0, scn = 0, sck = 0, snk = 0;
- gmx_bool bError = (sigma_ct != NULL) && (sigma_nt != NULL) && (sigma_kt != NULL);
+ gmx_bool bError = (sigma_ct != nullptr) && (sigma_nt != nullptr) && (sigma_kt != nullptr);
for (i0 = 0; (i0 < n-2) && ((t[i0]-t[0]) < fit_start); i0++)
{
sc2, sn2, sk2, sck, snk, scn);
}
/* Determine integral of the correlation function */
- tau_hb = evaluate_integral(n, t, ct, NULL, (t[n-1]-t[0])/2, &dtau);
+ tau_hb = evaluate_integral(n, t, ct, nullptr, (t[n-1]-t[0])/2, &dtau);
printf("Integral %10.3f %s%8.3f %10.3f\n", 1/tau_hb,
bError ? " " : "", tau_hb, calc_dg(tau_hb, temp));
e_1 = std::exp(-1.0);
for (i = 0; i < len; i++)
{
ct[i] *= ct_fac;
- if (gt != NULL)
+ if (gt != nullptr)
{
gt[i] *= gt_fac;
}
};
gmx_bool bNorm = FALSE;
double nhb = 0;
- real *rhbex = NULL, *ht, *gt, *ght, *dght, *kt;
+ real *rhbex = nullptr, *ht, *gt, *ght, *dght, *kt;
real *ct, tail, tail2, dtail, *cct;
const real tol = 1e-3;
int nframes = hb->nframes;
- unsigned int **h = NULL, **g = NULL;
+ unsigned int **h = nullptr, **g = nullptr;
int nh, nhbonds, nhydro;
t_hbond *hbh;
int acType;
- int *dondata = NULL;
+ int *dondata = nullptr;
enum {
AC_NONE, AC_NN, AC_GEM, AC_LUZAR
}
/* The autocorrelation function is normalized after summation only */
- low_do_autocorr(NULL, oenv, NULL, nframes, 1, -1, &rhbex, hb->time[1]-hb->time[0],
+ low_do_autocorr(nullptr, oenv, nullptr, nframes, 1, -1, &rhbex, hb->time[1]-hb->time[0],
eacNormal, 1, FALSE, bNorm, FALSE, 0, -1, 0);
/* Cross correlation analysis for thermodynamics */
}
xvgrclose(fp);
- analyse_corr(nn, hb->time, ct, ght, kt, NULL, NULL, NULL,
+ analyse_corr(nn, hb->time, ct, ght, kt, nullptr, nullptr, nullptr,
fit_start, temp);
- do_view(oenv, fn, NULL);
+ do_view(oenv, fn, nullptr);
sfree(rhbex);
sfree(ct);
sfree(gt);
t_hbdata *hb,
const gmx_output_env_t *oenv)
{
- FILE *fp = NULL;
+ FILE *fp = nullptr;
const char *leg[] = { "Nbound", "Nfree" };
if (!fn || !hb)
{
- return NULL;
+ return nullptr;
}
fp = xvgropen(fn, "Donor properties", output_env_get_xvgr_tlabel(oenv), "Number", oenv);
}
else
{
- fplog = NULL;
+ fplog = nullptr;
}
for (grp = gr0; grp <= (bTwo ? gr1 : gr0); grp++)
{
"The option [TT]-sel[tt] that used to work on selected hbonds is out of order, and therefore not available for the time being."
};
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPR, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
/* { efNDX, "-sel", "select", ffOPTRD },*/
{ efXVG, "-num", "hbnum", ffWRITE },
{ efLOG, "-g", "hbond", ffOPTWR },
int grp, nabin, nrbin, resdist, ihb;
char **leg;
t_hbdata *hb;
- FILE *fp, *fpnhb = NULL, *donor_properties = NULL;
+ FILE *fp, *fpnhb = nullptr, *donor_properties = nullptr;
t_gridcell ***grid;
t_ncell *icell, *jcell;
ivec ngrid;
gmx_bool bParallel;
gmx_bool bEdge_yjj, bEdge_xjj;
- t_hbdata **p_hb = NULL; /* one per thread, then merge after the frame loop */
- int **p_adist = NULL, **p_rdist = NULL; /* a histogram for each thread. */
+ t_hbdata **p_hb = nullptr; /* one per thread, then merge after the frame loop */
+ int **p_adist = nullptr, **p_rdist = nullptr; /* a histogram for each thread. */
const bool bOMP = GMX_OPENMP;
/* get topology */
gmx::MDModules mdModules;
t_inputrec *ir = mdModules.inputrec();
- read_tpx_top(ftp2fn(efTPR, NFILE, fnm), ir, box, &natoms, NULL, NULL, &top);
+ read_tpx_top(ftp2fn(efTPR, NFILE, fnm), ir, box, &natoms, nullptr, nullptr, &top);
snew(grpnames, grNR);
snew(index, grNR);
snew(p_rdist[i], nrbin+1);
p_hb[i]->max_frames = 0;
- p_hb[i]->nhb = NULL;
- p_hb[i]->ndist = NULL;
- p_hb[i]->n_bound = NULL;
- p_hb[i]->time = NULL;
- p_hb[i]->nhx = NULL;
+ p_hb[i]->nhb = nullptr;
+ p_hb[i]->ndist = nullptr;
+ p_hb[i]->n_bound = nullptr;
+ p_hb[i]->time = nullptr;
+ p_hb[i]->nhx = nullptr;
p_hb[i]->bHBmap = hb->bHBmap;
p_hb[i]->bDAnr = hb->bDAnr;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
} t_xvgrfile;
t_xvgrfile xf[efhNR] = {
- { NULL, NULL, TRUE, "radius", "Helix radius", NULL, "r (nm)", 0.0 },
- { NULL, NULL, TRUE, "twist", "Twist per residue", NULL, "Angle (deg)", 0.0 },
- { NULL, NULL, TRUE, "rise", "Rise per residue", NULL, "Rise (nm)", 0.0 },
- { NULL, NULL, FALSE, "len-ahx", "Length of the Helix", NULL, "Length (nm)", 0.0 },
- { NULL, NULL, FALSE, "dip-ahx", "Helix Backbone Dipole", NULL, "rq (nm e)", 0.0 },
- { NULL, NULL, TRUE, "rms-ahx", "RMS Deviation from Ideal Helix", NULL, "RMS (nm)", 0.0 },
- { NULL, NULL, FALSE, "rmsa-ahx", "Average RMSD per Residue", "Residue", "RMS (nm)", 0.0 },
- { NULL, NULL, FALSE, "cd222", "Ellipticity at 222 nm", NULL, "nm", 0.0 },
- { NULL, NULL, TRUE, "pprms", "RMS Distance from \\8a\\4-helix", NULL, "deg", 0.0 },
- { NULL, NULL, TRUE, "caphi", "Average Ca-Ca Dihedral", NULL, "\\8F\\4(deg)", 0.0 },
- { NULL, NULL, TRUE, "phi", "Average \\8F\\4 angles", NULL, "deg", 0.0 },
- { NULL, NULL, TRUE, "psi", "Average \\8Y\\4 angles", NULL, "deg", 0.0 },
- { NULL, NULL, TRUE, "hb3", "Average n-n+3 hbond length", NULL, "nm", 0.0 },
- { NULL, NULL, TRUE, "hb4", "Average n-n+4 hbond length", NULL, "nm", 0.0 },
- { NULL, NULL, TRUE, "hb5", "Average n-n+5 hbond length", NULL, "nm", 0.0 },
- { NULL, NULL, FALSE, "JCaHa", "J-Coupling Values", "Residue", "Hz", 0.0 },
- { NULL, NULL, FALSE, "helicity", "Helicity per Residue", "Residue", "% of time", 0.0 }
+ { nullptr, nullptr, TRUE, "radius", "Helix radius", nullptr, "r (nm)", 0.0 },
+ { nullptr, nullptr, TRUE, "twist", "Twist per residue", nullptr, "Angle (deg)", 0.0 },
+ { nullptr, nullptr, TRUE, "rise", "Rise per residue", nullptr, "Rise (nm)", 0.0 },
+ { nullptr, nullptr, FALSE, "len-ahx", "Length of the Helix", nullptr, "Length (nm)", 0.0 },
+ { nullptr, nullptr, FALSE, "dip-ahx", "Helix Backbone Dipole", nullptr, "rq (nm e)", 0.0 },
+ { nullptr, nullptr, TRUE, "rms-ahx", "RMS Deviation from Ideal Helix", nullptr, "RMS (nm)", 0.0 },
+ { nullptr, nullptr, FALSE, "rmsa-ahx", "Average RMSD per Residue", "Residue", "RMS (nm)", 0.0 },
+ { nullptr, nullptr, FALSE, "cd222", "Ellipticity at 222 nm", nullptr, "nm", 0.0 },
+ { nullptr, nullptr, TRUE, "pprms", "RMS Distance from \\8a\\4-helix", nullptr, "deg", 0.0 },
+ { nullptr, nullptr, TRUE, "caphi", "Average Ca-Ca Dihedral", nullptr, "\\8F\\4(deg)", 0.0 },
+ { nullptr, nullptr, TRUE, "phi", "Average \\8F\\4 angles", nullptr, "deg", 0.0 },
+ { nullptr, nullptr, TRUE, "psi", "Average \\8Y\\4 angles", nullptr, "deg", 0.0 },
+ { nullptr, nullptr, TRUE, "hb3", "Average n-n+3 hbond length", nullptr, "nm", 0.0 },
+ { nullptr, nullptr, TRUE, "hb4", "Average n-n+4 hbond length", nullptr, "nm", 0.0 },
+ { nullptr, nullptr, TRUE, "hb5", "Average n-n+5 hbond length", nullptr, "nm", 0.0 },
+ { nullptr, nullptr, FALSE, "JCaHa", "J-Coupling Values", "Residue", "Hz", 0.0 },
+ { nullptr, nullptr, FALSE, "helicity", "Helicity per Residue", "Residue", "% of time", 0.0 }
};
gmx_output_env_t *oenv;
real t;
real rms;
matrix box;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
gmx_bool bRange;
t_filenm fnm[] = {
- { efTPR, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffREAD },
- { efTRX, "-f", NULL, ffREAD },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
{ efSTO, "-cz", "zconf", ffWRITE },
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
/* Read reference frame from tpx file to compute helix length */
snew(xref, top->atoms.nr);
read_tpx(ftp2fn(efTPR, NFILE, fnm),
- NULL, NULL, &natoms, xref, NULL, NULL);
+ nullptr, nullptr, &natoms, xref, nullptr, nullptr);
calc_hxprops(nres, bb, xref);
do_start_end(nres, bb, &nbb, bbindex, &nca, caindex, bRange, rStart, rEnd);
sfree(xref);
if (teller == 1)
{
write_sto_conf(opt2fn("-cz", NFILE, fnm), "Helix fitted to Z-Axis",
- &(top->atoms), x, NULL, ePBC, box);
+ &(top->atoms), x, nullptr, ePBC, box);
}
xf[efhRAD].val = radius(xf[efhRAD].fp2, nca, caindex, x);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
"purposes, we also write out the actual Euler rotation angles as [TT]theta[1-3].xvg[tt]"
};
- t_topology *top = NULL;
+ t_topology *top = nullptr;
real t;
- rvec *x = NULL;
+ rvec *x = nullptr;
matrix box;
t_trxstatus *status;
int natoms;
int ePBC;
gmx_output_env_t *oenv;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
static gmx_bool bSC = FALSE;
static gmx_bool bIncremental = FALSE;
#define NPA asize(pa)
t_filenm fnm[] = {
- { efTPR, NULL, NULL, ffREAD },
- { efTRX, "-f", NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efDAT, "-oaxis", "helixaxis", ffWRITE },
{ efDAT, "-ocenter", "center", ffWRITE },
{ efXVG, "-orise", "rise", ffWRITE },
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME,
- NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,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.
real sgang1, real sgang2, real ****intfpos,
gmx_output_env_t *oenv)
{
- FILE *fpsg = NULL, *fpsk = NULL;
+ FILE *fpsg = nullptr, *fpsk = nullptr;
t_topology top;
int ePBC;
t_trxstatus *status;
rvec *xtop, *x;
matrix box;
real sg, sk, sgintf;
- int **index = NULL;
- char **grpname = NULL;
+ int **index = nullptr;
+ char **grpname = nullptr;
int i, j, k, n, *isize, ng, nslicez, framenr;
- real ***sg_grid = NULL, ***sk_grid = NULL, ***sg_fravg = NULL, ***sk_fravg = NULL, ****sk_4d = NULL, ****sg_4d = NULL;
+ real ***sg_grid = nullptr, ***sk_grid = nullptr, ***sg_fravg = nullptr, ***sk_fravg = nullptr, ****sk_4d = nullptr, ****sg_4d = nullptr;
int *perm;
int ndx1, ndx2;
int bins;
* i.e 1D Row-major order in (t,x,y) */
- read_tps_conf(fnTPS, &top, &ePBC, &xtop, NULL, box, FALSE);
+ read_tps_conf(fnTPS, &top, &ePBC, &xtop, nullptr, box, FALSE);
*nslicex = static_cast<int>(box[XX][XX]/binw + onehalf); /*Calculate slicenr from binwidth*/
*nslicey = static_cast<int>(box[YY][YY]/binw + onehalf);
gmx_fatal(FARGS, "Topology (%d atoms) does not match trajectory (%d atoms)",
top.atoms.nr, natoms);
}
- check_index(NULL, ng, index[0], NULL, natoms);
+ check_index(nullptr, ng, index[0], nullptr, natoms);
/*Prepare structures for temporary storage of frame info*/
}
}
- sg_4d = NULL;
- sk_4d = NULL;
+ sg_4d = nullptr;
+ sk_4d = nullptr;
*nframes = 0;
framenr = 0;
find_tetra_order_grid(top, ePBC, natoms, box, x, isize[0], index[0],
&sg, &sk, *nslicex, *nslicey, nslicez, sg_grid, sk_grid);
- GMX_RELEASE_ASSERT(sk_fravg != NULL, "Trying to dereference NULL sk_fravg pointer");
+ GMX_RELEASE_ASSERT(sk_fravg != nullptr, "Trying to dereference NULL sk_fravg pointer");
for (i = 0; i < *nslicex; i++)
{
for (j = 0; j < *nslicey; j++)
if (framenr%tblock == 0)
{
- GMX_RELEASE_ASSERT(sk_4d != NULL, "Trying to dereference NULL sk_4d pointer");
+ GMX_RELEASE_ASSERT(sk_4d != nullptr, "Trying to dereference NULL sk_4d pointer");
sk_4d[*nframes] = sk_fravg;
sg_4d[*nframes] = sg_fravg;
(*nframes)++;
static gmx_bool bRawOut = FALSE;
int frames, xslices, yslices; /* Dimensions of interface arrays*/
real ***intfpos; /* Interface arrays (intfnr,t,xy) -potentially large */
- static const char *normal_axis[] = { NULL, "z", "x", "y", NULL };
+ static const char *normal_axis[] = { nullptr, "z", "x", "y", nullptr };
t_pargs pa[] = {
{ "-d", FALSE, etENUM, {normal_axis},
};
t_filenm fnm[] = { /* files for g_order */
- { efTRX, "-f", NULL, ffREAD }, /* trajectory file */
- { efNDX, "-n", NULL, ffREAD }, /* index file */
- { efTPR, "-s", NULL, ffREAD }, /* topology file */
+ { efTRX, "-f", nullptr, ffREAD }, /* trajectory file */
+ { efNDX, "-n", nullptr, ffREAD }, /* index file */
+ { efTPR, "-s", nullptr, ffREAD }, /* topology file */
{ efXPM, "-o", "intf", ffWRMULT}, /* XPM- surface maps */
{ efOUT, "-or", "raw", ffOPTWRMULT }, /* xvgr output file */
{ efOUT, "-Spect", "intfspect", ffOPTWRMULT}, /* Fourier spectrum interfaces */
gmx_output_env_t *oenv;
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
trxfnm = ftp2fn(efTRX, NFILE, fnm);
/* Calculate axis */
- GMX_RELEASE_ASSERT(normal_axis[0] != NULL, "Option setting inconsistency; normal_axis[0] is NULL");
+ GMX_RELEASE_ASSERT(normal_axis[0] != nullptr, "Option setting inconsistency; normal_axis[0] is NULL");
if (std::strcmp(normal_axis[0], "x") == 0)
{
axis = XX;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
snew(ld, 1);
for (; (i < nre); i++)
{
- if ((std::strstr(names[i].name, ligand) != NULL) &&
- (std::strstr(names[i].name, self) == NULL))
+ if ((std::strstr(names[i].name, ligand) != nullptr) &&
+ (std::strstr(names[i].name, self) == nullptr))
{
- if (std::strstr(names[i].name, "LJ") != NULL)
+ if (std::strstr(names[i].name, "LJ") != nullptr)
{
ld->nlj++;
srenew(ld->lj, ld->nlj);
ld->lj[ld->nlj-1] = i;
}
- else if (std::strstr(names[i].name, "Coul") != NULL)
+ else if (std::strstr(names[i].name, "Coul") != nullptr)
{
ld->nqq++;
srenew(ld->qq, ld->nqq);
int nre, nframes = 0, ct = 0;
ener_file_t fp;
t_liedata *ld;
- gmx_enxnm_t *enm = NULL;
+ gmx_enxnm_t *enm = nullptr;
t_enxframe *fr;
real lie;
double lieaver = 0, lieav2 = 0;
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
- NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int number = 0;
int end_number = 0;
- char *start = NULL; /*holds the string of the number behind a ','*/
- char *end = NULL; /*holds the string of the number behind a '-' */
+ char *start = nullptr; /*holds the string of the number behind a ','*/
+ char *end = nullptr; /*holds the string of the number behind a '-' */
- int nvecs = 0; /* counts the number of vectors in the list*/
+ int nvecs = 0; /* counts the number of vectors in the list*/
- step = NULL;
+ step = nullptr;
snew(pos, n+4);
startpos = pos;
std::strcpy(pos, str);
pos[n+1] = '1';
pos[n+2] = '\0';
- *list = NULL;
+ *list = nullptr;
while ((c = *pos) != 0)
{
{
/*store number*/
srenew(*list, nvecs+1);
- (*list)[nvecs++] = number = std::strtol(start, NULL, 10);
+ (*list)[nvecs++] = number = std::strtol(start, nullptr, 10);
status = sBefore;
if (number == 0)
{
if (c == ',')
{
/*store numbers*/
- end_number = std::strtol(end, NULL, 10);
- number = std::strtol(start, NULL, 10);
+ end_number = std::strtol(end, nullptr, 10);
+ number = std::strtol(start, nullptr, 10);
status = sBefore;
if (number == 0)
{
srenew(*list, nvecs+end_number-number+1);
if (step)
{
- istep = strtol(step, NULL, 10);
- step = NULL;
+ istep = strtol(step, nullptr, 10);
+ step = nullptr;
}
else
{
/*Eigenvectors */
- write_eigvec(fp, edpars->ned, eig_listen[evMON], eigvecs, nvec, "COMPONENTS GROUP 1", NULL);
+ write_eigvec(fp, edpars->ned, eig_listen[evMON], eigvecs, nvec, "COMPONENTS GROUP 1", nullptr);
write_eigvec(fp, edpars->ned, eig_listen[evLINFIX], eigvecs, nvec, "COMPONENTS GROUP 2", evStepList[evLINFIX]);
write_eigvec(fp, edpars->ned, eig_listen[evLINACC], eigvecs, nvec, "COMPONENTS GROUP 3", evStepList[evLINACC]);
write_eigvec(fp, edpars->ned, eig_listen[evRADFIX], eigvecs, nvec, "COMPONENTS GROUP 4", evStepList[evRADFIX]);
- write_eigvec(fp, edpars->ned, eig_listen[evRADACC], eigvecs, nvec, "COMPONENTS GROUP 5", NULL);
- write_eigvec(fp, edpars->ned, eig_listen[evRADCON], eigvecs, nvec, "COMPONENTS GROUP 6", NULL);
+ write_eigvec(fp, edpars->ned, eig_listen[evRADACC], eigvecs, nvec, "COMPONENTS GROUP 5", nullptr);
+ write_eigvec(fp, edpars->ned, eig_listen[evRADCON], eigvecs, nvec, "COMPONENTS GROUP 6", nullptr);
write_eigvec(fp, edpars->ned, eig_listen[evFLOOD], eigvecs, nvec, "COMPONENTS GROUP 7", evStepList[evFLOOD]);
t_topology top;
matrix box;
printf("read coordnumber from file %s\n", confin);
- read_tps_conf(confin, &top, NULL, x, NULL, box, FALSE);
+ read_tps_conf(confin, &top, nullptr, x, nullptr, box, FALSE);
printf("number of coordinates in file %d\n", top.atoms.nr);
return top.atoms.nr;
}
enum {
evStepNr = evRADFIX + 1
};
- static const char* evSelections[evNr] = {NULL, NULL, NULL, NULL, NULL, NULL};
+ static const char* evSelections[evNr] = {nullptr, nullptr, nullptr, nullptr, nullptr, nullptr};
static const char* evOptions[evNr] = {"-linfix", "-linacc", "-flood", "-radfix", "-radacc", "-radcon", "-mon"};
- static const char* evParams[evStepNr] = {NULL, NULL};
+ static const char* evParams[evStepNr] = {nullptr, nullptr};
static const char* evStepOptions[evStepNr] = {"-linstep", "-accdir", "-not_used", "-radstep"};
static const char* ConstForceStr;
static real * evStepList[evStepNr];
#define NPA asize(pa)
rvec *xref1;
- int nvec1, *eignr1 = NULL;
- rvec *xav1, **eigvec1 = NULL;
- t_atoms *atoms = NULL;
+ int nvec1, *eignr1 = nullptr;
+ rvec *xav1, **eigvec1 = nullptr;
+ t_atoms *atoms = nullptr;
int nav; /* Number of atoms in the average structure */
char *grpname;
const char *indexfile;
int i;
int *index, *ifit;
- int nfit; /* Number of atoms in the reference/fit structure */
- int ev_class; /* parameter _class i.e. evMON, evRADFIX etc. */
+ int nfit; /* Number of atoms in the reference/fit structure */
+ int ev_class; /* parameter _class i.e. evMON, evRADFIX etc. */
int nvecs;
- real *eigval1 = NULL; /* in V3.3 this is parameter of read_eigenvectors */
+ real *eigval1 = nullptr; /* in V3.3 this is parameter of read_eigenvectors */
const char *EdiFile;
const char *TargetFile;
t_filenm fnm[] = {
{ efTRN, "-f", "eigenvec", ffREAD },
{ efXVG, "-eig", "eigenval", ffOPTRD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efSTX, "-tar", "target", ffOPTRD},
{ efSTX, "-ori", "origin", ffOPTRD},
{ efEDI, "-o", "sam", ffWRITE }
#define NFILE asize(fnm)
edi_params.outfrq = 100; edi_params.slope = 0.0; edi_params.maxedsteps = 0;
if (!parse_common_args(&argc, argv, 0,
- NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
}
else /* if there are no eigenvectors for this option set list to zero */
{
- listen[ev_class] = NULL;
+ listen[ev_class] = nullptr;
snew(listen[ev_class], 1);
listen[ev_class][0] = 0;
}
&xref1, &edi_params.fitmas, &xav1, &edi_params.pcamas, &nvec1, &eignr1, &eigvec1, &eigval1);
read_tps_conf(ftp2fn(efTPS, NFILE, fnm),
- &top, &ePBC, &xtop, NULL, topbox, 0);
+ &top, &ePBC, &xtop, nullptr, topbox, 0);
atoms = &top.atoms;
printf("\n");
- if (xref1 == NULL)
+ if (xref1 == nullptr)
{
if (bFit1)
{
}
else
{
- make_t_edx(&edi_params.star, 0, NULL, index);
+ make_t_edx(&edi_params.star, 0, nullptr, index);
}
/* Store origin positions */
}
else
{
- make_t_edx(&edi_params.sori, 0, NULL, index);
+ make_t_edx(&edi_params.sori, 0, nullptr, index);
}
/* Write edi-file */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
*/
const char *spec = " !&|";
- return (c != '\0' && std::strchr(spec, c) == NULL);
+ return (c != '\0' && std::strchr(spec, c) == nullptr);
}
static int parse_names(char **string, int *n_names, char **names)
(*string)++;
s = gmx_strdup((*string));
sp = std::strchr(s, c);
- if (sp != NULL)
+ if (sp != nullptr)
{
(*string) += sp-s + 1;
sp[0] = '\0';
{
char buf[STRLEN];
int j, nchain;
- int i, a, natoms, *start = NULL, *end = NULL, ca_start, ca_end;
+ int i, a, natoms, *start = nullptr, *end = nullptr, ca_start, ca_end;
rvec vec;
natoms = atoms->nr;
static gmx_bool check_have_atoms(const t_atoms *atoms, char *string)
{
- if (atoms == NULL)
+ if (atoms == nullptr)
{
printf("Can not process '%s' without atom info, use option -f\n", string);
return FALSE;
}
}
- string = NULL;
+ string = nullptr;
snew(index, natoms);
snew(index1, natoms);
}
printf("\n");
printf("> ");
- if (NULL == fgets(inp_string, STRLEN, stdin))
+ if (nullptr == fgets(inp_string, STRLEN, stdin))
{
gmx_fatal(FARGS, "Error reading user input");
}
t_blocka *block, *block2;
char **gnames, **gnames2;
t_filenm fnm[] = {
- { efSTX, "-f", NULL, ffOPTRD },
- { efNDX, "-n", NULL, ffOPTRDMULT },
- { efNDX, "-o", NULL, ffWRITE }
+ { efSTX, "-f", nullptr, ffOPTRD },
+ { efNDX, "-n", nullptr, ffOPTRDMULT },
+ { efNDX, "-o", nullptr, ffWRITE }
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, 0, NFILE, fnm, NPA, pa, asize(desc), desc,
- 0, NULL, &oenv))
+ 0, nullptr, &oenv))
{
return 0;
}
fprintf(stderr, "\nReading structure file\n");
read_tps_conf(stxfile, top, &ePBC, &x, &v, box, FALSE);
atoms = &top->atoms;
- if (atoms->pdbinfo == NULL)
+ if (atoms->pdbinfo == nullptr)
{
snew(atoms->pdbinfo, atoms->nr);
}
}
else
{
- atoms = NULL;
- x = NULL;
+ atoms = nullptr;
+ x = nullptr;
}
/* read input file(s) */
block = new_blocka();
- gnames = NULL;
+ gnames = nullptr;
printf("Going to read %d old index file(s)\n", nndxin);
if (nndxin)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
if (atoms->nr <= 0)
{
- return NULL;
+ return nullptr;
}
snew(rndx, atoms->nr);
r0 = atoms->atom[0].resind;
if (atoms->nr <= 0)
{
- return NULL;
+ return nullptr;
}
snew(natm, atoms->nres);
r0 = atoms->atom[0].resind;
"Discretize distance in this number of levels" }
};
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXPM, "-mean", "dm", ffWRITE },
{ efXPM, "-frames", "dmf", ffOPTWR },
{ efXVG, "-no", "num", ffOPTWR },
};
#define NFILE asize(fnm)
- FILE *out = NULL, *fp;
+ FILE *out = nullptr, *fp;
t_topology top;
int ePBC;
t_atoms useatoms;
int *tot_n;
matrix box = {{0}};
gmx_output_env_t *oenv;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
if (!parse_common_args(&argc, argv, PCA_CAN_TIME, NFILE, fnm,
- asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
fprintf(stderr, "Will calculate number of different contacts\n");
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, FALSE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, FALSE);
fprintf(stderr, "Select group for analysis\n");
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, &grpname);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int natoms, ind_min[2] = {0, 0}, ind_mini = 0, ind_minj = 0;
real rmin, rmax, rmint, tmint;
gmx_bool bFirst;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
natoms = read_first_x(oenv, &status, trxfn, &t, &x, box);
- check_index(NULL, n, index, NULL, natoms);
+ check_index(nullptr, n, index, nullptr, natoms);
out = xvgropen(outfn, "Minimum distance to periodic image",
output_env_get_time_label(oenv), "Distance (nm)", oenv);
rmint = box[XX][XX];
tmint = 0;
- if (NULL != top)
+ if (nullptr != top)
{
gpbc = gmx_rmpbc_init(&top->idef, ePBC, natoms);
}
bFirst = TRUE;
do
{
- if (NULL != top)
+ if (nullptr != top)
{
gmx_rmpbc(gpbc, natoms, box, x);
}
}
while (read_next_x(oenv, status, &t, x, box));
- if (NULL != top)
+ if (nullptr != top)
{
gmx_rmpbc_done(gpbc);
}
for (j = 0; (j < j1); j++)
{
jx = index3[j];
- if (index2 == NULL)
+ if (index2 == nullptr)
{
i0 = j + 1;
}
t_trxstatus *trxout;
char buf[256];
char **leg;
- real t, dmin, dmax, **mindres = NULL, **maxdres = NULL;
+ real t, dmin, dmax, **mindres = nullptr, **maxdres = nullptr;
int nmin, nmax;
t_trxstatus *status;
int i = -1, j, k;
rvec *x0;
matrix box;
gmx_bool bFirst;
- FILE *respertime = NULL;
+ FILE *respertime = nullptr;
if (read_first_x(oenv, &status, fn, &t, &x0, box) == 0)
{
sprintf(buf, "%simum Distance", bMin ? "Min" : "Max");
dist = xvgropen(dfile, buf, output_env_get_time_label(oenv), "Distance (nm)", oenv);
sprintf(buf, "Number of Contacts %s %g nm", bMin ? "<" : ">", rcut);
- num = nfile ? xvgropen(nfile, buf, output_env_get_time_label(oenv), "Number", oenv) : NULL;
- atm = afile ? gmx_ffopen(afile, "w") : NULL;
- trxout = xfile ? open_trx(xfile, "w") : NULL;
+ num = nfile ? xvgropen(nfile, buf, output_env_get_time_label(oenv), "Number", oenv) : nullptr;
+ atm = afile ? gmx_ffopen(afile, "w") : nullptr;
+ trxout = xfile ? open_trx(xfile, "w") : nullptr;
if (bMat)
{
{
oindex[0] = bMin ? min1 : max1;
oindex[1] = bMin ? min2 : max2;
- write_trx(trxout, 2, oindex, atoms, i, t, box, x0, NULL, NULL);
+ write_trx(trxout, 2, oindex, atoms, i, t, box, x0, nullptr, nullptr);
}
bFirst = FALSE;
/*dmin should be minimum distance for residue and group*/
"Write residue names" }
};
gmx_output_env_t *oenv;
- t_topology *top = NULL;
+ t_topology *top = nullptr;
int ePBC = -1;
rvec *x;
matrix box;
const char *trxfnm, *tpsfnm, *ndxfnm, *distfnm, *numfnm, *atmfnm, *oxfnm, *resfnm;
char **grpname;
int *gnx;
- int **index, *residues = NULL;
+ int **index, *residues = nullptr;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffOPTRD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXVG, "-od", "mindist", ffWRITE },
{ efXVG, "-on", "numcont", ffOPTWR },
{ efOUT, "-o", "atm-pair", ffOPTWR },
if (!parse_common_args(&argc, argv,
PCA_CAN_VIEW | PCA_CAN_TIME | PCA_TIME_UNIT,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
atmfnm = ftp2fn_null(efOUT, NFILE, fnm);
oxfnm = opt2fn_null("-ox", NFILE, fnm);
resfnm = opt2fn_null("-or", NFILE, fnm);
- if (bPI || resfnm != NULL)
+ if (bPI || resfnm != nullptr)
{
/* We need a tps file */
tpsfnm = ftp2fn(efTPS, NFILE, fnm);
if (tpsfnm || resfnm || !ndxfnm)
{
snew(top, 1);
- bTop = read_tps_conf(tpsfnm, top, &ePBC, &x, NULL, box, FALSE);
+ bTop = read_tps_conf(tpsfnm, top, &ePBC, &x, nullptr, box, FALSE);
if (bPI && !bTop)
{
printf("\nWARNING: Without a run input file a trajectory with broken molecules will not give the correct periodic image distance\n\n");
}
}
- get_index(top ? &(top->atoms) : NULL, ndxfnm, ng, gnx, index, grpname);
+ get_index(top ? &(top->atoms) : nullptr, ndxfnm, ng, gnx, index, grpname);
if (bMat && (ng == 1))
{
if (resfnm)
{
- GMX_RELEASE_ASSERT(top != NULL, "top pointer cannot be NULL when finding residues");
+ GMX_RELEASE_ASSERT(top != nullptr, "top pointer cannot be NULL when finding residues");
nres = find_residues(&(top->atoms), gnx[0], index[0], &residues);
if (debug)
else
{
dist_plot(trxfnm, atmfnm, distfnm, numfnm, resfnm, oxfnm,
- rcutoff, bMat, top ? &(top->atoms) : NULL,
+ rcutoff, bMat, top ? &(top->atoms) : nullptr,
ng, index, gnx, grpname, bSplit, !bMax, nres, residues, bPBC, ePBC,
bGroup, bEachResEachTime, bPrintResName, oenv);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
static int *select_ftype(const char *opt, int *nft, int *mult)
{
- int *ft = NULL, ftype;
+ int *ft = nullptr, ftype;
if (opt[0] == 'a')
{
"angle distributions etc. It uses a run input file ([REF].tpx[ref]) for the",
"definitions of the angles, dihedrals etc."
};
- static const char *opt[] = { NULL, "angle", "dihedral", "improper", "ryckaert-bellemans", NULL };
+ static const char *opt[] = { nullptr, "angle", "dihedral", "improper", "ryckaert-bellemans", nullptr };
static gmx_bool bH = TRUE;
static real hq = -1;
t_pargs pa[] = {
int *nr;
char **grpnames;
t_filenm fnm[] = {
- { efTPR, NULL, NULL, ffREAD },
- { efNDX, NULL, "angle", ffWRITE }
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, "angle", ffWRITE }
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa,
- asize(desc), desc, 0, NULL, &oenv))
+ asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
- GMX_RELEASE_ASSERT(opt[0] != 0, "Options inconsistency; opt[0] is NULL");
+ GMX_RELEASE_ASSERT(opt[0] != nullptr, "Options inconsistency; opt[0] is NULL");
ft = select_ftype(opt[0], &nft, &mult);
- top = read_top(ftp2fn(efTPR, NFILE, fnm), NULL);
+ top = read_top(ftp2fn(efTPR, NFILE, fnm), nullptr);
ntype = calc_ntype(nft, ft, &(top->idef));
snew(grpnames, ntype);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
"Do a least squares fit of the second to the first structure before interpolating" }
};
const char *leg[] = { "Ref = 1\\Sst\\N conf", "Ref = 2\\Snd\\N conf" };
- FILE *fp = NULL;
+ FILE *fp = nullptr;
int i, isize, is_lsq, nat1, nat2;
t_trxstatus *status;
int *index, *index_lsq, *index_all, *dummy;
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW,
NFILE, fnm, asize(pa), pa, asize(desc), desc,
- 0, NULL, &oenv))
+ 0, nullptr, &oenv))
{
return 0;
}
t_topology *top;
snew(top, 1);
- read_tps_conf(opt2fn("-f1", NFILE, fnm), top, NULL, &x1, NULL, box, FALSE);
+ read_tps_conf(opt2fn("-f1", NFILE, fnm), top, nullptr, &x1, nullptr, box, FALSE);
nat1 = top->atoms.nr;
- read_tps_conf(opt2fn("-f2", NFILE, fnm), top, NULL, &x2, NULL, box, FALSE);
+ read_tps_conf(opt2fn("-f2", NFILE, fnm), top, nullptr, &x2, nullptr, box, FALSE);
nat2 = top->atoms.nr;
if (nat1 != nat2)
{
for (i = 0; (i < ninterm); i++)
{
fac = dointerp(nat1, x1, x2, xx, i, ninterm, first, last);
- write_trx(status, nat1, dummy, &atoms, i, fac, box, xx, NULL, NULL);
+ write_trx(status, nat1, dummy, &atoms, i, fac, box, xx, nullptr, nullptr);
if (bRMS)
{
rms1 = rmsdev_ind(isize, index, mass, x1, xx);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
curr->delta_t = dt;
curr->beginfit = (1 - 2*GMX_REAL_EPS)*beginfit;
curr->endfit = (1 + 2*GMX_REAL_EPS)*endfit;
- curr->x0 = NULL;
- curr->n_offs = NULL;
+ curr->x0 = nullptr;
+ curr->n_offs = nullptr;
curr->nframes = 0;
curr->nlast = 0;
curr->dim_factor = dim_factor;
}
for (i = 0; (i < nrgrp); i++)
{
- curr->ndata[i] = NULL;
- curr->data[i] = NULL;
+ curr->ndata[i] = nullptr;
+ curr->data[i] = nullptr;
if (bTen)
{
- curr->datam[i] = NULL;
+ curr->datam[i] = nullptr;
}
}
- curr->time = NULL;
- curr->lsq = NULL;
+ curr->time = nullptr;
+ curr->lsq = nullptr;
curr->nmol = nmol;
if (curr->nmol > 0)
{
gmx_stats_t lsq1;
int i, j;
real a, b, D, Dav, D2av, VarD, sqrtD, sqrtD_max, scale;
- t_pdbinfo *pdbinfo = NULL;
- const int *mol2a = NULL;
+ t_pdbinfo *pdbinfo = nullptr;
+ const int *mol2a = nullptr;
out = xvgropen(fn, "Diffusion Coefficients / Molecule", "Molecule", "D", oenv);
gmx_stats_add_point(lsq1, xx, yy, dx, dy);
}
}
- gmx_stats_get_ab(lsq1, elsqWEIGHT_NONE, &a, &b, NULL, NULL, NULL, NULL);
+ gmx_stats_get_ab(lsq1, elsqWEIGHT_NONE, &a, &b, nullptr, nullptr, nullptr, nullptr);
gmx_stats_free(lsq1);
D = a*FACTOR/curr->dim_factor;
if (D < 0)
{
scale *= 10;
}
- GMX_RELEASE_ASSERT(pdbinfo != NULL, "Internal error - pdbinfo not set for PDB input");
+ GMX_RELEASE_ASSERT(pdbinfo != nullptr, "Internal error - pdbinfo not set for PDB input");
for (i = 0; i < top->atoms.nr; i++)
{
pdbinfo[i].bfac *= scale;
}
- write_sto_conf(fn_pdb, "molecular MSD", &top->atoms, x, NULL, ePBC, box);
+ write_sto_conf(fn_pdb, "molecular MSD", &top->atoms, x, nullptr, ePBC, box);
}
}
#define prev (1-cur)
matrix box;
gmx_bool bFirst;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
natoms = read_first_x(oenv, &status, fn, &curr->t0, &(x[cur]), box);
#ifdef DEBUG
fprintf(stderr, "Read %d atoms for first frame\n", natoms);
#endif
- if ((gnx_com != NULL) && natoms < top->atoms.nr)
+ if ((gnx_com != nullptr) && natoms < top->atoms.nr)
{
fprintf(stderr, "WARNING: The trajectory only contains part of the system (%d of %d atoms) and therefore the COM motion of only this part of the system will be removed\n", natoms, top->atoms.nr);
}
t = curr->t0;
if (x_pdb)
{
- *x_pdb = NULL;
+ *x_pdb = nullptr;
}
if (bMol)
t_pdb > t - 0.5*(t - t_prev) &&
t_pdb < t + 0.5*(t - t_prev))))
{
- if (*x_pdb == NULL)
+ if (*x_pdb == nullptr)
{
snew(*x_pdb, natoms);
}
{
for (i = 0; (i < curr->ngrp); i++)
{
- curr->ndata[i] = NULL;
- curr->data[i] = NULL;
+ curr->ndata[i] = nullptr;
+ curr->data[i] = nullptr;
if (bTen)
{
- curr->datam[i] = NULL;
+ curr->datam[i] = nullptr;
}
}
- curr->time = NULL;
+ curr->time = nullptr;
}
maxframes += 10;
for (i = 0; (i < curr->ngrp); i++)
for (i = 0; (i < curr->ngrp); i++)
{
/* calculate something useful, like mean square displacements */
- calc_corr(curr, i, gnx[i], index[i], xa[cur], (gnx_com != NULL), com,
+ calc_corr(curr, i, gnx[i], index[i], xa[cur], (gnx_com != nullptr), com,
calc1, bTen);
}
cur = prev;
real *DD, *SigmaD, a, a2, b, r, chi2;
rvec *x;
matrix box;
- int *gnx_com = NULL; /* the COM removal group size */
- int **index_com = NULL; /* the COM removal group atom indices */
- char **grpname_com = NULL; /* the COM removal group name */
+ int *gnx_com = nullptr; /* the COM removal group size */
+ int **index_com = nullptr; /* the COM removal group atom indices */
+ char **grpname_com = nullptr; /* the COM removal group name */
snew(gnx, nrgrp);
snew(index, nrgrp);
}
msd = init_corr(nrgrp, type, axis, dim_factor,
- mol_file == NULL ? 0 : gnx[0], bTen, bMW, dt, top,
+ mol_file == nullptr ? 0 : gnx[0], bTen, bMW, dt, top,
beginfit, endfit);
nat_trx =
corr_loop(msd, trx_file, top, ePBC, mol_file ? gnx[0] : 0, gnx, index,
- (mol_file != NULL) ? calc1_mol : (bMW ? calc1_mw : calc1_norm),
+ (mol_file != nullptr) ? calc1_mol : (bMW ? calc1_mw : calc1_norm),
bTen, gnx_com, index_com, dt, t_pdb,
- pdb_file ? &x : NULL, box, oenv);
+ pdb_file ? &x : nullptr, box, oenv);
/* Correct for the number of points */
for (j = 0; (j < msd->ngrp); j++)
if (mol_file)
{
- if (pdb_file && x == NULL)
+ if (pdb_file && x == nullptr)
{
fprintf(stderr, "\nNo frame found need time tpdb = %g ps\n"
"Can not write %s\n\n", t_pdb, pdb_file);
}
i = top->atoms.nr;
top->atoms.nr = nat_trx;
- if (pdb_file && top->atoms.pdbinfo == NULL)
+ if (pdb_file && top->atoms.pdbinfo == nullptr)
{
snew(top->atoms.pdbinfo, top->atoms.nr);
}
top->atoms.nr = i;
}
- DD = NULL;
- SigmaD = NULL;
+ DD = nullptr;
+ SigmaD = nullptr;
if (beginfit == -1)
{
"the diffusion coefficient of the molecule.",
"This option implies option [TT]-mol[tt]."
};
- static const char *normtype[] = { NULL, "no", "x", "y", "z", NULL };
- static const char *axtitle[] = { NULL, "no", "x", "y", "z", NULL };
+ static const char *normtype[] = { nullptr, "no", "x", "y", "z", nullptr };
+ static const char *axtitle[] = { nullptr, "no", "x", "y", "z", nullptr };
static int ngroup = 1;
static real dt = 10;
static real t_pdb = 0;
};
t_filenm fnm[] = {
- { efTRX, NULL, NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efXVG, NULL, "msd", ffWRITE },
+ { efTRX, nullptr, nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efXVG, nullptr, "msd", ffWRITE },
{ efXVG, "-mol", "diff_mol", ffOPTWR },
{ efPDB, "-pdb", "diff_mol", ffOPTWR }
};
if (!parse_common_args(&argc, argv,
PCA_CAN_VIEW | PCA_CAN_BEGIN | PCA_CAN_END | PCA_TIME_UNIT,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
fprintf(stderr, "Calculating diffusion coefficients for molecules.\n");
}
- GMX_RELEASE_ASSERT(normtype[0] != 0, "Options inconsistency; normtype[0]Â is NULL");
- GMX_RELEASE_ASSERT(axtitle[0] != 0, "Options inconsistency; axtitle[0]Â is NULL");
+ GMX_RELEASE_ASSERT(normtype[0] != nullptr, "Options inconsistency; normtype[0]Â is NULL");
+ GMX_RELEASE_ASSERT(axtitle[0] != nullptr, "Options inconsistency; axtitle[0]Â is NULL");
if (normtype[0][0] != 'n')
{
gmx_fatal(FARGS, "Can only calculate the full tensor for 3D msd");
}
- bTop = read_tps_conf(tps_file, &top, &ePBC, &xdum, NULL, box, bMW || bRmCOMM);
+ bTop = read_tps_conf(tps_file, &top, &ePBC, &xdum, nullptr, box, bMW || bRmCOMM);
if (mol_file && !bTop)
{
gmx_fatal(FARGS,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
eigensolver(hess, ndim, begin-1, end-1, eigenvalues, eigenvectors);
/* And scale the output eigenvectors */
- if (bM && eigenvectors != NULL)
+ if (bM && eigenvectors != nullptr)
{
for (int i = 0; i < (end-begin+1); i++)
{
/* Cannot check symmetry since we only store half matrix */
/* divide elements hess[i][j] by sqrt(mas[i])*sqrt(mas[j]) when required */
- GMX_RELEASE_ASSERT(sparse_hessian != NULL, "NULL matrix pointer provided to nma_sparse_hessian");
+ GMX_RELEASE_ASSERT(sparse_hessian != nullptr, "NULL matrix pointer provided to nma_sparse_hessian");
if (bM)
{
sparse_eigensolver(sparse_hessian, neig, eigenvalues, eigenvectors, 10000000);
/* Scale output eigenvectors */
- if (bM && eigenvectors != NULL)
+ if (bM && eigenvectors != nullptr)
{
for (i = 0; i < neig; i++)
{
real value, omega, nu;
real factor_gmx_to_omega2;
real factor_omega_to_wavenumber;
- real *spectrum = NULL;
+ real *spectrum = nullptr;
real wfac;
gmx_output_env_t *oenv;
const char *qcleg[] = {
"Heat Capacity cV (J/mol K)",
"Enthalpy H (kJ/mol)"
};
- real * full_hessian = NULL;
- gmx_sparsematrix_t * sparse_hessian = NULL;
+ real * full_hessian = nullptr;
+ gmx_sparsematrix_t * sparse_hessian = nullptr;
t_filenm fnm[] = {
{ efMTX, "-f", "hessian", ffREAD },
- { efTPR, NULL, NULL, ffREAD },
+ { efTPR, nullptr, nullptr, ffREAD },
{ efXVG, "-of", "eigenfreq", ffWRITE },
{ efXVG, "-ol", "eigenval", ffWRITE },
{ efXVG, "-os", "spectrum", ffOPTWR },
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, 0,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
snew(top_x, tpx.natoms);
int natoms_tpx;
- read_tpx(ftp2fn(efTPR, NFILE, fnm), NULL, box, &natoms_tpx,
- top_x, NULL, &mtop);
+ read_tpx(ftp2fn(efTPR, NFILE, fnm), nullptr, box, &natoms_tpx,
+ top_x, nullptr, &mtop);
int nharm = 0;
if (bCons)
{
* If this is not valid we convert to full matrix storage,
* but warn the user that we might run out of memory...
*/
- if ((sparse_hessian != NULL) && (end == ndim))
+ if ((sparse_hessian != nullptr) && (end == ndim))
{
fprintf(stderr, "Cannot use sparse Hessian to calculate all eigenvectors.\n");
}
}
gmx_sparsematrix_destroy(sparse_hessian);
- sparse_hessian = NULL;
+ sparse_hessian = nullptr;
fprintf(stderr, "Converted sparse to full matrix storage.\n");
}
snew(eigenvalues, nrow);
- if (full_hessian != NULL)
+ if (full_hessian != nullptr)
{
/* Using full matrix storage */
eigenvectors = allocateEigenvectors(nrow, begin, end, false);
}
else
{
- qc = NULL;
+ qc = nullptr;
}
printf("Writing eigenfrequencies - negative eigenvalues will be set to zero.\n");
}
}
/* Spectrum ? */
- spec = NULL;
+ spec = nullptr;
if (opt2bSet("-os", NFILE, fnm) && (maxspec > 0))
{
snew(spectrum, maxspec);
nu = 1e-12*omega/(2*M_PI);
value = omega*factor_omega_to_wavenumber;
fprintf (out, "%6d %15g\n", i, value);
- if (NULL != spec)
+ if (nullptr != spec)
{
wfac = eigenvalues[i-begin]/(width*std::sqrt(2*M_PI));
for (j = 0; (j < maxspec); j++)
spectrum[j] += wfac*std::exp(-gmx::square(j-value)/(2*gmx::square(width)));
}
}
- if (NULL != qc)
+ if (nullptr != qc)
{
qcv = cv_corr(nu, T);
qu = u_corr(nu, T);
}
}
xvgrclose(out);
- if (NULL != spec)
+ if (nullptr != spec)
{
for (j = 0; (j < maxspec); j++)
{
}
xvgrclose(spec);
}
- if (NULL != qc)
+ if (nullptr != qc)
{
printf("Quantum corrections for harmonic degrees of freedom\n");
printf("Use appropriate -first and -last options to get reliable results.\n");
* will not be strictly orthogonal in plain cartesian scalar products.
*/
const real *eigenvectorPtr;
- if (full_hessian != NULL)
+ if (full_hessian != nullptr)
{
eigenvectorPtr = eigenvectors;
}
eigenvectorPtr = eigenvectors + (begin - 1)*atom_index.size();
}
write_eigenvectors(opt2fn("-v", NFILE, fnm), atom_index.size(), eigenvectorPtr, FALSE, begin, end,
- eWXR_NO, NULL, FALSE, top_x, bM, eigenvalues);
+ eWXR_NO, nullptr, FALSE, top_x, bM, eigenvalues);
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
t_atoms *atoms;
rvec *xtop, *xref, *xav, *xout1, *xout2;
gmx_bool bDMR, bDMA, bFit;
- int nvec, *eignr = NULL;
- rvec **eigvec = NULL;
+ int nvec, *eignr = nullptr;
+ rvec **eigvec = nullptr;
matrix box;
real *eigval, *invsqrtm, t, disp;
int natoms;
t_filenm fnm[] = {
{ efTRN, "-v", "eigenvec", ffREAD },
{ efXVG, "-e", "eigenval", ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efTRO, "-o", "ensemble", ffWRITE }
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, 0,
- NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
read_eigenvectors(opt2fn("-v", NFILE, fnm), &natoms, &bFit,
&xref, &bDMR, &xav, &bDMA, &nvec, &eignr, &eigvec, &eigval);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, bDMA);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, bDMA);
atoms = &top.atoms;
printf("\nSelect an index group of %d elements that corresponds to the eigenvectors\n", natoms);
{
printf("Select eigenvectors for output, end your selection with 0\n");
nout = -1;
- iout = NULL;
+ iout = nullptr;
do
{
nout++;
copy_rvec(xout1[i], xout2[index[i]]);
}
t = s+1;
- write_trx(out, natoms, index, atoms, 0, t, box, xout2, NULL, NULL);
+ write_trx(out, natoms, index, atoms, 0, t, box, xout2, nullptr, nullptr);
fprintf(stderr, "\rGenerated %d structures", s+1);
fflush(stderr);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
int ePBC;
t_atoms *atoms;
rvec *xtop, *xref, *xav, *xout;
- int nvec, *eignr = NULL;
- rvec **eigvec = NULL;
+ int nvec, *eignr = nullptr;
+ rvec **eigvec = nullptr;
matrix box;
int natoms;
int i, j, k, kmode, d;
t_filenm fnm[] =
{
- { efTPS, NULL, NULL, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
{ efTRN, "-v", "eigenvec", ffREAD },
{ efTRO, "-o", "nmtraj", ffWRITE }
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, 0,
- NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
read_eigenvectors(opt2fn("-v", NFILE, fnm), &natoms, &bFit,
&xref, &bDMR, &xav, &bDMA, &nvec, &eignr, &eigvec, &eigval);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, bDMA);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, bDMA);
/* Find vectors and phases */
}
}
}
- write_trx(out, natoms, dummy, atoms, i, static_cast<real>(i)/nframes, box, xout, NULL, NULL);
+ write_trx(out, natoms, dummy, atoms, i, static_cast<real>(i)/nframes, box, xout, nullptr, nullptr);
}
fprintf(stderr, "\n");
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
const char *sgslfn, const char *skslfn,
const gmx_output_env_t *oenv)
{
- FILE *fpsg = NULL, *fpsk = NULL;
+ FILE *fpsg = nullptr, *fpsk = nullptr;
t_topology top;
int ePBC;
t_trxstatus *status;
char **grpname;
int i, *isize, ng, nframes;
real *sg_slice, *sg_slice_tot, *sk_slice, *sk_slice_tot;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
- read_tps_conf(fnTPS, &top, &ePBC, &xtop, NULL, box, FALSE);
+ read_tps_conf(fnTPS, &top, &ePBC, &xtop, nullptr, box, FALSE);
snew(sg_slice, nslice);
snew(sk_slice, nslice);
gmx_fatal(FARGS, "Topology (%d atoms) does not match trajectory (%d atoms)",
top.atoms.nr, natoms);
}
- check_index(NULL, ng, index[0], NULL, natoms);
+ check_index(nullptr, ng, index[0], nullptr, natoms);
fpsg = xvgropen(sgfn, "S\\sg\\N Angle Order Parameter", "Time (ps)", "S\\sg\\N",
oenv);
gmx_bool use_unitvector = FALSE; /* use a specified unit vector instead of axis to specify unit normal*/
rvec direction, com, dref, dvec;
int comsize, distsize;
- int *comidx = NULL, *distidx = NULL;
- char *grpname = NULL;
+ int *comidx = nullptr, *distidx = nullptr;
+ char *grpname = nullptr;
t_pbc pbc;
real arcdist, tmpdist;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
/* PBC added for center-of-mass vector*/
/* Initiate the pbc structure */
}
if (distcalc)
{
- if (grpname != NULL)
+ if (grpname != nullptr)
{
sfree(grpname);
}
sfree(x0); /* free memory used by coordinate arrays */
sfree(x1);
- if (comidx != NULL)
+ if (comidx != nullptr)
{
sfree(comidx);
}
- if (distidx != NULL)
+ if (distidx != nullptr)
{
sfree(distidx);
}
- if (grpname != NULL)
+ if (grpname != nullptr)
{
sfree(grpname);
}
frout.natoms = nout;
frout.bF = FALSE;
frout.bV = FALSE;
- frout.x = 0;
+ frout.x = nullptr;
snew(frout.x, nout);
init_t_atoms(&useatoms, nout, TRUE);
}
}
- write_sto_conf(opt2fn("-ob", nfile, fnm), "Order parameters", &useatoms, frout.x, NULL, frout.ePBC, frout.box);
+ write_sto_conf(opt2fn("-ob", nfile, fnm), "Order parameters", &useatoms, frout.x, nullptr, frout.ePBC, frout.box);
sfree(frout.x);
done_atom(&useatoms);
static int nslices = 1; /* nr of slices defined */
static gmx_bool bSzonly = FALSE; /* True if only Sz is wanted */
static gmx_bool bUnsat = FALSE; /* True if carbons are unsat. */
- static const char *normal_axis[] = { NULL, "z", "x", "y", NULL };
+ static const char *normal_axis[] = { nullptr, "z", "x", "y", nullptr };
static gmx_bool permolecule = FALSE; /*compute on a per-molecule basis */
static gmx_bool radial = FALSE; /*compute a radial membrane normal */
static gmx_bool distcalc = FALSE; /*calculate distance from a reference group */
*a; /* atom numbers in each group */
t_blocka *block; /* data from index file */
t_filenm fnm[] = { /* files for g_order */
- { efTRX, "-f", NULL, ffREAD }, /* trajectory file */
- { efNDX, "-n", NULL, ffREAD }, /* index file */
- { efNDX, "-nr", NULL, ffOPTRD }, /* index for radial axis calculation */
- { efTPR, NULL, NULL, ffREAD }, /* topology file */
+ { efTRX, "-f", nullptr, ffREAD }, /* trajectory file */
+ { efNDX, "-n", nullptr, ffREAD }, /* index file */
+ { efNDX, "-nr", nullptr, ffOPTRD }, /* index for radial axis calculation */
+ { efTPR, nullptr, nullptr, ffREAD }, /* topology file */
{ efXVG, "-o", "order", ffWRITE }, /* xvgr output file */
{ efXVG, "-od", "deuter", ffWRITE }, /* xvgr output file */
- { efPDB, "-ob", NULL, ffOPTWR }, /* write Scd as B factors to PDB if permolecule */
+ { efPDB, "-ob", nullptr, ffOPTWR }, /* write Scd as B factors to PDB if permolecule */
{ efXVG, "-os", "sliced", ffWRITE }, /* xvgr output file */
{ efXVG, "-Sg", "sg-ang", ffOPTWR }, /* xvgr output file */
{ efXVG, "-Sk", "sk-dist", ffOPTWR }, /* xvgr output file */
};
gmx_bool bSliced = FALSE; /* True if box is sliced */
#define NFILE asize(fnm)
- real **distvals = NULL;
+ real **distvals = nullptr;
const char *sgfnm, *skfnm, *ndxfnm, *tpsfnm, *trxfnm;
gmx_output_env_t *oenv;
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
trxfnm = ftp2fn(efTRX, NFILE, fnm);
/* Calculate axis */
- GMX_RELEASE_ASSERT(normal_axis[0] != NULL, "Options inconsistency; normal_axis[0] is NULL");
+ GMX_RELEASE_ASSERT(normal_axis[0] != nullptr, "Options inconsistency; normal_axis[0] is NULL");
if (std::strcmp(normal_axis[0], "x") == 0)
{
axis = XX;
opt2fn("-Sgsl", NFILE, fnm), opt2fn("-Sksl", NFILE, fnm),
oenv);
/* view xvgr files */
- do_view(oenv, opt2fn("-Sg", NFILE, fnm), NULL);
- do_view(oenv, opt2fn("-Sk", NFILE, fnm), NULL);
+ do_view(oenv, opt2fn("-Sg", NFILE, fnm), nullptr);
+ do_view(oenv, opt2fn("-Sk", NFILE, fnm), nullptr);
if (nslices > 1)
{
- do_view(oenv, opt2fn("-Sgsl", NFILE, fnm), NULL);
- do_view(oenv, opt2fn("-Sksl", NFILE, fnm), NULL);
+ do_view(oenv, opt2fn("-Sgsl", NFILE, fnm), nullptr);
+ do_view(oenv, opt2fn("-Sksl", NFILE, fnm), nullptr);
}
}
else
}
- do_view(oenv, opt2fn("-o", NFILE, fnm), NULL); /* view xvgr file */
- do_view(oenv, opt2fn("-os", NFILE, fnm), NULL); /* view xvgr file */
- do_view(oenv, opt2fn("-od", NFILE, fnm), NULL); /* view xvgr file */
+ do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr); /* view xvgr file */
+ do_view(oenv, opt2fn("-os", NFILE, fnm), nullptr); /* view xvgr file */
+ do_view(oenv, opt2fn("-od", NFILE, fnm), nullptr); /* view xvgr file */
}
- if (distvals != NULL)
+ if (distvals != nullptr)
{
for (i = 0; i < nslices; ++i)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
real tmp2 = 0;
gmx_bool bFraction;
- int *numbers = NULL;
+ int *numbers = nullptr;
/* Index variables for parallel work distribution */
int startglobal, stopglobal;
const gmx_mtop_t *mtop, FILE *fp_out, gmx_bool bVerbose, unsigned int seed,
t_commrec *cr)
{
- rvec *x = NULL; /* The coordinates */
- real *q = NULL; /* The charges */
- real edir = 0.0; /* real space error */
- real erec = 0.0; /* reciprocal space error */
- real derr = 0.0; /* difference of real and reciprocal space error */
- real derr0 = 0.0; /* difference of real and reciprocal space error */
- real beta = 0.0; /* splitting parameter beta */
- real beta0 = 0.0; /* splitting parameter beta */
- int ncharges; /* The number of atoms with charges */
- int nsamples; /* The number of samples used for the calculation of the
- * self-energy error term */
+ rvec *x = nullptr; /* The coordinates */
+ real *q = nullptr; /* The charges */
+ real edir = 0.0; /* real space error */
+ real erec = 0.0; /* reciprocal space error */
+ real derr = 0.0; /* difference of real and reciprocal space error */
+ real derr0 = 0.0; /* difference of real and reciprocal space error */
+ real beta = 0.0; /* splitting parameter beta */
+ real beta0 = 0.0; /* splitting parameter beta */
+ int ncharges; /* The number of atoms with charges */
+ int nsamples; /* The number of samples used for the calculation of the
+ * self-energy error term */
int i = 0;
if (MASTER(cr))
real user_beta = -1.0;
real fracself = 1.0;
t_inputinfo info;
- t_state state; /* The state from the tpr input file */
- gmx_mtop_t mtop; /* The topology from the tpr input file */
- t_inputrec *ir = NULL; /* The inputrec from the tpr file */
- FILE *fp = NULL;
+ t_state state; /* The state from the tpr input file */
+ gmx_mtop_t mtop; /* The topology from the tpr input file */
+ t_inputrec *ir = nullptr; /* The inputrec from the tpr file */
+ FILE *fp = nullptr;
t_commrec *cr;
unsigned long PCA_Flags;
gmx_bool bTUNE = FALSE;
static t_filenm fnm[] = {
- { efTPR, "-s", NULL, ffREAD },
+ { efTPR, "-s", nullptr, ffREAD },
{ efOUT, "-o", "error", ffWRITE },
{ efTPR, "-so", "tuned", ffOPTWR }
};
- gmx_output_env_t *oenv = NULL;
+ gmx_output_env_t *oenv = nullptr;
t_pargs pa[] = {
{ "-beta", FALSE, etREAL, {&user_beta},
if (!parse_common_args(&argc, argv, PCA_Flags,
NFILE, fnm, asize(pa), pa, asize(desc), desc,
- 0, NULL, &oenv))
+ 0, nullptr, &oenv))
{
sfree(cr);
return 0;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
};
t_filenm fnm[] = {
- { efTPR, NULL, NULL, ffREAD },
- { efTRX, "-f", NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXVG, "-o", "polystat", ffWRITE },
{ efXVG, "-v", "polyvec", ffOPTWR },
{ efXVG, "-p", "persist", ffOPTWR },
char *grpname;
t_trxstatus *status;
real t;
- rvec *x, *bond = NULL;
+ rvec *x, *bond = nullptr;
matrix box;
int natoms, i, j, frame, ind0, ind1, a, d, d2, ord[DIM] = {0};
dvec cm, sum_eig = {0, 0, 0};
double **gyr, **gyr_all, eig[DIM], **eigv;
double sum_eed2, sum_eed2_tot, sum_gyro, sum_gyro_tot, sum_pers_tot;
- int *ninp = NULL;
- double *sum_inp = NULL, pers;
+ int *ninp = nullptr;
+ double *sum_inp = nullptr, pers;
double *intd, ymax, ymin;
double mmol, m;
char title[STRLEN];
"<R\\sg\\N eig1>", "<R\\sg\\N eig2>", "<R\\sg\\N eig3>"
};
char **legp, buf[STRLEN];
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
if (!parse_common_args(&argc, argv,
PCA_CAN_VIEW | PCA_CAN_TIME | PCA_TIME_UNIT,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
snew(top, 1);
ePBC = read_tpx_top(ftp2fn(efTPR, NFILE, fnm),
- NULL, box, &natoms, NULL, NULL, top);
+ nullptr, box, &natoms, nullptr, nullptr, top);
fprintf(stderr, "Select a group of polymer mainchain atoms:\n");
get_index(&top->atoms, ftp2fn_null(efNDX, NFILE, fnm),
}
else
{
- outv = NULL;
+ outv = nullptr;
}
if (opt2bSet("-p", NFILE, fnm))
}
else
{
- outp = NULL;
+ outp = nullptr;
}
if (opt2bSet("-i", NFILE, fnm))
}
else
{
- intd = NULL;
- outi = NULL;
+ intd = nullptr;
+ outi = nullptr;
}
natoms = read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
real t;
double z;
rvec xcm;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
switch (axis)
{
int ePBC;
int **index; /* indices for all groups */
t_filenm fnm[] = { /* files for g_order */
- { efTRX, "-f", NULL, ffREAD }, /* trajectory file */
- { efNDX, NULL, NULL, ffREAD }, /* index file */
- { efTPR, NULL, NULL, ffREAD }, /* topology file */
+ { efTRX, "-f", nullptr, ffREAD }, /* trajectory file */
+ { efNDX, nullptr, nullptr, ffREAD }, /* index file */
+ { efTPR, nullptr, nullptr, ffREAD }, /* topology file */
{ efXVG, "-o", "potential", ffWRITE }, /* xvgr output file */
{ efXVG, "-oc", "charge", ffWRITE }, /* xvgr output file */
{ efXVG, "-of", "field", ffWRITE }, /* xvgr output file */
opt2fn("-oc", NFILE, fnm), opt2fn("-of", NFILE, fnm),
nslices, ngrps, (const char**)grpname, slWidth, oenv);
- do_view(oenv, opt2fn("-o", NFILE, fnm), NULL); /* view xvgr file */
- do_view(oenv, opt2fn("-oc", NFILE, fnm), NULL); /* view xvgr file */
- do_view(oenv, opt2fn("-of", NFILE, fnm), NULL); /* view xvgr file */
+ do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr); /* view xvgr file */
+ do_view(oenv, opt2fn("-oc", NFILE, fnm), nullptr); /* view xvgr file */
+ do_view(oenv, opt2fn("-of", NFILE, fnm), nullptr); /* view xvgr file */
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
FILE * fmoi;
matrix axes, box;
gmx_output_env_t *oenv;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
char ** legend;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXVG, "-a1", "paxis1", ffWRITE },
{ efXVG, "-a2", "paxis2", ffWRITE },
{ efXVG, "-a3", "paxis3", ffWRITE },
if (!parse_common_args(&argc, argv,
PCA_CAN_TIME | PCA_TIME_UNIT | PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
}
sfree(legend);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, NULL, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box, TRUE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
int j;
gmx_output_env_t *oenv;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPR, NULL, NULL, ffREAD },
- { efXVG, NULL, "rama", ffWRITE }
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efXVG, nullptr, "rama", ffWRITE }
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
- NFILE, fnm, 0, NULL, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, 0, nullptr, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
fprintf(stderr, "\n");
xvgrclose(out);
- do_view(oenv, ftp2fn(efXVG, NFILE, fnm), NULL);
+ do_view(oenv, ftp2fn(efXVG, NFILE, fnm), nullptr);
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* equalize principal components: */
/* orient principal axes, get principal components */
- orient_princ(atoms, isize, index, natoms, x, NULL, princ);
+ orient_princ(atoms, isize, index, natoms, x, nullptr, princ);
/* calc our own principal components */
clear_rvec(vec);
};
int ewhat;
const char *what[ewNR + 1] =
- { NULL, "rmsd", "rho", "rhosc", NULL };
+ { nullptr, "rmsd", "rho", "rhosc", nullptr };
const char *whatname[ewNR] =
- { NULL, "RMSD", "Rho", "Rho sc" };
+ { nullptr, "RMSD", "Rho", "Rho sc" };
const char *whatlabel[ewNR] =
- { NULL, "RMSD (nm)", "Rho", "Rho sc" };
+ { nullptr, "RMSD (nm)", "Rho", "Rho sc" };
const char *whatxvgname[ewNR] =
- { NULL, "RMSD", "\\8r\\4", "\\8r\\4\\ssc\\N" };
+ { nullptr, "RMSD", "\\8r\\4", "\\8r\\4\\ssc\\N" };
const char *whatxvglabel[ewNR] =
- { NULL, "RMSD (nm)", "\\8r\\4", "\\8r\\4\\ssc\\N" };
+ { nullptr, "RMSD (nm)", "\\8r\\4", "\\8r\\4\\ssc\\N" };
/* strings and things for fitting methods */
enum
{
};
int efit;
const char *fit[efNR + 1] =
- { NULL, "rot+trans", "translation", "none", NULL };
+ { nullptr, "rot+trans", "translation", "none", nullptr };
const char *fitgraphlabel[efNR + 1] =
- { NULL, "lsq fit", "translational fit", "no fit" };
+ { nullptr, "lsq fit", "translational fit", "no fit" };
static int nrms = 1;
static gmx_bool bMassWeighted = TRUE;
t_pargs pa[] =
int i, j, k, m, teller, teller2, tel_mat, tel_mat2;
#define NFRAME 5000
int maxframe = NFRAME, maxframe2 = NFRAME;
- real t, *w_rls, *w_rms, *w_rls_m = NULL, *w_rms_m = NULL;
+ real t, *w_rls, *w_rms, *w_rls_m = nullptr, *w_rms_m = nullptr;
gmx_bool bNorm, bAv, bFreq2, bFile2, bMat, bBond, bDelta, bMirror, bMass;
gmx_bool bFit, bReset;
t_topology top;
int ePBC;
- t_iatom *iatom = NULL;
+ t_iatom *iatom = nullptr;
matrix box = {{0}};
- rvec *x, *xp, *xm = NULL, **mat_x = NULL, **mat_x2, *mat_x2_j = NULL, vec1,
+ rvec *x, *xp, *xm = nullptr, **mat_x = nullptr, **mat_x2, *mat_x2_j = nullptr, vec1,
vec2;
t_trxstatus *status;
char buf[256], buf2[256];
int ncons = 0;
FILE *fp;
- real rlstot = 0, **rls, **rlsm = NULL, *time, *time2, *rlsnorm = NULL,
- **rmsd_mat = NULL, **bond_mat = NULL, *axis, *axis2, *del_xaxis,
+ real rlstot = 0, **rls, **rlsm = nullptr, *time, *time2, *rlsnorm = nullptr,
+ **rmsd_mat = nullptr, **bond_mat = nullptr, *axis, *axis2, *del_xaxis,
*del_yaxis, rmsd_max, rmsd_min, rmsd_avg, bond_max, bond_min, ang;
- real **rmsdav_mat = NULL, av_tot, weight, weight_tot;
- real **delta = NULL, delta_max, delta_scalex = 0, delta_scaley = 0,
+ real **rmsdav_mat = nullptr, av_tot, weight, weight_tot;
+ real **delta = nullptr, delta_max, delta_scalex = 0, delta_scaley = 0,
*delta_tot;
int delta_xsize = 0, del_lev = 100, mx, my, abs_my;
- gmx_bool bA1, bA2, bPrev, bTop, *bInMat = NULL;
- int ifit, *irms, ibond = 0, *ind_bond1 = NULL, *ind_bond2 = NULL, n_ind_m =
+ gmx_bool bA1, bA2, bPrev, bTop, *bInMat = nullptr;
+ int ifit, *irms, ibond = 0, *ind_bond1 = nullptr, *ind_bond2 = nullptr, n_ind_m =
0;
- int *ind_fit, **ind_rms, *ind_m = NULL, *rev_ind_m = NULL, *ind_rms_m =
- NULL;
+ int *ind_fit, **ind_rms, *ind_m = nullptr, *rev_ind_m = nullptr, *ind_rms_m =
+ nullptr;
char *gn_fit, **gn_rms;
t_rgb rlo, rhi;
gmx_output_env_t *oenv;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
t_filenm fnm[] =
{
- { efTPS, NULL, NULL, ffREAD },
- { efTRX, "-f", NULL, ffREAD },
- { efTRX, "-f2", NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efXVG, NULL, "rmsd", ffWRITE },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTRX, "-f2", nullptr, ffOPTRD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efXVG, nullptr, "rmsd", ffWRITE },
{ efXVG, "-mir", "rmsdmir", ffOPTWR },
{ efXVG, "-a", "avgrp", ffOPTWR },
{ efXVG, "-dist", "rmsd-dist", ffOPTWR },
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT | PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL,
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr,
&oenv))
{
return 0;
}
bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xp,
- NULL, box, TRUE);
+ nullptr, box, TRUE);
snew(w_rls, top.atoms.nr);
snew(w_rms, top.atoms.nr);
}
if (bReset)
{
- reset_x(ifit, ind_fit, top.atoms.nr, NULL, xp, w_rls);
+ reset_x(ifit, ind_fit, top.atoms.nr, nullptr, xp, w_rls);
}
if (bMirror)
{
if (bReset)
{
- reset_x(ifit, ind_fit, natoms, NULL, x, w_rls);
+ reset_x(ifit, ind_fit, natoms, nullptr, x, w_rls);
}
if (ewhat == ewRhoSc)
{
}
if (bReset)
{
- reset_x(ifit, ind_fit, natoms, NULL, xp, w_rls);
+ reset_x(ifit, ind_fit, natoms, nullptr, xp, w_rls);
}
if (bFit)
{
if (bReset)
{
- reset_x(ifit, ind_fit, natoms, NULL, x, w_rls);
+ reset_x(ifit, ind_fit, natoms, nullptr, x, w_rls);
}
if (ewhat == ewRhoSc)
{
xvgrclose(fp);
}
do_view(oenv, opt2fn_null("-a", NFILE, fnm), "-graphtype bar");
- do_view(oenv, opt2fn("-o", NFILE, fnm), NULL);
- do_view(oenv, opt2fn_null("-mir", NFILE, fnm), NULL);
- do_view(oenv, opt2fn_null("-m", NFILE, fnm), NULL);
- do_view(oenv, opt2fn_null("-bm", NFILE, fnm), NULL);
- do_view(oenv, opt2fn_null("-dist", NFILE, fnm), NULL);
+ do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr);
+ do_view(oenv, opt2fn_null("-mir", NFILE, fnm), nullptr);
+ do_view(oenv, opt2fn_null("-m", NFILE, fnm), nullptr);
+ do_view(oenv, opt2fn_null("-bm", NFILE, fnm), nullptr);
+ do_view(oenv, opt2fn_null("-dist", NFILE, fnm), nullptr);
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
fp = gmx_ffopen(eq_fn, "r");
neq = 0;
- equiv = NULL;
+ equiv = nullptr;
while (get_a_line(fp, line, STRLEN))
{
lp = line;
/* this is not efficient, but I'm lazy */
srenew(equiv, neq+1);
- equiv[neq] = NULL;
+ equiv[neq] = nullptr;
na = 0;
if (sscanf(lp, "%s %n", atomname, &n) == 1)
{
equiv[neq][na].aname = gmx_strdup(atomname);
if (na > 0)
{
- equiv[neq][na].nname = NULL;
+ equiv[neq][na].nname = nullptr;
}
na++;
lp += n;
srenew(equiv[neq], na+1);
equiv[neq][na].set = false;
equiv[neq][na].rnr = 0;
- equiv[neq][na].rname = NULL;
- equiv[neq][na].aname = NULL;
+ equiv[neq][na].rname = nullptr;
+ equiv[neq][na].aname = nullptr;
/* next */
neq++;
else
{
neq = 0;
- equiv = NULL;
+ equiv = nullptr;
}
groupnr = 0;
int *index, *noe_index;
char *grpname;
real **d_r, **d, **dtot, **dtot2, **mean, **rms, **rmsc, *resnr;
- real **dtot1_3 = NULL, **dtot1_6 = NULL;
+ real **dtot1_3 = nullptr, **dtot1_6 = nullptr;
real rmsnow, meanmax, rmsmax, rmscmax;
real max1_3, max1_6;
- t_noe_gr *noe_gr = NULL;
- t_noe **noe = NULL;
+ t_noe_gr *noe_gr = nullptr;
+ t_noe **noe = nullptr;
t_rgb rlo, rhi;
gmx_bool bRMS, bScale, bMean, bNOE, bNMR3, bNMR6, bNMR;
"Use periodic boundary conditions when computing distances" }
};
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efDAT, "-equiv", "equiv", ffOPTRD },
- { efXVG, NULL, "distrmsd", ffWRITE },
+ { efXVG, nullptr, "distrmsd", ffWRITE },
{ efXPM, "-rms", "rmsdist", ffOPTWR },
{ efXPM, "-scl", "rmsscale", ffOPTWR },
{ efXPM, "-mean", "rmsmean", ffOPTWR },
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
}
/* get topology and index */
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, FALSE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, FALSE);
if (!bPBC)
{
write_noe(opt2FILE("-noe", NFILE, fnm, "w"), gnr, noe, noe_gr, scalemax);
}
- do_view(oenv, ftp2fn(efXVG, NFILE, fnm), NULL);
+ do_view(oenv, ftp2fn(efXVG, NFILE, fnm), nullptr);
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
if ((ri->nr == atoms->resinfo[atoms->atom[i].resind].nr) &&
(ri->ic == atoms->resinfo[atoms->atom[i].resind].ic) &&
(std::strcmp(*atoms->resinfo[atoms->atom[i].resind].name, rresnm) == 0) &&
- (std::strstr(*atoms->atomname[i], atomnm) != NULL))
+ (std::strstr(*atoms->atomname[i], atomnm) != nullptr))
{
break;
}
}
for (i = 0; i < isize; i++)
{
- av += w_rls[index[i]]*(f != NULL ? f[i] : U[i][uind]);
+ av += w_rls[index[i]]*(f != nullptr ? f[i] : U[i][uind]);
m += w_rls[index[i]];
if (i+1 == isize ||
atoms->atom[index[i]].resind != atoms->atom[index[i+1]].resind)
{
av /= m;
- if (f != NULL)
+ if (f != nullptr)
{
for (j = start; j <= i; j++)
{
real bfac, pdb_bfac, *Uaver;
double **U, *xav;
int aid;
- rvec *rmsd_x = NULL;
+ rvec *rmsd_x = nullptr;
double *rmsf, invcount, totmass;
int d;
real count = 0;
rvec xcm;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
gmx_output_env_t *oenv;
const char *leg[2] = { "MD", "X-Ray" };
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efPDB, "-q", NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efPDB, "-q", nullptr, ffOPTRD },
{ efPDB, "-oq", "bfac", ffOPTWR },
{ efPDB, "-ox", "xaver", ffOPTWR },
{ efXVG, "-o", "rmsf", ffWRITE },
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, asize(pargs), pargs, asize(desc), desc, 0, NULL,
+ NFILE, fnm, asize(pargs), pargs, asize(desc), desc, 0, nullptr,
&oenv))
{
return 0;
devfn = opt2fn_null("-od", NFILE, fnm);
dirfn = opt2fn_null("-dir", NFILE, fnm);
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xref, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xref, nullptr, box, TRUE);
const char *title = *top.name;
snew(w_rls, top.atoms.nr);
t_topology *top_pdb;
snew(top_pdb, 1);
/* Read coordinates twice */
- read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, NULL, NULL, NULL, pdbbox, FALSE);
+ read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, nullptr, nullptr, nullptr, pdbbox, FALSE);
snew(pdbatoms, 1);
*pdbatoms = top_pdb->atoms;
- read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, NULL, &pdbx, NULL, pdbbox, FALSE);
+ read_tps_conf(opt2fn("-q", NFILE, fnm), top_pdb, nullptr, &pdbx, nullptr, pdbbox, FALSE);
title = *top_pdb->name;
snew(refatoms, 1);
*refatoms = top_pdb->atoms;
{
for (d = 0; d < DIM*DIM; d++)
{
- average_residues(NULL, U, d, isize, index, w_rls, &top.atoms);
+ average_residues(nullptr, U, d, isize, index, w_rls, &top.atoms);
}
}
}
if (bRes)
{
- average_residues(rmsf, NULL, 0, isize, index, w_rls, &top.atoms);
+ average_residues(rmsf, nullptr, 0, isize, index, w_rls, &top.atoms);
}
/* Write RMSD output */
fp = xvgropen(devfn, "RMS Deviation", label, "(nm)", oenv);
rvec_inc(xref[index[i]], xcm);
}
write_sto_conf_indexed(opt2fn("-oq", NFILE, fnm), title, pdbatoms, pdbx,
- NULL, ePBC, pdbbox, isize, index);
+ nullptr, ePBC, pdbbox, isize, index);
}
if (opt2bSet("-ox", NFILE, fnm))
{
}
}
/* Write a .pdb file with B-factors and optionally anisou records */
- write_sto_conf_indexed(opt2fn("-ox", NFILE, fnm), title, pdbatoms, xref, NULL,
+ write_sto_conf_indexed(opt2fn("-ox", NFILE, fnm), title, pdbatoms, xref, nullptr,
ePBC, pdbbox, isize, index);
}
if (bAniso)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int i, m, teller, n_alloc, natoms, nvec, ai, aj, ak;
unsigned long mode;
real t, t0, t1, dt;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
t_topology *top;
int ePBC;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPR, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffREAD },
{ efXVG, "-o", "rotacf", ffWRITE }
};
#define NFILE asize(fnm)
ppa = add_acf_pargs(&npargs, pa);
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
- NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv))
{
sfree(ppa);
return 0;
snew(c1, nvec);
for (i = 0; (i < nvec); i++)
{
- c1[i] = NULL;
+ c1[i] = nullptr;
}
n_alloc = 0;
teller, nvec, c1, dt, mode, bAver);
}
- do_view(oenv, ftp2fn(efXVG, NFILE, fnm), NULL);
+ do_view(oenv, ftp2fn(efXVG, NFILE, fnm), nullptr);
return 0;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
real xf;
matrix box, R;
real *w_rls;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
nfr_all = 0;
{
copy_rvec(x[index[i]], xi[nfr][i]);
}
- reset_x(gnx, NULL, gnx, NULL, xi[nfr], w_rls);
+ reset_x(gnx, nullptr, gnx, nullptr, xi[nfr], w_rls);
nfr++;
if (nfr % 100 == 0)
{
"the rotation matrix."
};
const char *reffit[] =
- { NULL, "none", "xyz", "xy", NULL };
+ { nullptr, "none", "xyz", "xy", nullptr };
static int skip = 1;
static gmx_bool bFitXY = FALSE, bMW = TRUE;
t_pargs pa[] = {
int natoms, i;
char *grpname;
int gnx;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
int *index;
gmx_output_env_t *oenv;
real *w_rls;
const char *leg[] = { "xx", "xy", "xz", "yx", "yy", "yz", "zx", "zy", "zz" };
#define NLEG asize(leg)
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efXVG, NULL, "rotmat", ffWRITE }
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efXVG, nullptr, "rotmat", ffWRITE }
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x_ref, NULL, box, bMW);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x_ref, nullptr, box, bMW);
gpbc = gmx_rmpbc_init(&top.idef, ePBC, top.atoms.nr);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
- GMX_RELEASE_ASSERT(reffit[0] != NULL, "Options inconsistency; reffit[0] is NULL");
+ GMX_RELEASE_ASSERT(reffit[0] != nullptr, "Options inconsistency; reffit[0] is NULL");
if (reffit[0][0] != 'n')
{
get_refx(oenv, ftp2fn(efTRX, NFILE, fnm), reffit[0][2] == 'z' ? 3 : 2, skip,
if (reffit[0][0] == 'n')
{
- reset_x(gnx, index, natoms, NULL, x_ref, w_rls);
+ reset_x(gnx, index, natoms, nullptr, x_ref, w_rls);
}
out = xvgropen(ftp2fn(efXVG, NFILE, fnm),
{
gmx_rmpbc(gpbc, natoms, box, x);
- reset_x(gnx, index, natoms, NULL, x, w_rls);
+ reset_x(gnx, index, natoms, nullptr, x, w_rls);
if (bFitXY)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
static t_charge *mk_charge(const t_atoms *atoms, const t_block *cgs, int *nncg)
{
- t_charge *cg = NULL;
+ t_charge *cg = nullptr;
char buf[32];
int i, j, ncg, resnr, anr;
real qq;
"Use separate files for each interaction (may be MANY)" }
};
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPR, NULL, NULL, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPR, nullptr, nullptr, ffREAD },
};
#define NFILE asize(fnm)
gmx_output_env_t *oenv;
if (!parse_common_args(&argc, argv, PCA_CAN_TIME,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
teller = 0;
- time = NULL;
+ time = nullptr;
do
{
srenew(time, teller+1);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
static unsigned int seed = 0;
static int nthreads = -1;
- static const char *emode[] = { NULL, "direct", "mc", NULL };
- static const char *emethod[] = { NULL, "debye", "fft", NULL };
+ static const char *emode[] = { nullptr, "direct", "mc", nullptr };
+ static const char *emethod[] = { nullptr, "debye", "fft", nullptr };
gmx_neutron_atomic_structurefactors_t *gnsf;
gmx_sans_t *gsans;
#endif
};
FILE *fp;
- const char *fnTPX, *fnTRX, *fnDAT = NULL;
+ const char *fnTPX, *fnTRX, *fnDAT = nullptr;
t_trxstatus *status;
- t_topology *top = NULL;
- gmx_rmpbc_t gpbc = NULL;
+ t_topology *top = nullptr;
+ gmx_rmpbc_t gpbc = nullptr;
gmx_bool bFFT = FALSE, bDEBYE = FALSE;
gmx_bool bMC = FALSE;
int ePBC = -1;
rvec *x;
int natoms;
real t;
- char **grpname = NULL;
- int *index = NULL;
+ char **grpname = nullptr;
+ int *index = nullptr;
int isize;
int i;
- char *hdr = NULL;
- char *suffix = NULL;
- t_filenm *fnmdup = NULL;
- gmx_radial_distribution_histogram_t *prframecurrent = NULL, *pr = NULL;
- gmx_static_structurefactor_t *sqframecurrent = NULL, *sq = NULL;
+ char *hdr = nullptr;
+ char *suffix = nullptr;
+ t_filenm *fnmdup = nullptr;
+ gmx_radial_distribution_histogram_t *prframecurrent = nullptr, *pr = nullptr;
+ gmx_static_structurefactor_t *sqframecurrent = nullptr, *sq = nullptr;
gmx_output_env_t *oenv;
#define NFILE asize(fnm)
t_filenm fnm[] = {
- { efTPR, "-s", NULL, ffREAD },
- { efTRX, "-f", NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTPR, "-s", nullptr, ffREAD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efDAT, "-d", "nsfactor", ffOPTRD },
{ efXVG, "-pr", "pr", ffWRITE },
{ efXVG, "-sq", "sq", ffWRITE },
nthreads = gmx_omp_get_max_threads();
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_TIME_UNIT,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
gmx_omp_set_num_threads(nthreads);
/* Now try to parse opts for modes */
- GMX_RELEASE_ASSERT(emethod[0] != NULL, "Options inconsistency; emethod[0]Â is NULL");
+ GMX_RELEASE_ASSERT(emethod[0] != nullptr, "Options inconsistency; emethod[0]Â is NULL");
switch (emethod[0][0])
{
case 'd':
snew(grpname, 1);
snew(index, 1);
- read_tps_conf(fnTPX, top, &ePBC, &x, NULL, box, TRUE);
+ read_tps_conf(fnTPX, top, &ePBC, &x, nullptr, box, TRUE);
printf("\nPlease select group for SANS spectra calculation:\n");
get_index(&(top->atoms), ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, grpname);
gmx_rmpbc(gpbc, top->atoms.nr, box, x);
}
/* allocate memory for pr */
- if (pr == NULL)
+ if (pr == nullptr)
{
/* in case its first frame to read */
snew(pr, 1);
prframecurrent = calc_radial_distribution_histogram(gsans, x, box, index, isize, binwidth, bMC, bNORM, mcover, seed);
/* copy prframecurrent -> pr and summ up pr->gr[i] */
/* allocate and/or resize memory for pr->gr[i] and pr->r[i] */
- if (pr->gr == NULL)
+ if (pr->gr == nullptr)
{
/* check if we use pr->gr first time */
snew(pr->gr, prframecurrent->grn);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
"Energy of the incoming X-ray (keV) "}
};
#define NPA asize(pa)
- const char *fnTPS, *fnTRX, *fnNDX, *fnDAT = NULL;
+ const char *fnTPS, *fnTRX, *fnNDX, *fnDAT = nullptr;
gmx_output_env_t *oenv;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efDAT, "-d", "sfactor", ffOPTRD },
{ efXVG, "-sq", "sq", ffWRITE },
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME,
- NFILE, fnm, NPA, pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, NPA, pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
FILE *fp;
real *min_eig, *max_eig;
- real *axis_x, *axis_y, *axis_z, *axis = NULL;
+ real *axis_x, *axis_y, *axis_z, *axis = nullptr;
double *P;
real **PP, *W, *E, **WW, **EE, *S, **SS, *M, *bE;
rvec xxx;
npargs = asize(pa);
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW,
- NFILE, fnm, npargs, pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, npargs, pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
}
else
{
- et_val = NULL;
+ et_val = nullptr;
}
if (fn_ene && et_val)
opt2fn("-ls", NFILE, fnm), opt2fn("-lsh", NFILE, fnm),
opt2fn("-lss", NFILE, fnm),
opt2fn("-ls3", NFILE, fnm), opt2fn("-g", NFILE, fnm),
- n, nset, val, fn_ge != NULL, e_nset, et_val, Tref,
+ n, nset, val, fn_ge != nullptr, e_nset, et_val, Tref,
pmax, gmax,
- opt2parg_bSet("-emin", NPA, pa) ? &emin : NULL,
- opt2parg_bSet("-emax", NPA, pa) ? &emax : NULL,
+ opt2parg_bSet("-emin", NPA, pa) ? &emin : nullptr,
+ opt2parg_bSet("-emax", NPA, pa) ? &emax : nullptr,
nlevels, pmin,
idim, ibox,
opt2parg_bSet("-xmin", NPA, pa), rmin,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW,
NFILE, fnm, asize(pa), pa, asize(desc),
- desc, 0, NULL, &oenv))
+ desc, 0, nullptr, &oenv))
{
return 0;
}
}
xvgrclose(fp);
- do_view(oenv, ftp2fn(efXVG, NFILE, fnm), NULL);
+ do_view(oenv, ftp2fn(efXVG, NFILE, fnm), nullptr);
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
char str[STRLEN];
gmx_bool bTPS;
rvec xref, dx, dxh1, dxh2, outer;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
t_pbc pbc;
const char *legr[] = {
"<cos(\\8q\\4\\s1\\N)>",
};
t_filenm fnm[] = {
- { efTRX, NULL, NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efXVG, NULL, "sori", ffWRITE },
+ { efTRX, nullptr, nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efXVG, nullptr, "sori", ffWRITE },
{ efXVG, "-no", "snor", ffWRITE },
{ efXVG, "-ro", "sord", ffWRITE },
{ efXVG, "-co", "scum", ffWRITE },
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
bTPS = (opt2bSet("-s", NFILE, fnm) || !opt2bSet("-n", NFILE, fnm) || bCom);
if (bTPS)
{
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box,
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box,
bCom);
}
}
else
{
- get_index(NULL, ftp2fn(efNDX, NFILE, fnm), 2, isize, index, grpname);
+ get_index(nullptr, ftp2fn(efNDX, NFILE, fnm), 2, isize, index, grpname);
}
if (bCom)
}
xvgrclose(fp);
- do_view(oenv, opt2fn("-o", NFILE, fnm), NULL);
- do_view(oenv, opt2fn("-no", NFILE, fnm), NULL);
+ do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr);
+ do_view(oenv, opt2fn("-no", NFILE, fnm), nullptr);
do_view(oenv, opt2fn("-ro", NFILE, fnm), "-nxy");
do_view(oenv, opt2fn("-co", NFILE, fnm), "-nxy");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2007,2008,2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2007,2008,2009,2010,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.
int i, nidx, nidxp;
int v;
int j, k;
- int ***bin = NULL;
+ int ***bin = nullptr;
int nbin[3];
FILE *flp;
int x, y, z, minx, miny, minz, maxx, maxy, maxz;
int tot, maxval, minval;
double norm;
gmx_output_env_t *oenv;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
t_filenm fnm[] = {
- { efTPS, NULL, NULL, ffREAD }, /* this is for the topology */
- { efTRX, "-f", NULL, ffREAD }, /* and this for the trajectory */
- { efNDX, NULL, NULL, ffOPTRD }
+ { efTPS, nullptr, nullptr, ffREAD }, /* this is for the topology */
+ { efTRX, "-f", nullptr, ffREAD }, /* and this for the trajectory */
+ { efNDX, nullptr, nullptr, ffOPTRD }
};
#define NFILE asize(fnm)
return 0;
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, box, TRUE);
sfree(xtop);
atoms = &(top.atoms);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
double sdip, sdip2, sinp, sdinp, nmol;
int *hist;
t_pbc pbc;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
const char *desc[] = {
};
t_filenm fnm[] = {
- { efTRX, NULL, NULL, ffREAD },
- { efTPR, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efXVG, NULL, "scdist", ffWRITE }
+ { efTRX, nullptr, nullptr, ffREAD },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efXVG, nullptr, "scdist", ffWRITE }
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME | PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
gmx::MDModules mdModules;
ir = mdModules.inputrec();
read_tpx_top(ftp2fn(efTPR, NFILE, fnm),
- ir, box, &natoms, NULL, NULL, top);
+ ir, box, &natoms, nullptr, nullptr, top);
/* get index groups */
printf("Select a group of reference particles and a solvent group:\n");
}
xvgrclose(fp);
- do_view(oenv, opt2fn("-o", NFILE, fnm), NULL);
+ do_view(oenv, opt2fn("-o", NFILE, fnm), nullptr);
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
const char *fn_tcf, const char *fn_cub,
const char *fn_vk, const gmx_output_env_t *oenv)
{
- FILE *fp, *fp_vk, *fp_cub = NULL;
+ FILE *fp, *fp_vk, *fp_cub = nullptr;
int nk, ntc;
- real **tcaf, **tcafc = NULL, eta, *sig;
+ real **tcaf, **tcafc = nullptr, eta, *sig;
int i, j, k, kc;
int ncorr;
double fitparms[3];
tcaf[k][0] = 1.0;
fitparms[0] = 1;
fitparms[1] = 1;
- do_lmfit(ncorr, tcaf[k], sig, dt, 0, 0, ncorr*dt,
- oenv, bDebugMode(), effnVAC, fitparms, 0, NULL);
+ do_lmfit(ncorr, tcaf[k], sig, dt, nullptr, 0, ncorr*dt,
+ oenv, bDebugMode(), effnVAC, fitparms, 0, nullptr);
eta = 1000*fitparms[1]*rho/
(4*fitparms[0]*PICO*norm2(kfac[k])/(NANO*NANO));
fprintf(stdout, "k %6.3f tau %6.3f eta %8.5f 10^-3 kg/(m s)\n",
tcafc[k][0] = 1.0;
fitparms[0] = 1;
fitparms[1] = 1;
- do_lmfit(ncorr, tcafc[k], sig, dt, 0, 0, ncorr*dt,
- oenv, bDebugMode(), effnVAC, fitparms, 0, NULL);
+ do_lmfit(ncorr, tcafc[k], sig, dt, nullptr, 0, ncorr*dt,
+ oenv, bDebugMode(), effnVAC, fitparms, 0, nullptr);
eta = 1000*fitparms[1]*rho/
(4*fitparms[0]*PICO*norm2(kfac[kset_c[k]])/(NANO*NANO));
fprintf(stdout,
matrix box;
gmx_bool bTop;
int gnx;
- int *index, *atndx = NULL, at;
+ int *index, *atndx = nullptr, at;
char *grpname;
char title[256];
real t0, t1, dt, m, mtot, sysmass, rho, sx, cx;
#define NHISTO 360
t_filenm fnm[] = {
- { efTRN, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { 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 },
ppa = add_acf_pargs(&npargs, pa);
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
- NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv))
{
sfree(ppa);
return 0;
}
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, NULL, NULL, box,
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box,
TRUE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
fprintf(fp, " %g", time);
for (i = 0; i < n; i++)
{
- if (index != NULL)
+ if (index != nullptr)
{
ii = index[i];
}
for (i = 0; i < isize[g]; i++)
{
ind = index[g][i];
- if (mass != NULL)
+ if (mass != nullptr)
{
m = mass[ind];
svmul(m, x[ind], tmp);
}
}
}
- if (mass != NULL)
+ if (mass != nullptr)
{
for (d = 0; d < DIM; d++)
{
int ngrps, int isize[], int **index, gmx_bool bDim[],
const char *sffmt)
{
- static rvec *xav = NULL;
+ static rvec *xav = nullptr;
if (bCom)
{
- if (xav == NULL)
+ if (xav == nullptr)
{
snew(xav, ngrps);
}
average_data(x, xav, mass, ngrps, isize, index);
- low_print_data(fp, time, xav, ngrps, NULL, bDim, sffmt);
+ low_print_data(fp, time, xav, ngrps, nullptr, bDim, sffmt);
}
else
{
static void write_trx_x(t_trxstatus *status, const t_trxframe *fr, real *mass, gmx_bool bCom,
int ngrps, int isize[], int **index)
{
- static rvec *xav = NULL;
- static t_atoms *atoms = NULL;
+ static rvec *xav = nullptr;
+ static t_atoms *atoms = nullptr;
t_trxframe fr_av;
int i;
if (bCom)
{
- if (xav == NULL)
+ if (xav == nullptr)
{
snew(xav, ngrps);
snew(atoms, 1);
fr_av.natoms = ngrps;
fr_av.atoms = atoms;
fr_av.x = xav;
- write_trxframe(status, &fr_av, NULL);
+ write_trxframe(status, &fr_av, nullptr);
}
else
{
- write_trxframe_indexed(status, fr, isize[0], index[0], NULL);
+ write_trxframe_indexed(status, fr, isize[0], index[0], nullptr);
}
}
static real ekrot(rvec x[], rvec v[], real mass[], int isize, int index[])
{
- static real **TCM = NULL, **L;
+ static real **TCM = nullptr, **L;
double tm, m0, lxx, lxy, lxz, lyy, lyz, lzz, ekrot;
rvec a0, ocm;
dvec dx, b0;
dvec xcm, vcm, acm;
int i, j, m, n;
- if (TCM == NULL)
+ if (TCM == nullptr)
{
snew(TCM, DIM);
for (i = 0; i < DIM; i++)
*(atoms->resinfo[atoms->atom[maxi].resind].name),
atoms->resinfo[atoms->atom[maxi].resind].nr);
- if (atoms->pdbinfo == NULL)
+ if (atoms->pdbinfo == nullptr)
{
snew(atoms->pdbinfo, atoms->nr);
}
atoms->pdbinfo[index[i]].bfac = sum[index[i]][onedim]*scale;
}
}
- write_sto_conf_indexed(fname, title, atoms, x, NULL, ePBC, box, isize, index);
+ write_sto_conf_indexed(fname, title, atoms, x, nullptr, ePBC, box, isize, index);
}
}
int i, m, in, nnn;
real vn, vnmax;
- if (*histo == NULL)
+ if (*histo == nullptr)
{
vnmax = 0;
for (i = 0; (i < gnx); i++)
{ "-scale", FALSE, etREAL, {&scale},
"Scale factor for [REF].pdb[ref] output, 0 is autoscale" }
};
- FILE *outx = NULL, *outv = NULL, *outf = NULL, *outb = NULL, *outt = NULL;
- FILE *outekt = NULL, *outekr = NULL;
+ FILE *outx = nullptr, *outv = nullptr, *outf = nullptr, *outb = nullptr, *outt = nullptr;
+ FILE *outekt = nullptr, *outekr = nullptr;
t_topology top;
int ePBC;
real *mass, time;
const char *indexfn;
t_trxframe fr;
- int flags, nvhisto = 0, *vhisto = NULL;
- rvec *xtop, *xp = NULL;
- rvec *sumx = NULL, *sumv = NULL, *sumf = NULL;
+ int flags, nvhisto = 0, *vhisto = nullptr;
+ rvec *xtop, *xp = nullptr;
+ rvec *sumx = nullptr, *sumv = nullptr, *sumf = nullptr;
matrix topbox;
t_trxstatus *status;
- t_trxstatus *status_out = NULL;
- gmx_rmpbc_t gpbc = NULL;
+ t_trxstatus *status_out = nullptr;
+ gmx_rmpbc_t gpbc = nullptr;
int i, j;
int nr_xfr, nr_vfr, nr_ffr;
char **grpname;
gmx_output_env_t *oenv;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXVG, "-ox", "coord", ffOPTWR },
{ efTRX, "-oxt", "coord", ffOPTWR },
{ efXVG, "-ov", "veloc", ffOPTWR },
if (!parse_common_args(&argc, argv,
PCA_CAN_TIME | PCA_TIME_UNIT | PCA_CAN_VIEW,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
sprintf(sffmt6, "%s%s%s%s%s%s", sffmt, sffmt, sffmt, sffmt, sffmt, sffmt);
bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC,
- &xtop, NULL, topbox,
+ &xtop, nullptr, topbox,
bCom && (bOX || bOXT || bOV || bOT || bEKT || bEKR));
sfree(xtop);
if ((bMol || bCV || bCF) && !bTop)
}
else
{
- mass = NULL;
+ mass = nullptr;
}
flags = 0;
}
if (bOF && fr.bF)
{
- print_data(outf, time, fr.f, NULL, bCom, ngroups, isize, index, bDim, sffmt);
+ print_data(outf, time, fr.f, nullptr, bCom, ngroups, isize, index, bDim, sffmt);
}
if (bOB && fr.bBox)
{
}
while (read_next_frame(oenv, status, &fr));
- if (gpbc != NULL)
+ if (gpbc != nullptr)
{
gmx_rmpbc_done(gpbc);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
ok = FALSE;
do
{
- if (NULL == fgets(inputstring, STRLEN - 1, stdin))
+ if (nullptr == fgets(inputstring, STRLEN - 1, stdin))
{
gmx_fatal(FARGS, "Error reading user input" );
}
{
if (index)
{
- write_trxframe_indexed(fp_out[j], &trx[i], isize, index, NULL);
+ write_trxframe_indexed(fp_out[j], &trx[i], isize, index, nullptr);
}
else
{
- write_trxframe(fp_out[j], &trx[i], NULL);
+ write_trxframe(fp_out[j], &trx[i], nullptr);
}
}
}
};
#define npargs asize(pa)
int ftpin, i, frame, frame_out;
- t_trxstatus *status, *trxout = NULL;
+ t_trxstatus *status, *trxout = nullptr;
real t_corr;
t_trxframe fr, frout;
char **fnms, **fnms_out, *out_file;
gmx_bool lastTimeSet = FALSE;
real last_frame_time, searchtime;
int isize = 0, j;
- int *index = NULL, imax;
+ int *index = nullptr, imax;
char *grpname;
- real **val = NULL, *t = NULL, dt_remd;
+ real **val = nullptr, *t = nullptr, dt_remd;
int n, nset, ftpout = -1, prevEndStep = 0, filetype;
gmx_off_t fpos;
gmx_output_env_t *oenv;
t_filenm fnm[] =
{
- { efTRX, "-f", NULL, ffRDMULT },
- { efTRO, "-o", NULL, ffWRMULT },
+ { efTRX, "-f", nullptr, ffRDMULT },
+ { efTRO, "-o", nullptr, ffWRMULT },
{ efNDX, "-n", "index", ffOPTRD },
{ efXVG, "-demux", "remd", ffOPTRD }
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_TIME_UNIT, NFILE, fnm,
- asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
}
if (bIndex)
{
- trjtools_gmx_prepare_tng_writing(out_file, 'w', NULL, &trxout,
- fnms[0], isize, NULL, index, grpname);
+ trjtools_gmx_prepare_tng_writing(out_file, 'w', nullptr, &trxout,
+ fnms[0], isize, nullptr, index, grpname);
}
else
{
- trjtools_gmx_prepare_tng_writing(out_file, 'w', NULL, &trxout,
- fnms[0], -1, NULL, NULL, NULL);
+ trjtools_gmx_prepare_tng_writing(out_file, 'w', nullptr, &trxout,
+ fnms[0], -1, nullptr, nullptr, nullptr);
}
}
else
if (bIndex)
{
write_trxframe_indexed(trxout, &frout, isize, index,
- NULL);
+ nullptr);
}
else
{
- write_trxframe(trxout, &frout, NULL);
+ write_trxframe(trxout, &frout, nullptr);
}
if ( ((frame % 10) == 0) || (frame < 10) )
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
in = gmx_trr_open(fn, "r");
fp = gmx_fio_getfp(in);
- if (fp == NULL)
+ if (fp == nullptr)
{
fprintf(stderr, "Sorry, can not trunc %s, truncation of this filetype is not supported\n", fn);
gmx_trr_close(in);
bStop = FALSE;
while (!bStop && gmx_trr_read_frame_header(in, &sh, &bOK))
{
- gmx_trr_read_frame_data(in, &sh, NULL, NULL, NULL, NULL);
+ gmx_trr_read_frame_data(in, &sh, nullptr, nullptr, nullptr, nullptr);
fpos = gmx_ftell(fp);
t = sh.t;
if (t >= t0)
const char *input_file,
const char *output_file)
{
- gmx_mtop_t *mtop = NULL;
+ gmx_mtop_t *mtop = nullptr;
if (fn2bTPX(tps_file) &&
efTNG != fn2ftp(input_file) &&
{
int temp_natoms = -1;
snew(mtop, 1);
- read_tpx(tps_file, NULL, NULL, &temp_natoms,
- NULL, NULL, mtop);
+ read_tpx(tps_file, nullptr, nullptr, &temp_natoms,
+ nullptr, nullptr, mtop);
}
return mtop;
};
const char *pbc_opt[epNR + 1] =
{
- NULL, "none", "mol", "res", "atom", "nojump", "cluster", "whole",
- NULL
+ nullptr, "none", "mol", "res", "atom", "nojump", "cluster", "whole",
+ nullptr
};
int unitcell_enum;
const char *unitcell_opt[euNR+1] =
- { NULL, "rect", "tric", "compact", NULL };
+ { nullptr, "rect", "tric", "compact", nullptr };
enum
{
ecSel, ecTric, ecRect, ecZero, ecNR
};
const char *center_opt[ecNR+1] =
- { NULL, "tric", "rect", "zero", NULL };
+ { nullptr, "tric", "rect", "zero", nullptr };
int ecenter;
int fit_enum;
};
const char *fit[efNR + 1] =
{
- NULL, "none", "rot+trans", "rotxy+transxy", "translation", "transxy",
- "progressive", NULL
+ nullptr, "none", "rot+trans", "rotxy+transxy", "translation", "transxy",
+ "progressive", nullptr
};
static gmx_bool bSeparate = FALSE, bVels = TRUE, bForce = FALSE, bCONECT = FALSE;
static int skip_nr = 1, ndec = 3, nzero = 0;
static real tzero = 0, delta_t = 0, timestep = 0, ttrunc = -1, tdump = -1, split_t = 0;
static rvec newbox = {0, 0, 0}, shift = {0, 0, 0}, trans = {0, 0, 0};
- static char *exec_command = NULL;
+ static char *exec_command = nullptr;
static real dropunder = 0, dropover = 0;
static gmx_bool bRound = FALSE;
};
#define NPA asize(pa)
- FILE *out = NULL;
- t_trxstatus *trxout = NULL;
+ FILE *out = nullptr;
+ t_trxstatus *trxout = nullptr;
t_trxstatus *trxin;
int file_nr;
t_trxframe fr, frout;
int flags;
- rvec *xmem = NULL, *vmem = NULL, *fmem = NULL;
- rvec *xp = NULL, x_shift, hbox;
- real *w_rls = NULL;
+ rvec *xmem = nullptr, *vmem = nullptr, *fmem = nullptr;
+ rvec *xp = nullptr, x_shift, hbox;
+ real *w_rls = nullptr;
int m, i, d, frame, outframe, natoms, nout, ncent, newstep = 0, model_nr;
#define SKIP 10
t_topology top;
- gmx_mtop_t *mtop = NULL;
- gmx_conect gc = NULL;
+ gmx_mtop_t *mtop = nullptr;
+ gmx_conect gc = nullptr;
int ePBC = -1;
- t_atoms *atoms = NULL, useatoms;
+ t_atoms *atoms = nullptr, useatoms;
matrix top_box;
int *index, *cindex;
char *grpnm;
int ifit, my_clust = -1;
int *ind_fit;
char *gn_fit;
- t_cluster_ndx *clust = NULL;
- t_trxstatus **clust_status = NULL;
- int *clust_status_id = NULL;
+ t_cluster_ndx *clust = nullptr;
+ t_trxstatus **clust_status = nullptr;
+ int *clust_status_id = nullptr;
int ntrxopen = 0;
- int *nfwritten = NULL;
+ int *nfwritten = nullptr;
int ndrop = 0, ncol, drop0 = 0, drop1 = 0, dropuse = 0;
double **dropval;
real tshift = 0, t0 = -1, dt = 0.001, prec;
gmx_bool bFit, bPFit, bReset;
int nfitdim;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
gmx_bool bRmPBC, bPBCWhole, bPBCcomRes, bPBCcomMol, bPBCcomAtom, bPBC, bNoJump, bCluster;
gmx_bool bCopy, bDoIt, bIndex, bTDump, bSetTime, bTPS = FALSE, bDTset = FALSE;
gmx_bool bExec, bTimeStep = FALSE, bDumpFrame = FALSE, bSetPrec, bNeedPrec;
gmx_bool bHaveFirstFrame, bHaveNextFrame, bSetBox, bSetUR, bSplit = FALSE;
gmx_bool bSubTraj = FALSE, bDropUnder = FALSE, bDropOver = FALSE, bTrans = FALSE;
gmx_bool bWriteFrame, bSplitHere;
- const char *top_file, *in_file, *out_file = NULL;
+ const char *top_file, *in_file, *out_file = nullptr;
char out_file2[256], *charpt;
- char *outf_base = NULL;
- const char *outf_ext = NULL;
+ char *outf_base = nullptr;
+ const char *outf_ext = nullptr;
char top_title[256], title[256], filemode[5];
gmx_output_env_t *oenv;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTRO, "-o", NULL, ffWRITE },
- { efTPS, NULL, NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTRO, "-o", nullptr, ffWRITE },
+ { efTPS, nullptr, nullptr, ffOPTRD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efNDX, "-fr", "frames", ffOPTRD },
{ efNDX, "-sub", "cluster", ffOPTRD },
{ efXVG, "-drop", "drop", ffOPTRD }
PCA_CAN_BEGIN | PCA_CAN_END | PCA_CAN_VIEW |
PCA_TIME_UNIT,
NFILE, fnm, NPA, pa, asize(desc), desc,
- 0, NULL, &oenv))
+ 0, nullptr, &oenv))
{
return 0;
}
if (bSeparate || bSplit)
{
outf_ext = std::strrchr(out_file, '.');
- if (outf_ext == NULL)
+ if (outf_ext == nullptr)
{
gmx_fatal(FARGS, "Output file name '%s' does not contain a '.'", out_file);
}
gmx_fatal(FARGS, "Can only use the sub option with output file types "
"xtc and trr");
}
- clust = cluster_index(NULL, opt2fn("-sub", NFILE, fnm));
+ clust = cluster_index(nullptr, opt2fn("-sub", NFILE, fnm));
/* Check for number of files disabled, as FOPEN_MAX is not the correct
* number to check for. In my linux box it is only 16.
snew(nfwritten, clust->clust->nr);
for (i = 0; (i < clust->clust->nr); i++)
{
- clust_status[i] = NULL;
+ clust_status[i] = nullptr;
clust_status_id[i] = -1;
}
bSeparate = bSplit = FALSE;
if (bTPS)
{
- read_tps_conf(top_file, &top, &ePBC, &xp, NULL, top_box,
+ read_tps_conf(top_file, &top, &ePBC, &xp, nullptr, top_box,
bReset || bPBCcomRes);
std::strncpy(top_title, *top.name, 255);
top_title[255] = '\0';
}
/* get frame number index */
- frindex = NULL;
+ frindex = nullptr;
if (opt2bSet("-fr", NFILE, fnm))
{
printf("Select groups of frame number indices:\n");
gmx_rmpbc(gpbc, top.atoms.nr, top_box, xp);
}
copy_rvec(xp[index[0]], x_shift);
- reset_x_ndim(nfitdim, ifit, ind_fit, atoms->nr, NULL, xp, w_rls);
+ reset_x_ndim(nfitdim, ifit, ind_fit, atoms->nr, nullptr, xp, w_rls);
rvec_dec(x_shift, xp[index[0]]);
}
else
filemode[0],
trxin,
&trxout,
- NULL,
+ nullptr,
nout,
mtop,
index,
break;
case efXTC:
case efTRR:
- out = NULL;
+ out = nullptr;
if (!bSplit && !bSubTraj)
{
trxout = open_trx(out_file, filemode);
gmx_rmpbc_trxfr(gpbc, &fr);
}
- reset_x_ndim(nfitdim, ifit, ind_fit, natoms, NULL, fr.x, w_rls);
+ reset_x_ndim(nfitdim, ifit, ind_fit, natoms, nullptr, fr.x, w_rls);
do_fit(natoms, w_rls, xp, fr.x);
}
/* store this set of coordinates for future use */
if (bPFit || bNoJump)
{
- if (xp == NULL)
+ if (xp == nullptr)
{
snew(xp, natoms);
}
if (bReset)
{
- reset_x_ndim(nfitdim, ifit, ind_fit, natoms, NULL, fr.x, w_rls);
+ reset_x_ndim(nfitdim, ifit, ind_fit, natoms, nullptr, fr.x, w_rls);
if (bFit)
{
do_fit_ndim(nfitdim, natoms, w_rls, xp, fr.x);
clust->clust->index[my_clust]))
{
close_trx(clust_status[my_clust]);
- clust_status[my_clust] = NULL;
+ clust_status[my_clust] = nullptr;
clust_status_id[my_clust] = -2;
ntrxopen--;
if (ntrxopen < 0)
{
case efGRO:
write_hconf_p(out, title, &useatoms,
- frout.x, frout.bV ? frout.v : NULL, frout.box);
+ frout.x, frout.bV ? frout.v : nullptr, frout.box);
break;
case efPDB:
fprintf(out, "REMARK GENERATED BY TRJCONV\n");
frout.bStep = TRUE;
frout.bTime = TRUE;
}
- write_g96_conf(out, &frout, -1, NULL);
+ write_g96_conf(out, &frout, -1, nullptr);
}
if (bSeparate || bSplitHere)
{
gmx_ffclose(out);
- out = NULL;
+ out = nullptr;
}
break;
default:
{
close_trx(trxout);
}
- else if (out != NULL)
+ else if (out != nullptr)
{
gmx_ffclose(out);
}
sfree(mtop);
- do_view(oenv, out_file, NULL);
+ do_view(oenv, out_file, nullptr);
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
int natoms, nwat, ncut;
char **grpname;
int i, j, d, *isize, isize_ref = 0, isize_sol;
- int sa, sr, *swi, **index, *ind_ref = NULL, *ind_sol;
+ int sa, sr, *swi, **index, *ind_ref = nullptr, *ind_sol;
gmx_output_env_t *oenv;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efTRO, "-o", "ordered", ffOPTWR },
{ efXVG, "-nshell", "nshell", ffOPTWR }
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_TIME,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, NULL, box, TRUE);
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &x, nullptr, box, TRUE);
sfree(x);
/* get index groups */
swi[i] = i;
}
- out = NULL;
- fp = NULL;
+ out = nullptr;
+ fp = nullptr;
bNShell = ((opt2bSet("-nshell", NFILE, fnm)) ||
(opt2parg_bSet("-r", asize(pa), pa)));
bPDBout = FALSE;
}
}
}
- write_trx(out, natoms, swi, &top.atoms, 0, t, box, x, NULL, NULL);
+ write_trx(out, natoms, swi, &top.atoms, 0, t, box, x, nullptr, nullptr);
}
}
while (read_next_x(oenv, status, &t, x, box));
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
fp = fopen(fn_out, "r");
fprintf(stdout, "\n\n");
- while (fgets(buf, STRLEN-1, fp) != NULL)
+ while (fgets(buf, STRLEN-1, fp) != nullptr)
{
fprintf(stdout, "%s", buf);
}
iFound = eFoundDDStr; /* Skip some case statements */
}
- while (fgets(line, STRLEN, fp) != NULL)
+ while (fgets(line, STRLEN, fp) != nullptr)
{
/* Remove leading spaces */
ltrim(line);
/* Check for TERM and INT signals from user: */
- if (std::strstr(line, errSIG) != NULL)
+ if (std::strstr(line, errSIG) != nullptr)
{
fclose(fp);
cleandata(perfdata, test_nr);
/* Check whether cycle resetting worked */
if (presteps > 0 && !bFoundResetStr)
{
- if (std::strstr(line, matchstrcr) != NULL)
+ if (std::strstr(line, matchstrcr) != nullptr)
{
sprintf(dumstring, "step %s", "%" GMX_SCNd64);
sscanf(line, dumstring, &resetsteps);
if (gmx_fexist(errfile))
{
fp = fopen(errfile, "r");
- while (fgets(line, STRLEN, fp) != NULL)
+ while (fgets(line, STRLEN, fp) != nullptr)
{
if (str_starts(line, "Fatal error:") )
{
- if (fgets(line, STRLEN, fp) != NULL)
+ if (fgets(line, STRLEN, fp) != nullptr)
{
fprintf(stderr, "\nWARNING: An error occurred during this benchmark:\n"
"%s\n", line);
/* Get the commands we need to set up the runs from environment variables */
if (!bThreads)
{
- if ( (cp = getenv("MPIRUN")) != NULL)
+ if ( (cp = getenv("MPIRUN")) != nullptr)
{
*cmd_mpirun = gmx_strdup(cp);
}
*cmd_mpirun = gmx_strdup(empty_mpirun);
}
- if (*cmd_mdrun == NULL)
+ if (*cmd_mdrun == nullptr)
{
/* The use of MDRUN is deprecated, but made available in 5.1
for backward compatibility. It may be removed in a future
version. */
- if ( (cp = getenv("MDRUN" )) != NULL)
+ if ( (cp = getenv("MDRUN" )) != nullptr)
{
*cmd_mdrun = gmx_strdup(cp);
}
const char *cmd_mdrun,
gmx_bool bNeedGpuSupport)
{
- char *command = NULL;
+ char *command = nullptr;
char *cp;
char line[STRLEN];
FILE *fp;
while (!feof(fp) )
{
cp = fgets(line, STRLEN, fp);
- if (cp != NULL)
+ if (cp != nullptr)
{
if (str_starts(line, match_mdrun) )
{
/* Scale the Fourier grid spacing */
ir->nkx = ir->nky = ir->nkz = 0;
- calc_grid(NULL, state.box, fourierspacing*fac, &ir->nkx, &ir->nky, &ir->nkz);
+ calc_grid(nullptr, state.box, fourierspacing*fac, &ir->nkx, &ir->nky, &ir->nkz);
/* Adjust other radii since various conditions need to be fulfilled */
if (eelPME == ir->coulombtype)
{
char numstring[STRLEN];
char newfilename[STRLEN];
- const char *fn = NULL;
+ const char *fn = nullptr;
int i;
const char *opt;
* constructing mdrun command lines */
{
int i, nr, k, ret, count = 0, totaltests;
- int *nPMEnodes = NULL;
- t_perf *pd = NULL;
+ int *nPMEnodes = nullptr;
+ t_perf *pd = nullptr;
int cmdline_length;
char *command, *cmd_stub;
char buf[STRLEN];
/* Loop over various numbers of PME nodes: */
for (i = 0; i < *pmeentries; i++)
{
- char *cmd_gpu_ids = NULL;
+ char *cmd_gpu_ids = nullptr;
pd = &perfdata[k][i];
int presteps = 100; /* Do a full cycle reset after presteps steps */
gmx_bool bOverwrite = FALSE, bKeepTPR;
gmx_bool bLaunch = FALSE;
- char *ExtraArgs = NULL;
- char **tpr_names = NULL;
- const char *simulation_tpr = NULL;
- char *deffnm = NULL;
+ char *ExtraArgs = nullptr;
+ char **tpr_names = nullptr;
+ const char *simulation_tpr = nullptr;
+ char *deffnm = nullptr;
int best_npme, best_tpr;
int sim_part = 1; /* For benchmarks with checkpoint files */
char bbuf[STRLEN];
/* Default program names if nothing else is found */
- char *cmd_mpirun = NULL, *cmd_mdrun = NULL;
+ char *cmd_mpirun = nullptr, *cmd_mdrun = nullptr;
char *cmd_args_bench, *cmd_args_launch;
- char *cmd_np = NULL;
+ char *cmd_np = nullptr;
/* IDs of GPUs that are eligible for computation */
- char *eligible_gpu_ids = NULL;
- t_eligible_gpu_ids *gpu_ids = NULL;
+ char *eligible_gpu_ids = nullptr;
+ t_eligible_gpu_ids *gpu_ids = nullptr;
- t_perf **perfdata = NULL;
+ t_perf **perfdata = nullptr;
t_inputinfo *info;
int i;
FILE *fp;
{ efLOG, "-err", "bencherr", ffWRITE },
{ efTPR, "-so", "tuned", ffWRITE },
/* mdrun: */
- { efTPR, NULL, NULL, ffREAD },
- { efTRN, "-o", NULL, ffWRITE },
- { efCOMPRESSED, "-x", NULL, ffOPTWR },
- { efCPT, "-cpi", NULL, ffOPTRD },
- { efCPT, "-cpo", NULL, ffOPTWR },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efTRN, "-o", nullptr, ffWRITE },
+ { efCOMPRESSED, "-x", nullptr, ffOPTWR },
+ { efCPT, "-cpi", nullptr, ffOPTRD },
+ { efCPT, "-cpo", nullptr, ffOPTWR },
{ efSTO, "-c", "confout", ffWRITE },
{ efEDR, "-e", "ener", ffWRITE },
{ efLOG, "-g", "md", ffWRITE },
int nthreads = 1;
const char *procstring[] =
- { NULL, "np", "n", "none", NULL };
+ { nullptr, "np", "n", "none", nullptr };
const char *npmevalues_opt[] =
- { NULL, "auto", "all", "subset", NULL };
+ { nullptr, "auto", "all", "subset", nullptr };
gmx_bool bAppendFiles = TRUE;
gmx_bool bKeepAndNumCPT = FALSE;
gmx_bool bBenchmark = TRUE;
gmx_bool bCheck = TRUE;
- gmx_output_env_t *oenv = NULL;
+ gmx_output_env_t *oenv = nullptr;
t_pargs pa[] = {
/***********************/
if (!parse_common_args(&argc, argv, PCA_NOEXIT_ON_ARGS,
NFILE, fnm, asize(pa), pa, asize(desc), desc,
- 0, NULL, &oenv))
+ 0, nullptr, &oenv))
{
return 0;
}
// procstring[0]Â is used inside two different conditionals further down
- GMX_RELEASE_ASSERT(procstring[0] != NULL, "Options inconsistency; procstring[0]Â is NULL");
+ GMX_RELEASE_ASSERT(procstring[0] != nullptr, "Options inconsistency; procstring[0]Â is NULL");
/* Store the remaining unparsed command line entries in a string which
* is then attached to the mdrun command line */
get_program_paths(bThreads, &cmd_mpirun, &cmd_mdrun);
if (bBenchmark && repeats > 0)
{
- check_mdrun_works(bThreads, cmd_mpirun, cmd_np, cmd_mdrun, NULL != eligible_gpu_ids);
+ check_mdrun_works(bThreads, cmd_mpirun, cmd_np, cmd_mdrun, nullptr != eligible_gpu_ids);
}
/* Print some header info to file */
snew(perfdata, ntprs);
if (bBenchmark)
{
- GMX_RELEASE_ASSERT(npmevalues_opt[0] != NULL, "Options inconsistency; npmevalues_opt[0] is NULL");
+ GMX_RELEASE_ASSERT(npmevalues_opt[0] != nullptr, "Options inconsistency; npmevalues_opt[0] is NULL");
do_the_tests(fp, tpr_names, maxPMEnodes, minPMEnodes, npme_fixed, npmevalues_opt[0], perfdata, &pmeentries,
repeats, nnodes, ntprs, bThreads, cmd_mpirun, cmd_np, cmd_mdrun,
cmd_args_bench, fnm, NFILE, presteps, cpt_steps, bCheck, gpu_ids);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
#define NPA asize(pa)
t_filenm fnm[] = {
- { efTRX, NULL, NULL, ffREAD },
- { efTPS, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRX, nullptr, nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXPM, "-om", "vanhove", ffOPTWR },
{ efXVG, "-or", "vanhove_r", ffOPTWR },
{ efXVG, "-ot", "vanhove_t", ffOPTWR }
real *time, t, invbin = 0, rmax2 = 0, rint2 = 0, d2;
real invsbin = 0, matmax, normfac, dt, *tickx, *ticky;
char buf[STRLEN], **legend;
- real **mat = NULL;
- int *pt = NULL, **pr = NULL, *mcount = NULL, *tcount = NULL, *rcount = NULL;
+ real **mat = nullptr;
+ int *pt = nullptr, **pr = nullptr, *mcount = nullptr, *tcount = nullptr, *rcount = nullptr;
FILE *fp;
t_rgb rlo = {1, 1, 1}, rhi = {0, 0, 0};
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
exit(0);
}
- read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, NULL, boxtop,
+ read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, &xtop, nullptr, boxtop,
FALSE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &isize, &index, &grpname);
nalloc = 0;
- time = NULL;
- sbox = NULL;
- sx = NULL;
+ time = nullptr;
+ sbox = nullptr;
+ sx = nullptr;
clear_mat(avbox);
read_first_x(oenv, &status, ftp2fn(efTRX, NFILE, fnm), &t, &x, box);
srenew(sbox, nalloc);
srenew(sx, nalloc);
}
- GMX_RELEASE_ASSERT(time != NULL, "Memory allocation failure; time array is NULL");
- GMX_RELEASE_ASSERT(sbox != NULL, "Memory allocation failure; sbox array is NULL");
+ GMX_RELEASE_ASSERT(time != nullptr, "Memory allocation failure; time array is NULL");
+ GMX_RELEASE_ASSERT(sbox != nullptr, "Memory allocation failure; sbox array is NULL");
time[nfr] = t;
copy_mat(box, sbox[nfr]);
xvgrclose(fp);
}
- do_view(oenv, matfile, NULL);
- do_view(oenv, orfile, NULL);
- do_view(oenv, otfile, NULL);
+ do_view(oenv, matfile, nullptr);
+ do_view(oenv, orfile, nullptr);
+ do_view(oenv, otfile, nullptr);
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
rvec mv_mol;
/* Array for the correlation function */
real **c1;
- real *normm = NULL;
+ real *normm = nullptr;
gmx_output_env_t *oenv;
#define NHISTO 360
t_filenm fnm[] = {
- { efTRN, "-f", NULL, ffREAD },
- { efTPS, NULL, NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTRN, "-f", nullptr, ffREAD },
+ { efTPS, nullptr, nullptr, ffOPTRD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efXVG, "-o", "vac", ffWRITE },
{ efXVG, "-os", "spectrum", ffOPTWR }
};
npargs = asize(pa);
ppa = add_acf_pargs(&npargs, pa);
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW | PCA_CAN_TIME,
- NFILE, fnm, npargs, ppa, asize(desc), desc, 0, NULL, &oenv))
+ NFILE, fnm, npargs, ppa, asize(desc), desc, 0, nullptr, &oenv))
{
sfree(ppa);
return 0;
if (bTPS)
{
- bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, NULL, NULL, box,
+ bTop = read_tps_conf(ftp2fn(efTPS, NFILE, fnm), &top, &ePBC, nullptr, nullptr, box,
TRUE);
get_index(&top.atoms, ftp2fn_null(efNDX, NFILE, fnm), 1, &gnx, &index, &grpname);
}
snew(c1, gnx);
for (i = 0; (i < gnx); i++)
{
- c1[i] = NULL;
+ c1[i] = nullptr;
}
read_first_frame(oenv, &status, ftp2fn(efTRN, NFILE, fnm), &fr, TRX_NEED_V);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
snew(win, nwin);
for (i = 0; i < nwin; i++)
{
- win[i].Histo = win[i].cum = 0;
- win[i].k = win[i].pos = win[i].z = 0;
- win[i].N = win[i].Ntot = 0;
- win[i].g = win[i].tau = win[i].tausmooth = 0;
- win[i].bContrib = 0;
- win[i].ztime = 0;
- win[i].forceAv = 0;
- win[i].aver = win[i].sigma = 0;
- win[i].bsWeight = 0;
+ win[i].Histo = win[i].cum = nullptr;
+ win[i].k = win[i].pos = win[i].z = nullptr;
+ win[i].N = win[i].Ntot = nullptr;
+ win[i].g = win[i].tau = win[i].tausmooth = nullptr;
+ win[i].bContrib = nullptr;
+ win[i].ztime = nullptr;
+ win[i].forceAv = nullptr;
+ win[i].aver = win[i].sigma = nullptr;
+ win[i].bsWeight = nullptr;
}
return win;
}
std::istringstream ist;
/* line 1 */
- if (fgets(line, 2048, file) == NULL)
+ if (fgets(line, 2048, file) == nullptr)
{
gmx_fatal(FARGS, "Error reading header from pdo file\n");
}
}
/* line 2 */
- if (fgets(line, 2048, file) == NULL)
+ if (fgets(line, 2048, file) == nullptr)
{
gmx_fatal(FARGS, "Error reading header from pdo file\n");
}
}
/* line3 */
- if (fgets(line, 2048, file) == NULL)
+ if (fgets(line, 2048, file) == nullptr)
{
gmx_fatal(FARGS, "Error reading header from pdo file\n");
}
ist >> Buffer0 >> Buffer1 >> header->nSkip;
/* line 4 */
- if (fgets(line, 2048, file) == NULL)
+ if (fgets(line, 2048, file) == nullptr)
{
gmx_fatal(FARGS, "Error reading header from pdo file\n");
}
ist >> Buffer0 >> Buffer1 >> Buffer2 >> header->Reference;
/* line 5 */
- if (fgets(line, 2048, file) == NULL)
+ if (fgets(line, 2048, file) == nullptr)
{
gmx_fatal(FARGS, "Error reading header from pdo file\n");
}
for (i = 0; i < header->nPull; ++i)
{
- if (fgets(line, 2048, file) == NULL)
+ if (fgets(line, 2048, file) == nullptr)
{
gmx_fatal(FARGS, "Error reading header from pdo file\n");
}
}
}
- if (fgets(line, 2048, file) == NULL)
+ if (fgets(line, 2048, file) == nullptr)
{
gmx_fatal(FARGS, "Cannot read from file\n");
}
char *p;
int slen;
- if (fgets(ptr, *len-1, fp) == NULL)
+ if (fgets(ptr, *len-1, fp) == nullptr)
{
- return NULL;
+ return nullptr;
}
p = ptr;
- while ((std::strchr(ptr, '\n') == NULL) && (!feof(fp)))
+ while ((std::strchr(ptr, '\n') == nullptr) && (!feof(fp)))
{
/* This line is longer than len characters, let's increase len! */
*len += STRLEN;
p += STRLEN;
srenew(ptr, *len);
- if (fgets(p-1, STRLEN, fp) == NULL)
+ if (fgets(p-1, STRLEN, fp) == nullptr)
{
break;
}
int i, inttemp, bins, count, ntot;
real minval, maxval, minfound = 1e20, maxfound = -1e20;
double temp, time, time0 = 0, dt;
- char *ptr = 0;
- t_UmbrellaWindow * window = 0;
+ char *ptr = nullptr;
+ t_UmbrellaWindow * window = nullptr;
gmx_bool timeok, dt_ok = 1;
- char *tmpbuf = 0, fmt[256], fmtign[256], fmtlf[5] = "%lf";
+ char *tmpbuf = nullptr, fmt[256], fmtign[256], fmtlf[5] = "%lf";
int len = STRLEN, dstep = 1;
const int blocklen = 4096;
- int *lennow = 0;
+ int *lennow = nullptr;
if (!bGetMinMax)
{
snew(window->g, window->nPull);
snew(window->bsWeight, window->nPull);
- window->bContrib = 0;
+ window->bContrib = nullptr;
if (opt->bCalcTauInt)
{
}
else
{
- window->ztime = 0;
+ window->ztime = nullptr;
}
snew(lennow, window->nPull);
window->g[i] = 1.;
if (opt->bCalcTauInt)
{
- window->ztime[i] = 0;
+ window->ztime[i] = nullptr;
}
}
count = 0;
snew(tmpbuf, len);
- while ( (ptr = fgets3(file, tmpbuf, &len)) != NULL)
+ while ( (ptr = fgets3(file, tmpbuf, &len)) != nullptr)
{
trim(ptr);
{
int i, j, k, nbin;
double last;
- char *fn = 0, *buf = 0;
- FILE *fp = 0;
+ char *fn = nullptr, *buf = nullptr;
+ FILE *fp = nullptr;
if (opt->bs_verbose)
{
void print_histograms(const char *fnhist, t_UmbrellaWindow * window, int nWindows,
int bs_index, t_UmbrellaOptions *opt, const char *xlabel)
{
- char *fn = 0, *buf = 0, title[256];
+ char *fn = nullptr, *buf = nullptr, title[256];
FILE *fp;
int bins, l, i, j;
{
t_UmbrellaWindow * synthWindow;
double *bsProfile, *bsProfiles_av, *bsProfiles_av2, maxchange = 1e20, tmp, stddev;
- int i, j, *randomArray = 0, winid, pullid, ib;
+ int i, j, *randomArray = nullptr, winid, pullid, ib;
int iAllPull, nAllPull, *allPull_winId, *allPull_pullId;
FILE *fp;
gmx_bool bExact = FALSE;
void read_wham_in(const char *fn, char ***filenamesRet, int *nfilesRet,
t_UmbrellaOptions *opt)
{
- char **filename = 0, tmp[WHAM_MAXFILELEN+2];
+ char **filename = nullptr, tmp[WHAM_MAXFILELEN+2];
int nread, sizenow, i, block = 1;
FILE *fp;
fp = gmx_ffopen(fn, "r");
nread = 0;
sizenow = 0;
- while (fgets(tmp, sizeof(tmp), fp) != NULL)
+ while (fgets(tmp, sizeof(tmp), fp) != nullptr)
{
if (std::strlen(tmp) >= WHAM_MAXFILELEN)
{
//! Open a file or a pipe to a gzipped file
FILE *open_pdo_pipe(const char *fn, t_UmbrellaOptions *opt, gmx_bool *bPipeOpen)
{
- char Buffer[1024], gunzip[1024], *Path = 0;
- FILE *pipe = 0;
+ char Buffer[1024], gunzip[1024], *Path = nullptr;
+ FILE *pipe = nullptr;
static gmx_bool bFirst = 1;
/* gzipped pdo file? */
printf("Executing command '%s'\n", Buffer);
}
#if HAVE_PIPES
- if ((pipe = popen(Buffer, "r")) == NULL)
+ if ((pipe = popen(Buffer, "r")) == nullptr)
{
gmx_fatal(FARGS, "Unable to open pipe to `%s'\n", Buffer);
}
}
read_pdo_header(file, header, opt);
/* here only determine min and max of this window */
- read_pdo_data(file, header, i, NULL, opt, TRUE, &mintmp, &maxtmp);
+ read_pdo_data(file, header, i, nullptr, opt, TRUE, &mintmp, &maxtmp);
if (maxtmp > opt->max)
{
opt->max = maxtmp;
file = open_pdo_pipe(fn[i], opt, &bPipeOpen);
read_pdo_header(file, header, opt);
/* load data into window */
- read_pdo_data(file, header, i, window, opt, FALSE, NULL, NULL);
+ read_pdo_data(file, header, i, window, opt, FALSE, nullptr, nullptr);
if ((window+i)->Ntot[0] == 0)
{
fprintf(stderr, "\nWARNING, no data points read from file %s (check -b option)\n", fn[i]);
static int first = 1;
/* printf("Reading %s \n",fn); */
- read_tpx_state(fn, ir, &state, NULL);
+ read_tpx_state(fn, ir, &state, nullptr);
if (!ir->bPull)
{
bool geometryIsSet = false;
for (int i = 0; i < ir->pull->ncoord; i++)
{
- if (coordsel == NULL || coordsel->bUse[i])
+ if (coordsel == nullptr || coordsel->bUse[i])
{
if (header->pcrd[i].pull_type != epullUMBRELLA)
{
maxlen+1);
for (int i = 0; i < ir->pull->ncoord; i++)
{
- bool use = (coordsel == NULL || coordsel->bUse[i]);
+ bool use = (coordsel == nullptr || coordsel->bUse[i]);
printf(fmt,
epullg_names[header->pcrd[i].geometry], header->pcrd[i].k, header->pcrd[i].init_dist,
int2YN(header->pcrd[i].dim[XX]), int2YN(header->pcrd[i].dim[YY]), int2YN(header->pcrd[i].dim[ZZ]),
gmx_bool bGetMinMax, real *mintmp, real *maxtmp,
t_coordselection *coordsel)
{
- double **y = 0, pos = 0., t, force, time0 = 0., dt;
+ double **y = nullptr, pos = 0., t, force, time0 = 0., dt;
int ny, nt, bins, ibin, i, g, gUsed, dstep = 1;
int nColExpect, ntot, column;
real min, max, minfound = 1e20, maxfound = -1e20;
gmx_bool dt_ok, timeok;
const char *quantity;
const int blocklen = 4096;
- int *lennow = 0;
+ int *lennow = nullptr;
static gmx_bool bFirst = TRUE;
/*
snew(window->Ntot, window->nPull);
snew(window->g, window->nPull);
snew(window->bsWeight, window->nPull);
- window->bContrib = 0;
+ window->bContrib = nullptr;
if (opt->bCalcTauInt)
{
}
else
{
- window->ztime = NULL;
+ window->ztime = nullptr;
}
snew(lennow, window->nPull);
if (opt->bCalcTauInt)
{
- window->ztime[g] = NULL;
+ window->ztime[g] = nullptr;
}
}
{
gmx_fatal(FARGS, "Expected the %d'th file in input file to be a tpr file\n", i);
}
- read_tpr_header(fnTprs[i], header, opt, (opt->nCoordsel > 0) ? &opt->coordsel[i] : NULL);
+ read_tpr_header(fnTprs[i], header, opt, (opt->nCoordsel > 0) ? &opt->coordsel[i] : nullptr);
if (whaminFileType(fnPull[i]) != whamin_pullxf)
{
gmx_fatal(FARGS, "Expected the %d'th file in input file to be a xvg (pullx/pullf) file\n", i);
}
- read_pull_xf(fnPull[i], header, NULL, opt, TRUE, &mintmp, &maxtmp,
- (opt->nCoordsel > 0) ? &opt->coordsel[i] : NULL);
+ read_pull_xf(fnPull[i], header, nullptr, opt, TRUE, &mintmp, &maxtmp,
+ (opt->nCoordsel > 0) ? &opt->coordsel[i] : nullptr);
if (maxtmp > opt->max)
{
opt->max = maxtmp;
{
gmx_fatal(FARGS, "Expected the %d'th file in input file to be a tpr file\n", i);
}
- read_tpr_header(fnTprs[i], header, opt, (opt->nCoordsel > 0) ? &opt->coordsel[i] : NULL);
+ read_tpr_header(fnTprs[i], header, opt, (opt->nCoordsel > 0) ? &opt->coordsel[i] : nullptr);
if (whaminFileType(fnPull[i]) != whamin_pullxf)
{
gmx_fatal(FARGS, "Expected the %d'th file in input file to be a xvg (pullx/pullf) file\n", i);
}
- read_pull_xf(fnPull[i], header, window+i, opt, FALSE, NULL, NULL,
- (opt->nCoordsel > 0) ? &opt->coordsel[i] : NULL);
+ read_pull_xf(fnPull[i], header, window+i, opt, FALSE, nullptr, nullptr,
+ (opt->nCoordsel > 0) ? &opt->coordsel[i] : nullptr);
if (window[i].Ntot[0] == 0)
{
fprintf(stderr, "\nWARNING, no data points read from file %s (check -b option)\n", fnPull[i]);
int i, ig, ncorr, ntot, j, k, *count, restart;
real *corr, c0, dt, tmp;
real *ztime, av, tausteps;
- FILE *fp, *fpcorr = 0;
+ FILE *fp, *fpcorr = nullptr;
if (opt->verbose)
{
{
FILE *fp;
int i, iline, n, len = STRLEN, temp;
- char *ptr = 0, *tmpbuf = 0;
+ char *ptr = nullptr, *tmpbuf = nullptr;
char fmt[1024], fmtign[1024];
int block = 1, sizenow;
fp = gmx_ffopen(opt->fnCoordSel, "r");
- opt->coordsel = NULL;
+ opt->coordsel = nullptr;
snew(tmpbuf, len);
sizenow = 0;
iline = 0;
- while ( (ptr = fgets3(fp, tmpbuf, &len)) != NULL)
+ while ( (ptr = fgets3(fp, tmpbuf, &len)) != nullptr)
{
trim(ptr);
n = wordcount(ptr);
"the histograms."
};
- const char *en_unit[] = {NULL, "kJ", "kCal", "kT", NULL};
- const char *en_unit_label[] = {"", "E (kJ mol\\S-1\\N)", "E (kcal mol\\S-1\\N)", "E (kT)", NULL};
- const char *en_bsMethod[] = { NULL, "b-hist", "hist", "traj", "traj-gauss", NULL };
+ const char *en_unit[] = {nullptr, "kJ", "kCal", "kT", nullptr};
+ const char *en_unit_label[] = {"", "E (kJ mol\\S-1\\N)", "E (kcal mol\\S-1\\N)", "E (kT)", nullptr};
+ const char *en_bsMethod[] = { nullptr, "b-hist", "hist", "traj", "traj-gauss", nullptr };
static t_UmbrellaOptions opt;
t_pargs pa[] = {
int i, j, l, nfiles, nwins, nfiles2;
t_UmbrellaHeader header;
- t_UmbrellaWindow * window = NULL;
+ t_UmbrellaWindow * window = nullptr;
double *profile, maxchange = 1e20;
gmx_bool bMinSet, bMaxSet, bAutoSet, bExact = FALSE;
char **fninTpr, **fninPull, **fninPdo;
opt.max = 0;
opt.bAuto = TRUE;
opt.nCoordsel = 0;
- opt.coordsel = NULL;
+ opt.coordsel = nullptr;
/* bootstrapping stuff */
opt.nBootStrap = 0;
opt.stepUpdateContrib = 100;
if (!parse_common_args(&argc, argv, 0,
- NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, NULL, &opt.oenv))
+ NFILE, fnm, asize(pa), pa, asize(desc), desc, 0, nullptr, &opt.oenv))
{
return 0;
}
}
/* Read file that selects the pull group to be used */
- if (opt.fnCoordSel != NULL)
+ if (opt.fnCoordSel != nullptr)
{
readPullCoordSelection(&opt, fninTpr, nfiles);
}
}
else
{ /* reading pdo files */
- if (opt.fnCoordSel != NULL)
+ if (opt.fnCoordSel != nullptr)
{
gmx_fatal(FARGS, "Reading a -is file is not supported with PDO input files.\n"
"Use awk or a similar tool to pick the required pull groups from your PDO files\n");
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_output_env_t *oenv;
static real rot0 = 0;
static gmx_bool bNum = TRUE;
- static char *title = NULL;
+ static char *title = nullptr;
static int r0 = 1;
t_pargs pa [] = {
{ "-r0", FALSE, etINT, {&r0},
"Toggle numbers" }
};
t_filenm fnm[] = {
- { efDAT, "-f", NULL, ffREAD },
- { efEPS, "-o", NULL, ffWRITE }
+ { efDAT, "-f", nullptr, ffREAD },
+ { efEPS, "-o", nullptr, ffWRITE }
};
#define NFILE asize(fnm)
char **resnm;
if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa,
- asize(desc), desc, 0, NULL, &oenv))
+ asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
{
if (std::strcmp(argv[i], "-r0") == 0)
{
- r0 = std::strtol(argv[++i], NULL, 10);
+ r0 = std::strtol(argv[++i], nullptr, 10);
fprintf(stderr, "First residue is %d\n", r0);
}
else if (std::strcmp(argv[i], "-rot0") == 0)
{
- rot0 = strtod(argv[++i], NULL);
+ rot0 = strtod(argv[++i], nullptr);
fprintf(stderr, "Initial rotation is %g\n", rot0);
}
else if (std::strcmp(argv[i], "-T") == 0)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
void get_params(const char *mpin, const char *mpout, t_psrec *psr)
{
- static const char *gmx_bools[BOOL_NR+1] = { "no", "yes", NULL };
+ static const char *gmx_bools[BOOL_NR+1] = { "no", "yes", nullptr };
/* this must correspond to t_rgb *linecolors[] below */
- static const char *colors[] = { "none", "black", "white", NULL };
+ static const char *colors[] = { "none", "black", "white", nullptr };
warninp_t wi;
t_inpfile *inp;
const char *tmp;
wi = init_warning(FALSE, 0);
- if (mpin != NULL)
+ if (mpin != nullptr)
{
inp = read_inpfile(mpin, &ninp, wi);
}
else
{
- inp = NULL;
+ inp = nullptr;
}
ETYPE("black&white", psr->bw, gmx_bools);
RTYPE("linewidth", psr->linewidth, 1.0);
check_warning_error(wi, FARGS);
- if (mpout != NULL)
+ if (mpout != nullptr)
{
write_inpfile(mpout, ninp, inp, TRUE, wi);
}
t_rgb blue = { 0, 0, 1 };
#define BLACK (&black)
/* this must correspond to *colors[] in get_params */
-t_rgb *linecolors[] = { NULL, &black, &white, NULL };
+t_rgb *linecolors[] = { nullptr, &black, &white, nullptr };
gmx_bool diff_maps(int nmap1, t_mapping *map1, int nmap2, t_mapping *map2)
{
boxxh = fontsize;
}
- GMX_RELEASE_ASSERT(map != NULL, "NULL map array provided to leg_continuous()");
+ GMX_RELEASE_ASSERT(map != nullptr, "NULL map array provided to leg_continuous()");
/* LANDSCAPE */
xx0 = x0-((nmap-mapoffset)*boxxh)/2.0;
FILE *out;
int i, x, y, col;
int nmap;
- t_mapping *map = NULL;
+ t_mapping *map = nullptr;
out = gmx_ffopen(outf, "w");
real x0, y0, xx;
real w, h, dw, dh;
int nmap1 = 0, nmap2 = 0, leg_nmap;
- t_mapping *map1 = NULL, *map2 = NULL, *leg_map;
+ t_mapping *map1 = nullptr, *map2 = nullptr, *leg_map;
gmx_bool bMap1, bNextMap1, bDiscrete;
/* memory leak: */
{
ps_comment(out, "Now it's legend time!");
ps_linewidth(out, static_cast<int>(psr->linewidth));
- if (mat2 == NULL || elegend != elSecond)
+ if (mat2 == nullptr || elegend != elSecond)
{
bDiscrete = mat[0].bDiscrete;
legend = mat[0].legend;
for (i = 0; (i < nmat); i++)
{
/* Make labels for x axis */
- if (mat[i].axis_x == NULL)
+ if (mat[i].axis_x == nullptr)
{
snew(mat[i].axis_x, mat[i].nx);
for (j = 0; (j < mat[i].nx); j++)
}
}
/* Make labels for y axis */
- if (mat[i].axis_y == NULL)
+ if (mat[i].axis_y == nullptr)
{
snew(mat[i].axis_y, mat[i].ny);
for (j = 0; (j < mat[i].ny); j++)
" not match.\n", k, mat1[k].nx, mat1[k].ny, mat2[k].nx, mat2[k].ny);
}
printf("Combining two %dx%d matrices\n", mat1[k].nx, mat1[k].ny);
- rmat1 = matrix2real(&mat1[k], NULL);
- rmat2 = matrix2real(&mat2[k], NULL);
- if (NULL == rmat1 || NULL == rmat2)
+ rmat1 = matrix2real(&mat1[k], nullptr);
+ rmat2 = matrix2real(&mat2[k], nullptr);
+ if (nullptr == rmat1 || nullptr == rmat2)
{
gmx_fatal(FARGS, "Could not extract real data from %s xpm matrices. Note that, e.g.,\n"
"g_rms and g_mdmat provide such data, but not do_dssp.\n",
- (NULL == rmat1 && NULL == rmat2) ? "both" : "one of the" );
+ (nullptr == rmat1 && nullptr == rmat2) ? "both" : "one of the" );
}
rlo = 1e38;
rhi = -1e38;
zero_lines(nmat, mat, mat);
}
- if (epsfile != NULL)
+ if (epsfile != nullptr)
{
ps_mat(epsfile, nmat, mat, mat2, bFrame, bDiag, bFirstDiag,
bTitle, bTitleOnce, bYonce, elegend,
size, boxx, boxy, m2p, m2pout, mapoffset);
}
- if (xpmfile != NULL)
+ if (xpmfile != nullptr)
{
xpm_mat(xpmfile, nmat, mat, mat2, bDiag, bFirstDiag);
}
};
gmx_output_env_t *oenv;
- const char *fn, *epsfile = NULL, *xpmfile = NULL;
+ const char *fn, *epsfile = nullptr, *xpmfile = nullptr;
int i, nmat, nmat2, etitle, elegend, ediag, erainbow, ecombine;
- t_matrix *mat = NULL, *mat2 = NULL;
+ t_matrix *mat = nullptr, *mat2 = nullptr;
gmx_bool bTitle, bTitleOnce, bDiag, bFirstDiag, bGrad;
static gmx_bool bFrame = TRUE, bZeroLine = FALSE, bYonce = FALSE;
static real size = 400, boxx = 0, boxy = 0, cmin = 0, cmax = 0;
enum {
etSel, etTop, etOnce, etYlabel, etNone, etNR
};
- const char *title[] = { NULL, "top", "once", "ylabel", "none", NULL };
+ const char *title[] = { nullptr, "top", "once", "ylabel", "none", nullptr };
/* MUST correspond to enum elXxx as defined at top of file */
- const char *legend[] = { NULL, "both", "first", "second", "none", NULL };
+ const char *legend[] = { nullptr, "both", "first", "second", "none", nullptr };
enum {
edSel, edFirst, edSecond, edNone, edNR
};
- const char *diag[] = { NULL, "first", "second", "none", NULL };
+ const char *diag[] = { nullptr, "first", "second", "none", nullptr };
enum {
erSel, erNo, erBlue, erRed, erNR
};
- const char *rainbow[] = { NULL, "no", "blue", "red", NULL };
+ const char *rainbow[] = { nullptr, "no", "blue", "red", nullptr };
/* MUST correspond to enum ecXxx as defined at top of file */
const char *combine[] = {
- NULL, "halves", "add", "sub", "mult", "div", NULL
+ nullptr, "halves", "add", "sub", "mult", "div", nullptr
};
static int skip = 1, mapoffset = 0;
t_pargs pa[] = {
};
#define NPA asize(pa)
t_filenm fnm[] = {
- { efXPM, "-f", NULL, ffREAD },
+ { efXPM, "-f", nullptr, ffREAD },
{ efXPM, "-f2", "root2", ffOPTRD },
- { efM2P, "-di", NULL, ffLIBOPTRD },
+ { efM2P, "-di", nullptr, ffLIBOPTRD },
{ efM2P, "-do", "out", ffOPTWR },
- { efEPS, "-o", NULL, ffOPTWR },
- { efXPM, "-xpm", NULL, ffOPTWR }
+ { efEPS, "-o", nullptr, ffOPTWR },
+ { efXPM, "-xpm", nullptr, ffOPTWR }
};
#define NFILE asize(fnm)
if (!parse_common_args(&argc, argv, PCA_CAN_VIEW,
NFILE, fnm, NPA, pa,
- asize(desc), desc, 0, NULL, &oenv))
+ asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
epsfile = ftp2fn_null(efEPS, NFILE, fnm);
xpmfile = opt2fn_null("-xpm", NFILE, fnm);
- if (epsfile == NULL && xpmfile == NULL)
+ if (epsfile == nullptr && xpmfile == nullptr)
{
if (ecombine != ecHalves)
{
"WARNING: can only write result of arithmetic combination "
"of two matrices to .xpm file\n"
" file %s will not be written\n", epsfile);
- epsfile = NULL;
+ epsfile = nullptr;
}
bDiag = ediag != edNone;
}
}
- if ((mat2 == NULL) && (elegend != elNone))
+ if ((mat2 == nullptr) && (elegend != elNone))
{
elegend = elFirst;
}
if (ecombine && ecombine != ecHalves)
{
write_combined_matrix(ecombine, xpmfile, nmat, mat, mat2,
- opt2parg_bSet("-cmin", NPA, pa) ? &cmin : NULL,
- opt2parg_bSet("-cmax", NPA, pa) ? &cmax : NULL);
+ opt2parg_bSet("-cmin", NPA, pa) ? &cmin : nullptr,
+ opt2parg_bSet("-cmax", NPA, pa) ? &cmax : nullptr);
}
else
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
ak = index[i+2];
al = index[i+3];
phi = RAD2DEG*
- dih_angle(x[ai], x[aj], x[ak], x[al], NULL,
+ dih_angle(x[ai], x[aj], x[ak], x[al], nullptr,
r_ij, r_kj, r_kl, m, n,
&sign, &t1, &t2, &t3);
phitot += phi;
}
bb[i].phi = RAD2DEG*
- dih_angle(x[bb[i].Cprev], x[bb[i].N], x[bb[i].CA], x[bb[i].C], NULL,
+ dih_angle(x[bb[i].Cprev], x[bb[i].N], x[bb[i].CA], x[bb[i].C], nullptr,
r_ij, r_kj, r_kl, m, n,
&sign, &t1, &t2, &t3);
bb[i].psi = RAD2DEG*
- dih_angle(x[bb[i].N], x[bb[i].CA], x[bb[i].C], x[bb[i].Nnext], NULL,
+ dih_angle(x[bb[i].N], x[bb[i].CA], x[bb[i].C], x[bb[i].Nnext], nullptr,
r_ij, r_kj, r_kl, m, n,
&sign, &t1, &t2, &t3);
bb[i].pprms2 = gmx::square(bb[i].phi-PHI_AHX)+gmx::square(bb[i].psi-PSI_AHX);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
rvec r_ij, r_kj, r_kl, m, n;
real sign;
t_dih *dd;
- gmx_rmpbc_t gpbc = NULL;
+ gmx_rmpbc_t gpbc = nullptr;
gpbc = gmx_rmpbc_init(xr->idef, xr->ePBC, xr->natoms);
gmx_rmpbc(gpbc, xr->natoms, xr->box, xr->x);
dd = &(xr->dih[i]);
dd->ang = dih_angle(xr->x[dd->ai[0]], xr->x[dd->ai[1]],
xr->x[dd->ai[2]], xr->x[dd->ai[3]],
- NULL,
+ nullptr,
r_ij, r_kj, r_kl, m, n, &sign, &t1, &t2, &t3);
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_sans_t *gmx_sans_init (const t_topology *top, gmx_neutron_atomic_structurefactors_t *gnsf)
{
- gmx_sans_t *gsans = NULL;
+ gmx_sans_t *gsans = nullptr;
int i, j;
/* Try to assing scattering length from nsfactor.dat */
snew(gsans, 1);
real mcover,
unsigned int seed)
{
- gmx_radial_distribution_histogram_t *pr = NULL;
+ gmx_radial_distribution_histogram_t *pr = nullptr;
rvec dist;
double rmax;
int i, j;
double **tgr;
int tid;
int nthreads;
- gmx::DefaultRandomEngine *trng = NULL;
+ gmx::DefaultRandomEngine *trng = nullptr;
#endif
gmx_int64_t mc = 0, mc_max;
gmx::DefaultRandomEngine rng(seed);
gmx_static_structurefactor_t *convert_histogram_to_intensity_curve (gmx_radial_distribution_histogram_t *pr, double start_q, double end_q, double q_step)
{
- gmx_static_structurefactor_t *sq = NULL;
+ gmx_static_structurefactor_t *sq = nullptr;
int i, j;
/* init data */
snew(sq, 1);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
trans[ZZ][m] = -trans[ZZ][m];
}
}
- rotate_atoms(natoms, NULL, x, trans);
+ rotate_atoms(natoms, nullptr, x, trans);
if (v)
{
- rotate_atoms(natoms, NULL, v, trans);
+ rotate_atoms(natoms, nullptr, v, trans);
}
for (i = 0; i < natoms; i++)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
snew(gsf->b, nralloc);
snew(gsf->c, nralloc);
snew(gsf->p, nralloc);
- gsf->n = NULL;
+ gsf->n = nullptr;
gsf->nratoms = line_no;
while (get_a_line(fp, line, STRLEN))
{
sf->energy = energy;
/* Read the topology informations */
- read_tps_conf (fnTPS, &top, &ePBC, &xtop, NULL, box, TRUE);
+ read_tps_conf (fnTPS, &top, &ePBC, &xtop, nullptr, box, TRUE);
sfree (xtop);
/* groups stuff... */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
#if GMX_LIB_MPI
gmx_fill_commrec_from_mpi(cr);
#else
- cr->mpi_comm_mysim = NULL;
- cr->mpi_comm_mygroup = NULL;
+ cr->mpi_comm_mysim = nullptr;
+ cr->mpi_comm_mygroup = nullptr;
cr->nnodes = 1;
cr->sim_nodeid = 0;
cr->nodeid = cr->sim_nodeid;
static void done_mpi_in_place_buf(mpi_in_place_buf_t *buf)
{
- if (NULL != buf)
+ if (nullptr != buf)
{
sfree(buf->ibuf);
sfree(buf->libuf);
void done_commrec(t_commrec *cr)
{
- if (NULL != cr->dd)
+ if (nullptr != cr->dd)
{
// TODO: implement
// done_domdec(cr->dd);
}
- if (NULL != cr->ms)
+ if (nullptr != cr->ms)
{
done_mpi_in_place_buf(cr->ms->mpb);
sfree(cr->ms);
return cr;
#else
- return NULL;
+ return nullptr;
#endif
}
ng, ni);
}
- if (getenv("GMX_NO_NODECOMM") == NULL &&
+ if (getenv("GMX_NO_NODECOMM") == nullptr &&
((ng > 1 && ng < n) || (ni > 1 && ni < n)))
{
nc->bUse = TRUE;
{
/* This is here because of the silly MPI specification
that MPI_IN_PLACE should be put in sendbuf instead of recvbuf */
- MPI_Reduce(r, NULL, nr, MPI_DOUBLE, MPI_SUM, 0, cr->nc.comm_intra);
+ MPI_Reduce(r, nullptr, nr, MPI_DOUBLE, MPI_SUM, 0, cr->nc.comm_intra);
}
MPI_Bcast(r, nr, MPI_DOUBLE, 0, cr->nc.comm_intra);
}
{
/* This is here because of the silly MPI specification
that MPI_IN_PLACE should be put in sendbuf instead of recvbuf */
- MPI_Reduce(r, NULL, nr, MPI_FLOAT, MPI_SUM, 0, cr->nc.comm_intra);
+ MPI_Reduce(r, nullptr, nr, MPI_FLOAT, MPI_SUM, 0, cr->nc.comm_intra);
}
MPI_Bcast(r, nr, MPI_FLOAT, 0, cr->nc.comm_intra);
}
{
/* This is here because of the silly MPI specification
that MPI_IN_PLACE should be put in sendbuf instead of recvbuf */
- MPI_Reduce(r, NULL, nr, MPI_INT, MPI_SUM, 0, cr->nc.comm_intra);
+ MPI_Reduce(r, nullptr, nr, MPI_INT, MPI_SUM, 0, cr->nc.comm_intra);
}
MPI_Bcast(r, nr, MPI_INT, 0, cr->nc.comm_intra);
}
{
/* This is here because of the silly MPI specification
that MPI_IN_PLACE should be put in sendbuf instead of recvbuf */
- MPI_Reduce(r, NULL, nr, MPI_INT64_T, MPI_SUM, 0, cr->nc.comm_intra);
+ MPI_Reduce(r, nullptr, nr, MPI_INT64_T, MPI_SUM, 0, cr->nc.comm_intra);
}
MPI_Bcast(r, nr, MPI_INT64_T, 0, cr->nc.comm_intra);
}
const char *opt2fn_master(const char *opt, int nfile, const t_filenm fnm[],
t_commrec *cr)
{
- return SIMMASTER(cr) ? opt2fn(opt, nfile, fnm) : NULL;
+ return SIMMASTER(cr) ? opt2fn(opt, nfile, fnm) : nullptr;
}
void gmx_fatal_collective(int f_errno, const char *file, int line,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
const real * shiftvec;
real * fshift;
real tabscale = 0;
- const real * VFtab = NULL;
+ const real * VFtab = nullptr;
const real * x;
real * f;
real facel, krf, crf;
tj[STATE_A] = ntiA+2*typeA[jnr];
tj[STATE_B] = ntiB+2*typeB[jnr];
- if (nlist->excl_fep == NULL || nlist->excl_fep[k])
+ if (nlist->excl_fep == nullptr || nlist->excl_fep[k])
{
c6[STATE_A] = nbfp[tj[STATE_A]];
c6[STATE_B] = nbfp[tj[STATE_B]];
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
else
{
tabscale = 0;
- VFtab = NULL;
+ VFtab = nullptr;
}
ewtab = fr->ic->tabq_coul_FDV0;
ewtabscale = fr->ic->tabq_scale;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
else
{
tabscale = 0;
- VFtab = NULL;
+ VFtab = nullptr;
}
/* avoid compiler warnings for cases that cannot happen */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* Static data structures to find kernels */
-static nb_kernel_info_t * kernel_list = NULL;
+static nb_kernel_info_t * kernel_list = nullptr;
static unsigned int kernel_list_size = 0;
-static int * kernel_list_hash = NULL;
+static int * kernel_list_hash = nullptr;
static unsigned int kernel_list_hash_size = 0;
static unsigned int
nb_kernel_list_hash_destroy()
{
sfree(kernel_list_hash);
- kernel_list_hash = NULL;
+ kernel_list_hash = nullptr;
kernel_list_hash_size = 0;
}
if (kernel_list_hash_size == 0)
{
- return NULL;
+ return nullptr;
}
index = nb_kernel_hash_func(arch,
other,
vf) % kernel_list_hash_size;
- kernelinfo_ptr = NULL;
+ kernelinfo_ptr = nullptr;
while ( (i = kernel_list_hash[index]) != -1)
{
if (!gmx_strcasecmp_min(kernel_list[i].architecture, arch) &&
index = (index+1) % kernel_list_hash_size;
}
- if (debug && kernelinfo_ptr != NULL)
+ if (debug && kernelinfo_ptr != nullptr)
{
fprintf(debug,
"NB kernel %s() with architecture '%s' used for neighborlist with\n"
}
/* If we did not find any kernel the pointer will still be NULL */
- return (kernelinfo_ptr != NULL) ? kernelinfo_ptr->kernelptr : NULL;
+ return (kernelinfo_ptr != nullptr) ? kernelinfo_ptr->kernelptr : nullptr;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* Add the generic kernels to the structure stored statically in nb_kernel.c */
nb_kernel_list_add_kernels(kernellist_c, kernellist_c_size);
- if (!(fr != NULL && fr->use_simd_kernels == FALSE))
+ if (!(fr != nullptr && fr->use_simd_kernels == FALSE))
{
/* Add interaction-specific kernels for different architectures */
/* Single precision */
/* We typically call this setup routine before starting timers,
* but if that has not been done for whatever reason we do it now.
*/
- gmx_nonbonded_setup(NULL, FALSE);
+ gmx_nonbonded_setup(nullptr, FALSE);
}
/* Not used yet */
other = "";
- nl->kernelptr_vf = NULL;
- nl->kernelptr_v = NULL;
- nl->kernelptr_f = NULL;
+ nl->kernelptr_vf = nullptr;
+ nl->kernelptr_v = nullptr;
+ nl->kernelptr_f = nullptr;
elec = gmx_nbkernel_elec_names[nl->ielec];
elec_mod = eintmod_names[nl->ielecmod];
{
/* Try to find a specific kernel first */
- for (i = 0; i < narch && nl->kernelptr_vf == NULL; i++)
+ for (i = 0; i < narch && nl->kernelptr_vf == nullptr; i++)
{
nl->kernelptr_vf = (void *) nb_kernel_list_findkernel(log, arch_and_padding[i].arch, elec, elec_mod, vdw, vdw_mod, geom, other, "PotentialAndForce");
nl->simd_padding_width = arch_and_padding[i].simd_padding_width;
}
- for (i = 0; i < narch && nl->kernelptr_f == NULL; i++)
+ for (i = 0; i < narch && nl->kernelptr_f == nullptr; i++)
{
nl->kernelptr_f = (void *) nb_kernel_list_findkernel(log, arch_and_padding[i].arch, elec, elec_mod, vdw, vdw_mod, geom, other, "Force");
nl->simd_padding_width = arch_and_padding[i].simd_padding_width;
/* If there is not force-only optimized kernel, is there a potential & force one? */
- if (nl->kernelptr_f == NULL)
+ if (nl->kernelptr_f == nullptr)
{
- nl->kernelptr_f = (void *) nb_kernel_list_findkernel(NULL, arch_and_padding[i].arch, elec, elec_mod, vdw, vdw_mod, geom, other, "PotentialAndForce");
+ nl->kernelptr_f = (void *) nb_kernel_list_findkernel(nullptr, arch_and_padding[i].arch, elec, elec_mod, vdw, vdw_mod, geom, other, "PotentialAndForce");
nl->simd_padding_width = arch_and_padding[i].simd_padding_width;
}
}
(nl->ivdw != GMX_NBKERNEL_VDW_NONE) && (nl->ivdwmod == eintmodPOTSWITCH) &&
bElecAndVdwSwitchDiffers)
{
- nl->kernelptr_vf = NULL;
- nl->kernelptr_f = NULL;
+ nl->kernelptr_vf = nullptr;
+ nl->kernelptr_f = nullptr;
}
/* Give up, pick a generic one instead.
* We only do this for particle-particle kernels; by leaving the water-optimized kernel
* pointers to NULL, the water optimization will automatically be disabled for this interaction.
*/
- if (nl->kernelptr_vf == NULL && !gmx_strcasecmp_min(geom, "Particle-Particle"))
+ if (nl->kernelptr_vf == nullptr && !gmx_strcasecmp_min(geom, "Particle-Particle"))
{
nl->kernelptr_vf = (void *) gmx_nb_generic_kernel;
nl->kernelptr_f = (void *) gmx_nb_generic_kernel;
int n, n0, n1, i, i0, i1;
t_nblists * nblists;
nb_kernel_data_t kernel_data;
- nb_kernel_t * kernelptr = NULL;
+ nb_kernel_t * kernelptr = nullptr;
rvec * f;
kernel_data.flags = flags;
continue;
}
/* Neighborlists whose kernelptr==NULL will always be empty */
- if (kernelptr != NULL)
+ if (kernelptr != nullptr)
{
(*kernelptr)(&(nlist[i]), x, f, fr, mdatoms, &kernel_data, nrnb);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
*nbfs = 0.0;
for (i = 0; (i < eNR_NBKERNEL_ALLVSALLGB); i++)
{
- if (std::strstr(nbdata[i].name, "W3-W3") != NULL)
+ if (std::strstr(nbdata[i].name, "W3-W3") != nullptr)
{
*nbfs += 9e-6*nrnb->n[i];
}
- else if (std::strstr(nbdata[i].name, "W3") != NULL)
+ else if (std::strstr(nbdata[i].name, "W3") != nullptr)
{
*nbfs += 3e-6*nrnb->n[i];
}
- else if (std::strstr(nbdata[i].name, "W4-W4") != NULL)
+ else if (std::strstr(nbdata[i].name, "W4-W4") != nullptr)
{
*nbfs += 10e-6*nrnb->n[i];
}
- else if (std::strstr(nbdata[i].name, "W4") != NULL)
+ else if (std::strstr(nbdata[i].name, "W4") != nullptr)
{
*nbfs += 4e-6*nrnb->n[i];
}
*mflop += mni*flop;
frac = 100.0*mni*flop/tflop;
tfrac += frac;
- if (out != NULL)
+ if (out != nullptr)
{
fprintf(out, " %-32s %16.6f %15.3f %6.1f\n",
nbdata[i].name, mni, mni*flop, frac);
mflop = mflop/time_per_node;
wallclocktime = nsteps*delta_t;
- if (getenv("GMX_DETAILED_PERF_STATS") == NULL)
+ if (getenv("GMX_DETAILED_PERF_STATS") == nullptr)
{
fprintf(out, "%12s %12s %12s\n",
"", "(ns/day)", "(hour/ns)");
}
else
{
- if (getenv("GMX_DETAILED_PERF_STATS") == NULL)
+ if (getenv("GMX_DETAILED_PERF_STATS") == nullptr)
{
fprintf(out, "%12s %14s\n",
"", "(steps/hour)");
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2011,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.
ps->param[ps->nr].ai() = ai;
ps->param[ps->nr].aj() = aj;
clear_atom_list(2, ps->param[ps->nr].a);
- if (c == NULL)
+ if (c == nullptr)
{
clear_force_param(0, ps->param[ps->nr].c);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
ffp = &mtop->ffparams;
ffp->ntypes = 0;
ffp->atnr = atnr;
- ffp->functype = NULL;
- ffp->iparams = NULL;
+ ffp->functype = nullptr;
+ ffp->iparams = nullptr;
ffp->reppow = reppow;
- enter_function(&(nbtypes[F_LJ]), (t_functype)F_LJ, comb, reppow, ffp, NULL,
+ enter_function(&(nbtypes[F_LJ]), (t_functype)F_LJ, comb, reppow, ffp, nullptr,
&maxtypes, TRUE, TRUE);
- enter_function(&(nbtypes[F_BHAM]), (t_functype)F_BHAM, comb, reppow, ffp, NULL,
+ enter_function(&(nbtypes[F_BHAM]), (t_functype)F_BHAM, comb, reppow, ffp, nullptr,
&maxtypes, TRUE, TRUE);
for (mt = 0; mt < mtop->nmoltype; mt++)
for (i = 0; (i < F_NRE); i++)
{
molt->ilist[i].nr = 0;
- molt->ilist[i].iatoms = NULL;
+ molt->ilist[i].iatoms = nullptr;
plist = mi[mt].plist;
}
mtop->bIntermolecularInteractions = FALSE;
- if (intermolecular_interactions != NULL)
+ if (intermolecular_interactions != nullptr)
{
/* Process the intermolecular interaction list */
snew(mtop->intermolecular_ilist, F_NRE);
for (i = 0; (i < F_NRE); i++)
{
mtop->intermolecular_ilist[i].nr = 0;
- mtop->intermolecular_ilist[i].iatoms = NULL;
+ mtop->intermolecular_ilist[i].iatoms = nullptr;
plist = intermolecular_interactions->plist;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,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.
char *ptr;
cptr = strrchr(filename, DIR_SEPARATOR);
- if (cptr != NULL)
+ if (cptr != nullptr)
{
/* Skip the separator */
cptr += 1;
strcpy(filebase, cptr);
/* Remove the extension */
ptr = strrchr(filebase, '.');
- if (ptr != NULL)
+ if (ptr != nullptr)
{
ptr[0] = '\0';
}
file_fullpath = low_gmxlibfn(file, TRUE, FALSE);
- if (file_fullpath == NULL)
+ if (file_fullpath == nullptr)
{
return FALSE;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* Add all the impropers from the residue database to the list. */
nimproper = 0;
start = 0;
- if (hb != NULL)
+ if (hb != nullptr)
{
for (i = 0; (i < atoms->nres); i++)
{
srenew(*improper, nalloc);
}
/* Not broken out */
- set_p(&((*improper)[nimproper]), ai, NULL, impropers->b[j].s);
+ set_p(&((*improper)[nimproper]), ai, nullptr, impropers->b[j].s);
nimproper++;
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
snew(vsiteconflist, 1);
snew(vsitetoplist, 1);
- while (fgets2(pline, STRLEN-2, ddb) != NULL)
+ while (fgets2(pline, STRLEN-2, ddb) != nullptr)
{
strip_comment(pline);
trim(pline);
if (pline[0] == OPENDIR)
{
strncpy(dirstr, pline+1, STRLEN-2);
- if ((ch = strchr (dirstr, CLOSEDIR)) != NULL)
+ if ((ch = strchr (dirstr, CLOSEDIR)) != nullptr)
{
(*ch) = 0;
}
srenew(vsitetoplist[i].bond, k+1);
strncpy(vsitetoplist[i].bond[k].atom1, s1, MAXNAME-1);
strncpy(vsitetoplist[i].bond[k].atom2, s2, MAXNAME-1);
- vsitetoplist[i].bond[k].value = strtod(s3, NULL);
+ vsitetoplist[i].bond[k].value = strtod(s3, nullptr);
}
else if (n == 4)
{
strncpy(vsitetoplist[i].angle[k].atom1, s1, MAXNAME-1);
strncpy(vsitetoplist[i].angle[k].atom2, s2, MAXNAME-1);
strncpy(vsitetoplist[i].angle[k].atom3, s3, MAXNAME-1);
- vsitetoplist[i].angle[k].value = strtod(s4, NULL);
+ vsitetoplist[i].angle[k].value = strtod(s4, nullptr);
}
else
{
}
else
{
- return NULL;
+ return nullptr;
}
}
{ NOTSET, NOTSET, NOTSET, NOTSET, NOTSET, NOTSET };
c[0] = b;
- add_param(plist, ai, aj, c, NULL);
+ add_param(plist, ai, aj, c, nullptr);
}
static void add_vsites(t_params plist[], int vsite_type[],
srenew(*newcgnr, at->nr+*nadd);
for (j = 0; j < NMASS; j++)
{
- (*newatomname)[at->nr+*nadd-1-j] = NULL;
+ (*newatomname)[at->nr+*nadd-1-j] = nullptr;
}
/* Dummy masses will be placed at the center-of-mass in each ring. */
srenew(*newatomname, at->nr+*nadd);
srenew(*newvsite_type, at->nr+*nadd);
srenew(*newcgnr, at->nr+*nadd);
- (*newatomname)[at->nr+*nadd-1] = NULL;
+ (*newatomname)[at->nr+*nadd-1] = nullptr;
/* Calc the dummy mass initial position */
rvec_sub(x[ats[atHH]], x[ats[atOH]], r1);
t_atom *newatom;
t_params *params;
char ***newatomname;
- char *resnm = NULL;
+ char *resnm = nullptr;
int ndb, f;
char **db;
int nvsiteconf, nvsitetop, cmplength;
{ "CG", /* PHE */
"CD1", "HD1", "CD2", "HD2",
"CE1", "HE1", "CE2", "HE2",
- "CZ", "HZ", NULL },
+ "CZ", "HZ", nullptr },
{ "CB", /* TRP */
"CG",
"CD1", "HD1", "CD2",
"NE1", "HE1", "CE2", "CE3", "HE3",
"CZ2", "HZ2", "CZ3", "HZ3",
- "CH2", "HH2", NULL },
+ "CH2", "HH2", nullptr },
{ "CG", /* TYR */
"CD1", "HD1", "CD2", "HD2",
"CE1", "HE1", "CE2", "HE2",
- "CZ", "OH", "HH", NULL },
+ "CZ", "OH", "HH", nullptr },
{ "CG", /* HIS */
"ND1", "HD1", "CD2", "HD2",
- "CE1", "HE1", "NE2", "HE2", NULL }
+ "CE1", "HE1", "NE2", "HE2", nullptr }
};
if (debug)
ndb = fflib_search_file_end(ffdir, ".vsd", FALSE, &db);
nvsiteconf = 0;
- vsiteconflist = NULL;
+ vsiteconflist = nullptr;
nvsitetop = 0;
- vsitetop = NULL;
+ vsitetop = nullptr;
for (f = 0; f < ndb; f++)
{
read_vsite_database(db[f], &vsiteconflist, &nvsiteconf, &vsitetop, &nvsitetop);
strcpy(nexttpname, get_atomtype_name(get_atype(heavies[0], at, nrtp, rtp, rt), atype));
ch = get_dummymass_name(vsiteconflist, nvsiteconf, tpname, nexttpname);
- if (ch == NULL)
+ if (ch == nullptr)
{
if (ndb > 0)
{
for (j = 0; j < NMASS; j++)
{
- newatomname[at->nr+nadd-1-j] = NULL;
+ newatomname[at->nr+nadd-1-j] = nullptr;
}
/* calculate starting position for the masses */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
t_filenm fnm[] = {
{ efSTX, "-f", "conf", ffREAD },
{ efSTO, "-o", "out", ffWRITE },
- { efTRX, "-trj", NULL, ffOPTRD }
+ { efTRX, "-trj", nullptr, ffOPTRD }
};
#define NFILE asize(fnm)
static rvec nrbox = {1, 1, 1};
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* first the termini */
for (i = 0; i < nterpairs; i++)
{
- if (ntdb[i] != NULL)
+ if (ntdb[i] != nullptr)
{
copy_t_hackblock(ntdb[i], &hb[rN[i]]);
}
- if (ctdb[i] != NULL)
+ if (ctdb[i] != nullptr)
{
merge_t_hackblock(ctdb[i], &hb[rC[i]]);
}
ahptr = search_h_db(nah, ah, *pdba->resinfo[rnr].rtp);
if (ahptr)
{
- if (hb[rnr].name == NULL)
+ if (hb[rnr].name == nullptr)
{
hb[rnr].name = gmx_strdup(ahptr->name);
}
}
if (!bIgnore &&
- ( ( ( hbr->hack[j].tp > 0 || hbr->hack[j].oname == NULL ) &&
+ ( ( ( hbr->hack[j].tp > 0 || hbr->hack[j].oname == nullptr ) &&
strcmp(atomname, hbr->hack[j].ai()) == 0 ) ||
- ( hbr->hack[j].oname != NULL &&
+ ( hbr->hack[j].oname != nullptr &&
strcmp(atomname, hbr->hack[j].oname) == 0) ) )
{
/* now expand all hacks for this atom */
(*abi)[*nabi + k].bXSet = FALSE;
/* if we're adding (oname==NULL) and don't have a new name (nname)
yet, build it from atomname */
- if ( (*abi)[*nabi + k].nname == NULL)
+ if ( (*abi)[*nabi + k].nname == nullptr)
{
- if ( (*abi)[*nabi + k].oname == NULL)
+ if ( (*abi)[*nabi + k].oname == nullptr)
{
(*abi)[*nabi + k].nname = gmx_strdup(atomname);
(*abi)[*nabi + k].nname[0] = 'H';
(*nabi) += hbr->hack[j].nr;
/* add hacks to atoms we've just added */
- if (hbr->hack[j].tp > 0 || hbr->hack[j].oname == NULL)
+ if (hbr->hack[j].tp > 0 || hbr->hack[j].oname == nullptr)
{
for (k = 0; k < hbr->hack[j].nr; k++)
{
rnr = pdba->atom[i].resind;
for (j = 0; j < nab[i]; j++)
{
- if (ab[i][j].oname == NULL)
+ if (ab[i][j].oname == nullptr)
{
/* we're adding */
- if (ab[i][j].nname == NULL)
+ if (ab[i][j].nname == nullptr)
{
gmx_incons("ab[i][j].nname not allocated");
}
nadd++;
}
}
- else if (ab[i][j].nname == NULL)
+ else if (ab[i][j].nname == nullptr)
{
/* we're deleting */
nadd--;
for (j = 0; j < nab[i]; j += ab[i][j].nr)
{
/* check if we're adding: */
- if (ab[i][j].oname == NULL && ab[i][j].tp > 0)
+ if (ab[i][j].oname == nullptr && ab[i][j].tp > 0)
{
bFoundAll = TRUE;
for (m = 0; (m < ab[i][j].nctl && bFoundAll); m++)
int **nabptr, t_hack ***abptr,
gmx_bool bUpdate_pdba, gmx_bool bKeep_old_pdba)
{
- t_atoms *newpdba = NULL, *pdba = NULL;
+ t_atoms *newpdba = nullptr, *pdba = nullptr;
int nadd;
int i, newi, j, natoms, nalreadypresent;
- int *nab = NULL;
- t_hack **ab = NULL;
+ int *nab = nullptr;
+ t_hack **ab = nullptr;
t_hackblock *hb;
rvec *xn;
gmx_bool bKeep_ab;
for (i = 0; (i < natoms); i++)
{
/* check if this atom wasn't scheduled for deletion */
- if (nab[i] == 0 || (ab[i][0].nname != NULL) )
+ if (nab[i] == 0 || (ab[i][0].nname != nullptr) )
{
if (newi >= natoms+nadd)
{
nalreadypresent = 0;
for (j = 0; j < nab[i]; j++)
{
- if (ab[i][j].oname == NULL) /* add */
+ if (ab[i][j].oname == nullptr) /* add */
{
newi++;
if (newi >= natoms+nadd)
fprintf(debug, " + %d", newi+1);
}
}
- if (ab[i][j].nname != NULL &&
- (ab[i][j].oname == NULL ||
+ if (ab[i][j].nname != nullptr &&
+ (ab[i][j].oname == nullptr ||
strcmp(ab[i][j].oname, *newpdba->atomname[newi]) == 0))
{
/* add or replace */
- if (ab[i][j].oname == NULL && ab[i][j].bAlreadyPresent)
+ if (ab[i][j].oname == nullptr && ab[i][j].bAlreadyPresent)
{
/* This atom is already present, copy it from the input. */
nalreadypresent++;
}
snew(newpdba->atomname[newi], 1);
*newpdba->atomname[newi] = gmx_strdup(ab[i][j].nname);
- if (ab[i][j].oname != NULL && ab[i][j].atom) /* replace */
- { /* newpdba->atom[newi].m = ab[i][j].atom->m; */
+ if (ab[i][j].oname != nullptr && ab[i][j].atom) /* replace */
+ { /* newpdba->atom[newi].m = ab[i][j].atom->m; */
/* newpdba->atom[newi].q = ab[i][j].atom->q; */
/* newpdba->atom[newi].type = ab[i][j].atom->type; */
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
} t_define;
static int ndef = 0;
-static t_define *defs = NULL;
+static t_define *defs = nullptr;
static int nincl = 0;
-static char **incl = 0;
+static char **incl = nullptr;
/* enum used for handling ifdefs */
enum {
{
const char *ptr;
- while ((ptr = strstr(buf, word)) != NULL)
+ while ((ptr = strstr(buf, word)) != nullptr)
{
/* Check if we did not find part of a longer word */
if (ptr &&
buf = ptr + strlen(word);
}
- return NULL;
+ return nullptr;
}
static gmx_bool find_directive(char *buf, char **name, char **val)
}
}
/* Check if anything is remaining */
- *val = (*buf != 0) ? buf : NULL;
+ *val = (*buf != 0) ? buf : nullptr;
return TRUE;
}
{
int i;
- if (include == NULL)
+ if (include == nullptr)
{
return;
}
sfree(incl[i]);
}
sfree(incl);
- incl = NULL;
+ incl = nullptr;
nincl = 0;
}
}
else
{
- defs[i].def = NULL;
+ defs[i].def = nullptr;
}
}
sfree(defs[i].def);
}
sfree(defs);
- defs = NULL;
+ defs = nullptr;
ndef = 0;
}
}
else
{
- add_define(cppopts[i] + 2, NULL);
+ add_define(cppopts[i] + 2, nullptr);
}
}
i++;
snew(cpp, 1);
*handle = cpp;
- cpp->fn = NULL;
+ cpp->fn = nullptr;
/* Find the file. First check whether it is in the current directory. */
if (gmx_fexist(filenm))
{
{
gmx_fatal(FARGS, "Topology include file \"%s\" not found", filenm);
}
- if (NULL != debug)
+ if (nullptr != debug)
{
fprintf(debug, "GMXCPP: cpp file open %s\n", cpp->fn);
}
ptr = strrchr(cpp->fn, '/');
ptr2 = strrchr(cpp->fn, DIR_SEPARATOR);
- if (ptr == NULL || (ptr2 != NULL && ptr2 > ptr))
+ if (ptr == nullptr || (ptr2 != nullptr && ptr2 > ptr))
{
ptr = ptr2;
}
- if (ptr == NULL)
+ if (ptr == nullptr)
{
- cpp->path = NULL;
- cpp->cwd = NULL;
+ cpp->path = nullptr;
+ cpp->cwd = nullptr;
}
else
{
snew(cpp->cwd, STRLEN);
gmx_getcwd(cpp->cwd, STRLEN);
- if (NULL != debug)
+ if (nullptr != debug)
{
fprintf(debug, "GMXCPP: cwd %s\n", cpp->cwd);
}
gmx_chdir(cpp->path);
- if (NULL != debug)
+ if (nullptr != debug)
{
fprintf(debug, "GMXCPP: chdir to %s\n", cpp->path);
}
}
cpp->line_len = 0;
- cpp->line = NULL;
+ cpp->line = nullptr;
cpp->line_nr = 0;
cpp->nifdef = 0;
- cpp->ifdefs = NULL;
- cpp->child = NULL;
- cpp->parent = NULL;
- if (cpp->fp == NULL)
+ cpp->ifdefs = nullptr;
+ cpp->child = nullptr;
+ cpp->parent = nullptr;
+ if (cpp->fp == nullptr)
{
- if (NULL != debug)
+ if (nullptr != debug)
{
fprintf(debug, "GMXCPP: opening file %s\n", cpp->fn);
}
cpp->fp = fopen(cpp->fn, "r");
}
- if (cpp->fp == NULL)
+ if (cpp->fp == nullptr)
{
switch (errno)
{
inc_fn, i0, len);
}
/* Open include file and store it as a child in the handle structure */
- status = cpp_open_file(inc_fn, &(handle->child), NULL);
+ status = cpp_open_file(inc_fn, &(handle->child), nullptr);
sfree(inc_fn);
if (status != eCPP_OK)
{
- handle->child = NULL;
+ handle->child = nullptr;
return status;
}
/* Make a linked list of open files and move on to the include file */
if (!bEOF)
{
/* Read the actual line now. */
- if (fgets2(buf, n-1, handle->fp) == NULL)
+ if (fgets2(buf, n-1, handle->fp) == nullptr)
{
/* Recheck EOF, since we could have been at the end before
* the fgets2 call, but we need to read past the end to know.
if (bEOF)
{
- if (handle->parent == NULL)
+ if (handle->parent == nullptr)
{
return eCPP_EOF;
}
cpp_close_file(handlep);
*handlep = handle->parent;
- handle->child = NULL;
+ handle->child = nullptr;
return cpp_read_line(handlep, n, buf);
}
else
{
nn = 0;
ptr = buf;
- while ((ptr = strstrw(ptr, defs[i].name)) != NULL)
+ while ((ptr = strstrw(ptr, defs[i].name)) != nullptr)
{
nn++;
ptr += strlen(defs[i].name);
len = strlen(buf) + nn*std::max(four, four+strlen(defs[i].def)-strlen(defs[i].name));
snew(name, len);
ptr = buf;
- while ((ptr2 = strstrw(ptr, defs[i].name)) != NULL)
+ while ((ptr2 = strstrw(ptr, defs[i].name)) != nullptr)
{
strncat(name, ptr, (int)(ptr2-ptr));
strcat(name, defs[i].def);
fprintf(debug, "GMXCPP: closing file %s\n", handle->fn);
}
fclose(handle->fp);
- if (NULL != handle->cwd)
+ if (nullptr != handle->cwd)
{
- if (NULL != debug)
+ if (nullptr != debug)
{
fprintf(debug, "GMXCPP: chdir to %s\n", handle->cwd);
}
return eCPP_UNKNOWN;
}
}
- handle->fp = NULL;
+ handle->fp = nullptr;
handle->line_nr = 0;
- if (NULL != handle->fn)
+ if (nullptr != handle->fn)
{
sfree(handle->fn);
- handle->fn = NULL;
+ handle->fn = nullptr;
}
- if (NULL != handle->line)
+ if (nullptr != handle->line)
{
sfree(handle->line);
- handle->line = NULL;
+ handle->line = nullptr;
}
- if (NULL != handle->ifdefs)
+ if (nullptr != handle->ifdefs)
{
sfree(handle->ifdefs);
}
handle->nifdef = 0;
- if (NULL != handle->path)
+ if (nullptr != handle->path)
{
sfree(handle->path);
}
- if (NULL != handle->cwd)
+ if (nullptr != handle->cwd)
{
sfree(handle->cwd);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2011,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.
{
if ((nt < 0) || (nt >= ga->nr))
{
- return NULL;
+ return nullptr;
}
return *(ga->atomname[nt]);
snew(ga, 1);
ga->nr = 0;
- ga->atom = NULL;
- ga->atomname = NULL;
- ga->nb = NULL;
- ga->bondatomtype = NULL;
- ga->radius = NULL;
- ga->vol = NULL;
- ga->surftens = NULL;
- ga->atomnumber = NULL;
- ga->gb_radius = NULL;
- ga->S_hct = NULL;
+ ga->atom = nullptr;
+ ga->atomname = nullptr;
+ ga->nb = nullptr;
+ ga->bondatomtype = nullptr;
+ ga->radius = nullptr;
+ ga->vol = nullptr;
+ ga->surftens = nullptr;
+ ga->atomnumber = nullptr;
+ ga->gb_radius = nullptr;
+ ga->S_hct = nullptr;
return ga;
}
{
if (strcmp(*ga->atomname[i], name) == 0)
{
- if (NULL != debug)
+ if (nullptr != debug)
{
fprintf(debug, "Trying to add atomtype %s again. Skipping it.\n", name);
}
}
/* Renumber nlist */
- nbsnew = NULL;
+ nbsnew = nullptr;
snew(nbsnew, plist[ftype].nr);
nrfp = NRFP(ftype);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2011,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.
if ((nt < 0) || (nt >= ga->nr))
{
- return NULL;
+ return nullptr;
}
return *(ga->atomname[nt]);
ga->nr = 0;
sfree(ga);
- *at = NULL;
+ *at = nullptr;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
w_a1 = w_a2 = -1;
w_period2 = -1.0;
- w_moltype = NULL;
+ w_moltype = nullptr;
for (molt = 0; molt < mtop->nmoltype; molt++)
{
moltype = &mtop->moltype[molt];
}
}
if (!bFound &&
- (w_moltype == NULL || period2 < w_period2))
+ (w_moltype == nullptr || period2 < w_period2))
{
w_moltype = moltype;
w_a1 = a1;
}
}
- if (w_moltype != NULL)
+ if (w_moltype != nullptr)
{
bWarn = (w_period2 < gmx::square(min_steps_warn*dt));
/* A check that would recognize most water models */
gmx_bool bMorse,
warninp_t wi)
{
- t_molinfo *molinfo = NULL;
+ t_molinfo *molinfo = nullptr;
int nmolblock;
gmx_molblock_t *molblock, *molbs;
int mb, i, nrmols, nmismatch;
}
t_topology *conftop;
- rvec *x = NULL;
- rvec *v = NULL;
+ rvec *x = nullptr;
+ rvec *v = nullptr;
snew(conftop, 1);
init_state(state, 0, 0, 0, 0, 0);
- read_tps_conf(confin, conftop, NULL, &x, &v, state->box, FALSE);
+ read_tps_conf(confin, conftop, nullptr, &x, &v, state->box, FALSE);
state->natoms = conftop->atoms.nr;
if (state->natoms != sys->natoms)
{
copy_rvec(x[i], state->x[i]);
}
sfree(x);
- if (v != NULL)
+ if (v != nullptr)
{
state->flags |= (1 << estV);
state->v.resize(state->natoms);
t_atom *atom;
snew(top, 1);
- read_tps_conf(fn, top, NULL, &x, &v, box, FALSE);
+ read_tps_conf(fn, top, nullptr, &x, &v, box, FALSE);
natoms = top->atoms.nr;
done_top(top);
sfree(top);
char warn_buf[STRLEN];
t_filenm fnm[] = {
- { efMDP, NULL, NULL, ffREAD },
+ { efMDP, nullptr, nullptr, ffREAD },
{ efMDP, "-po", "mdout", ffWRITE },
- { efSTX, "-c", NULL, ffREAD },
- { efSTX, "-r", NULL, ffOPTRD },
- { efSTX, "-rb", NULL, ffOPTRD },
- { efNDX, NULL, NULL, ffOPTRD },
- { efTOP, NULL, NULL, ffREAD },
+ { efSTX, "-c", nullptr, ffREAD },
+ { efSTX, "-r", nullptr, ffOPTRD },
+ { efSTX, "-rb", nullptr, ffOPTRD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
+ { efTOP, nullptr, nullptr, ffREAD },
{ efTOP, "-pp", "processed", ffOPTWR },
- { efTPR, "-o", NULL, ffWRITE },
- { efTRN, "-t", NULL, ffOPTRD },
- { efEDR, "-e", NULL, ffOPTRD },
+ { efTPR, "-o", nullptr, ffWRITE },
+ { efTRN, "-t", nullptr, ffOPTRD },
+ { efEDR, "-e", nullptr, ffOPTRD },
/* This group is needed by the VMD viewer as the start configuration for IMD sessions: */
{ efGRO, "-imd", "imdgroup", ffOPTWR },
{ efTRN, "-ref", "rotref", ffOPTRW }
/* Parse the command line */
if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa,
- asize(desc), desc, 0, NULL, &oenv))
+ asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
}
else
{
- if (ir->fepvals->all_lambda[i] == NULL)
+ if (ir->fepvals->all_lambda[i] == nullptr)
{
gmx_fatal(FARGS, "Values of lambda not set for a free energy calculation!");
}
}
}
- struct pull_t *pull = NULL;
+ struct pull_t *pull = nullptr;
if (ir->bPull)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
for (; i < 4; i++)
{
- hack->a[i] = NULL;
+ hack->a[i] = nullptr;
}
- hack->oname = NULL;
+ hack->oname = nullptr;
hack->nname = gmx_strdup(hn);
- hack->atom = NULL;
+ hack->atom = nullptr;
hack->cgnr = NOTSET;
hack->bXSet = FALSE;
for (i = 0; i < DIM; i++)
"while reading Hydrogen Database %s residue %s",
nab, i-1, aah[nah].name, hfn);
}
- if (NULL == fgets(buf, STRLEN, in))
+ if (nullptr == fgets(buf, STRLEN, in))
{
gmx_fatal(FARGS, "Error reading from file %s", hfn);
}
*/
nhdbf = fflib_search_file_end(ffdir, ".hdb", FALSE, &hdbf);
nah = 0;
- *ah = NULL;
+ *ah = nullptr;
for (f = 0; f < nhdbf; f++)
{
read_h_db_file(hdbf[f], &nah, ah);
if (nh <= 0)
{
- return NULL;
+ return nullptr;
}
ahkey.name = key;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2011,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.
free_t_bonded(&rbs->b[i]);
}
sfree(rbs->b);
- rbs->b = NULL;
+ rbs->b = nullptr;
rbs->nb = 0;
}
}
}
sfree(*h);
- *h = NULL;
+ *h = nullptr;
}
void free_t_hackblock(int nhb, t_hackblock **hb)
{
int i;
- hb->name = NULL;
+ hb->name = nullptr;
hb->nhack = 0;
hb->maxhack = 0;
- hb->hack = NULL;
+ hb->hack = nullptr;
for (i = 0; i < ebtsNR; i++)
{
hb->rb[i].nb = 0;
- hb->rb[i].b = NULL;
+ hb->rb[i].b = nullptr;
}
}
int i;
hack->nr = 0;
- hack->oname = NULL;
- hack->nname = NULL;
- hack->atom = NULL;
+ hack->oname = nullptr;
+ hack->nname = nullptr;
+ hack->atom = nullptr;
hack->cgnr = NOTSET;
hack->tp = 0;
hack->nctl = 0;
for (i = 0; i < 4; i++)
{
- hack->a[i] = NULL;
+ hack->a[i] = nullptr;
}
for (i = 0; i < DIM; i++)
{
{
d->rb[i].type = s->rb[i].type;
d->rb[i].nb = 0;
- d->rb[i].b = NULL;
+ d->rb[i].b = nullptr;
}
merge_t_bondeds(s->rb, d->rb, FALSE, FALSE);
}
}
else
{
- d->atom = NULL;
+ d->atom = nullptr;
}
for (i = 0; i < 4; i++)
{
*d = *s;
d->name = safe_strdup(s->name);
d->nhack = 0;
- d->hack = NULL;
+ d->hack = nullptr;
for (i = 0; i < ebtsNR; i++)
{
d->rb[i].nb = 0;
- d->rb[i].b = NULL;
+ d->rb[i].b = nullptr;
}
merge_t_hackblock(s, d);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
if (enum_rot == en_rotXYZ || enum_rot == en_rotZ)
{
- rotate_conf(xout->size(), as_rvec_array(xout->data()), NULL, alfa, beta, gamma);
+ rotate_conf(xout->size(), as_rvec_array(xout->data()), nullptr, alfa, beta, gamma);
}
for (size_t i = 0; i < xout->size(); ++i)
{
set_pbc(&pbc, ePBC, box);
/* With -ip, take nmol_insrt from file posfn */
- double **rpos = NULL;
+ double **rpos = nullptr;
const bool insertAtPositions = !posfn.empty();
if (insertAtPositions)
{
originalAtomCount - atoms->nr);
}
- if (rpos != NULL)
+ if (rpos != nullptr)
{
for (int i = 0; i < DIM; ++i)
{
InsertMolecules()
: bBox_(false), nmolIns_(0), nmolTry_(10), seed_(0),
defaultDistance_(0.105), scaleFactor_(0.57), enumRot_(en_rotXYZ),
- top_(NULL), ePBC_(-1)
+ top_(nullptr), ePBC_(-1)
{
clear_rvec(newBox_);
clear_rvec(deltaR_);
}
virtual ~InsertMolecules()
{
- if (top_ != NULL)
+ if (top_ != nullptr)
{
done_mtop(top_);
sfree(top_);
snew(top_, 1);
if (!inputConfFile_.empty())
{
- readConformation(inputConfFile_.c_str(), top_, &x_, NULL,
+ readConformation(inputConfFile_.c_str(), top_, &x_, nullptr,
&ePBC_, box_, "solute");
if (top_->natoms == 0)
{
int ePBC_dummy;
matrix box_dummy;
readConformation(insertConfFile_.c_str(), top_insrt, &x_insrt,
- NULL, &ePBC_dummy, box_dummy, "molecule");
+ nullptr, &ePBC_dummy, box_dummy, "molecule");
if (top_insrt->atoms.nr == 0)
{
gmx_fatal(FARGS, "No molecule in %s, please check your input",
insertConfFile_.c_str());
}
- if (top_->name == NULL)
+ if (top_->name == nullptr)
{
top_->name = top_insrt->name;
}
fprintf(stderr, "Writing generated configuration to %s\n",
outputConfFile_.c_str());
write_sto_conf(outputConfFile_.c_str(), *top_->name, &atoms,
- as_rvec_array(x_.data()), NULL, ePBC_, box_);
+ as_rvec_array(x_.data()), nullptr, ePBC_, box_);
/* print size of generated configuration */
fprintf(stderr, "\nOutput configuration contains %d atoms in %d residues\n",
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
char buf[1024], elem[16], type[16], nbbuf[16], **newbuf;
int i, nb, nnnm, line = 1;
double qq, mm;
- t_nm2type *nm2t = NULL;
+ t_nm2type *nm2t = nullptr;
fp = fflib_open(fn);
- if (NULL == fp)
+ if (nullptr == fp)
{
gmx_fatal(FARGS, "Can not find %s in library directory", fn);
}
do
{
/* Read a line from the file */
- bCont = (fgets2(buf, 1023, fp) != NULL);
+ bCont = (fgets2(buf, 1023, fp) != nullptr);
if (bCont)
{
}
else
{
- newbuf = NULL;
+ newbuf = nullptr;
}
nm2t[nnnm].elem = gmx_strdup(elem);
nm2t[nnnm].type = gmx_strdup(type);
nff = fflib_search_file_end(ffdir, ".n2t", FALSE, &ff);
*nnm = 0;
- nm = NULL;
+ nm = nullptr;
for (f = 0; f < nff; f++)
{
rd_nm2type_file(ff[f], nnm, &nm);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
char *nn;
int i;
- nn = NULL;
+ nn = nullptr;
i = 0;
while (i < nrr && ((!bCompareFFRTPname && strcmp(name, rr[i].gmx) != 0) ||
char *nn;
gmx_bool bFFRTPTERRNM;
- bFFRTPTERRNM = (getenv("GMX_NO_FFRTP_TER_RENAME") == NULL);
+ bFFRTPTERRNM = (getenv("GMX_NO_FFRTP_TER_RENAME") == nullptr);
for (r = 0; r < pdba->nres; r++)
{
nn = search_resrename(nrr, rr, *pdba->resinfo[r].rtp, bStart, bEnd, FALSE);
- if (bFFRTPTERRNM && nn == NULL && (bStart || bEnd))
+ if (bFFRTPTERRNM && nn == nullptr && (bStart || bEnd))
{
/* This is a terminal residue, but the residue name,
* currently stored in .rtp, is not a standard residue name,
*pdba->resinfo[r].rtp, bStart, bEnd, TRUE);
}
- if (nn != NULL && strcmp(*pdba->resinfo[r].rtp, nn) != 0)
+ if (nn != nullptr && strcmp(*pdba->resinfo[r].rtp, nn) != 0)
{
if (bVerbose)
{
for (i = 0; (i < pdba->nres); i++)
{
- if (pdba->resinfo[i].rtp == NULL)
+ if (pdba->resinfo[i].rtp == nullptr)
{
pdba->resinfo[i].rtp = pdba->resinfo[i].name;
}
{
resnm = *pdba->resinfo[i].name;
if ((bFullCompare && (gmx_strcasecmp(resnm, oldnm) == 0)) ||
- (!bFullCompare && strstr(resnm, oldnm) != NULL))
+ (!bFullCompare && strstr(resnm, oldnm) != nullptr))
{
/* Rename the residue name (not the rtp name) */
pdba->resinfo[i].name = put_symtab(symtab, newnm);
/* We have not set the rtp name yes, use the residue name */
bbnm = *pdba->resinfo[i].name;
if ((bFullCompare && (gmx_strcasecmp(bbnm, oldnm) == 0)) ||
- (!bFullCompare && strstr(bbnm, oldnm) != NULL))
+ (!bFullCompare && strstr(bbnm, oldnm) != nullptr))
{
/* Change the rtp builing block name */
pdba->resinfo[i].rtp = put_symtab(symtab, newnm);
/* We have not set the rtp name yes, use the residue name */
bbnm = *pdba->resinfo[i].name;
if ((bFullCompare && (strcmp(bbnm, oldnm) == 0)) ||
- (!bFullCompare && strstr(bbnm, oldnm) != NULL))
+ (!bFullCompare && strstr(bbnm, oldnm) != nullptr))
{
ptr = gettp(i, nrr, rr);
pdba->resinfo[i].rtp = put_symtab(symtab, ptr);
printf("Reading %s...\n", inf);
t_topology *top;
snew(top, 1);
- read_tps_conf(inf, top, ePBC, x, NULL, box, FALSE);
+ read_tps_conf(inf, top, ePBC, x, nullptr, box, FALSE);
strncpy(title, *top->name, STRLEN);
title[STRLEN-1] = '\0';
*atoms = top->atoms;
sfree(top);
natom = atoms->nr;
- if (atoms->pdbinfo == NULL)
+ if (atoms->pdbinfo == nullptr)
{
snew(atoms->pdbinfo, atoms->nr);
}
rename_pdbres(atoms, "SOL", watres, FALSE, symtab);
rename_pdbres(atoms, "WAT", watres, FALSE, symtab);
- rename_atoms("xlateat.dat", NULL,
- atoms, symtab, NULL, TRUE, rt, TRUE, bVerbose);
+ rename_atoms("xlateat.dat", nullptr,
+ atoms, symtab, nullptr, TRUE, rt, TRUE, bVerbose);
if (natom == 0)
{
if (outf)
{
- write_sto_conf(outf, title, atoms, *x, NULL, *ePBC, box);
+ write_sto_conf(outf, title, atoms, *x, nullptr, *ePBC, box);
}
return natom;
pdba = *pdbaptr;
natoms = pdba->nr;
- pdbnew = NULL;
+ pdbnew = nullptr;
snew(xnew, 1);
snew(pdbi, natoms);
old_prev_chainnum = -1;
new_chainnum = -1;
- this_atomname = NULL;
+ this_atomname = nullptr;
this_atomnum = -1;
- this_resname = NULL;
+ this_resname = nullptr;
this_resnum = -1;
this_chainid = '?';
prev_chainid = this_chainid;
this_atomname = *(pdba->atomname[i]);
- this_atomnum = (pdba->pdbinfo != NULL) ? pdba->pdbinfo[i].atomnr : i+1;
+ this_atomnum = (pdba->pdbinfo != nullptr) ? pdba->pdbinfo[i].atomnr : i+1;
this_resname = *ri->name;
this_resnum = ri->nr;
this_chainid = ri->chainid;
prev_resname, prev_resnum, prev_chainid, prev_atomnum, prev_atomname,
this_resname, this_resnum, this_chainid, this_atomnum, this_atomname);
- if (NULL == fgets(select, STRLEN-1, stdin))
+ if (nullptr == fgets(select, STRLEN-1, stdin))
{
gmx_fatal(FARGS, "Error reading from stdin");
}
};
- FILE *fp, *top_file, *top_file2, *itp_file = NULL;
+ FILE *fp, *top_file, *top_file2, *itp_file = nullptr;
int natom, nres;
t_atoms pdba_all, *pdba;
t_atoms *atoms;
int nrrn;
char **rrn;
int nrtprename;
- rtprename_t *rtprename = NULL;
+ rtprename_t *rtprename = nullptr;
int nah, nNtdb, nCtdb, ntdblist;
t_hackblock *ntdb, *ctdb, **tdblist;
int nssbonds;
t_filenm fnm[] = {
{ efSTX, "-f", "eiwit.pdb", ffREAD },
{ efSTO, "-o", "conf", ffWRITE },
- { efTOP, NULL, NULL, ffWRITE },
+ { efTOP, nullptr, nullptr, ffWRITE },
{ efITP, "-i", "posre", ffWRITE },
{ efNDX, "-n", "clean", ffOPTWR },
{ efSTO, "-q", "clean.pdb", ffOPTWR }
static gmx_bool bRenumRes = FALSE, bRTPresname = FALSE;
static real angle = 135.0, distance = 0.3, posre_fc = 1000;
static real long_bond_dist = 0.25, short_bond_dist = 0.05;
- static const char *vsitestr[] = { NULL, "none", "hydrogens", "aromatics", NULL };
- static const char *watstr[] = { NULL, "select", "none", "spc", "spce", "tip3p", "tip4p", "tip5p", NULL };
- static const char *chainsep[] = { NULL, "id_or_ter", "id_and_ter", "ter", "id", "interactive", NULL };
- static const char *merge[] = {NULL, "no", "all", "interactive", NULL };
+ static const char *vsitestr[] = { nullptr, "none", "hydrogens", "aromatics", nullptr };
+ static const char *watstr[] = { nullptr, "select", "none", "spc", "spce", "tip3p", "tip4p", "tip5p", nullptr };
+ static const char *chainsep[] = { nullptr, "id_or_ter", "id_and_ter", "ter", "id", "interactive", nullptr };
+ static const char *merge[] = {nullptr, "no", "all", "interactive", nullptr };
static const char *ff = "select";
t_pargs pa[] = {
#define NPARGS asize(pa)
if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa, asize(desc), desc,
- 0, NULL, &oenv))
+ 0, nullptr, &oenv))
{
return 0;
}
/* Force field selection, interactive or direct */
- choose_ff(strcmp(ff, "select") == 0 ? NULL : ff,
+ choose_ff(strcmp(ff, "select") == 0 ? nullptr : ff,
forcefield, sizeof(forcefield),
ffdir, sizeof(ffdir));
nrrn = fflib_search_file_end(ffdir, ".r2b", FALSE, &rrn);
nrtprename = 0;
- rtprename = NULL;
+ rtprename = nullptr;
for (i = 0; i < nrrn; i++)
{
fp = fflib_open(rrn[i]);
}
clear_mat(box);
- if (watermodel != NULL && (strstr(watermodel, "4p") ||
- strstr(watermodel, "4P")))
+ if (watermodel != nullptr && (strstr(watermodel, "4p") ||
+ strstr(watermodel, "4P")))
{
watres = "HO4";
}
- else if (watermodel != NULL && (strstr(watermodel, "5p") ||
- strstr(watermodel, "5P")))
+ else if (watermodel != nullptr && (strstr(watermodel, "5p") ||
+ strstr(watermodel, "5P")))
{
watres = "HO5";
}
nchainmerges = 0;
- this_atomname = NULL;
+ this_atomname = nullptr;
this_atomnum = -1;
- this_resname = NULL;
+ this_resname = nullptr;
this_resnum = -1;
this_chainid = '?';
this_chainnumber = -1;
}
this_atomname = *pdba_all.atomname[i];
- this_atomnum = (pdba_all.pdbinfo != NULL) ? pdba_all.pdbinfo[i].atomnr : i+1;
+ this_atomnum = (pdba_all.pdbinfo != nullptr) ? pdba_all.pdbinfo[i].atomnr : i+1;
this_resname = *ri->name;
this_resnum = ri->nr;
this_chainid = ri->chainid;
prev_resname, prev_resnum, prev_chainid, prev_atomnum, prev_atomname,
this_resname, this_resnum, this_chainid, this_atomnum, this_atomname);
- if (NULL == fgets(select, STRLEN-1, stdin))
+ if (nullptr == fgets(select, STRLEN-1, stdin))
{
gmx_fatal(FARGS, "Error reading from stdin");
}
printf("Reading residue database... (%s)\n", forcefield);
nrtpf = fflib_search_file_end(ffdir, ".rtp", TRUE, &rtpf);
nrtp = 0;
- restp = NULL;
+ restp = nullptr;
for (i = 0; i < nrtpf; i++)
{
read_resall(rtpf[i], &nrtp, &restp, atype, &symtab, FALSE);
nincl = 0;
nmol = 0;
- incls = NULL;
- mols = NULL;
+ incls = nullptr;
+ mols = nullptr;
for (chain = 0; (chain < nch); chain++)
{
cc = &(chains[chain]);
{
sprintf(fn, "chain_%c%d.pdb", cc->chainid, cc->chainnum);
}
- write_sto_conf(fn, title, pdba, x, NULL, ePBC, box);
+ write_sto_conf(fn, title, pdba, x, nullptr, ePBC, box);
}
{
printf("No suitable end (N or 5') terminus found in database - assuming this residue\n"
"is already in a terminus-specific form and skipping terminus selection.\n");
- cc->ntdb[i] = NULL;
+ cc->ntdb[i] = nullptr;
}
else
{
}
else
{
- cc->ntdb[i] = NULL;
+ cc->ntdb[i] = nullptr;
}
/* And the C terminus */
{
printf("No suitable end (C or 3') terminus found in database - assuming this residue\n"
"is already in a terminus-specific form and skipping terminus selection.\n");
- cc->ctdb[i] = NULL;
+ cc->ctdb[i] = nullptr;
}
else
{
}
else
{
- cc->ctdb[i] = NULL;
+ cc->ctdb[i] = nullptr;
}
}
/* lookup hackblocks and rtp for all residues */
requires some re-thinking of code in gen_vsite.c, which I won't
do now :( AF 26-7-99 */
- rename_atoms(NULL, ffdir,
+ rename_atoms(nullptr, ffdir,
pdba, &symtab, restp_chain, FALSE, rt, FALSE, bVerbose);
match_atomnames_with_rtp(restp_chain, hb_chain, pdba, x, bVerbose);
printf("Generating any missing hydrogen atoms and/or adding termini.\n");
natom = add_h(&pdba, &x, nah, ah,
cc->nterpairs, cc->ntdb, cc->ctdb, cc->r_start, cc->r_end, bAllowMissing,
- NULL, NULL, TRUE, FALSE);
+ nullptr, nullptr, TRUE, FALSE);
printf("Now there are %d residues with %d atoms\n",
pdba->nres, pdba->nr);
if (debug)
{
- write_pdbfile(debug, title, pdba, x, ePBC, box, ' ', 0, NULL, TRUE);
+ write_pdbfile(debug, title, pdba, x, ePBC, box, ' ', 0, nullptr, TRUE);
}
if (debug)
if (cc->bAllWat)
{
- top_file2 = NULL;
+ top_file2 = nullptr;
}
else
if (bITP)
{
sprintf(fn, "chain_%c.pdb", cc->chainid);
}
- write_sto_conf(fn, "", pdba, x, NULL, ePBC, box);
+ write_sto_conf(fn, "", pdba, x, nullptr, ePBC, box);
}
}
- if (watermodel == NULL)
+ if (watermodel == nullptr)
{
for (chain = 0; chain < nch; chain++)
{
{
make_new_box(atoms->nr, x, box, box_space, FALSE);
}
- write_sto_conf(ftp2fn(efSTO, NFILE, fnm), title, atoms, x, NULL, ePBC, box);
+ write_sto_conf(ftp2fn(efSTO, NFILE, fnm), title, atoms, x, nullptr, ePBC, box);
printf("\t\t--------- PLEASE NOTE ------------\n");
printf("You have successfully generated a topology from: %s.\n",
opt2fn("-f", NFILE, fnm));
- if (watermodel != NULL)
+ if (watermodel != nullptr)
{
printf("The %s force field and the %s water model are used.\n",
ffname, watermodel);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
int sel;
- if (ffsel != NULL)
+ if (ffsel != nullptr)
{
sel = -1;
int cwdsel = -1;
{
pret = fgets(buf, STRLEN, stdin);
- if (pret != NULL)
+ if (pret != nullptr)
{
- sel = strtol(buf, NULL, 10);
+ sel = strtol(buf, nullptr, 10);
sel--;
}
}
- while (pret == NULL || (sel < 0) || (sel >= nff));
+ while (pret == nullptr || (sel < 0) || (sel >= nff));
/* Check for a current limitation of the fflib code.
* It will always read from the first ff directory in the list.
if (strcmp(wmsel, "none") == 0)
{
- *watermodel = NULL;
+ *watermodel = nullptr;
return;
}
{
fprintf(stderr, "No file '%s' found, will not include a water model\n",
fn_watermodels);
- *watermodel = NULL;
+ *watermodel = nullptr;
return;
}
fp = fflib_open(fn_list);
printf("\nSelect the Water Model:\n");
nwm = 0;
- model = NULL;
+ model = nullptr;
while (get_a_line(fp, buf, STRLEN))
{
srenew(model, nwm+1);
{
pret = fgets(buf, STRLEN, stdin);
- if (pret != NULL)
+ if (pret != nullptr)
{
- sel = strtol(buf, NULL, 10);
+ sel = strtol(buf, nullptr, 10);
sel--;
}
}
- while (pret == NULL || sel < 0 || sel > nwm);
+ while (pret == nullptr || sel < 0 || sel > nwm);
if (sel == nwm)
{
- *watermodel = NULL;
+ *watermodel = nullptr;
}
else
{
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
- if (strchr(ffdir, '/') == NULL)
+ if (strchr(ffdir, '/') == nullptr)
{
fprintf(out, ";\tForce field was read from the standard GROMACS share directory.\n;\n\n");
}
fprintf(out, "; Include forcefield parameters\n");
p = strrchr(ffdir, '/');
- p = (ffdir[0] == '.' || p == NULL) ? ffdir : p+1;
+ p = (ffdir[0] == '.' || p == nullptr) ? ffdir : p+1;
fprintf(out, "#include \"%s/%s\"\n\n", p, fflib_forcefield_itp());
}
fprintf(out, "; Include water topology\n");
p = strrchr(ffdir, '/');
- p = (ffdir[0] == '.' || p == NULL) ? ffdir : p+1;
+ p = (ffdir[0] == '.' || p == nullptr) ? ffdir : p+1;
fprintf(out, "#include \"%s/%s.itp\"\n", p, water);
fprintf(out, "\n");
for (i = 0; (i < nincl); i++)
{
incl = strrchr(incls[i], DIR_SEPARATOR);
- if (incl == NULL)
+ if (incl == nullptr)
{
incl = incls[i];
}
gmx_fatal(FARGS, "Trying to make impossible special bond (%s-%s)!",
ssbonds[i].a1, ssbonds[i].a2);
}
- add_param(ps, ai, aj, NULL, NULL);
+ add_param(ps, ai, aj, nullptr, nullptr);
}
}
fprintf(stderr, "Warning: Short Bond (%d-%d = %g nm)\n",
ai+1, aj+1, std::sqrt(dist2));
}
- add_param(psb, ai, aj, NULL, hb[resind].rb[ebtsBONDS].b[j].s);
+ add_param(psb, ai, aj, nullptr, hb[resind].rb[ebtsBONDS].b[j].s);
}
}
/* add bonds from list of hacks (each added atom gets a bond) */
for (j = 0; j < hb[resind].nhack; j++)
{
if ( ( hb[resind].hack[j].tp > 0 ||
- hb[resind].hack[j].oname == NULL ) &&
+ hb[resind].hack[j].oname == nullptr ) &&
strcmp(hb[resind].hack[j].a[0], *(atoms->atomname[i])) == 0)
{
switch (hb[resind].hack[j].tp)
{
- case 9: /* COOH terminus */
- add_param(psb, i, i+1, NULL, NULL); /* C-O */
- add_param(psb, i, i+2, NULL, NULL); /* C-OA */
- add_param(psb, i+2, i+3, NULL, NULL); /* OA-H */
+ case 9: /* COOH terminus */
+ add_param(psb, i, i+1, nullptr, nullptr); /* C-O */
+ add_param(psb, i, i+2, nullptr, nullptr); /* C-OA */
+ add_param(psb, i+2, i+3, nullptr, nullptr); /* OA-H */
break;
default:
for (k = 0; (k < hb[resind].hack[j].nr); k++)
{
- add_param(psb, i, i+k+1, NULL, NULL);
+ add_param(psb, i, i+k+1, nullptr, nullptr);
}
}
}
/* first the termini */
for (i = 0; i < nterpairs; i++)
{
- if (rn[i] >= 0 && ntdb[i] != NULL)
+ if (rn[i] >= 0 && ntdb[i] != nullptr)
{
copy_t_hackblock(ntdb[i], &(*hb)[rn[i]]);
}
- if (rc[i] >= 0 && ctdb[i] != NULL)
+ if (rc[i] >= 0 && ctdb[i] != nullptr)
{
merge_t_hackblock(ctdb[i], &(*hb)[rc[i]]);
}
}
bRM = merge_t_bondeds(res->rb, (*hb)[i].rb, tern >= 0, terc >= 0);
- if (bRM && ((tern >= 0 && ntdb[tern] == NULL) ||
- (terc >= 0 && ctdb[terc] == NULL)))
+ if (bRM && ((tern >= 0 && ntdb[tern] == nullptr) ||
+ (terc >= 0 && ctdb[terc] == nullptr)))
{
gmx_fatal(FARGS, "There is a dangling bond at at least one of the terminal ends and the force field does not provide terminal entries or files. Fix your terminal residues so that they match the residue database (.rtp) entries, or provide terminal database entries (.tdb).");
}
/* find atom in restp */
for (l = 0; l < (*restp)[i].natom; l++)
{
- if ( ( (*hb)[i].hack[j].oname == NULL &&
+ if ( ( (*hb)[i].hack[j].oname == nullptr &&
strcmp((*hb)[i].hack[j].a[0], *(*restp)[i].atomname[l]) == 0 ) ||
- ( (*hb)[i].hack[j].oname != NULL &&
+ ( (*hb)[i].hack[j].oname != nullptr &&
strcmp((*hb)[i].hack[j].oname, *(*restp)[i].atomname[l]) == 0 ) )
{
break;
/* Deleting can happen also only on the input atoms,
* not necessarily always on the rtp entry.
*/
- if (!((*hb)[i].hack[j].oname != NULL &&
- (*hb)[i].hack[j].nname != NULL) &&
- !((*hb)[i].hack[j].oname != NULL &&
- (*hb)[i].hack[j].nname == NULL))
+ if (!((*hb)[i].hack[j].oname != nullptr &&
+ (*hb)[i].hack[j].nname != nullptr) &&
+ !((*hb)[i].hack[j].oname != nullptr &&
+ (*hb)[i].hack[j].nname == nullptr))
{
gmx_fatal(FARGS,
"atom %s not found in buiding block %d%s "
"while combining tdb and rtp",
- (*hb)[i].hack[j].oname != NULL ?
+ (*hb)[i].hack[j].oname != nullptr ?
(*hb)[i].hack[j].oname : (*hb)[i].hack[j].a[0],
i+1, *resinfo[i].rtp);
}
}
else
{
- if ( (*hb)[i].hack[j].oname == NULL)
+ if ( (*hb)[i].hack[j].oname == nullptr)
{
/* we're adding: */
add_atom_to_restp(&(*restp)[i], l, &(*hb)[i].hack[j]);
else
{
/* oname != NULL */
- if ( (*hb)[i].hack[j].nname == NULL)
+ if ( (*hb)[i].hack[j].nname == nullptr)
{
/* we're deleting */
if (debug)
bDeleted = FALSE;
for (j = 0; j < hbr->nhack; j++)
{
- if (hbr->hack[j].oname != NULL && hbr->hack[j].nname != NULL &&
+ if (hbr->hack[j].oname != nullptr && hbr->hack[j].nname != nullptr &&
gmx_strcasecmp(oldnm, hbr->hack[j].oname) == 0)
{
/* This is a replace entry. */
for (k = 0; k < hbr->nhack; k++)
{
if (k != j &&
- hbr->hack[k].oname != NULL && hbr->hack[k].nname != NULL &&
+ hbr->hack[k].oname != nullptr && hbr->hack[k].nname != nullptr &&
gmx_strcasecmp(hbr->hack[k].nname, hbr->hack[j].oname) == 0)
{
/* The replace in hack[j] replaces an atom that
bFoundInAdd = FALSE;
for (k = 0; k < hbr->nhack; k++)
{
- if (hbr->hack[k].oname == NULL &&
- hbr->hack[k].nname != NULL &&
+ if (hbr->hack[k].oname == nullptr &&
+ hbr->hack[k].nname != nullptr &&
atomname_cmp_nr(newnm, &hbr->hack[k], &anmnr))
{
if (anmnr <= 1)
snew(pdba->atomname[atind], 1);
*pdba->atomname[atind] = gmx_strdup(newnm);
}
- else if (hbr->hack[j].oname != NULL && hbr->hack[j].nname == NULL &&
+ else if (hbr->hack[j].oname != nullptr && hbr->hack[j].nname == nullptr &&
gmx_strcasecmp(oldnm, hbr->hack[j].oname) == 0)
{
/* This is a delete entry, check if this atom is present
/* Skip this CMAP entry if it refers to residues before the
* first or after the last residue.
*/
- if (((strchr(pname, '-') != NULL) && (residx == 0)) ||
- ((strchr(pname, '+') != NULL) && (residx == nres-1)))
+ if (((strchr(pname, '-') != nullptr) && (residx == 0)) ||
+ ((strchr(pname, '+') != nullptr) && (residx == nres-1)))
{
bAddCMAP = FALSE;
break;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
t_atom *at = atoms->atom;
char ** const * anm = atoms->atomname;
- bPrevious = (strchr(type, '-') != NULL);
- bNext = (strchr(type, '+') != NULL);
+ bPrevious = (strchr(type, '-') != nullptr);
+ bNext = (strchr(type, '+') != nullptr);
if (!bPrevious)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
fprintf(stderr, "Reading %s configuration%s\n", statusTitle,
v ? " and velocities" : "");
- rvec *x_tmp = NULL, *v_tmp = NULL;
+ rvec *x_tmp = nullptr, *v_tmp = nullptr;
bool dummy;
- readConfAndTopology(confin, &dummy, top, ePBC, x ? &x_tmp : NULL, v ? &v_tmp : NULL, box);
+ readConfAndTopology(confin, &dummy, top, ePBC, x ? &x_tmp : nullptr, v ? &v_tmp : nullptr, box);
const gmx::sfree_guard xguard(x_tmp);
const gmx::sfree_guard vguard(v_tmp);
if (x && x_tmp)
{
fprintf(stderr, "Reading %s configuration%s\n", statusTitle,
v ? " and velocities" : "");
- rvec *x_tmp = NULL, *v_tmp = NULL;
- read_tps_conf(confin, top, ePBC, x ? &x_tmp : NULL, v ? &v_tmp : NULL, box, FALSE);
+ rvec *x_tmp = nullptr, *v_tmp = nullptr;
+ read_tps_conf(confin, top, ePBC, x ? &x_tmp : nullptr, v ? &v_tmp : nullptr, box, FALSE);
const gmx::sfree_guard xguard(x_tmp);
const gmx::sfree_guard vguard(v_tmp);
if (x && x_tmp)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
} gmx_inputrec_strings;
-static gmx_inputrec_strings *is = NULL;
+static gmx_inputrec_strings *is = nullptr;
void init_inputrec_strings()
{
void done_inputrec_strings()
{
sfree(is);
- is = NULL;
+ is = nullptr;
}
};
static const char *constraints[eshNR+1] = {
- "none", "h-bonds", "all-bonds", "h-angles", "all-angles", NULL
+ "none", "h-bonds", "all-bonds", "h-angles", "all-angles", nullptr
};
static const char *couple_lam[ecouplamNR+1] = {
- "vdw-q", "vdw", "q", "none", NULL
+ "vdw-q", "vdw", "q", "none", nullptr
};
void init_ir(t_inputrec *ir, t_gromppopts *opts)
CHECK(EEL_FULL(ir->coulombtype) || ir->implicit_solvent == eisGBSA);
}
- if (getenv("GMX_DO_GALACTIC_DYNAMICS") == NULL)
+ if (getenv("GMX_DO_GALACTIC_DYNAMICS") == nullptr)
{
sprintf(err_buf, "epsilon-r must be >= 0 instead of %g\n", ir->epsilon_r);
CHECK(ir->epsilon_r < 0);
}
ltrim(copy);
}
- if (ptr == NULL)
+ if (ptr == nullptr)
{
sfree(copy0);
}
char *names[MAXPTR];
double dbl;
- opts->wall_atomtype[0] = NULL;
- opts->wall_atomtype[1] = NULL;
+ opts->wall_atomtype[0] = nullptr;
+ opts->wall_atomtype[1] = nullptr;
ir->wall_atomtype[0] = -1;
ir->wall_atomtype[1] = -1;
CCTYPE ("VARIOUS PREPROCESSING OPTIONS");
CTYPE ("Preprocessor information: use cpp syntax.");
CTYPE ("e.g.: -I/home/joe/doe -I/home/mary/roe");
- STYPE ("include", opts->include, NULL);
+ STYPE ("include", opts->include, nullptr);
CTYPE ("e.g.: -DPOSRES -DFLEXIBLE (note these variable names are case sensitive)");
- STYPE ("define", opts->define, NULL);
+ STYPE ("define", opts->define, nullptr);
CCTYPE ("RUN CONTROL PARAMETERS");
EETYPE("integrator", ir->eI, ei_names);
CTYPE ("number of steps for center of mass motion removal");
ITYPE ("nstcomm", ir->nstcomm, 100);
CTYPE ("group(s) for center of mass motion removal");
- STYPE ("comm-grps", is->vcm, NULL);
+ STYPE ("comm-grps", is->vcm, nullptr);
CCTYPE ("LANGEVIN DYNAMICS OPTIONS");
CTYPE ("Friction coefficient (amu/ps) and random seed");
CTYPE ("This selects the subset of atoms for the compressed");
CTYPE ("trajectory file. You can select multiple groups. By");
CTYPE ("default, all atoms will be written.");
- STYPE ("compressed-x-grps", is->x_compressed_groups, NULL);
+ STYPE ("compressed-x-grps", is->x_compressed_groups, nullptr);
CTYPE ("Selection of energy groups");
- STYPE ("energygrps", is->energy, NULL);
+ STYPE ("energygrps", is->energy, nullptr);
/* Neighbor searching */
CCTYPE ("NEIGHBORSEARCHING PARAMETERS");
CTYPE ("Extension of the potential lookup tables beyond the cut-off");
RTYPE ("table-extension", ir->tabext, 1.0);
CTYPE ("Separate tables between energy group pairs");
- STYPE ("energygrp-table", is->egptable, NULL);
+ STYPE ("energygrp-table", is->egptable, nullptr);
CTYPE ("Spacing for the PME/PPPM FFT grid");
RTYPE ("fourierspacing", ir->fourier_spacing, 0.12);
CTYPE ("FFT grid size, when a value is 0 fourierspacing will be used");
ITYPE("nh-chain-length", ir->opts.nhchainlength, 10);
EETYPE("print-nose-hoover-chain-variables", ir->bPrintNHChains, yesno_names);
CTYPE ("Groups to couple separately");
- STYPE ("tc-grps", is->tcgrps, NULL);
+ STYPE ("tc-grps", is->tcgrps, nullptr);
CTYPE ("Time constant (ps) and reference temperature (K)");
- STYPE ("tau-t", is->tau_t, NULL);
- STYPE ("ref-t", is->ref_t, NULL);
+ STYPE ("tau-t", is->tau_t, nullptr);
+ STYPE ("ref-t", is->ref_t, nullptr);
CTYPE ("pressure coupling");
EETYPE("pcoupl", ir->epc, epcoupl_names);
EETYPE("pcoupltype", ir->epct, epcoupltype_names);
ITYPE ("nstpcouple", ir->nstpcouple, -1);
CTYPE ("Time constant (ps), compressibility (1/bar) and reference P (bar)");
RTYPE ("tau-p", ir->tau_p, 1.0);
- STYPE ("compressibility", dumstr[0], NULL);
- STYPE ("ref-p", dumstr[1], NULL);
+ STYPE ("compressibility", dumstr[0], nullptr);
+ STYPE ("ref-p", dumstr[1], nullptr);
CTYPE ("Scaling of reference coordinates, No, All or COM");
EETYPE ("refcoord-scaling", ir->refcoord_scaling, erefscaling_names);
CCTYPE ("OPTIONS FOR QMMM calculations");
EETYPE("QMMM", ir->bQMMM, yesno_names);
CTYPE ("Groups treated Quantum Mechanically");
- STYPE ("QMMM-grps", is->QMMM, NULL);
+ STYPE ("QMMM-grps", is->QMMM, nullptr);
CTYPE ("QM method");
- STYPE("QMmethod", is->QMmethod, NULL);
+ STYPE("QMmethod", is->QMmethod, nullptr);
CTYPE ("QMMM scheme");
EETYPE("QMMMscheme", ir->QMMMscheme, eQMMMscheme_names);
CTYPE ("QM basisset");
- STYPE("QMbasis", is->QMbasis, NULL);
+ STYPE("QMbasis", is->QMbasis, nullptr);
CTYPE ("QM charge");
- STYPE ("QMcharge", is->QMcharge, NULL);
+ STYPE ("QMcharge", is->QMcharge, nullptr);
CTYPE ("QM multiplicity");
- STYPE ("QMmult", is->QMmult, NULL);
+ STYPE ("QMmult", is->QMmult, nullptr);
CTYPE ("Surface Hopping");
- STYPE ("SH", is->bSH, NULL);
+ STYPE ("SH", is->bSH, nullptr);
CTYPE ("CAS space options");
- STYPE ("CASorbitals", is->CASorbitals, NULL);
- STYPE ("CASelectrons", is->CASelectrons, NULL);
- STYPE ("SAon", is->SAon, NULL);
- STYPE ("SAoff", is->SAoff, NULL);
- STYPE ("SAsteps", is->SAsteps, NULL);
+ STYPE ("CASorbitals", is->CASorbitals, nullptr);
+ STYPE ("CASelectrons", is->CASelectrons, nullptr);
+ STYPE ("SAon", is->SAon, nullptr);
+ STYPE ("SAoff", is->SAoff, nullptr);
+ STYPE ("SAsteps", is->SAsteps, nullptr);
CTYPE ("Scale factor for MM charges");
RTYPE ("MMChargeScaleFactor", ir->scalefactor, 1.0);
CTYPE ("Optimization of QM subsystem");
- STYPE ("bOPT", is->bOPT, NULL);
- STYPE ("bTS", is->bTS, NULL);
+ STYPE ("bOPT", is->bOPT, nullptr);
+ STYPE ("bTS", is->bTS, nullptr);
/* Simulated annealing */
CCTYPE("SIMULATED ANNEALING");
CTYPE ("Type of annealing for each temperature group (no/single/periodic)");
- STYPE ("annealing", is->anneal, NULL);
+ STYPE ("annealing", is->anneal, nullptr);
CTYPE ("Number of time points to use for specifying annealing in each group");
- STYPE ("annealing-npoints", is->anneal_npoints, NULL);
+ STYPE ("annealing-npoints", is->anneal_npoints, nullptr);
CTYPE ("List of times at the annealing points for each group");
- STYPE ("annealing-time", is->anneal_time, NULL);
+ STYPE ("annealing-time", is->anneal_time, nullptr);
CTYPE ("Temp. at each annealing point, for each group.");
- STYPE ("annealing-temp", is->anneal_temp, NULL);
+ STYPE ("annealing-temp", is->anneal_temp, nullptr);
/* Startup run */
CCTYPE ("GENERATE VELOCITIES FOR STARTUP RUN");
/* Energy group exclusions */
CCTYPE ("ENERGY GROUP EXCLUSIONS");
CTYPE ("Pairs of energy groups for which all non-bonded interactions are excluded");
- STYPE ("energygrp-excl", is->egpexcl, NULL);
+ STYPE ("energygrp-excl", is->egpexcl, nullptr);
/* Walls */
CCTYPE ("WALLS");
ITYPE ("nwall", ir->nwall, 0);
EETYPE("wall-type", ir->wall_type, ewt_names);
RTYPE ("wall-r-linpot", ir->wall_r_linpot, -1);
- STYPE ("wall-atomtype", is->wall_atomtype, NULL);
- STYPE ("wall-density", is->wall_density, NULL);
+ STYPE ("wall-atomtype", is->wall_atomtype, nullptr);
+ STYPE ("wall-density", is->wall_density, nullptr);
RTYPE ("wall-ewald-zfac", ir->wall_ewald_zfac, 3);
/* COM pulling */
/* Interactive MD */
ir->bIMD = FALSE;
CCTYPE("Group to display and/or manipulate in interactive MD session");
- STYPE ("IMD-group", is->imd_grp, NULL);
+ STYPE ("IMD-group", is->imd_grp, nullptr);
if (is->imd_grp[0] != '\0')
{
snew(ir->imd, 1);
CTYPE ("Orientation restraints force constant and tau for time averaging");
RTYPE ("orire-fc", ir->orires_fc, 0.0);
RTYPE ("orire-tau", ir->orires_tau, 0.0);
- STYPE ("orire-fitgrp", is->orirefitgrp, NULL);
+ STYPE ("orire-fitgrp", is->orirefitgrp, nullptr);
CTYPE ("Output frequency for trace(SD) and S to energy file");
ITYPE ("nstorireout", ir->nstorireout, 100);
/* free energy variables */
CCTYPE ("Free energy variables");
EETYPE("free-energy", ir->efep, efep_names);
- STYPE ("couple-moltype", is->couple_moltype, NULL);
+ STYPE ("couple-moltype", is->couple_moltype, nullptr);
EETYPE("couple-lambda0", opts->couple_lam0, couple_lam);
EETYPE("couple-lambda1", opts->couple_lam1, couple_lam);
EETYPE("couple-intramol", opts->bCoupleIntra, yesno_names);
ITYPE ("init-lambda-state", fep->init_fep_state, -1);
RTYPE ("delta-lambda", fep->delta_lambda, 0.0);
ITYPE ("nstdhdl", fep->nstdhdl, 50);
- STYPE ("fep-lambdas", is->fep_lambda[efptFEP], NULL);
- STYPE ("mass-lambdas", is->fep_lambda[efptMASS], NULL);
- STYPE ("coul-lambdas", is->fep_lambda[efptCOUL], NULL);
- STYPE ("vdw-lambdas", is->fep_lambda[efptVDW], NULL);
- STYPE ("bonded-lambdas", is->fep_lambda[efptBONDED], NULL);
- STYPE ("restraint-lambdas", is->fep_lambda[efptRESTRAINT], NULL);
- STYPE ("temperature-lambdas", is->fep_lambda[efptTEMPERATURE], NULL);
+ STYPE ("fep-lambdas", is->fep_lambda[efptFEP], nullptr);
+ STYPE ("mass-lambdas", is->fep_lambda[efptMASS], nullptr);
+ STYPE ("coul-lambdas", is->fep_lambda[efptCOUL], nullptr);
+ STYPE ("vdw-lambdas", is->fep_lambda[efptVDW], nullptr);
+ STYPE ("bonded-lambdas", is->fep_lambda[efptBONDED], nullptr);
+ STYPE ("restraint-lambdas", is->fep_lambda[efptRESTRAINT], nullptr);
+ STYPE ("temperature-lambdas", is->fep_lambda[efptTEMPERATURE], nullptr);
ITYPE ("calc-lambda-neighbors", fep->lambda_neighbors, 1);
- STYPE ("init-lambda-weights", is->lambda_weights, NULL);
+ STYPE ("init-lambda-weights", is->lambda_weights, nullptr);
EETYPE("dhdl-print-energy", fep->edHdLPrintEnergy, edHdLPrintEnergy_names);
RTYPE ("sc-alpha", fep->sc_alpha, 0.0);
ITYPE ("sc-power", fep->sc_power, 1);
/* Non-equilibrium MD stuff */
CCTYPE("Non-equilibrium MD stuff");
- STYPE ("acc-grps", is->accgrps, NULL);
- STYPE ("accelerate", is->acc, NULL);
- STYPE ("freezegrps", is->freeze, NULL);
- STYPE ("freezedim", is->frdim, NULL);
+ STYPE ("acc-grps", is->accgrps, nullptr);
+ STYPE ("accelerate", is->acc, nullptr);
+ STYPE ("freezegrps", is->freeze, nullptr);
+ STYPE ("freezedim", is->frdim, nullptr);
RTYPE ("cos-acceleration", ir->cos_accel, 0);
- STYPE ("deform", is->deform, NULL);
+ STYPE ("deform", is->deform, nullptr);
/* simulated tempering variables */
CCTYPE("simulated tempering variables");
snew(ir->swap->grp[i].molname, STRLEN);
}
CTYPE("Two index groups that contain the compartment-partitioning atoms");
- STYPE("split-group0", ir->swap->grp[eGrpSplit0].molname, NULL);
- STYPE("split-group1", ir->swap->grp[eGrpSplit1].molname, NULL);
+ STYPE("split-group0", ir->swap->grp[eGrpSplit0].molname, nullptr);
+ STYPE("split-group1", ir->swap->grp[eGrpSplit1].molname, nullptr);
CTYPE("Use center of mass of split groups (yes/no), otherwise center of geometry is used");
EETYPE("massw-split0", ir->swap->massw_split[0], yesno_names);
EETYPE("massw-split1", ir->swap->massw_split[1], yesno_names);
CTYPE("Name of solvent molecules");
- STYPE("solvent-group", ir->swap->grp[eGrpSolvent].molname, NULL);
+ STYPE("solvent-group", ir->swap->grp[eGrpSolvent].molname, nullptr);
CTYPE("Split cylinder: radius, upper and lower extension (nm) (this will define the channels)");
CTYPE("Note that the split cylinder settings do not have an influence on the swapping protocol,");
int ig = eSwapFixedGrpNR + i;
sprintf(buf, "iontype%d-name", i);
- STYPE(buf, ir->swap->grp[ig].molname, NULL);
+ STYPE(buf, ir->swap->grp[ig].molname, nullptr);
sprintf(buf, "iontype%d-in-A", i);
ITYPE(buf, ir->swap->grp[ig].nmolReq[0], -1);
sprintf(buf, "iontype%d-in-B", i);
/* User defined thingies */
CCTYPE ("User defined thingies");
- STYPE ("user1-grps", is->user1, NULL);
- STYPE ("user2-grps", is->user2, NULL);
+ STYPE ("user1-grps", is->user1, nullptr);
+ STYPE ("user2-grps", is->user2, nullptr);
ITYPE ("userint1", ir->userint1, 0);
ITYPE ("userint2", ir->userint2, 0);
ITYPE ("userint3", ir->userint3, 0);
ir->nstcomm = 0;
}
- opts->couple_moltype = NULL;
+ opts->couple_moltype = nullptr;
if (strlen(is->couple_moltype) > 0)
{
if (ir->efep != efepNO)
/* ORIENTATION RESTRAINT PARAMETERS */
- if (opts->bOrire && str_nelem(is->orirefitgrp, MAXPTR, NULL) != 1)
+ if (opts->bOrire && str_nelem(is->orirefitgrp, MAXPTR, nullptr) != 1)
{
warning_error(wi, "ERROR: Need one orientation restraint fit group\n");
}
{
/* All atoms are part of one (or no) group, no index required */
groups->ngrpnr[gtype] = 0;
- groups->grpnr[gtype] = NULL;
+ groups->grpnr[gtype] = nullptr;
}
else
{
{
fprintf(stderr, "processing index file...\n");
}
- if (ndx == NULL)
+ if (ndx == nullptr)
{
snew(grps, 1);
snew(grps->index, 1);
{
ir->opts.annealing[i] = eannNO;
ir->opts.anneal_npoints[i] = 0;
- ir->opts.anneal_time[i] = NULL;
- ir->opts.anneal_temp[i] = NULL;
+ ir->opts.anneal_time[i] = nullptr;
+ ir->opts.anneal_temp[i] = nullptr;
}
if (nSA > 0)
{
*/
tol = 1e-5;
ptr = getenv("GMX_LJCOMB_TOL");
- if (ptr != NULL)
+ if (ptr != nullptr)
{
double dbl;
double gmx_unused canary;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
sprintf(wbuf, "%s should contain %d pull group indices with geometry %s",
buf, pcrd->ngroup, epullg_names[pcrd->eGeom]);
- set_warning_line(wi, NULL, -1);
+ set_warning_line(wi, nullptr, -1);
warning_error(wi, wbuf);
}
for (int g = 0; g < pcrd->ngroup; g++)
double t_start;
pull = ir->pull;
- pull_work = init_pull(NULL, pull, ir, 0, NULL, mtop, NULL, oenv, lambda, FALSE, 0);
- md = init_mdatoms(NULL, mtop, ir->efep);
- atoms2md(mtop, ir, -1, NULL, mtop->natoms, md);
+ pull_work = init_pull(nullptr, pull, ir, 0, nullptr, mtop, nullptr, oenv, lambda, FALSE, 0);
+ md = init_mdatoms(nullptr, mtop, ir->efep);
+ atoms2md(mtop, ir, -1, nullptr, mtop->natoms, md);
if (ir->efep)
{
update_mdatoms(md, lambda);
t_start = ir->init_t + ir->init_step*ir->delta_t;
- pull_calc_coms(NULL, pull_work, md, &pbc, t_start, x, NULL);
+ pull_calc_coms(nullptr, pull_work, md, &pbc, t_start, x, nullptr);
fprintf(stderr, "Pull group natoms pbc atom distance at start reference at t=0\n");
for (c = 0; c < pull->ncoord; c++)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_fatal(FARGS, "Number of atoms in file %s (%d) does not match the number of atoms in rotation group (%d)!\n",
reffile, header.natoms, rotg->nat);
}
- gmx_trr_read_single_frame(reffile, &header.step, &header.t, &header.lambda, f_box, &header.natoms, rotg->x_ref, NULL, NULL);
+ gmx_trr_read_single_frame(reffile, &header.step, &header.t, &header.lambda, f_box, &header.natoms, rotg->x_ref, nullptr, nullptr);
/* Check whether the box is unchanged and output a warning if not: */
check_box_unchanged(f_box, box, reffile, wi);
ii = rotg->ind[i];
copy_rvec(x[ii], rotg->x_ref[i]);
}
- gmx_trr_write_single_frame(reffile, g, 0.0, 0.0, box, rotg->nat, rotg->x_ref, NULL, NULL);
+ gmx_trr_write_single_frame(reffile, g, 0.0, 0.0, box, rotg->nat, rotg->x_ref, nullptr, nullptr);
}
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* Skip blank or comment-only lines */
do
{
- if (fgets2(buf, STRLEN, in) != NULL)
+ if (fgets2(buf, STRLEN, in) != nullptr)
{
strip_comment(buf);
trim(buf);
{
tp = rtp->atom[j].type;
tpnm = get_atomtype_name(tp, atype);
- if (tpnm == NULL)
+ if (tpnm == nullptr)
{
gmx_fatal(FARGS, "Incorrect atomtype (%d)", tp);
}
/* Read Atoms */
maxentries = 0;
- r0->atom = NULL;
- r0->atomname = NULL;
- r0->cgnr = NULL;
+ r0->atom = nullptr;
+ r0->atomname = nullptr;
+ r0->cgnr = nullptr;
i = 0;
- while (get_a_line(in, line, STRLEN) && (strchr(line, '[') == NULL))
+ while (get_a_line(in, line, STRLEN) && (strchr(line, '[') == nullptr))
{
if (sscanf(line, "%s%s%lf%d", buf, buf1, &q, &cg) != 4)
{
int j, n, ni, maxrb;
maxrb = rtp->rb[bt].nb;
- while (get_a_line(in, line, STRLEN) && (strchr(line, '[') == NULL))
+ while (get_a_line(in, line, STRLEN) && (strchr(line, '[') == nullptr))
{
if (rtp->rb[bt].nb >= maxrb)
{
}
for (; j < MAXATOMLIST; j++)
{
- rtp->rb[bt].b[rtp->rb[bt].nb].a[j] = NULL;
+ rtp->rb[bt].b[rtp->rb[bt].nb].a[j] = nullptr;
}
while (isspace(line[n]))
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
atoms = *atoms_solvt;
/* copy each residue from *atoms to a molecule in *molecule */
- moltypes = NULL;
+ moltypes = nullptr;
nrmoltypes = 0;
for (i = 0; i < atoms->nr; i++)
{
// but not in all).
t_atoms newAtoms;
init_t_atoms(&newAtoms, 0, FALSE);
- gmx::AtomsBuilder builder(&newAtoms, NULL);
+ gmx::AtomsBuilder builder(&newAtoms, nullptr);
builder.reserve(atoms->nr * nmol, atoms->nres * nmol);
std::vector<RVec> newX(atoms->nr * nmol);
std::vector<RVec> newV(!v->empty() ? atoms->nr * nmol : 0);
char *filename = gmxlibfn(fn);
snew(top_solvt, 1);
- readConformation(filename, top_solvt, &x_solvt, !v->empty() ? &v_solvt : NULL,
+ readConformation(filename, top_solvt, &x_solvt, !v->empty() ? &v_solvt : nullptr,
&ePBC_solvt, box_solvt, "solvent");
t_atoms *atoms_solvt = &top_solvt->atoms;
if (0 == atoms_solvt->nr)
bSkip = FALSE;
line++;
strcpy(buf2, buf);
- if ((temp = strchr(buf2, '\n')) != NULL)
+ if ((temp = strchr(buf2, '\n')) != nullptr)
{
temp[0] = '\0';
}
if (buf2[0] == '[')
{
buf2[0] = ' ';
- if ((temp = strchr(buf2, '\n')) != NULL)
+ if ((temp = strchr(buf2, '\n')) != nullptr)
{
temp[0] = '\0';
}
}
if (bSkip)
{
- if ((temp = strchr(buf, '\n')) != NULL)
+ if ((temp = strchr(buf, '\n')) != nullptr)
{
temp[0] = '\0';
}
t_filenm fnm[] = {
{ efSTX, "-cp", "protein", ffOPTRD },
{ efSTX, "-cs", "spc216", ffLIBRD},
- { efSTO, NULL, NULL, ffWRITE},
- { efTOP, NULL, NULL, ffOPTRW},
+ { efSTO, nullptr, nullptr, ffWRITE},
+ { efTOP, nullptr, nullptr, ffOPTRW},
};
#define NFILE asize(fnm)
/* Generate a solute configuration */
conf_prot = opt2fn("-cp", NFILE, fnm);
readConformation(conf_prot, top, &x,
- bReadV ? &v : NULL, &ePBC, box, "solute");
+ bReadV ? &v : nullptr, &ePBC, box, "solute");
if (bReadV && v.empty())
{
fprintf(stderr, "Note: no velocities found\n");
fprintf(stderr, "Writing generated configuration to %s\n", confout);
const char *outputTitle = (bProt ? *top->name : "Generated by gmx solvate");
write_sto_conf(confout, outputTitle, &top->atoms, as_rvec_array(x.data()),
- !v.empty() ? as_rvec_array(v.data()) : NULL, ePBC, box);
+ !v.empty() ? as_rvec_array(v.data()) : nullptr, ePBC, box);
/* print size of generated configuration */
fprintf(stderr, "\nOutput configuration contains %d atoms in %d residues\n",
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
const char *sbfile = "specbond.dat";
- t_specbond *sb = NULL;
+ t_specbond *sb = nullptr;
char r1buf[32], r2buf[32], a1buf[32], a2buf[32], nr1buf[32], nr2buf[32];
double length;
int nb1, nb2;
int mk_specbonds(t_atoms *pdba, rvec x[], gmx_bool bInteractive,
t_ssbond **specbonds, gmx_bool bVerbose)
{
- t_specbond *sb = NULL;
- t_ssbond *bonds = NULL;
+ t_specbond *sb = nullptr;
+ t_ssbond *bonds = nullptr;
int nsb;
int nspec, nbonds;
int *specp, *sgp;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
else
{
- *nname = NULL;
+ *nname = nullptr;
}
}
a->type = get_atomtype_type(buf[i++], atype);
ndel = 0;
for (j = 0; j < tb[i].nhack; j++)
{
- if (tb[i].hack[j].oname != NULL && tb[i].hack[j].nname != NULL)
+ if (tb[i].hack[j].oname != nullptr && tb[i].hack[j].nname != nullptr)
{
nrepl++;
}
- else if (tb[i].hack[j].oname == NULL && tb[i].hack[j].nname != NULL)
+ else if (tb[i].hack[j].oname == nullptr && tb[i].hack[j].nname != nullptr)
{
nadd++;
}
- else if (tb[i].hack[j].oname != NULL && tb[i].hack[j].nname == NULL)
+ else if (tb[i].hack[j].oname != nullptr && tb[i].hack[j].nname == nullptr)
{
ndel++;
}
- else if (tb[i].hack[j].oname == NULL && tb[i].hack[j].nname == NULL)
+ else if (tb[i].hack[j].oname == nullptr && tb[i].hack[j].nname == nullptr)
{
gmx_fatal(FARGS, "invalid hack (%s) in termini database", tb[i].name);
}
fprintf(out, "[ %s ]\n", kw_names[ekwRepl-ebtsNR-1]);
for (j = 0; j < tb[i].nhack; j++)
{
- if (tb[i].hack[j].oname != NULL && tb[i].hack[j].nname != NULL)
+ if (tb[i].hack[j].oname != nullptr && tb[i].hack[j].nname != nullptr)
{
fprintf(out, "%s\t", tb[i].hack[j].oname);
print_atom(out, tb[i].hack[j].atom, atype);
fprintf(out, "[ %s ]\n", kw_names[ekwAdd-ebtsNR-1]);
for (j = 0; j < tb[i].nhack; j++)
{
- if (tb[i].hack[j].oname == NULL && tb[i].hack[j].nname != NULL)
+ if (tb[i].hack[j].oname == nullptr && tb[i].hack[j].nname != nullptr)
{
print_ab(out, &(tb[i].hack[j]), tb[i].hack[j].nname);
print_atom(out, tb[i].hack[j].atom, atype);
fprintf(out, "[ %s ]\n", kw_names[ekwDel-ebtsNR-1]);
for (j = 0; j < tb[i].nhack; j++)
{
- if (tb[i].hack[j].oname != NULL && tb[i].hack[j].nname == NULL)
+ if (tb[i].hack[j].oname != nullptr && tb[i].hack[j].nname == nullptr)
{
fprintf(out, "%s\n", tb[i].hack[j].oname);
}
fflib_filename_base(fn, filebase, STRLEN);
/* Remove the C/N termini extension */
ptr = strrchr(filebase, '.');
- if (ptr != NULL)
+ if (ptr != nullptr)
{
ptr[0] = '\0';
}
clear_t_hack(&(tb[nb].hack[nh]));
for (i = 0; i < 4; i++)
{
- tb[nb].hack[nh].a[i] = NULL;
+ tb[nb].hack[nh].a[i] = nullptr;
}
tb[nb].nhack++;
read_atom(line+n, kwnr == ekwAdd,
&tb[nb].hack[nh].nname, tb[nb].hack[nh].atom, atype,
&tb[nb].hack[nh].cgnr);
- if (tb[nb].hack[nh].nname == NULL)
+ if (tb[nb].hack[nh].nname == nullptr)
{
- if (tb[nb].hack[nh].oname != NULL)
+ if (tb[nb].hack[nh].oname != nullptr)
{
tb[nb].hack[nh].nname = gmx_strdup(tb[nb].hack[nh].oname);
}
}
for (; j < MAXATOMLIST; j++)
{
- tb[nb].rb[kwnr].b[tb[nb].rb[kwnr].nb].a[j] = NULL;
+ tb[nb].rb[kwnr].b[tb[nb].rb[kwnr].nb].a[j] = nullptr;
}
strcpy(buf, "");
sscanf(line+n, "%s", buf);
*/
ntdbf = fflib_search_file_end(ffdir, ext, FALSE, &tdbf);
ntb = 0;
- *tbptr = NULL;
+ *tbptr = nullptr;
for (f = 0; f < ntdbf; f++)
{
read_ter_db_file(tdbf[f], &ntb, tbptr, atype);
restp = get_restp(rtpname_match, nrtp, rtp);
n = 0;
- list = NULL;
+ list = nullptr;
for (i = 0; i < nb; i++)
{
{
/* advance to next |-separated field */
s = strchr(s, '|');
- if (s != NULL)
+ if (s != nullptr)
{
s++;
}
}
}
- while (!found && s != NULL);
+ while (!found && s != nullptr);
}
/* All residue-specific termini have been added. We might have to fall
/* A conjunction hyphen normally indicates a residue-specific
terminus, which is named like "GLY-COOH". A generic terminus
won't have a hyphen. */
- bool bFoundAnyHyphen = (c != NULL);
+ bool bFoundAnyHyphen = (c != nullptr);
/* '-' as the last character indicates charge, so if that's
the only one found e.g. "COO-", then it was not a conjunction
hyphen, so this is a generic terminus */
/* Check that we haven't already added a residue-specific version
* of this terminus.
*/
- for (j = 0; j < n && strstr((*list[j]).name, s) == NULL; j++)
+ for (j = 0; j < n && strstr((*list[j]).name, s) == nullptr; j++)
{
;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
char ai[32], aj[32];
double e_diss;
const char *fn = "edissoc.dat";
- t_2morse *t2m = NULL;
+ t_2morse *t2m = nullptr;
int maxn2m = 0, n2m = 0;
int nread;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
return d_invalid;
}
-static directive **necessary = NULL;
+static directive **necessary = nullptr;
static void set_nec(directive **n, ...)
/* Must always have at least one extra argument */
void DS_Init(DirStack **DS)
{
- if (necessary == NULL)
+ if (necessary == nullptr)
{
int i;
}
}
}
- *DS = NULL;
+ *DS = nullptr;
}
{
DirStack *D;
- while (*DS != NULL)
+ while (*DS != nullptr)
{
D = *DS;
*DS = (*DS)->prev;
DirStack *D;
D = DS;
- while ((D != NULL) && (D->d != d))
+ while ((D != nullptr) && (D->d != d))
{
D = D->prev;
}
- return (D != NULL);
+ return (D != nullptr);
}
int DS_Check_Order(DirStack *DS, directive d)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
if (*nb == -1)
{
- *nb = strtol(nb_str, NULL, 10);
+ *nb = strtol(nb_str, nullptr, 10);
}
if ((*nb < 1) || (*nb >= eNBF_NR))
{
}
if (*comb == -1)
{
- *comb = strtol(comb_str, NULL, 10);
+ *comb = strtol(comb_str, nullptr, 10);
}
if ((*comb < 1) || (*comb >= eCOMB_NR))
{
int n, len;
int ncppopts = 0;
const char *cppadds[2];
- char **cppopts = NULL;
+ char **cppopts = nullptr;
const char *option[2] = { "-D", "-I" };
const char *nopt[2] = { "define", "include" };
const char *ptr;
}
}
srenew(cppopts, ++ncppopts);
- cppopts[ncppopts-1] = NULL;
+ cppopts[ncppopts-1] = nullptr;
return cppopts;
}
const t_atoms *mol_atoms;
atoms->nr = 0;
- atoms->atom = NULL;
+ atoms->atom = nullptr;
for (mb = 0; mb < nmolb; mb++)
{
{
FILE *out;
int i, sl, nb_funct;
- char *pline = NULL, **title = NULL;
+ char *pline = nullptr, **title = nullptr;
char line[STRLEN], errbuf[256], comb_str[256], nb_str[256];
char genpairs[32];
char *dirstr, *dummy2;
int nrcopies, nmol, nmolb = 0, nscan, ncombs, ncopy;
double fLJ, fQQ, fPOW;
- gmx_molblock_t *molb = NULL;
- t_molinfo *mi0 = NULL;
+ gmx_molblock_t *molb = nullptr;
+ t_molinfo *mi0 = nullptr;
DirStack *DS;
directive d, newd;
t_nbparam **nbparam, **pair;
/* File handling variables */
int status, done;
gmx_cpp_t handle;
- char *tmp_line = NULL;
+ char *tmp_line = nullptr;
char warn_buf[STRLEN];
const char *floating_point_arithmetic_tip =
"Total charge should normally be an integer. See\n"
}
else
{
- out = NULL;
+ out = nullptr;
}
/* open input file */
DS_Init(&DS); /* directive stack */
nmol = 0; /* no molecules yet... */
d = d_invalid; /* first thing should be a directive */
- nbparam = NULL; /* The temporary non-bonded matrix */
- pair = NULL; /* The temporary pair interaction matrix */
- block2 = NULL; /* the extra exclusions */
+ nbparam = nullptr; /* The temporary non-bonded matrix */
+ pair = nullptr; /* The temporary pair interaction matrix */
+ block2 = nullptr; /* the extra exclusions */
nb_funct = F_LJ;
*reppow = 12.0; /* Default value for repulsion power */
- *intermolecular_interactions = NULL;
+ *intermolecular_interactions = nullptr;
/* Init the number of CMAP torsion angles and grid spacing */
plist[F_CMAP].grid_spacing = 0;
* skip spaces and tabs on either side of directive
*/
dirstr = gmx_strdup((pline+1));
- if ((dummy2 = strchr (dirstr, CLOSEDIR)) != NULL)
+ if ((dummy2 = strchr (dirstr, CLOSEDIR)) != nullptr)
{
(*dummy2) = 0;
}
if (d == d_intermolecular_interactions)
{
- if (*intermolecular_interactions == NULL)
+ if (*intermolecular_interactions == nullptr)
{
/* We (mis)use the moleculetype processing
* to process the intermolecular interactions
break;
case d_atomtypes:
push_at(symtab, atype, batype, pline, nb_funct,
- &nbparam, bGenPairs ? &pair : NULL, wi);
+ &nbparam, bGenPairs ? &pair : nullptr, wi);
break;
case d_bondtypes:
- push_bt(d, plist, 2, NULL, batype, pline, wi);
+ push_bt(d, plist, 2, nullptr, batype, pline, wi);
break;
case d_constrainttypes:
- push_bt(d, plist, 2, NULL, batype, pline, wi);
+ push_bt(d, plist, 2, nullptr, batype, pline, wi);
break;
case d_pairtypes:
if (bGenPairs)
}
else
{
- push_bt(d, plist, 2, atype, NULL, pline, wi);
+ push_bt(d, plist, 2, atype, nullptr, pline, wi);
}
break;
case d_angletypes:
- push_bt(d, plist, 3, NULL, batype, pline, wi);
+ push_bt(d, plist, 3, nullptr, batype, pline, wi);
break;
case d_dihedraltypes:
/* Special routine that can read both 2 and 4 atom dihedral definitions. */
if (!bReadMolType)
{
int ntype;
- if (opts->couple_moltype != NULL &&
+ if (opts->couple_moltype != nullptr &&
(opts->couple_lam0 == ecouplamNONE ||
opts->couple_lam0 == ecouplamQ ||
opts->couple_lam1 == ecouplamNONE ||
opts->couple_lam1 == ecouplamQ))
{
dcatt = add_atomtype_decoupled(symtab, atype,
- &nbparam, bGenPairs ? &pair : NULL);
+ &nbparam, bGenPairs ? &pair : nullptr);
}
ntype = get_atomtype_ntypes(atype);
ncombs = (ntype*(ntype+1))/2;
molb[nmolb].nmol = nrcopies;
nmolb++;
- bCouple = (opts->couple_moltype != NULL &&
+ bCouple = (opts->couple_moltype != nullptr &&
(gmx_strcasecmp("system", opts->couple_moltype) == 0 ||
strcmp(*(mi0->name), opts->couple_moltype) == 0));
if (bCouple)
}
}
sfree(pline);
- pline = NULL;
+ pline = nullptr;
}
}
while (!done);
done_bond_atomtype(&batype);
- if (*intermolecular_interactions != NULL)
+ if (*intermolecular_interactions != nullptr)
{
sfree(mi0->atoms.atom);
}
}
else
{
- tmpfile = NULL;
+ tmpfile = nullptr;
}
if (bVerbose)
* not by the gromacs routines
*/
int qm_max = 0, qm_nr = 0, link_nr = 0, link_max = 0;
- int *qm_arr = NULL, *link_arr = NULL;
+ int *qm_arr = nullptr, *link_arr = nullptr;
gmx_bool *bQMMM, *blink;
/* First we search and select the QM atoms in an qm_arr array that
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
return;
}
- ft = strtol(alc[nral], NULL, 10);
+ ft = strtol(alc[nral], nullptr, 10);
ftype = ifunc_index(d, ft);
nrfp = NRFP(ftype);
nrfpA = interaction_function[ftype].nrfpA;
if (nn >= 3 && strlen(alc[2]) == 1 && isdigit(alc[2][0]))
{
nral = 2;
- ft = strtol(alc[nral], NULL, 10);
+ ft = strtol(alc[nral], nullptr, 10);
/* Move atom types around a bit and use 'X' for wildcard atoms
* to create a 4-atom dihedral definition with arbitrary atoms in
* position 1 and 4.
else if (nn == 5 && strlen(alc[4]) == 1 && isdigit(alc[4][0]))
{
nral = 4;
- ft = strtol(alc[nral], NULL, 10);
+ ft = strtol(alc[nral], nullptr, 10);
}
else
{
}
start += nchar_consumed;
- ft = strtol(alc[nral], NULL, 10);
- nxcmap = strtol(alc[nral+1], NULL, 10);
- nycmap = strtol(alc[nral+2], NULL, 10);
+ ft = strtol(alc[nral], nullptr, 10);
+ nxcmap = strtol(alc[nral+1], nullptr, 10);
+ nycmap = strtol(alc[nral+2], nullptr, 10);
/* Check for equal grid spacing in x and y dims */
if (nxcmap != nycmap)
ncmap = nxcmap*nycmap;
ftype = ifunc_index(d, ft);
- nrfpA = strtol(alc[6], NULL, 10)*strtol(alc[6], NULL, 10);
- nrfpB = strtol(alc[7], NULL, 10)*strtol(alc[7], NULL, 10);
+ nrfpA = strtol(alc[6], nullptr, 10)*strtol(alc[6], nullptr, 10);
+ nrfpB = strtol(alc[7], nullptr, 10)*strtol(alc[7], nullptr, 10);
nrfp = nrfpA+nrfpB;
/* Allocate memory for the CMAP grid */
}
nn = sscanf(line+start+sl, " %s ", s);
sl += strlen(s);
- bt[F_CMAP].cmap[i+(bt[F_CMAP].ncmap)-nrfp] = strtod(s, NULL);
+ bt[F_CMAP].cmap[i+(bt[F_CMAP].ncmap)-nrfp] = strtod(s, nullptr);
if (nn == 1)
{
warning_error_and_exit(wi, errbuf, FARGS);
}
}
- resnr = strtol(resnumberic, NULL, 10);
+ resnr = strtol(resnumberic, nullptr, 10);
if (nr > 0)
{
{
int i, j, ti, tj, ntype;
gmx_bool bFound;
- t_param *pi = NULL;
+ t_param *pi = nullptr;
int nr = bt[ftype].nr;
int nral = NRAL(ftype);
int nrfp = interaction_function[ftype].nrfpA;
{
int nparam_found;
gmx_bool bFound, bSame;
- t_param *pi = NULL;
- t_param *pj = NULL;
+ t_param *pi = nullptr;
+ t_param *pj = nullptr;
int nr = bt[ftype].nr;
int nral = NRAL(ftype);
int nrfpA = interaction_function[ftype].nrfpA;
{
char *ptr;
int type, ftype, j, n, ret, nj, a;
- int *atc = NULL;
- double *weight = NULL, weight_tot;
+ int *atc = nullptr;
+ double *weight = nullptr, weight_tot;
t_param param;
char errbuf[STRLEN];
snew(b2->a, b2->nr);
for (i = 0; (i < b2->nr); i++)
{
- b2->a[i] = NULL;
+ b2->a[i] = nullptr;
}
}
/* Empty the LJ14 pairlist */
plist[F_LJ14].nr = 0;
- plist[F_LJ14].param = NULL;
+ plist[F_LJ14].param = nullptr;
}
static void generate_LJCpairsNB(t_molinfo *mol, int nb_funct, t_params *nbp, warninp_t wi)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
{
plist[i].nr = 0;
plist[i].maxnr = 0;
- plist[i].param = NULL;
+ plist[i].param = nullptr;
/* CMAP */
plist[i].ncmap = 0;
- plist[i].cmap = NULL;
+ plist[i].cmap = nullptr;
plist[i].grid_spacing = 0;
plist[i].nc = 0;
plist[i].nct = 0;
- plist[i].cmap_types = NULL;
+ plist[i].cmap_types = nullptr;
}
}
{
ri = at->atom[i].resind;
if ((i == 0 || ri != at->atom[i-1].resind) &&
- at->resinfo[ri].rtp != NULL)
+ at->resinfo[ri].rtp != nullptr)
{
qres = get_residue_charge(at, i);
fprintf(out, "; residue %3d %-3s rtp %-4s q ",
fprintf(out, "\n");
}
tpA = at->atom[i].type;
- if ((tpnmA = get_atomtype_name(tpA, atype)) == NULL)
+ if ((tpnmA = get_atomtype_name(tpA, atype)) == nullptr)
{
gmx_fatal(FARGS, "tpA = %d, i= %d in print_atoms", tpA, i);
}
if (PERTURBED(at->atom[i]))
{
tpB = at->atom[i].typeB;
- if ((tpnmB = get_atomtype_name(tpB, atype)) == NULL)
+ if ((tpnmB = get_atomtype_name(tpB, atype)) == nullptr)
{
gmx_fatal(FARGS, "tpB = %d, i= %d in print_atoms", tpB, i);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
nrbond = nrang = nridih = 0;
- bonds = NULL;
- angles = NULL;
- idihs = NULL;
+ bonds = nullptr;
+ angles = nullptr;
+ idihs = nullptr;
nrset++;
/* now set the vsite parameters: */
get_bondeds(NRAL(ftype), plist[ftype].param[i].a, at2vb,
for (i = 0; (i < ps->nr); i++) /* for all bonds in the plist */
{
int vsnral = 0;
- const int *first_atoms = NULL;
+ const int *first_atoms = nullptr;
bKeep = FALSE;
bRemove = FALSE;
for (i = 0; (i < ps->nr); i++) /* for all angles in the plist */
{
int vsnral = 0;
- const int *first_atoms = NULL;
+ const int *first_atoms = nullptr;
bKeep = FALSE;
bAll3FAD = TRUE;
{
int k, m, n, nvsite;
int vsnral = 0;
- const int *first_atoms = NULL;
+ const int *first_atoms = nullptr;
int atom;
gmx_bool bKeep, bUsed, bPresent;
t_pindex *pindex;
at2vsitecon_t *at2vc;
- pindex = 0; /* avoid warnings */
+ pindex = nullptr; /* avoid warnings */
/* make vsite_type array */
snew(vsite_type, natoms);
for (i = 0; i < natoms; i++)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
ai = ang->param[i].ai();
aj = ang->param[i].aj();
ak = ang->param[i].ak();
- th = RAD2DEG*bond_angle(x[ai], x[aj], x[ak], bPBC ? &pbc : NULL,
+ th = RAD2DEG*bond_angle(x[ai], x[aj], x[ak], bPBC ? &pbc : nullptr,
r_ij, r_kj, &costh, &t1, &t2);
if (debug)
{
aj = dih->param[i].aj();
ak = dih->param[i].ak();
al = dih->param[i].al();
- ph = RAD2DEG*dih_angle(x[ai], x[aj], x[ak], x[al], bPBC ? &pbc : NULL,
+ ph = RAD2DEG*dih_angle(x[ai], x[aj], x[ak], x[al], bPBC ? &pbc : nullptr,
r_ij, r_kj, r_kl, m, n, &sign, &t1, &t2, &t3);
if (debug)
{
for (i = 0; (i < atoms->nr); i++)
{
tp = atoms->atom[i].type;
- if ((tpnm = get_atomtype_name(tp, atype)) == NULL)
+ if ((tpnm = get_atomtype_name(tp, atype)) == nullptr)
{
gmx_fatal(FARGS, "tp = %d, i = %d in print_rtp", tp, i);
}
}
/* Force field selection, interactive or direct */
- choose_ff(strcmp(ff, "select") == 0 ? NULL : ff,
+ choose_ff(strcmp(ff, "select") == 0 ? nullptr : ff,
forcefield, sizeof(forcefield),
ffdir, sizeof(ffdir));
/* Read coordinates */
t_topology *top;
snew(top, 1);
- read_tps_conf(opt2fn("-f", NFILE, fnm), top, &epbc, &x, NULL, box, FALSE);
+ read_tps_conf(opt2fn("-f", NFILE, fnm), top, &epbc, &x, nullptr, box, FALSE);
t_atoms *atoms = &top->atoms;
natoms = atoms->nr;
- if (atoms->pdbinfo == NULL)
+ if (atoms->pdbinfo == nullptr)
{
snew(atoms->pdbinfo, natoms);
}
init_nnb(&nnb, atoms->nr, 4);
gen_nnb(&nnb, plist);
print_nnb(&nnb, "NNB");
- gen_pad(&nnb, atoms, &rtp_header_settings, plist, excls, NULL, TRUE);
+ gen_pad(&nnb, atoms, &rtp_header_settings, plist, excls, nullptr, TRUE);
done_nnb(&nnb);
if (!bPairs)
fp = ftp2FILE(efTOP, NFILE, fnm, "w");
print_top_header(fp, ftp2fn(efTOP, NFILE, fnm), TRUE, ffdir, 1.0);
- write_top(fp, NULL, mymol.name, atoms, FALSE, bts, plist, excls, atype,
+ write_top(fp, nullptr, mymol.name, atoms, FALSE, bts, plist, excls, atype,
cgnr, rtp_header_settings.nrexcl);
- print_top_mols(fp, mymol.name, ffdir, NULL, 0, NULL, 1, &mymol);
+ print_top_mols(fp, mymol.name, ffdir, nullptr, 0, nullptr, 1, &mymol);
gmx_ffclose(fp);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
else
{
- xl[n].res = NULL;
+ xl[n].res = nullptr;
}
/* Replace underscores in the string by spaces */
- while ((_ptr = strchr(abuf, '_')) != 0)
+ while ((_ptr = strchr(abuf, '_')) != nullptr)
{
*_ptr = ' ';
}
for (i = 0; (i < nxlate); i++)
{
sfree(xlatom[i].filebase);
- if (xlatom[i].res != NULL)
+ if (xlatom[i].res != nullptr)
{
sfree(xlatom[i].res);
}
gmx_bool bStartTerm, bEndTerm;
nxlate = 0;
- xlatom = NULL;
- if (xlfile != NULL)
+ xlatom = nullptr;
+ if (xlfile != nullptr)
{
fp = libopen(xlfile);
get_xlatoms(xlfile, fp, &nxlate, &xlatom);
for (i = 0; (i < nxlate) && !bRenamed; i++)
{
/* Check if the base file name of the rtp and arn entry match */
- if (restp == NULL ||
+ if (restp == nullptr ||
gmx_strcasecmp(restp[resind].filebase, xlatom[i].filebase) == 0)
{
/* Match the residue name */
- bMatch = (xlatom[i].res == NULL ||
+ bMatch = (xlatom[i].res == nullptr ||
(gmx_strcasecmp("protein-nterm", xlatom[i].res) == 0 &&
gmx_residuetype_is_protein(rt, rnm) && bStartTerm) ||
(gmx_strcasecmp("protein-cterm", xlatom[i].res) == 0 &&
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_host_alloc_t **nb_alloc,
gmx_host_free_t **nb_free)
{
- *nb_alloc = NULL;
- *nb_free = NULL;
+ *nb_alloc = nullptr;
+ *nb_free = nullptr;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
if (cpuInfo.count("CPU architecture"))
{
- *family = std::strtol(cpuInfo.at("CPU architecture").c_str(), NULL, 10);
+ *family = std::strtol(cpuInfo.at("CPU architecture").c_str(), nullptr, 10);
// For some 64-bit CPUs it appears to say 'AArch64' instead
if (*family == 0 && cpuInfo.at("CPU architecture").find("AArch64") != std::string::npos)
{
}
if (cpuInfo.count("CPU variant"))
{
- *model = std::strtol(cpuInfo.at("CPU variant").c_str(), NULL, 16);
+ *model = std::strtol(cpuInfo.at("CPU variant").c_str(), nullptr, 16);
}
if (cpuInfo.count("CPU revision"))
{
- *stepping = std::strtol(cpuInfo.at("CPU revision").c_str(), NULL, 10);
+ *stepping = std::strtol(cpuInfo.at("CPU revision").c_str(), nullptr, 10);
}
if (cpuInfo.count("Features"))
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* GPU emulation detection is done later, but we need here as well
* -- uncool, but there's no elegant workaround */
- bEmulateGPU = (getenv("GMX_EMULATE_GPU") != NULL);
+ bEmulateGPU = (getenv("GMX_EMULATE_GPU") != nullptr);
if (hwinfo->gpu_info.n_dev_compatible > 0)
{
/* detect GPUs */
hwinfo_g->gpu_info.n_dev = 0;
hwinfo_g->gpu_info.n_dev_compatible = 0;
- hwinfo_g->gpu_info.gpu_dev = NULL;
+ hwinfo_g->gpu_info.gpu_dev = nullptr;
/* Run the detection if the binary was compiled with GPU support
* and we requested detection.
*/
hwinfo_g->gpu_info.bDetectGPUs =
(bGPUBinary && bDetectGPUs &&
- getenv("GMX_DISABLE_GPU_DETECTION") == NULL);
+ getenv("GMX_DISABLE_GPU_DETECTION") == nullptr);
if (hwinfo_g->gpu_info.bDetectGPUs)
{
gmx_detect_gpus(mdlog, cr);
{
const gmx::CpuInfo &cpuInfo = *hwinfo_g->cpuInfo;
- if (fplog != NULL)
+ if (fplog != nullptr)
{
std::string detected;
{
char *env;
- if (gpu_opt->gpu_id != NULL && !bGPUBinary)
+ if (gpu_opt->gpu_id != nullptr && !bGPUBinary)
{
gmx_fatal(FARGS, "GPU ID string set, but %s was compiled without GPU support!",
gmx::getProgramContext().displayName());
}
env = getenv("GMX_GPU_ID");
- if (env != NULL && gpu_opt->gpu_id != NULL)
+ if (env != nullptr && gpu_opt->gpu_id != nullptr)
{
gmx_fatal(FARGS, "GMX_GPU_ID and -gpu_id can not be used at the same time");
}
- if (env == NULL)
+ if (env == nullptr)
{
env = gpu_opt->gpu_id;
}
/* parse GPU IDs if the user passed any */
- if (env != NULL)
+ if (env != nullptr)
{
/* Parse a "plain" or comma-separated GPU ID string which contains a
* sequence of digits corresponding to GPU IDs; the order will
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
sfree(checkres);
}
- else if (getenv("GMX_EMULATE_GPU") == NULL)
+ else if (getenv("GMX_EMULATE_GPU") == nullptr)
{
pick_compatible_gpus(gpu_info, gpu_opt);
assign_rank_gpu_ids(gpu_opt, cr->nrank_pp_intranode, cr->rank_pp_intranode);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
if (depth >= 0)
{
- hwloc_obj_t cache = hwloc_get_next_obj_by_depth(topo, depth, NULL);
- if (cache != NULL)
+ hwloc_obj_t cache = hwloc_get_next_obj_by_depth(topo, depth, nullptr);
+ if (cache != nullptr)
{
std::vector<hwloc_obj_t> hwThreads = getHwLocDescendantsByType(cache, HWLOC_OBJ_PU);
int depth = hwloc_get_type_depth(topo, HWLOC_OBJ_NUMANODE);
const struct hwloc_distances_s * dist = hwloc_get_whole_distance_matrix_by_depth(topo, depth);
- if (dist != NULL && dist->nbobjs == hwlocNumaNodes.size())
+ if (dist != nullptr && dist->nbobjs == hwlocNumaNodes.size())
{
machine->numa.baseLatency = dist->latency_base;
machine->numa.maxRelativeLatency = dist->latency_max;
else
{
// No numa nodes found. Use the entire machine as a numa node.
- const hwloc_obj_t hwlocMachine = hwloc_get_next_obj_by_type(topo, HWLOC_OBJ_MACHINE, NULL);
+ const hwloc_obj_t hwlocMachine = hwloc_get_next_obj_by_type(topo, HWLOC_OBJ_MACHINE, nullptr);
- if (hwlocMachine != NULL)
+ if (hwlocMachine != nullptr)
{
machine->numa.nodes.resize(1);
machine->numa.nodes[0].id = 0;
{
const hwloc_obj_t ancestor = hwloc_get_ancestor_obj_by_type(topo, HWLOC_OBJ_NUMANODE, p);
int numaId;
- if (ancestor != NULL)
+ if (ancestor != nullptr)
{
numaId = ancestor->logical_index;
}
hwloc_topology_set_flags(topo, HWLOC_TOPOLOGY_FLAG_IO_DEVICES);
- if (hwloc_topology_load(topo) != 0 || hwloc_get_root_obj(topo) == NULL)
+ if (hwloc_topology_load(topo) != 0 || hwloc_get_root_obj(topo) == nullptr)
{
hwloc_topology_destroy(topo);
return; // SupportLevel::None.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
"IMD_PAUSE",
"IMD_TRATE",
"IMD_IOERROR",
- NULL
+ nullptr
};
/*! \brief Initializes the IMD private data. */
static t_gmx_IMD_setup* imd_create(int imdatoms, int nstimddef, int imdport)
{
- t_gmx_IMD_setup *IMDsetup = NULL;
+ t_gmx_IMD_setup *IMDsetup = nullptr;
snew(IMDsetup, 1);
/* then we reset the IMD step to its default, and reset the connection boolean */
IMDsetup->nstimd_new = IMDsetup->nstimd_def;
- IMDsetup->clientsocket = NULL;
+ IMDsetup->clientsocket = nullptr;
IMDsetup->bConnected = FALSE;
}
fprintf(stdout, "%s For a log of the IMD pull forces explicitly specify '-if' on the command line.\n"
"%s (Not possible with energy minimization.)\n", IMDstr, IMDstr);
- return NULL;
+ return nullptr;
}
#endif
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
fprintf(stderr, "%s Error in file %s on line %d.\n", IMDstr, file, line);
- if (NULL != msg)
+ if (nullptr != msg)
{
fprintf(stderr, "%s\n", msg);
}
extern IMDSocket* imdsock_create()
{
- IMDSocket *sock = NULL;
+ IMDSocket *sock = nullptr;
#ifdef GMX_IMD
print_IMD_error(ERR_ARGS);
sfree(sock);
- return NULL;
+ return nullptr;
}
else
#endif
{
print_IMD_error(ERR_ARGS);
- return NULL;
+ return nullptr;
}
}
/* is the socket already NULL? */
- if (sock == NULL)
+ if (sock == nullptr)
{
return;
}
int ret = -1;
- if (sock == NULL)
+ if (sock == nullptr)
{
return 1;
}
do
{
/* check the set for read readiness. */
- ret = select(sock->sockfd + 1, &readfds, NULL, NULL, tval);
+ ret = select(sock->sockfd + 1, &readfds, nullptr, nullptr, tval);
/* redo on system interrupt */
}
while (ret < 0 && errno == EINTR);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* Make jobz point to the character "V" if eigenvectors
* should be calculated, otherwise "N" (only eigenvalues).
*/
- jobz = (eigenvectors != NULL) ? "V" : "N";
+ jobz = (eigenvectors != nullptr) ? "V" : "N";
/* allocate lapack stuff */
snew(isuppz, 2*n);
}
#endif
- if (eigenvectors != NULL)
+ if (eigenvectors != nullptr)
{
dovec = 1;
}
#if GMX_DOUBLE
F77_FUNC(dseupd, DSEUPD) (&dovec, "A", select, eigenvalues, eigenvectors,
- &n, NULL, "I", &n, "SA", &neig, &abstol,
+ &n, nullptr, "I", &n, "SA", &neig, &abstol,
resid, &ncv, v, &n, iparam, ipntr,
workd, workl, &lworkl, &info);
#else
F77_FUNC(sseupd, SSEUPD) (&dovec, "A", select, eigenvalues, eigenvectors,
- &n, NULL, "I", &n, "SA", &neig, &abstol,
+ &n, nullptr, "I", &n, "SA", &neig, &abstol,
resid, &ncv, v, &n, iparam, ipntr,
workd, workl, &lworkl, &info);
#endif
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
int matrix_invert(FILE *fp, int n, double **a)
{
int i, j, m, lda, *ipiv, lwork, info;
- double **test = NULL, **id, *work;
+ double **test = nullptr, **id, *work;
#ifdef DEBUG_MATRIX
if (fp)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
{
A->ndata[i] = 0;
A->nalloc[i] = 0;
- A->data[i] = NULL;
+ A->data[i] = nullptr;
}
return A;
}
/* Release each row */
for (i = 0; i < A->nrow; i++)
{
- if (A->data[i] != NULL)
+ if (A->data[i] != nullptr)
{
sfree(A->data[i]);
}
if (A->ndata[row] == A->nalloc[row])
{
A->nalloc[row] += 100;
- if (A->data[row] == NULL)
+ if (A->data[row] == nullptr)
{
snew(A->data[row], A->nalloc[row]);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
f[aj][m] += f_j[m];
f[ak][m] += f_k[m];
}
- if (g != NULL)
+ if (g != nullptr)
{
copy_ivec(SHIFT_IVEC(g, aj), jt);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
dd->Rtav_6 = &(dd->Rt_6[dd->nres]);
ptr = getenv("GMX_DISRE_ENSEMBLE_SIZE");
- if (cr && cr->ms != NULL && ptr != NULL && !bIsREMD)
+ if (cr && cr->ms != nullptr && ptr != nullptr && !bIsREMD)
{
#if GMX_MPI
dd->nsystems = 0;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
else
{
- pbc_null = NULL;
+ pbc_null = nullptr;
}
#ifdef DEBUG
}
else
{
- pbc_null = NULL;
+ pbc_null = nullptr;
}
/* Copy the whole idef, so we can modify the contents locally */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014, by the GROMACS development team, led by
+ * Copyright (c) 2014,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.
{
int atnr;
- if (global_atom_index == NULL)
+ if (global_atom_index == nullptr)
{
atnr = i + 1;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* Note that thread 0 uses the global fshift and energy arrays,
* but to keep the code simple, we initialize all data here.
*/
- bt->f_t[t].f = NULL;
+ bt->f_t[t].f = nullptr;
bt->f_t[t].f_nalloc = 0;
snew(bt->f_t[t].fshift, SHIFTS);
bt->f_t[t].grpp.nener = nenergrp*nenergrp;
}
bt->nblock_used = 0;
- bt->block_index = NULL;
- bt->mask = NULL;
+ bt->block_index = nullptr;
+ bt->mask = nullptr;
bt->block_nalloc = 0;
/* The optimal value after which to switch from uniform to localized
const int max_nthread_uniform = 4;
char * ptr;
- if ((ptr = getenv("GMX_BONDED_NTHREAD_UNIFORM")) != NULL)
+ if ((ptr = getenv("GMX_BONDED_NTHREAD_UNIFORM")) != nullptr)
{
sscanf(ptr, "%d", &bt->bonded_max_nthread_uniform);
- if (fplog != NULL)
+ if (fplog != nullptr)
{
fprintf(fplog, "\nMax threads for uniform bonded distribution set to %d by env.var.\n",
bt->bonded_max_nthread_uniform);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
od->fc = ir->orires_fc;
od->nex = 0;
- od->S = NULL;
- od->M = NULL;
- od->eig = NULL;
- od->v = NULL;
+ od->S = nullptr;
+ od->M = nullptr;
+ od->eig = nullptr;
+ od->v = nullptr;
- nr_ex = NULL;
+ nr_ex = nullptr;
iloop = gmx_mtop_ilistloop_init(mtop);
while (gmx_mtop_ilistloop_next(iloop, &il, &nmol))
const t_atom *atom;
while (gmx_mtop_atomloop_all_next(aloop, &i, &atom))
{
- if (mtop->groups.grpnr[egcORFIT] == NULL ||
+ if (mtop->groups.grpnr[egcORFIT] == nullptr ||
mtop->groups.grpnr[egcORFIT][i] == 0)
{
/* Not correct for free-energy with changing masses */
od->mref[j] = atom->m;
- if (ms == NULL || MASTERSIM(ms))
+ if (ms == nullptr || MASTERSIM(ms))
{
copy_rvec(xref[i], od->xref[j]);
for (d = 0; d < DIM; d++)
}
}
svmul(1.0/mtot, com, com);
- if (ms == NULL || MASTERSIM(ms))
+ if (ms == nullptr || MASTERSIM(ms))
{
for (j = 0; j < od->nref; j++)
{
int ex, i, j, nrot, ord[DIM], t;
matrix S, TMP;
- if (od->M == NULL)
+ if (od->M == nullptr)
{
snew(od->M, DIM);
for (i = 0; i < DIM; i++)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
energygrp_vdw = grppener->ener[egLJSR];
break;
default:
- energygrp_elec = NULL; /* Keep compiler happy */
- energygrp_vdw = NULL; /* Keep compiler happy */
+ energygrp_elec = nullptr; /* Keep compiler happy */
+ energygrp_vdw = nullptr; /* Keep compiler happy */
gmx_fatal(FARGS, "Unknown function type %d in do_nonbonded14", ftype);
break;
}
t_pbc pbc_no;
const t_pbc *pbc_nonnull;
- if (pbc != NULL)
+ if (pbc != nullptr)
{
pbc_nonnull = pbc;
}
else
{
- set_pbc(&pbc_no, epbcNONE, NULL);
+ set_pbc(&pbc_no, epbcNONE, nullptr);
pbc_nonnull = &pbc_no;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
rvec comA_sc, comB_sc, rdist, dpdl, dx;
gmx_bool bForceValid = TRUE;
- if ((f == NULL) || (vir_diag == NULL)) /* should both be null together! */
+ if ((f == nullptr) || (vir_diag == nullptr)) /* should both be null together! */
{
bForceValid = FALSE;
}
v = posres(idef->il[F_POSRES].nr, idef->il[F_POSRES].iatoms,
idef->iparams_posres,
x, as_rvec_array(fr->f_novirsum->data()), fr->vir_diag_posres,
- fr->ePBC == epbcNONE ? NULL : pbc,
+ fr->ePBC == epbcNONE ? nullptr : pbc,
lambda[efptRESTRAINT], &dvdl,
fr->rc_scaling, fr->ePBC, fr->posres_com, fr->posres_comB);
enerd->term[F_POSRES] += v;
lambda_dum = (i == 0 ? lambda[efptRESTRAINT] : fepvals->all_lambda[efptRESTRAINT][i-1]);
v = posres(idef->il[F_POSRES].nr, idef->il[F_POSRES].iatoms,
idef->iparams_posres,
- x, NULL, NULL,
- fr->ePBC == epbcNONE ? NULL : pbc, lambda_dum, &dvdl_dum,
+ x, nullptr, nullptr,
+ fr->ePBC == epbcNONE ? nullptr : pbc, lambda_dum, &dvdl_dum,
fr->rc_scaling, fr->ePBC, fr->posres_com, fr->posres_comB);
enerd->enerpart_lambda[i] += v;
}
v = fbposres(idef->il[F_FBPOSRES].nr, idef->il[F_FBPOSRES].iatoms,
idef->iparams_fbposres,
x, as_rvec_array(fr->f_novirsum->data()), fr->vir_diag_posres,
- fr->ePBC == epbcNONE ? NULL : pbc,
+ fr->ePBC == epbcNONE ? nullptr : pbc,
fr->rc_scaling, fr->ePBC, fr->posres_com);
enerd->term[F_FBPOSRES] += v;
inc_nrnb(nrnb, eNR_FBPOSRES, idef->il[F_FBPOSRES].nr/2);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
iparams,
x, f, fshift,
&pbc,
- /* const struct t_graph *g */ NULL,
+ /* const struct t_graph *g */ nullptr,
lambda, &dvdlambda,
- /* const struct t_mdatoms *md */ NULL,
- /* struct t_fcdata *fcd */ NULL,
+ /* const struct t_mdatoms *md */ nullptr,
+ /* struct t_fcdata *fcd */ nullptr,
&ddgatindex);
checker_.checkReal(energy, interaction_function[ftype].longname);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
real rmsdev(int natoms, real mass[], rvec x[], rvec xp[])
{
- return calc_similar_ind(FALSE, natoms, NULL, mass, x, xp);
+ return calc_similar_ind(FALSE, natoms, nullptr, mass, x, xp);
}
real rhodev_ind(int nind, int index[], real mass[], rvec x[], rvec xp[])
real rhodev(int natoms, real mass[], rvec x[], rvec xp[])
{
- return calc_similar_ind(TRUE, natoms, NULL, mass, x, xp);
+ return calc_similar_ind(TRUE, natoms, nullptr, mass, x, xp);
}
void calc_fit_R(int ndim, int natoms, real *w_rls, const rvec *xp, rvec *x, matrix R)
}
tm = 0.0;
clear_rvec(xcm);
- if (ind_cm != NULL)
+ if (ind_cm != nullptr)
{
for (i = 0; i < ncm; i++)
{
xcm[m] /= tm;
}
- if (ind_reset != NULL)
+ if (ind_reset != nullptr)
{
for (i = 0; i < nreset; i++)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,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.
return eg2c_names[unit];
}
- return NULL;
+ return nullptr;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
const char *format;
int i, j;
- if (getenv("GMX_PRINT_LONGFORMAT") != NULL)
+ if (getenv("GMX_PRINT_LONGFORMAT") != nullptr)
{
format = flong;
}
const char *format;
int i, j;
- if (getenv("GMX_PRINT_LONGFORMAT") != NULL)
+ if (getenv("GMX_PRINT_LONGFORMAT") != nullptr)
{
format = flong;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
int size = 0;
- if (MASTER(cr) && *s != NULL)
+ if (MASTER(cr) && *s != nullptr)
{
/* Size of the char buffer is string length + 1 for '\0' */
size = strlen(*s) + 1;
}
nblock_bc(cr, size, *s);
}
- else if (!MASTER(cr) && *s != NULL)
+ else if (!MASTER(cr) && *s != nullptr)
{
sfree(*s);
- *s = NULL;
+ *s = nullptr;
}
}
block_bc(cr, n);
if (n == 0)
{
- groups->grpnr[g] = NULL;
+ groups->grpnr[g] = nullptr;
}
else
{
{
if (!MASTER(cr))
{
- pull->coord[c].externalPotentialProvider = NULL;
+ pull->coord[c].externalPotentialProvider = nullptr;
}
if (pull->coord[c].eType == epullEXTERNAL)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
real *vsite_m;
int n_nonlin_vsite_mol;
- att = NULL;
+ att = nullptr;
natt = 0;
- if (n_nonlin_vsite != NULL)
+ if (n_nonlin_vsite != nullptr)
{
*n_nonlin_vsite = 0;
}
&mtop->ffparams,
vsite_m,
&n_nonlin_vsite_mol);
- if (n_nonlin_vsite != NULL)
+ if (n_nonlin_vsite != nullptr)
{
*n_nonlin_vsite += nmol*n_nonlin_vsite_mol;
}
real particle_distance;
real nb_clust_frac_pairs_not_in_list_at_cutoff;
- verletbuf_atomtype_t *att = NULL;
+ verletbuf_atomtype_t *att = nullptr;
int natt = -1, i;
real elfac;
real kT_fac, mass_min;
resolution = 0.001;
env = getenv("GMX_VERLET_BUFFER_RES");
- if (env != NULL)
+ if (env != nullptr)
{
sscanf(env, "%lf", &resolution);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int b, i, j;
real mvb, im1, im2, tmp0, tmp1, tmp2;
- if (invmass != NULL)
+ if (invmass != nullptr)
{
for (b = 0; b < ncons; b++)
{
int bi, b, i, j;
real mvb, im1, im2, tmp0, tmp1, tmp2;
- if (invmass != NULL)
+ if (invmass != nullptr)
{
for (bi = 0; bi < ncons; bi++)
{
* so we pass invmass=NULL, which results in the use of 1 for all atoms.
*/
lincs_update_atoms(lincsd, th, 1.0, sol, r,
- (econq != econqForce) ? invmass : NULL, fp);
+ (econq != econqForce) ? invmass : nullptr, fp);
if (bCalcDHDL)
{
/* Communicate the corrected non-local coordinates */
if (DOMAINDECOMP(cr))
{
- dd_move_x_constraints(cr->dd, box, xp, NULL, FALSE);
+ dd_move_x_constraints(cr->dd, box, xp, nullptr, FALSE);
}
}
#pragma omp barrier
}
/* nit*ncons*(37+9*nrec) flops */
- if (v != NULL)
+ if (v != nullptr)
{
/* Update the velocities */
lincs_update_atoms(lincsd, th, invdt, mlambda, r, invmass, v);
/* 16 ncons flops */
}
- if (nlocat != NULL && (bCalcDHDL || bCalcVir))
+ if (nlocat != nullptr && (bCalcDHDL || bCalcVir))
{
if (lincsd->bTaskDep)
{
done_blocka(&at2con);
- if (cr->dd == NULL)
+ if (cr->dd == nullptr)
{
/* Since the matrix is static, we should free some memory */
li->ncc_alloc = li->ncc;
srenew(li->tmpncc, li->ncc_alloc);
}
- if (DOMAINDECOMP(cr) && dd_constraints_nlocalatoms(cr->dd) != NULL)
+ if (DOMAINDECOMP(cr) && dd_constraints_nlocalatoms(cr->dd) != nullptr)
{
int *nlocat_dd;
}
else
{
- li->nlocat = NULL;
+ li->nlocat = nullptr;
}
if (debug)
r2 = norm2(dx);
len = r2*gmx::invsqrt(r2);
d = std::abs(len/bllen[b]-1);
- if (d > ma && (nlocat == NULL || nlocat[b]))
+ if (d > ma && (nlocat == nullptr || nlocat[b]))
{
ma = d;
im = b;
}
- if (nlocat == NULL)
+ if (nlocat == nullptr)
{
ssd2 += d*d;
count++;
* We can also easily check if any constraint length is changed,
* if not dH/dlambda=0 and we can also set the boolean to FALSE.
*/
- bCalcDHDL = (ir->efep != efepNO && dvdlambda != NULL);
+ bCalcDHDL = (ir->efep != efepNO && dvdlambda != nullptr);
- if (lincsd->nc == 0 && cr->dd == NULL)
+ if (lincsd->nc == 0 && cr->dd == nullptr)
{
if (bLog || bEner)
{
if (lincsd->ncg_flex)
{
/* Set the flexible constraint lengths to the old lengths */
- if (pbc != NULL)
+ if (pbc != nullptr)
{
for (i = 0; i < lincsd->nc; i++)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
{
for (i = 0; i < natoms; i++)
{
- if (groups->grpnr[egcCompressedX] == NULL || groups->grpnr[egcCompressedX][i] == 0)
+ if (groups->grpnr[egcCompressedX] == nullptr || groups->grpnr[egcCompressedX][i] == 0)
{
nxtcatoms++;
}
}
}
}
- if (ir->pull != NULL)
+ if (ir->pull != nullptr)
{
cio += div_nsteps(nsteps, ir->pull->nstxout)*20; /* roughly 20 chars per line */
cio += div_nsteps(nsteps, ir->pull->nstfout)*20; /* roughly 20 chars per line */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_domdec_t *dd;
const char *anm, *resnm;
- dd = NULL;
+ dd = nullptr;
if (DOMAINDECOMP(cr))
{
dd = cr->dd;
int molb = 0;
for (i = start; i < start+homenr; i++)
{
- if (dd != NULL)
+ if (dd != nullptr)
{
if (i >= dd->nat_home && i < dd_ac0)
{
lambda += delta_step*ir->fepvals->delta_lambda;
}
- if (vir != NULL)
+ if (vir != nullptr)
{
clear_mat(vir_r_m_dr);
}
* For constraints there is both forward and backward communication.
*/
if (ir->ePBC != epbcNONE &&
- (cr->dd || bMolPBC) && !(cr->dd && cr->dd->constraint_comm == NULL))
+ (cr->dd || bMolPBC) && !(cr->dd && cr->dd->constraint_comm == nullptr))
{
/* With pbc=screw the screw has been changed to a shift
* by the constraint coordinate communication routine,
}
else
{
- pbc_null = NULL;
+ pbc_null = nullptr;
}
/* Communicate the coordinates required for the non-local constraints
{
dd_move_x_constraints(cr->dd, box, x, xprime, econq == econqCoord);
- if (v != NULL)
+ if (v != nullptr)
{
/* We need to initialize the non-local components of v.
* We never actually use these values, but we do increment them,
}
}
- if (constr->lincsd != NULL)
+ if (constr->lincsd != nullptr)
{
bOK = constrain_lincs(fplog, bLog, bEner, ir, step, constr->lincsd, md, cr,
x, xprime, min_proj,
box, pbc_null, lambda, dvdlambda,
- invdt, v, vir != NULL, vir_r_m_dr,
+ invdt, v, vir != nullptr, vir_r_m_dr,
econq, nrnb,
constr->maxwarn, &constr->warncount_lincs);
if (!bOK && constr->maxwarn < INT_MAX)
{
- if (fplog != NULL)
+ if (fplog != nullptr)
{
fprintf(fplog, "Constraint error in algorithm %s at step %s\n",
econstr_names[econtLINCS], gmx_step_str(step, buf));
md->invmass, constr->nblocks, constr->sblock,
idef, ir, x, xprime, nrnb,
constr->lagr, lambda, dvdlambda,
- invdt, v, vir != NULL, vir_r_m_dr,
+ invdt, v, vir != nullptr, vir_r_m_dr,
constr->maxwarn < INT_MAX, econq);
break;
case (econqVeloc):
md->invmass, constr->nblocks, constr->sblock,
idef, ir, x, min_proj, nrnb,
constr->lagr, lambda, dvdlambda,
- invdt, NULL, vir != NULL, vir_r_m_dr,
+ invdt, nullptr, vir != nullptr, vir_r_m_dr,
constr->maxwarn < INT_MAX, econq);
break;
default:
if (!bOK && constr->maxwarn < INT_MAX)
{
- if (fplog != NULL)
+ if (fplog != nullptr)
{
fprintf(fplog, "Constraint error in algorithm %s at step %s\n",
econstr_names[econtSHAKE], gmx_step_str(step, buf));
nth, th,
pbc_null,
x[0], xprime[0],
- invdt, v ? v[0] : NULL,
- vir != NULL,
+ invdt, v ? v[0] : nullptr,
+ vir != nullptr,
th == 0 ? vir_r_m_dr : constr->vir_r_m_dr_th[th],
th == 0 ? &bSettleErrorHasOccurred : &constr->bSettleErrorHasOccurred[th]);
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
}
inc_nrnb(nrnb, eNR_SETTLE, nsettle);
- if (v != NULL)
+ if (v != nullptr)
{
inc_nrnb(nrnb, eNR_CONSTR_V, nsettle*3);
}
- if (vir != NULL)
+ if (vir != nullptr)
{
inc_nrnb(nrnb, eNR_CONSTR_VIR, nsettle*3);
}
{
int calcvir_atom_end;
- if (vir == NULL)
+ if (vir == nullptr)
{
calcvir_atom_end = 0;
}
gmx_incons("Unknown constraint quantity for settle");
}
- if (vir != NULL)
+ if (vir != nullptr)
{
/* Reduce the virial contributions over the threads */
for (int th = 1; th < nth; th++)
}
}
- if (vir != NULL)
+ if (vir != nullptr)
{
/* The normal uses of constrain() pass step_scaling = 1.0.
* The call to constrain() for SD1 that passes step_scaling =
}
else
{
- return NULL;
+ return nullptr;
}
}
ncons = idef->il[F_CONSTR].nr/3;
init_blocka(&sblocks);
- gen_sblocks(NULL, 0, md->homenr, idef, &sblocks, FALSE);
+ gen_sblocks(nullptr, 0, md->homenr, idef, &sblocks, FALSE);
/*
bstart=(idef->nodeid > 0) ? blocks->multinr[idef->nodeid-1] : 0;
int nsettles =
gmx_mtop_ftype_count(mtop, F_SETTLE);
- GMX_RELEASE_ASSERT(!ir->bPull || ir->pull_work != NULL, "init_constraints called with COM pulling before/without initializing the pull code");
+ GMX_RELEASE_ASSERT(!ir->bPull || ir->pull_work != nullptr, "init_constraints called with COM pulling before/without initializing the pull code");
if (nconstraints + nsettles == 0 &&
!(ir->bPull && pull_have_constraint(ir->pull_work)) &&
- ed == NULL)
+ ed == nullptr)
{
- return NULL;
+ return nullptr;
}
struct gmx_constr *constr;
/* Allocate thread-local work arrays */
int nthreads = gmx_omp_nthreads_get(emntSETTLE);
- if (nthreads > 1 && constr->vir_r_m_dr_th == NULL)
+ if (nthreads > 1 && constr->vir_r_m_dr_th == nullptr)
{
snew(constr->vir_r_m_dr_th, nthreads);
snew(constr->bSettleErrorHasOccurred, nthreads);
/* Initialize the essential dynamics sampling.
* Put the pointer to the ED struct in constr */
constr->ed = ed;
- if (ed != NULL || state->edsamstate != NULL)
+ if (ed != nullptr || state->edsamstate != nullptr)
{
init_edsam(mtop, ir, cr, ed, as_rvec_array(state->x.data()), state->box, state->edsamstate);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
static const double sy_const_5[] = { 0.2967324292201065, 0.2967324292201065, -0.186929716880426, 0.2967324292201065, 0.2967324292201065 };
static const double* sy_const[] = {
- NULL,
+ nullptr,
sy_const_1,
- NULL,
+ nullptr,
sy_const_3,
- NULL,
+ nullptr,
sy_const_5
};
/* if scalefac is NULL, we are doing the NHC of the barostat */
bBarostat = FALSE;
- if (scalefac == NULL)
+ if (scalefac == nullptr)
{
bBarostat = TRUE;
}
// Trivial OpenMP region that does not throw
int g;
- if (cFREEZE == NULL)
+ if (cFREEZE == nullptr)
{
g = 0;
}
void andersen_tcoupl(t_inputrec *ir, gmx_int64_t step,
const t_commrec *cr, const t_mdatoms *md, t_state *state, real rate, const gmx_bool *randomize, const real *boltzfac)
{
- const int *gatindex = (DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL);
+ const int *gatindex = (DOMAINDECOMP(cr) ? cr->dd->gatindex : nullptr);
int i;
int gc = 0;
gmx::ThreeFry2x64<0> rng(ir->andersen_seed, gmx::RandomDomain::Thermostat);
case etrtBARONHC:
case etrtBARONHC2:
NHC_trotter(opts, state->nnhpres, ekind, dt, state->nhpres_xi.data(),
- state->nhpres_vxi.data(), NULL, &(state->veta), MassQ, FALSE);
+ state->nhpres_vxi.data(), nullptr, &(state->veta), MassQ, FALSE);
break;
case etrtNHC:
case etrtNHC2:
NHC_trotter(opts, opts->ngtc, ekind, dt, state->nosehoover_xi.data(),
- state->nosehoover_vxi.data(), scalefac, NULL, MassQ, (ir->eI == eiVV));
+ state->nosehoover_vxi.data(), scalefac, nullptr, MassQ, (ir->eI == eiVV));
/* need to rescale the kinetic energies and velocities here. Could
scale the velocities later, but we need them scaled in order to
produce the correct outputs, so we'll scale them here. */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
real dHH = mtop->ffparams.iparams[settle_type].settle.dhh;
settleparam_init(&settled->mass1, 1.0, 1.0, 1.0, 1.0, dOH, dHH);
- settled->ow1 = NULL;
- settled->hw2 = NULL;
- settled->hw3 = NULL;
- settled->virfac = NULL;
+ settled->ow1 = nullptr;
+ settled->hw2 = nullptr;
+ settled->hw3 = nullptr;
+ settled->virfac = nullptr;
settled->nalloc = 0;
/* Without SIMD configured, this bool is not used */
- settled->bUseSimd = (getenv("GMX_DISABLE_SIMD_KERNELS") == NULL);
+ settled->bUseSimd = (getenv("GMX_DISABLE_SIMD_KERNELS") == nullptr);
return settled;
}
hw2 = iatoms[i*nral1 + 2];
hw3 = iatoms[i*nral1 + 3];
- if (pbc == NULL)
+ if (pbc == nullptr)
{
rvec_sub(x[ow1], x[hw2], roh2);
rvec_sub(x[ow1], x[hw3], roh3);
int settleStart = ((numSettlePacks* thread + nthread - 1)/nthread)*packSize;
int settleEnd = ((numSettlePacks*(thread + 1) + nthread - 1)/nthread)*packSize;
- if (v != NULL)
+ if (v != nullptr)
{
if (!bCalcVirial)
{
pbc,
x, xprime,
invdt, v,
- NULL,
+ nullptr,
bErrorHasOccurred);
}
else
pbc,
x, xprime,
invdt, v,
- NULL,
+ nullptr,
bErrorHasOccurred);
}
else
t_pbc pbcNo;
const t_pbc *pbcNonNull;
- if (pbc != NULL)
+ if (pbc != nullptr)
{
pbcNonNull = pbc;
}
else
{
- set_pbc(&pbcNo, epbcNONE, NULL);
+ set_pbc(&pbcNo, epbcNONE, nullptr);
pbcNonNull = &pbcNo;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
eb->e_sim[i].eav = 0;
eb->e_sim[i].esum = 0;
eb->enm[i].name = gmx_strdup(enm[i-index]);
- if (unit != NULL)
+ if (unit != nullptr)
{
eb->enm[i].unit = gmx_strdup(unit);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_bool bSimTemp = FALSE;
nlim = fep->n_lambda;
- if (simtemp != NULL)
+ if (simtemp != nullptr)
{
bSimTemp = TRUE;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
do_force_listed(wcycle, box, ir->fepvals, cr,
idef, (const rvec *) x, hist, f, fr,
&pbc, graph, enerd, nrnb, lambda, md, fcd,
- DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL,
+ DOMAINDECOMP(cr) ? cr->dd->gatindex : nullptr,
flags);
where();
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
const char *egrp_nm[egNR+1] = {
"Coul-SR", "LJ-SR", "Buck-SR",
- "Coul-14", "LJ-14", NULL
+ "Coul-14", "LJ-14", nullptr
};
t_forcerec *mk_forcerec(void)
/* Check if we are doing QM on this group */
qm = FALSE;
- if (qm_grpnr != NULL)
+ if (qm_grpnr != nullptr)
{
for (j = j0; j < j1 && !qm; j++)
{
}
n_solvent_parameters = 0;
- solvent_parameters = NULL;
+ solvent_parameters = nullptr;
/* Allocate temporary array for solvent type */
snew(cg_sp, mtop->nmolblock);
{
check_solvent_cg(molt, cg_mol, nmol,
mtop->groups.grpnr[egcQMMM] ?
- mtop->groups.grpnr[egcQMMM]+at_offset+am : 0,
+ mtop->groups.grpnr[egcQMMM]+at_offset+am : nullptr,
&mtop->groups.grps[egcQMMM],
fr,
&n_solvent_parameters, &solvent_parameters,
}
sfree(cg_sp);
- if (bestsol != esolNO && fp != NULL)
+ if (bestsol != esolNO && fp != nullptr)
{
fprintf(fp, "\nEnabling %s-like water optimization for %d molecules.\n\n",
esol_names[bestsol],
{
bId = FALSE;
}
- if (mtop->groups.grpnr[egcQMMM] != NULL)
+ if (mtop->groups.grpnr[egcQMMM] != nullptr)
{
for (ai = a0; ai < a1; ai++)
{
{
if (fr->eeltype == eelGRF)
{
- calc_rffac(NULL, fr->eeltype, fr->epsilon_r, fr->epsilon_rf,
+ calc_rffac(nullptr, fr->eeltype, fr->epsilon_r, fr->epsilon_rf,
fr->rcoulomb, fr->temp, fr->zsquare, box,
&fr->kappa, &fr->k_rf, &fr->c_rf);
}
int ntp, *typecount;
gmx_bool bBHAM;
real *nbfp;
- real *nbfp_comb = NULL;
+ real *nbfp_comb = nullptr;
ntp = fr->ntype;
bBHAM = fr->bBHAM;
sfree(nbfp_comb);
}
- if (fplog != NULL)
+ if (fplog != nullptr)
{
if (fr->eDispCorr == edispcAllEner ||
fr->eDispCorr == edispcAllEnerPres)
char buf[STRLEN];
int i, j;
- if (tabfn == NULL)
+ if (tabfn == nullptr)
{
if (debug)
{
int ncount, *count;
bondedtable_t *tab;
- tab = NULL;
+ tab = nullptr;
ncount = 0;
- count = NULL;
+ count = nullptr;
count_tables(ftype1, ftype2, mtop, &ncount, &count);
// Are there any relevant tabulated bond interactions?
(ir->implicit_solvent == eisGBSA && (ir->gb_algorithm == egbSTILL ||
ir->gb_algorithm == egbHCT ||
ir->gb_algorithm == egbOBC))) &&
- getenv("GMX_NO_ALLVSALL") == NULL
+ getenv("GMX_NO_ALLVSALL") == nullptr
);
if (bAllvsAll && ir->opts.ngener > 1)
if (bPrintNote)
{
- if (fp != NULL)
+ if (fp != nullptr)
{
fprintf(fp, "\n%s\n", note);
}
#endif /* GMX_NBNXN_SIMD_2XNN && GMX_NBNXN_SIMD_4XN */
- if (getenv("GMX_NBNXN_SIMD_4XN") != NULL)
+ if (getenv("GMX_NBNXN_SIMD_4XN") != nullptr)
{
#ifdef GMX_NBNXN_SIMD_4XN
*kernel_type = nbnxnk4xN_SIMD_4xN;
gmx_fatal(FARGS, "SIMD 4xN kernels requested, but GROMACS has been compiled without support for these kernels");
#endif
}
- if (getenv("GMX_NBNXN_SIMD_2XNN") != NULL)
+ if (getenv("GMX_NBNXN_SIMD_2XNN") != nullptr)
{
#ifdef GMX_NBNXN_SIMD_2XNN
*kernel_type = nbnxnk4xN_SIMD_2xNN;
(GMX_SIMD_REAL_WIDTH >= 4 && GMX_SIMD_HAVE_FMA && !GMX_DOUBLE) || GMX_SIMD_IBM_QPX
*ewald_excl = ewaldexclAnalytical;
#endif
- if (getenv("GMX_NBNXN_EWALD_TABLE") != NULL)
+ if (getenv("GMX_NBNXN_EWALD_TABLE") != nullptr)
{
*ewald_excl = ewaldexclTable;
}
- if (getenv("GMX_NBNXN_EWALD_ANALYTICAL") != NULL)
+ if (getenv("GMX_NBNXN_EWALD_ANALYTICAL") != nullptr)
{
*ewald_excl = ewaldexclAnalytical;
}
const char *lookup_nbnxn_kernel_name(int kernel_type)
{
- const char *returnvalue = NULL;
+ const char *returnvalue = nullptr;
switch (kernel_type)
{
case nbnxnkNotSet:
case nbnxnkNR:
default:
gmx_fatal(FARGS, "Illegal kernel type selected");
- returnvalue = NULL;
+ returnvalue = nullptr;
break;
}
return returnvalue;
}
}
- if (bDoNonbonded && fp != NULL)
+ if (bDoNonbonded && fp != nullptr)
{
fprintf(fp, "\nUsing %s %dx%d non-bonded kernels\n\n",
lookup_nbnxn_kernel_name(*kernel_type),
*bUseGPU = FALSE;
- bEmulateGPUEnvVarSet = (getenv("GMX_EMULATE_GPU") != NULL);
+ bEmulateGPUEnvVarSet = (getenv("GMX_EMULATE_GPU") != nullptr);
/* Run GPU emulation mode if GMX_EMULATE_GPU is defined. Because
* GPUs (currently) only handle non-bonded calculations, we will
{
init_ewald_f_table(ic, rtab);
- if (fp != NULL)
+ if (fp != nullptr)
{
fprintf(fp, "Initialized non-bonded Ewald correction tables, spacing: %.2e size: %d\n\n",
1/ic->tabq_scale, ic->tabq_size);
}
}
- if (fp != NULL)
+ if (fp != nullptr)
{
real dispersion_shift;
&bEmulateGPU,
fr->gpu_opt);
- nbv->nbs = NULL;
+ nbv->nbs = nullptr;
nbv->min_ci_balanced = 0;
nbv->ngrp = (DOMAINDECOMP(cr) ? 2 : 1);
for (i = 0; i < nbv->ngrp; i++)
{
nbv->grp[i].nbl_lists.nnbl = 0;
- nbv->grp[i].nbat = NULL;
+ nbv->grp[i].nbat = nullptr;
nbv->grp[i].kernel_type = nbnxnkNotSet;
if (i == 0) /* local */
}
else /* non-local */
{
- if (nbpu_opt != NULL && strcmp(nbpu_opt, "gpu_cpu") == 0)
+ if (nbpu_opt != nullptr && strcmp(nbpu_opt, "gpu_cpu") == 0)
{
/* Use GPU for local, select a CPU kernel for non-local */
pick_nbnxn_kernel(fp, mdlog, fr->use_simd_kernels,
}
nbnxn_init_search(&nbv->nbs,
- DOMAINDECOMP(cr) ? &cr->dd->nc : NULL,
- DOMAINDECOMP(cr) ? domdec_zones(cr->dd) : NULL,
+ DOMAINDECOMP(cr) ? &cr->dd->nc : nullptr,
+ DOMAINDECOMP(cr) ? domdec_zones(cr->dd) : nullptr,
bFEP_NonBonded,
gmx_omp_nthreads_get(emntPairsearch));
if (fr->vdwtype == evdwCUT &&
(fr->vdw_modifier == eintmodNONE ||
fr->vdw_modifier == eintmodPOTSHIFT) &&
- getenv("GMX_NO_LJ_COMB_RULE") == NULL)
+ getenv("GMX_NO_LJ_COMB_RULE") == nullptr)
{
/* Plain LJ cut-off: we can optimize with combination rules */
enbnxninitcombrule = enbnxninitcombruleDETECT;
}
#endif /* GMX_THREAD_MPI */
- if ((env = getenv("GMX_NB_MIN_CI")) != NULL)
+ if ((env = getenv("GMX_NB_MIN_CI")) != nullptr)
{
char *end;
gmx_bool usingGpu(nonbonded_verlet_t *nbv)
{
- return nbv != NULL && nbv->bUseGPU;
+ return nbv != nullptr && nbv->bUseGPU;
}
void init_forcerec(FILE *fp,
gmx_bool bFEP_NonBonded;
int *nm_ind, egp_flags;
- if (fr->hwinfo == NULL)
+ if (fr->hwinfo == nullptr)
{
/* Detect hardware, gather information.
* In mdrun, hwinfo has already been set before calling init_forcerec.
fr->sc_sigma6_def = gmx::power6(ir->fepvals->sc_sigma);
env = getenv("GMX_SCSIGMA_MIN");
- if (env != NULL)
+ if (env != nullptr)
{
dbl = 0;
sscanf(env, "%20lf", &dbl);
}
fr->bNonbonded = TRUE;
- if (getenv("GMX_NO_NONBONDED") != NULL)
+ if (getenv("GMX_NO_NONBONDED") != nullptr)
{
/* turn off non-bonded calculations */
fr->bNonbonded = FALSE;
* can be used with water optimization, and disable it if that is not the case.
*/
- if (getenv("GMX_NB_GENERIC") != NULL)
+ if (getenv("GMX_NB_GENERIC") != nullptr)
{
- if (fp != NULL)
+ if (fp != nullptr)
{
fprintf(fp,
"Found environment variable GMX_NB_GENERIC.\n"
bNoSolvOpt = TRUE;
}
- if ( (getenv("GMX_DISABLE_SIMD_KERNELS") != NULL) || (getenv("GMX_NOOPTIMIZEDKERNELS") != NULL) )
+ if ( (getenv("GMX_DISABLE_SIMD_KERNELS") != nullptr) || (getenv("GMX_NOOPTIMIZEDKERNELS") != nullptr) )
{
fr->use_simd_kernels = FALSE;
- if (fp != NULL)
+ if (fp != nullptr)
{
fprintf(fp,
"\nFound environment variable GMX_DISABLE_SIMD_KERNELS.\n"
fr->bBHAM = (mtop->ffparams.functype[0] == F_BHAM);
/* Check if we can/should do all-vs-all kernels */
- fr->bAllvsAll = can_use_allvsall(ir, FALSE, NULL, NULL);
- fr->AllvsAll_work = NULL;
- fr->AllvsAll_workgb = NULL;
+ fr->bAllvsAll = can_use_allvsall(ir, FALSE, nullptr, nullptr);
+ fr->AllvsAll_work = nullptr;
+ fr->AllvsAll_workgb = nullptr;
/* All-vs-all kernels have not been implemented in 4.6 and later.
* See Redmine #1249. */
if (fr->bAllvsAll)
{
fr->bAllvsAll = FALSE;
- if (fp != NULL)
+ if (fp != nullptr)
{
fprintf(fp,
"\nYour simulation settings would have triggered the efficient all-vs-all\n"
{
fprintf(stderr, "\n%s\n", note);
}
- if (fp != NULL)
+ if (fp != nullptr)
{
fprintf(fp, "\n%s\n", note);
}
{
fr->bMolPBC = TRUE;
- if (getenv("GMX_USE_GRAPH") != NULL)
+ if (getenv("GMX_USE_GRAPH") != nullptr)
{
fr->bMolPBC = FALSE;
if (fp)
fr->cg_nalloc = ncg_mtop(mtop);
srenew(fr->cg_cm, fr->cg_nalloc);
}
- if (fr->shift_vec == NULL)
+ if (fr->shift_vec == nullptr)
{
snew(fr->shift_vec, SHIFTS);
}
- if (fr->fshift == NULL)
+ if (fr->fshift == nullptr)
{
snew(fr->fshift, SHIFTS);
}
- if (fr->nbfp == NULL)
+ if (fr->nbfp == nullptr)
{
fr->ntype = mtop->ffparams.atnr;
fr->nbfp = mk_nbfp(&mtop->ffparams, fr->bBHAM);
/* make tables for ordinary interactions */
if (bSomeNormalNbListsAreInUse)
{
- make_nbf_tables(fp, fr, rtab, tabfn, NULL, NULL, &fr->nblists[0]);
+ make_nbf_tables(fp, fr, rtab, tabfn, nullptr, nullptr, &fr->nblists[0]);
m = 1;
}
else
&fr->bExcl_IntraCGAll_InterCGNone);
if (DOMAINDECOMP(cr))
{
- fr->cginfo = NULL;
+ fr->cginfo = nullptr;
}
else
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
nl->maxnrj = 0;
nl->nri = 0;
nl->nrj = 0;
- nl->iinr = NULL;
- nl->gid = NULL;
- nl->shift = NULL;
- nl->jindex = NULL;
- nl->jjnr = NULL;
+ nl->iinr = nullptr;
+ nl->gid = nullptr;
+ nl->shift = nullptr;
+ nl->jindex = nullptr;
+ nl->jjnr = nullptr;
/*nl->nltype = nltype;*/
srenew(nl->iinr, nl->maxnri);
snew(fr->invsqrta, natoms);
snew(fr->dvda, natoms);
- fr->dadx = NULL;
- fr->dadx_rawptr = NULL;
+ fr->dadx = nullptr;
+ fr->dadx_rawptr = nullptr;
fr->nalloc_dadx = 0;
- born->gpol_still_work = NULL;
- born->gpol_hct_work = NULL;
+ born->gpol_still_work = nullptr;
+ born->gpol_hct_work = nullptr;
/* snew(born->asurf,natoms); */
/* snew(born->dasurf,natoms); */
int cnt;
int ndadx;
- if (fr->bAllvsAll && fr->dadx == NULL)
+ if (fr->bAllvsAll && fr->dadx == nullptr)
{
/* We might need up to 8 atoms of padding before and after,
* and another 4 units to guarantee SSE alignment.
}
else
{
- pbc_null = NULL;
+ pbc_null = nullptr;
}
if (sa_algorithm == esaAPPROX)
srenew(lists->list, lists->list_nalloc);
for (i = lists->nlist; i < lists->list_nalloc; i++)
{
- lists->list[i].aj = NULL;
+ lists->list[i].aj = nullptr;
lists->list[i].aj_nalloc = 0;
}
aj = il->iatoms[ind+2];
int shift = CENTRAL;
- if (g != NULL)
+ if (g != nullptr)
{
rvec_sub(x[ai], x[aj], dx);
ivec_sub(SHIFT_IVEC(g, ai), SHIFT_IVEC(g, aj), dt);
t_pbc pbc;
struct gbtmpnbls *nls;
- gbtmpnbl_t *list = NULL;
+ gbtmpnbl_t *list = nullptr;
set_pbc(&pbc, fr->ePBC, box);
nls = born->nblist_work;
void make_local_gb(const t_commrec *cr, gmx_genborn_t *born, int gb_algorithm)
{
int i, at0, at1;
- gmx_domdec_t *dd = NULL;
+ gmx_domdec_t *dd = nullptr;
if (DOMAINDECOMP(cr))
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2009, The GROMACS Development Team.
- * Copyright (c) 2010,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,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.
aadata = *((gmx_allvsallgb2_data_t **)work);
- if (aadata == NULL)
+ if (aadata == nullptr)
{
genborn_allvsall_setup(&aadata, top->idef.il, mdatoms->nr,
FALSE, FALSE, TRUE);
aadata = *((gmx_allvsallgb2_data_t **)work);
- if (aadata == NULL)
+ if (aadata == nullptr)
{
genborn_allvsall_setup(&aadata, top->idef.il, mdatoms->nr,
TRUE, TRUE, TRUE);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
/* check the environment variable */
- if ((env = getenv(modth_env_var[m])) != NULL)
+ if ((env = getenv(modth_env_var[m])) != nullptr)
{
sscanf(env, "%d", &nth);
/* with the verlet codepath, when any GMX_*_NUM_THREADS env var is set,
* OMP_NUM_THREADS also has to be set */
- if (bFullOmpSupport && getenv("OMP_NUM_THREADS") == NULL)
+ if (bFullOmpSupport && getenv("OMP_NUM_THREADS") == nullptr)
{
gmx_warning("%s=%d is set, the default number of threads also "
"needs to be set with OMP_NUM_THREADS!",
GMX_RELEASE_ASSERT(nthreads_omp, "nthreads_omp must be a non-NULL pointer");
- if ((env = getenv("OMP_NUM_THREADS")) != NULL)
+ if ((env = getenv("OMP_NUM_THREADS")) != nullptr)
{
int nt_omp;
* - 1
*/
nth = 1;
- if ((env = getenv("OMP_NUM_THREADS")) != NULL)
+ if ((env = getenv("OMP_NUM_THREADS")) != nullptr)
{
if (!bOMP && (std::strncmp(env, "1", 1) != 0))
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
/* Save the atoms index in the local atom numbers array */
(*anrs_loc)[localnr] = ii;
- if (coll_ind != NULL)
+ if (coll_ind != nullptr)
{
/* Keep track of where this local atom belongs in the collective index array.
* This is needed when reducing the local arrays to a collective/global array
* The rest of the code is for making the group whole again in case atoms changed
* their PBC representation / crossed a box boundary. We only do that if the
* shifts array is allocated. */
- if (NULL != shifts)
+ if (nullptr != shifts)
{
/* To make the group whole, start with a whole group and each
* step move the assembled positions at closest distance to the positions
clear_dvec(dsumvec);
/* Loop over all atoms and add their weighted position vectors */
- if (weight != NULL)
+ if (weight != nullptr)
{
for (i = 0; i < nat; i++)
{
weight_sum = get_sum_of_positions(x, weight, nr, dcenter);
- if (weight != NULL)
+ if (weight != nullptr)
{
denom = weight_sum; /* Divide by the sum of weight */
}
weight_sum = buf[3];
}
- if (weight_loc != NULL)
+ if (weight_loc != nullptr)
{
denom = 1.0/weight_sum; /* Divide by the sum of weight to get center of mass e.g. */
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int *ibuf, p;
gmx_bool bCompatible;
- if (NULL != log && !bQuiet)
+ if (nullptr != log && !bQuiet)
{
fprintf(log, "Multi-checking %s ... ", name);
}
- if (ms == NULL)
+ if (ms == nullptr)
{
gmx_fatal(FARGS,
"check_multi_int called with a NULL communication pointer");
if (bCompatible)
{
- if (NULL != log && !bQuiet)
+ if (nullptr != log && !bQuiet)
{
fprintf(log, "OK\n");
}
}
else
{
- if (NULL != log)
+ if (nullptr != log)
{
fprintf(log, "\n%s is not equal for all subsystems\n", name);
for (p = 0; p < ms->nsim; p++)
int p;
gmx_bool bCompatible;
- if (NULL != log && !bQuiet)
+ if (nullptr != log && !bQuiet)
{
fprintf(log, "Multi-checking %s ... ", name);
}
- if (ms == NULL)
+ if (ms == nullptr)
{
gmx_fatal(FARGS,
"check_multi_int called with a NULL communication pointer");
if (bCompatible)
{
- if (NULL != log && !bQuiet)
+ if (nullptr != log && !bQuiet)
{
fprintf(log, "OK\n");
}
{
// TODO Part of this error message would also be good to go to
// stderr (from one rank of one sim only)
- if (NULL != log)
+ if (nullptr != log)
{
fprintf(log, "\n%s is not equal for all subsystems\n", name);
for (p = 0; p < ms->nsim; p++)
{
if (fp)
{
- gmx_fatal_set_log_file(NULL);
+ gmx_fatal_set_log_file(nullptr);
gmx_fio_fclose(fp);
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
wallcycle_start(wcycle, ewcMoveE);
global_stat(gstat, cr, enerd, force_vir, shake_vir, mu_tot,
- ir, ekind, constr, bStopCM ? vcm : NULL,
+ ir, ekind, constr, bStopCM ? vcm : nullptr,
signalBuffer.size(), signalBuffer.data(),
totalNumberOfBondedInteractions,
*bSumEkinhOld, flags);
}
if (ir->eSwapCoords != eswapNO)
{
- if (state->swapstate == NULL)
+ if (state->swapstate == nullptr)
{
snew(state->swapstate, 1);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
* Therefore, when adding code, the user should use something like:
* gprnrU1 = (md->cU1==NULL ? 0 : md->cU1[localatindex])
*/
- if (mtop->groups.grpnr[egcUser1] != NULL)
+ if (mtop->groups.grpnr[egcUser1] != nullptr)
{
srenew(md->cU1, md->nalloc);
}
- if (mtop->groups.grpnr[egcUser2] != NULL)
+ if (mtop->groups.grpnr[egcUser2] != nullptr)
{
srenew(md->cU2, md->nalloc);
}
real mA, mB, fac;
real c6, c12;
- if (index == NULL)
+ if (index == nullptr)
{
ag = i;
}
if (ir->bQMMM)
{
- if (groups->grpnr[egcQMMM] == 0 ||
+ if (groups->grpnr[egcQMMM] == nullptr ||
groups->grpnr[egcQMMM][ag] < groups->grps[egcQMMM].nr-1)
{
md->bQM[i] = TRUE;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
md->nCrmsd = 1;
}
- md->bConstrVir = (getenv("GMX_CONSTRAINTVIR") != NULL);
+ md->bConstrVir = (getenv("GMX_CONSTRAINTVIR") != nullptr);
}
else
{
/* Pass NULL for unit to let get_ebin_space determine the units
* for interaction_function[i].longname
*/
- md->ie = get_ebin_space(md->ebin, md->f_nre, ener_nm, NULL);
+ md->ie = get_ebin_space(md->ebin, md->f_nre, ener_nm, nullptr);
if (md->nCrmsd)
{
/* This should be called directly after the call for md->ie,
do_enxnms(fp_ene, &md->ebin->nener, &md->ebin->enm);
}
- md->print_grpnms = NULL;
+ md->print_grpnms = nullptr;
/* check whether we're going to write dh histograms */
- md->dhc = NULL;
+ md->dhc = nullptr;
if (ir->fepvals->separate_dhdl_file == esepdhdlfileNO)
{
/* Currently dh histograms are only written with dynamics */
mde_delta_h_coll_init(md->dhc, ir);
}
- md->fp_dhdl = NULL;
+ md->fp_dhdl = nullptr;
snew(md->dE, ir->fepvals->n_lambda);
}
else
{
/* zero for simulated tempering */
md->dE[i] = enerd->enerpart_lambda[i+1]-enerd->enerpart_lambda[0];
- if (md->temperatures != NULL)
+ if (md->temperatures != nullptr)
{
/* MRS: is this right, given the way we have defined the exchange probabilities? */
/* is this even useful to have at all? */
if (md->nE > 1)
{
- if (md->print_grpnms == NULL)
+ if (md->print_grpnms == nullptr)
{
snew(md->print_grpnms, md->nE);
n = 0;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
dh->ndhmax = ndhmax+2;
for (i = 0; i < 2; i++)
{
- dh->bin[i] = NULL;
+ dh->bin[i] = nullptr;
}
snew(dh->dh, dh->ndhmax);
{
blk->sub[2].nr = 0;
blk->sub[2].type = xdr_datatype_float;
- blk->sub[2].fval = NULL;
+ blk->sub[2].fval = nullptr;
}
}
else
else
{
/* don't allocate the meta-data subblocks for lambda vectors */
- dhc->native_lambda_vec = NULL;
+ dhc->native_lambda_vec = nullptr;
dhc->n_lambda_vec = 0;
- dhc->native_lambda_components = 0;
+ dhc->native_lambda_components = nullptr;
dhc->lambda_index = -1;
}
/* allocate metadata subblocks */
/* now decide which data to write out */
dhc->nlambda = 0;
dhc->ndhdl = 0;
- dhc->dh_expanded = NULL;
- dhc->dh_energy = NULL;
- dhc->dh_pv = NULL;
+ dhc->dh_expanded = nullptr;
+ dhc->dh_energy = nullptr;
+ dhc->dh_pv = nullptr;
/* total number of raw data point collections in the sample */
dhc->ndh = 0;
dhc->dh_expanded = dhc->dh+n;
mde_delta_h_init(dhc->dh+n, ir->fepvals->dh_hist_size,
ir->fepvals->dh_hist_spacing, ndhmax,
- dhbtEXPANDED, 0, 0, NULL);
+ dhbtEXPANDED, 0, 0, nullptr);
n++;
}
if (bEnergy)
dhc->dh_energy = dhc->dh+n;
mde_delta_h_init(dhc->dh+n, ir->fepvals->dh_hist_size,
ir->fepvals->dh_hist_spacing, ndhmax,
- dhbtEN, 0, 0, NULL);
+ dhbtEN, 0, 0, nullptr);
n++;
}
/* add the dhdl's */
dhc->dh_pv = dhc->dh+n;
mde_delta_h_init(dhc->dh+n, ir->fepvals->dh_hist_size,
ir->fepvals->dh_hist_spacing, ndhmax,
- dhbtPV, 0, 0, NULL);
+ dhbtPV, 0, 0, nullptr);
n++;
}
}
{
mde_delta_h_add_dh(dhc->dh_du+i, foreign_dU[i]);
}
- if (dhc->dh_pv != NULL)
+ if (dhc->dh_pv != nullptr)
{
mde_delta_h_add_dh(dhc->dh_pv, pV);
}
- if (dhc->dh_energy != NULL)
+ if (dhc->dh_energy != nullptr)
{
mde_delta_h_add_dh(dhc->dh_energy, energy);
}
- if (dhc->dh_expanded != NULL)
+ if (dhc->dh_expanded != nullptr)
{
mde_delta_h_add_dh(dhc->dh_expanded, fep_state);
}
/* only allocate lambda vector component blocks if they must be written out
for backward compatibility */
- if (dhc->native_lambda_components != NULL)
+ if (dhc->native_lambda_components != nullptr)
{
add_subblocks_enxblock(blk, 2);
}
dhc->subblock_d[3] = dhc->start_lambda; /* old-style lambda at starttime */
dhc->subblock_d[4] = dhc->delta_lambda; /* lambda diff. between samples */
/* set the lambda vector components if they exist */
- if (dhc->native_lambda_components != NULL)
+ if (dhc->native_lambda_components != nullptr)
{
for (i = 0; i < dhc->n_lambda_vec; i++)
{
blk->sub[0].type = xdr_datatype_double;
blk->sub[0].dval = dhc->subblock_d;
- if (dhc->native_lambda_components != NULL)
+ if (dhc->native_lambda_components != nullptr)
{
dhc->subblock_i[0] = dhc->lambda_index;
/* set the lambda vector component IDs if they exist */
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
snew(of, 1);
- of->fp_trn = NULL;
- of->fp_ene = NULL;
- of->fp_xtc = NULL;
- of->tng = NULL;
- of->tng_low_prec = NULL;
- of->fp_dhdl = NULL;
+ of->fp_trn = nullptr;
+ of->fp_ene = nullptr;
+ of->fp_xtc = nullptr;
+ of->tng = nullptr;
+ of->tng_low_prec = nullptr;
+ of->fp_dhdl = nullptr;
of->eIntegrator = ir->eI;
of->bExpanded = ir->bExpanded;
of->simulation_part = ir->simulation_part;
of->x_compression_precision = static_cast<int>(ir->x_compression_precision);
of->wcycle = wcycle;
- of->f_global = NULL;
+ of->f_global = nullptr;
if (MASTER(cr))
{
if (mdof_flags & (MDOF_X | MDOF_V | MDOF_F))
{
- const rvec *x = (mdof_flags & MDOF_X) ? as_rvec_array(state_global->x.data()) : NULL;
- const rvec *v = (mdof_flags & MDOF_V) ? as_rvec_array(state_global->v.data()) : NULL;
- const rvec *f = (mdof_flags & MDOF_F) ? f_global : NULL;
+ const rvec *x = (mdof_flags & MDOF_X) ? as_rvec_array(state_global->x.data()) : nullptr;
+ const rvec *v = (mdof_flags & MDOF_V) ? as_rvec_array(state_global->v.data()) : nullptr;
+ const rvec *f = (mdof_flags & MDOF_F) ? f_global : nullptr;
if (of->fp_trn)
{
}
if (mdof_flags & MDOF_X_COMPRESSED)
{
- rvec *xxtc = NULL;
+ rvec *xxtc = nullptr;
if (of->natoms_x_compressed == of->natoms_global)
{
state_local->box,
of->natoms_x_compressed,
xxtc,
- NULL,
- NULL);
+ nullptr,
+ nullptr);
if (of->natoms_x_compressed != of->natoms_global)
{
sfree(xxtc);
void done_mdoutf(gmx_mdoutf_t of, const t_inputrec *ir)
{
- if (of->fp_ene != NULL)
+ if (of->fp_ene != nullptr)
{
close_enx(of->fp_ene);
}
{
gmx_trr_close(of->fp_trn);
}
- if (of->fp_dhdl != NULL)
+ if (of->fp_dhdl != nullptr)
{
gmx_fio_fclose(of->fp_dhdl);
}
ir->efield->finishOutput();
- if (of->f_global != NULL)
+ if (of->f_global != nullptr)
{
sfree(of->f_global);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
else
{
numAtomIndex = -1;
- atomIndex = NULL;
+ atomIndex = nullptr;
numHomeAtoms = top_global->natoms;
}
atoms2md(top_global, ir, numAtomIndex, atomIndex, numHomeAtoms, mdatoms);
{
GMX_ASSERT(graph != NULL, "We use a graph with PBC (no periodic mols) and without DD");
- *graph = mk_graph(NULL, &(top->idef), 0, top_global->natoms, FALSE, FALSE);
+ *graph = mk_graph(nullptr, &(top->idef), 0, top_global->natoms, FALSE, FALSE);
}
- else if (graph != NULL)
+ else if (graph != nullptr)
{
- *graph = NULL;
+ *graph = nullptr;
}
/* Note that with DD only flexible constraints, not shells, are supported
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
state_global->ngtc = 0;
/* Initialize lambda variables */
- initialize_lambdas(fplog, ir, &(state_global->fep_state), &state_global->lambda, NULL);
+ initialize_lambdas(fplog, ir, &(state_global->fep_state), &state_global->lambda, nullptr);
init_nrnb(nrnb);
/* Interactive molecular dynamics */
init_IMD(ir, cr, top_global, fplog, 1, as_rvec_array(state_global->x.data()),
- nfile, fnm, NULL, imdport, Flags);
+ nfile, fnm, nullptr, imdport, Flags);
if (ir->eI == eiNM)
{
/* With energy minimization, shells and flexible constraints are
* automatically minimized when treated like normal DOFS.
*/
- if (shellfc != NULL)
+ if (shellfc != nullptr)
{
- *shellfc = NULL;
+ *shellfc = nullptr;
}
}
state_global, top_global, ir,
&ems->s, &ems->f, mdatoms, *top,
fr, vsite, constr,
- nrnb, NULL, FALSE);
+ nrnb, nullptr, FALSE);
dd_store_state(cr->dd, &ems->s);
- *graph = NULL;
+ *graph = nullptr;
}
else
{
snew(*top, 1);
mdAlgorithmsSetupAtomData(cr, ir, top_global, *top, fr,
graph, mdatoms,
- vsite, shellfc ? *shellfc : NULL);
+ vsite, shellfc ? *shellfc : nullptr);
update_mdatoms(mdatoms, state_global->lambda[efptFEP]);
{
/* Constrain the starting coordinates */
dvdl_constr = 0;
- constrain(PAR(cr) ? NULL : fplog, TRUE, TRUE, constr, &(*top)->idef,
+ constrain(PAR(cr) ? nullptr : fplog, TRUE, TRUE, constr, &(*top)->idef,
ir, cr, -1, 0, 1.0, mdatoms,
as_rvec_array(ems->s.x.data()),
as_rvec_array(ems->s.x.data()),
- NULL,
+ nullptr,
fr->bMolPBC, ems->s.box,
ems->s.lambda[efptFEP], &dvdl_constr,
- NULL, NULL, nrnb, econqCoord);
+ nullptr, nullptr, nrnb, econqCoord);
}
}
}
else
{
- *gstat = NULL;
+ *gstat = nullptr;
}
- *outf = init_mdoutf(fplog, nfile, fnm, 0, cr, ir, top_global, NULL, wcycle);
+ *outf = init_mdoutf(fplog, nfile, fnm, 0, cr, ir, top_global, nullptr, wcycle);
snew(*enerd, 1);
init_enerdata(top_global->groups.grps[egcENER].nr, ir->fepvals->n_lambda,
*enerd);
- if (mdebin != NULL)
+ if (mdebin != nullptr)
{
/* Init bin for energy stuff */
- *mdebin = init_mdebin(mdoutf_get_fp_ene(*outf), top_global, ir, NULL);
+ *mdebin = init_mdebin(mdoutf_get_fp_ene(*outf), top_global, ir, nullptr);
}
clear_rvec(mu_tot);
&state->s, state_global, energyHistory,
&state->f);
- if (confout != NULL && MASTER(cr))
+ if (confout != nullptr && MASTER(cr))
{
if (ir->ePBC != epbcNONE && !ir->bPeriodicMols && DOMAINDECOMP(cr))
{
write_sto_conf_mtop(confout,
*top_global->name, top_global,
- as_rvec_array(state_global->x.data()), NULL, ir->ePBC, state_global->box);
+ as_rvec_array(state_global->x.data()), nullptr, ir->ePBC, state_global->box);
}
}
wallcycle_start(wcycle, ewcCONSTR);
dvdl_constr = 0;
validStep =
- constrain(NULL, TRUE, TRUE, constr, &top->idef,
+ constrain(nullptr, TRUE, TRUE, constr, &top->idef,
ir, cr, count, 0, 1.0, md,
as_rvec_array(s1->x.data()), as_rvec_array(s2->x.data()),
- NULL, bMolPBC, s2->box,
+ nullptr, bMolPBC, s2->box,
s2->lambda[efptBONDED], &dvdl_constr,
- NULL, NULL, nrnb, econqCoord);
+ nullptr, nullptr, nrnb, econqCoord);
wallcycle_stop(wcycle, ewcCONSTR);
// We should move this check to the different minimizers
{
/* Repartition the domain decomposition */
dd_partition_system(fplog, step, cr, FALSE, 1,
- NULL, top_global, ir,
+ nullptr, top_global, ir,
&ems->s, &ems->f,
mdatoms, top, fr, vsite, constr,
nrnb, wcycle, FALSE);
if (vsite)
{
- construct_vsites(vsite, as_rvec_array(ems->s.x.data()), 1, NULL,
+ construct_vsites(vsite, as_rvec_array(ems->s.x.data()), 1, nullptr,
top->idef.iparams, top->idef.il,
fr->ePBC, fr->bMolPBC, cr, ems->s.box);
}
count, nrnb, wcycle, top, &top_global->groups,
ems->s.box, &ems->s.x, &ems->s.hist,
&ems->f, force_vir, mdatoms, enerd, fcd,
- &ems->s.lambda, graph, fr, vsite, mu_tot, t, NULL, TRUE,
+ &ems->s.lambda, graph, fr, vsite, mu_tot, t, nullptr, TRUE,
GMX_FORCE_STATECHANGED | GMX_FORCE_ALLFORCES |
GMX_FORCE_VIRIAL | GMX_FORCE_ENERGY |
(bNS ? GMX_FORCE_NS : 0));
wallcycle_start(wcycle, ewcMoveE);
global_stat(gstat, cr, enerd, force_vir, shake_vir, mu_tot,
- inputrec, NULL, NULL, NULL, 1, &terminate,
- NULL, FALSE,
+ inputrec, nullptr, nullptr, nullptr, 1, &terminate,
+ nullptr, FALSE,
CGLO_ENERGY |
CGLO_PRESSURE |
CGLO_CONSTRAINT);
wallcycle_start(wcycle, ewcCONSTR);
dvdl_constr = 0;
rvec *f_rvec = as_rvec_array(ems->f.data());
- constrain(NULL, FALSE, FALSE, constr, &top->idef,
+ constrain(nullptr, FALSE, FALSE, constr, &top->idef,
inputrec, cr, count, 0, 1.0, mdatoms,
as_rvec_array(ems->s.x.data()), f_rvec, f_rvec,
fr->bMolPBC, ems->s.box,
ems->s.lambda[efptBONDED], &dvdl_constr,
- NULL, &shake_vir, nrnb, econqForceDispl);
+ nullptr, &shake_vir, nrnb, econqForceDispl);
enerd->term[F_DVDL_CONSTR] += dvdl_constr;
m_add(force_vir, shake_vir, vir);
wallcycle_stop(wcycle, ewcCONSTR);
init_em(fplog, CG, cr, inputrec,
state_global, top_global, s_min, &top,
nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat,
- vsite, constr, NULL,
+ vsite, constr, nullptr,
nfile, fnm, &outf, &mdebin, imdport, Flags, wcycle);
/* Print to log file */
/* Copy stuff to the energy bin for easy printing etc. */
upd_mdebin(mdebin, FALSE, FALSE, (double)step,
mdatoms->tmass, enerd, &s_min->s, inputrec->fepvals, inputrec->expandedvals, s_min->s.box,
- NULL, NULL, vir, pres, NULL, mu_tot, constr);
+ nullptr, nullptr, vir, pres, nullptr, mu_tot, constr);
print_ebin_header(fplog, step, step);
print_ebin(mdoutf_get_fp_ene(outf), TRUE, FALSE, FALSE, fplog, step, step, eprNORMAL,
}
/* Calculate the norm of the search vector */
- get_f_norm_max(cr, &(inputrec->opts), mdatoms, pm, &pnorm, NULL, NULL);
+ get_f_norm_max(cr, &(inputrec->opts), mdatoms, pm, &pnorm, nullptr, nullptr);
/* Just in case stepsize reaches zero due to numerical precision... */
if (stepsize <= 0)
do_x = do_per_step(step, inputrec->nstxout);
do_f = do_per_step(step, inputrec->nstfout);
- write_em_traj(fplog, cr, outf, do_x, do_f, NULL,
+ write_em_traj(fplog, cr, outf, do_x, do_f, nullptr,
top_global, inputrec, step,
s_min, state_global, energyHistory);
/* Store the new (lower) energies */
upd_mdebin(mdebin, FALSE, FALSE, (double)step,
mdatoms->tmass, enerd, &s_min->s, inputrec->fepvals, inputrec->expandedvals, s_min->s.box,
- NULL, NULL, vir, pres, NULL, mu_tot, constr);
+ nullptr, nullptr, vir, pres, nullptr, mu_tot, constr);
do_log = do_per_step(step, inputrec->nstlog);
do_ene = do_per_step(step, inputrec->nstenergy);
print_ebin_header(fplog, step, step);
}
print_ebin(mdoutf_get_fp_ene(outf), do_ene, FALSE, FALSE,
- do_log ? fplog : NULL, step, step, eprNORMAL,
+ do_log ? fplog : nullptr, step, step, eprNORMAL,
mdebin, fcd, &(top_global->groups), &(inputrec->opts));
}
{
/* Write final energy file entries */
print_ebin(mdoutf_get_fp_ene(outf), !do_ene, FALSE, FALSE,
- !do_log ? fplog : NULL, step, step, eprNORMAL,
+ !do_log ? fplog : nullptr, step, step, eprNORMAL,
mdebin, fcd, &(top_global->groups), &(inputrec->opts));
}
}
gmx_fatal(FARGS, "Cannot do parallel L-BFGS Minimization - yet.\n");
}
- if (NULL != constr)
+ if (nullptr != constr)
{
gmx_fatal(FARGS, "The combination of constraints and L-BFGS minimization is not implemented. Either do not use constraints, or use another minimizer (e.g. steepest descent).");
}
init_em(fplog, LBFGS, cr, inputrec,
state_global, top_global, &ems, &top,
nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat,
- vsite, constr, NULL,
+ vsite, constr, nullptr,
nfile, fnm, &outf, &mdebin, imdport, Flags, wcycle);
start = 0;
if (vsite)
{
- construct_vsites(vsite, as_rvec_array(state_global->x.data()), 1, NULL,
+ construct_vsites(vsite, as_rvec_array(state_global->x.data()), 1, nullptr,
top->idef.iparams, top->idef.il,
fr->ePBC, fr->bMolPBC, cr, state_global->box);
}
/* Copy stuff to the energy bin for easy printing etc. */
upd_mdebin(mdebin, FALSE, FALSE, (double)step,
mdatoms->tmass, enerd, state_global, inputrec->fepvals, inputrec->expandedvals, state_global->box,
- NULL, NULL, vir, pres, NULL, mu_tot, constr);
+ nullptr, nullptr, vir, pres, nullptr, mu_tot, constr);
print_ebin_header(fplog, step, step);
print_ebin(mdoutf_get_fp_ene(outf), TRUE, FALSE, FALSE, fplog, step, step, eprNORMAL,
/* Store the new (lower) energies */
upd_mdebin(mdebin, FALSE, FALSE, (double)step,
mdatoms->tmass, enerd, state_global, inputrec->fepvals, inputrec->expandedvals, state_global->box,
- NULL, NULL, vir, pres, NULL, mu_tot, constr);
+ nullptr, nullptr, vir, pres, nullptr, mu_tot, constr);
do_log = do_per_step(step, inputrec->nstlog);
do_ene = do_per_step(step, inputrec->nstenergy);
if (do_log)
print_ebin_header(fplog, step, step);
}
print_ebin(mdoutf_get_fp_ene(outf), do_ene, FALSE, FALSE,
- do_log ? fplog : NULL, step, step, eprNORMAL,
+ do_log ? fplog : nullptr, step, step, eprNORMAL,
mdebin, fcd, &(top_global->groups), &(inputrec->opts));
}
if (!do_ene || !do_log) /* Write final energy file entries */
{
print_ebin(mdoutf_get_fp_ene(outf), !do_ene, FALSE, FALSE,
- !do_log ? fplog : NULL, step, step, eprNORMAL,
+ !do_log ? fplog : nullptr, step, step, eprNORMAL,
mdebin, fcd, &(top_global->groups), &(inputrec->opts));
}
init_em(fplog, SD, cr, inputrec,
state_global, top_global, s_try, &top,
nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat,
- vsite, constr, NULL,
+ vsite, constr, nullptr,
nfile, fnm, &outf, &mdebin, imdport, Flags, wcycle);
/* Print to log file */
/* Store the new (lower) energies */
upd_mdebin(mdebin, FALSE, FALSE, (double)count,
mdatoms->tmass, enerd, &s_try->s, inputrec->fepvals, inputrec->expandedvals,
- s_try->s.box, NULL, NULL, vir, pres, NULL, mu_tot, constr);
+ s_try->s.box, nullptr, nullptr, vir, pres, nullptr, mu_tot, constr);
/* Prepare IMD energy record, if bIMD is TRUE. */
IMD_fill_energy_record(inputrec->bIMD, inputrec->imd, enerd, count, TRUE);
/* Write to trn, if necessary */
do_x = do_per_step(steps_accepted, inputrec->nstxout);
do_f = do_per_step(steps_accepted, inputrec->nstfout);
- write_em_traj(fplog, cr, outf, do_x, do_f, NULL,
+ write_em_traj(fplog, cr, outf, do_x, do_f, nullptr,
top_global, inputrec, count,
s_min, state_global, energyHistory);
}
{
if (MASTER(cr))
{
- warn_step(stderr, inputrec->em_tol, count == nsteps, constr != NULL);
- warn_step(fplog, inputrec->em_tol, count == nsteps, constr != NULL);
+ warn_step(stderr, inputrec->em_tol, count == nsteps, constr != nullptr);
+ warn_step(fplog, inputrec->em_tol, count == nsteps, constr != nullptr);
}
bAbort = TRUE;
}
rvec *fneg, *dfdx;
gmx_bool bSparse; /* use sparse matrix storage format */
size_t sz;
- gmx_sparsematrix_t * sparse_matrix = NULL;
- real * full_matrix = NULL;
+ gmx_sparsematrix_t * sparse_matrix = nullptr;
+ real * full_matrix = nullptr;
/* added with respect to mdrun */
int row, col;
real x_min;
bool bIsMaster = MASTER(cr);
- if (constr != NULL)
+ if (constr != nullptr)
{
gmx_fatal(FARGS, "Constraints present with Normal Mode Analysis, this combination is not supported");
}
state_global, top_global, &state_work, &top,
nrnb, mu_tot, fr, &enerd, &graph, mdatoms, &gstat,
vsite, constr, &shellfc,
- nfile, fnm, &outf, NULL, imdport, Flags, wcycle);
+ nfile, fnm, &outf, nullptr, imdport, Flags, wcycle);
std::vector<size_t> atom_index = get_atom_index(top_global);
snew(fneg, atom_index.size());
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
ma(&ptr_new, nbytes_new);
- if (nbytes_new > 0 && ptr_new == NULL)
+ if (nbytes_new > 0 && ptr_new == nullptr)
{
gmx_fatal(FARGS, "Allocation of %d bytes failed", nbytes_new);
}
}
memcpy(ptr_new, *ptr, nbytes_copy);
}
- if (*ptr != NULL)
+ if (*ptr != nullptr)
{
mf(*ptr);
}
int nenergrp, int stride,
nbnxn_alloc_t *ma)
{
- out->f = NULL;
+ out->f = nullptr;
ma((void **)&out->fshift, SHIFTS*DIM*sizeof(*out->fshift));
out->nV = nenergrp*nenergrp;
ma((void **)&out->Vvdw, out->nV*sizeof(*out->Vvdw));
char *ptr;
gmx_bool simple, bCombGeom, bCombLB, bSIMD;
- if (alloc == NULL)
+ if (alloc == nullptr)
{
nbat->alloc = nbnxn_alloc_aligned;
}
{
nbat->alloc = alloc;
}
- if (free == NULL)
+ if (free == nullptr)
{
nbat->free = nbnxn_free_aligned;
}
*/
tol = 1e-5;
ptr = getenv("GMX_LJCOMB_TOL");
- if (ptr != NULL)
+ if (ptr != nullptr)
{
double dbl;
set_lj_parameter_data(nbat, bSIMD);
nbat->natoms = 0;
- nbat->type = NULL;
- nbat->lj_comb = NULL;
+ nbat->type = nullptr;
+ nbat->lj_comb = nullptr;
if (simple)
{
int pack_x;
nbat->XFormat = nbatXYZQ;
nbat->FFormat = nbatXYZ;
}
- nbat->q = NULL;
+ nbat->q = nullptr;
nbat->nenergrp = n_energygroups;
if (!simple)
{
/* Energy groups not supported yet for super-sub lists */
- if (n_energygroups > 1 && fp != NULL)
+ if (n_energygroups > 1 && fp != nullptr)
{
fprintf(fp, "\nNOTE: With GPUs, reporting energy group contributions is not supported\n\n");
}
{
nbat->neg_2log++;
}
- nbat->energrp = NULL;
+ nbat->energrp = nullptr;
nbat->alloc((void **)&nbat->shift_vec, SHIFTS*sizeof(*nbat->shift_vec));
nbat->xstride = (nbat->XFormat == nbatXYZQ ? STRIDE_XYZQ : DIM);
nbat->fstride = (nbat->FFormat == nbatXYZQ ? STRIDE_XYZQ : DIM);
- nbat->x = NULL;
+ nbat->x = nullptr;
#if GMX_SIMD
if (simple)
nbat->nenergrp, 1<<nbat->neg_2log,
nbat->alloc);
}
- nbat->buffer_flags.flag = NULL;
+ nbat->buffer_flags.flag = nullptr;
nbat->buffer_flags.flag_nalloc = 0;
nth = gmx_omp_nthreads_get(emntNonbonded);
ptr = getenv("GMX_USE_TREEREDUCE");
- if (ptr != NULL)
+ if (ptr != nullptr)
{
- nbat->bUseTreeReduce = strtol(ptr, 0, 10);
+ nbat->bUseTreeReduce = strtol(ptr, nullptr, 10);
}
#if defined __MIC__
else if (nth > 8) /*on the CPU we currently don't benefit even at 32*/
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
static void nbnxn_grid_init(nbnxn_grid_t * grid)
{
- grid->cxy_na = NULL;
- grid->cxy_ind = NULL;
+ grid->cxy_na = nullptr;
+ grid->cxy_ind = nullptr;
grid->cxy_nalloc = 0;
- grid->bb = NULL;
- grid->bbj = NULL;
+ grid->bb = nullptr;
+ grid->bbj = nullptr;
grid->nc_nalloc = 0;
}
fill_cell(nbs, grid, nbat,
ash_c, ash_c+na_c, atinfo, x,
- NULL);
+ nullptr);
/* This copy to bbcz is not really necessary.
* But it allows to use the same grid search code
/* Home zone */
for (int i = n0; i < n1; i++)
{
- if (move == NULL || move[i] >= 0)
+ if (move == nullptr || move[i] >= 0)
{
/* We need to be careful with rounding,
* particles might be a few bits outside the local zone.
c1[d] = zones->size[zone].bb_x1[d];
}
- nbnxn_put_on_grid(nbs, nbs->ePBC, NULL,
+ nbnxn_put_on_grid(nbs, nbs->ePBC, nullptr,
zone, c0, c1,
zones->cg_range[zone],
zones->cg_range[zone+1],
-1,
atinfo,
x,
- 0, NULL,
+ 0, nullptr,
nb_kernel_type,
nbat);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
const real *x;
gmx_bool bEner;
gmx_bool bEwald;
- const real *Ftab = NULL;
+ const real *Ftab = nullptr;
real rcut2, rvdw2, rlist2;
int ntype;
real facel;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
}
#ifdef CALC_SHIFTFORCES
- if (fshift != NULL)
+ if (fshift != nullptr)
{
/* Add i forces to shifted force list */
for (i = 0; i < UNROLLI; i++)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
#else
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;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
nl->maxnrj = 0;
nl->nri = 0;
nl->nrj = 0;
- nl->iinr = NULL;
- nl->gid = NULL;
- nl->shift = NULL;
- nl->jindex = NULL;
- nl->jjnr = NULL;
- nl->excl_fep = NULL;
+ nl->iinr = nullptr;
+ nl->gid = nullptr;
+ nl->shift = nullptr;
+ nl->jindex = nullptr;
+ nl->jjnr = nullptr;
+ nl->excl_fep = nullptr;
}
nbs->bFEP = bFEP;
- nbs->DomDec = (n_dd_cells != NULL);
+ nbs->DomDec = (n_dd_cells != nullptr);
clear_ivec(nbs->dd_dim);
ngrid = 1;
nbnxn_grids_init(nbs, ngrid);
- nbs->cell = NULL;
+ nbs->cell = nullptr;
nbs->cell_nalloc = 0;
- nbs->a = NULL;
+ nbs->a = nullptr;
nbs->a_nalloc = 0;
nbs->nthread_max = nthread_max;
snew(nbs->work, nbs->nthread_max);
for (int t = 0; t < nbs->nthread_max; t++)
{
- nbs->work[t].cxy_na = NULL;
+ nbs->work[t].cxy_na = nullptr;
nbs->work[t].cxy_na_nalloc = 0;
- nbs->work[t].sort_work = NULL;
+ nbs->work[t].sort_work = nullptr;
nbs->work[t].sort_work_nalloc = 0;
snew(nbs->work[t].nbl_fep, 1);
}
/* Initialize detailed nbsearch cycle counting */
- nbs->print_cycles = (getenv("GMX_NBNXN_CYCLE") != 0);
+ nbs->print_cycles = (getenv("GMX_NBNXN_CYCLE") != nullptr);
nbs->search_count = 0;
nbs_cycle_clear(nbs->cc);
for (int t = 0; t < nbs->nthread_max; t++)
nbnxn_alloc_t *alloc,
nbnxn_free_t *free)
{
- if (alloc == NULL)
+ if (alloc == nullptr)
{
nbl->alloc = nbnxn_alloc_aligned;
}
{
nbl->alloc = alloc;
}
- if (free == NULL)
+ if (free == nullptr)
{
nbl->free = nbnxn_free_aligned;
}
nbl->na_ci = 0;
nbl->na_cj = 0;
nbl->nci = 0;
- nbl->ci = NULL;
+ nbl->ci = nullptr;
nbl->ci_nalloc = 0;
nbl->nsci = 0;
- nbl->sci = NULL;
+ nbl->sci = nullptr;
nbl->sci_nalloc = 0;
nbl->ncj = 0;
nbl->ncjInUse = 0;
- nbl->cj = NULL;
+ nbl->cj = nullptr;
nbl->cj_nalloc = 0;
nbl->ncj4 = 0;
/* We need one element extra in sj, so alloc initially with 1 */
nbl->cj4_nalloc = 0;
- nbl->cj4 = NULL;
+ nbl->cj4 = nullptr;
nbl->nci_tot = 0;
if (!nbl->bSimple)
GMX_ASSERT(sizeof(nbl->cj4[0].imei[0].imask)*8 >= c_nbnxnGpuJgroupSize*c_gpuNumClusterPerCell, "The i super-cluster cluster interaction mask does not contain a sufficient number of bits");
GMX_ASSERT(sizeof(nbl->excl[0])*8 >= c_nbnxnGpuJgroupSize*c_gpuNumClusterPerCell, "The GPU exclusion mask does not contain a sufficient number of bits");
- nbl->excl = NULL;
+ nbl->excl = nullptr;
nbl->excl_nalloc = 0;
nbl->nexcl = 0;
check_excl_space(nbl, 1);
#endif
snew_aligned(nbl->work->d2, c_gpuNumClusterPerCell, NBNXN_SEARCH_BB_MEM_ALIGN);
- nbl->work->sort = NULL;
+ nbl->work->sort = nullptr;
nbl->work->sort_nalloc = 0;
- nbl->work->sci_sort = NULL;
+ nbl->work->sci_sort = nullptr;
nbl->work->sci_sort_nalloc = 0;
}
}
else
{
- nbnxn_init_pairlist(nbl_list->nbl[i], nbl_list->bSimple, NULL, NULL);
+ nbnxn_init_pairlist(nbl_list->nbl[i], nbl_list->bSimple, nullptr, nullptr);
if (bSimple && nbl_list->nnbl > 1)
{
snew(nbl_list->nbl_work[i], 1);
- nbnxn_init_pairlist(nbl_list->nbl_work[i], nbl_list->bSimple, NULL, NULL);
+ nbnxn_init_pairlist(nbl_list->nbl_work[i], nbl_list->bSimple, nullptr, nullptr);
}
}
{
nl->nri = 0;
nl->nrj = 0;
- if (nl->jindex == NULL)
+ if (nl->jindex == nullptr)
{
snew(nl->jindex, 1);
}
int shift;
real shx, shy, shz;
int conv_i, cell0_i;
- const nbnxn_bb_t *bb_i = NULL;
+ const nbnxn_bb_t *bb_i = nullptr;
#if NBNXN_BBXXXX
- const float *pbb_i = NULL;
+ const float *pbb_i = nullptr;
#endif
const float *bbcz_i, *bbcz_j;
const int *flags_i;
int ndistc;
int ncpcheck;
int gridi_flag_shift = 0, gridj_flag_shift = 0;
- gmx_bitmask_t *gridj_flag = NULL;
+ gmx_bitmask_t *gridj_flag = nullptr;
int ncj_old_i, ncj_old_j;
nbs_cycle_start(&work->cc[enbsCCsearch]);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
nl = nl_sr;
homenr = maxsr;
- if (nl == NULL)
+ if (nl == nullptr)
{
return;
}
nl->maxnrj = 0;
nl->nri = -1;
nl->nrj = 0;
- nl->iinr = NULL;
- nl->gid = NULL;
- nl->shift = NULL;
- nl->jindex = NULL;
- nl->jjnr = NULL;
- nl->excl_fep = NULL;
+ nl->iinr = nullptr;
+ nl->gid = nullptr;
+ nl->shift = nullptr;
+ nl->jindex = nullptr;
+ nl->jjnr = nullptr;
+ nl->excl_fep = nullptr;
reallocate_nblist(nl);
nl->jindex[0] = 0;
type = GMX_NBLIST_INTERACTION_STANDARD;
bElecAndVdwSwitchDiffers = ( (fr->rcoulomb_switch != fr->rvdw_switch) || (fr->rcoulomb != fr->rvdw));
- fr->ns->bCGlist = (getenv("GMX_NBLISTCG") != 0);
+ fr->ns->bCGlist = (getenv("GMX_NBLISTCG") != nullptr);
if (!fr->ns->bCGlist)
{
igeometry_def = GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE;
else
{
igeometry_def = GMX_NBLIST_GEOMETRY_CG_CG;
- if (log != NULL)
+ if (log != nullptr)
{
fprintf(log, "\nUsing charge-group - charge-group neighbor lists and kernels\n\n");
}
maxsr_wat, GMX_NBKERNEL_VDW_NONE, eintmodNONE, ielec, ielecmod, igeometry_ww, type, bElecAndVdwSwitchDiffers);
/* Did we get the solvent loops so we can use optimized water kernels? */
- if (nbl->nlist_sr[eNL_VDWQQ_WATER].kernelptr_vf == NULL
- || nbl->nlist_sr[eNL_QQ_WATER].kernelptr_vf == NULL
- || nbl->nlist_sr[eNL_VDWQQ_WATERWATER].kernelptr_vf == NULL
- || nbl->nlist_sr[eNL_QQ_WATERWATER].kernelptr_vf == NULL)
+ if (nbl->nlist_sr[eNL_VDWQQ_WATER].kernelptr_vf == nullptr
+ || nbl->nlist_sr[eNL_QQ_WATER].kernelptr_vf == nullptr
+ || nbl->nlist_sr[eNL_VDWQQ_WATERWATER].kernelptr_vf == nullptr
+ || nbl->nlist_sr[eNL_QQ_WATERWATER].kernelptr_vf == nullptr)
{
fr->solvent_opt = esolNO;
- if (log != NULL)
+ if (log != nullptr)
{
fprintf(log, "Note: The available nonbonded kernels do not support water optimization - disabling.\n");
}
/* QMMM MM list */
if (fr->bQMMM && fr->qr->QMMMscheme != eQMMMschemeoniom)
{
- if (NULL == fr->QMMMlist)
+ if (nullptr == fr->QMMMlist)
{
snew(fr->QMMMlist, 1);
}
maxsr, 0, 0, ielec, ielecmod, GMX_NBLIST_GEOMETRY_PARTICLE_PARTICLE, GMX_NBLIST_INTERACTION_STANDARD, bElecAndVdwSwitchDiffers);
}
- if (log != NULL)
+ if (log != nullptr)
{
fprintf(log, "\n");
}
t_nblist * vdwc;
t_nblist * vdw;
t_nblist * coul;
- t_nblist * vdwc_free = NULL;
- t_nblist * vdw_free = NULL;
- t_nblist * coul_free = NULL;
- t_nblist * vdwc_ww = NULL;
- t_nblist * coul_ww = NULL;
+ t_nblist * vdwc_free = nullptr;
+ t_nblist * vdw_free = nullptr;
+ t_nblist * coul_free = nullptr;
+ t_nblist * vdwc_ww = nullptr;
+ t_nblist * coul_ww = nullptr;
int i, j, jcg, igid, gid, nbl_ind;
int jj, jj0, jj1, i_atom;
}
ns->nra_alloc = 0;
- ns->bexcl = NULL;
+ ns->bexcl = nullptr;
if (!DOMAINDECOMP(cr))
{
ns_realloc_natoms(ns, mtop->natoms);
char *ptr = getenv("GMX_DUMP_NL");
if (ptr)
{
- ns->dump_nl = strtol(ptr, NULL, 10);
+ ns->dump_nl = strtol(ptr, nullptr, 10);
if (fplog)
{
fprintf(fplog, "GMX_DUMP_NL = %d", ns->dump_nl);
}
else
{
- dd_zones = NULL;
+ dd_zones = nullptr;
- get_nsgrid_boundaries(grid->nboundeddim, box, NULL, NULL, NULL, NULL,
+ get_nsgrid_boundaries(grid->nboundeddim, box, nullptr, nullptr, nullptr, nullptr,
cgs->nr, fr->cg_cm, grid_x0, grid_x1, &grid_dens);
- grid_first(log, grid, NULL, NULL, box, grid_x0, grid_x1,
+ grid_first(log, grid, nullptr, nullptr, box, grid_x0, grid_x1,
fr->rlist, grid_dens);
}
}
else
{
- fill_grid(NULL, grid, cgs->nr, fr->cg0, fr->hcg, fr->cg_cm);
+ fill_grid(nullptr, grid, cgs->nr, fr->cg0, fr->hcg, fr->cg_cm);
grid->icg0 = fr->cg0;
grid->icg1 = fr->hcg;
}
/* Set the grid cell index for the test particle only.
* The cell to cg index is not corrected, but that does not matter.
*/
- fill_grid(NULL, ns->grid, fr->hcg, fr->hcg-1, fr->hcg, fr->cg_cm);
+ fill_grid(nullptr, ns->grid, fr->hcg, fr->hcg-1, fr->hcg, fr->cg_cm);
}
if (!fr->ns->bCGlist)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
if (d < nboundeddim)
{
- grid_x0[d] = (gr0 != NULL ? (*gr0)[d] : 0);
- grid_x1[d] = (gr1 != NULL ? (*gr1)[d] : box[d][d]);
+ grid_x0[d] = (gr0 != nullptr ? (*gr0)[d] : 0);
+ grid_x1[d] = (gr1 != nullptr ? (*gr1)[d] : box[d][d]);
vol *= (grid_x1[d] - grid_x0[d]);
}
else
{
- if (ddbox == NULL)
+ if (ddbox == nullptr)
{
get_nsgrid_boundaries_vac(av[d], stddev[d],
&grid_x0[d], &grid_x1[d],
bdens1 = grid_x1[d];
}
/* Check for a DD cell not at a lower edge */
- if (dd != NULL && gr0 != NULL && dd->ci[d] > 0)
+ if (dd != nullptr && gr0 != nullptr && dd->ci[d] > 0)
{
grid_x0[d] = (*gr0)[d];
bdens0 = (*gr0)[d];
}
/* Check for a DD cell not at a higher edge */
- if (dd != NULL && gr1 != NULL && dd->ci[d] < dd->nc[d]-1)
+ if (dd != nullptr && gr1 != nullptr && dd->ci[d] < dd->nc[d]-1)
{
grid_x1[d] = (*gr1)[d];
bdens1 = (*gr1)[d];
fprintf(debug, "Filling grid from %d to %d\n", cg0, cg1);
}
- if (dd_zones == NULL)
+ if (dd_zones == nullptr)
{
for (cg = cg0; cg < cg1; cg++)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
fprintf(debug, "nr. of distance calculations in bondeds: C %.1f SIMD %.1f\n", ndtot_c, ndtot_simd);
}
- if (ndistance_c != NULL)
+ if (ndistance_c != nullptr)
{
*ndistance_c = ndtot_c;
}
- if (ndistance_simd != NULL)
+ if (ndistance_simd != nullptr)
{
*ndistance_simd = ndtot_simd;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
/* here we include the insertion of the additional orca-input */
snew(buf, 200);
- if (addInputFile != NULL)
+ if (addInputFile != nullptr)
{
while (!feof(addInputFile))
{
- if (fgets(buf, 200, addInputFile) != NULL)
+ if (fgets(buf, 200, addInputFile) != nullptr)
{
fputs(buf, out);
}
{
sprintf(orca_xyzFilename, "%s.xyz", qm->orca_basename);
xyz = fopen(orca_xyzFilename, "r");
- if (fgets(buf, 300, xyz) == NULL)
+ if (fgets(buf, 300, xyz) == nullptr)
{
gmx_fatal(FARGS, "Unexpected end of ORCA output");
}
- if (fgets(buf, 300, xyz) == NULL)
+ if (fgets(buf, 300, xyz) == nullptr)
{
gmx_fatal(FARGS, "Unexpected end of ORCA output");
}
for (i = 0; i < qm->nrQMatoms; i++)
{
- if (fgets(buf, 300, xyz) == NULL)
+ if (fgets(buf, 300, xyz) == nullptr)
{
gmx_fatal(FARGS, "Unexpected end of ORCA output");
}
*/
for (j = 0; j < 7; j++)
{
- if (fgets(buf, 300, engrad) == NULL)
+ if (fgets(buf, 300, engrad) == nullptr)
{
gmx_fatal(FARGS, "Unexpected end of ORCA output");
}
}
/* now comes the energy
*/
- if (fgets(buf, 300, engrad) == NULL)
+ if (fgets(buf, 300, engrad) == nullptr)
{
gmx_fatal(FARGS, "Unexpected end of ORCA output");
}
*/
for (j = 0; j < 3; j++)
{
- if (fgets(buf, 300, engrad) == NULL)
+ if (fgets(buf, 300, engrad) == nullptr)
{
gmx_fatal(FARGS, "Unexpected end of ORCA output");
}
for (i = 0; i < 3*qm->nrQMatoms; i++)
{
k = i/3;
- if (fgets(buf, 300, engrad) == NULL)
+ if (fgets(buf, 300, engrad) == nullptr)
{
gmx_fatal(FARGS, "Unexpected end of ORCA output");
}
*/
/* we can skip the first line
*/
- if (fgets(buf, 300, pcgrad) == NULL)
+ if (fgets(buf, 300, pcgrad) == nullptr)
{
gmx_fatal(FARGS, "Unexpected end of ORCA output");
}
for (i = 0; i < mm->nrMMatoms; i++)
{
- if (fgets(buf, 300, pcgrad) == NULL)
+ if (fgets(buf, 300, pcgrad) == nullptr)
{
gmx_fatal(FARGS, "Unexpected end of ORCA output");
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
* Only needed in case of QM/MM optimizations
*/
FILE
- *out = NULL;
+ *out = nullptr;
int
- i, j, k, nrexcl = 0, *excluded = NULL, max_excl = 0;
+ i, j, k, nrexcl = 0, *excluded = nullptr, max_excl = 0;
out = fopen("QMMMexcl.dat", "w");
*/
gmx_groups_t *groups;
- int *qm_arr = NULL, vsite, ai, aj;
+ int *qm_arr = nullptr, vsite, ai, aj;
int qm_max = 0, qm_nr = 0, i, j, jmax, k, l, nrvsite2 = 0;
t_QMMMrec *qr;
t_MMrec *mm;
for (k = 0; k < qm_nr; k++)
{
int indexInMolecule;
- mtopGetMolblockIndex(mtop, qm_arr[k], &molb, NULL, &indexInMolecule);
+ mtopGetMolblockIndex(mtop, qm_arr[k], &molb, nullptr, &indexInMolecule);
t_atom *atom = &mtop->moltype[mtop->molblock[molb].type].atoms.atom[indexInMolecule];
atom->q = 0.0;
atom->qB = 0.0;
*/
for (i = 0; i < qm_nr; i++)
{
- mtopGetMolblockIndex(mtop, qm_arr[i], &molb, NULL, &a_offset);
+ mtopGetMolblockIndex(mtop, qm_arr[i], &molb, nullptr, &a_offset);
ilist_mol = mtop->moltype[mtop->molblock[molb].type].ilist;
nrvsite2 = ilist_mol[F_VSITE2].nr;
iatoms = ilist_mol[F_VSITE2].iatoms;
int
mm_max = 0, mm_nr = 0, mm_nr_new, i, j, is, k, shift;
t_j_particle
- *mm_j_particles = NULL, *qm_i_particles = NULL;
+ *mm_j_particles = nullptr, *qm_i_particles = nullptr;
t_QMMMrec
*qr;
t_nblist
t_pbc
pbc;
int
- *parallelMMarray = NULL;
+ *parallelMMarray = nullptr;
real
c12au, c6au;
t_QMrec
*qm, *qm2;
t_MMrec
- *mm = NULL;
+ *mm = nullptr;
rvec
- *forces = NULL, *fshift = NULL,
- *forces2 = NULL, *fshift2 = NULL; /* needed for multilayer ONIOM */
+ *forces = nullptr, *fshift = nullptr,
+ *forces2 = nullptr, *fshift2 = nullptr; /* needed for multilayer ONIOM */
int
i, j, k;
/* make a local copy the QMMMrec pointer
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
snew(d, 1);
d->nalloc = 0;
- d->rij = NULL;
- d->half_of_reduced_mass = NULL;
- d->distance_squared_tolerance = NULL;
- d->constraint_distance_squared = NULL;
+ d->rij = nullptr;
+ d->half_of_reduced_mass = nullptr;
+ d->distance_squared_tolerance = nullptr;
+ d->constraint_distance_squared = nullptr;
/* SOR initialization */
d->delta = 0.1;
i = ia[1];
j = ia[2];
- if ((econq == econqCoord) && v != NULL)
+ if ((econq == econqCoord) && v != nullptr)
{
/* Correct the velocities */
mm = scaled_lagrange_multiplier[ll]*invmass[i]*invdt;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
gmx_shellfc_t *shfc;
t_shell *shell;
- int *shell_index = NULL, *at2cg;
+ int *shell_index = nullptr, *at2cg;
const t_atom *atom;
int ns, nshell, nsi;
if (nshell == 0 && nflexcon == 0)
{
/* We're not doing shells or flexible constraints */
- return NULL;
+ return nullptr;
}
snew(shfc, 1);
shfc->shell_gl = shell;
shfc->shell_index_gl = shell_index;
- shfc->bPredict = (getenv("GMX_NOPREDICT") == NULL);
+ shfc->bPredict = (getenv("GMX_NOPREDICT") == nullptr);
shfc->bRequireInit = FALSE;
if (!shfc->bPredict)
{
}
else
{
- shfc->bRequireInit = (getenv("GMX_REQUIRE_SHELL_INIT") != NULL);
+ shfc->bRequireInit = (getenv("GMX_REQUIRE_SHELL_INIT") != nullptr);
if (shfc->bRequireInit && fplog)
{
fprintf(fplog, "\nWill always initiate shell positions\n");
{
t_shell *shell;
int a0, a1, *ind, nshell, i;
- gmx_domdec_t *dd = NULL;
+ gmx_domdec_t *dd = nullptr;
if (DOMAINDECOMP(cr))
{
}
}
constrain(log, FALSE, FALSE, constr, idef, ir, cr, step, 0, 1.0, md,
- x, xnold, NULL, bMolPBC, box,
+ x, xnold, nullptr, bMolPBC, box,
(*lambda)[efptBONDED], &(dvdlambda[efptBONDED]),
- NULL, NULL, nrnb, econqCoord);
+ nullptr, nullptr, nrnb, econqCoord);
constrain(log, FALSE, FALSE, constr, idef, ir, cr, step, 0, 1.0, md,
- x, xnew, NULL, bMolPBC, box,
+ x, xnew, nullptr, bMolPBC, box,
(*lambda)[efptBONDED], &(dvdlambda[efptBONDED]),
- NULL, NULL, nrnb, econqCoord);
+ nullptr, nullptr, nrnb, econqCoord);
for (n = 0; n < end; n++)
{
constrain(log, FALSE, FALSE, constr, idef, ir, cr, step, 0, 1.0, md,
x_old, xnew, acc_dir, bMolPBC, box,
(*lambda)[efptBONDED], &(dvdlambda[efptBONDED]),
- NULL, NULL, nrnb, econqDeriv_FlexCon);
+ nullptr, nullptr, nrnb, econqDeriv_FlexCon);
}
void relax_shell_flexcon(FILE *fplog, t_commrec *cr, gmx_bool bVerbose,
int nshell;
t_shell *shell;
t_idef *idef;
- rvec *acc_dir = NULL, *x_old = NULL;
+ rvec *acc_dir = nullptr, *x_old = nullptr;
real Epot[2], df[2];
real sf_dir, invdt;
real ftol, dum = 0;
if (shfc->bPredict && !bCont)
{
predict_shells(fplog, as_rvec_array(state->x.data()), as_rvec_array(state->v.data()), inputrec->delta_t, nshell, shell,
- md->massT, NULL, bInit);
+ md->massT, nullptr, bInit);
}
/* do_force expected the charge groups to be in the box */
state->box, &state->x, &state->hist,
force[Min], force_vir, md, enerd, fcd,
&state->lambda, graph,
- fr, vsite, mu_tot, t, NULL, bBornRadii,
+ fr, vsite, mu_tot, t, nullptr, bBornRadii,
(bDoNS ? GMX_FORCE_NS : 0) | force_flags);
sf_dir = 0;
top, groups, state->box, pos[Try], &state->hist,
force[Try], force_vir,
md, enerd, fcd, &state->lambda, graph,
- fr, vsite, mu_tot, t, NULL, bBornRadii,
+ fr, vsite, mu_tot, t, nullptr, bBornRadii,
force_flags);
if (gmx_debug_at)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
act.sa_handler = signal_handler;
sigemptyset(&act.sa_mask);
act.sa_flags = SA_RESTART;
- sigaction(signum, &act, NULL);
+ sigaction(signum, &act, nullptr);
#else
signal(signum, signal_handler);
#endif
void signal_handler_install(void)
{
- if (getenv("GMX_NO_TERM") == NULL)
+ if (getenv("GMX_NO_TERM") == nullptr)
{
if (debug)
{
}
gmx_signal(SIGTERM);
}
- if (getenv("GMX_NO_INT") == NULL)
+ if (getenv("GMX_NO_INT") == nullptr)
{
if (debug)
{
gmx_signal(SIGINT);
}
#if HAVE_SIGUSR1
- if (getenv("GMX_NO_USR1") == NULL)
+ if (getenv("GMX_NO_USR1") == nullptr)
{
if (debug)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
* if the constructing atoms aren't local.
*/
wallcycle_start(wcycle, ewcVSITESPREAD);
- spread_vsite_f(vsite, x, as_rvec_array(fr->f_novirsum->data()), NULL,
+ spread_vsite_f(vsite, x, as_rvec_array(fr->f_novirsum->data()), nullptr,
(flags & GMX_FORCE_VIRIAL), fr->vir_el_recip,
nrnb,
&top->idef, fr->ePBC, fr->bMolPBC, graph, box, cr);
gmx_bool use_GPU(const nonbonded_verlet_t *nbv)
{
- return nbv != NULL && nbv->bUseGPU;
+ return nbv != nullptr && nbv->bUseGPU;
}
static gmx_inline void clear_rvecs_omp(int n, rvec v[])
nbnxn_put_on_grid(nbv->nbs, fr->ePBC, box,
0, vzero, box_diag,
0, mdatoms->homenr, -1, fr->cginfo, x,
- 0, NULL,
+ 0, nullptr,
nbv->grp[eintLocal].kernel_type,
nbv->grp[eintLocal].nbat);
wallcycle_sub_stop(wcycle, ewcsNBS_GRID_LOCAL);
if (vsite && !(fr->bF_NoVirSum && !(flags & GMX_FORCE_VIRIAL)))
{
wallcycle_start(wcycle, ewcVSITESPREAD);
- spread_vsite_f(vsite, x, f, fr->fshift, FALSE, NULL, nrnb,
+ spread_vsite_f(vsite, x, f, fr->fshift, FALSE, nullptr, nrnb,
&top->idef, fr->ePBC, fr->bMolPBC, graph, box, cr);
wallcycle_stop(wcycle, ewcVSITESPREAD);
}
if (EEL_FULL(fr->eeltype) && cr->dd->n_intercg_excl &&
(flags & GMX_FORCE_VIRIAL))
{
- dd_move_f(cr->dd, as_rvec_array(fr->f_novirsum->data()), NULL);
+ dd_move_f(cr->dd, as_rvec_array(fr->f_novirsum->data()), nullptr);
}
wallcycle_stop(wcycle, ewcMOVEF);
}
if (vsite && !(fr->bF_NoVirSum && !(flags & GMX_FORCE_VIRIAL)))
{
wallcycle_start(wcycle, ewcVSITESPREAD);
- spread_vsite_f(vsite, x, f, fr->fshift, FALSE, NULL, nrnb,
+ spread_vsite_f(vsite, x, f, fr->fshift, FALSE, nullptr, nrnb,
&top->idef, fr->ePBC, fr->bMolPBC, graph, box, cr);
wallcycle_stop(wcycle, ewcVSITESPREAD);
}
dvdl_dum = 0;
/* constrain the current position */
- constrain(NULL, TRUE, FALSE, constr, &(top->idef),
+ constrain(nullptr, TRUE, FALSE, constr, &(top->idef),
ir, cr, step, 0, 1.0, md,
- as_rvec_array(state->x.data()), as_rvec_array(state->x.data()), NULL,
+ as_rvec_array(state->x.data()), as_rvec_array(state->x.data()), nullptr,
fr->bMolPBC, state->box,
state->lambda[efptBONDED], &dvdl_dum,
- NULL, NULL, nrnb, econqCoord);
+ nullptr, nullptr, nrnb, econqCoord);
if (EI_VV(ir->eI))
{
/* constrain the inital velocity, and save it */
/* also may be useful if we need the ekin from the halfstep for velocity verlet */
- constrain(NULL, TRUE, FALSE, constr, &(top->idef),
+ constrain(nullptr, TRUE, FALSE, constr, &(top->idef),
ir, cr, step, 0, 1.0, md,
as_rvec_array(state->x.data()), as_rvec_array(state->v.data()), as_rvec_array(state->v.data()),
fr->bMolPBC, state->box,
state->lambda[efptBONDED], &dvdl_dum,
- NULL, NULL, nrnb, econqVeloc);
+ nullptr, nullptr, nrnb, econqVeloc);
}
/* constrain the inital velocities at t-dt/2 */
if (EI_STATE_VELOCITY(ir->eI) && ir->eI != eiVV)
gmx_step_str(step, buf));
}
dvdl_dum = 0;
- constrain(NULL, TRUE, FALSE, constr, &(top->idef),
+ constrain(nullptr, TRUE, FALSE, constr, &(top->idef),
ir, cr, step, -1, 1.0, md,
- as_rvec_array(state->x.data()), savex, NULL,
+ as_rvec_array(state->x.data()), savex, nullptr,
fr->bMolPBC, state->box,
state->lambda[efptBONDED], &dvdl_dum,
- as_rvec_array(state->v.data()), NULL, nrnb, econqCoord);
+ as_rvec_array(state->v.data()), nullptr, nrnb, econqCoord);
for (i = start; i < end; i++)
{
else
{
/* Pass NULL iso fplog to avoid graph prints for each molecule type */
- mk_graph_ilist(NULL, mtop->moltype[molb->type].ilist,
+ mk_graph_ilist(nullptr, mtop->moltype[molb->type].ilist,
0, molb->natoms_mol, FALSE, FALSE, graph);
for (mol = 0; mol < molb->nmol; mol++)
nonbonded_verlet_t *nbv,
gmx_bool bWriteStat)
{
- t_nrnb *nrnb_tot = NULL;
+ t_nrnb *nrnb_tot = nullptr;
double delta_t = 0;
double nbfs = 0, mflop = 0;
double elapsed_time,
if (SIMMASTER(cr))
{
- struct gmx_wallclock_gpu_t* gputimes = use_GPU(nbv) ? nbnxn_gpu_get_timings(nbv->gpu_nbv) : NULL;
+ struct gmx_wallclock_gpu_t* gputimes = use_GPU(nbv) ? nbnxn_gpu_get_timings(nbv->gpu_nbv) : nullptr;
wallcycle_print(fplog, mdlog, cr->nnodes, cr->npmenodes, nthreads_pp, nthreads_pme,
elapsed_time_over_all_ranks,
}
/* Send to the log the information on the current lambdas */
- if (fplog != NULL)
+ if (fplog != nullptr)
{
fprintf(fplog, "Initial vector of lambda components:[ ");
for (int i = 0; i < efptNR; i++)
}
if (*bSimAnn)
{
- update_annealing_target_temp(ir, ir->init_t, upd ? *upd : NULL);
+ update_annealing_target_temp(ir, ir->init_t, upd ? *upd : nullptr);
}
- if (vcm != NULL)
+ if (vcm != nullptr)
{
*vcm = init_vcm(fplog, &mtop->groups, ir);
}
{
*outf = init_mdoutf(fplog, nfile, fnm, Flags, cr, ir, mtop, oenv, wcycle);
- *mdebin = init_mdebin((Flags & MD_APPENDFILES) ? NULL : mdoutf_get_fp_ene(*outf),
+ *mdebin = init_mdebin((Flags & MD_APPENDFILES) ? nullptr : mdoutf_get_fp_ene(*outf),
mtop, ir, mdoutf_get_fp_dhdl(*outf));
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
static int mk_sblocks(FILE *fp, t_graph *g, int maxsid, t_sid sid[])
{
int ng, nnodes;
- int nW, nG, nB; /* Number of Grey, Black, White */
- int fW, fG; /* First of each category */
- egCol *egc = NULL; /* The colour of each node */
+ int nW, nG, nB; /* Number of Grey, Black, White */
+ int fW, fG; /* First of each category */
+ egCol *egc = nullptr; /* The colour of each node */
int g0, nblock;
if (!g->nbound)
t_sid *sid;
int nsid;
- g = mk_graph(NULL, idef, at_start, at_end, TRUE, bSettle);
+ g = mk_graph(nullptr, idef, at_start, at_end, TRUE, bSettle);
if (debug)
{
p_graph(debug, "Graaf Dracula", g);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int inn[egNR];
real copyenerd[F_NRE];
int nener, j;
- real *rmsd_data = NULL;
+ real *rmsd_data = nullptr;
double nb;
gmx_bool bVV, bTemp, bEner, bPres, bConstrVir, bEkinAveVel, bReadEkin;
bool checkNumberOfBondedInteractions = flags & CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_int64_t nsteps, stepblocksize = 0, step;
gmx_int64_t seed;
int i;
- FILE *fp_tpi = NULL;
+ FILE *fp_tpi = nullptr;
char *ptr, *dump_pdb, **leg, str[STRLEN], str2[STRLEN];
double dbl, dump_ener;
gmx_bool bCavity;
int nat_cavity = 0, d;
- real *mass_cavity = NULL, mass_tot;
+ real *mass_cavity = nullptr, mass_tot;
int nbin;
double invbinw, *bin, refvolshift, logV, bUlogV;
real prescorr, enercorr, dvdlcorr;
if (bCavity)
{
ptr = getenv("GMX_TPIC_MASSES");
- if (ptr == NULL)
+ if (ptr == nullptr)
{
nat_cavity = 1;
}
sscanf(dump_pdb, "%20lf", &dump_ener);
}
- atoms2md(top_global, inputrec, -1, NULL, top_global->natoms, mdatoms);
+ atoms2md(top_global, inputrec, -1, nullptr, top_global->natoms, mdatoms);
update_mdatoms(mdatoms, inputrec->fepvals->init_lambda);
snew(enerd, 1);
copy_rvec(x_mol[i-a_tp0], state_global->x[i]);
}
/* Rotate the molecule randomly */
- rotate_conf(a_tp1-a_tp0, as_rvec_array(state_global->x.data())+a_tp0, NULL,
+ rotate_conf(a_tp1-a_tp0, as_rvec_array(state_global->x.data())+a_tp0, nullptr,
2*M_PI*dist(rng),
2*M_PI*dist(rng),
2*M_PI*dist(rng));
state_global->box, &state_global->x, &state_global->hist,
&f, force_vir, mdatoms, enerd, fcd,
&state_global->lambda,
- NULL, fr, NULL, mu_tot, t, NULL, FALSE,
+ nullptr, fr, nullptr, mu_tot, t, nullptr, FALSE,
GMX_FORCE_NONBONDED | GMX_FORCE_ENERGY |
(bNS ? GMX_FORCE_DYNAMICBOX | GMX_FORCE_NS : 0) |
(bStateChanged ? GMX_FORCE_STATECHANGED : 0));
close_trj(status);
- if (fp_tpi != NULL)
+ if (fp_tpi != nullptr)
{
xvgrclose(fp_tpi);
}
- if (fplog != NULL)
+ if (fplog != nullptr)
{
fprintf(fplog, "\n");
fprintf(fplog, " <V> = %12.5e nm^3\n", V_all/frame);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
)
{
int mdof_flags;
- rvec *x_for_confout = NULL;
+ rvec *x_for_confout = nullptr;
mdof_flags = 0;
if (do_per_step(step, ir->nstxout))
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
<NumTempScaleValues::single,
ApplyParrinelloRahmanVScaling::no>
(start, nrend, dt, dtPressureCouple,
- invMassPerDim, tcstat, cTC, NULL, x, xprime, v, f);
+ invMassPerDim, tcstat, cTC, nullptr, x, xprime, v, f);
}
else
{
<NumTempScaleValues::multiple,
ApplyParrinelloRahmanVScaling::no>
(start, nrend, dt, dtPressureCouple,
- invMassPerDim, tcstat, cTC, NULL, x, xprime, v, f);
+ invMassPerDim, tcstat, cTC, nullptr, x, xprime, v, f);
}
}
}
wallcycle_start(wcycle, ewcCONSTR);
if (EI_VV(inputrec->eI) && bFirstHalf)
{
- constrain(NULL, bLog, bEner, constr, idef,
+ constrain(nullptr, bLog, bEner, constr, idef,
inputrec, cr, step, 1, 1.0, md,
as_rvec_array(state->x.data()), as_rvec_array(state->v.data()), as_rvec_array(state->v.data()),
bMolPBC, state->box,
state->lambda[efptBONDED], dvdlambda,
- NULL, bCalcVir ? &vir_con : NULL, nrnb, econqVeloc);
+ nullptr, bCalcVir ? &vir_con : nullptr, nrnb, econqVeloc);
}
else
{
- constrain(NULL, bLog, bEner, constr, idef,
+ constrain(nullptr, bLog, bEner, constr, idef,
inputrec, cr, step, 1, 1.0, md,
- as_rvec_array(state->x.data()), as_rvec_array(upd->xp.data()), NULL,
+ as_rvec_array(state->x.data()), as_rvec_array(upd->xp.data()), nullptr,
bMolPBC, state->box,
state->lambda[efptBONDED], dvdlambda,
- as_rvec_array(state->v.data()), bCalcVir ? &vir_con : NULL, nrnb, econqCoord);
+ as_rvec_array(state->v.data()), bCalcVir ? &vir_con : nullptr, nrnb, econqCoord);
}
wallcycle_stop(wcycle, ewcCONSTR);
as_rvec_array(state->x.data()), as_rvec_array(upd->xp.data()), as_rvec_array(state->v.data()), as_rvec_array(force->data()),
bDoConstr, FALSE,
step, inputrec->ld_seed,
- DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL);
+ DOMAINDECOMP(cr) ? cr->dd->gatindex : nullptr);
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
}
/* Constrain the coordinates upd->xp for half a time step */
wallcycle_start(wcycle, ewcCONSTR);
- constrain(NULL, bLog, bEner, constr, idef,
+ constrain(nullptr, bLog, bEner, constr, idef,
inputrec, cr, step, 1, 0.5, md,
- as_rvec_array(state->x.data()), as_rvec_array(upd->xp.data()), NULL,
+ as_rvec_array(state->x.data()), as_rvec_array(upd->xp.data()), nullptr,
bMolPBC, state->box,
state->lambda[efptBONDED], dvdlambda,
- as_rvec_array(state->v.data()), NULL, nrnb, econqCoord);
+ as_rvec_array(state->v.data()), nullptr, nrnb, econqCoord);
wallcycle_stop(wcycle, ewcCONSTR);
}
*/
wallcycle_start_nocount(wcycle, ewcUPDATE);
- if (md->cFREEZE != NULL && constr != NULL)
+ if (md->cFREEZE != nullptr && constr != nullptr)
{
/* If we have atoms that are frozen along some, but not all
* dimensions, the constraints will have moved them also along
}
where();
dump_it_all(fplog, "After update",
- state->natoms, &state->x, &upd->xp, &state->v, NULL);
+ state->natoms, &state->x, &upd->xp, &state->v, nullptr);
}
void update_coords(FILE *fplog,
t_commrec *cr, /* these shouldn't be here -- need to think about it */
gmx_constr_t constr)
{
- gmx_bool bDoConstr = (NULL != constr);
+ gmx_bool bDoConstr = (nullptr != constr);
/* Running the velocity half does nothing except for velocity verlet */
if ((UpdatePart == etrtVELOCITY1 || UpdatePart == etrtVELOCITY2) &&
md->cFREEZE, md->cACC, md->cTC,
x_rvec, xp_rvec, v_rvec, f_rvec,
bDoConstr, TRUE,
- step, inputrec->ld_seed, DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL);
+ step, inputrec->ld_seed, DOMAINDECOMP(cr) ? cr->dd->gatindex : nullptr);
break;
case (eiBD):
do_update_bd(start_th, end_th, dt,
x_rvec, xp_rvec, v_rvec, f_rvec,
inputrec->bd_fric,
upd->sd->bd_rf,
- step, inputrec->ld_seed, DOMAINDECOMP(cr) ? cr->dd->gatindex : NULL);
+ step, inputrec->ld_seed, DOMAINDECOMP(cr) ? cr->dd->gatindex : nullptr);
break;
case (eiVV):
case (eiVVAK):
real rate = (ir->delta_t)/ir->opts.tau_t[0];
- if (ir->etc == etcANDERSEN && constr != NULL)
+ if (ir->etc == etcANDERSEN && constr != nullptr)
{
/* Currently, Andersen thermostat does not support constrained
systems. Functionality exists in the andersen_tcoupl
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
ilist[i].nr = 0;
ilist[i].nalloc = 0;
- ilist[i].iatoms = NULL;
+ ilist[i].iatoms = nullptr;
}
}
const t_pbc *pbc_null2;
int *vsite_pbc;
- if (v != NULL)
+ if (v != nullptr)
{
inv_dt = 1.0/dt;
}
inv_dt = 1.0;
}
- bPBCAll = (pbc_null != NULL && !vsite->bHaveChargeGroups);
+ bPBCAll = (pbc_null != nullptr && !vsite->bHaveChargeGroups);
- pbc_null2 = NULL;
- vsite_pbc = NULL;
+ pbc_null2 = nullptr;
+ vsite_pbc = nullptr;
for (int ftype = c_ftypeVsiteStart; ftype < c_ftypeVsiteEnd; ftype++)
{
if (ilist[ftype].nr == 0)
{
pbc_null2 = pbc_null;
}
- else if (pbc_null != NULL)
+ else if (pbc_null != nullptr)
{
vsite_pbc = vsite->vsite_pbc_loc[ftype - c_ftypeVsiteStart];
}
pbc_atom = avsite;
copy_rvec(x[avsite], xpbc);
}
- else if (vsite_pbc != NULL)
+ else if (vsite_pbc != nullptr)
{
pbc_atom = vsite_pbc[i/(1 + nra)];
if (pbc_atom > -2)
}
else
{
- pbc_null2 = NULL;
+ pbc_null2 = nullptr;
}
}
else
rvec_add(xpbc, dx, x[avsite]);
}
}
- if (v != NULL)
+ if (v != nullptr)
{
/* Calculate velocity of vsite... */
rvec vv;
}
else
{
- pbc_null = NULL;
+ pbc_null = nullptr;
}
if (bDomDec)
const gmx_moltype_t *molt = &mtop->moltype[molb->type];
for (int mol = 0; mol < molb->nmol; mol++)
{
- construct_vsites(vsite, x+as, 0.0, NULL,
+ construct_vsites(vsite, x+as, 0.0, nullptr,
mtop->ffparams.iparams, molt->ilist,
- epbcNONE, TRUE, NULL, NULL);
+ epbcNONE, TRUE, nullptr, nullptr);
as += molt->atoms.nr;
}
}
const t_pbc *pbc_null2;
const int *vsite_pbc;
- bPBCAll = (pbc_null != NULL && !vsite->bHaveChargeGroups);
+ bPBCAll = (pbc_null != nullptr && !vsite->bHaveChargeGroups);
/* this loop goes backwards to be able to build *
* higher type vsites from lower types */
- pbc_null2 = NULL;
- vsite_pbc = NULL;
+ pbc_null2 = nullptr;
+ vsite_pbc = nullptr;
for (int ftype = c_ftypeVsiteEnd - 1; ftype >= c_ftypeVsiteStart; ftype--)
{
if (ilist[ftype].nr == 0)
{
pbc_null2 = pbc_null;
}
- else if (pbc_null != NULL)
+ else if (pbc_null != nullptr)
{
vsite_pbc = vsite->vsite_pbc_loc[ftype - c_ftypeVsiteStart];
}
for (int i = 0; i < nr; )
{
- if (vsite_pbc != NULL)
+ if (vsite_pbc != nullptr)
{
if (vsite_pbc[i/(1 + nra)] > -2)
{
}
else
{
- pbc_null2 = NULL;
+ pbc_null2 = nullptr;
}
}
/* This is wasting some CPU time as we now do this multiple times
* per MD step.
*/
- pbc_null = set_pbc_dd(&pbc, ePBC, cr->dd ? cr->dd->nc : NULL, FALSE, box);
+ pbc_null = set_pbc_dd(&pbc, ePBC, cr->dd ? cr->dd->nc : nullptr, FALSE, box);
}
else
{
- pbc_null = NULL;
+ pbc_null = nullptr;
}
if (DOMAINDECOMP(cr))
VsiteThread *tData = vsite->tData[thread];
rvec *fshift_t;
- if (thread == 0 || fshift == NULL)
+ if (thread == 0 || fshift == nullptr)
{
fshift_t = fshift;
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
}
- if (fshift != NULL)
+ if (fshift != nullptr)
{
for (int th = 1; th < vsite->nthreads; th++)
{
if (nvsite == 0)
{
- return NULL;
+ return nullptr;
}
snew(vsite, 1);
int *a2cg = atom2cg(&molt->cgs);
vsite->vsite_pbc_molt[mt] = get_vsite_pbc(mtop->ffparams.iparams,
molt->ilist,
- molt->atoms.atom, NULL,
+ molt->atoms.atom, nullptr,
&molt->cgs, a2cg);
sfree(a2cg);
}
}
}
- vsite->taskIndex = NULL;
+ vsite->taskIndex = nullptr;
vsite->taskIndexNalloc = 0;
return vsite;
/* Make an atom to charge group index */
int *a2cg = atom2cg(&top->cgs);
vsite->vsite_pbc_loc = get_vsite_pbc(top->idef.iparams,
- top->idef.il, NULL, md,
+ top->idef.il, nullptr, md,
&top->cgs, a2cg);
sfree(a2cg);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
*/
strcpy(suf_up, part_suffix);
upstring(suf_up);
- *bAddPart = (strstr(fn, part_suffix) != NULL ||
- strstr(fn, suf_up) != NULL);
+ *bAddPart = (strstr(fn, part_suffix) != nullptr ||
+ strstr(fn, suf_up) != nullptr);
}
sfree(outputfiles);
}
else
{
- fpmulti = NULL;
+ fpmulti = nullptr;
}
check_multi_int(fpmulti, cr->ms, sim_part, "simulation part", TRUE);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
/* topology information not available or invalid, ignore it */
hwThreads = hwTop.machine().logicalProcessorCount;
- *localityOrder = NULL;
+ *localityOrder = nullptr;
}
// Only warn about the first problem per node. Otherwise, the first test
// failing would essentially always cause also the other problems get
}
validLayout = validLayout && !invalidValue;
- if (validLayout && fplog != NULL)
+ if (validLayout && fplog != nullptr)
{
fprintf(fplog, "Pinning threads with a%s logical core stride of %d\n",
bPickPinStride ? "n auto-selected" : " user-specified",
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
hist->disre_initf = 0;
hist->ndisrepairs = 0;
- hist->disre_rm3tav = NULL;
+ hist->disre_rm3tav = nullptr;
hist->orire_initf = 0;
hist->norire_Dtav = 0;
- hist->orire_Dtav = NULL;
+ hist->orire_Dtav = nullptr;
}
static void zero_ekinstate(ekinstate_t *eks)
{
eks->ekin_n = 0;
- eks->ekinh = NULL;
- eks->ekinf = NULL;
- eks->ekinh_old = NULL;
+ eks->ekinh = nullptr;
+ eks->ekinf = nullptr;
+ eks->ekinh_old = nullptr;
eks->ekinscalef_nhc.resize(0);
eks->ekinscaleh_nhc.resize(0);
eks->vscale_nhc.resize(0);
swapstate->nIonTypes = 0;
swapstate->nAverage = 0;
swapstate->fluxleak = 0;
- swapstate->fluxleak_p = NULL;
+ swapstate->fluxleak_p = nullptr;
swapstate->bFromCpt = 0;
swapstate->nat[eChan0] = 0;
swapstate->nat[eChan1] = 0;
- swapstate->xc_old_whole[eChan0] = NULL;
- swapstate->xc_old_whole[eChan1] = NULL;
- swapstate->xc_old_whole_p[eChan0] = NULL;
- swapstate->xc_old_whole_p[eChan1] = NULL;
- swapstate->ionType = NULL;
+ swapstate->xc_old_whole[eChan0] = nullptr;
+ swapstate->xc_old_whole[eChan1] = nullptr;
+ swapstate->xc_old_whole_p[eChan0] = nullptr;
+ swapstate->xc_old_whole_p[eChan1] = nullptr;
+ swapstate->ionType = nullptr;
}
void init_gtc_state(t_state *state, int ngtc, int nnhpres, int nhchainlength)
}
else
{
- state->dfhist = NULL;
+ state->dfhist = nullptr;
}
- state->swapstate = NULL;
- state->edsamstate = NULL;
+ state->swapstate = nullptr;
+ state->edsamstate = nullptr;
state->ddp_count = 0;
state->ddp_count_cg_gl = 0;
state->cg_gl.resize(0);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,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.
{
//! Initializes a text table column with given values.
ColumnData(const char *title, int width, bool bWrap)
- : title_(title != NULL ? title : ""),
+ : title_(title != nullptr ? title : ""),
width_(width), bWrap_(bWrap), firstLine_(0),
nextLineIndex_(0), nextLineOffset_(0)
{
void TextTableFormatter::addColumn(const char *title, int width, bool bWrap)
{
- if (title != NULL && title[0] != '\0')
+ if (title != nullptr && title[0] != '\0')
{
impl_->bPrintHeader_ = true;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
impl_->currentTopicAsString().c_str())));
}
const IHelpTopic *newTopic = topic.findSubTopic(name);
- if (newTopic == NULL)
+ if (newTopic == nullptr)
{
if (impl_->isAtRootTopic())
{
const IHelpTopic &topic = impl_->currentTopic();
const char *title = topic.title();
HelpWriterContext context(impl_->rootContext_);
- context.enterSubSection(title != NULL ? title : "");
+ context.enterSubSection(title != nullptr ? title : "");
topic.writeHelp(context);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
const IHelpTopic *
AbstractSimpleHelpTopic::findSubTopic(const char * /* name */) const
{
- return NULL;
+ return nullptr;
}
void AbstractSimpleHelpTopic::writeHelp(const HelpWriterContext &context) const
Impl::SubTopicMap::const_iterator topic = impl_->subTopicMap_.find(name);
if (topic == impl_->subTopicMap_.end())
{
- return NULL;
+ return nullptr;
}
return topic->second;
}
}
TextWriter &file = context.outputFile();
TextTableFormatter formatter;
- formatter.addColumn(NULL, maxNameLength + 1, false);
- formatter.addColumn(NULL, 72 - maxNameLength, true);
+ formatter.addColumn(nullptr, maxNameLength + 1, false);
+ formatter.addColumn(nullptr, 72 - maxNameLength, true);
formatter.setFirstColumnIndent(4);
file.writeLine(title);
for (topic = impl_->subTopicMap_.begin(); topic != impl_->subTopicMap_.end(); ++topic)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
consoleOptionsFormatter_.reset(new TextTableFormatter());
consoleOptionsFormatter_->setFirstColumnIndent(1);
- consoleOptionsFormatter_->addColumn(NULL, 7, false);
- consoleOptionsFormatter_->addColumn(NULL, 18, false);
- consoleOptionsFormatter_->addColumn(NULL, 16, false);
- consoleOptionsFormatter_->addColumn(NULL, 28, false);
+ consoleOptionsFormatter_->addColumn(nullptr, 7, false);
+ consoleOptionsFormatter_->addColumn(nullptr, 18, false);
+ consoleOptionsFormatter_->addColumn(nullptr, 16, false);
+ consoleOptionsFormatter_->addColumn(nullptr, 28, false);
}
return *consoleOptionsFormatter_;
}
std::string HelpWriterContext::Impl::replaceLinks(const std::string &input) const
{
std::string result(input);
- if (state_->links_ != NULL)
+ if (state_->links_ != nullptr)
{
HelpLinks::Impl::LinkList::const_iterator link;
for (link = state_->links_->impl_->links_.begin();
*/
HelpWriterContext::HelpWriterContext(TextWriter *writer, HelpOutputFormat format)
- : impl_(new Impl(Impl::StatePointer(new Impl::SharedState(writer, format, NULL)), 0))
+ : impl_(new Impl(Impl::StatePointer(new Impl::SharedState(writer, format, nullptr)), 0))
{
}
const HelpLinks *links)
: impl_(new Impl(Impl::StatePointer(new Impl::SharedState(writer, format, links)), 0))
{
- if (links != NULL)
+ if (links != nullptr)
{
GMX_RELEASE_ASSERT(links->impl_->format_ == format,
"Links must have the same output format as the context");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,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.
TEST_F(TextTableFormatterTest, HandlesEmptyColumnTitles)
{
- formatter_.addColumn(NULL, 4, false);
+ formatter_.addColumn(nullptr, 4, false);
formatter_.addColumn("", 4, false);
- formatter_.addColumn(NULL, 14, true);
+ formatter_.addColumn(nullptr, 14, true);
formatter_.addColumn("", 14, true);
formatter_.clear();
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
};
HelpTestBase::HelpTestBase()
- : rootTopic_("", NULL, "Root topic text"),
+ : rootTopic_("", nullptr, "Root topic text"),
writer_(&helpFile_),
context_(&writer_, gmx::eHelpOutputFormat_Console),
manager_(rootTopic_, context_)
TEST_F(HelpManagerTest, HandlesSubTopics)
{
MockHelpTopic &first =
- rootTopic_.addSubTopic("first", "First topic", NULL);
+ rootTopic_.addSubTopic("first", "First topic", nullptr);
MockHelpTopic &firstSub =
- first.addSubTopic("firstsub", "First subtopic", NULL);
- rootTopic_.addSubTopic("second", "Second topic", NULL);
+ first.addSubTopic("firstsub", "First subtopic", nullptr);
+ rootTopic_.addSubTopic("second", "Second topic", nullptr);
using ::testing::_;
EXPECT_CALL(firstSub, writeHelp(_));
TEST_F(HelpManagerTest, HandlesInvalidTopics)
{
MockHelpTopic &first =
- rootTopic_.addSubTopic("first", "First topic", NULL);
- first.addSubTopic("firstsub", "First subtopic", NULL);
- rootTopic_.addSubTopic("second", "Second topic", NULL);
+ rootTopic_.addSubTopic("first", "First topic", nullptr);
+ first.addSubTopic("firstsub", "First subtopic", nullptr);
+ rootTopic_.addSubTopic("second", "Second topic", nullptr);
ASSERT_THROW_GMX(manager_.enterTopic("unknown"), gmx::InvalidInputError);
ASSERT_NO_THROW_GMX(manager_.enterTopic("first"));
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015, by the GROMACS development team, led by
+ * 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.
gmx::HelpOutputFormat format,
const char *id)
{
- gmx::HelpWriterContext context(NULL, format);
+ gmx::HelpWriterContext context(nullptr, format);
std::string result
= context.substituteMarkupAndWrapToString(settings_, text);
- if (id == NULL)
+ if (id == nullptr)
{
switch (format)
{
void testFormatting(const gmx::ConstArrayRef<const char *> &text)
{
std::string testText = gmx::joinStrings(text, "\n");
- testFormatting(testText, gmx::eHelpOutputFormat_Console, NULL);
- testFormatting(testText, gmx::eHelpOutputFormat_Rst, NULL);
+ testFormatting(testText, gmx::eHelpOutputFormat_Console, nullptr);
+ testFormatting(testText, gmx::eHelpOutputFormat_Rst, nullptr);
}
gmx::TextLineWrapperSettings settings_;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
}
MockHelpTopic::MockHelpTopic(const char *name, const char *title, const char *text)
- : name_(name), title_(title), text_(text != NULL ? text : "")
+ : name_(name), title_(title), text_(text != nullptr ? text : "")
{
if (!isNullOrEmpty(text))
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
GMX_THROW(APIError("Inconsistent value counts for vector values"));
}
- if (settings.name_ != NULL)
+ if (settings.name_ != nullptr)
{
name_ = settings.name_;
}
- if (settings.descr_ != NULL)
+ if (settings.descr_ != nullptr)
{
descr_ = settings.descr_;
}
- if (storeIsSet_ != NULL)
+ if (storeIsSet_ != nullptr)
{
*storeIsSet_ = false;
}
bool AbstractOptionStorage::isBoolean() const
{
- return dynamic_cast<const BooleanOptionStorage *>(this) != NULL;
+ return dynamic_cast<const BooleanOptionStorage *>(this) != nullptr;
}
void AbstractOptionStorage::startSource()
void AbstractOptionStorage::markAsSet()
{
setFlag(efOption_Set);
- if (storeIsSet_ != NULL)
+ if (storeIsSet_ != nullptr)
{
*storeIsSet_ = true;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
//! Initializes the name and default values for an option.
explicit AbstractOption(const char *name)
: minValueCount_(1), maxValueCount_(1),
- name_(name), descr_(NULL), storeIsSet_(NULL)
+ name_(name), descr_(nullptr), storeIsSet_(nullptr)
{ }
/*! \brief
//! Initializes the name and default values for an option.
explicit OptionTemplate(const char *name)
: AbstractOption(name),
- defaultValue_(NULL), defaultValueIfSet_(NULL), store_(NULL),
- countptr_(NULL), storeVector_(NULL)
+ defaultValue_(nullptr), defaultValueIfSet_(nullptr), store_(nullptr),
+ countptr_(nullptr), storeVector_(nullptr)
{ }
/*! \brief
template <class InfoType>
bool isType() const
{
- return toType<InfoType>() != NULL;
+ return toType<InfoType>() != nullptr;
}
/*! \brief
* Convert the info object to a particular type if the type is correct.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
StringOptionStorage::StringOptionStorage(const StringOption &settings)
: MyBase(settings), info_(this)
{
- if (settings.defaultEnumIndex_ >= 0 && settings.enumValues_ == NULL)
+ if (settings.defaultEnumIndex_ >= 0 && settings.enumValues_ == nullptr)
{
GMX_THROW(APIError("Cannot set default enum index without enum values"));
}
- if (settings.enumValues_ != NULL)
+ if (settings.enumValues_ != nullptr)
{
int count = settings.enumValuesCount_;
if (count < 0)
{
count = 0;
- while (settings.enumValues_[count] != NULL)
+ while (settings.enumValues_[count] != nullptr)
{
++count;
}
}
for (int i = 0; i < count; ++i)
{
- if (settings.enumValues_[i] == NULL)
+ if (settings.enumValues_[i] == nullptr)
{
GMX_THROW(APIError("Enumeration value cannot be NULL"));
}
GMX_THROW(APIError("Default enumeration index is out of range"));
}
const std::string *defaultValue = settings.defaultValue();
- if (defaultValue != NULL && *defaultValue != allowed_[settings.defaultEnumIndex_])
+ if (defaultValue != nullptr && *defaultValue != allowed_[settings.defaultEnumIndex_])
{
GMX_THROW(APIError("Conflicting default values"));
}
StorePointer store)
: MyBase(settings, std::move(store)), info_(this)
{
- if (enumValues == NULL)
+ if (enumValues == nullptr)
{
GMX_THROW(APIError("Allowed values must be provided to EnumOption"));
}
if (count < 0)
{
count = 0;
- while (enumValues[count] != NULL)
+ while (enumValues[count] != nullptr)
{
++count;
}
}
for (int i = 0; i < count; ++i)
{
- if (enumValues[i] == NULL)
+ if (enumValues[i] == nullptr)
{
GMX_THROW(APIError("Enumeration value cannot be NULL"));
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
//! Initializes an option with the given name.
explicit StringOption(const char *name)
- : MyBase(name), enumValues_(NULL), enumValuesCount_(0),
+ : MyBase(name), enumValues_(nullptr), enumValuesCount_(0),
defaultEnumIndex_(-1)
{
}
//! Initializes an option with the given name.
explicit EnumOption(const char *name)
- : MyBase(name), enumValues_(NULL), enumValuesCount_(0)
+ : MyBase(name), enumValues_(nullptr), enumValuesCount_(0)
{
}
//! Helper function to convert default values for storate initialization.
static int convertToInt(const EnumType *defaultValue)
{
- return defaultValue != NULL ? static_cast<int>(*defaultValue) : -1;
+ return defaultValue != nullptr ? static_cast<int>(*defaultValue) : -1;
}
//! Creates a EnumOptionStorage object.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
};
FileTypeHandler::FileTypeHandler(int fileType)
- : fileType_(fileType), extensionCount_(0), genericTypes_(NULL)
+ : fileType_(fileType), extensionCount_(0), genericTypes_(nullptr)
{
if (fileType_ >= 0)
{
const char *FileTypeHandler::extension(int i) const
{
GMX_ASSERT(i >= 0 && i < extensionCount_, "Invalid extension index");
- if (genericTypes_ != NULL)
+ if (genericTypes_ != nullptr)
{
return ftp2ext_with_dot(genericTypes_[i]);
}
bool
FileTypeHandler::isValidType(int fileType) const
{
- if (genericTypes_ != NULL)
+ if (genericTypes_ != nullptr)
{
for (int i = 0; i < extensionCount(); ++i)
{
{
defaultExtension_ = typeHandler.extension(0);
}
- if (settings.defaultBasename_ != NULL)
+ if (settings.defaultBasename_ != nullptr)
{
std::string defaultValue(settings.defaultBasename_);
int type = fn2ftp(settings.defaultBasename_);
std::string FileNameOptionStorage::processValue(const std::string &value) const
{
- if (manager_ != NULL)
+ if (manager_ != nullptr)
{
std::string processedValue = manager_->completeFileName(value, info_);
if (!processedValue.empty())
void FileNameOptionStorage::processAll()
{
- if (manager_ != NULL && hasFlag(efOption_HasDefaultValue))
+ if (manager_ != nullptr && hasFlag(efOption_HasDefaultValue))
{
ArrayRef<std::string> valueList = values();
GMX_RELEASE_ASSERT(valueList.size() == 1,
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
//! Initializes an option with the given name.
explicit FileNameOption(const char *name)
: MyBase(name), optionType_(eftUnknown), legacyType_(-1),
- defaultBasename_(NULL), defaultType_(-1),
+ defaultBasename_(nullptr), defaultType_(-1),
bLegacyOptionalBehavior_(false),
bRead_(false), bWrite_(false), bLibrary_(false),
bAllowMissing_(false)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
template <class ManagerType>
ManagerType *get() const
{
- ManagerType *result = NULL;
+ ManagerType *result = nullptr;
for (ListType::const_iterator i = list_.begin(); i != list_.end(); ++i)
{
ManagerType *curr = dynamic_cast<ManagerType *>(*i);
- if (curr != NULL)
+ if (curr != nullptr)
{
- GMX_RELEASE_ASSERT(result == NULL,
+ GMX_RELEASE_ASSERT(result == nullptr,
"More than one applicable option manager is set");
result = curr;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,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.
{
const char *name = section.name_;
// Make sure that there are no duplicate sections.
- GMX_RELEASE_ASSERT(findSection(name) == NULL, "Duplicate subsection name");
+ GMX_RELEASE_ASSERT(findSection(name) == nullptr, "Duplicate subsection name");
std::unique_ptr<IOptionSectionStorage> storage(section.createStorage());
subsections_.push_back(SectionPointer(new OptionSectionImpl(managers_, std::move(storage), name)));
return subsections_.back().get();
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
OptionsAssigner::Impl::Impl(Options *options)
: options_(*options), bAcceptBooleanNoPrefix_(false),
- currentOption_(NULL), currentValueCount_(0), reverseBoolean_(false)
+ currentOption_(nullptr), currentValueCount_(0), reverseBoolean_(false)
{
sectionStack_.push_back(&options_.impl_->rootSection_);
}
AbstractOptionStorage *
OptionsAssigner::Impl::findOption(const char *name)
{
- GMX_RELEASE_ASSERT(currentOption_ == NULL,
+ GMX_RELEASE_ASSERT(currentOption_ == nullptr,
"Cannot search for another option while processing one");
const Section §ion = currentSection();
AbstractOptionStorage *option = section.findOption(name);
- if (option == NULL && bAcceptBooleanNoPrefix_)
+ if (option == nullptr && bAcceptBooleanNoPrefix_)
{
if (name[0] == 'n' && name[1] == 'o')
{
option = section.findOption(name + 2);
- if (option != NULL && option->isBoolean())
+ if (option != nullptr && option->isBoolean())
{
reverseBoolean_ = true;
}
else
{
- option = NULL;
+ option = nullptr;
}
}
}
void OptionsAssigner::startSection(const char *name)
{
Impl::Section *section = impl_->currentSection().findSection(name);
- if (section == NULL)
+ if (section == nullptr)
{
GMX_THROW(InvalidInputError("Unknown subsection"));
}
bool OptionsAssigner::tryStartOption(const char *name)
{
- GMX_RELEASE_ASSERT(impl_->currentOption_ == NULL, "finishOption() not called");
+ GMX_RELEASE_ASSERT(impl_->currentOption_ == nullptr, "finishOption() not called");
AbstractOptionStorage *option = impl_->findOption(name);
- if (option == NULL)
+ if (option == nullptr)
{
return false;
}
void OptionsAssigner::appendValue(const Variant &value)
{
AbstractOptionStorage *option = impl_->currentOption_;
- GMX_RELEASE_ASSERT(option != NULL, "startOption() not called");
+ GMX_RELEASE_ASSERT(option != nullptr, "startOption() not called");
++impl_->currentValueCount_;
option->appendValue(value);
}
void OptionsAssigner::finishOption()
{
AbstractOptionStorage *option = impl_->currentOption_;
- GMX_RELEASE_ASSERT(option != NULL, "startOption() not called");
+ GMX_RELEASE_ASSERT(option != nullptr, "startOption() not called");
bool bBoolReverseValue = false;
if (option->isBoolean())
{
bBoolReverseValue = true;
}
}
- impl_->currentOption_ = NULL;
+ impl_->currentOption_ = nullptr;
impl_->reverseBoolean_ = false;
option->finishSet();
if (bBoolReverseValue)
void OptionsAssigner::finish()
{
- GMX_RELEASE_ASSERT(impl_->currentOption_ == NULL, "finishOption() not called");
+ GMX_RELEASE_ASSERT(impl_->currentOption_ == nullptr, "finishOption() not called");
GMX_RELEASE_ASSERT(!impl_->inSection(), "finishSection() not called");
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
settings.maxValueCount_ : settings.minValueCount_)))
{
if (hasFlag(efOption_NoDefaultValue)
- && (settings.defaultValue_ != NULL
- || settings.defaultValueIfSet_ != NULL))
+ && (settings.defaultValue_ != nullptr
+ || settings.defaultValueIfSet_ != nullptr))
{
GMX_THROW(APIError("Option does not support default value, but one is set"));
}
if (!hasFlag(efOption_NoDefaultValue))
{
setFlag(efOption_HasDefaultValue);
- if (settings.defaultValue_ != NULL)
+ if (settings.defaultValue_ != nullptr)
{
setDefaultValue(*settings.defaultValue_);
}
- if (settings.defaultValueIfSet_ != NULL)
+ if (settings.defaultValueIfSet_ != nullptr)
{
setDefaultValueIfSet(*settings.defaultValueIfSet_);
}
if (result.empty() || (result.size() == 1 && result[0].empty()))
{
result.clear();
- if (defaultValueIfSet_.get() != NULL)
+ if (defaultValueIfSet_.get() != nullptr)
{
result.push_back(formatSingleValue(*defaultValueIfSet_));
}
void OptionStorageTemplate<T>::processSet()
{
processSetValues(&setValues_);
- if (setValues_.empty() && defaultValueIfSet_.get() != NULL)
+ if (setValues_.empty() && defaultValueIfSet_.get() != nullptr)
{
addValue(*defaultValueIfSet_);
setFlag(efOption_HasDefaultValue);
virtual void visitOption(OptionInfo *option)
{
InfoType *subtype = option->toType<InfoType>();
- if (subtype != NULL)
+ if (subtype != nullptr)
{
visitOptionType(subtype);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
{
gmx::Options options;
std::string value;
- const char * const allowed[] = { "none", "test", "value", NULL };
+ const char * const allowed[] = { "none", "test", "value", nullptr };
using gmx::StringOption;
ASSERT_NO_THROW(options.addOption(
StringOption("p").store(&value)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
*/
TimeUnitBehavior::TimeUnitBehavior()
- : timeUnit_(TimeUnit_Default), timeUnitStore_(NULL)
+ : timeUnit_(TimeUnit_Default), timeUnitStore_(nullptr)
{
}
GMX_RELEASE_ASSERT(timeUnit >= 0 && timeUnit <= TimeUnit_s,
"Invalid time unit");
timeUnit_ = timeUnit;
- if (timeUnitStore_ != NULL)
+ if (timeUnitStore_ != nullptr)
{
*timeUnitStore_ = timeUnit;
}
void TimeUnitBehavior::setTimeUnitFromEnvironment()
{
const char *const value = std::getenv("GMXTIMEUNIT");
- if (value != NULL)
+ if (value != nullptr)
{
ConstArrayRef<const char *> timeUnits(g_timeUnits);
ConstArrayRef<const char *>::const_iterator i =
double factor = TimeUnitManager(timeUnit()).timeScaleFactor();
TimeOptionScaler<DoubleOptionInfo>(factor).visitSection(&options->rootSection());
TimeOptionScaler<FloatOptionInfo>(factor).visitSection(&options->rootSection());
- if (timeUnitStore_ != NULL)
+ if (timeUnitStore_ != nullptr)
{
*timeUnitStore_ = static_cast<TimeUnit>(timeUnit_);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
void set_box_rel(const t_inputrec *ir, t_state *state)
{
/* Make sure the box obeys the restrictions before we fix the ratios */
- correct_box(NULL, 0, state->box, NULL);
+ correct_box(nullptr, 0, state->box, nullptr);
clear_mat(state->box_rel);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
add_gbond(g, ia[1], ia[2]);
add_gbond(g, ia[1], ia[3]);
}
- else if (part == NULL)
+ else if (part == nullptr)
{
/* Simply add this bond */
for (j = 1; j < np; j++)
{
if (interaction_function[i].flags & IF_CHEMBOND)
{
- mk_igraph(g, i, &(ilist[i]), at_start, at_end, NULL);
+ mk_igraph(g, i, &(ilist[i]), at_start, at_end, nullptr);
}
}
else
{
/* This is a special thing used in splitter.c to generate shake-blocks */
- mk_igraph(g, F_CONSTR, &(ilist[F_CONSTR]), at_start, at_end, NULL);
+ mk_igraph(g, F_CONSTR, &(ilist[F_CONSTR]), at_start, at_end, nullptr);
if (bSettle)
{
- mk_igraph(g, F_SETTLE, &(ilist[F_SETTLE]), at_start, at_end, NULL);
+ mk_igraph(g, F_SETTLE, &(ilist[F_SETTLE]), at_start, at_end, nullptr);
}
}
g->nbound = 0;
}
g->negc = 0;
- g->egc = NULL;
+ g->egc = nullptr;
sfree(nbond);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
real gmx_unused *pbc_simd)
{
#if GMX_SIMD_HAVE_REAL
- if (pbc != NULL && pbc->ePBC != epbcNONE)
+ if (pbc != nullptr && pbc->ePBC != epbcNONE)
{
rvec inv_box_diag = {0, 0, 0};
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
const char *epbc_names[epbcNR+1] =
{
- "xyz", "no", "xy", "screw", NULL
+ "xyz", "no", "xy", "screw", nullptr
};
/* Skip 0 so we have more chance of detecting if we forgot to call set_pbc. */
if (ePBC == epbcNONE)
{
- return NULL;
+ return nullptr;
}
if ((box[XX][YY] != 0) || (box[XX][ZZ] != 0) || (box[YY][ZZ] != 0))
}
else
{
- ptr = NULL;
+ ptr = nullptr;
}
return ptr;
}
else
{
- if (ePBC == epbcSCREW && NULL != dd_pbc)
+ if (ePBC == epbcSCREW && nullptr != dd_pbc)
{
/* This combinated should never appear here */
gmx_incons("low_set_pbc called with screw pbc and dd_nc != NULL");
ePBC = guess_ePBC(box);
}
- low_set_pbc(pbc, ePBC, NULL, box);
+ low_set_pbc(pbc, ePBC, nullptr, box);
}
t_pbc *set_pbc_dd(t_pbc *pbc, int ePBC,
{
pbc->ePBC = ePBC;
- return NULL;
+ return nullptr;
}
if (nullptr == domdecCells)
{
- low_set_pbc(pbc, ePBC, NULL, box);
+ low_set_pbc(pbc, ePBC, nullptr, box);
}
else
{
}
}
- return (pbc->ePBC != epbcNONE ? pbc : NULL);
+ return (pbc->ePBC != epbcNONE ? pbc : nullptr);
}
void pbc_dx(const t_pbc *pbc, const rvec x1, const rvec x2, rvec dx)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
rmpbc_graph_t *gr;
if (ePBC == epbcNONE
- || NULL == gpbc
- || NULL == gpbc->idef
+ || nullptr == gpbc
+ || nullptr == gpbc->idef
|| gpbc->idef->ntypes <= 0)
{
- return NULL;
+ return nullptr;
}
- gr = NULL;
+ gr = nullptr;
for (i = 0; i < gpbc->ngraph; i++)
{
if (natoms == gpbc->graph[i].natoms)
gr = &gpbc->graph[i];
}
}
- if (gr == NULL)
+ if (gr == nullptr)
{
/* We'd like to check with the number of atoms in the topology,
* but we don't have that available.
srenew(gpbc->graph, gpbc->ngraph);
gr = &gpbc->graph[gpbc->ngraph-1];
gr->natoms = natoms;
- gr->gr = mk_graph(NULL, gpbc->idef, 0, natoms, FALSE, FALSE);
+ gr->gr = mk_graph(nullptr, gpbc->idef, 0, natoms, FALSE, FALSE);
}
return gr->gr;
{
int i;
- if (NULL != gpbc)
+ if (nullptr != gpbc)
{
for (i = 0; i < gpbc->ngraph; i++)
{
done_graph(gpbc->graph[i].gr);
sfree(gpbc->graph[i].gr);
}
- if (gpbc->graph != NULL)
+ if (gpbc->graph != nullptr)
{
sfree(gpbc->graph);
}
static int gmx_rmpbc_ePBC(gmx_rmpbc_t gpbc, const matrix box)
{
- if (NULL != gpbc && gpbc->ePBC >= 0)
+ if (nullptr != gpbc && gpbc->ePBC >= 0)
{
return gpbc->ePBC;
}
ePBC = gmx_rmpbc_ePBC(gpbc, box);
gr = gmx_rmpbc_get_graph(gpbc, ePBC, natoms);
- if (gr != NULL)
+ if (gr != nullptr)
{
mk_mshift(stdout, gr, ePBC, box, x);
shift_self(gr, box, x);
ePBC = gmx_rmpbc_ePBC(gpbc, box);
gr = gmx_rmpbc_get_graph(gpbc, ePBC, natoms);
- if (gr != NULL)
+ if (gr != nullptr)
{
mk_mshift(stdout, gr, ePBC, box, x);
shift_x(gr, box, x, x_s);
{
ePBC = gmx_rmpbc_ePBC(gpbc, fr->box);
gr = gmx_rmpbc_get_graph(gpbc, ePBC, fr->natoms);
- if (gr != NULL)
+ if (gr != nullptr)
{
mk_mshift(stdout, gr, ePBC, fr->box, fr->x);
shift_self(gr, fr->box, fr->x);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
pcrd->f_scal = dr_tot[c]/((pull->group[pcrd->params.group[0]].invtm + pull->group[pcrd->params.group[1]].invtm)*dt*dt);
- if (vir != NULL && pcrd->params.eGeom != epullgDIRPBC && bMaster)
+ if (vir != nullptr && pcrd->params.eGeom != epullgDIRPBC && bMaster)
{
double f_invr;
/* Adds the pull contribution to the virial */
static void add_virial_coord(tensor vir, const pull_coord_work_t *pcrd)
{
- if (vir != NULL && pcrd->params.eGeom != epullgDIRPBC)
+ if (vir != nullptr && pcrd->params.eGeom != epullgDIRPBC)
{
/* Add the pull contribution for each distance vector to the virial. */
add_virial_coord_dr(vir, pcrd->dr01, pcrd->f01);
int coord_index,
const char *provider)
{
- GMX_RELEASE_ASSERT(pull != NULL, "register_external_pull_potential called before init_pull");
- GMX_RELEASE_ASSERT(provider != NULL, "register_external_pull_potential called with NULL as provider name");
+ GMX_RELEASE_ASSERT(pull != nullptr, "register_external_pull_potential called before init_pull");
+ GMX_RELEASE_ASSERT(provider != nullptr, "register_external_pull_potential called with NULL as provider name");
if (coord_index < 0 || coord_index > pull->ncoord - 1)
{
provider, coord_index + 1, epull_names[pcrd->params.eType], epull_names[epullEXTERNAL]);
}
- GMX_RELEASE_ASSERT(pcrd->params.externalPotentialProvider != NULL, "The external potential provider string for a pull coordinate is NULL");
+ GMX_RELEASE_ASSERT(pcrd->params.externalPotentialProvider != nullptr, "The external potential provider string for a pull coordinate is NULL");
if (gmx_strcasecmp(provider, pcrd->params.externalPotentialProvider) != 0)
{
{
real dVdl = 0;
- pull_calc_coms(cr, pull, md, pbc, t, x, NULL);
+ pull_calc_coms(cr, pull, md, pbc, t, x, nullptr);
for (int c = 0; c < pull->ncoord; c++)
{
}
do_pull_pot_coord(pull, c, pbc, t, lambda,
- &V, MASTER(cr) ? vir : NULL, &dVdl);
+ &V, MASTER(cr) ? vir : nullptr, &dVdl);
/* Distribute the force over the atoms in the pulled groups */
apply_forces_coord(pull, c, md, f);
{
pg->nalloc_loc = over_alloc_dd(pg->nat_loc+1);
srenew(pg->ind_loc, pg->nalloc_loc);
- if (pg->epgrppbc == epgrppbcCOS || pg->params.weight != NULL)
+ if (pg->epgrppbc == epgrppbcCOS || pg->params.weight != nullptr)
{
srenew(pg->weight_loc, pg->nalloc_loc);
}
}
pg->ind_loc[pg->nat_loc] = ii;
- if (pg->params.weight != NULL)
+ if (pg->params.weight != nullptr)
{
pg->weight_loc[pg->nat_loc] = pg->params.weight[i];
}
}
else
{
- ga2la = NULL;
+ ga2la = nullptr;
}
/* We always make the master node participate, such that it can do i/o
* and to simplify MC type extensions people might have.
*/
- bMustParticipate = (comm->bParticipateAll || dd == NULL || DDMASTER(dd));
+ bMustParticipate = (comm->bParticipateAll || dd == nullptr || DDMASTER(dd));
for (g = 0; g < pull->ngroup; g++)
{
(comm->bParticipate &&
comm->must_count >= comm->setup_count - history_count);
- if (debug && dd != NULL)
+ if (debug && dd != nullptr)
{
fprintf(debug, "Our DD rank (%3d) pull #atoms>0 or master: %d, will be part %d\n",
dd->rank, bMustParticipate, bWillParticipate);
{
pg->nat_loc = 0;
pg->nalloc_loc = 0;
- pg->ind_loc = NULL;
- pg->weight_loc = NULL;
+ pg->ind_loc = nullptr;
+ pg->weight_loc = nullptr;
}
else
{
}
else
{
- if (groups->grpnr[egcTC] == NULL)
+ if (groups->grpnr[egcTC] == nullptr)
{
mbd = ir->delta_t/ir->opts.tau_t[0];
}
/* Copy the pull parameters */
pull->params = *pull_params;
/* Avoid pointer copies */
- pull->params.group = NULL;
- pull->params.coord = NULL;
+ pull->params.group = nullptr;
+ pull->params.coord = nullptr;
pull->ncoord = pull_params->ncoord;
pull->ngroup = pull_params->ngroup;
}
else
{
- if (pgrp->params.weight != NULL)
+ if (pgrp->params.weight != nullptr)
{
gmx_fatal(FARGS, "Pull groups can not have relative weights and cosine weighting at same time");
}
#if GMX_MPI
/* Use a sub-communicator when we have more than 32 ranks */
- comm->bParticipateAll = (cr == NULL || !DOMAINDECOMP(cr) ||
+ comm->bParticipateAll = (cr == nullptr || !DOMAINDECOMP(cr) ||
cr->dd->nnodes <= 32 ||
- getenv("GMX_PULL_PARTICIPATE_ALL") != NULL);
+ getenv("GMX_PULL_PARTICIPATE_ALL") != nullptr);
/* This sub-commicator is not used with comm->bParticipateAll,
* so we can always initialize it to NULL.
*/
comm->setup_count = 0;
comm->must_count = 0;
- if (!comm->bParticipateAll && fplog != NULL)
+ if (!comm->bParticipateAll && fplog != nullptr)
{
fprintf(fplog, "Will use a sub-communicator for pull communication\n");
}
- comm->rbuf = NULL;
- comm->dbuf = NULL;
- comm->dbuf_cyl = NULL;
+ comm->rbuf = nullptr;
+ comm->dbuf = nullptr;
+ comm->dbuf_cyl = nullptr;
/* We still need to initialize the PBC reference coordinates */
pull->bSetPBCatoms = TRUE;
/* Only do I/O when we are doing dynamics and if we are the MASTER */
- pull->out_x = NULL;
- pull->out_f = NULL;
+ pull->out_x = nullptr;
+ pull->out_f = nullptr;
if (bOutFile)
{
/* Check for px and pf filename collision, if we are writing
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
static double** allocate_square_matrix(int dim)
{
int i;
- double** mat = NULL;
+ double** mat = nullptr;
snew(mat, dim);
} /* END of loop over slabs */
/* Output on the master */
- if ( (NULL != out_slabs) && bOutStep)
+ if ( (nullptr != out_slabs) && bOutStep)
{
fprintf(out_slabs, "%12.3e%6d", time, g);
for (j = erg->slab_first; j <= erg->slab_last; j++)
char buf[50], buf2[75];
gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
gmx_bool bFlex;
- char *LegendStr = NULL;
+ char *LegendStr = nullptr;
if (rot->enfrot->Flags & MD_APPENDFILES)
int i, j, k;
rvec zet = {0.0, 0.0, 1.0};
rvec rot_axis = {0.0, 0.0, 0.0};
- rvec *rotated_str = NULL;
+ rvec *rotated_str = nullptr;
real ooanorm;
real angle;
matrix rotmat;
rvec axis)
{
int i, j, k;
- rvec *ref_s_1 = NULL;
- rvec *act_s_1 = NULL;
+ rvec *ref_s_1 = nullptr;
+ rvec *act_s_1 = nullptr;
rvec shift;
double **Rmat, **RtR, **eigvec;
double eigval[3];
}
/* Weight positions with sqrt(weight) */
- if (NULL != weight)
+ if (nullptr != weight)
{
weigh_coords(ref_s_1, weight, natoms);
weigh_coords(act_s_1, weight, natoms);
static real flex_fit_angle(t_rotgrp *rotg)
{
int i;
- rvec *fitcoords = NULL;
+ rvec *fitcoords = nullptr;
rvec center; /* Center of positions passed to the fit routine */
real fitangle; /* Angle of the rotation group derived by fitting */
rvec coord;
/* Remember how many we allocated */
erg->nslabs_alloc = nslabs;
- if ( (NULL != fplog) && bVerbose)
+ if ( (nullptr != fplog) && bVerbose)
{
fprintf(fplog, "%s allocating memory to store data for %d slabs (rotation group %d).\n",
RotStr, nslabs, g);
}
else
{
- erg->PotAngleFit = NULL;
+ erg->PotAngleFit = nullptr;
}
/* xc_ref_ind needs to be set to identity in the serial case */
t_rot *rot;
t_rotgrp *rotg;
int g;
- int nat_max = 0; /* Size of biggest rotation group */
- gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */
- gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
- rvec *x_pbc = NULL; /* Space for the pbc-correct atom positions */
+ int nat_max = 0; /* Size of biggest rotation group */
+ gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ rvec *x_pbc = nullptr; /* Space for the pbc-correct atom positions */
if (MASTER(cr) && bVerbose)
/* Output every step for reruns */
if (er->Flags & MD_RERUN)
{
- if (NULL != fplog)
+ if (nullptr != fplog)
{
fprintf(fplog, "%s rerun - will write rotation output every available step.\n", RotStr);
}
rot->nstsout = 1;
}
- er->out_slabs = NULL;
+ er->out_slabs = nullptr;
if (MASTER(cr) && HaveFlexibleGroups(rot) )
{
er->out_slabs = open_slab_out(opt2fn("-rs", nfile, fnm), rot);
* When ir->bContinuation=TRUE this has already been done, but ok. */
snew(x_pbc, mtop->natoms);
copy_rvecn(x, x_pbc, 0, mtop->natoms);
- do_pbc_first_mtop(NULL, ir->ePBC, box, mtop, x_pbc);
+ do_pbc_first_mtop(nullptr, ir->ePBC, box, mtop, x_pbc);
/* All molecules will be whole now, but not necessarily in the home box.
* Additionally, if a rotation group consists of more than one molecule
* (e.g. two strands of DNA), each one of them can end up in a different
{
rotg = &rot->grp[g];
- if (NULL != fplog)
+ if (nullptr != fplog)
{
fprintf(fplog, "%s group %d type '%s'\n", RotStr, g, erotg_names[rotg->eType]);
}
{
erg->nat_loc = 0;
erg->nalloc_loc = 0;
- erg->ind_loc = NULL;
+ erg->ind_loc = nullptr;
}
else
{
else
{
er->mpi_bufsize = 0;
- er->mpi_inbuf = NULL;
- er->mpi_outbuf = NULL;
+ er->mpi_inbuf = nullptr;
+ er->mpi_outbuf = nullptr;
}
/* Only do I/O on the MASTER */
- er->out_angles = NULL;
- er->out_rot = NULL;
- er->out_torque = NULL;
+ er->out_angles = nullptr;
+ er->out_rot = nullptr;
+ er->out_torque = nullptr;
if (MASTER(cr))
{
er->out_rot = open_rot_out(opt2fn("-ro", nfile, fnm), rot, oenv);
t_rotgrp *rotg;
gmx_bool outstep_slab, outstep_rot;
gmx_bool bColl;
- gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */
- gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
+ gmx_enfrot_t er; /* Pointer to the enforced rotation buffer variables */
+ gmx_enfrotgrp_t erg; /* Pointer to enforced rotation group data */
rvec transvec;
- t_gmx_potfit *fit = NULL; /* For fit type 'potential' determine the fit
- angle via the potential minimum */
+ t_gmx_potfit *fit = nullptr; /* For fit type 'potential' determine the fit
+ angle via the potential minimum */
/* Enforced rotation cycle counting: */
gmx_cycles_t cycles_comp; /* Cycles for the enf. rotation computation
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
int n,
real *data)
{
- if (cr != NULL && PAR(cr))
+ if (cr != nullptr && PAR(cr))
{
if (comm->bParticipateAll)
{
int n,
double *data)
{
- if (cr != NULL && PAR(cr))
+ if (cr != nullptr && PAR(cr))
{
if (comm->bParticipateAll)
{
{
int a;
- if (cr != NULL && DOMAINDECOMP(cr))
+ if (cr != nullptr && DOMAINDECOMP(cr))
{
if (ga2la_get_home(cr->dd->ga2la, pgrp->params.pbcatom, &a))
{
rvec g_x, dx, dir;
double inv_cyl_r2;
pull_comm_t *comm;
- gmx_ga2la_t *ga2la = NULL;
+ gmx_ga2la_t *ga2la = nullptr;
comm = &pull->comm;
- if (comm->dbuf_cyl == NULL)
+ if (comm->dbuf_cyl == nullptr)
{
snew(comm->dbuf_cyl, pull->ncoord*stride);
}
comm->dbuf_cyl[c*stride+8] = radf_fac1[ZZ];
}
- if (cr != NULL && PAR(cr))
+ if (cr != nullptr && PAR(cr))
{
/* Sum the contributions over the ranks */
pull_reduce_double(cr, comm, pull->ncoord*stride, comm->dbuf_cyl);
{
int ii = pgrp->ind_loc[i];
real wm;
- if (pgrp->weight_loc == NULL)
+ if (pgrp->weight_loc == nullptr)
{
wm = mass[ii];
sum_wm += wm;
sum_csm += static_cast<double>(cw*sw*m);
sum_ssm += static_cast<double>(sw*sw*m);
- if (xp != NULL)
+ if (xp != nullptr)
{
real cw = std::cos(xp[ii][cosdim]*twopi_box);
real sw = std::sin(xp[ii][cosdim]*twopi_box);
comm = &pull->comm;
- if (comm->rbuf == NULL)
+ if (comm->rbuf == nullptr)
{
snew(comm->rbuf, pull->ngroup);
}
- if (comm->dbuf == NULL)
+ if (comm->dbuf == nullptr)
{
snew(comm->dbuf, 3*pull->ngroup);
}
{
pull_set_pbcatoms(cr, pull, x, comm->rbuf);
- if (cr != NULL && DOMAINDECOMP(cr))
+ if (cr != nullptr && DOMAINDECOMP(cr))
{
/* We can keep these PBC reference coordinates fixed for nstlist
* steps, since atoms won't jump over PBC.
}
}
- if (pgrp->weight_loc == NULL)
+ if (pgrp->weight_loc == nullptr)
{
sum_com->sum_wwm = sum_com->sum_wm;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
}
sfree(cdata);
}
- cdata = NULL;
+ cdata = nullptr;
}
} // namespace gmx
* reference positions use the whole residue/molecule. */
if (root->type == SEL_EXPRESSION)
{
- bool bSelection = (sel != NULL);
+ bool bSelection = (sel != nullptr);
int flags = bSelection ? POS_COMPLMAX : POS_COMPLWHOLE;
if (bSelection)
{
if (root->type != SEL_ROOT && root->type != SEL_MODIFIER
&& root->type != SEL_SUBEXPRREF && root->type != SEL_SUBEXPR)
{
- sel = NULL;
+ sel = nullptr;
}
/* Recurse into children */
SelectionTreeElementPointer child = root->child;
{
sel->evaluate = &_gmx_sel_evaluate_subexpr_staticeval;
sel->cdata->evaluate = sel->evaluate;
- sel->child->mempool = NULL;
+ sel->child->mempool = nullptr;
sel->flags &= ~(SEL_ALLOCVAL | SEL_ALLOCDATA);
if (sel->v.type == GROUP_VALUE || sel->v.type == POS_VALUE)
{
if (root->child->type != SEL_SUBEXPR
|| (root->child->v.type != GROUP_VALUE && !(root->flags & SEL_ATOMVAL)))
{
- gmx_ana_index_set(&root->u.cgrp, -1, 0, 0);
+ gmx_ana_index_set(&root->u.cgrp, -1, nullptr, 0);
}
else if (root->child->cdata->flags & SEL_CDATA_FULLEVAL)
{
sel->freeExpressionData();
/* Make the item static */
sel->type = SEL_CONST;
- sel->evaluate = NULL;
- sel->cdata->evaluate = NULL;
+ sel->evaluate = nullptr;
+ sel->cdata->evaluate = nullptr;
/* Set the group value.
* freeExpressionData() frees the cgrp group, so we can just override it.
* */
sel->flags |= SEL_ALLOCDATA;
for (i = 0; i < isize; ++i)
{
- if (sel->v.u.s[i] == NULL)
+ if (sel->v.u.s[i] == nullptr)
{
snew(sel->v.u.s[i], 2);
}
child.reset(new SelectionTreeElement(SEL_CONST, SelectionLocation::createEmpty()));
child->flags = SEL_FLAGSSET | SEL_SINGLEVAL | SEL_ALLOCVAL | SEL_ALLOCDATA;
_gmx_selelem_set_vtype(child, GROUP_VALUE);
- child->evaluate = NULL;
+ child->evaluate = nullptr;
_gmx_selvalue_reserve(&child->v, 1);
gmx_ana_index_copy(child->v.u.g, sel->v.u.g, true);
init_item_compilerdata(child);
* If we reach here with a NOT expression, the NOT expression
* is also static, and will be made a constant later, so don't waste
* time copying the group. */
- child->evaluate = NULL;
+ child->evaluate = nullptr;
if (sel->u.boolt == BOOL_NOT
|| ((sel->cdata->flags & SEL_CDATA_STATICEVAL)
&& sel->u.boolt == BOOL_OR))
{
- child->cdata->evaluate = NULL;
+ child->cdata->evaluate = nullptr;
}
else
{
|| ((root->child->cdata->flags & SEL_CDATA_SIMPLESUBEXPR)
&& !(root->child->cdata->flags & SEL_CDATA_FULLEVAL))))
{
- root->evaluate = NULL;
+ root->evaluate = nullptr;
if (root->cdata)
{
- root->cdata->evaluate = NULL;
+ root->cdata->evaluate = nullptr;
}
}
if ((expr->flags & SEL_VARNUMVAL)
|| ((expr->flags & SEL_SINGLEVAL) && expr->v.type != GROUP_VALUE))
{
- gmx_ana_index_set(&root->u.cgrp, -1, NULL, 0);
+ gmx_ana_index_set(&root->u.cgrp, -1, nullptr, 0);
}
else if (expr->cdata->gmax->isize == gall->isize)
{
/* For selections, store the maximum group for
* gmx_ana_selcollection_evaluate_fin() as the value of the root
* element (unused otherwise). */
- if (expr->type != SEL_SUBEXPR && expr->v.u.p->m.mapb.a != NULL)
+ if (expr->type != SEL_SUBEXPR && expr->v.u.p->m.mapb.a != nullptr)
{
SelectionTreeElementPointer child = expr;
sel->cdata->evaluate = sel->evaluate;
sel->child->freeValues();
- sel->child->mempool = NULL;
+ sel->child->mempool = nullptr;
_gmx_selvalue_setstore(&sel->child->v, sel->v.u.ptr);
sel->child->flags &= ~(SEL_ALLOCVAL | SEL_ALLOCDATA);
}
&& (sel->cdata->flags & SEL_CDATA_SIMPLESUBEXPR)
&& (sel->cdata->flags & SEL_CDATA_STATICMULTIEVALSUBEXPR))
{
- sel->evaluate = NULL;
- sel->cdata->evaluate = NULL;
+ sel->evaluate = nullptr;
+ sel->cdata->evaluate = nullptr;
}
}
sc->mempool = _gmx_sel_mempool_create();
_gmx_sel_evaluate_init(&evaldata, sc->mempool, &sc->gall,
- sc->top, NULL, NULL);
+ sc->top, nullptr, nullptr);
/* Clear the symbol table because it is not possible to parse anything
* after compilation, and variable references in the symbol table can
mark_subexpr_dynamic(item->child, true);
}
set_evaluation_function(item, &analyze_static);
- item->evaluate(&evaldata, item, NULL);
+ item->evaluate(&evaldata, item, nullptr);
item = item->next;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
* \param mp Memory pool from which to reserve memory.
*/
explicit MempoolGroupReserver(gmx_sel_mempool_t *mp)
- : mp_(mp), g_(NULL)
+ : mp_(mp), g_(nullptr)
{
}
//! Frees any memory allocated using this reserver.
~MempoolGroupReserver()
{
- if (g_ != NULL)
+ if (g_ != nullptr)
{
_gmx_sel_mempool_free_group(mp_, g_);
}
*/
void reserve(gmx_ana_index_t *g, int count)
{
- GMX_RELEASE_ASSERT(g_ == NULL, "Can only reserve one element with one instance");
+ GMX_RELEASE_ASSERT(g_ == nullptr, "Can only reserve one element with one instance");
_gmx_sel_mempool_alloc_group(mp_, g, count);
g_ = g;
}
public:
//! Constructs an assigner without an initial assignment.
SelelemTemporaryValueAssigner()
- : old_ptr_(NULL), old_nalloc_(0)
+ : old_ptr_(nullptr), old_nalloc_(0)
{
}
/*! \brief
{
/* Clear the evaluation group of subexpressions */
if (sel->child && sel->child->type == SEL_SUBEXPR
- && sel->child->evaluate != NULL)
+ && sel->child->evaluate != nullptr)
{
sel->child->u.cgrp.isize = 0;
/* Not strictly necessary, because the value will be overwritten
}
if (sel->evaluate)
{
- sel->evaluate(&data, sel, NULL);
+ sel->evaluate(&data, sel, nullptr);
}
sel = sel->next;
}
}
sel->child->evaluate(data, sel->child,
- sel->u.cgrp.isize < 0 ? NULL : &sel->u.cgrp);
+ sel->u.cgrp.isize < 0 ? nullptr : &sel->u.cgrp);
}
void
{
int i, j;
- if (g != NULL && sel->child->evaluate != NULL)
+ if (g != nullptr && sel->child->evaluate != nullptr)
{
sel->child->evaluate(data, sel->child, g);
}
else
{
child->flags |= SEL_EVALFRAME;
- child->evaluate(data, child, NULL);
+ child->evaluate(data, child, nullptr);
}
}
child = child->next;
{
GMX_THROW(gmx::NotImplementedError("Non-position valued modifiers not implemented"));
}
- sel->u.expr.method->pupdate(context, NULL, &sel->v, sel->u.expr.mdata);
+ sel->u.expr.method->pupdate(context, nullptr, &sel->v, sel->u.expr.mdata);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
struct gmx_ana_indexgrps_t
{
//! Initializes an empty set of groups.
- explicit gmx_ana_indexgrps_t(int nr) : nr(nr), g(NULL)
+ explicit gmx_ana_indexgrps_t(int nr) : nr(nr), g(nullptr)
{
names.reserve(nr);
snew(g, nr);
gmx_ana_indexgrps_init(gmx_ana_indexgrps_t **g, gmx_mtop_t *top,
const char *fnm)
{
- t_blocka *block = NULL;
- char **names = NULL;
+ t_blocka *block = nullptr;
+ char **names = nullptr;
if (fnm)
{
{
if (n < 0 || n >= g->nr)
{
- return NULL;
+ return nullptr;
}
return &g->g[n];
}
return false;
}
- if (destName != NULL)
+ if (destName != nullptr)
{
*destName = src->names[n];
}
gmx_ana_index_clear(gmx_ana_index_t *g)
{
g->isize = 0;
- g->index = NULL;
+ g->index = nullptr;
g->nalloc_index = 0;
}
t->index[0] = 0;
t->index[1] = 0;
t->nra = 0;
- t->a = NULL;
+ t->a = nullptr;
t->nalloc_a = 0;
return;
}
// TODO: Check callers and either check these there as well, or turn these
// into exceptions.
- GMX_RELEASE_ASSERT(top != NULL || (type != INDEX_RES && type != INDEX_MOL),
+ GMX_RELEASE_ASSERT(top != nullptr || (type != INDEX_RES && type != INDEX_MOL),
"Topology must be provided for residue or molecule blocks");
GMX_RELEASE_ASSERT(!(type == INDEX_MOL && top->mols.nr == 0),
"Molecule information must be present for molecule blocks");
gmx_ana_indexmap_clear(gmx_ana_indexmap_t *m)
{
m->type = INDEX_UNKNOWN;
- m->refid = NULL;
- m->mapid = NULL;
+ m->refid = nullptr;
+ m->mapid = nullptr;
m->mapb.nr = 0;
- m->mapb.index = NULL;
+ m->mapb.index = nullptr;
m->mapb.nalloc_index = 0;
m->mapb.nra = 0;
- m->mapb.a = NULL;
+ m->mapb.a = nullptr;
m->mapb.nalloc_a = 0;
- m->orgid = NULL;
+ m->orgid = nullptr;
m->b.nr = 0;
- m->b.index = NULL;
+ m->b.index = nullptr;
m->b.nra = 0;
- m->b.a = NULL;
+ m->b.a = nullptr;
m->b.nalloc_index = 0;
m->b.nalloc_a = 0;
m->bStatic = true;
GMX_RELEASE_ASSERT(m->bStatic,
"Changing original IDs is not supported after starting "
"to use the mapping");
- GMX_RELEASE_ASSERT(top != NULL || (type != INDEX_RES && type != INDEX_MOL),
+ GMX_RELEASE_ASSERT(top != nullptr || (type != INDEX_RES && type != INDEX_MOL),
"Topology must be provided for residue or molecule blocks");
GMX_RELEASE_ASSERT(!(type == INDEX_MOL && top->mols.nr == 0),
"Molecule information must be present for molecule blocks");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2014, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,2014,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.
snew(mp, 1);
mp->currsize = 0;
mp->freesize = 0;
- mp->buffer = NULL;
- mp->freeptr = NULL;
+ mp->buffer = nullptr;
+ mp->freeptr = nullptr;
mp->nblocks = 0;
- mp->blockstack = NULL;
+ mp->blockstack = nullptr;
mp->blockstack_nalloc = 0;
mp->maxsize = 0;
return mp;
void *
_gmx_sel_mempool_alloc(gmx_sel_mempool_t *mp, size_t size)
{
- void *ptr = NULL;
+ void *ptr = nullptr;
size_t size_walign;
size_walign = ((size + ALIGN_STEP - 1) / ALIGN_STEP) * ALIGN_STEP;
{
int size;
- if (ptr == NULL)
+ if (ptr == nullptr)
{
return;
}
_gmx_sel_mempool_free_group(gmx_sel_mempool_t *mp, gmx_ana_index_t *g)
{
_gmx_sel_mempool_free(mp, g->index);
- g->index = NULL;
+ g->index = nullptr;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
: search_(search)
{
testPosCount_ = 0;
- testPositions_ = NULL;
- testExclusionIds_ = NULL;
- testIndices_ = NULL;
+ testPositions_ = nullptr;
+ testExclusionIds_ = nullptr;
+ testIndices_ = nullptr;
nexcl_ = 0;
- excl_ = NULL;
+ excl_ = nullptr;
clear_rvec(xtest_);
clear_rvec(testcell_);
clear_ivec(currCell_);
}
bXY_ = false;
nref_ = 0;
- xref_ = NULL;
- refExclusionIds_ = NULL;
- refIndices_ = NULL;
+ xref_ = nullptr;
+ refExclusionIds_ = nullptr;
+ refIndices_ = nullptr;
std::memset(&pbc_, 0, sizeof(pbc_));
bGrid_ = false;
GMX_RELEASE_ASSERT(positions.index_ == -1,
"Individual indexed positions not supported as reference");
bXY_ = bXY;
- if (bXY_ && pbc != NULL && pbc->ePBC != epbcNONE)
+ if (bXY_ && pbc != nullptr && pbc->ePBC != epbcNONE)
{
if (pbc->ePBC != epbcXY && pbc->ePBC != epbcXYZ)
{
clear_rvec(box[ZZ]);
set_pbc(&pbc_, epbcXY, box);
}
- else if (pbc != NULL)
+ else if (pbc != nullptr)
{
pbc_ = *pbc;
}
for (int i = 0; i < nref_; ++i)
{
- const int ii = (refIndices_ != NULL) ? refIndices_[i] : i;
+ const int ii = (refIndices_ != nullptr) ? refIndices_[i] : i;
rvec refcell;
mapPointToGridCell(positions.x_[ii], refcell, xrefAlloc_[i]);
addToGridCell(refcell, i);
}
}
- else if (refIndices_ != NULL)
+ else if (refIndices_ != nullptr)
{
xrefAlloc_.resize(nref_);
xref_ = as_rvec_array(xrefAlloc_.data());
xref_ = positions.x_;
}
excls_ = excls;
- refExclusionIds_ = NULL;
- if (excls != NULL)
+ refExclusionIds_ = nullptr;
+ if (excls != nullptr)
{
// TODO: Check that the IDs are ascending, or remove the limitation.
refExclusionIds_ = positions.exclusionIds_;
- GMX_RELEASE_ASSERT(refExclusionIds_ != NULL,
+ GMX_RELEASE_ASSERT(refExclusionIds_ != nullptr,
"Exclusion IDs must be set for reference positions "
"when exclusions are enabled");
}
if (testIndex_ >= 0 && testIndex_ < testPosCount_)
{
const int index =
- (testIndices_ != NULL ? testIndices_[testIndex] : testIndex);
+ (testIndices_ != nullptr ? testIndices_[testIndex] : testIndex);
if (search_.bGrid_)
{
search_.mapPointToGridCell(testPositions_[index], testcell_, xtest_);
{
copy_rvec(testPositions_[index], xtest_);
}
- if (search_.excls_ != NULL)
+ if (search_.excls_ != nullptr)
{
const int exclIndex = testExclusionIds_[index];
if (exclIndex < search_.excls_->nr)
else
{
nexcl_ = 0;
- excl_ = NULL;
+ excl_ = nullptr;
}
}
}
if (exclind_ < nexcl_)
{
const int index =
- (search_.refIndices_ != NULL ? search_.refIndices_[j] : j);
+ (search_.refIndices_ != nullptr ? search_.refIndices_[j] : j);
const int refId = search_.refExclusionIds_[index];
while (exclind_ < nexcl_ && excl_[exclind_] < refId)
{
testPositions_ = positions.x_;
testExclusionIds_ = positions.exclusionIds_;
testIndices_ = positions.indices_;
- GMX_RELEASE_ASSERT(search_.excls_ == NULL || testExclusionIds_ != NULL,
+ GMX_RELEASE_ASSERT(search_.excls_ == nullptr || testExclusionIds_ != nullptr,
"Exclusion IDs must be set when exclusions are enabled");
if (positions.index_ < 0)
{
typedef std::vector<SearchImplPointer> SearchList;
Impl()
- : cutoff_(0), excls_(NULL), mode_(eSearchMode_Automatic), bXY_(false)
+ : cutoff_(0), excls_(nullptr), mode_(eSearchMode_Automatic), bXY_(false)
{
}
~Impl()
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,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.
* to methods that accept positions.
*/
AnalysisNeighborhoodPositions(const rvec &x)
- : count_(1), index_(-1), x_(&x), exclusionIds_(NULL), indices_(NULL)
+ : count_(1), index_(-1), x_(&x), exclusionIds_(nullptr), indices_(nullptr)
{
}
/*! \brief
* Initializes positions from an array of position vectors.
*/
AnalysisNeighborhoodPositions(const rvec x[], int count)
- : count_(count), index_(-1), x_(x), exclusionIds_(NULL), indices_(NULL)
+ : count_(count), index_(-1), x_(x), exclusionIds_(nullptr), indices_(nullptr)
{
}
/*! \brief
*/
AnalysisNeighborhoodPositions(const std::vector<RVec> &x)
: count_(x.size()), index_(-1), x_(as_rvec_array(x.data())),
- exclusionIds_(NULL), indices_(NULL)
+ exclusionIds_(nullptr), indices_(nullptr)
{
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
if (nparam == 0)
{
- return NULL;
+ return nullptr;
}
/* Find the first non-null parameter */
i = 0;
- while (i < nparam && param[i].name == NULL)
+ while (i < nparam && param[i].name == nullptr)
{
++i;
}
/* Process the special case of a NULL parameter */
- if (name == NULL)
+ if (name == nullptr)
{
- return (i == 0) ? NULL : ¶m[i-1];
+ return (i == 0) ? nullptr : ¶m[i-1];
}
for (; i < nparam; ++i)
{
return ¶m[i];
}
}
- return NULL;
+ return nullptr;
}
/*! \brief
try
{
SelectionTreeElementPointer expr =
- _gmx_sel_init_position(value->expr, NULL, scanner);
+ _gmx_sel_init_position(value->expr, nullptr, scanner);
*value = SelectionParserValue::createExpr(expr);
}
catch (UserInputError &ex)
param->flags &= ~SPAR_DYNAMIC;
GMX_RELEASE_ASSERT(param->val.type == INT_VALUE || param->val.type == REAL_VALUE,
"Invalid range parameter type");
- int *idata = NULL;
- real *rdata = NULL;
+ int *idata = nullptr;
+ real *rdata = nullptr;
sfree_guard dataGuard;
if (param->val.type == INT_VALUE)
{
{
*param->nvalptr = param->val.nr;
}
- param->nvalptr = NULL;
+ param->nvalptr = nullptr;
}
/*! \brief
if (param->val.type == POS_VALUE)
{
gmx_ana_pos_reserve(param->val.u.p, valueCount, 0);
- gmx_ana_indexmap_init(¶m->val.u.p->m, NULL, NULL, INDEX_UNKNOWN);
+ gmx_ana_indexmap_init(¶m->val.u.p->m, nullptr, nullptr, INDEX_UNKNOWN);
gmx_ana_pos_set_nr(param->val.u.p, valueCount);
}
else
{
*param->nvalptr = param->val.nr;
}
- param->nvalptr = NULL;
+ param->nvalptr = nullptr;
}
/*! \brief
{
*param->nvalptr = param->val.nr;
}
- param->nvalptr = NULL;
+ param->nvalptr = nullptr;
return;
}
{
*param->nvalptr = 1;
}
- param->nvalptr = NULL;
+ param->nvalptr = nullptr;
if (param->val.type == INT_VALUE || param->val.type == REAL_VALUE
|| param->val.type == STR_VALUE)
{
{
*param->nvalptr = param->val.nr;
}
- param->nvalptr = NULL;
+ param->nvalptr = nullptr;
}
/*! \brief
const std::string &svalue = value.stringValue();
int i = 1;
int match = 0;
- while (param->val.u.s[i] != NULL)
+ while (param->val.u.s[i] != nullptr)
{
if (startsWith(param->val.u.s[i], svalue))
{
if (params[i].val.type != POS_VALUE
&& (params[i].flags & (SPAR_VARNUM | SPAR_ATOMVAL)))
{
- GMX_RELEASE_ASSERT(params[i].val.u.ptr == NULL,
+ GMX_RELEASE_ASSERT(params[i].val.u.ptr == nullptr,
"value pointer is not NULL "
"although it should be for SPAR_VARNUM "
"and SPAR_ATOMVAL parameters");
GMX_RELEASE_ASSERT(!((params[i].flags & SPAR_VARNUM)
&& (params[i].flags & SPAR_DYNAMIC))
- || params[i].nvalptr != NULL,
+ || params[i].nvalptr != nullptr,
"nvalptr is NULL but both "
"SPAR_VARNUM and SPAR_DYNAMIC are specified");
}
else
{
- GMX_RELEASE_ASSERT(params[i].val.u.ptr != NULL,
+ GMX_RELEASE_ASSERT(params[i].val.u.ptr != nullptr,
"value pointer is NULL");
}
}
try
{
// Always assigned afterwards, but cppcheck does not see that.
- gmx_ana_selparam_t *oparam = NULL;
+ gmx_ana_selparam_t *oparam = nullptr;
/* Find the parameter and make some checks */
if (!pparam->name().empty())
{
nullParamIndex = -1;
oparam
= gmx_ana_selparam_find(pparam->name().c_str(), nparam, params);
- GMX_RELEASE_ASSERT(oparam != NULL, "Inconsistent selection parameter");
+ GMX_RELEASE_ASSERT(oparam != nullptr, "Inconsistent selection parameter");
}
else if (nullParamIndex >= 0)
{
oparam = ¶ms[nullParamIndex];
- if (oparam->name != NULL)
+ if (oparam->name != nullptr)
{
std::string text(_gmx_sel_lexer_get_text(scanner, pparam->location()));
std::string message
if (!(params[i].flags & SPAR_OPTIONAL) && !(params[i].flags & SPAR_SET))
{
std::string message;
- if (params[i].name == NULL)
+ if (params[i].name == nullptr)
{
message = formatString("'%s' should be followed by a value/expression",
root->name().c_str());
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
template <typename ValueType> static
ValueType get(ValueType *src)
{
- GMX_RELEASE_ASSERT(src != NULL, "Semantic value pointers should be non-NULL");
+ GMX_RELEASE_ASSERT(src != nullptr, "Semantic value pointers should be non-NULL");
const std::unique_ptr<ValueType> srcGuard(src);
return ValueType(std::move(*src));
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
bool canContinue = false;
gmx::GromacsException *gromacsException
= dynamic_cast<gmx::GromacsException *>(ex);
- if (gromacsException != NULL)
+ if (gromacsException != nullptr)
{
gromacsException->prependContext(formatCurrentErrorContext(scanner));
- canContinue = (dynamic_cast<gmx::UserInputError *>(ex) != NULL);
+ canContinue = (dynamic_cast<gmx::UserInputError *>(ex) != nullptr);
}
_gmx_sel_lexer_set_exception(scanner, std::current_exception());
return canContinue;
ex.prependContext(context);
gmx::TextWriter *statusWriter
= _gmx_sel_lexer_get_status_writer(scanner);
- if (statusWriter != NULL)
+ if (statusWriter != nullptr)
{
gmx::formatExceptionMessageToWriter(statusWriter, ex);
return true;
const char *name,
SelectionParserValueListPointer values,
const SelectionLocation &location)
- : name_(name != NULL ? name : ""), location_(location),
+ : name_(name != nullptr ? name : ""), location_(location),
values_(values ? std::move(values)
: SelectionParserValueListPointer(new SelectionParserValueList))
{
for (i = 0; i < nparams; ++i)
{
param[i].flags &= ~SPAR_SET;
- _gmx_selvalue_setstore(¶m[i].val, NULL);
+ _gmx_selvalue_setstore(¶m[i].val, nullptr);
if (param[i].flags & SPAR_VARNUM)
{
param[i].val.nr = -1;
}
/* Duplicate the enum value array if it is given statically */
- if ((param[i].flags & SPAR_ENUMVAL) && orgparam[i].val.u.ptr != NULL)
+ if ((param[i].flags & SPAR_ENUMVAL) && orgparam[i].val.u.ptr != nullptr)
{
int n;
/* Count the values */
n = 1;
- while (orgparam[i].val.u.s[n] != NULL)
+ while (orgparam[i].val.u.s[n] != nullptr)
{
++n;
}
(n+1)*sizeof(param[i].val.u.s[0]));
}
}
- mdata = NULL;
+ mdata = nullptr;
if (sel->u.expr.method->init_data)
{
mdata = sel->u.expr.method->init_data(nparams, param);
}
SelectionParserParameterList params;
params.push_back(
- SelectionParserParameter::createFromExpression(NULL, child));
+ SelectionParserParameter::createFromExpression(nullptr, child));
params.push_back(
- SelectionParserParameter::create(NULL, std::move(args), location));
+ SelectionParserParameter::create(nullptr, std::move(args), location));
_gmx_sel_parse_params(params, root->u.expr.method->nparams,
root->u.expr.method->param, root, scanner);
}
else
{
params->push_front(
- SelectionParserParameter::createFromExpression(NULL, sel));
+ SelectionParserParameter::createFromExpression(nullptr, sel));
root = modifier;
}
/* Process the parameters */
_gmx_selelem_set_kwpos_type(root.get(), type);
/* Create the parameters for the parameter parser. */
SelectionParserParameterList params;
- params.push_back(SelectionParserParameter::createFromExpression(NULL, expr));
+ params.push_back(SelectionParserParameter::createFromExpression(nullptr, expr));
/* Parse the parameters. */
_gmx_sel_parse_params(params, root->u.expr.method->nparams,
root->u.expr.method->param, root, scanner);
SEL_GROUPREF, _gmx_sel_lexer_get_current_location(scanner)));
_gmx_selelem_set_vtype(sel, GROUP_VALUE);
sel->setName(gmx::formatString("group %d", id));
- sel->u.gref.name = NULL;
+ sel->u.gref.name = nullptr;
sel->u.gref.id = id;
if (_gmx_sel_lexer_has_groups_set(scanner))
/* Print out some information if the parser is interactive */
gmx::TextWriter *statusWriter = _gmx_sel_lexer_get_status_writer(scanner);
- if (statusWriter != NULL)
+ if (statusWriter != nullptr)
{
const std::string message
= gmx::formatString("Selection '%s' parsed",
sc->varstrs[sc->nvars] = gmx_strdup(pselstr);
++sc->nvars;
gmx::TextWriter *statusWriter = _gmx_sel_lexer_get_status_writer(scanner);
- if (statusWriter != NULL)
+ if (statusWriter != nullptr)
{
const std::string message
= gmx::formatString("Variable '%s' parsed", pselstr);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
"part_mol_com", "part_mol_cog",
"dyn_res_com", "dyn_res_cog",
"dyn_mol_com", "dyn_mol_cog",
- NULL,
+ nullptr,
};
/*! \brief
*/
PositionCalculationCollection::Impl::Impl()
- : top_(NULL), first_(NULL), last_(NULL), bInit_(false)
+ : top_(nullptr), first_(nullptr), last_(nullptr), bInit_(false)
{
}
{
// Loop backwards, because there can be internal references in that are
// correctly handled by this direction.
- while (last_ != NULL)
+ while (last_ != nullptr)
{
GMX_ASSERT(last_->refcount == 1,
"Dangling references to position calculations");
gmx_ana_poscalc_t *before)
{
GMX_RELEASE_ASSERT(pc->coll == this, "Inconsistent collections");
- if (before == NULL)
+ if (before == nullptr)
{
- pc->next = NULL;
+ pc->next = nullptr;
pc->prev = last_;
- if (last_ != NULL)
+ if (last_ != nullptr)
{
last_->next = pc;
}
}
before->prev = pc;
}
- if (pc->prev == NULL)
+ if (pc->prev == nullptr)
{
first_ = pc;
}
PositionCalculationCollection::Impl::removeCalculation(gmx_ana_poscalc_t *pc)
{
GMX_RELEASE_ASSERT(pc->coll == this, "Inconsistent collections");
- if (pc->prev != NULL)
+ if (pc->prev != nullptr)
{
pc->prev->next = pc->next;
}
{
first_ = pc->next;
}
- if (pc->next != NULL)
+ if (pc->next != nullptr)
{
pc->next->prev = pc->prev;
}
{
last_ = pc->prev;
}
- pc->prev = pc->next = NULL;
+ pc->prev = pc->next = nullptr;
}
gmx_ana_poscalc_t *
gmx_ana_poscalc_set_flags(pc, flags);
pc->refcount = 1;
pc->coll = this;
- insertCalculation(pc, NULL);
+ insertCalculation(pc, nullptr);
return pc;
}
}
if (pc->sbase)
{
- gmx_ana_poscalc_update(pc->sbase, NULL, NULL, fr, pbc);
+ gmx_ana_poscalc_update(pc->sbase, nullptr, nullptr, fr, pbc);
}
if (!p)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,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.
gmx_ana_pos_t::gmx_ana_pos_t()
{
- x = NULL;
- v = NULL;
- f = NULL;
+ x = nullptr;
+ v = nullptr;
+ f = nullptr;
gmx_ana_indexmap_clear(&m);
nalloc_x = 0;
}
copy_rvec(x, pos->x[0]);
clear_rvec(pos->v[0]);
clear_rvec(pos->f[0]);
- gmx_ana_indexmap_init(&pos->m, NULL, NULL, INDEX_UNKNOWN);
+ gmx_ana_indexmap_init(&pos->m, nullptr, nullptr, INDEX_UNKNOWN);
}
/*!
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,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.
{
if (bBoolNo)
{
- GMX_RELEASE_ASSERT(param->name != NULL,
+ GMX_RELEASE_ASSERT(param->name != nullptr,
"bBoolNo should only be set for a parameters with a name");
snew(yylval->str, strlen(param->name) + 3);
yylval->str[0] = 'n';
}
else
{
- yylval->str = param->name ? gmx_strdup(param->name) : NULL;
+ yylval->str = param->name ? gmx_strdup(param->name) : nullptr;
}
return PARAM;
}
if (!bPosMod && method->type != POS_VALUE)
{
state->nextMethodSymbol = symbol;
- _gmx_sel_lexer_add_token(yylloc, NULL, 0, state);
+ _gmx_sel_lexer_add_token(yylloc, nullptr, 0, state);
return EMPTY_POSMOD;
}
_gmx_sel_lexer_add_token(yylloc, symbol->name().c_str(), -1, state);
{
/* Remove all methods from the stack */
state->msp = -1;
- if (method->param[1].name == NULL)
+ if (method->param[1].name == nullptr)
{
state->nextparam = &method->param[1];
}
}
else
{
- if (method->param[0].name == NULL)
+ if (method->param[0].name == nullptr)
{
state->nextparam = &method->param[0];
}
if (state->neom > 0)
{
--state->neom;
- _gmx_sel_lexer_add_token(yylloc, NULL, 0, state);
+ _gmx_sel_lexer_add_token(yylloc, nullptr, 0, state);
return END_OF_METHOD;
}
- state->nextparam = NULL;
+ state->nextparam = nullptr;
state->bBoolNo = false;
_gmx_sel_lexer_add_token(yylloc, param->name, -1, state);
return init_param_token(yylval, param, bBoolNo);
if (state->nextMethodSymbol)
{
const gmx::SelectionParserSymbol *symbol = state->nextMethodSymbol;
- state->nextMethodSymbol = NULL;
+ state->nextMethodSymbol = nullptr;
return init_method_token(yylval, yylloc, symbol, true, state);
}
return 0;
/* Check if the identifier matches with a parameter name */
if (state->msp >= 0)
{
- gmx_ana_selparam_t *param = NULL;
+ gmx_ana_selparam_t *param = nullptr;
bool bBoolNo = false;
int sp = state->msp;
while (!param && sp >= 0)
for (i = 0; i < state->mstack[sp]->nparams; ++i)
{
/* Skip NULL parameters and too long parameters */
- if (state->mstack[sp]->param[i].name == NULL
+ if (state->mstack[sp]->param[i].name == nullptr
|| strlen(state->mstack[sp]->param[i].name) > yyleng)
{
continue;
state->mstack_alloc = 20;
state->msp = -1;
state->neom = 0;
- state->nextparam = NULL;
- state->nextMethodSymbol = NULL;
+ state->nextparam = nullptr;
+ state->nextMethodSymbol = nullptr;
state->prev_pos_kw = 0;
state->bBoolNo = false;
state->bMatchOf = false;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
"Should not be called more than once");
posMass_.reserve(posCount());
posCharge_.reserve(posCount());
- if (top == NULL)
+ if (top == nullptr)
{
posMass_.resize(posCount(), 1.0);
posCharge_.resize(posCount(), 0.0);
void
SelectionData::refreshMassesAndCharges(const gmx_mtop_t *top)
{
- if (top != NULL && isDynamic() && !hasFlag(efSelection_DynamicMask))
+ if (top != nullptr && isDynamic() && !hasFlag(efSelection_DynamicMask))
{
computeMassesAndCharges(top, rawPositions_, &posMass_, &posCharge_);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
* assigned results in undefined behavior.
* isValid() returns `false` for the selection until it is initialized.
*/
- Selection() : sel_(NULL) {}
+ Selection() : sel_(nullptr) {}
/*! \brief
* Creates a new selection object.
*
explicit Selection(internal::SelectionData *sel) : sel_(sel) {}
//! Returns whether the selection object is initialized.
- bool isValid() const { return sel_ != NULL; }
+ bool isValid() const { return sel_ != nullptr; }
//! Returns whether two selection objects wrap the same selection.
bool operator==(const Selection &other) const
return constArrayRefFromArray(data().rawPositions_.x, posCount());
}
//! Returns whether velocities are available for this selection.
- bool hasVelocities() const { return data().rawPositions_.v != NULL; }
+ bool hasVelocities() const { return data().rawPositions_.v != nullptr; }
/*! \brief
* Returns velocities for this selection as a continuous array.
*
return constArrayRefFromArray(data().rawPositions_.v, posCount());
}
//! Returns whether forces are available for this selection.
- bool hasForces() const { return sel_->rawPositions_.f != NULL; }
+ bool hasForces() const { return sel_->rawPositions_.f != nullptr; }
/*! \brief
* Returns forces for this selection as a continuous array.
*
ConstArrayRef<int> atomIndices() const
{
const int *atoms = sel_->rawPositions_.m.mapb.a;
- if (atoms == NULL)
+ if (atoms == nullptr)
{
return ConstArrayRef<int>();
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
*/
SelectionCollection::Impl::Impl()
- : debugLevel_(0), bExternalGroupsSet_(false), grps_(NULL)
+ : debugLevel_(0), bExternalGroupsSet_(false), grps_(nullptr)
{
sc_.nvars = 0;
- sc_.varstrs = NULL;
- sc_.top = NULL;
+ sc_.varstrs = nullptr;
+ sc_.top = nullptr;
gmx_ana_index_clear(&sc_.gall);
- sc_.mempool = NULL;
+ sc_.mempool = nullptr;
sc_.symtab.reset(new SelectionParserSymbolTable);
gmx_ana_index_clear(&requiredAtoms_);
gmx_ana_selmethod_register_defaults(sc_.symtab.get());
bool promptLine(TextInputStream *inputStream, TextWriter *statusWriter,
std::string *line)
{
- if (statusWriter != NULL)
+ if (statusWriter != nullptr)
{
statusWriter->writeString("> ");
}
while (endsWith(*line, "\\\n"))
{
line->resize(line->length() - 2);
- if (statusWriter != NULL)
+ if (statusWriter != nullptr)
{
statusWriter->writeString("... ");
}
{
line->resize(line->length() - 1);
}
- else if (statusWriter != NULL)
+ else if (statusWriter != nullptr)
{
statusWriter->writeLine();
}
gmx_ana_indexgrps_t *grps, size_t firstSelection,
int maxCount, const std::string &context, bool bFirst)
{
- if (grps != NULL)
+ if (grps != nullptr)
{
writer->writeLine("Available static index groups:");
gmx_ana_indexgrps_print(writer, grps, 0);
void printHelp(TextWriter *writer, gmx_ana_selcollection_t *sc,
const std::string &line)
{
- if (sc->rootHelp.get() == NULL)
+ if (sc->rootHelp.get() == nullptr)
{
sc->rootHelp = createSelectionHelpTopic();
}
if (bInteractive)
{
TextWriter *statusWriter = _gmx_sel_lexer_get_status_writer(scanner);
- if (statusWriter != NULL)
+ if (statusWriter != nullptr)
{
printCurrentStatus(statusWriter, sc, grps, oldCount, maxnr, context, true);
}
int status;
while (promptLine(inputStream, statusWriter, &line))
{
- if (statusWriter != NULL)
+ if (statusWriter != nullptr)
{
line = stripString(line);
if (line.empty())
}
{
YYLTYPE location;
- status = _gmx_sel_yypush_parse(parserState.get(), 0, NULL,
+ status = _gmx_sel_yypush_parse(parserState.get(), 0, nullptr,
&location, scanner);
}
// TODO: Remove added selections from the collection if parsing failed?
void checkTopologyProperties(const gmx_mtop_t *top,
const SelectionTopologyProperties &props)
{
- if (top == NULL)
+ if (top == nullptr)
{
if (props.hasAny())
{
void
SelectionCollection::setReferencePosType(const char *type)
{
- GMX_RELEASE_ASSERT(type != NULL, "Cannot assign NULL position type");
+ GMX_RELEASE_ASSERT(type != nullptr, "Cannot assign NULL position type");
// Check that the type is valid, throw if it is not.
e_poscalc_t dummytype;
int dummyflags;
void
SelectionCollection::setOutputPosType(const char *type)
{
- GMX_RELEASE_ASSERT(type != NULL, "Cannot assign NULL position type");
+ GMX_RELEASE_ASSERT(type != nullptr, "Cannot assign NULL position type");
// Check that the type is valid, throw if it is not.
e_poscalc_t dummytype;
int dummyflags;
void
SelectionCollection::setTopology(gmx_mtop_t *top, int natoms)
{
- GMX_RELEASE_ASSERT(natoms > 0 || top != NULL,
+ GMX_RELEASE_ASSERT(natoms > 0 || top != nullptr,
"The number of atoms must be given if there is no topology");
checkTopologyProperties(top, requiredTopologyProperties());
// Get the number of atoms from the topology if it is not given.
void
SelectionCollection::setIndexGroups(gmx_ana_indexgrps_t *grps)
{
- GMX_RELEASE_ASSERT(grps == NULL || !impl_->bExternalGroupsSet_,
+ GMX_RELEASE_ASSERT(grps == nullptr || !impl_->bExternalGroupsSet_,
"Can only set external groups once or clear them afterwards");
impl_->grps_ = grps;
impl_->bExternalGroupsSet_ = true;
const std::string &context)
{
return parseInteractive(count, &StandardInputStream::instance(),
- bInteractive ? &TextOutputFile::standardError() : NULL,
+ bInteractive ? &TextOutputFile::standardError() : nullptr,
context);
}
std::unique_ptr<TextWriter> initStatusWriter(TextOutputStream *statusStream)
{
std::unique_ptr<TextWriter> statusWriter;
- if (statusStream != NULL)
+ if (statusStream != nullptr)
{
statusWriter.reset(new TextWriter(statusStream));
statusWriter->wrapperSettings().setLineLength(78);
yyscan_t scanner;
TextInputFile file(filename);
// TODO: Exception-safe way of using the lexer.
- _gmx_sel_init_lexer(&scanner, &impl_->sc_, NULL, -1,
+ _gmx_sel_init_lexer(&scanner, &impl_->sc_, nullptr, -1,
impl_->bExternalGroupsSet_,
impl_->grps_);
_gmx_sel_set_lex_input_file(scanner, file.handle());
- return runParser(scanner, NULL, false, -1, std::string());
+ return runParser(scanner, nullptr, false, -1, std::string());
}
catch (GromacsException &ex)
{
{
yyscan_t scanner;
- _gmx_sel_init_lexer(&scanner, &impl_->sc_, NULL, -1,
+ _gmx_sel_init_lexer(&scanner, &impl_->sc_, nullptr, -1,
impl_->bExternalGroupsSet_,
impl_->grps_);
_gmx_sel_set_lex_input_str(scanner, str.c_str());
- return runParser(scanner, NULL, false, -1, std::string());
+ return runParser(scanner, nullptr, false, -1, std::string());
}
checkTopologyProperties(impl_->sc_.top, requiredTopologyProperties());
if (!impl_->bExternalGroupsSet_)
{
- setIndexGroups(NULL);
+ setIndexGroups(nullptr);
}
if (impl_->debugLevel_ >= 1)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
info_(this), manager_(*manager), defaultText_(settings.defaultText_),
selectionFlags_(settings.selectionFlags_)
{
- GMX_RELEASE_ASSERT(manager != NULL,
+ GMX_RELEASE_ASSERT(manager != nullptr,
"SelectionOptionManager must be added before SelectionOption");
GMX_RELEASE_ASSERT(!hasFlag(efOption_MultipleTimes),
"allowMultiple() is not supported for selection options");
| efOption_DontCheckMinimumCount),
info_(this), manager_(*manager), bValueParsed_(false)
{
- GMX_RELEASE_ASSERT(manager != NULL,
+ GMX_RELEASE_ASSERT(manager != nullptr,
"SelectionOptionManager must be added before SelectionFileOption");
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
Impl(SelectionCollection *selections,
ITopologyProvider *topologyProvider)
: selections_(*selections), topologyProvider_(*topologyProvider),
- manager_(selections), grps_(NULL)
+ manager_(selections), grps_(nullptr)
{
}
~Impl()
{
- if (grps_ != NULL)
+ if (grps_ != nullptr)
{
gmx_ana_indexgrps_free(grps_);
}
" %s\n(with -n), but it was not used by any selection.\n",
ndxfile_.c_str());
}
- selections_.setIndexGroups(NULL);
+ selections_.setIndexGroups(nullptr);
return;
}
if (ndxfile_.empty())
{
gmx_mtop_t *top = topologyProvider_.getTopology(false);
- gmx_ana_indexgrps_init(&grps_, top, NULL);
+ gmx_ana_indexgrps_init(&grps_, top, nullptr);
}
else
{
- gmx_ana_indexgrps_init(&grps_, NULL, ndxfile_.c_str());
+ gmx_ana_indexgrps_init(&grps_, nullptr, ndxfile_.c_str());
}
selections_.setIndexGroups(grps_);
}
void doneIndexGroups()
{
- if (grps_ != NULL)
+ if (grps_ != nullptr)
{
- selections_.setIndexGroups(NULL);
+ selections_.setIndexGroups(nullptr);
gmx_ana_indexgrps_free(grps_);
- grps_ = NULL;
+ grps_ = nullptr;
}
}
const bool topRequired = selections_.requiredTopologyProperties().needsTopology;
gmx_mtop_t *top = topologyProvider_.getTopology(topRequired);
int natoms = -1;
- if (top == NULL)
+ if (top == nullptr)
{
natoms = topologyProvider_.getAtomCount();
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
const char *
_gmx_selelem_type_str(const gmx::SelectionTreeElement &sel)
{
- const char *p = NULL;
+ const char *p = nullptr;
switch (sel.type)
{
case SEL_CONST: p = "CONST"; break;
const char *
_gmx_sel_value_type_str(const gmx_ana_selvalue_t *val)
{
- const char *p = NULL;
+ const char *p = nullptr;
switch (val->type)
{
case NO_VALUE: p = "NONE"; break;
const char *
_gmx_selelem_boolean_type_str(const gmx::SelectionTreeElement &sel)
{
- const char *p = NULL;
+ const char *p = nullptr;
switch (sel.u.boolt)
{
case BOOL_NOT: p = "NOT"; break;
}
_gmx_selvalue_clear(&this->v);
std::memset(&this->u, 0, sizeof(this->u));
- this->evaluate = NULL;
- this->mempool = NULL;
- this->cdata = NULL;
+ this->evaluate = nullptr;
+ this->mempool = nullptr;
+ this->cdata = nullptr;
}
SelectionTreeElement::~SelectionTreeElement()
}
}
_gmx_selvalue_free(&v);
- if (type == SEL_SUBEXPRREF && u.param != NULL)
+ if (type == SEL_SUBEXPRREF && u.param != nullptr)
{
// TODO: This is now called from two different locations.
// It is likely that one of them is unnecessary, but that requires
if (type == SEL_EXPRESSION || type == SEL_MODIFIER)
{
_gmx_selelem_free_method(u.expr.method, u.expr.mdata);
- u.expr.mdata = NULL;
- u.expr.method = NULL;
+ u.expr.mdata = nullptr;
+ u.expr.method = nullptr;
/* Free position data */
delete u.expr.pos;
- u.expr.pos = NULL;
+ u.expr.pos = nullptr;
/* Free position calculation data */
if (u.expr.pc)
{
gmx_ana_poscalc_free(u.expr.pc);
- u.expr.pc = NULL;
+ u.expr.pc = nullptr;
}
}
if (type == SEL_ARITHMETIC)
{
sfree(u.arith.opstr);
- u.arith.opstr = NULL;
+ u.arith.opstr = nullptr;
}
if (type == SEL_SUBEXPR || type == SEL_ROOT
|| (type == SEL_CONST && v.type == GROUP_VALUE))
case INT_VALUE:
case REAL_VALUE:
_gmx_sel_mempool_free(mempool, v.u.ptr);
- _gmx_selvalue_setstore(&v, NULL);
+ _gmx_selvalue_setstore(&v, nullptr);
break;
case GROUP_VALUE:
{
GMX_RELEASE_ASSERT(type == SEL_GROUPREF,
"Should only be called for index group reference elements");
- if (grps == NULL)
+ if (grps == nullptr)
{
std::string message = formatString(
"Cannot match '%s', because index groups are not available.",
gmx_ana_index_t foundGroup;
std::string foundName;
- if (u.gref.name != NULL)
+ if (u.gref.name != nullptr)
{
if (!gmx_ana_indexgrps_find(&foundGroup, &foundName, grps, u.gref.name))
{
void
_gmx_selelem_free_param(gmx_ana_selparam_t *param)
{
- if (param->val.u.ptr != NULL)
+ if (param->val.u.ptr != nullptr)
{
if (param->val.type == GROUP_VALUE)
{
void
_gmx_selelem_free_method(gmx_ana_selmethod_t *method, void *mdata)
{
- sel_freefunc free_func = NULL;
+ sel_freefunc free_func = nullptr;
/* Save the pointer to the free function. */
if (method && method->free)
if ((sel.type == SEL_CONST && sel.v.type == GROUP_VALUE) || sel.type == SEL_ROOT)
{
const gmx_ana_index_t *g = sel.v.u.g;
- if (!g || g->isize == 0 || sel.evaluate != NULL)
+ if (!g || g->isize == 0 || sel.evaluate != nullptr)
{
g = &sel.u.cgrp;
}
fprintf(fp, "\n");
}
}
- else if (sel.type == SEL_SUBEXPRREF && sel.u.param != NULL)
+ else if (sel.type == SEL_SUBEXPRREF && sel.u.param != nullptr)
{
fprintf(fp, "%*c param", level*2+1, ' ');
- if (sel.u.param->name != NULL)
+ if (sel.u.param->name != nullptr)
{
fprintf(fp, " \"%s\"", sel.u.param->name);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
* \param[in] name Name to set (can be NULL).
* \throws std::bad_alloc if out of memory.
*/
- void setName(const char *name) { name_ = (name != NULL ? name : ""); }
+ void setName(const char *name) { name_ = (name != nullptr ? name : ""); }
//! \copydoc setName(const char *)
void setName(const std::string &name) { name_ = name; }
/*! \brief
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
const std::string &symname = symbol->name();
const gmx_ana_selmethod_t *method = symbol->methodValue();
methods_.push_back(std::make_pair(std::string(symname), method));
- if (method->help.nlhelp > 0 && method->help.help != NULL)
+ if (method->help.nlhelp > 0 && method->help.help != nullptr)
{
addSubTopic(HelpTopicPointer(
new KeywordDetailsHelpTopic(symname, *method)));
writeKeywordListStart(context, "Additional keywords that directly select atoms:");
printKeywordList(context, GROUP_VALUE, false);
- writeKeywordListEnd(context, NULL);
+ writeKeywordListEnd(context, nullptr);
writeKeywordListStart(context, "Keywords that directly evaluate to positions:");
printKeywordList(context, POS_VALUE, false);
writeKeywordListStart(context, "Additional keywords:");
printKeywordList(context, POS_VALUE, true);
printKeywordList(context, NO_VALUE, true);
- writeKeywordListEnd(context, NULL);
+ writeKeywordListEnd(context, nullptr);
writeKeywordSubTopics(context);
}
= (method.flags & SMETH_MODIFIER) != 0;
if (method.type == type && bModifiers == bIsModifier)
{
- const bool bHasHelp = (method.help.nlhelp > 0 && method.help.help != NULL);
+ const bool bHasHelp = (method.help.nlhelp > 0 && method.help.help != nullptr);
const bool bPrintHelpMark
= bHasHelp && context.outputFormat() == eHelpOutputFormat_Console;
file.writeString(formatString(" %c ", bPrintHelpMark ? '+' : ' '));
- if (method.help.syntax != NULL)
+ if (method.help.syntax != nullptr)
{
file.writeLine(method.help.syntax);
}
{
const gmx_ana_selmethod_t &method = *iter->second;
const bool bHasHelp
- = (method.help.nlhelp > 0 && method.help.help != NULL);
+ = (method.help.nlhelp > 0 && method.help.help != nullptr);
if (!bHasHelp || usedSymbols.count(iter->first) > 0)
{
continue;
}
std::string title;
- if (method.help.helpTitle != NULL)
+ if (method.help.helpTitle != nullptr)
{
title = method.help.helpTitle;
title.append(" - ");
}
const IHelpTopic *subTopic = findSubTopic(iter->first.c_str());
- GMX_RELEASE_ASSERT(subTopic != NULL, "Keyword subtopic no longer exists");
+ GMX_RELEASE_ASSERT(subTopic != nullptr, "Keyword subtopic no longer exists");
HelpWriterContext subContext(context);
subContext.enterSubSection(title);
subTopic->writeHelp(subContext);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2011,2012,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.
/** Array of selection methods defined in the library. */
static const t_register_method smtable_def[] = {
- {NULL, &sm_cog},
- {NULL, &sm_com},
+ {nullptr, &sm_cog},
+ {nullptr, &sm_com},
- {NULL, &sm_all},
- {NULL, &sm_none},
- {NULL, &sm_atomnr},
- {NULL, &sm_resnr},
+ {nullptr, &sm_all},
+ {nullptr, &sm_none},
+ {nullptr, &sm_atomnr},
+ {nullptr, &sm_resnr},
{"resid", &sm_resnr},
- {NULL, &sm_resindex},
+ {nullptr, &sm_resindex},
{"residue", &sm_resindex},
- {NULL, &sm_molindex},
+ {nullptr, &sm_molindex},
{"mol", &sm_molindex},
{"molecule", &sm_molindex},
- {NULL, &sm_atomname},
+ {nullptr, &sm_atomname},
{"name", &sm_atomname},
- {NULL, &sm_pdbatomname},
+ {nullptr, &sm_pdbatomname},
{"pdbname", &sm_pdbatomname},
- {NULL, &sm_atomtype},
+ {nullptr, &sm_atomtype},
{"type", &sm_atomtype},
- {NULL, &sm_resname},
- {NULL, &sm_insertcode},
- {NULL, &sm_chain},
- {NULL, &sm_mass},
- {NULL, &sm_charge},
- {NULL, &sm_altloc},
- {NULL, &sm_occupancy},
- {NULL, &sm_betafactor},
+ {nullptr, &sm_resname},
+ {nullptr, &sm_insertcode},
+ {nullptr, &sm_chain},
+ {nullptr, &sm_mass},
+ {nullptr, &sm_charge},
+ {nullptr, &sm_altloc},
+ {nullptr, &sm_occupancy},
+ {nullptr, &sm_betafactor},
{"beta", &sm_betafactor},
- {NULL, &sm_x},
- {NULL, &sm_y},
- {NULL, &sm_z},
+ {nullptr, &sm_x},
+ {nullptr, &sm_y},
+ {nullptr, &sm_z},
- {NULL, &sm_distance},
+ {nullptr, &sm_distance},
{"dist", &sm_distance},
- {NULL, &sm_mindistance},
+ {nullptr, &sm_mindistance},
{"mindist", &sm_mindistance},
- {NULL, &sm_within},
- {NULL, &sm_insolidangle},
- {NULL, &sm_same},
+ {nullptr, &sm_within},
+ {nullptr, &sm_insolidangle},
+ {nullptr, &sm_same},
- {NULL, &sm_merge},
- {NULL, &sm_plus},
- {NULL, &sm_permute},
+ {nullptr, &sm_merge},
+ {nullptr, &sm_plus},
+ {nullptr, &sm_permute},
};
/*! \brief
for (i = 0; i < nparams; ++i)
{
/* Check that there is at most one NULL name, in the beginning */
- if (param[i].name == NULL && i > 0)
+ if (param[i].name == nullptr && i > 0)
{
report_error(fp, name, "error: NULL parameter should be the first one");
bOk = false;
/* Check for duplicates */
for (j = 0; j < i; ++j)
{
- if (param[j].name == NULL)
+ if (param[j].name == nullptr)
{
continue;
}
}
}
/* Check that the value pointer is NULL */
- if (param[i].nvalptr != NULL)
+ if (param[i].nvalptr != nullptr)
{
report_param_error(fp, name, param[i].name, "warning: nvalptr is set");
}
- if (param[i].val.u.ptr != NULL && !(param[i].flags & SPAR_ENUMVAL))
+ if (param[i].val.u.ptr != nullptr && !(param[i].flags & SPAR_ENUMVAL))
{
report_param_error(fp, name, param[i].name, "warning: value pointer is set");
}
/* Check that the name contains only valid characters */
- if (param[i].name == NULL)
+ if (param[i].name == nullptr)
{
continue;
}
if (method->pupdate && !(method->flags & SMETH_DYNAMIC))
{
report_error(fp, method->name, "warning: pupdate not used because the method is static");
- method->pupdate = NULL;
+ method->pupdate = nullptr;
}
}
/* Check that there is an evaluation function */
{
gmx_ana_selmethod_t *method = smtable_def[i].method;
- if (smtable_def[i].name == NULL)
+ if (smtable_def[i].name == nullptr)
{
rc = gmx_ana_selmethod_register(symtab, method->name, method);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2012,2013,2014, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,2012,2013,2014,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.
_gmx_selvalue_clear(gmx_ana_selvalue_t *val)
{
val->nr = 0;
- val->u.ptr = NULL;
+ val->u.ptr = nullptr;
val->nalloc = 0;
}
}
}
// TODO: It causes a memory leak somewhere if val->nr is assigned zero here...
- val->u.ptr = NULL;
+ val->u.ptr = nullptr;
val->nalloc = 0;
}
srenew(val->u.s, n);
for (i = val->nalloc; i < n; ++i)
{
- val->u.s[i] = NULL;
+ val->u.s[i] = nullptr;
}
break;
case POS_VALUE:
- GMX_RELEASE_ASSERT(val->u.ptr == NULL,
+ GMX_RELEASE_ASSERT(val->u.ptr == nullptr,
"Reallocation of position values not supported");
val->u.p = new gmx_ana_pos_t[n];
break;
{
*ptr = val->u.ptr;
*nalloc = val->nalloc;
- val->u.ptr = NULL;
+ val->u.ptr = nullptr;
val->nalloc = 0;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
/** Parameters for comparison expression evaluation. */
static gmx_ana_selparam_t smparams_compare[] = {
- {"int1", {INT_VALUE, -1, {NULL}}, NULL,
+ {"int1", {INT_VALUE, -1, {nullptr}}, nullptr,
SPAR_OPTIONAL | SPAR_DYNAMIC | SPAR_ATOMVAL},
- {"real1", {REAL_VALUE, -1, {NULL}}, NULL,
+ {"real1", {REAL_VALUE, -1, {nullptr}}, nullptr,
SPAR_OPTIONAL | SPAR_DYNAMIC | SPAR_ATOMVAL},
- {"op", {STR_VALUE, 1, {NULL}}, NULL, 0},
- {"int2", {INT_VALUE, -1, {NULL}}, NULL,
+ {"op", {STR_VALUE, 1, {nullptr}}, nullptr, 0},
+ {"int2", {INT_VALUE, -1, {nullptr}}, nullptr,
SPAR_OPTIONAL | SPAR_DYNAMIC | SPAR_ATOMVAL},
- {"real2", {REAL_VALUE, -1, {NULL}}, NULL,
+ {"real2", {REAL_VALUE, -1, {nullptr}}, nullptr,
SPAR_OPTIONAL | SPAR_DYNAMIC | SPAR_ATOMVAL},
};
"cmp", GROUP_VALUE, SMETH_SINGLEVAL,
asize(smparams_compare), smparams_compare,
&init_data_compare,
- NULL,
+ nullptr,
&init_compare,
- NULL,
+ nullptr,
&free_data_compare,
- NULL,
+ nullptr,
&evaluate_compare,
- NULL,
- {NULL, NULL, 0, NULL},
+ nullptr,
+ {nullptr, nullptr, 0, nullptr},
};
/*! \brief
static const char *
comparison_type_str(e_comparison_t cmpt)
{
- const char *p = NULL;
+ const char *p = nullptr;
switch (cmpt)
{
case CMP_INVALID: p = "INVALID"; break;
else
{
n = 0;
- val->i = NULL;
- val->r = NULL;
+ val->i = nullptr;
+ val->r = nullptr;
}
return n;
}
/* Reverse the sides to place the integer on the right */
int flags;
d->left.r = d->right.r;
- d->right.r = NULL;
+ d->right.r = nullptr;
d->right.i = d->left.i;
- d->left.i = NULL;
+ d->left.i = nullptr;
flags = d->left.flags;
d->left.flags = d->right.flags;
d->right.flags = flags;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
/** Parameters for the \p distance selection method. */
static gmx_ana_selparam_t smparams_distance[] = {
- {"cutoff", {REAL_VALUE, 1, {NULL}}, NULL, SPAR_OPTIONAL},
- {"from", {POS_VALUE, 1, {NULL}}, NULL, SPAR_DYNAMIC},
+ {"cutoff", {REAL_VALUE, 1, {nullptr}}, nullptr, SPAR_OPTIONAL},
+ {"from", {POS_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC},
};
/** Parameters for the \p mindistance selection method. */
static gmx_ana_selparam_t smparams_mindistance[] = {
- {"cutoff", {REAL_VALUE, 1, {NULL}}, NULL, SPAR_OPTIONAL},
- {"from", {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM},
+ {"cutoff", {REAL_VALUE, 1, {nullptr}}, nullptr, SPAR_OPTIONAL},
+ {"from", {POS_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM},
};
/** Parameters for the \p within selection method. */
static gmx_ana_selparam_t smparams_within[] = {
- {NULL, {REAL_VALUE, 1, {NULL}}, NULL, 0},
- {"of", {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM},
+ {nullptr, {REAL_VALUE, 1, {nullptr}}, nullptr, 0},
+ {"of", {POS_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM},
};
//! Help title for distance selection methods.
"distance", REAL_VALUE, SMETH_DYNAMIC,
asize(smparams_distance), smparams_distance,
&init_data_common,
- NULL,
+ nullptr,
&init_common,
- NULL,
+ nullptr,
&free_data_common,
&init_frame_common,
- NULL,
+ nullptr,
&evaluate_distance,
{"distance from POS [cutoff REAL]",
helptitle_distance, asize(help_distance), help_distance},
"mindistance", REAL_VALUE, SMETH_DYNAMIC,
asize(smparams_mindistance), smparams_mindistance,
&init_data_common,
- NULL,
+ nullptr,
&init_common,
- NULL,
+ nullptr,
&free_data_common,
&init_frame_common,
- NULL,
+ nullptr,
&evaluate_distance,
{"mindistance from POS_EXPR [cutoff REAL]",
helptitle_distance, asize(help_distance), help_distance},
"within", GROUP_VALUE, SMETH_DYNAMIC,
asize(smparams_within), smparams_within,
&init_data_common,
- NULL,
+ nullptr,
&init_common,
- NULL,
+ nullptr,
&free_data_common,
&init_frame_common,
- NULL,
+ nullptr,
&evaluate_within,
{"within REAL of POS_EXPR",
helptitle_distance, asize(help_distance), help_distance},
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
/** Parameters for the \p insolidangle selection method. */
static gmx_ana_selparam_t smparams_insolidangle[] = {
- {"center", {POS_VALUE, 1, {NULL}}, NULL, SPAR_DYNAMIC},
- {"span", {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM},
- {"cutoff", {REAL_VALUE, 1, {NULL}}, NULL, SPAR_OPTIONAL},
+ {"center", {POS_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC},
+ {"span", {POS_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM},
+ {"cutoff", {REAL_VALUE, 1, {nullptr}}, nullptr, SPAR_OPTIONAL},
};
/** Help text for the \p insolidangle selection method. */
"insolidangle", GROUP_VALUE, SMETH_DYNAMIC,
asize(smparams_insolidangle), smparams_insolidangle,
&init_data_insolidangle,
- NULL,
+ nullptr,
&init_insolidangle,
- NULL,
+ nullptr,
&free_data_insolidangle,
&init_frame_insolidangle,
- NULL,
+ nullptr,
&evaluate_insolidangle,
{"insolidangle center POS span POS_EXPR [cutoff REAL]",
"Selecting atoms in a solid angle",
// cppcheck-suppress uninitdata
data->tbinsize = 0.0;
// cppcheck-suppress uninitdata
- data->tbin = NULL;
+ data->tbin = nullptr;
// cppcheck-suppress uninitdata
data->maxbins = 0;
// cppcheck-suppress uninitdata
data->nbins = 0;
// cppcheck-suppress uninitdata
- data->bin = NULL;
+ data->bin = nullptr;
param[0].val.u.p = &data->center;
param[1].val.u.p = &data->span;
sfree(surf->bin[i].x);
}
surf->bin[i].n_alloc = 0;
- surf->bin[i].x = NULL;
+ surf->bin[i].x = nullptr;
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
/** Parameters for integer keyword evaluation. */
static gmx_ana_selparam_t smparams_keyword_int[] = {
- {NULL, {INT_VALUE, -1, {NULL}}, NULL, SPAR_ATOMVAL},
- {NULL, {INT_VALUE, -1, {NULL}}, NULL, SPAR_RANGES | SPAR_VARNUM},
+ {nullptr, {INT_VALUE, -1, {nullptr}}, nullptr, SPAR_ATOMVAL},
+ {nullptr, {INT_VALUE, -1, {nullptr}}, nullptr, SPAR_RANGES | SPAR_VARNUM},
};
/** Parameters for real keyword evaluation. */
static gmx_ana_selparam_t smparams_keyword_real[] = {
- {NULL, {REAL_VALUE, -1, {NULL}}, NULL, SPAR_ATOMVAL | SPAR_DYNAMIC},
- {NULL, {REAL_VALUE, -1, {NULL}}, NULL, SPAR_RANGES | SPAR_VARNUM},
+ {nullptr, {REAL_VALUE, -1, {nullptr}}, nullptr, SPAR_ATOMVAL | SPAR_DYNAMIC},
+ {nullptr, {REAL_VALUE, -1, {nullptr}}, nullptr, SPAR_RANGES | SPAR_VARNUM},
};
/** Parameters for string keyword evaluation. */
static gmx_ana_selparam_t smparams_keyword_str[] = {
- {NULL, {STR_VALUE, -1, {NULL}}, NULL, SPAR_ATOMVAL},
- {NULL, {STR_VALUE, -1, {NULL}}, NULL, SPAR_VARNUM},
+ {nullptr, {STR_VALUE, -1, {nullptr}}, nullptr, SPAR_ATOMVAL},
+ {nullptr, {STR_VALUE, -1, {nullptr}}, nullptr, SPAR_VARNUM},
};
/** Selection method data for integer keyword evaluation. */
"kw_int", GROUP_VALUE, SMETH_SINGLEVAL,
asize(smparams_keyword_int), smparams_keyword_int,
&init_data_kwint,
- NULL,
+ nullptr,
&init_kwint,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_keyword_int,
- NULL,
- {NULL, NULL, 0, NULL},
+ nullptr,
+ {nullptr, nullptr, 0, nullptr},
};
/** Selection method data for real keyword evaluation. */
"kw_real", GROUP_VALUE, SMETH_SINGLEVAL,
asize(smparams_keyword_real), smparams_keyword_real,
&init_data_kwreal,
- NULL,
+ nullptr,
&init_kwreal,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_keyword_real,
- NULL,
- {NULL, NULL, 0, NULL},
+ nullptr,
+ {nullptr, nullptr, 0, nullptr},
};
/** Selection method data for string keyword evaluation. */
"kw_str", GROUP_VALUE, SMETH_SINGLEVAL,
asize(smparams_keyword_str), smparams_keyword_str,
&init_data_kwstr,
- NULL,
+ nullptr,
&init_kwstr,
- NULL,
+ nullptr,
&free_data_kwstr,
- NULL,
+ nullptr,
&evaluate_keyword_str,
- NULL,
- {NULL, NULL, 0, NULL},
+ nullptr,
+ {nullptr, nullptr, 0, nullptr},
};
/*! \brief
/** Parameters for keyword evaluation in an arbitrary group. */
static gmx_ana_selparam_t smparams_kweval_group[] = {
- {NULL, {GROUP_VALUE, 1, {NULL}}, NULL, SPAR_DYNAMIC},
+ {nullptr, {GROUP_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC},
};
/** Parameters for keyword evaluation from positions. */
static gmx_ana_selparam_t smparams_kweval_pos[] = {
- {NULL, {POS_VALUE, 1, {NULL}}, NULL, SPAR_DYNAMIC},
+ {nullptr, {POS_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC},
};
{
t_methoddata_kweval *d = static_cast<t_methoddata_kweval *>(data);
- d->kwmethod->init(top, 0, NULL, d->kwmdata);
+ d->kwmethod->init(top, 0, nullptr, d->kwmdata);
}
static void
sel->u.expr.method->name = data->kwmethod->name;
sel->u.expr.method->type = data->kwmethod->type;
sel->u.expr.method->flags = data->kwmethod->flags | SMETH_VARNUMVAL;
- sel->u.expr.method->init_data = NULL;
- sel->u.expr.method->set_poscoll = NULL;
- sel->u.expr.method->init = method->init ? &init_kweval : NULL;
+ sel->u.expr.method->init_data = nullptr;
+ sel->u.expr.method->set_poscoll = nullptr;
+ sel->u.expr.method->init = method->init ? &init_kweval : nullptr;
sel->u.expr.method->outinit = &init_output_kweval;
sel->u.expr.method->free = &free_data_kweval;
- sel->u.expr.method->init_frame = method->init_frame ? &init_frame_kweval : NULL;
+ sel->u.expr.method->init_frame = method->init_frame ? &init_frame_kweval : nullptr;
sel->u.expr.method->update = &evaluate_kweval;
- sel->u.expr.method->pupdate = NULL;
+ sel->u.expr.method->pupdate = nullptr;
sel->u.expr.method->nparams = asize(smparams_kweval_group);
sel->u.expr.method->param = smparams_kweval_group;
_gmx_selelem_init_method_params(sel, scanner);
void *scanner)
{
if ((method->flags & (SMETH_SINGLEVAL | SMETH_VARNUMVAL))
- || method->outinit || method->pupdate == NULL)
+ || method->outinit || method->pupdate == nullptr)
{
std::string message
= gmx::formatString("Keyword '%s' cannot be evaluated in this context",
sel->u.expr.method->name = data->kwmethod->name;
sel->u.expr.method->type = data->kwmethod->type;
sel->u.expr.method->flags = data->kwmethod->flags | SMETH_SINGLEVAL;
- sel->u.expr.method->init_data = NULL;
- sel->u.expr.method->set_poscoll = NULL;
- sel->u.expr.method->init = method->init ? &init_kweval : NULL;
- sel->u.expr.method->outinit = NULL;
+ sel->u.expr.method->init_data = nullptr;
+ sel->u.expr.method->set_poscoll = nullptr;
+ sel->u.expr.method->init = method->init ? &init_kweval : nullptr;
+ sel->u.expr.method->outinit = nullptr;
sel->u.expr.method->free = &free_data_kweval;
- sel->u.expr.method->init_frame = method->init_frame ? &init_frame_kweval : NULL;
+ sel->u.expr.method->init_frame = method->init_frame ? &init_frame_kweval : nullptr;
sel->u.expr.method->update = &evaluate_kweval_pos;
- sel->u.expr.method->pupdate = NULL;
+ sel->u.expr.method->pupdate = nullptr;
sel->u.expr.method->nparams = asize(smparams_kweval_pos);
sel->u.expr.method->param = smparams_kweval_pos;
_gmx_selelem_init_method_params(sel, scanner);
{
gmx::SelectionParserParameterList params;
params.push_back(
- gmx::SelectionParserParameter::createFromExpression(NULL, child));
+ gmx::SelectionParserParameter::createFromExpression(nullptr, child));
if (child->v.type == GROUP_VALUE)
{
return init_evaluator_group(method, params, scanner);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
/** Parameters for the merging selection modifiers. */
static gmx_ana_selparam_t smparams_merge[] = {
- {NULL, {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM},
- {NULL, {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM},
- {"stride", {INT_VALUE, 1, {NULL}}, NULL, SPAR_OPTIONAL},
+ {nullptr, {POS_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM},
+ {nullptr, {POS_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM},
+ {"stride", {INT_VALUE, 1, {nullptr}}, nullptr, SPAR_OPTIONAL},
};
//! Help title for the merging selection modifiers.
"merge", POS_VALUE, SMETH_MODIFIER,
asize(smparams_merge), smparams_merge,
&init_data_merge,
- NULL,
+ nullptr,
&init_merge,
&init_output_merge,
&free_data_merge,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
&evaluate_merge,
{"merge POSEXPR", helptitle_merge, asize(help_merge), help_merge},
};
"plus", POS_VALUE, SMETH_MODIFIER,
asize(smparams_merge)-1, smparams_merge,
&init_data_merge,
- NULL,
+ nullptr,
&init_merge,
&init_output_plus,
&free_data_merge,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
&evaluate_plus,
{"plus POSEXPR", helptitle_merge, asize(help_merge), help_merge},
};
}
gmx_ana_pos_reserve_for_append(out->u.p, d->p1.count() + d->p2.count(),
d->p1.m.b.nra + d->p2.m.b.nra,
- d->p1.v != NULL, d->p1.f != NULL);
+ d->p1.v != nullptr, d->p1.f != nullptr);
gmx_ana_pos_empty_init(out->u.p);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
/** Parameters for the \p permute selection modifier. */
static gmx_ana_selparam_t smparams_permute[] = {
- {NULL, {POS_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM},
- {NULL, {INT_VALUE, -1, {NULL}}, NULL, SPAR_VARNUM},
+ {nullptr, {POS_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM},
+ {nullptr, {INT_VALUE, -1, {nullptr}}, nullptr, SPAR_VARNUM},
};
/** Help text for the \p permute selection modifier. */
"permute", POS_VALUE, SMETH_MODIFIER,
asize(smparams_permute), smparams_permute,
&init_data_permute,
- NULL,
+ nullptr,
&init_permute,
&init_output_permute,
&free_data_permute,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
&evaluate_permute,
{"POSEXPR permute P1 ... PN",
"Permuting selections", asize(help_permute), help_permute},
{
t_methoddata_permute *data = new t_methoddata_permute();
data->n = 0;
- data->perm = NULL;
- data->rperm = NULL;
+ data->perm = nullptr;
+ data->rperm = nullptr;
param[0].val.u.p = &data->p;
return data;
}
out->u.p->m.type = d->p.m.type;
gmx_ana_pos_reserve_for_append(out->u.p, d->p.count(), d->p.m.b.nra,
- d->p.v != NULL, d->p.f != NULL);
+ d->p.v != nullptr, d->p.f != nullptr);
gmx_ana_pos_empty_init(out->u.p);
for (i = 0; i < d->p.count(); i += d->n)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
/** Parameters for position keyword evaluation. */
static gmx_ana_selparam_t smparams_keyword_pos[] = {
- {NULL, {GROUP_VALUE, 1, {NULL}}, NULL, SPAR_DYNAMIC},
+ {nullptr, {GROUP_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC},
};
/** Parameters for the \p cog and \p com selection methods. */
static gmx_ana_selparam_t smparams_com[] = {
- {"of", {GROUP_VALUE, 1, {NULL}}, NULL, SPAR_DYNAMIC},
- {"pbc", {NO_VALUE, 0, {NULL}}, NULL, 0},
+ {"of", {GROUP_VALUE, 1, {nullptr}}, nullptr, SPAR_DYNAMIC},
+ {"pbc", {NO_VALUE, 0, {nullptr}}, nullptr, 0},
};
/** Selection method data for position keyword evaluation. */
&init_kwpos,
&init_output_pos,
&free_data_pos,
- NULL,
+ nullptr,
&evaluate_pos,
- NULL,
- {NULL, NULL, 0, NULL},
+ nullptr,
+ {nullptr, nullptr, 0, nullptr},
};
/** Selection method data for the \p cog method. */
&init_cog,
&init_output_pos,
&free_data_pos,
- NULL,
+ nullptr,
&evaluate_pos,
- NULL,
- {"cog of ATOM_EXPR [pbc]", NULL, 0, NULL},
+ nullptr,
+ {"cog of ATOM_EXPR [pbc]", nullptr, 0, nullptr},
};
/** Selection method data for the \p com method. */
&init_com,
&init_output_pos,
&free_data_pos,
- NULL,
+ nullptr,
&evaluate_pos,
- NULL,
- {"com of ATOM_EXPR [pbc]", NULL, 0, NULL},
+ nullptr,
+ {"com of ATOM_EXPR [pbc]", nullptr, 0, nullptr},
};
/*!
{
param[1].val.u.b = &data->bPBC;
}
- data->pc = NULL;
+ data->pc = nullptr;
data->bPBC = false;
- data->type = NULL;
+ data->type = nullptr;
data->flags = -1;
return data;
}
}
t_methoddata_pos *d = static_cast<t_methoddata_pos *>(sel.u.expr.mdata);
- return d->type == NULL;
+ return d->type == nullptr;
}
/*! \brief
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
/** Parameters for the \p same selection method. */
static gmx_ana_selparam_t smparams_same_int[] = {
- {NULL, {INT_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_ATOMVAL},
- {"as", {INT_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM},
+ {nullptr, {INT_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_ATOMVAL},
+ {"as", {INT_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM},
};
/** Parameters for the \p same selection method. */
static gmx_ana_selparam_t smparams_same_str[] = {
- {NULL, {STR_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_ATOMVAL},
- {"as", {STR_VALUE, -1, {NULL}}, NULL, SPAR_DYNAMIC | SPAR_VARNUM},
+ {nullptr, {STR_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_ATOMVAL},
+ {"as", {STR_VALUE, -1, {nullptr}}, nullptr, SPAR_DYNAMIC | SPAR_VARNUM},
};
/** Help text for the \p same selection method. */
"same", GROUP_VALUE, 0,
asize(smparams_same_int), smparams_same_int,
&init_data_same,
- NULL,
+ nullptr,
&init_same,
- NULL,
+ nullptr,
&free_data_same,
&init_frame_same_int,
&evaluate_same_int,
- NULL,
+ nullptr,
{"same KEYWORD as ATOM_EXPR",
"Extending selections", asize(help_same), help_same},
};
"same", GROUP_VALUE, SMETH_SINGLEVAL,
asize(smparams_same_str), smparams_same_str,
&init_data_same,
- NULL,
+ nullptr,
&init_same,
- NULL,
+ nullptr,
&free_data_same,
&init_frame_same_str,
&evaluate_same_str,
- NULL,
- {NULL, NULL, 0, NULL},
+ nullptr,
+ {nullptr, nullptr, 0, nullptr},
};
static void *
t_methoddata_same *data;
snew(data, 1);
- data->as_s_sorted = NULL;
+ data->as_s_sorted = nullptr;
param[1].nvalptr = &data->nas;
return data;
}
ptr = bsearch(&d->val.s[j], d->as_s_sorted, d->nas,
sizeof(d->as_s_sorted[0]), &cmp_str);
/* Check whether the value was found in the as list. */
- if (ptr == NULL)
+ if (ptr == nullptr)
{
/* If not, skip all atoms with the same value. */
const char *tmpval = d->val.s[j];
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
/** Selection method data for \p all selection keyword. */
gmx_ana_selmethod_t sm_all = {
"all", GROUP_VALUE, 0,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_all,
- NULL,
+ nullptr,
};
/** Selection method data for \p none selection keyword. */
gmx_ana_selmethod_t sm_none = {
"none", GROUP_VALUE, 0,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_none,
- NULL,
+ nullptr,
};
/** Selection method data for \p atomnr selection keyword. */
gmx_ana_selmethod_t sm_atomnr = {
"atomnr", INT_VALUE, 0,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_atomnr,
- NULL,
+ nullptr,
};
/** Selection method data for \p resnr selection keyword. */
gmx_ana_selmethod_t sm_resnr = {
"resnr", INT_VALUE, SMETH_REQTOP,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_resnr,
- NULL,
- {NULL, helptitle_resindex, asize(help_resindex), help_resindex}
+ nullptr,
+ {nullptr, helptitle_resindex, asize(help_resindex), help_resindex}
};
/** Selection method data for \p resindex selection keyword. */
gmx_ana_selmethod_t sm_resindex = {
"resindex", INT_VALUE, SMETH_REQTOP,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_resindex,
- NULL,
- {NULL, helptitle_resindex, asize(help_resindex), help_resindex}
+ nullptr,
+ {nullptr, helptitle_resindex, asize(help_resindex), help_resindex}
};
/** Selection method data for \p molindex selection keyword. */
gmx_ana_selmethod_t sm_molindex = {
"molindex", INT_VALUE, SMETH_REQTOP,
- 0, NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
&check_molecules,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_molindex,
- NULL,
+ nullptr,
};
/** Selection method data for \p atomname selection keyword. */
gmx_ana_selmethod_t sm_atomname = {
"atomname", STR_VALUE, SMETH_REQTOP,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_atomname,
- NULL,
- {NULL, helptitle_atomname, asize(help_atomname), help_atomname}
+ nullptr,
+ {nullptr, helptitle_atomname, asize(help_atomname), help_atomname}
};
/** Selection method data for \p pdbatomname selection keyword. */
gmx_ana_selmethod_t sm_pdbatomname = {
"pdbatomname", STR_VALUE, SMETH_REQTOP,
- 0, NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
&check_pdbinfo,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_pdbatomname,
- NULL,
- {NULL, helptitle_atomname, asize(help_atomname), help_atomname}
+ nullptr,
+ {nullptr, helptitle_atomname, asize(help_atomname), help_atomname}
};
/** Selection method data for \p atomtype selection keyword. */
gmx_ana_selmethod_t sm_atomtype = {
"atomtype", STR_VALUE, SMETH_REQTOP,
- 0, NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
&check_atomtype,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_atomtype,
- NULL,
+ nullptr,
};
/** Selection method data for \p resname selection keyword. */
gmx_ana_selmethod_t sm_resname = {
"resname", STR_VALUE, SMETH_REQTOP,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_resname,
- NULL,
+ nullptr,
};
/** Selection method data for \p chain selection keyword. */
gmx_ana_selmethod_t sm_insertcode = {
"insertcode", STR_VALUE, SMETH_REQTOP | SMETH_CHARVAL,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_insertcode,
- NULL,
+ nullptr,
};
/** Selection method data for \p chain selection keyword. */
gmx_ana_selmethod_t sm_chain = {
"chain", STR_VALUE, SMETH_REQTOP | SMETH_CHARVAL,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_chain,
- NULL,
+ nullptr,
};
/** Selection method data for \p mass selection keyword. */
gmx_ana_selmethod_t sm_mass = {
"mass", REAL_VALUE, SMETH_REQMASS,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_mass,
- NULL,
+ nullptr,
};
/** Selection method data for \p charge selection keyword. */
gmx_ana_selmethod_t sm_charge = {
"charge", REAL_VALUE, SMETH_REQTOP,
- 0, NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
&check_charge,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_charge,
- NULL,
+ nullptr,
};
/** Selection method data for \p chain selection keyword. */
gmx_ana_selmethod_t sm_altloc = {
"altloc", STR_VALUE, SMETH_REQTOP | SMETH_CHARVAL,
- 0, NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
&check_pdbinfo,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_altloc,
- NULL,
+ nullptr,
};
/** Selection method data for \p occupancy selection keyword. */
gmx_ana_selmethod_t sm_occupancy = {
"occupancy", REAL_VALUE, SMETH_REQTOP,
- 0, NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
&check_pdbinfo,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_occupancy,
- NULL,
+ nullptr,
};
/** Selection method data for \p betafactor selection keyword. */
gmx_ana_selmethod_t sm_betafactor = {
"betafactor", REAL_VALUE, SMETH_REQTOP,
- 0, NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
&check_pdbinfo,
- NULL,
- NULL,
- NULL,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_betafactor,
- NULL,
+ nullptr,
};
/** Selection method data for \p x selection keyword. */
gmx_ana_selmethod_t sm_x = {
"x", REAL_VALUE, SMETH_DYNAMIC,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_x,
};
/** Selection method data for \p y selection keyword. */
gmx_ana_selmethod_t sm_y = {
"y", REAL_VALUE, SMETH_DYNAMIC,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_y,
};
/** Selection method data for \p z selection keyword. */
gmx_ana_selmethod_t sm_z = {
"z", REAL_VALUE, SMETH_DYNAMIC,
- 0, NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
+ 0, nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
+ nullptr,
&evaluate_z,
};
{
bool bOk;
- bOk = (top != NULL && top->mols.nr > 0);
+ bOk = (top != nullptr && top->mols.nr > 0);
if (!bOk)
{
GMX_THROW(gmx::InconsistentInputError("Molecule information not available in topology"));
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2009,2010,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.
* \a var_ members as appropriate.
*/
Impl(SymbolType type, const char *name)
- : name_(name), type_(type), meth_(NULL)
+ : name_(name), type_(type), meth_(nullptr)
{
}
{
const char *const *postypes
= gmx::PositionCalculationCollection::typeEnumValues;
- for (int i = 0; postypes[i] != NULL; ++i)
+ for (int i = 0; postypes[i] != nullptr; ++i)
{
SymbolPointer sym(new SelectionParserSymbol(
new SelectionParserSymbol::Impl(
Impl::SymbolMap::const_iterator sym = impl_->symbols_.lower_bound(name);
if (sym == impl_->symbols_.end())
{
- return NULL;
+ return nullptr;
}
if (sym->second->name() == name)
{
return sym->second.get();
}
- return NULL;
+ return nullptr;
}
SelectionParserSymbolIterator
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
IndexBlockTest::IndexBlockTest()
{
blocka_.nr = 0;
- blocka_.index = NULL;
+ blocka_.index = nullptr;
blocka_.nalloc_index = 0;
blocka_.nra = 0;
- blocka_.a = NULL;
+ blocka_.a = nullptr;
blocka_.nalloc_a = 0;
gmx_ana_index_clear(&g_);
}
for (int i = 0; i < blocka_.nr; ++i)
{
gmx::test::TestReferenceChecker blockCompound(
- compound.checkCompound("Block", NULL));
+ compound.checkCompound("Block", nullptr));
blockCompound.checkSequence(&blocka_.a[blocka_.index[i]],
&blocka_.a[blocka_.index[i+1]],
"Atoms");
TEST_F(IndexBlockTest, CreatesUnknownBlock)
{
- gmx_ana_index_make_block(&blocka_, NULL, NULL, INDEX_UNKNOWN, false);
+ gmx_ana_index_make_block(&blocka_, nullptr, nullptr, INDEX_UNKNOWN, false);
checkBlocka();
done_blocka(&blocka_);
- gmx_ana_index_make_block(&blocka_, NULL, NULL, INDEX_UNKNOWN, false);
+ gmx_ana_index_make_block(&blocka_, nullptr, nullptr, INDEX_UNKNOWN, false);
checkBlocka();
}
{
const int group[] = { 0, 1, 3, 4, 6 };
setGroup(group);
- gmx_ana_index_make_block(&blocka_, NULL, &g_, INDEX_ATOM, false);
+ gmx_ana_index_make_block(&blocka_, nullptr, &g_, INDEX_ATOM, false);
checkBlocka();
done_blocka(&blocka_);
- gmx_ana_index_make_block(&blocka_, NULL, &g_, INDEX_ATOM, true);
+ gmx_ana_index_make_block(&blocka_, nullptr, &g_, INDEX_ATOM, true);
checkBlocka();
}
{
const int group[] = { 0, 1, 3, 4, 6 };
setGroup(group);
- gmx_ana_index_make_block(&blocka_, NULL, &g_, INDEX_ALL, false);
+ gmx_ana_index_make_block(&blocka_, nullptr, &g_, INDEX_ALL, false);
checkBlocka();
done_blocka(&blocka_);
- gmx_ana_index_make_block(&blocka_, NULL, &g_, INDEX_ALL, true);
+ gmx_ana_index_make_block(&blocka_, nullptr, &g_, INDEX_ALL, true);
checkBlocka();
}
{
const int group[] = { 0, 1, 2 };
setGroup(group);
- EXPECT_TRUE(gmx_ana_index_has_complete_elems(&g_, INDEX_ATOM, NULL));
- EXPECT_FALSE(gmx_ana_index_has_complete_elems(&g_, INDEX_ALL, NULL));
- EXPECT_FALSE(gmx_ana_index_has_complete_elems(&g_, INDEX_UNKNOWN, NULL));
+ EXPECT_TRUE(gmx_ana_index_has_complete_elems(&g_, INDEX_ATOM, nullptr));
+ EXPECT_FALSE(gmx_ana_index_has_complete_elems(&g_, INDEX_ALL, nullptr));
+ EXPECT_FALSE(gmx_ana_index_has_complete_elems(&g_, INDEX_UNKNOWN, nullptr));
}
TEST_F(IndexBlockTest, ChecksGroupForCompleteResiduesPositive)
g.isize = atomCount;
g.index = const_cast<int *>(atoms);
gmx_ana_indexmap_update(&map_, &g, bMaskOnly);
- if (name == NULL)
+ if (name == nullptr)
{
name = "Updated";
}
for (int i = 0; i < map_.mapb.nr; ++i)
{
gmx::test::TestReferenceChecker blockCompound(
- compound.checkCompound("Block", NULL));
+ compound.checkCompound("Block", nullptr));
blockCompound.checkSequence(&atoms[map_.mapb.index[i]],
&atoms[map_.mapb.index[i+1]],
"Atoms");
const int maxGroup[] = { 0, 1, 2, 3 };
const int evalGroup[] = { 0, 2 };
testInit(maxGroup, INDEX_ALL);
- testUpdate(evalGroup, false, NULL);
+ testUpdate(evalGroup, false, nullptr);
}
TEST_F(IndexMapTest, MapsResidueBlocks)
topManager_.initAtoms(18);
topManager_.initUniformResidues(3);
testInit(maxGroup, INDEX_RES);
- testUpdate(evalGroup, false, NULL);
+ testUpdate(evalGroup, false, nullptr);
}
TEST_F(IndexMapTest, MapsResidueBlocksWithMask)
topManager_.initAtoms(18);
topManager_.initUniformResidues(3);
testInit(maxGroup, INDEX_RES);
- testUpdate(evalGroup, true, NULL);
+ testUpdate(evalGroup, true, nullptr);
}
TEST_F(IndexMapTest, HandlesMultipleRequests)
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
for (int j = 0; j < refPosCount_; ++j)
{
rvec dx;
- if (pbc != NULL)
+ if (pbc != nullptr)
{
pbc_dx(pbc, i->x, refPos_[j], dx);
}
exclusionIds_.begin());
excls_.nr = 0;
- excls_.index = NULL;
+ excls_.index = nullptr;
excls_.nra = 0;
- excls_.a = NULL;
+ excls_.a = nullptr;
excls_.nalloc_index = 0;
excls_.nalloc_a = 0;
}
gmx::AnalysisNeighborhoodSearch *search,
const NeighborhoodSearchTestData &data)
{
- testPairSearchFull(search, data, data.testPositions(), NULL,
+ testPairSearchFull(search, data, data.testPositions(), nullptr,
gmx::EmptyArrayRef(), gmx::EmptyArrayRef());
}
gmx::AnalysisNeighborhoodSearch search =
nb->initSearch(&data.pbc_,
data.refPositions().indexed(refIndices));
- testPairSearchFull(&search, data, data.testPositions(), NULL,
+ testPairSearchFull(&search, data, data.testPositions(), nullptr,
refIndices, testIndices);
}
}
remainingTestPositions.erase(testIndex);
refPairs = data.testPositions_[testIndex].refPairs;
- if (excls != NULL)
+ if (excls != nullptr)
{
ExclusionsHelper::markExcludedPairs(&refPairs, testIndex, excls);
}
{
data_.generateRandomRefPositions(10);
data_.generateRandomTestPositions(5);
- data_.computeReferences(NULL);
+ data_.computeReferences(nullptr);
}
private:
data_.generateRandomRefPositions(1000);
data_.generateRandomTestPositions(100);
set_pbc(&data_.pbc_, epbcNONE, data_.box_);
- data_.computeReferences(NULL);
+ data_.computeReferences(nullptr);
}
private:
nb_.setCutoff(data.cutoff_);
gmx::AnalysisNeighborhoodSearch search =
- nb_.initSearch(NULL, data.refPositions());
+ nb_.initSearch(nullptr, data.refPositions());
ASSERT_EQ(gmx::AnalysisNeighborhood::eSearchMode_Simple, search.mode());
testIsWithin(&search, data);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
void PositionCalculationTest::checkInitialized()
{
gmx::test::TestReferenceChecker compound(
- checker_.checkCompound("InitializedPositions", NULL));
+ checker_.checkCompound("InitializedPositions", nullptr));
PositionTestList::const_iterator pi;
for (pi = posList_.begin(); pi != posList_.end(); ++pi)
{
gmx_ana_index_t g;
g.isize = atoms.size();
g.index = const_cast<int *>(atoms.data());
- gmx_ana_poscalc_update(pc, p, &g, topManager_.frame(), NULL);
+ gmx_ana_poscalc_update(pc, p, &g, topManager_.frame(), nullptr);
checkPositions(checker, name, p, true);
}
!= gmx::PositionCalculationCollection::RequiredTopologyInfo::None;
EXPECT_EQ(bExpectTop, requiresTopology);
setMaximumGroup(pc, atoms);
- gmx_ana_pos_t *p = initPositions(pc, NULL);
+ gmx_ana_pos_t *p = initPositions(pc, nullptr);
checkInitialized();
{
generateCoordinates();
pcc_.initFrame(frame);
gmx::test::TestReferenceChecker frameCompound(
checker_.checkCompound("EvaluatedPositions", "Frame0"));
- updateAndCheck(pc, p, atoms, &frameCompound, NULL);
+ updateAndCheck(pc, p, atoms, &frameCompound, nullptr);
}
}
!= gmx::PositionCalculationCollection::RequiredTopologyInfo::None;
EXPECT_EQ(bExpectTop, requiresTopology);
setMaximumGroup(pc, initAtoms);
- gmx_ana_pos_t *p = initPositions(pc, NULL);
+ gmx_ana_pos_t *p = initPositions(pc, nullptr);
checkInitialized();
{
generateCoordinates();
pcc_.initFrame(topManager_.frame());
gmx::test::TestReferenceChecker frameCompound(
checker_.checkCompound("EvaluatedPositions", "Frame0"));
- updateAndCheck(pc, p, evalAtoms, &frameCompound, NULL);
+ updateAndCheck(pc, p, evalAtoms, &frameCompound, nullptr);
}
}
for (int i = 0; i < p->count(); ++i)
{
gmx::test::TestReferenceChecker posCompound(
- compound.checkCompound("Position", NULL));
+ compound.checkCompound("Position", nullptr));
posCompound.checkSequence(&p->m.mapb.a[p->m.mapb.index[i]],
&p->m.mapb.a[p->m.mapb.index[i+1]],
"Atoms");
{
posCompound.checkVector(p->x[i], "Coordinates");
}
- if (bCoordinates && p->v != NULL)
+ if (bCoordinates && p->v != nullptr)
{
posCompound.checkVector(p->v[i], "Velocity");
}
- if (bCoordinates && p->f != NULL)
+ if (bCoordinates && p->f != nullptr)
{
posCompound.checkVector(p->f[i], "Force");
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
void setAtomCount(int natoms)
{
- ASSERT_NO_THROW_GMX(sc_.setTopology(NULL, natoms));
+ ASSERT_NO_THROW_GMX(sc_.setTopology(nullptr, natoms));
}
void loadTopology(const char *filename);
void setTopology();
#endif
SelectionCollectionTest::SelectionCollectionTest()
- : grps_(NULL)
+ : grps_(nullptr)
{
topManager_.requestFrame();
sc_.setDebugLevel(s_debugLevel);
SelectionCollectionTest::~SelectionCollectionTest()
{
- if (grps_ != NULL)
+ if (grps_ != nullptr)
{
gmx_ana_indexgrps_free(grps_);
}
void
SelectionCollectionTest::loadIndexGroups(const char *filename)
{
- GMX_RELEASE_ASSERT(grps_ == NULL,
+ GMX_RELEASE_ASSERT(grps_ == nullptr,
"External groups can only be loaded once");
std::string fullpath =
gmx::test::TestFileManager::getInputFilePath(filename);
- gmx_ana_indexgrps_init(&grps_, NULL, fullpath.c_str());
+ gmx_ana_indexgrps_init(&grps_, nullptr, fullpath.c_str());
sc_.setIndexGroups(grps_);
}
// TODO: Check something about the returned selections as well.
ASSERT_NO_THROW_GMX(sc_.parseInteractive(
count, &helper_.inputStream(),
- bInteractive ? &helper_.outputStream() : NULL,
+ bInteractive ? &helper_.outputStream() : nullptr,
"for test context"));
helper_.checkSession();
}
checker->checkSequenceCompound("Positions", sel.posCount()));
for (int i = 0; i < sel.posCount(); ++i)
{
- TestReferenceChecker poscompound(compound.checkCompound("Position", NULL));
+ TestReferenceChecker poscompound(compound.checkCompound("Position", nullptr));
const gmx::SelectionPosition &p = sel.position(i);
if (flags.test(efTestPositionAtoms))
{
using gmx::test::TestReferenceChecker;
++framenr_;
- ASSERT_NO_THROW_GMX(sc_.evaluate(topManager_.frame(), NULL));
+ ASSERT_NO_THROW_GMX(sc_.evaluate(topManager_.frame(), nullptr));
std::string frame = gmx::formatString("Frame%d", framenr_);
TestReferenceChecker compound(
checker_.checkCompound("EvaluatedSelections", frame.c_str()));
TEST_F(SelectionCollectionTest, HandlesUnknownGroupReferenceParser1)
{
- ASSERT_NO_THROW_GMX(sc_.setIndexGroups(NULL));
+ ASSERT_NO_THROW_GMX(sc_.setIndexGroups(nullptr));
EXPECT_THROW_GMX(sc_.parseFromString("group \"foo\""), gmx::InconsistentInputError);
EXPECT_THROW_GMX(sc_.parseFromString("4"), gmx::InconsistentInputError);
}
{
ASSERT_NO_THROW_GMX(sc_.parseFromString("group \"foo\""));
ASSERT_NO_FATAL_FAILURE(setAtomCount(10));
- EXPECT_THROW_GMX(sc_.setIndexGroups(NULL), gmx::InconsistentInputError);
+ EXPECT_THROW_GMX(sc_.setIndexGroups(nullptr), gmx::InconsistentInputError);
EXPECT_THROW_GMX(sc_.compile(), gmx::APIError);
}
TEST_F(SelectionCollectionTest, HandlesOutOfRangeAtomIndexInGroup)
{
- ASSERT_NO_THROW_GMX(sc_.setTopology(NULL, 5));
+ ASSERT_NO_THROW_GMX(sc_.setTopology(nullptr, 5));
ASSERT_NO_THROW_GMX(loadIndexGroups("simple.ndx"));
EXPECT_THROW_GMX(sc_.parseFromString("group \"GrpB\""), gmx::InconsistentInputError);
}
{
ASSERT_NO_THROW_GMX(loadIndexGroups("simple.ndx"));
ASSERT_NO_THROW_GMX(sc_.parseFromString("group \"GrpB\""));
- EXPECT_THROW_GMX(sc_.setTopology(NULL, 5), gmx::InconsistentInputError);
+ EXPECT_THROW_GMX(sc_.setTopology(nullptr, 5), gmx::InconsistentInputError);
}
TEST_F(SelectionCollectionTest, HandlesOutOfRangeAtomIndexInGroupDelayed2)
{
- ASSERT_NO_THROW_GMX(sc_.setTopology(NULL, 5));
+ ASSERT_NO_THROW_GMX(sc_.setTopology(nullptr, 5));
ASSERT_NO_THROW_GMX(sc_.parseFromString("group \"GrpB\""));
EXPECT_THROW_GMX(loadIndexGroups("simple.ndx"), gmx::InconsistentInputError);
}
ASSERT_NO_THROW_GMX(sc_.parseFromString("x < 1.5 permute 3 2 1"));
ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro"));
ASSERT_NO_THROW_GMX(sc_.compile());
- EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), NULL), gmx::InconsistentInputError);
+ EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), nullptr), gmx::InconsistentInputError);
}
TEST_F(SelectionCollectionTest, HandlesFramesWithTooSmallAtomSubsets)
ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro"));
ASSERT_NO_THROW_GMX(sc_.compile());
topManager_.frame()->natoms = 8;
- EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), NULL), gmx::InconsistentInputError);
+ EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), nullptr), gmx::InconsistentInputError);
}
TEST_F(SelectionCollectionTest, HandlesFramesWithTooSmallAtomSubsets2)
ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro"));
ASSERT_NO_THROW_GMX(sc_.compile());
topManager_.initFrameIndices(index);
- EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), NULL), gmx::InconsistentInputError);
+ EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), nullptr), gmx::InconsistentInputError);
}
TEST_F(SelectionCollectionTest, HandlesFramesWithTooSmallAtomSubsets3)
ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro"));
ASSERT_NO_THROW_GMX(sc_.compile());
topManager_.initFrameIndices(index);
- EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), NULL), gmx::InconsistentInputError);
+ EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), nullptr), gmx::InconsistentInputError);
}
TEST_F(SelectionCollectionTest, HandlesFramesWithTooSmallAtomSubsets4)
ASSERT_NO_FATAL_FAILURE(loadTopology("simple.gro"));
ASSERT_NO_THROW_GMX(sc_.compile());
topManager_.frame()->natoms = 10;
- EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), NULL), gmx::InconsistentInputError);
+ EXPECT_THROW_GMX(sc_.evaluate(topManager_.frame(), nullptr), gmx::InconsistentInputError);
}
// TODO: Tests for more evaluation errors
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
ASSERT_TRUE(sel.isValid());
- EXPECT_NO_THROW_GMX(sc_.setTopology(NULL, 10));
+ EXPECT_NO_THROW_GMX(sc_.setTopology(nullptr, 10));
EXPECT_NO_THROW_GMX(sc_.compile());
EXPECT_STREQ("all", sel.selectionText());
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
void TopologyManager::requestFrame()
{
- GMX_RELEASE_ASSERT(mtop_ == NULL,
+ GMX_RELEASE_ASSERT(mtop_ == nullptr,
"Frame must be requested before initializing topology");
- if (frame_ == NULL)
+ if (frame_ == nullptr)
{
snew(frame_, 1);
}
void TopologyManager::requestVelocities()
{
- GMX_RELEASE_ASSERT(frame_ != NULL,
+ GMX_RELEASE_ASSERT(frame_ != nullptr,
"Velocities requested before requesting a frame");
frame_->bV = TRUE;
if (frame_->natoms > 0)
void TopologyManager::requestForces()
{
- GMX_RELEASE_ASSERT(frame_ != NULL,
+ GMX_RELEASE_ASSERT(frame_ != nullptr,
"Forces requested before requesting a frame");
frame_->bF = TRUE;
if (frame_->natoms > 0)
{
bool fullTopology;
int ePBC;
- rvec *xtop = NULL;
+ rvec *xtop = nullptr;
matrix box;
GMX_RELEASE_ASSERT(mtop_ == nullptr, "Topology initialized more than once");
snew(mtop_, 1);
readConfAndTopology(
gmx::test::TestFileManager::getInputFilePath(filename).c_str(),
- &fullTopology, mtop_, &ePBC, frame_ != NULL ? &xtop : NULL,
- NULL, box);
+ &fullTopology, mtop_, &ePBC, frame_ != nullptr ? &xtop : nullptr,
+ nullptr, box);
- if (frame_ != NULL)
+ if (frame_ != nullptr)
{
frame_->natoms = mtop_->natoms;
frame_->bX = TRUE;
void TopologyManager::initAtoms(int count)
{
- GMX_RELEASE_ASSERT(mtop_ == NULL, "Topology initialized more than once");
+ GMX_RELEASE_ASSERT(mtop_ == nullptr, "Topology initialized more than once");
snew(mtop_, 1);
mtop_->nmoltype = 1;
snew(mtop_->moltype, 1);
atoms.atom[i].m = (i % 3 == 0 ? 2.0 : 1.0);
}
atoms.haveMass = TRUE;
- if (frame_ != NULL)
+ if (frame_ != nullptr)
{
frame_->natoms = count;
frame_->bX = TRUE;
void TopologyManager::initUniformResidues(int residueSize)
{
- GMX_RELEASE_ASSERT(mtop_ != NULL, "Topology not initialized");
+ GMX_RELEASE_ASSERT(mtop_ != nullptr, "Topology not initialized");
t_atoms &atoms = this->atoms();
int residueIndex = -1;
for (int i = 0; i < atoms.nr; ++i)
void TopologyManager::initUniformMolecules(int moleculeSize)
{
- GMX_RELEASE_ASSERT(mtop_ != NULL, "Topology not initialized");
+ GMX_RELEASE_ASSERT(mtop_ != nullptr, "Topology not initialized");
int index = 0;
mtop_->mols.nalloc_index = (mtop_->natoms + moleculeSize - 1) / moleculeSize + 1;
srenew(mtop_->mols.index, mtop_->mols.nalloc_index);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
outlier = (r > rmsd*level);
if (outlier)
{
- if (NULL != x)
+ if (nullptr != x)
{
*x = stats->x[stats->np_c];
}
- if (NULL != y)
+ if (nullptr != y)
{
*y = stats->y[stats->np_c];
}
- if (NULL != dx)
+ if (nullptr != dx)
{
*dx = stats->dx[stats->np_c];
}
- if (NULL != dy)
+ if (nullptr != dy)
{
*dy = stats->dy[stats->np_c];
}
{
int ok;
if ((ok = gmx_stats_add_point(gstats, x[i], y[i],
- (NULL != dx) ? dx[i] : 0,
- (NULL != dy) ? dy[i] : 0)) != estatsOK)
+ (nullptr != dx) ? dx[i] : 0,
+ (nullptr != dy) ? dy[i] : 0)) != estatsOK)
{
return ok;
}
{
return ok;
}
- if (NULL != a)
+ if (nullptr != a)
{
*a = stats->a;
}
- if (NULL != b)
+ if (nullptr != b)
{
*b = stats->b;
}
- if (NULL != da)
+ if (nullptr != da)
{
*da = stats->sigma_a;
}
- if (NULL != db)
+ if (nullptr != db)
{
*db = stats->sigma_b;
}
- if (NULL != chi2)
+ if (nullptr != chi2)
{
*chi2 = stats->chi2;
}
- if (NULL != Rfit)
+ if (nullptr != Rfit)
{
*Rfit = stats->Rfit;
}
{
return ok;
}
- if (NULL != a)
+ if (nullptr != a)
{
*a = stats->aa;
}
- if (NULL != da)
+ if (nullptr != da)
{
*da = stats->sigma_aa;
}
- if (NULL != chi2)
+ if (nullptr != chi2)
{
*chi2 = stats->chi2aa;
}
- if (NULL != Rfit)
+ if (nullptr != Rfit)
{
*Rfit = stats->Rfitaa;
}
return ok;
}
- if (NULL != aver)
+ if (nullptr != aver)
{
*aver = stats->aver;
}
- if (NULL != sigma)
+ if (nullptr != sigma)
{
*sigma = stats->sigma_aver;
}
- if (NULL != error)
+ if (nullptr != error)
{
*error = stats->error;
}
int ok;
real da, chi2, Rfit;
- gmx_stats_add_points(lsq, n, x, y, 0, 0);
+ gmx_stats_add_points(lsq, n, x, y, nullptr, nullptr);
ok = gmx_stats_get_a(lsq, elsqWEIGHT_NONE, a, &da, &chi2, &Rfit);
gmx_stats_free(lsq);
{
double pt;
- if (xd != NULL)
+ if (xd != nullptr)
{
pt = xd[i];
}
- else if (xr != NULL)
+ else if (xr != nullptr)
{
pt = xr[i];
}
return ok;
}
}
- ok = gmx_stats_get_ab(lsq, elsqWEIGHT_NONE, a, b, NULL, NULL, chi2, r);
+ ok = gmx_stats_get_ab(lsq, elsqWEIGHT_NONE, a, b, nullptr, nullptr, chi2, r);
gmx_stats_free(lsq);
return ok;
int lsq_y_ax_b(int n, real x[], real y[], real *a, real *b, real *r, real *chi2)
{
- return low_lsq_y_ax_b(n, x, NULL, y, a, b, r, chi2);
+ return low_lsq_y_ax_b(n, x, nullptr, y, a, b, r, chi2);
}
int lsq_y_ax_b_xdouble(int n, double x[], real y[], real *a, real *b,
real *r, real *chi2)
{
- return low_lsq_y_ax_b(n, NULL, x, y, a, b, r, chi2);
+ return low_lsq_y_ax_b(n, nullptr, x, y, a, b, r, chi2);
}
int lsq_y_ax_b_error(int n, real x[], real y[], real dy[],
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
static const char *SwS = {"SWAP:"}; /**< For output that comes from the swap module */
static const char *SwSEmpty = {" "}; /**< Placeholder for multi-line output */
static const char* CompStr[eCompNR] = {"A", "B" }; /**< Compartment name */
-static const char *SwapStr[eSwapTypesNR+1] = { "", "X-", "Y-", "Z-", NULL}; /**< Name for the swap types. */
-static const char *DimStr[DIM+1] = { "X", "Y", "Z", NULL}; /**< Name for the swap dimension. */
+static const char *SwapStr[eSwapTypesNR+1] = { "", "X-", "Y-", "Z-", nullptr}; /**< Name for the swap types. */
+static const char *DimStr[DIM+1] = { "X", "Y", "Z", nullptr}; /**< Name for the swap dimension. */
/** Keep track of through which channel the ions have passed */
enum eChannelHistory {
rvec_add(reference, dx, correctPBCimage);
/* Take weight into account */
- if (NULL == weights)
+ if (nullptr == weights)
{
wi = 1.0;
}
add_to_list(iAtom, &g->comp[comp], dist);
/* Master also checks for ion groups through which channel each ion has passed */
- if (MASTER(cr) && (g->comp_now != NULL) && !bIsSolvent)
+ if (MASTER(cr) && (g->comp_now != nullptr) && !bIsSolvent)
{
int globalAtomNr = g->ind[iAtom] + 1; /* PDB index starts at 1 ... */
detect_flux_per_channel(g, globalAtomNr, comp, g->xc[iAtom],
}
}
- if (bIsSolvent && NULL != fpout)
+ if (bIsSolvent && nullptr != fpout)
{
fprintf(fpout, "# Solv. molecules in comp.%s: %d comp.%s: %d\n",
CompStr[eCompA], g->comp[eCompA].nMol,
/*! \brief Ensure that each atom belongs to at most one of the swap groups. */
static void check_swap_groups(t_swap *s, int nat, gmx_bool bVerbose)
{
- int *nGroup = NULL; /* This array counts for each atom in the MD system to
- how many swap groups it belongs (should be 0 or 1!) */
+ int *nGroup = nullptr; /* This array counts for each atom in the MD system to
+ how many swap groups it belongs (should be 0 or 1!) */
int ind = -1;
- int nMultiple = 0; /* Number of atoms belonging to multiple groups */
+ int nMultiple = 0; /* Number of atoms belonging to multiple groups */
if (bVerbose)
/* Determine the number of solvent atoms per solvent molecule from the
* first solvent atom: */
int molb = 0;
- mtopGetMolblockIndex(mtop, ind[0], &molb, NULL, NULL);
+ mtopGetMolblockIndex(mtop, ind[0], &molb, nullptr, nullptr);
int apm = mtop->molblock[molb].natoms_mol;
if (bVerbose)
/* Check whether this is also true for all other solvent atoms */
for (int i = 1; i < nat; i++)
{
- mtopGetMolblockIndex(mtop, ind[i], &molb, NULL, NULL);
+ mtopGetMolblockIndex(mtop, ind[i], &molb, nullptr, nullptr);
if (apm != mtop->molblock[molb].natoms_mol)
{
gmx_fatal(FARGS, "Not all molecules of swap group %d consist of %d atoms.",
}
// Center of split groups
- snprintf(buf, STRLEN, "%scenter of %s of split group 0", SwapStr[ir->eSwapCoords], (NULL != s->group[eGrpSplit0].m) ? "mass" : "geometry");
+ snprintf(buf, STRLEN, "%scenter of %s of split group 0", SwapStr[ir->eSwapCoords], (nullptr != s->group[eGrpSplit0].m) ? "mass" : "geometry");
legend[count++] = gmx_strdup(buf);
- snprintf(buf, STRLEN, "%scenter of %s of split group 1", SwapStr[ir->eSwapCoords], (NULL != s->group[eGrpSplit1].m) ? "mass" : "geometry");
+ snprintf(buf, STRLEN, "%scenter of %s of split group 1", SwapStr[ir->eSwapCoords], (nullptr != s->group[eGrpSplit1].m) ? "mass" : "geometry");
legend[count++] = gmx_strdup(buf);
// Ion flux for each channel and ion type
/* All these flux detection routines run on the master only */
if (!MASTER(cr))
{
- g->comp_now = NULL;
- g->comp_from = NULL;
- g->channel_label = NULL;
+ g->comp_now = nullptr;
+ g->comp_from = nullptr;
+ g->channel_label = nullptr;
return;
}
{
char *env = getenv("GMX_COMPELDUMP");
- if (env != NULL)
+ if (env != nullptr)
{
fprintf(stderr, "\n%s Found env.var. GMX_COMPELDUMP, will output CompEL starting structure made whole.\n"
"%s In case of multimeric channels, please check whether they have the correct PBC representation.\n",
SwS, SwSEmpty);
- write_sto_conf_mtop("CompELAssumedWholeConfiguration.pdb", *mtop->name, mtop, x, NULL, ePBC, box);
+ write_sto_conf_mtop("CompELAssumedWholeConfiguration.pdb", *mtop->name, mtop, x, nullptr, ePBC, box);
}
}
matrix box,
int ePBC)
{
- rvec *x_pbc = NULL; /* positions of the whole MD system with molecules made whole */
+ rvec *x_pbc = nullptr; /* positions of the whole MD system with molecules made whole */
t_swapgrp *g;
t_swap *s;
copy_rvecn(x, x_pbc, 0, mtop->natoms);
/* This can only make individual molecules whole, not multimers */
- do_pbc_mtop(NULL, ePBC, box, mtop, x_pbc);
+ do_pbc_mtop(nullptr, ePBC, box, mtop, x_pbc);
/* Output the starting structure? */
outputStartStructureIfWanted(mtop, x_pbc, ePBC, box);
*/
int nAnions = 0;
int nCations = 0;
- int *indAnions = NULL;
- int *indCations = NULL;
+ int *indAnions = nullptr;
+ int *indCations = nullptr;
snew(indAnions, g->nat);
snew(indCations, g->nat);
}
}
- if (*swapstatePtr == NULL)
+ if (*swapstatePtr == nullptr)
{
snew(*swapstatePtr, 1);
}
}
else
{
- s->fpout = NULL;
+ s->fpout = nullptr;
}
/* Prepare for parallel or serial run */
g = &(s->group[ig]);
g->nat_loc = 0;
g->nalloc_loc = 0;
- g->ind_loc = NULL;
+ g->ind_loc = nullptr;
}
}
else
for (ig = eSwapFixedGrpNR; ig < s->ngrp; ig++)
{
g = &(s->group[ig]);
- communicate_group_positions(cr, g->xc, NULL, NULL, FALSE,
- x, g->nat, g->nat_loc, g->ind_loc, g->c_ind_loc, NULL, NULL);
+ communicate_group_positions(cr, g->xc, nullptr, nullptr, FALSE,
+ x, g->nat, g->nat_loc, g->ind_loc, g->c_ind_loc, nullptr, nullptr);
/* Determine how many ions of this type each compartment contains */
sortMoleculesIntoCompartments(g, cr, sc, box, step, s->fpout, bRerun, FALSE);
/* Since we here know that we have to perform ion/water position exchanges,
* we now assemble the solvent positions */
g = &(s->group[eGrpSolvent]);
- communicate_group_positions(cr, g->xc, NULL, NULL, FALSE,
- x, g->nat, g->nat_loc, g->ind_loc, g->c_ind_loc, NULL, NULL);
+ communicate_group_positions(cr, g->xc, nullptr, nullptr, FALSE,
+ x, g->nat, g->nat_loc, g->ind_loc, g->c_ind_loc, nullptr, nullptr);
/* Determine how many molecules of solvent each compartment contains */
sortMoleculesIntoCompartments(g, cr, sc, box, step, s->fpout, bRerun, TRUE);
}
}
- if (s->fpout != NULL)
+ if (s->fpout != nullptr)
{
print_ionlist(s, t, " # after swap");
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
vi = v_inrange - dc*(i - i_inrange)*dx;
}
- if (table_v != NULL)
+ if (table_v != nullptr)
{
table_v[i] = vi;
}
/* Currently the last value only contains half the force: double it */
table_f[0] *= 2;
- if (table_v != NULL && table_fdv0 != NULL)
+ if (table_v != nullptr && table_fdv0 != nullptr)
{
/* Copy to FDV0 table too. Allocation occurs in forcerec.c,
* init_ewald_f_table().
{
char *libfn;
char buf[STRLEN];
- double **yy = NULL, start, end, dx0, dx1, ssd, vm, vp, f, numf;
+ double **yy = nullptr, start, end, dx0, dx1, ssd, vm, vp, f, numf;
int k, i, nx, nx0 = 0, ny, nny, ns;
gmx_bool bAllZero, bZeroV, bZeroF;
double tabscale;
t_forcerec *fr, real rtab,
const char *tabfn)
{
- t_forcetable *dispersionCorrectionTable = NULL;
+ t_forcetable *dispersionCorrectionTable = nullptr;
- if (tabfn == NULL)
+ if (tabfn == nullptr)
{
if (debug)
{
* This file is part of the GROMACS molecular simulation package.
*
* Copyright (c) 1991-2006 David van der Spoel, Erik Lindahl, Berk Hess, University of Groningen.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
*
* We call gettimeofday an extra time at the start to avoid cache misses.
*/
- gettimeofday(&t1, NULL);
- gettimeofday(&t1, NULL);
+ gettimeofday(&t1, nullptr);
+ gettimeofday(&t1, nullptr);
c1 = gmx_cycles_read();
do
d = d/(1.0+static_cast<double>(i));
}
/* Read the time again */
- gettimeofday(&t2, NULL);
+ gettimeofday(&t2, nullptr);
c2 = gmx_cycles_read();
timediff = static_cast<double>(t2.tv_sec-t1.tv_sec)+(t2.tv_usec-t1.tv_usec)*1e-6;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
if (!wallcycle_have_counter())
{
- return NULL;
+ return nullptr;
}
snew(wc, 1);
wc->haveInvalidCount = FALSE;
wc->wc_barrier = FALSE;
- wc->wcc_all = NULL;
+ wc->wcc_all = nullptr;
wc->wc_depth = 0;
wc->ewc_prev = -1;
wc->reset_counters = resetstep;
#if GMX_MPI
- if (PAR(cr) && getenv("GMX_CYCLE_BARRIER") != NULL)
+ if (PAR(cr) && getenv("GMX_CYCLE_BARRIER") != nullptr)
{
if (fplog)
{
#endif
snew(wc->wcc, ewcNR);
- if (getenv("GMX_CYCLE_ALL") != NULL)
+ if (getenv("GMX_CYCLE_ALL") != nullptr)
{
if (fplog)
{
void wallcycle_destroy(gmx_wallcycle_t wc)
{
- if (wc == NULL)
+ if (wc == nullptr)
{
return;
}
- if (wc->wcc != NULL)
+ if (wc->wcc != nullptr)
{
sfree(wc->wcc);
}
- if (wc->wcc_all != NULL)
+ if (wc->wcc_all != nullptr)
{
sfree(wc->wcc_all);
}
- if (wc->wcsc != NULL)
+ if (wc->wcsc != nullptr)
{
sfree(wc->wcsc);
}
{
gmx_cycles_t cycle;
- if (wc == NULL)
+ if (wc == nullptr)
{
return;
}
cycle = gmx_cycles_read();
wc->wcc[ewc].start = cycle;
- if (wc->wcc_all != NULL)
+ if (wc->wcc_all != nullptr)
{
wc->wc_depth++;
if (ewc == ewcRUN)
void wallcycle_start_nocount(gmx_wallcycle_t wc, int ewc)
{
- if (wc == NULL)
+ if (wc == nullptr)
{
return;
}
{
gmx_cycles_t cycle, last;
- if (wc == NULL)
+ if (wc == nullptr)
{
return 0;
}
{
int i;
- if (wc == NULL)
+ if (wc == nullptr)
{
return;
}
void wallcycle_scale_by_num_threads(gmx_wallcycle_t wc, bool isPmeRank, int nthreads_pp, int nthreads_pme)
{
- if (wc == NULL)
+ if (wc == nullptr)
{
return;
}
int i;
int nsum;
- if (wc == NULL)
+ if (wc == nullptr)
{
/* Default construction of std::array of non-class T can leave
the values indeterminate, just like a C array, and icc
MPI_Allreduce(cycles, cycles_sum.data(), nsum, MPI_DOUBLE, MPI_SUM,
cr->mpi_comm_mysim);
- if (wc->wcc_all != NULL)
+ if (wc->wcc_all != nullptr)
{
double *buf_all, *cyc_all;
char buf[STRLEN];
const char *hline = "-----------------------------------------------------------------------------";
- if (wc == NULL)
+ if (wc == nullptr)
{
return;
}
tot_for_pp += cyc_sum[i];
}
}
- if (wc->wcc_all != NULL)
+ if (wc->wcc_all != nullptr)
{
for (i = 0; i < ewcNR; i++)
{
extern gmx_int64_t wcycle_get_reset_counters(gmx_wallcycle_t wc)
{
- if (wc == NULL)
+ if (wc == nullptr)
{
return -1;
}
extern void wcycle_set_reset_counters(gmx_wallcycle_t wc, gmx_int64_t reset_counters)
{
- if (wc == NULL)
+ if (wc == nullptr)
{
return;
}
void wallcycle_sub_start(gmx_wallcycle_t wc, int ewcs)
{
- if (useCycleSubcounters && wc != NULL)
+ if (useCycleSubcounters && wc != nullptr)
{
wc->wcsc[ewcs].start = gmx_cycles_read();
}
void wallcycle_sub_start_nocount(gmx_wallcycle_t wc, int ewcs)
{
- if (useCycleSubcounters && wc != NULL)
+ if (useCycleSubcounters && wc != nullptr)
{
wallcycle_sub_start(wc, ewcs);
wc->wcsc[ewcs].n--;
void wallcycle_sub_stop(gmx_wallcycle_t wc, int ewcs)
{
- if (useCycleSubcounters && wc != NULL)
+ if (useCycleSubcounters && wc != nullptr)
{
wc->wcsc[ewcs].c += gmx_cycles_read() - wc->wcsc[ewcs].start;
wc->wcsc[ewcs].n++;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
* but it might be useful to keep t_topology comparison as an option.
*/
top[0] = gmx_mtop_t_to_t_topology(&mtop[0], true);
- cmp_top(stdout, &top[0], NULL, ftol, abstol);
+ cmp_top(stdout, &top[0], nullptr, ftol, abstol);
}
}
}
gmx_bool bShowTimestep = TRUE, newline = FALSE;
t_trxstatus *status;
gmx_mtop_t mtop;
- gmx_localtop_t *top = NULL;
+ gmx_localtop_t *top = nullptr;
t_state state;
t_inputrec *ir;
{
int nre, fnr;
ener_file_t in;
- gmx_enxnm_t *enm = NULL;
+ gmx_enxnm_t *enm = nullptr;
t_enxframe *fr;
gmx_bool bShowTStep;
gmx_bool timeSet;
"consisting of a rough outline for a methods section for a paper."
};
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffOPTRD },
- { efTRX, "-f2", NULL, ffOPTRD },
+ { efTRX, "-f", nullptr, ffOPTRD },
+ { efTRX, "-f2", nullptr, ffOPTRD },
{ efTPR, "-s1", "top1", ffOPTRD },
{ efTPR, "-s2", "top2", ffOPTRD },
- { efTPS, "-c", NULL, ffOPTRD },
- { efEDR, "-e", NULL, ffOPTRD },
+ { efTPS, "-c", nullptr, ffOPTRD },
+ { efEDR, "-e", nullptr, ffOPTRD },
{ efEDR, "-e2", "ener2", ffOPTRD },
- { efNDX, "-n", NULL, ffOPTRD },
- { efTEX, "-m", NULL, ffOPTWR }
+ { efNDX, "-n", nullptr, ffOPTRD },
+ { efTEX, "-m", nullptr, ffOPTWR }
};
#define NFILE asize(fnm)
- const char *fn1 = NULL, *fn2 = NULL, *tex = NULL;
+ const char *fn1 = nullptr, *fn2 = nullptr, *tex = nullptr;
gmx_output_env_t *oenv;
static real vdw_fac = 0.8;
static real ftol = 0.001;
static real abstol = 0.001;
static gmx_bool bCompAB = FALSE;
- static char *lastener = NULL;
+ static char *lastener = nullptr;
static t_pargs pa[] = {
{ "-vdwfac", FALSE, etREAL, {&vdw_fac},
"Fraction of sum of VdW radii used as warning cutoff" },
};
if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa,
- asize(desc), desc, 0, NULL, &oenv))
+ asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
{
if (bCompAB)
{
- if (fn1 == NULL)
+ if (fn1 == nullptr)
{
gmx_fatal(FARGS, "With -ab you need to set the -s1 option");
}
- fn2 = NULL;
+ fn2 = nullptr;
}
comp_tpx(fn1, fn2, bRMSD, ftol, abstol);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
t_state state;
int gnx;
char *grpname;
- int *index = NULL;
+ int *index = nullptr;
char buf[200], buf2[200];
gmx_output_env_t *oenv;
t_filenm fnm[] = {
- { efTPR, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD },
{ efTPR, "-o", "tprout", ffWRITE }
};
#define NFILE asize(fnm)
/* Parse the command line */
if (!parse_common_args(&argc, argv, 0, NFILE, fnm, asize(pa), pa,
- asize(desc), desc, 0, NULL, &oenv))
+ asize(desc), desc, 0, nullptr, &oenv))
{
return 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
read_tpx_state(fn,
ir,
&state,
- tpx.bTop ? &mtop : NULL);
+ tpx.bTop ? &mtop : nullptr);
if (mdpfn && tpx.bIr)
{
gp = gmx_fio_fopen(mdpfn, "w");
- pr_inputrec(gp, 0, NULL, ir, TRUE);
+ pr_inputrec(gp, 0, nullptr, ir, TRUE);
gmx_fio_fclose(gp);
}
pr_top(stdout, indent, "topology", &(top), bShowNumbers, bShowParameters);
}
- pr_rvecs(stdout, indent, "box", tpx.bBox ? state.box : NULL, DIM);
- pr_rvecs(stdout, indent, "box_rel", tpx.bBox ? state.box_rel : NULL, DIM);
- pr_rvecs(stdout, indent, "boxv", tpx.bBox ? state.boxv : NULL, DIM);
- pr_rvecs(stdout, indent, "pres_prev", tpx.bBox ? state.pres_prev : NULL, DIM);
- pr_rvecs(stdout, indent, "svir_prev", tpx.bBox ? state.svir_prev : NULL, DIM);
- pr_rvecs(stdout, indent, "fvir_prev", tpx.bBox ? state.fvir_prev : NULL, DIM);
+ pr_rvecs(stdout, indent, "box", tpx.bBox ? state.box : nullptr, DIM);
+ pr_rvecs(stdout, indent, "box_rel", tpx.bBox ? state.box_rel : nullptr, DIM);
+ pr_rvecs(stdout, indent, "boxv", tpx.bBox ? state.boxv : nullptr, DIM);
+ pr_rvecs(stdout, indent, "pres_prev", tpx.bBox ? state.pres_prev : nullptr, DIM);
+ pr_rvecs(stdout, indent, "svir_prev", tpx.bBox ? state.svir_prev : nullptr, DIM);
+ pr_rvecs(stdout, indent, "fvir_prev", tpx.bBox ? state.fvir_prev : nullptr, DIM);
/* leave nosehoover_xi in for now to match the tpr version */
pr_doubles(stdout, indent, "nosehoover_xi", state.nosehoover_xi.data(), state.ngtc);
/*pr_doubles(stdout,indent,"nosehoover_vxi",state.nosehoover_vxi,state.ngtc);*/
/*pr_doubles(stdout,indent,"therm_integral",state.therm_integral,state.ngtc);*/
- pr_rvecs(stdout, indent, "x", tpx.bX ? as_rvec_array(state.x.data()) : NULL, state.natoms);
- pr_rvecs(stdout, indent, "v", tpx.bV ? as_rvec_array(state.v.data()) : NULL, state.natoms);
+ pr_rvecs(stdout, indent, "x", tpx.bX ? as_rvec_array(state.x.data()) : nullptr, state.natoms);
+ pr_rvecs(stdout, indent, "v", tpx.bV ? as_rvec_array(state.v.data()) : nullptr, state.natoms);
}
groups = &mtop.groups;
#define BUFLEN 256
char buf[BUFLEN];
gmx_cpp_t handle;
- char *cppopts[] = { NULL };
+ char *cppopts[] = { nullptr };
status = cpp_open_file(fn, &handle, cppopts);
if (status != 0)
snew(v, trrheader.natoms);
snew(f, trrheader.natoms);
if (gmx_trr_read_frame_data(fpread, &trrheader,
- trrheader.box_size ? box : NULL,
- trrheader.x_size ? x : NULL,
- trrheader.v_size ? v : NULL,
- trrheader.f_size ? f : NULL))
+ trrheader.box_size ? box : nullptr,
+ trrheader.x_size ? x : nullptr,
+ trrheader.v_size ? v : nullptr,
+ trrheader.f_size ? f : nullptr))
{
sprintf(buf, "%s frame %d", fn, nframe);
indent = 0;
#ifdef GMX_USE_TNG
tng_trajectory_t tng;
gmx_int64_t nframe = 0;
- gmx_int64_t i, *block_ids = NULL, step, ndatablocks;
+ gmx_int64_t i, *block_ids = nullptr, step, ndatablocks;
gmx_bool bOK;
- real *values = NULL;
+ real *values = nullptr;
gmx_tng_open(fn, 'r', &tng);
gmx_print_tng_molecule_system(tng, stdout);
bOK = gmx_get_tng_data_block_types_of_next_frame(tng, -1,
0,
- NULL,
+ nullptr,
&step, &ndatablocks,
&block_ids);
do
}
while (gmx_get_tng_data_block_types_of_next_frame(tng, step,
0,
- NULL,
+ nullptr,
&step,
&ndatablocks,
&block_ids));
{
ener_file_t in;
gmx_bool bCont;
- gmx_enxnm_t *enm = NULL;
+ gmx_enxnm_t *enm = nullptr;
t_enxframe *fr;
int i, j, nre, b;
char buf[22];
static void list_mtx(const char *fn)
{
int nrow, ncol, i, j, k;
- real *full = NULL, value;
- gmx_sparsematrix_t * sparse = NULL;
+ real *full = nullptr, value;
+ gmx_sparsematrix_t * sparse = nullptr;
gmx_mtxio_read(fn, &nrow, &ncol, &full, &sparse);
- if (full == NULL)
+ if (full == nullptr)
{
snew(full, nrow*ncol);
for (i = 0; i < nrow*ncol; i++)
"Position restraint output from -sys -s is broken"
};
t_filenm fnm[] = {
- { efTPR, "-s", NULL, ffOPTRD },
- { efTRX, "-f", NULL, ffOPTRD },
- { efEDR, "-e", NULL, ffOPTRD },
- { efCPT, NULL, NULL, ffOPTRD },
- { efTOP, "-p", NULL, ffOPTRD },
+ { efTPR, "-s", nullptr, ffOPTRD },
+ { efTRX, "-f", nullptr, ffOPTRD },
+ { efEDR, "-e", nullptr, ffOPTRD },
+ { efCPT, nullptr, nullptr, ffOPTRD },
+ { efTOP, "-p", nullptr, ffOPTRD },
{ efMTX, "-mtx", "hessian", ffOPTRD },
- { efMDP, "-om", NULL, ffOPTWR }
+ { efMDP, "-om", nullptr, ffOPTWR }
};
#define NFILE asize(fnm)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
srenew(ap->bAvail, ap->maxprop);
for (i = ap->nprop; (i < ap->maxprop); i++)
{
- ap->atomnm[i] = NULL;
- ap->resnm[i] = NULL;
+ ap->atomnm[i] = nullptr;
+ ap->resnm[i] = nullptr;
ap->value[i] = 0;
ap->bAvail[i] = FALSE;
}
gmx_atomprop *ap = (gmx_atomprop*) aps;
int p;
- if (aps == NULL)
+ if (aps == nullptr)
{
printf("\nWARNING: gmx_atomprop_destroy called with a NULL pointer\n\n");
return;
static void vdw_warning(FILE *fp)
{
- if (NULL != fp)
+ if (nullptr != fp)
{
fprintf(fp, "NOTE: From version 5.0 %s uses the Van der Waals radii\n",
gmx::getProgramContext().displayName());
return ap->prop[epropElement].atomnm[i];
}
}
- return NULL;
+ return nullptr;
}
int gmx_atomprop_atomnumber(gmx_atomprop_t aps, const char *elem)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
#include "gromacs/utility/txtdump.h"
const char *ptype_str[eptNR+1] = {
- "Atom", "Nucleus", "Shell", "Bond", "VSite", NULL
+ "Atom", "Nucleus", "Shell", "Bond", "VSite", nullptr
};
void init_atom(t_atoms *at)
{
at->nr = 0;
at->nres = 0;
- at->atom = NULL;
- at->resinfo = NULL;
- at->atomname = NULL;
- at->atomtype = NULL;
- at->atomtypeB = NULL;
- at->pdbinfo = NULL;
+ at->atom = nullptr;
+ at->resinfo = nullptr;
+ at->atomname = nullptr;
+ at->atomtype = nullptr;
+ at->atomtypeB = nullptr;
+ at->pdbinfo = nullptr;
at->haveMass = FALSE;
at->haveCharge = FALSE;
at->haveType = FALSE;
void init_atomtypes(t_atomtypes *at)
{
at->nr = 0;
- at->radius = NULL;
- at->vol = NULL;
- at->atomnumber = NULL;
- at->gb_radius = NULL;
- at->S_hct = NULL;
+ at->radius = nullptr;
+ at->vol = nullptr;
+ at->atomnumber = nullptr;
+ at->gb_radius = nullptr;
+ at->S_hct = nullptr;
}
void done_atom(t_atoms *at)
{
srenew(atoms->atomname, atoms->nr+natom_extra);
srenew(atoms->atom, atoms->nr+natom_extra);
- if (NULL != atoms->pdbinfo)
+ if (nullptr != atoms->pdbinfo)
{
srenew(atoms->pdbinfo, atoms->nr+natom_extra);
}
- if (NULL != atoms->atomtype)
+ if (nullptr != atoms->atomtype)
{
srenew(atoms->atomtype, atoms->nr+natom_extra);
}
- if (NULL != atoms->atomtypeB)
+ if (nullptr != atoms->atomtypeB)
{
srenew(atoms->atomtypeB, atoms->nr+natom_extra);
}
for (i = atoms->nr; (i < atoms->nr+natom_extra); i++)
{
- atoms->atomname[i] = NULL;
+ atoms->atomname[i] = nullptr;
memset(&atoms->atom[i], 0, sizeof(atoms->atom[i]));
- if (NULL != atoms->pdbinfo)
+ if (nullptr != atoms->pdbinfo)
{
std::memset(&atoms->pdbinfo[i], 0, sizeof(atoms->pdbinfo[i]));
}
- if (NULL != atoms->atomtype)
+ if (nullptr != atoms->atomtype)
{
- atoms->atomtype[i] = NULL;
+ atoms->atomtype[i] = nullptr;
}
- if (NULL != atoms->atomtypeB)
+ if (nullptr != atoms->atomtypeB)
{
- atoms->atomtypeB[i] = NULL;
+ atoms->atomtypeB[i] = nullptr;
}
}
atoms->nr += natom_extra;
atoms->nr = natoms;
atoms->nres = 0;
snew(atoms->atomname, natoms);
- atoms->atomtype = NULL;
- atoms->atomtypeB = NULL;
+ atoms->atomtype = nullptr;
+ atoms->atomtypeB = nullptr;
snew(atoms->resinfo, natoms);
snew(atoms->atom, natoms);
atoms->haveMass = FALSE;
}
else
{
- atoms->pdbinfo = NULL;
+ atoms->pdbinfo = nullptr;
}
}
int i;
snew(dst, 1);
- init_t_atoms(dst, src->nr, (NULL != src->pdbinfo));
+ init_t_atoms(dst, src->nr, (nullptr != src->pdbinfo));
dst->nr = src->nr;
- if (NULL != src->atomname)
+ if (nullptr != src->atomname)
{
snew(dst->atomname, src->nr);
}
- if (NULL != src->atomtype)
+ if (nullptr != src->atomtype)
{
snew(dst->atomtype, src->nr);
}
- if (NULL != src->atomtypeB)
+ if (nullptr != src->atomtypeB)
{
snew(dst->atomtypeB, src->nr);
}
for (i = 0; (i < src->nr); i++)
{
dst->atom[i] = src->atom[i];
- if (NULL != src->pdbinfo)
+ if (nullptr != src->pdbinfo)
{
dst->pdbinfo[i] = src->pdbinfo[i];
}
- if (NULL != src->atomname)
+ if (nullptr != src->atomname)
{
dst->atomname[i] = src->atomname[i];
}
- if (NULL != src->atomtype)
+ if (nullptr != src->atomtype)
{
dst->atomtype[i] = src->atomtype[i];
}
- if (NULL != src->atomtypeB)
+ if (nullptr != src->atomtypeB)
{
dst->atomtypeB[i] = src->atomtypeB[i];
}
ri = &atoms->resinfo[atoms->atom[atom_ind].resind];
ri->name = put_symtab(symtab, resname);
- ri->rtp = NULL;
+ ri->rtp = nullptr;
ri->nr = resnr;
ri->ic = ic;
ri->chainnum = chainnum;
{
for (i = 0; (i < a1->nr); i++)
{
- cmp_atom(fp, i, &(a1->atom[i]), NULL, ftol, abstol);
+ cmp_atom(fp, i, &(a1->atom[i]), nullptr, ftol, abstol);
}
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
char **AtomsBuilder::symtabString(char **source)
{
- if (symtab_ != NULL)
+ if (symtab_ != nullptr)
{
return put_symtab(symtab_, *source);
}
void AtomsRemover::removeMarkedAtoms(t_atoms *atoms) const
{
const int originalAtomCount = atoms->nr;
- AtomsBuilder builder(atoms, NULL);
+ AtomsBuilder builder(atoms, nullptr);
if (atoms->nr > 0)
{
builder.setNextResidueNumber(atoms->resinfo[0].nr);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
snew(block->index, block->nalloc_index);
block->index[0] = 0;
block->nalloc_a = 0;
- block->a = NULL;
+ block->a = nullptr;
}
t_blocka *new_blocka(void)
block->nra = 0;
sfree(block->index);
sfree(block->a);
- block->index = NULL;
- block->a = NULL;
+ block->index = nullptr;
+ block->a = nullptr;
block->nalloc_index = 0;
block->nalloc_a = 0;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
static void analyse_other(const char ** restype, const t_atoms *atoms,
t_blocka *gb, char ***gn, gmx_bool bASK, gmx_bool bVerb)
{
- restp_t *restp = NULL;
- char **attp = NULL;
+ restp_t *restp = nullptr;
+ char **attp = nullptr;
char *rname, *aname;
int *aid, *aaid;
int i, j, k, l, resind, naid, naaid, natp, nrestp = 0;
}
}
sfree(attp);
- attp = NULL;
+ attp = nullptr;
}
}
sfree(aid);
};
static const t_gmx_help_make_index_group constructing_data[] =
- {{ NULL, 0, "Protein", TRUE, -1, -1},
+ {{ nullptr, 0, "Protein", TRUE, -1, -1},
{ pnoh, asize(pnoh), "Protein-H", TRUE, 0, -1},
{ calpha, asize(calpha), "C-alpha", FALSE, -1, -1},
{ bb, asize(bb), "Backbone", FALSE, -1, -1},
void analyse(const t_atoms *atoms, t_blocka *gb, char ***gn, gmx_bool bASK, gmx_bool bVerb)
{
- gmx_residuetype_t*rt = NULL;
+ gmx_residuetype_t*rt = nullptr;
char *resnm;
int *aid;
const char ** restype;
snew(restype, atoms->nres);
ntypes = 0;
- p_typename = NULL;
+ p_typename = nullptr;
if (atoms->nres > 0)
{
int i = 0;
in = gmx_ffopen(gfile, "r");
snew(b, 1);
b->nr = 0;
- b->index = NULL;
+ b->index = nullptr;
b->nra = 0;
- b->a = NULL;
- *grpname = NULL;
+ b->a = nullptr;
+ *grpname = nullptr;
maxentries = 0;
while (get_a_line(in, line, STRLEN))
{
srenew(b->a, maxentries);
}
assert(b->a != NULL); // for clang analyzer
- b->a[i] = strtol(str, NULL, 10)-1;
+ b->a[i] = strtol(str, nullptr, 10)-1;
b->index[b->nr]++;
(b->nra)++;
pt = strstr(pt, str)+strlen(str);
strcpy(string, grpname[i]);
upstring(string);
minstring(string);
- if (strstr(string, key) != NULL)
+ if (strstr(string, key) != nullptr)
{
if (aa != -1)
{
int isize[], int *index[], char *grpnames[])
{
char ***gnames;
- t_blocka *grps = NULL;
+ t_blocka *grps = nullptr;
int *grpnr;
snew(grpnr, ngrps);
snew(gnames, 1);
- if (fnm != NULL)
+ if (fnm != nullptr)
{
grps = init_index(fnm, gnames);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
int atomIndexInMolecule;
mtopGetMolblockIndex(mtop, globalAtomIndex, moleculeBlock,
- NULL, &atomIndexInMolecule);
+ nullptr, &atomIndexInMolecule);
const gmx_moltype_t &moltype = mtop->moltype[mtop->molblock[*moleculeBlock].type];
return moltype.atoms.atom[atomIndexInMolecule];
}
{
int atomIndexInMolecule;
mtopGetMolblockIndex(mtop, globalAtomIndex, moleculeBlock,
- NULL, &atomIndexInMolecule);
+ nullptr, &atomIndexInMolecule);
const gmx_moltype_t &moltype = mtop->moltype[mtop->molblock[*moleculeBlock].type];
const int resind = moltype.atoms.atom[atomIndexInMolecule].resind;
return moltype.atoms.resinfo[resind];
{
int atomIndexInMolecule;
mtopGetMolblockIndex(mtop, globalAtomIndex, moleculeBlock,
- NULL, &atomIndexInMolecule);
+ nullptr, &atomIndexInMolecule);
const gmx_moltype_t &moltype = mtop->moltype[mtop->molblock[*moleculeBlock].type];
GMX_ASSERT(moltype.atoms.havePdbInfo, "PDB information not present when requested");
return moltype.atoms.pdbinfo[atomIndexInMolecule];
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2008,2009,2010,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2008,2009,2010,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.
}
env = getenv("GMX_MAXRESRENUM");
- if (env != NULL)
+ if (env != nullptr)
{
sscanf(env, "%d", &mtop->maxres_renum);
}
gmx_bool gmx_mtop_atomloop_all_next(gmx_mtop_atomloop_all_t aloop,
int *at_global, const t_atom **atom)
{
- if (aloop == NULL)
+ if (aloop == nullptr)
{
gmx_incons("gmx_mtop_atomloop_all_next called without calling gmx_mtop_atomloop_all_init");
}
gmx_bool gmx_mtop_atomloop_block_next(gmx_mtop_atomloop_block_t aloop,
const t_atom **atom, int *nmol)
{
- if (aloop == NULL)
+ if (aloop == nullptr)
{
gmx_incons("gmx_mtop_atomloop_all_next called without calling gmx_mtop_atomloop_all_init");
}
gmx_bool gmx_mtop_ilistloop_next(gmx_mtop_ilistloop_t iloop,
t_ilist **ilist_mol, int *nmol)
{
- if (iloop == NULL)
+ if (iloop == nullptr)
{
gmx_incons("gmx_mtop_ilistloop_next called without calling gmx_mtop_ilistloop_init");
}
t_ilist **ilist_mol, int *atnr_offset)
{
- if (iloop == NULL)
+ if (iloop == nullptr)
{
gmx_incons("gmx_mtop_ilistloop_all_next called without calling gmx_mtop_ilistloop_all_init");
}
idef->atnr = ffp->atnr;
idef->functype = ffp->functype;
idef->iparams = ffp->iparams;
- idef->iparams_posres = NULL;
+ idef->iparams_posres = nullptr;
idef->iparams_posres_nalloc = 0;
- idef->iparams_fbposres = NULL;
+ idef->iparams_fbposres = nullptr;
idef->iparams_fbposres_nalloc = 0;
idef->fudgeQQ = ffp->fudgeQQ;
idef->cmap_grid = ffp->cmap_grid;
{
idef->il[ftype].nr = 0;
idef->il[ftype].nalloc = 0;
- idef->il[ftype].iatoms = NULL;
+ idef->il[ftype].iatoms = nullptr;
}
natoms = 0;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2010,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.
*prt = rt;
rt->n = 0;
- rt->resname = NULL;
- rt->restype = NULL;
+ rt->resname = nullptr;
+ rt->restype = nullptr;
db = libopen("residuetypes.dat");
int * ntypes)
{
int n = 0;
- const char **my_typename = NULL;
+ const char **my_typename = nullptr;
if (rt->n > 0)
{
}
else
{
- return NULL;
+ return nullptr;
}
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
base = 0;
symbuf = symtab->symbuf;
- while (symbuf != NULL)
+ while (symbuf != nullptr)
{
const int index = name-symbuf->buf;
if ( ( index >= 0 ) && ( index < symbuf->bufsize ) )
t_symbuf *symbuf;
symbuf = symtab->symbuf;
- while (symbuf != NULL)
+ while (symbuf != nullptr)
{
if (name < symbuf->bufsize)
{
}
}
gmx_fatal(FARGS, "symtab get_symtab_handle %d not found", name);
- return NULL;
+ return nullptr;
}
static t_symbuf *new_symbuf(void)
snew(symbuf, 1);
symbuf->bufsize = TABLESIZE;
snew(symbuf->buf, symbuf->bufsize);
- symbuf->next = NULL;
+ symbuf->next = nullptr;
return symbuf;
}
t_symbuf *symbuf;
gmx_bool bCont;
- if (symtab->symbuf == NULL)
+ if (symtab->symbuf == nullptr)
{
symtab->symbuf = new_symbuf();
}
{
for (i = 0; (i < symbuf->bufsize); i++)
{
- if (symbuf->buf[i] == NULL)
+ if (symbuf->buf[i] == nullptr)
{
symtab->nr++;
symbuf->buf[i] = gmx_strdup(name);
return &(symbuf->buf[i]);
}
}
- if (symbuf->next != NULL)
+ if (symbuf->next != nullptr)
{
symbuf = symbuf->next;
bCont = TRUE;
void open_symtab(t_symtab *symtab)
{
symtab->nr = 0;
- symtab->symbuf = NULL;
+ symtab->symbuf = nullptr;
}
void close_symtab(t_symtab gmx_unused *symtab)
close_symtab(symtab);
symbuf = symtab->symbuf;
- while (symbuf != NULL)
+ while (symbuf != nullptr)
{
for (i = 0; (i < symbuf->bufsize) && (i < symtab->nr); i++)
{
symbuf = symbuf->next;
sfree(freeptr);
}
- symtab->symbuf = NULL;
+ symtab->symbuf = nullptr;
if (symtab->nr != 0)
{
gmx_incons("Freeing symbol table (symtab) structure");
close_symtab(symtab);
symbuf = symtab->symbuf;
- while (symbuf != NULL)
+ while (symbuf != nullptr)
{
symtab->nr -= std::min(symbuf->bufsize, symtab->nr);
freeptr = symbuf;
symbuf = symbuf->next;
sfree(freeptr);
}
- symtab->symbuf = NULL;
+ symtab->symbuf = nullptr;
if (symtab->nr != 0)
{
gmx_incons("Freeing symbol table (symtab) structure");
i = 0;
nr = symtab->nr;
symbuf = symtab->symbuf;
- while (symbuf != NULL)
+ while (symbuf != nullptr)
{
for (j = 0; (j < symbuf->bufsize) && (j < nr); j++)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
const char *gtypes[egcNR+1] = {
"T-Coupling", "Energy Mon.", "Acceleration", "Freeze",
- "User1", "User2", "VCM", "Compressed X", "Or. Res. Fit", "QMMM", NULL
+ "User1", "User2", "VCM", "Compressed X", "Or. Res. Fit", "QMMM", nullptr
};
static void init_groups(gmx_groups_t *groups)
{
groups->ngrpname = 0;
- groups->grpname = NULL;
+ groups->grpname = nullptr;
for (int g = 0; g < egcNR; g++)
{
- groups->grps[g].nm_ind = NULL;
+ groups->grps[g].nm_ind = nullptr;
groups->ngrpnr[g] = 0;
- groups->grpnr[g] = NULL;
+ groups->grpnr[g] = nullptr;
}
}
void init_mtop(gmx_mtop_t *mtop)
{
- mtop->name = NULL;
+ mtop->name = nullptr;
mtop->nmoltype = 0;
- mtop->moltype = NULL;
+ mtop->moltype = nullptr;
mtop->nmolblock = 0;
- mtop->molblock = NULL;
+ mtop->molblock = nullptr;
mtop->maxres_renum = 0;
mtop->maxresnr = -1;
init_groups(&mtop->groups);
void init_top(t_topology *top)
{
- top->name = NULL;
+ top->name = nullptr;
init_atom(&(top->atoms));
init_atomtypes(&(top->atomtypes));
init_block(&top->cgs);
for (i = 0; (i < egcNR); i++)
{
- if (NULL != g->grps[i].nm_ind)
+ if (nullptr != g->grps[i].nm_ind)
{
sfree(g->grps[i].nm_ind);
- g->grps[i].nm_ind = NULL;
+ g->grps[i].nm_ind = nullptr;
}
- if (NULL != g->grpnr[i])
+ if (nullptr != g->grpnr[i])
{
sfree(g->grpnr[i]);
- g->grpnr[i] = NULL;
+ g->grpnr[i] = nullptr;
}
}
/* The contents of this array is in symtab, don't free it here */
for (int f = 0; f < F_NRE; ++f)
{
sfree(top->idef.il[f].iatoms);
- top->idef.il[f].iatoms = NULL;
+ top->idef.il[f].iatoms = nullptr;
top->idef.il[f].nalloc = 0;
}
for (int f = 0; f < F_NRE; ++f)
{
sfree(top->idef.il[f].iatoms);
- top->idef.il[f].iatoms = NULL;
+ top->idef.il[f].iatoms = nullptr;
top->idef.il[f].nalloc = 0;
}
done_atom(&top->atoms);
}
else
{
- cmp_idef(fp, &(t1->idef), NULL, ftol, abstol);
- cmp_atoms(fp, &(t1->atoms), NULL, ftol, abstol);
+ cmp_idef(fp, &(t1->idef), nullptr, ftol, abstol);
+ cmp_atoms(fp, &(t1->atoms), nullptr, ftol, abstol);
}
}
}
cmp_int(fp, "ngrpnr", i, g0->ngrpnr[i], g1->ngrpnr[i]);
if (g0->ngrpnr[i] == g1->ngrpnr[i] && natoms0 == natoms1 &&
- (g0->grpnr[i] != NULL || g1->grpnr[i] != NULL))
+ (g0->grpnr[i] != nullptr || g1->grpnr[i] != nullptr))
{
for (j = 0; j < natoms0; j++)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2008, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
t_iatom *iabuf;
int iabuf_nalloc;
- if (qB == NULL)
+ if (qB == nullptr)
{
qB = qA;
}
iabuf_nalloc = 0;
- iabuf = NULL;
+ iabuf = nullptr;
iparams = idef->iparams;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
void TrajectoryAnalysisModule::registerBasicDataset(AbstractAnalysisData *data,
const char *name)
{
- GMX_RELEASE_ASSERT(data != NULL, "Attempting to register NULL data");
+ GMX_RELEASE_ASSERT(data != nullptr, "Attempting to register NULL data");
// TODO: Strong exception safety should be possible to implement.
GMX_RELEASE_ASSERT(impl_->datasets_.find(name) == impl_->datasets_.end(),
"Duplicate data set name registered");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
*/
TopologyInformation::TopologyInformation()
- : mtop_(NULL), top_(NULL), bTop_(false), xtop_(NULL), ePBC_(-1)
+ : mtop_(nullptr), top_(nullptr), bTop_(false), xtop_(nullptr), ePBC_(-1)
{
clear_mat(boxtop_);
}
{
if (!xtop_)
{
- *x = NULL;
+ *x = nullptr;
GMX_THROW(APIError("Topology coordinates requested without setting efUseTopX"));
}
*x = xtop_;
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,2012,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.
{
public:
//! Returns true if a topology file was loaded.
- bool hasTopology() const { return mtop_ != NULL; }
+ bool hasTopology() const { return mtop_ != nullptr; }
//! Returns true if a full topology file was loaded.
bool hasFullTopology() const { return bTop_; }
//! Returns the loaded topology, or NULL if not loaded.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
module_->initAfterFirstFrame(settings_, common_.frame());
t_pbc pbc;
- t_pbc *ppbc = settings_.hasPBC() ? &pbc : NULL;
+ t_pbc *ppbc = settings_.hasPBC() ? &pbc : nullptr;
int nframes = 0;
AnalysisDataParallelOptions dataOptions;
{
common_.initFrame();
t_trxframe &frame = common_.frame();
- if (ppbc != NULL)
+ if (ppbc != nullptr)
{
set_pbc(ppbc, topology.ePBC(), frame.box);
}
}
while (common_.readNextFrame());
module_->finishFrames(pdata.get());
- if (pdata.get() != NULL)
+ if (pdata.get() != nullptr)
{
pdata->finish();
}
{
return createModule(factory());
};
- return ICommandLineOptionsModule::runAsMain(argc, argv, NULL, NULL, runnerFactory);
+ return ICommandLineOptionsModule::runAsMain(argc, argv, nullptr, nullptr, runnerFactory);
}
// static
/*
* 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,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.
};
Angle::Angle()
- : sel1info_(NULL), sel2info_(NULL),
+ : sel1info_(nullptr), sel2info_(nullptr),
g1type_(Group1Type_Angle), g2type_(Group2Type_None),
binWidth_(1.0), natoms1_(0), natoms2_(0)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
const SelectionPosition &p1 = sel[g].position(i);
const SelectionPosition &p2 = sel[g].position(i+1);
rvec dx;
- if (pbc != NULL)
+ if (pbc != nullptr)
{
pbc_dx(pbc, p2.x(), p1.x(), dx);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
const Selection &sel = pdata->parallelSelection(sel_);
gmx::UniformRealDistribution<real> dist;
- GMX_RELEASE_ASSERT(NULL != pbc, "You have no periodic boundary conditions");
+ GMX_RELEASE_ASSERT(nullptr != pbc, "You have no periodic boundary conditions");
// Analysis framework magic
dh.startFrame(frnr, fr.time);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2006, The GROMACS development team.
- * Copyright (c) 2008,2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2008,2009,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.
srenew(atoms->resinfo, r0+1);
atoms->atom[i0].resind = r0;
t_atoms_set_resinfo(atoms, i0, symtab, resnm, r0+1, ' ', 0, ' ');
- if (atoms->pdbinfo != NULL)
+ if (atoms->pdbinfo != nullptr)
{
srenew(atoms->pdbinfo, atoms->nr+ndots);
}
xnew[ii0][XX] = dots[k++];
xnew[ii0][YY] = dots[k++];
xnew[ii0][ZZ] = dots[k++];
- if (atoms->pdbinfo != NULL)
+ if (atoms->pdbinfo != nullptr)
{
atoms->pdbinfo[ii0].type = epdbATOM;
atoms->pdbinfo[ii0].atomnr = ii0;
}
atoms->nr = i0+ndots;
atoms->nres = r0+1;
- write_sto_conf(fn, title, atoms, xnew, NULL, ePBC, const_cast<rvec *>(box));
+ write_sto_conf(fn, title, atoms, xnew, nullptr, ePBC, const_cast<rvec *>(box));
atoms->nres = r0;
atoms->nr = i0;
}
aaa.pdbinfo[ii0].occup = 0.0;
}
aaa.nr = ndots;
- write_sto_conf(fn, title, &aaa, xnew, NULL, ePBC, const_cast<rvec *>(box));
+ write_sto_conf(fn, title, &aaa, xnew, nullptr, ePBC, const_cast<rvec *>(box));
do_conect(fn, ndots, xnew);
done_atom(&aaa);
}
};
Sasa::Sasa()
- : solsize_(0.14), ndots_(24), dgsDefault_(0), bIncludeSolute_(true), top_(NULL)
+ : solsize_(0.14), ndots_(24), dgsDefault_(0), bIncludeSolute_(true), top_(nullptr)
{
//minarea_ = 0.5;
registerAnalysisDataset(&area_, "area");
// surfacedots contains nsurfacedots entries, and contains the actual
// points.
real totarea, totvolume;
- real *area = NULL, *surfacedots = NULL;
+ real *area = nullptr, *surfacedots = nullptr;
int nsurfacedots;
calculator_.calculate(surfaceSel.coordinates().data(), pbc,
frameData.index_.size(), frameData.index_.data(), flag,
&surfacedots, &nsurfacedots);
// Unpack the atomwise areas into the frameData.atomAreas_ array for easier
// indexing in the case of dynamic surfaceSel.
- if (area != NULL)
+ if (area != nullptr)
{
if (surfaceSel.isDynamic())
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2009,2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2009,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.
*/
IndexFileWriterModule::IndexFileWriterModule()
- : fp_(NULL), currentGroup_(-1), currentSize_(0), bAnyWritten_(false)
+ : fp_(nullptr), currentGroup_(-1), currentSize_(0), bAnyWritten_(false)
{
}
void IndexFileWriterModule::closeFile()
{
- if (fp_ != NULL)
+ if (fp_ != nullptr)
{
gmx_fio_fclose(fp_);
- fp_ = NULL;
+ fp_ = nullptr;
}
}
void
IndexFileWriterModule::pointsAdded(const AnalysisDataPointSetRef &points)
{
- if (fp_ == NULL)
+ if (fp_ == nullptr)
{
return;
}
void IndexFileWriterModule::dataFinished()
{
- if (fp_ != NULL)
+ if (fp_ != nullptr)
{
std::fprintf(fp_, "\n");
}
Select::Select()
: bTotNorm_(false), bFracNorm_(false), bResInd_(false),
bCumulativeLifetimes_(true), resNumberType_(ResidueNumbering_ByNumber),
- pdbAtoms_(PdbAtomsSelection_All), top_(NULL),
+ pdbAtoms_(PdbAtomsSelection_All), top_(nullptr),
occupancyModule_(new AnalysisDataAverageModule()),
lifetimeModule_(new AnalysisDataLifetimeModule())
{
case PdbAtomsSelection_All:
{
t_trxstatus *status = open_trx(fnPDB_.c_str(), "w");
- write_trxframe(status, &fr, NULL);
+ write_trxframe(status, &fr, nullptr);
close_trx(status);
break;
}
atomIndicesSet.end());
t_trxstatus *status = open_trx(fnPDB_.c_str(), "w");
write_trxframe_indexed(status, &fr, allAtomIndices.size(),
- allAtomIndices.data(), NULL);
+ allAtomIndices.data(), nullptr);
close_trx(status);
break;
}
}
}
t_trxstatus *status = open_trx(fnPDB_.c_str(), "w");
- write_trxframe_indexed(status, &fr, indices.size(), indices.data(), NULL);
+ write_trxframe_indexed(status, &fr, indices.size(), indices.data(), nullptr);
close_trx(status);
break;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2007, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
return;
}
real area = 0.0, vol = 0.0;
- real *dots = NULL, *atom_area = NULL;
+ real *dots = nullptr, *atom_area = nullptr;
int lfnr = 0, maxdots = 0;
if (mode & FLAG_VOLUME)
{
{
flags |= impl_->flags_;
*area = 0;
- if (volume == NULL)
+ if (volume == nullptr)
{
flags &= ~FLAG_VOLUME;
}
{
*volume = 0;
}
- if (at_area == NULL)
+ if (at_area == nullptr)
{
flags &= ~FLAG_ATOM_AREA;
}
else
{
- *at_area = NULL;
+ *at_area = nullptr;
}
- if (lidots == NULL)
+ if (lidots == nullptr)
{
flags &= ~FLAG_DOTS;
}
else
{
- *lidots = NULL;
+ *lidots = nullptr;
}
- if (n_dots == NULL)
+ if (n_dots == nullptr)
{
flags &= ~FLAG_DOTS;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
: settings_(*settings),
startTime_(0.0), endTime_(0.0), deltaTime_(0.0),
bStartTimeSet_(false), bEndTimeSet_(false), bDeltaTimeSet_(false),
- bTrajOpen_(false), fr(NULL), gpbc_(NULL), status_(NULL), oenv_(NULL)
+ bTrajOpen_(false), fr(nullptr), gpbc_(nullptr), status_(nullptr), oenv_(nullptr)
{
}
{
snew(topInfo_.mtop_, 1);
readConfAndTopology(topfile_.c_str(), &topInfo_.bTop_, topInfo_.mtop_,
- &topInfo_.ePBC_, &topInfo_.xtop_, NULL,
+ &topInfo_.ePBC_, &topInfo_.xtop_, nullptr,
topInfo_.boxtop_);
// TODO: Only load this here if the tool actually needs it; selections
// take care of themselves.
&& !settings_.hasFlag(TrajectoryAnalysisSettings::efUseTopX))
{
sfree(topInfo_.xtop_);
- topInfo_.xtop_ = NULL;
+ topInfo_.xtop_ = nullptr;
}
}
}
TrajectoryAnalysisRunnerCommon::Impl::initFirstFrame()
{
// Return if we have already initialized the trajectory.
- if (fr != NULL)
+ if (fr != nullptr)
{
return;
}
close_trx(status_);
bTrajOpen_ = false;
}
- if (gpbc_ != NULL)
+ if (gpbc_ != nullptr)
{
gmx_rmpbc_done(gpbc_);
- gpbc_ = NULL;
+ gpbc_ = nullptr;
}
}
void
TrajectoryAnalysisRunnerCommon::initFrame()
{
- if (impl_->gpbc_ != NULL)
+ if (impl_->gpbc_ != nullptr)
{
gmx_rmpbc_trxfr(impl_->gpbc_, impl_->fr);
}
t_trxframe &
TrajectoryAnalysisRunnerCommon::frame() const
{
- GMX_RELEASE_ASSERT(impl_->fr != NULL, "Frame not available when accessed");
+ GMX_RELEASE_ASSERT(impl_->fr != nullptr, "Frame not available when accessed");
return *impl_->fr;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
void
AbstractTrajectoryAnalysisModuleTestFixture::Impl::ensureModuleCreated()
{
- if (module_.get() == NULL)
+ if (module_.get() == nullptr)
{
module_ = parent_.createModule();
const std::vector<std::string> &datasetNames(module_->datasetNames());
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
public:
SurfaceAreaTest()
: rng_(12345), area_(0.0), volume_(0.0),
- atomArea_(NULL), dotCount_(0), dots_(NULL)
+ atomArea_(nullptr), dotCount_(0), dots_(nullptr)
{
clear_mat(box_);
}
{
volume_ = 0.0;
sfree(atomArea_);
- atomArea_ = NULL;
+ atomArea_ = nullptr;
dotCount_ = 0;
sfree(dots_);
- dots_ = NULL;
+ dots_ = nullptr;
t_pbc pbc;
if (bPBC)
{
gmx::SurfaceAreaCalculator calculator;
calculator.setDotCount(ndots);
calculator.setRadii(radius_);
- calculator.calculate(as_rvec_array(x_.data()), bPBC ? &pbc : NULL,
+ calculator.calculate(as_rvec_array(x_.data()), bPBC ? &pbc : nullptr,
index_.size(), index_.data(), flags,
&area_, &volume_, &atomArea_,
&dots_, &dotCount_);
{
compound.checkReal(volume_, "Volume");
}
- if (atomArea_ != NULL)
+ if (atomArea_ != nullptr)
{
compound.checkSequenceArray(index_.size(), atomArea_, "AtomArea");
}
- if (dots_ != NULL)
+ if (dots_ != nullptr)
{
if (checkDotCoordinates)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
* \throws std::bad_alloc if the allocation fails.
*/
pointer
- allocate(std::size_t n, typename std::allocator<void>::const_pointer gmx_unused hint = 0)
+ allocate(std::size_t n, typename std::allocator<void>::const_pointer gmx_unused hint = nullptr)
{
void *p = internal::alignedMalloc(n*sizeof(T));
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
fromVector(typename std::vector<value_type>::iterator begin,
typename std::vector<value_type>::iterator end)
{
- value_type *p_begin = (begin != end) ? &*begin : NULL;
+ value_type *p_begin = (begin != end) ? &*begin : nullptr;
value_type *p_end = p_begin + (end-begin);
return ArrayRef<value_type>(p_begin, p_end);
}
* used to initialize any ArrayRef, without specifying the template
* type. It is not explicit to enable that usage.
*/
- ArrayRef(const EmptyArrayRef &) : begin_(NULL), end_(NULL) {}
+ ArrayRef(const EmptyArrayRef &) : begin_(nullptr), end_(nullptr) {}
/*! \brief
* Constructs a reference to a particular range.
*
* std::vector<T> to a method that takes ArrayRef.
*/
ArrayRef(std::vector<T> &v)
- : begin_((!v.empty()) ? &v[0] : NULL),
- end_((!v.empty()) ? &v[0] + v.size() : NULL)
+ : begin_((!v.empty()) ? &v[0] : nullptr),
+ end_((!v.empty()) ? &v[0] + v.size() : nullptr)
{
}
/*! \brief
fromVector(typename std::vector<value_type>::const_iterator begin,
typename std::vector<value_type>::const_iterator end)
{
- const value_type *p_begin = (begin != end) ? &*begin : NULL;
+ const value_type *p_begin = (begin != end) ? &*begin : nullptr;
const value_type *p_end = p_begin + (end-begin);
return ConstArrayRef<value_type>(p_begin, p_end);
}
/*! \brief
* Constructs an empty reference.
*/
- ConstArrayRef() : begin_(NULL), end_(NULL) {}
+ ConstArrayRef() : begin_(nullptr), end_(nullptr) {}
/*! \brief
* Constructs an empty reference.
*
* used to initialize any Const ArrayRef, without specifying the
* template type. It is not explicit to enable that usage.
*/
- ConstArrayRef(const EmptyArrayRef &) : begin_(NULL), end_(NULL) {}
+ ConstArrayRef(const EmptyArrayRef &) : begin_(nullptr), end_(nullptr) {}
/*! \brief
* Constructs a const reference from a non-const reference.
*/
* std::vector<T> to a method that takes ConstArrayRef.
*/
ConstArrayRef(const std::vector<T> &v)
- : begin_((!v.empty()) ? &v[0] : NULL),
- end_((!v.empty()) ? &v[0] + v.size() : NULL)
+ : begin_((!v.empty()) ? &v[0] : nullptr),
+ end_((!v.empty()) ? &v[0] + v.size() : nullptr)
{
}
/*! \brief
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
* a mutex for locking the variable...
*/
#if GMX_COOL_QUOTES
- return (getenv("GMX_NO_QUOTES") == NULL);
+ return (getenv("GMX_NO_QUOTES") == nullptr);
#else
/*be uncool*/
return false;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
char *fgets2(char *line, int n, FILE *stream)
{
char *c;
- if (fgets(line, n, stream) == NULL)
+ if (fgets(line, n, stream) == nullptr)
{
- return NULL;
+ return nullptr;
}
- if ((c = strchr(line, '\n')) != NULL)
+ if ((c = strchr(line, '\n')) != nullptr)
{
*c = '\0';
}
gmx_fatal(FARGS, "An input file contains a line longer than %d characters, while the buffer passed to fgets2 has size %d. The line starts with: '%20.20s'", n, n, line);
}
}
- if ((c = strchr(line, '\r')) != NULL)
+ if ((c = strchr(line, '\r')) != nullptr)
{
*c = '\0';
}
}
/* search for a comment mark and replace it by a zero */
- if ((c = strchr(line, COMMENTSIGN)) != NULL)
+ if ((c = strchr(line, COMMENTSIGN)) != nullptr)
{
(*c) = 0;
}
{
int i, c;
- if (NULL == str)
+ if (nullptr == str)
{
return;
}
{
int nul;
- if (NULL == str)
+ if (nullptr == str)
{
return;
}
* the current line (where it also won't fit, but looks better)
*/
- b2 = NULL;
+ b2 = nullptr;
b2len = strlen(buf)+1+indent;
snew(b2, b2len);
i0 = i2 = 0;
void parse_digits_from_string(const char *digitstring, int *ndigits, int **digitlist)
{
/* TODO use std::string, once gmx_gpu_opt_t is ready for it */
- if (NULL == digitstring)
+ if (nullptr == digitstring)
{
*ndigits = 0;
- *digitlist = NULL;
+ *digitlist = nullptr;
return;
}
- if (strstr(digitstring, ",") != NULL)
+ if (strstr(digitstring, ",") != nullptr)
{
parse_digits_from_csv_string(digitstring, ndigits, digitlist);
}
{
int i;
- if (NULL == digitstring)
+ if (nullptr == digitstring)
{
*ndigits = 0;
- *digitlist = NULL;
+ *digitlist = nullptr;
return;
}
void parse_digits_from_csv_string(const char *digitstring, int *ndigits, int **digitlist)
{
- if (NULL == digitstring)
+ if (nullptr == digitstring)
{
*ndigits = 0;
- *digitlist = NULL;
+ *digitlist = nullptr;
return;
}
gmx_fatal(FARGS, "Invalid token in digit-only string: \"%s\"\n",
token.c_str());
}
- int number = static_cast<int>(str_to_int64_t(token.c_str(), NULL));
+ int number = static_cast<int>(str_to_int64_t(token.c_str(), nullptr));
digits.push_back(number);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
public:
static std::string getDefaultPath();
- Impl() : envName_(NULL), bEnvIsSet_(false) {}
+ Impl() : envName_(nullptr), bEnvIsSet_(false) {}
const char *envName_;
bool bEnvIsSet_;
std::string filename = findFile(options);
if (filename.empty())
{
- return NULL;
+ return nullptr;
}
#if 0
if (debug)
message.append(defaultPath);
message.append(" (default)");
}
- if (!bEnvIsSet && envName != NULL)
+ if (!bEnvIsSet && envName != nullptr)
{
message.append(
formatString("\nYou can set additional directories to search "
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2010,2011,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.
{
errno = 0;
DIR *handle = opendir(dirname);
- if (handle == NULL)
+ if (handle == nullptr)
{
if (bThrow)
{
dirname);
GMX_THROW_WITH_ERRNO(FileIOError(message), "opendir", code);
}
- return NULL;
+ return nullptr;
}
return new Impl(handle);
}
{
errno = 0;
dirent *p = readdir(dirent_handle);
- if (p == NULL)
+ if (p == nullptr)
{
if (errno == 0)
{
DirectoryEnumerator::DirectoryEnumerator(const char *dirname, bool bThrow)
: impl_(nullptr)
{
- GMX_RELEASE_ASSERT(dirname != NULL && dirname[0] != '\0',
+ GMX_RELEASE_ASSERT(dirname != nullptr && dirname[0] != '\0',
"Attempted to open empty/null directory path");
impl_.reset(Impl::init(dirname, bThrow));
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
std::fprintf(fp, "\n-------------------------------------------------------\n");
std::fprintf(fp, "Program: %s, version %s\n", programName, gmx_version());
- if (file != NULL)
+ if (file != nullptr)
{
std::fprintf(fp, "Source file: %s (line %d)\n",
Path::stripSourcePrefix(file), line);
}
- if (func != NULL)
+ if (func != nullptr)
{
std::fprintf(fp, "Function: %s\n", func);
}
/*
* 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,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.
const char *GromacsException::what() const noexcept
{
const ErrorMessage *msg = getInfo<ExceptionInfoMessage>();
- if (msg == NULL)
+ if (msg == nullptr)
{
return "No reason provided";
}
void GromacsException::prependContext(const std::string &context)
{
const ErrorMessage *msg = getInfo<ExceptionInfoMessage>();
- GMX_RELEASE_ASSERT(msg != NULL, "Message should always be set");
+ GMX_RELEASE_ASSERT(msg != nullptr, "Message should always be set");
setInfo(ExceptionInfoMessage(msg->prependContext(context)));
}
{
std::fprintf(fp_, "%*sReason: %s\n", indent, "",
std::strerror(errorNumber));
- if (funcName != NULL)
+ if (funcName != nullptr)
{
std::fprintf(fp_, "%*s(call to %s() returned error code %d)\n",
indent, "", funcName, errorNumber);
{
writer_->wrapperSettings().setIndent(indent);
writer_->writeLine(formatString("Reason: %s", std::strerror(errorNumber)));
- if (funcName != NULL)
+ if (funcName != nullptr)
{
writer_->writeLine(
formatString("(call to %s() returned error code %d)",
{
writeLine(formatString("Reason: %s", std::strerror(errorNumber)).c_str(),
indent);
- if (funcName != NULL)
+ if (funcName != nullptr)
{
writeLine(formatString("(call to %s() returned error code %d)",
funcName, errorNumber).c_str(),
const std::exception &ex, int indent)
{
const GromacsException *gmxEx = dynamic_cast<const GromacsException *>(&ex);
- if (gmxEx != NULL)
+ if (gmxEx != nullptr)
{
// TODO: Add an option to print location information for the tests
bool bAnythingWritten = false;
// TODO: Remove duplicate context if present in multiple nested exceptions.
const ErrorMessage *msg = gmxEx->getInfo<ExceptionInfoMessage>();
- if (msg != NULL)
+ if (msg != nullptr)
{
- while (msg != NULL && msg->isContext())
+ while (msg != nullptr && msg->isContext())
{
writer->writeLine(msg->text().c_str(), indent*2);
++indent;
msg = &msg->child();
}
- if (msg != NULL && !msg->text().empty())
+ if (msg != nullptr && !msg->text().empty())
{
writer->writeLine(msg->text().c_str(), indent*2);
bAnythingWritten = true;
}
const int *errorNumber = gmxEx->getInfo<ExceptionInfoErrno>();
- if (errorNumber != NULL && *errorNumber != 0)
+ if (errorNumber != nullptr && *errorNumber != 0)
{
const char * const *funcName
= gmxEx->getInfo<ExceptionInfoApiFunction>();
writer->writeErrNoInfo(*errorNumber,
- funcName != NULL ? *funcName : NULL,
+ funcName != nullptr ? *funcName : nullptr,
(indent+1)*2);
bAnythingWritten = true;
}
const internal::NestedExceptionList *nested
= gmxEx->getInfo<ExceptionInfoNestedExceptions>();
- if (nested != NULL)
+ if (nested != nullptr)
{
internal::NestedExceptionList::const_iterator ni;
for (ni = nested->begin(); ni != nested->end(); ++ni)
bool bPrintType = false;
const GromacsException *gmxEx = dynamic_cast<const GromacsException *>(&ex);
// TODO: Treat more of the standard exceptions
- if (gmxEx != NULL)
+ if (gmxEx != nullptr)
{
title = getErrorCodeString(gmxEx->errorCode());
}
- else if (dynamic_cast<const tMPI::system_error *>(&ex) != NULL)
+ else if (dynamic_cast<const tMPI::system_error *>(&ex) != nullptr)
{
title = "System error in thread synchronization";
}
- else if (dynamic_cast<const std::bad_alloc *>(&ex) != NULL)
+ else if (dynamic_cast<const std::bad_alloc *>(&ex) != nullptr)
{
title = "Memory allocation failed";
}
- else if (dynamic_cast<const std::logic_error *>(&ex) != NULL)
+ else if (dynamic_cast<const std::logic_error *>(&ex) != nullptr)
{
title = "Standard library logic error (bug)";
bPrintType = true;
}
- else if (dynamic_cast<const std::runtime_error *>(&ex) != NULL)
+ else if (dynamic_cast<const std::runtime_error *>(&ex) != nullptr)
{
title = "Standard library runtime error (possible bug)";
bPrintType = true;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
static bool bDebug = false;
static tMPI_Thread_mutex_t where_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
-FILE *debug = NULL;
+FILE *debug = nullptr;
gmx_bool gmx_debug_at = FALSE;
-static FILE *log_file = NULL;
+static FILE *log_file = nullptr;
static tMPI_Thread_mutex_t error_mutex = TMPI_THREAD_MUTEX_INITIALIZER;
void gmx_init_debug(const int dbglevel, const char *dbgfile)
if (bFirst) /* we repeat the check in the locked section because things
might have changed */
{
- if ((temp = getenv("GMX_PRINT_DEBUG_LINES")) != NULL)
+ if ((temp = getenv("GMX_PRINT_DEBUG_LINES")) != nullptr)
{
- nskip = strtol(temp, NULL, 10);
+ nskip = strtol(temp, nullptr, 10);
}
bFirst = FALSE;
}
{
if (log_file)
{
- gmx::internal::printFatalErrorHeader(log_file, title, NULL, file, line);
+ gmx::internal::printFatalErrorHeader(log_file, title, nullptr, file, line);
gmx::internal::printFatalErrorMessageLine(log_file, msg, 0);
gmx::internal::printFatalErrorFooter(log_file);
}
- gmx::internal::printFatalErrorHeader(stderr, title, NULL, file, line);
+ gmx::internal::printFatalErrorHeader(stderr, title, nullptr, file, line);
gmx::internal::printFatalErrorMessageLine(stderr, msg, 0);
gmx::internal::printFatalErrorFooter(stderr);
}
{ "range", "Range checking error" }
};
- if (key == NULL)
+ if (key == nullptr)
{
return "NULL error type (should not occur)";
}
static void call_error_handler(const char *key, const char *file, int line, const char *msg)
{
- if (msg == NULL)
+ if (msg == nullptr)
{
msg = "Empty gmx_fatal message (bug).";
}
if ((n < n_min) || (n >= n_max))
{
- if (warn_str != NULL)
+ if (warn_str != nullptr)
{
strcpy(buf, warn_str);
strcat(buf, "\n");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015, by the GROMACS development team, led by
+ * 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.
std::string result;
char buf[bufsize];
buf[0] = '\0';
- while (std::fgets(buf, bufsize, fp) != NULL)
+ while (std::fgets(buf, bufsize, fp) != nullptr)
{
const size_t length = std::strlen(buf);
result.append(buf, length);
{
}
FileStreamImpl(const char *filename, const char *mode)
- : fp_(NULL), bClose_(true)
+ : fp_(nullptr), bClose_(true)
{
fp_ = std::fopen(filename, mode);
- if (fp_ == NULL)
+ if (fp_ == nullptr)
{
GMX_THROW_WITH_ERRNO(
FileIOError(formatString("Could not open file '%s'", filename)),
}
~FileStreamImpl()
{
- if (fp_ != NULL && bClose_)
+ if (fp_ != nullptr && bClose_)
{
if (std::fclose(fp_) != 0)
{
FILE *handle()
{
- GMX_RELEASE_ASSERT(fp_ != NULL,
+ GMX_RELEASE_ASSERT(fp_ != nullptr,
"Attempted to access a file object that is not open");
return fp_;
}
void close()
{
- GMX_RELEASE_ASSERT(fp_ != NULL,
+ GMX_RELEASE_ASSERT(fp_ != nullptr,
"Attempted to close a file object that is not open");
GMX_RELEASE_ASSERT(bClose_,
"Attempted to close a file object that should not be");
const bool bOk = (std::fclose(fp_) == 0);
- fp_ = NULL;
+ fp_ = nullptr;
if (!bOk)
{
GMX_THROW_WITH_ERRNO(
FILE *TextInputFile::openRawHandle(const char *filename)
{
FILE *fp = fopen(filename, "r");
- if (fp == NULL)
+ if (fp == nullptr)
{
GMX_THROW_WITH_ERRNO(
FileIOError(formatString("Could not open file '%s'", filename)),
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
struct t_pstack *prev;
} t_pstack;
-static t_pstack *pstack = NULL;
+static t_pstack *pstack = nullptr;
static bool bUnbuffered = false;
static int s_maxBackupCount = 0;
const DataFileFinder &getLibraryFileFinder()
{
- if (g_libFileFinder != NULL)
+ if (g_libFileFinder != nullptr)
{
return *g_libFileFinder;
}
if (count < 0)
{
const char *env = getenv("GMX_MAXBACKUP");
- if (env != NULL)
+ if (env != nullptr)
{
// TODO: Check that the value is converted properly.
- count = strtol(env, NULL, 10);
+ count = strtol(env, nullptr, 10);
if (count < 0)
{
count = 0;
tMPI_Thread_mutex_lock(&pstack_mutex);
ps = pstack;
- if (ps == NULL)
+ if (ps == nullptr)
{
- if (fp != NULL)
+ if (fp != nullptr)
{
ret = fclose(fp);
}
}
else if (ps->fp == fp)
{
- if (fp != NULL)
+ if (fp != nullptr)
{
ret = pclose(fp);
}
}
else
{
- while ((ps->prev != NULL) && (ps->prev->fp != fp))
+ while ((ps->prev != nullptr) && (ps->prev->fp != fp))
{
ps = ps->prev;
}
- if ((ps->prev != NULL) && ps->prev->fp == fp)
+ if ((ps->prev != nullptr) && ps->prev->fp == fp)
{
- if (ps->prev->fp != NULL)
+ if (ps->prev->fp != nullptr)
{
ret = pclose(ps->prev->fp);
}
}
else
{
- if (fp != NULL)
+ if (fp != nullptr)
{
ret = fclose(fp);
}
tMPI_Thread_mutex_lock(&pstack_mutex);
t_pstack *ps = pstack;
- while (ps != NULL)
+ while (ps != nullptr)
{
if (ps->fp == fp)
{
sprintf(buf, "uncompress -c < %s", fn);
fprintf(stderr, "Going to execute '%s'\n", buf);
- if ((fp = popen(buf, mode)) == NULL)
+ if ((fp = popen(buf, mode)) == nullptr)
{
gmx_open(fn);
}
sprintf(buf, "gunzip -c < %s", fn);
fprintf(stderr, "Going to execute '%s'\n", buf);
- if ((fp = popen(buf, mode)) == NULL)
+ if ((fp = popen(buf, mode)) == nullptr)
{
gmx_open(fn);
}
{
FILE *test;
- if (fname == NULL)
+ if (fname == nullptr)
{
return FALSE;
}
test = fopen(fname, "r");
- if (test == NULL)
+ if (test == nullptr)
{
/*Windows doesn't allow fopen of directory - so we need to check this seperately */
#if GMX_NATIVE_WINDOWS
#ifdef SKIP_FFOPS
return fopen(file, mode);
#else
- FILE *ff = NULL;
- char buf[256], *bufsize = 0, *ptr;
+ FILE *ff = nullptr;
+ char buf[256], *bufsize = nullptr, *ptr;
gmx_bool bRead;
int bs;
- if (file == NULL)
+ if (file == nullptr)
{
- return NULL;
+ return nullptr;
}
if (mode[0] == 'w')
strcpy(buf, file);
if (!bRead || gmx_fexist(buf))
{
- if ((ff = fopen(buf, mode)) == NULL)
+ if ((ff = fopen(buf, mode)) == nullptr)
{
gmx_file(buf);
}
/* Check whether we should be using buffering (default) or not
* (for debugging)
*/
- if (bUnbuffered || ((bufsize = getenv("GMX_LOG_BUFFER")) != NULL))
+ if (bUnbuffered || ((bufsize = getenv("GMX_LOG_BUFFER")) != nullptr))
{
/* Check whether to use completely unbuffered */
if (bUnbuffered)
}
else
{
- bs = strtol(bufsize, NULL, 10);
+ bs = strtol(bufsize, nullptr, 10);
}
if (bs <= 0)
{
- setbuf(ff, NULL);
+ setbuf(ff, nullptr);
}
else
{
}
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
- return NULL;
+ return nullptr;
}
FILE *low_libopen(const char *file, gmx_bool bFatal)
return fp;
}
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
- return NULL;
+ return nullptr;
}
char *gmxlibfn(const char *file)
FILE *gmx_fopen_temporary(char *buf)
{
int i, len;
- FILE *fpout = NULL;
+ FILE *fpout = nullptr;
if ((len = strlen(buf)) < 7)
{
gmx_fatal(FARGS, "Error creating temporary file %s: %s", buf,
strerror(errno));
}
- if ((fpout = fdopen(fd, "w")) == NULL)
+ if ((fpout = fdopen(fd, "w")) == nullptr)
{
gmx_fatal(FARGS, "Cannot open temporary file %s", buf);
}
{
/* the full copy buffer size: */
#define FILECOPY_BUFSIZE (1<<16)
- FILE *in = NULL;
- FILE *out = NULL;
+ FILE *in = nullptr;
+ FILE *out = nullptr;
char *buf;
snew(buf, FILECOPY_BUFSIZE);
#else
char *pdum = getcwd(buffer, size);
#endif
- if (pdum == NULL)
+ if (pdum == nullptr)
{
gmx_fatal(FARGS, "Cannot get working directory. Reason: %s",
strerror(errno));
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2016, by the GROMACS development team, led by
+ * Copyright (c) 2012,2013,2014,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.
{
bool shouldSetAffinity = true;
- *message = NULL;
+ *message = nullptr;
#if GMX_OPENMP
/* We assume that the affinity setting is available on all platforms
* gcc supports. Even if this is not the case (e.g. Mac OS) the user
GMX_CATCH_ALL_AND_EXIT_WITH_FATAL_ERROR;
const char *const gomp_env = getenv("GOMP_CPU_AFFINITY");
- const bool bGompCpuAffinitySet = (gomp_env != NULL);
+ const bool bGompCpuAffinitySet = (gomp_env != nullptr);
/* turn off internal pinning if GOMP_CPU_AFFINITY is set & non-empty */
if (bGompCpuAffinitySet && *gomp_env != '\0')
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
bool match(const char *value) const
{
- int rc = regexec(®ex_, value, 0, NULL, 0);
+ int rc = regexec(®ex_, value, 0, nullptr, 0);
if (rc != 0 && rc != REG_NOMATCH)
{
// TODO: Handle errors.
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015, by the GROMACS development team, led by
+ * 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.
i = static_cast<int>(step);
- if (warn != NULL && (static_cast<gmx_int64_t>(i) != step))
+ if (warn != nullptr && (static_cast<gmx_int64_t>(i) != step))
{
fprintf(stderr, "\nWARNING during %s:\n", warn);
fprintf(stderr, "int64 value ");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
* Note that the return value is unintuitively `false` when the target
* is active, to allow implementing ::GMX_LOG like it is now.
*/
- operator bool() const { return target_ == NULL; }
+ operator bool() const { return target_ == nullptr; }
/*! \brief
* Writes the entry from the given writer to the log target.
// Both of the below should be explicit, once that works in CUDA.
//! Returns whether the output for this log level goes anywhere.
- operator bool() const { return target_ != NULL; }
+ operator bool() const { return target_ != nullptr; }
//! Creates a helper for ::GMX_LOG.
operator LogWriteHelper() const { return LogWriteHelper(target_); }
/*
* 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,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.
result.push_back("");
#endif
const char *path = std::getenv("PATH");
- if (path != NULL)
+ if (path != nullptr)
{
splitPathEnvironment(path, &result);
}
// static
bool File::exists(const char *filename, NotFoundHandler onNotFound)
{
- if (filename == NULL)
+ if (filename == nullptr)
{
return false;
}
FILE *test = std::fopen(filename, "r");
- if (test == NULL)
+ if (test == nullptr)
{
const bool wasError = (errno != ENOENT && errno != ENOTDIR);
NotFoundInfo info(filename, "The file could not be opened.",
if (!S_ISREG(st_buf.st_mode))
{
NotFoundInfo info(filename, "The file is not a regular file.",
- NULL, true, 0);
+ nullptr, true, 0);
onNotFound(info);
return false;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
char *title;
#define LINE_WIDTH 79
- if (fp == NULL)
+ if (fp == nullptr)
{
return;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
const IProgramContext &getProgramContext()
{
- if (g_programContext != NULL)
+ if (g_programContext != nullptr)
{
return *g_programContext;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2012,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 2010,2012,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.
cbase = (char *)base;
- swaptype = (size_t)(cbase - (char *)0) % sizeof(int) || size % sizeof(int) ? 2 : size == sizeof(int) ? 0 : 1;
+ swaptype = (size_t)(cbase - (char *)nullptr) % sizeof(int) || size % sizeof(int) ? 2 : size == sizeof(int) ? 0 : 1;
if (nmemb < 7)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
void *p;
- p = NULL;
+ p = nullptr;
if (size == 0)
{
- p = NULL;
+ p = nullptr;
}
else
{
- if ((p = malloc(size)) == NULL)
+ if ((p = malloc(size)) == nullptr)
{
gmx_fatal(errno, __FILE__, __LINE__,
"Not enough memory. Failed to malloc %" GMX_PRId64 " bytes for %s\n"
{
void *p;
- p = NULL;
+ p = nullptr;
if ((nelem == 0) || (elsize == 0))
{
- p = NULL;
+ p = nullptr;
}
else
{
}
memset(p, 0, (size_t) (nelem * elsize));
#else
- if ((p = calloc((size_t)nelem, (size_t)elsize)) == NULL)
+ if ((p = calloc((size_t)nelem, (size_t)elsize)) == nullptr)
{
gmx_fatal(errno, __FILE__, __LINE__,
"Not enough memory. Failed to calloc %" GMX_PRId64
void *p;
size_t size = nelem*elsize;
- p = NULL;
+ p = nullptr;
if (size == 0)
{
save_free(name, file, line, ptr);
size/1048576.0, name, file, line, rank);
}
#endif
- if (ptr == NULL)
+ if (ptr == nullptr)
{
p = malloc((size_t)size);
}
{
p = realloc(ptr, (size_t)size);
}
- if (p == NULL)
+ if (p == nullptr)
{
gmx_fatal(errno, __FILE__, __LINE__,
"Not enough memory. Failed to realloc %" GMX_PRId64 " bytes for %s, %s=%x\n"
#ifdef DEBUG
log_action(0, name, file, line, 0, 0, ptr);
#endif
- if (ptr != NULL)
+ if (ptr != nullptr)
{
free(ptr);
}
size_t nelem, size_t elsize, size_t alignment)
{
void *aligned = save_malloc_aligned(name, file, line, nelem, elsize, alignment);
- if (aligned != NULL)
+ if (aligned != nullptr)
{
memset(aligned, 0, (size_t)(nelem * elsize));
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
std::strcpy(temp, line);
dum = std::strchr(temp, '[');
- if (dum == NULL)
+ if (dum == nullptr)
{
return FALSE;
}
dum[0] = ' ';
dum = std::strchr(temp, ']');
- if (dum == NULL)
+ if (dum == nullptr)
{
gmx_fatal(FARGS, "header is not terminated on line:\n'%s'\n", line);
return FALSE;
char *pret;
pret = fgets(buf, STRLEN, in);
- if (pret == NULL || sscanf(buf, "%d", &nstr) != 1)
+ if (pret == nullptr || sscanf(buf, "%d", &nstr) != 1)
{
gmx_warning("File is empty");
gmx_ffclose(in);
/*
* 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,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.
std::string stripSuffixIfPresent(const std::string &str, const char *suffix)
{
- if (suffix != NULL)
+ if (suffix != nullptr)
{
size_t suffixLength = std::strlen(suffix);
if (suffixLength > 0 && endsWith(str, suffix))
replaceInternal(const std::string &input, const char *from, const char *to,
bool bWholeWords)
{
- GMX_RELEASE_ASSERT(from != NULL && to != NULL,
+ GMX_RELEASE_ASSERT(from != nullptr && to != nullptr,
"Replacement strings must not be NULL");
size_t matchLength = std::strlen(from);
std::string result;
{
const char *nextBreakPtr = std::strpbrk(input + lineEnd, " \n");
size_t nextBreak
- = (nextBreakPtr != NULL ? nextBreakPtr - input : inputLength);
+ = (nextBreakPtr != nullptr ? nextBreakPtr - input : inputLength);
if (nextBreak > lastAllowedBreakPoint && lineEnd > lineStart)
{
break;
/*
* 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,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.
*/
static inline bool isNullOrEmpty(const char *str)
{
- return str == NULL || str[0] == '\0';
+ return str == nullptr || str[0] == '\0';
}
/*! \brief
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
void gmx_format_current_time(char *buf, size_t len)
{
- time_t clock = time(NULL);
+ time_t clock = time(nullptr);
gmx_ctime_r(&clock, buf, len);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 2012,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.
TEST(StringUtilityTest, EndsWith)
{
EXPECT_TRUE(gmx::endsWith("foobar", "bar"));
- EXPECT_TRUE(gmx::endsWith("foobar", NULL));
+ EXPECT_TRUE(gmx::endsWith("foobar", nullptr));
EXPECT_TRUE(gmx::endsWith("foobar", ""));
EXPECT_TRUE(gmx::endsWith("", ""));
EXPECT_FALSE(gmx::endsWith("", "foobar"));
TEST(StringUtilityTest, StripSuffixIfPresent)
{
EXPECT_EQ("foo", gmx::stripSuffixIfPresent("foobar", "bar"));
- EXPECT_EQ("foobar", gmx::stripSuffixIfPresent("foobar", NULL));
+ EXPECT_EQ("foobar", gmx::stripSuffixIfPresent("foobar", nullptr));
EXPECT_EQ("foobar", gmx::stripSuffixIfPresent("foobar", ""));
EXPECT_EQ("foobar", gmx::stripSuffixIfPresent("foobar", "bbar"));
EXPECT_EQ("foobar", gmx::stripSuffixIfPresent("foobar", "barr"));
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
fprintf(fp, "%s: not available\n", title);
}
- return (p != NULL);
+ return (p != nullptr);
}
int pr_title(FILE *fp, int indent, const char *title)
const char *flong = "%15.8e";
const char *format;
- if (getenv("GMX_PRINT_LONGFORMAT") != NULL)
+ if (getenv("GMX_PRINT_LONGFORMAT") != nullptr)
{
format = flong;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
virtual const char *shortDescription() const
{
- return NULL;
+ return nullptr;
}
virtual void init(gmx::CommandLineModuleSettings * /*settings*/)
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
unsigned long Flags,
gmx_walltime_accounting_t walltime_accounting)
{
- gmx_mdoutf_t outf = NULL;
+ gmx_mdoutf_t outf = nullptr;
gmx_int64_t step, step_rel;
double elapsed_time;
double t, t0, lam0[efptNR];
t_vcm *vcm;
matrix parrinellorahmanMu, M;
t_trxframe rerun_fr;
- gmx_repl_ex_t repl_ex = NULL;
+ gmx_repl_ex_t repl_ex = nullptr;
int nchkpt = 1;
gmx_localtop_t *top;
- t_mdebin *mdebin = NULL;
+ t_mdebin *mdebin = nullptr;
gmx_enerdata_t *enerd;
PaddedRVecVector f {};
gmx_global_stat_t gstat;
- gmx_update_t *upd = NULL;
- t_graph *graph = NULL;
+ gmx_update_t *upd = nullptr;
+ t_graph *graph = nullptr;
gmx_groups_t *groups;
gmx_ekindata_t *ekind;
gmx_shellfc_t *shellfc;
gmx_bool bResetCountersHalfMaxH = FALSE;
gmx_bool bTemp, bPres, bTrotter;
real dvdl_constr;
- rvec *cbuf = NULL;
+ rvec *cbuf = nullptr;
int cbuf_nalloc = 0;
matrix lastbox;
int lamnew = 0;
/* PME load balancing data for GPU kernels */
- pme_load_balancing_t *pme_loadbal = NULL;
+ pme_load_balancing_t *pme_loadbal = nullptr;
gmx_bool bPMETune = FALSE;
gmx_bool bPMETunePrinting = FALSE;
state_global, top_global, ir,
state, &f, mdatoms, top, fr,
vsite, constr,
- nrnb, NULL, FALSE);
+ nrnb, nullptr, FALSE);
shouldCheckNumberOfBondedInteractions = true;
update_realloc(upd, state->natoms);
}
if (vsite)
{
/* Construct the virtual sites for the initial configuration */
- construct_vsites(vsite, as_rvec_array(state->x.data()), ir->delta_t, NULL,
+ construct_vsites(vsite, as_rvec_array(state->x.data()), ir->delta_t, nullptr,
top->idef.iparams, top->idef.il,
fr->ePBC, fr->bMolPBC, cr, state->box);
}
bSumEkinhOld = FALSE;
compute_globals(fplog, gstat, cr, ir, fr, ekind, state, mdatoms, nrnb, vcm,
- NULL, enerd, force_vir, shake_vir, total_vir, pres, mu_tot,
+ nullptr, enerd, force_vir, shake_vir, total_vir, pres, mu_tot,
constr, &nullSignaller, state->box,
&totalNumberOfBondedInteractions, &bSumEkinhOld, cglo_flags
| (shouldCheckNumberOfBondedInteractions ? CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS : 0));
perhaps loses some logic?*/
compute_globals(fplog, gstat, cr, ir, fr, ekind, state, mdatoms, nrnb, vcm,
- NULL, enerd, force_vir, shake_vir, total_vir, pres, mu_tot,
+ nullptr, enerd, force_vir, shake_vir, total_vir, pres, mu_tot,
constr, &nullSignaller, state->box,
- NULL, &bSumEkinhOld,
+ nullptr, &bSumEkinhOld,
cglo_flags &~(CGLO_STOPCM | CGLO_PRESSURE));
}
{
/* PME grid + cut-off optimization with GPUs or PME nodes */
pme_loadbal_do(pme_loadbal, cr,
- (bVerbose && MASTER(cr)) ? stderr : NULL,
+ (bVerbose && MASTER(cr)) ? stderr : nullptr,
fplog, mdlog,
ir, fr, state,
wcycle,
* the full step kinetic energy and possibly for T-coupling.*/
/* This may not be quite working correctly yet . . . . */
compute_globals(fplog, gstat, cr, ir, fr, ekind, state, mdatoms, nrnb, vcm,
- wcycle, enerd, NULL, NULL, NULL, NULL, mu_tot,
+ wcycle, enerd, nullptr, nullptr, nullptr, nullptr, mu_tot,
constr, &nullSignaller, state->box,
&totalNumberOfBondedInteractions, &bSumEkinhOld,
CGLO_GSTAT | CGLO_TEMPERATURE | CGLO_CHECK_NUMBER_OF_BONDED_INTERACTIONS);
if (EI_VV(ir->eI) && !startingFromCheckpoint && !bRerunMD)
/* ############### START FIRST UPDATE HALF-STEP FOR VV METHODS############### */
{
- rvec *vbuf = NULL;
+ rvec *vbuf = nullptr;
wallcycle_start(wcycle, ewcUPDATE);
if (ir->eI == eiVV && bInitStep)
if (!bRerunMD || rerun_fr.bV || bForceUpdate) /* Why is rerun_fr.bV here? Unclear. */
{
wallcycle_stop(wcycle, ewcUPDATE);
- update_constraints(fplog, step, NULL, ir, mdatoms,
+ update_constraints(fplog, step, nullptr, ir, mdatoms,
state, fr->bMolPBC, graph, &f,
&top->idef, shake_vir,
cr, nrnb, wcycle, upd, constr,
if (inputrecNvtTrotter(ir) && ir->eI == eiVV)
{
/* update temperature and kinetic energy now that step is over - this is the v(t+dt) point */
- enerd->term[F_TEMP] = sum_ekin(&(ir->opts), ekind, NULL, (ir->eI == eiVV), FALSE);
+ enerd->term[F_TEMP] = sum_ekin(&(ir->opts), ekind, nullptr, (ir->eI == eiVV), FALSE);
enerd->term[F_EKIN] = trace(ekind->ekin);
}
}
* the full step kinetic energy and possibly for T-coupling.*/
/* This may not be quite working correctly yet . . . . */
compute_globals(fplog, gstat, cr, ir, fr, ekind, state, mdatoms, nrnb, vcm,
- wcycle, enerd, NULL, NULL, NULL, NULL, mu_tot,
+ wcycle, enerd, nullptr, nullptr, nullptr, nullptr, mu_tot,
constr, &nullSignaller, state->box,
- NULL, &bSumEkinhOld,
+ nullptr, &bSumEkinhOld,
CGLO_GSTAT | CGLO_TEMPERATURE);
wallcycle_start(wcycle, ewcUPDATE);
}
/* if we have constraints, we have to remove the kinetic energy parallel to the bonds */
if (constr && bIfRandomize)
{
- update_constraints(fplog, step, NULL, ir, mdatoms,
+ update_constraints(fplog, step, nullptr, ir, mdatoms,
state, fr->bMolPBC, graph, &f,
&top->idef, tmp_vir,
cr, nrnb, wcycle, upd, constr,
compute_globals(fplog, gstat, cr, ir, fr, ekind, state, mdatoms, nrnb, vcm,
wcycle, enerd, force_vir, shake_vir, total_vir, pres, mu_tot,
constr, &nullSignaller, lastbox,
- NULL, &bSumEkinhOld,
+ nullptr, &bSumEkinhOld,
(bGStat ? CGLO_GSTAT : 0) | CGLO_TEMPERATURE
);
wallcycle_start(wcycle, ewcUPDATE);
* to numerical errors, or are they important
* physically? I'm thinking they are just errors, but not completely sure.
* For now, will call without actually constraining, constr=NULL*/
- update_constraints(fplog, step, NULL, ir, mdatoms,
+ update_constraints(fplog, step, nullptr, ir, mdatoms,
state, fr->bMolPBC, graph, &f,
&top->idef, tmp_vir,
- cr, nrnb, wcycle, upd, NULL,
+ cr, nrnb, wcycle, upd, nullptr,
FALSE, bCalcVir);
}
if (EI_VV(ir->eI))
unshift_self(graph, state->box, as_rvec_array(state->x.data()));
}
- if (vsite != NULL)
+ if (vsite != nullptr)
{
wallcycle_start(wcycle, ewcVSITECONSTR);
- if (graph != NULL)
+ if (graph != nullptr)
{
shift_self(graph, state->box, as_rvec_array(state->x.data()));
}
top->idef.iparams, top->idef.il,
fr->ePBC, fr->bMolPBC, cr, state->box);
- if (graph != NULL)
+ if (graph != nullptr)
{
unshift_self(graph, state->box, as_rvec_array(state->x.data()));
}
if (fplog && do_log && bDoExpanded)
{
/* only needed if doing expanded ensemble */
- PrintFreeEnergyInfoToFile(fplog, ir->fepvals, ir->expandedvals, ir->bSimTemp ? ir->simtempvals : NULL,
+ PrintFreeEnergyInfoToFile(fplog, ir->fepvals, ir->expandedvals, ir->bSimTemp ? ir->simtempvals : nullptr,
state_global->dfhist, state->fep_state, ir->nstlog, step);
}
if (bCalcEner)
gmx_bool do_dr = do_per_step(step, ir->nstdisreout);
gmx_bool do_or = do_per_step(step, ir->nstorireout);
- print_ebin(mdoutf_get_fp_ene(outf), do_ene, do_dr, do_or, do_log ? fplog : NULL,
+ print_ebin(mdoutf_get_fp_ene(outf), do_ene, do_dr, do_or, do_log ? fplog : nullptr,
step, t,
eprNORMAL, mdebin, fcd, groups, &(ir->opts));
/* ####### END SET VARIABLES FOR NEXT ITERATION ###### */
- if ( (membed != NULL) && (!bLastStep) )
+ if ( (membed != nullptr) && (!bLastStep) )
{
rescale_membed(step_rel, membed, as_rvec_array(state_global->x.data()));
}
"mdrun -resetstep.", step);
}
reset_all_counters(fplog, mdlog, cr, step, &step_rel, ir, wcycle, nrnb, walltime_accounting,
- use_GPU(fr->nbv) ? fr->nbv : NULL);
+ use_GPU(fr->nbv) ? fr->nbv : nullptr);
wcycle_set_reset_counters(wcycle, -1);
if (!(cr->duty & DUTY_PME))
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
};
t_commrec *cr;
t_filenm fnm[] = {
- { efTPR, NULL, NULL, ffREAD },
- { efTRN, "-o", NULL, ffWRITE },
- { efCOMPRESSED, "-x", NULL, ffOPTWR },
- { efCPT, "-cpi", NULL, ffOPTRD | ffALLOW_MISSING },
- { efCPT, "-cpo", NULL, ffOPTWR },
+ { 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 },
{ efLOG, "-rs", "rotslabs", ffOPTWR },
{ efLOG, "-rt", "rottorque", ffOPTWR },
{ efMTX, "-mtx", "nm", ffOPTWR },
- { efRND, "-multidir", NULL, ffOPTRDMULT},
+ { efRND, "-multidir", nullptr, ffOPTRDMULT},
{ efDAT, "-membed", "membed", ffOPTRD },
{ efTOP, "-mp", "membed", ffOPTRD },
{ efNDX, "-mn", "membed", ffOPTRD },
rvec realddxyz = {0, 0, 0};
const char *ddrank_opt[ddrankorderNR+1] =
- { NULL, "interleave", "pp_pme", "cartesian", NULL };
+ { nullptr, "interleave", "pp_pme", "cartesian", nullptr };
const char *dddlb_opt[] =
- { NULL, "auto", "no", "yes", NULL };
+ { nullptr, "auto", "no", "yes", nullptr };
const char *thread_aff_opt[threadaffNR+1] =
- { NULL, "auto", "on", "off", NULL };
+ { nullptr, "auto", "on", "off", nullptr };
const char *nbpu_opt[] =
- { NULL, "auto", "cpu", "gpu", "gpu_cpu", NULL };
+ { nullptr, "auto", "cpu", "gpu", "gpu_cpu", nullptr };
real rdd = 0.0, rconstr = 0.0, dlb_scale = 0.8, pforce = -1;
- char *ddcsx = NULL, *ddcsy = NULL, *ddcsz = NULL;
+ char *ddcsx = nullptr, *ddcsy = nullptr, *ddcsz = nullptr;
real cpt_period = 15.0, max_hours = -1;
gmx_bool bTryToAppendFiles = TRUE;
gmx_bool bKeepAndNumCPT = FALSE;
gmx_bool bResetCountersHalfWay = FALSE;
- gmx_output_env_t *oenv = NULL;
+ gmx_output_env_t *oenv = nullptr;
/* Non transparent initialization of a complex gmx_hw_opt_t struct.
* But unfortunately we are not allowed to call a function here,
*/
gmx_hw_opt_t hw_opt = {
0, 0, 0, 0, threadaffSEL, 0, 0,
- { NULL, FALSE, 0, NULL }
+ { nullptr, FALSE, 0, nullptr }
};
t_pargs pa[] = {
gmx_bool bDoAppendFiles, bStartFromCpt;
FILE *fplog;
int rc;
- char **multidir = NULL;
+ char **multidir = nullptr;
cr = init_commrec();
*/
if (!parse_common_args(&argc, argv, PCA_Flags, NFILE, fnm, asize(pa), pa,
- asize(desc), desc, 0, NULL, &oenv))
+ asize(desc), desc, 0, nullptr, &oenv))
{
sfree(cr);
return 0;
}
else
{
- fplog = NULL;
+ fplog = nullptr;
}
ddxyz[XX] = (int)(realddxyz[XX] + 0.5);
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2010,2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * 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.
for (i = 0; i < egcNR; i++)
{
- if (groups->grpnr[i] != NULL)
+ if (groups->grpnr[i] != nullptr)
{
groups->ngrpnr[i] = state->natoms;
snew(new_egrp[i], state->natoms);
{
for (j = 0; j < egcNR; j++)
{
- if (groups->grpnr[j] != NULL)
+ if (groups->grpnr[j] != nullptr)
{
new_egrp[j][i-rm] = groups->grpnr[j][i];
}
for (i = 0; i < egcNR; i++)
{
- if (groups->grpnr[i] != NULL)
+ if (groups->grpnr[i] != nullptr)
{
sfree(groups->grpnr[i]);
groups->grpnr[i] = new_egrp[i];
if (buf[0] != ';')
{
strcpy(buf2, buf);
- if ((temp = strchr(buf2, '\n')) != NULL)
+ if ((temp = strchr(buf2, '\n')) != nullptr)
{
temp[0] = '\0';
}
if (buf2[0] == '[')
{
buf2[0] = ' ';
- if ((temp = strchr(buf2, '\n')) != NULL)
+ if ((temp = strchr(buf2, '\n')) != nullptr)
{
temp[0] = '\0';
}
int i, rm_bonded_at, fr_id, fr_i = 0, tmp_id, warn = 0;
int ng, j, max_lip_rm, ins_grp_id, ntype, lip_rm;
real prot_area;
- rvec *r_ins = NULL;
+ rvec *r_ins = nullptr;
t_block *ins_at, *rest_at;
pos_ins_t *pos_ins;
mem_t *mem_p;
gmx_bool bExcl = FALSE;
t_atoms atoms;
t_pbc *pbc;
- char **piecename = NULL;
- gmx_membed_t *membed = NULL;
+ char **piecename = nullptr;
+ gmx_membed_t *membed = nullptr;
/* input variables */
const char *membed_input;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
fprintf(fplog, "\nInitializing Replica Exchange\n");
- if (ms == NULL || ms->nsim == 1)
+ if (ms == nullptr || ms->nsim == 1)
{
gmx_fatal(FARGS, "Nothing to exchange with only one replica, maybe you forgot to set the -multi option of mdrun?");
}
fprintf(fplog, "Repl %2s %2d", leg, ind[0]);
for (i = 1; i < n; i++)
{
- fprintf(fplog, " %c %2d", (bEx != 0 && bEx[i]) ? 'x' : ' ', ind[i]);
+ fprintf(fplog, " %c %2d", (bEx != nullptr && bEx[i]) ? 'x' : ' ', ind[i]);
}
fprintf(fplog, "\n");
}
re->prob[i] = re->prob_sum[i]/re->nattempt[i%2];
}
}
- print_ind(fplog, "", re->nrepl, re->ind, NULL);
+ print_ind(fplog, "", re->nrepl, re->ind, nullptr);
print_prob(fplog, "", re->nrepl, re->prob);
fprintf(fplog, "Repl number of exchanges:\n");
- print_ind(fplog, "", re->nrepl, re->ind, NULL);
+ print_ind(fplog, "", re->nrepl, re->ind, nullptr);
print_count(fplog, "", re->nrepl, re->nexchange);
fprintf(fplog, "Repl average number of exchanges:\n");
re->prob[i] = ((real)re->nexchange[i])/re->nattempt[i%2];
}
}
- print_ind(fplog, "", re->nrepl, re->ind, NULL);
+ print_ind(fplog, "", re->nrepl, re->ind, nullptr);
print_prob(fplog, "", re->nrepl, re->prob);
fprintf(fplog, "\n");
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
gmx_bool bEnvSet;
char buf2[256];
- bEnvSet = (getenv("OMP_NUM_THREADS") != NULL);
+ bEnvSet = (getenv("OMP_NUM_THREADS") != nullptr);
if (bNtOmpOptionSet || bEnvSet)
{
hw_opt->nthreads_tmpi,
hw_opt->nthreads_omp,
hw_opt->nthreads_omp_pme,
- hw_opt->gpu_opt.gpu_id != NULL ? hw_opt->gpu_opt.gpu_id : "");
+ hw_opt->gpu_opt.gpu_id != nullptr ? hw_opt->gpu_opt.gpu_id : "");
}
/* Checks we can do when we don't (yet) know the cut-off scheme */
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2011,2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
copy pointed-to items, of course,
but those are all const. */
t_commrec *cr; /* we need a local version of this */
- FILE *fplog = NULL;
+ FILE *fplog = nullptr;
t_filenm *fnm;
fnm = dup_tfn(mc.nfile, mc.fnm);
mdrunner_start_fn, (void*)(mda) );
if (ret != TMPI_SUCCESS)
{
- return NULL;
+ return nullptr;
}
crn = reinitialize_commrec_for_this_thread(cr);
return;
}
- if (fp != NULL && bGPU && ir->nstlist < nstlist_try[0])
+ if (fp != nullptr && bGPU && ir->nstlist < nstlist_try[0])
{
fprintf(fp, nstl_gpu, ir->nstlist);
}
{
fprintf(stderr, "%s\n", nve_err);
}
- if (fp != NULL)
+ if (fp != nullptr)
{
fprintf(fp, "%s\n", nve_err);
}
{
fprintf(stderr, "%s\n", vbd_err);
}
- if (fp != NULL)
+ if (fp != nullptr)
{
fprintf(fp, "%s\n", vbd_err);
}
*/
nstlist_prev = ir->nstlist;
ir->nstlist = nbnxnReferenceNstlist;
- calc_verlet_buffer_size(mtop, det(box), ir, -1, &ls, NULL,
+ calc_verlet_buffer_size(mtop, det(box), ir, -1, &ls, nullptr,
&rlistWithReferenceNstlist);
ir->nstlist = nstlist_prev;
}
/* Set the pair-list buffer size in ir */
- calc_verlet_buffer_size(mtop, det(box), ir, -1, &ls, NULL, &rlist_new);
+ calc_verlet_buffer_size(mtop, det(box), ir, -1, &ls, nullptr, &rlist_new);
/* Does rlist fit in the box? */
bBox = (gmx::square(rlist_new) < max_cutoff2(ir->ePBC, box));
if (!bBox || !bDD)
{
gmx_warning(!bBox ? box_err : dd_err);
- if (fp != NULL)
+ if (fp != nullptr)
{
fprintf(fp, "\n%s\n", bBox ? box_err : dd_err);
}
{
fprintf(stderr, "%s\n\n", buf);
}
- if (fp != NULL)
+ if (fp != nullptr)
{
fprintf(fp, "%s\n\n", buf);
}
*/
verletbuf_get_list_setup(TRUE, bUseGPU, &ls);
- calc_verlet_buffer_size(mtop, det(box), ir, -1, &ls, NULL, &rlist_new);
+ calc_verlet_buffer_size(mtop, det(box), ir, -1, &ls, nullptr, &rlist_new);
if (rlist_new != ir->rlist)
{
- if (fplog != NULL)
+ if (fplog != nullptr)
{
fprintf(fplog, "\nChanging rlist from %g to %g for non-bonded %dx%d atom kernels\n\n",
ir->rlist, rlist_new,
static gmx::LoggerOwner buildLogger(FILE *fplog, const t_commrec *cr)
{
gmx::LoggerBuilder builder;
- if (fplog != NULL)
+ if (fplog != nullptr)
{
builder.addTargetFile(gmx::MDLogger::LogLevel::Info, fplog);
}
gmx_ddbox_t ddbox = {0};
int npme_major, npme_minor;
t_nrnb *nrnb;
- gmx_mtop_t *mtop = NULL;
- t_mdatoms *mdatoms = NULL;
- t_forcerec *fr = NULL;
- t_fcdata *fcd = NULL;
+ gmx_mtop_t *mtop = nullptr;
+ t_mdatoms *mdatoms = nullptr;
+ t_forcerec *fr = nullptr;
+ t_fcdata *fcd = nullptr;
real ewaldcoeff_q = 0;
real ewaldcoeff_lj = 0;
- struct gmx_pme_t **pmedata = NULL;
- gmx_vsite_t *vsite = NULL;
+ struct gmx_pme_t **pmedata = nullptr;
+ gmx_vsite_t *vsite = nullptr;
gmx_constr_t constr;
int nChargePerturbed = -1, nTypePerturbed = 0, status;
gmx_wallcycle_t wcycle;
- gmx_walltime_accounting_t walltime_accounting = NULL;
+ gmx_walltime_accounting_t walltime_accounting = nullptr;
int rc;
gmx_int64_t reset_counters;
- gmx_edsam_t ed = NULL;
+ gmx_edsam_t ed = nullptr;
int nthreads_pme = 1;
- gmx_membed_t * membed = NULL;
- gmx_hw_info_t *hwinfo = NULL;
+ gmx_membed_t * membed = nullptr;
+ gmx_hw_info_t *hwinfo = nullptr;
/* The master rank decides early on bUseGPU and broadcasts this later */
gmx_bool bUseGPU = FALSE;
if (Flags & MD_APPENDFILES)
{
- fplog = NULL;
+ fplog = nullptr;
}
bool doMembed = opt2bSet("-membed", nfile, fnm);
gmx_print_detected_hardware(fplog, cr, mdlog, hwinfo);
- if (fplog != NULL)
+ if (fplog != nullptr)
{
/* Print references after all software/hardware printing */
please_cite(fplog, "Abraham2015");
{
/* Here the master rank decides if all ranks will use GPUs */
bUseGPU = (hwinfo->gpu_info.n_dev_compatible > 0 ||
- getenv("GMX_EMULATE_GPU") != NULL);
+ getenv("GMX_EMULATE_GPU") != nullptr);
/* TODO add GPU kernels for this and replace this check by:
* (bUseGPU && (ir->vdwtype == evdwPME &&
Flags);
/* the main thread continues here with a new cr. We don't deallocate
the old cr because other threads may still be reading it. */
- if (cr == NULL)
+ if (cr == nullptr)
{
gmx_comm("Failed to spawn threads");
}
gmx_bcast_sim(sizeof(bUseGPU), &bUseGPU, cr);
}
- if (fplog != NULL)
+ if (fplog != nullptr)
{
pr_inputrec(fplog, 0, "Input Parameters", inputrec, FALSE);
fprintf(fplog, "\n");
}
else
{
- pmedata = NULL;
+ pmedata = nullptr;
}
}
else
/* We don't need the state */
stateInstance.reset();
- state = NULL;
+ state = nullptr;
ewaldcoeff_q = calc_ewaldcoeff_q(inputrec->rcoulomb, inputrec->ewald_rtol);
ewaldcoeff_lj = calc_ewaldcoeff_lj(inputrec->rvdw, inputrec->ewald_rtol_lj);
*/
finish_run(fplog, mdlog, cr,
inputrec, nrnb, wcycle, walltime_accounting,
- fr ? fr->nbv : NULL,
+ fr ? fr->nbv : nullptr,
EI_DYNAMICS(inputrec->eI) && !MULTISIM(cr));
// Free PME data
if (pmedata)
{
gmx_pme_destroy(pmedata);
- pmedata = NULL;
+ pmedata = nullptr;
}
/* Free GPU memory and context */
- free_gpu_resources(fr, cr, &hwinfo->gpu_info, fr ? fr->gpu_opt : NULL);
+ free_gpu_resources(fr, cr, &hwinfo->gpu_info, fr ? fr->gpu_opt : nullptr);
if (doMembed)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
snew(fitem, 1);
fitem->nname = 0;
- fitem->name = NULL;
- fitem->set = NULL;
- fitem->get = NULL;
- fitem->def = NULL;
- fitem->help = NULL;
+ fitem->name = nullptr;
+ fitem->set = nullptr;
+ fitem->get = nullptr;
+ fitem->def = nullptr;
+ fitem->help = nullptr;
return fitem;
}
t_fgroup *fgroup;
snew(fgroup, 1);
- fgroup->name = NULL;
+ fgroup->name = nullptr;
fgroup->nfitem = 0;
- fgroup->fitem = NULL;
+ fgroup->fitem = nullptr;
return fgroup;
}
fgrid->w = 0;
fgrid->h = 0;
fgrid->nfgroup = 0;
- fgrid->fgroup = NULL;
+ fgrid->fgroup = nullptr;
fgrid->nfsimple = 0;
- fgrid->fsimple = NULL;
+ fgrid->fsimple = nullptr;
return fgrid;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
int g, i;
snew(f, 1);
- if (fn != NULL)
+ if (fn != nullptr)
{
f->grps = init_index(fn, &f->grpnames);
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
};
#define COFFS 70
static t_mess Mess[] = {
- { "GROMACS", 0, 20, NULL },
- { NULL, 16, 9, NULL },
- { "Copyright (c) 1991-2013", COFFS+ 2, 9, NULL },
- { "D.v.d.Spoel, E.Lindahl, B.Hess", COFFS+11, 9, NULL },
- { "& Groningen University ", COFFS+20, 9, NULL },
- { "click to dismiss", COFFS+31, 8, NULL }
+ { "GROMACS", 0, 20, nullptr },
+ { nullptr, 16, 9, nullptr },
+ { "Copyright (c) 1991-2013", COFFS+ 2, 9, nullptr },
+ { "D.v.d.Spoel, E.Lindahl, B.Hess", COFFS+11, 9, nullptr },
+ { "& Groningen University ", COFFS+20, 9, nullptr },
+ { "click to dismiss", COFFS+31, 8, nullptr }
};
#define NMESS asize(Mess)
int i;
logo->bQuitOnClick = bQuitOnClick;
InitWin(&logo->wd, 0, 0, 360, 270, 1, "GROMACS");
bg = LIGHTGREY;
- if ((newcol = std::getenv("GMX_LOGO_COLOR")) != NULL)
+ if ((newcol = std::getenv("GMX_LOGO_COLOR")) != nullptr)
{
GetNamedColor(x11, newcol, &bg);
}
logo->wd.x, logo->wd.y,
logo->wd.width, logo->wd.height,
logo->wd.bwidth, WHITE, bg);
- for (i = 0, logo->bigfont = NULL; (i < NBF); i++)
+ for (i = 0, logo->bigfont = nullptr; (i < NBF); i++)
{
- if ((logo->bigfont = XLoadQueryFont(x11->disp, bfname[i])) != NULL)
+ if ((logo->bigfont = XLoadQueryFont(x11->disp, bfname[i])) != nullptr)
{
break;
}
#ifdef DEBUG
std::fprintf(stderr, "Big Logofont: %s\n", bfname[i]);
#endif
- for (i = 0, logo->smallfont = NULL; (i < NSF); i++)
+ for (i = 0, logo->smallfont = nullptr; (i < NSF); i++)
{
- if ((logo->smallfont = XLoadQueryFont(x11->disp, sfname[i])) != NULL)
+ if ((logo->smallfont = XLoadQueryFont(x11->disp, sfname[i])) != nullptr)
{
break;
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
snew(man->szLab, sh.natoms);
snew(man->bHydro, sh.natoms);
snew(bB, sh.natoms);
- read_tpx_top(status, NULL, man->box, &man->natom, NULL, NULL, &man->top);
+ read_tpx_top(status, nullptr, man->box, &man->natom, nullptr, nullptr, &man->top);
man->gpbc = gmx_rmpbc_init(&man->top.idef, -1, man->natom);
man->natom =
t_manager *man;
snew(man, 1);
- man->status = NULL;
+ man->status = nullptr;
man->bPlus = true;
man->bSort = true;
man->oenv = oenv;
man->molw = init_mw(x11, man->wd.self, 0, 0, 1, 1, WHITE, BLUE, ePBC, box);
/* Title Window */
- InitWin(&(man->title), 0, 0, 1, 1, 0, NULL);
+ InitWin(&(man->title), 0, 0, 1, 1, 0, nullptr);
man->title.self = XCreateSimpleWindow(x11->disp, man->molw->wd.self,
man->title.x, man->title.y,
man->title.width, man->title.height,
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
best = 0;
besti = 0;
- if (NULL != type)
+ if (nullptr != type)
{
for (i = 0; (i < NAC); i++)
{
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{ 4, 5 }, { 5, 6 }, { 6, 7 }, { 7, 4 },
{ 0, 4 }, { 1, 5 }, { 2, 6 }, { 3, 7 }
};
- static int *edge = NULL;
+ static int *edge = nullptr;
int i, j, k, i0, i1;
rvec corner[NCUCEDGE], box_center;
vec4 x4;
if (boxtype == esbTrunc)
{
calc_compact_unitcell_vertices(view->ecenter, box, corner);
- if (edge == NULL)
+ if (edge == nullptr)
{
edge = compact_unitcell_edges();
}
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
kid->m = &(ent[l]);
kid->Parent = Parent;
w = &(kid->wd);
- InitWin(w, j*mlen, k*mht, mlen-2, mht-2, 1, NULL);
+ InitWin(w, j*mlen, k*mht, mlen-2, mht-2, 1, nullptr);
w->self = XCreateSimpleWindow(x11->disp, m->wd.self,
w->x, w->y, w->width, w->height,
w->bwidth, bg, bg);
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
case IDDOEXPORT:
write_sto_conf(gmx->confout, *gmx->man->top.name,
&(gmx->man->top.atoms),
- gmx->man->x, NULL, gmx->man->molw->ePBC, gmx->man->box);
+ gmx->man->x, nullptr, gmx->man->molw->ePBC, gmx->man->box);
break;
case IDQUIT:
show_mb(gmx, emQuit);
snew(gmx->wd, 1);
ePBC = read_tpx_top(ftp2fn(efTPR, nfile, fnm),
- NULL, box, &natom, NULL, NULL, &top);
+ nullptr, box, &natom, nullptr, nullptr, &top);
read_first_frame(oenv, &status, ftp2fn(efTRX, nfile, fnm), &fr, TRX_DONT_SKIP);
close_trx(status);
hints.min_width = 2*EWIDTH+40;
hints.min_height = EHEIGHT+LDHEIGHT+LEGHEIGHT+40;
XSetStandardProperties(x11->disp, gmx->wd->self, gmx->wd->text, program,
- pm, NULL, 0, &hints);
+ pm, nullptr, 0, &hints);
x11->RegisterCallback(x11, gmx->wd->self, x11->root, MainCallBack, gmx);
x11->SetInputMask(x11, gmx->wd->self,
gmx_output_env_t *oenv;
t_filenm fnm[] = {
- { efTRX, "-f", NULL, ffREAD },
- { efTPR, NULL, NULL, ffREAD },
- { efNDX, NULL, NULL, ffOPTRD }
+ { efTRX, "-f", nullptr, ffREAD },
+ { efTPR, nullptr, nullptr, ffREAD },
+ { efNDX, nullptr, nullptr, ffOPTRD }
};
#define NFILE asize(fnm)
if (parse_common_args(&argc, argv, PCA_CAN_TIME, NFILE, fnm,
- 0, NULL, asize(desc), desc, asize(bugs), bugs, &oenv))
+ 0, nullptr, asize(desc), desc, asize(bugs), bugs, &oenv))
{
#if !GMX_X11
std::fprintf(stderr, "Compiled without X-Windows - can not run viewer.\n");
#else
t_x11 *x11;
- if ((x11 = GetX11(&argc, argv)) == NULL)
+ if ((x11 = GetX11(&argc, argv)) == nullptr)
{
std::fprintf(stderr, "Can't connect to X Server.\n"
"Check your DISPLAY environment variable\n");
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
if (name)
{
- bFont = ((font = XLQF(err, disp, name)) != NULL);
+ bFont = ((font = XLQF(err, disp, name)) != nullptr);
}
else
{
- font = NULL;
+ font = nullptr;
}
for (i = 0; (!bFont && (i < MAXNAMES)); i++)
{
- bFont = ((font = XLQF(err, disp, fontnames[i])) != NULL);
+ bFont = ((font = XLQF(err, disp, fontnames[i])) != nullptr);
}
if (!bFont)
fontlist = XListFonts(disp, "?", 1, &count);
if (count != 0)
{
- bFont = ((font = XLQF(err, disp, fontlist[0])) != NULL);
+ bFont = ((font = XLQF(err, disp, fontlist[0])) != nullptr);
}
}
if (!bFont)
/* Filter out expose events with non-zero count field */
if (event.xexpose.count != 0)
{
- curs = NULL;
+ curs = nullptr;
}
break;
case ConfigureNotify:
item->cb = cb;
item->mask = 0;
item->data = data;
- item->next = NULL;
+ item->next = nullptr;
if (x11->wlist)
{
char **ARGV;
char *display;
char *fontname;
- char *title, *FG = NULL, *BG = NULL;
+ char *title, *FG = nullptr, *BG = nullptr;
bool bVerbose = false;
int i;
argv[i] = ARGV[i];
}
*argc = ARGC;
- argv[ARGC] = NULL;
+ argv[ARGC] = nullptr;
snew(x11, 1);
x11->dispname = display;
x11->console = stderr;
}
else
- if ((x11->console = std::fopen("/dev/null", "w")) == NULL)
+ if ((x11->console = std::fopen("/dev/null", "w")) == nullptr)
{
x11->console = stderr;
}
- if ((x11->disp = XOpenDisplay(display)) == NULL)
+ if ((x11->disp = XOpenDisplay(display)) == nullptr)
{
if (bVerbose)
{
std::fprintf(x11->console, "Display %s invalid\n", display);
}
- return NULL;
+ return nullptr;
}
- if ((x11->font = GetFont(x11->console, x11->disp, fontname)) == NULL)
+ if ((x11->font = GetFont(x11->console, x11->disp, fontname)) == nullptr)
{
- return NULL;
+ return nullptr;
}
- if ((x11->gc = GetGC(x11->disp, x11->font)) == NULL)
+ if ((x11->gc = GetGC(x11->disp, x11->font)) == nullptr)
{
- return NULL;
+ return nullptr;
}
x11->root = DefaultRootWindow(x11->disp);
}
x11->title = gmx_strdup(title);
sfree(title);
- x11->wlist = NULL;
+ x11->wlist = nullptr;
x11->GetNamedColor = &GetNamedColor;
x11->MainLoop = &MainLoop;
x11->RegisterCallback = &RegisterCallback;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2004, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
return dlg->dlgitem[i];
}
}
- return NULL;
+ return nullptr;
}
t_dlgitem *FindWin(t_dlg *dlg, Window win)
return dlg->dlgitem[i];
}
}
- return NULL;
+ return nullptr;
}
/*****************************
{
t_dlgitem *dlgitem;
- if ((dlgitem = FindItem(dlg, id)) != NULL)
+ if ((dlgitem = FindItem(dlg, id)) != nullptr)
{
*w = dlgitem->win.width;
*h = dlgitem->win.height;
{
t_dlgitem *dlgitem;
- if ((dlgitem = FindItem(dlg, id)) != NULL)
+ if ((dlgitem = FindItem(dlg, id)) != nullptr)
{
*x0 = dlgitem->win.x;
*y0 = dlgitem->win.y;
{
t_dlgitem *dlgitem;
- if ((dlgitem = FindItem(dlg, id)) != NULL)
+ if ((dlgitem = FindItem(dlg, id)) != nullptr)
{
return dlgitem->win.x;
}
{
t_dlgitem *dlgitem;
- if ((dlgitem = FindItem(dlg, id)) != NULL)
+ if ((dlgitem = FindItem(dlg, id)) != nullptr)
{
return dlgitem->win.y;
}
{
t_dlgitem *dlgitem;
- if ((dlgitem = FindItem(dlg, id)) != NULL)
+ if ((dlgitem = FindItem(dlg, id)) != nullptr)
{
return dlgitem->win.width;
}
{
t_dlgitem *dlgitem;
- if ((dlgitem = FindItem(dlg, id)) != NULL)
+ if ((dlgitem = FindItem(dlg, id)) != nullptr)
{
return dlgitem->win.height;
}
int old_w, old_h;
#endif
- if ((dlgitem = FindItem(dlg, id)) != NULL)
+ if ((dlgitem = FindItem(dlg, id)) != nullptr)
{
#ifdef DEBUG
old_w = dlgitem->win.width;
t_dlgitem *dlgitem;
int old_x, old_y;
- if ((dlgitem = FindItem(dlg, id)) != NULL)
+ if ((dlgitem = FindItem(dlg, id)) != nullptr)
{
old_x = dlgitem->win.x;
old_y = dlgitem->win.y;
{
t_dlgitem *dlgitem;
- if ((dlgitem = FindItem(dlg, id)) != NULL)
+ if ((dlgitem = FindItem(dlg, id)) != nullptr)
{
if (dlgitem->type == edlgCB)
{
{
t_dlgitem *dlgitem;
- if ((dlgitem = FindItem(dlg, id)) != NULL)
+ if ((dlgitem = FindItem(dlg, id)) != nullptr)
{
if (dlgitem->type == edlgET)
{
{
t_dlgitem *dlgitem;
- if ((dlgitem = FindItem(dlg, id)) != NULL)
+ if ((dlgitem = FindItem(dlg, id)) != nullptr)
{
if (dlgitem->type == edlgET)
{
}
}
- return NULL;
+ return nullptr;
}
/*****************************
"No help for this item"
};
MessageBox(dlg->x11, dlg->wDad, "No Help", 2, lines,
- MB_OK | MB_ICONSTOP | MB_APPLMODAL, NULL, NULL);
+ MB_OK | MB_ICONSTOP | MB_APPLMODAL, nullptr, nullptr);
}
void HelpDlg(t_dlg *dlg)
"First press the OK button."
};
MessageBox(dlg->x11, dlg->win.self, "Help Dialogbox",
- 3, lines, MB_OK | MB_ICONINFORMATION | MB_APPLMODAL, NULL, NULL);
+ 3, lines, MB_OK | MB_ICONINFORMATION | MB_APPLMODAL, nullptr, nullptr);
}
void HelpNow(t_dlg *dlg, t_dlgitem *dlgitem)
char buf[80];
bool bCont = true;
int i, nlines = 0;
- char **lines = NULL;
+ char **lines = nullptr;
if (!dlgitem->help)
{
while (bCont);
MessageBox(dlg->x11, dlg->wDad, "Help",
nlines, lines,
- MB_OK | MB_ICONINFORMATION | MB_APPLMODAL, NULL, NULL);
+ MB_OK | MB_ICONINFORMATION | MB_APPLMODAL, nullptr, nullptr);
for (i = 0; (i < nlines); i++)
{
sfree(lines[i]);
int i, nWndProc;
t_dlgitem *dlgitem;
- if ((dlgitem = FindWin(dlg, w)) != NULL)
+ if ((dlgitem = FindWin(dlg, w)) != nullptr)
{
nWndProc = (dlgitem->WndProc)(x11, dlgitem, event);
#ifdef DEBUG
hints.y = dlg->win.y;
hints.flags = PPosition;
XSetStandardProperties(dlg->x11->disp, dlg->win.self, dlg->title,
- dlg->title, None, NULL, 0, &hints);
+ dlg->title, None, nullptr, 0, &hints);
}
void AddDlgItem(t_dlg *dlg, t_dlgitem *item)
t_dlgitem *dlgitem;
int i;
- if ((dlgitem = FindItem(dlg, id)) != NULL)
+ if ((dlgitem = FindItem(dlg, id)) != nullptr)
{
dlg->x11->UnRegisterCallback(dlg->x11, dlgitem->win.self);
if (dlgitem->win.self)
{
XDestroyWindow(dlg->x11->disp, dlg->win.self);
}
- dlg->dlgitem = NULL;
+ dlg->dlgitem = nullptr;
}
}
}
else
{
- dlg->title = NULL;
+ dlg->title = nullptr;
}
if (w == 0)
{
{
y = y0;
}
- InitWin(&(dlg->win), x, y, w, h, bw, NULL);
+ InitWin(&(dlg->win), x, y, w, h, bw, nullptr);
SetDlgSize(dlg, w, h, x0 || y0);
dlg->wDad = Parent;
dlg->fg = x11->fg;
dlg->bg = x11->bg;
dlg->nitem = 0;
- dlg->dlgitem = NULL;
+ dlg->dlgitem = nullptr;
DoCreateDlg(dlg);
return dlg;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
for (j = 0; (j < h); j++)
{
grid[i][j].nitem = 0;
- grid[i][j].list = NULL;
+ grid[i][j].list = nullptr;
}
}
return grid;
GroupID = (*ID)++;
item = &(grid[fgroup->x][fgroup->y]);
AddListItem(item, CreateGroupBox(x11, fgroup->name, GroupID,
- 0, NULL, 0, 0, 0, 0, 0));
+ 0, nullptr, 0, 0, 0, 0, 0));
x = 2*OFFS_X;
y = item->list[0]->win.y+item->list[0]->win.height;
w = 0;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
return DefWndProc(x11, dlgitem, event);
}
- XLookupString(&(event->xkey), c, BUFSIZE, &keysym, NULL);
+ XLookupString(&(event->xkey), c, BUFSIZE, &keysym, nullptr);
#ifdef DEBUG
std::printf("Keysym: %x\n", keysym);
#endif
t_dlgitem *dlgitem;
dlgitem = newitem();
- InitWin(&(dlgitem->win), x0, y0, w, h, bw, NULL);
+ InitWin(&(dlgitem->win), x0, y0, w, h, bw, nullptr);
dlgitem->ID = id;
dlgitem->type = edlgPM;
dlgitem->u.pixmap.pm = pm;
}
w += 2*OFFS_X;
}
- InitWin(&(dlgitem->win), x0, y0, w, h, bw, NULL);
+ InitWin(&(dlgitem->win), x0, y0, w, h, bw, nullptr);
dlgitem->ID = id;
dlgitem->GroupID = groupid;
dlgitem->type = edlgST;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
#define ID_ICON -2
#define ID_TEXT -1
-static bmchar *icon_bits = NULL;
+static bmchar *icon_bits = nullptr;
static int icon_width = 0;
static int icon_height = 0;
static unsigned long icon_fg = 0;
*
* Copyright (c) 1991-2000, University of Groningen, The Netherlands.
* Copyright (c) 2001-2013, The GROMACS development team.
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
const char *s, int x, int y, int width, int height,
eXPos eX, eYPos eY)
{
- SpecialTextInRect(x11, NULL, win, s, x, y, width, height, eX, eY);
+ SpecialTextInRect(x11, nullptr, win, s, x, y, width, height, eX, eY);
}
void TextInWin(t_x11 *x11, t_windata *win,
}
else
{
- win->text = NULL;
+ win->text = nullptr;
}
#ifdef DEBUG
std::printf("%s: %d x %d at %d, %d\n", text, w, h, x0, y0);
struct t_mpos *prev;
} t_mpos;
-static t_mpos *mpos = NULL;
+static t_mpos *mpos = nullptr;
void PushMouse(Display *disp, Window dest, int x, int y)
{
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
for (size_t i = 0; i < count; ++i)
{
char *arg = strdup(cmdline[i]);
- if (arg == NULL)
+ if (arg == nullptr)
{
throw std::bad_alloc();
}
args_.push_back(arg);
argv_.push_back(arg);
}
- argv_.push_back(NULL);
+ argv_.push_back(nullptr);
}
CommandLine::Impl::~Impl()
*/
CommandLine::CommandLine()
- : impl_(new Impl(NULL, 0))
+ : impl_(new Impl(nullptr, 0))
{
}
impl_->args_.reserve(newSize);
impl_->argv_.reserve(newSize + 1);
char *newArg = strdup(arg);
- if (newArg == NULL)
+ if (newArg == nullptr)
{
throw std::bad_alloc();
}
impl_->args_.push_back(newArg);
impl_->argv_.pop_back(); // Remove the trailing NULL.
impl_->argv_.push_back(newArg);
- impl_->argv_.push_back(NULL);
+ impl_->argv_.push_back(nullptr);
impl_->argc_ = static_cast<int>(newSize);
}
{
// The name and description are not used in the tests, so they can be NULL.
const std::unique_ptr<ICommandLineModule> wrapperModule(
- ICommandLineOptionsModule::createModule(NULL, NULL, std::move(module)));
+ ICommandLineOptionsModule::createModule(nullptr, nullptr, std::move(module)));
return runModuleDirect(wrapperModule.get(), commandLine);
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
std::string fakeStdin("fake-stdin");
gmx::TextWriter::writeFileFromString(fakeStdin, theString);
- if (NULL == std::freopen(fakeStdin.c_str(), "r", stdin))
+ if (nullptr == std::freopen(fakeStdin.c_str(), "r", stdin))
{
GMX_THROW_WITH_ERRNO(FileIOError("Failed to redirect a string to stdin"),
"freopen",
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
}
ReferenceDataEntry(const char *type, const char *id)
- : type_(type), id_(id != NULL ? id : ""), isTextBlock_(false),
- hasBeenChecked_(false), correspondingOutputEntry_(NULL)
+ : type_(type), id_(id != nullptr ? id : ""), isTextBlock_(false),
+ hasBeenChecked_(false), correspondingOutputEntry_(nullptr)
{
}
bool idMatches(const char *id) const
{
- return (id == NULL && id_.empty()) || (id != NULL && id_ == id);
+ return (id == nullptr && id_.empty()) || (id != nullptr && id_ == id);
}
ChildIterator findChild(const char *id, const ChildIterator &prev) const
bool wrappingSearch = true;
if (child != children_.end())
{
- if (id == NULL && (*child)->id().empty())
+ if (id == nullptr && (*child)->id().empty())
{
wrappingSearch = false;
++child;
}
void setCorrespondingOutputEntry(ReferenceDataEntry *entry)
{
- GMX_RELEASE_ASSERT(correspondingOutputEntry_ == NULL,
+ GMX_RELEASE_ASSERT(correspondingOutputEntry_ == nullptr,
"Output entry already exists");
correspondingOutputEntry_ = entry;
}
/*
* 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,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.
{
GMX_RELEASE_ASSERT(initialized(),
"Accessing uninitialized reference data checker.");
- return compareRootEntry_ == NULL;
+ return compareRootEntry_ == nullptr;
}
//! Whether initialized with other means than the default constructor.
TestReferenceChecker::Impl::Impl(bool initialized)
: initialized_(initialized), defaultTolerance_(defaultRealTolerance()),
- compareRootEntry_(NULL), outputRootEntry_(NULL),
+ compareRootEntry_(nullptr), outputRootEntry_(nullptr),
updateMismatchingEntries_(false), bSelfTestMode_(false), seqIndex_(-1)
{
}
lastFoundEntry_ = entry;
return entry->get();
}
- return NULL;
+ return nullptr;
}
ReferenceDataEntry *
const IReferenceDataEntryChecker &checker)
{
ReferenceDataEntry *entry = findEntry(id);
- if (entry == NULL && outputRootEntry_ != NULL)
+ if (entry == nullptr && outputRootEntry_ != nullptr)
{
lastFoundEntry_ = compareRootEntry_->addChild(createEntry(type, id, checker));
entry = lastFoundEntry_->get();
}
std::string fullId = appendPath(id);
ReferenceDataEntry *entry = findOrCreateEntry(type, id, checker);
- if (entry == NULL)
+ if (entry == nullptr)
{
return ::testing::AssertionFailure()
<< "Reference data item " << fullId << " not found";
}
entry->setChecked();
::testing::AssertionResult result(checkEntry(*entry, fullId, type, checker));
- if (outputRootEntry_ != NULL && entry->correspondingOutputEntry() == NULL)
+ if (outputRootEntry_ != nullptr && entry->correspondingOutputEntry() == nullptr)
{
if (!updateMismatchingEntries_ || result)
{
bool TestReferenceChecker::checkPresent(bool bPresent, const char *id)
{
- if (impl_->shouldIgnore() || impl_->outputRootEntry_ != NULL)
+ if (impl_->shouldIgnore() || impl_->outputRootEntry_ != nullptr)
{
return bPresent;
}
std::string fullId = impl_->appendPath(id);
NullChecker checker;
ReferenceDataEntry *entry = impl_->findOrCreateEntry(type, id, checker);
- if (entry == NULL)
+ if (entry == nullptr)
{
ADD_FAILURE() << "Reference data item " << fullId << " not found";
return TestReferenceChecker(new Impl(true));
return TestReferenceChecker(new Impl(true));
}
}
- if (impl_->outputRootEntry_ != NULL && entry->correspondingOutputEntry() == NULL)
+ if (impl_->outputRootEntry_ != nullptr && entry->correspondingOutputEntry() == nullptr)
{
impl_->outputRootEntry_->addChild(entry->cloneToOutputEntry());
}
/*
* 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,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.
TestReferenceChecker compound(checkSequenceCompound(id, length));
for (Iterator i = begin; i != end; ++i)
{
- compound.checkValue(*i, NULL);
+ compound.checkValue(*i, nullptr);
}
}
/*! \brief
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015, by the GROMACS development team, led by
+ * Copyright (c) 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.
};
std::string TestFileManager::Impl::s_inputDirectory;
-const char *TestFileManager::Impl::s_globalOutputTempDirectory = NULL;
+const char *TestFileManager::Impl::s_globalOutputTempDirectory = nullptr;
/** Controls whether TestFileManager should delete temporary files
after the test finishes. */
static bool g_bDeleteFilesAfterTest = true;
const char *TestFileManager::getGlobalOutputTempDirectory()
{
- GMX_RELEASE_ASSERT(Impl::s_globalOutputTempDirectory != NULL, "Global path for temporary output files from tests is not set");
+ GMX_RELEASE_ASSERT(Impl::s_globalOutputTempDirectory != nullptr, "Global path for temporary output files from tests is not set");
return Impl::s_globalOutputTempDirectory;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
{
if (existingFiles_.count(filename) == 0)
{
- File::NotFoundInfo info(filename, "File not present in test", NULL, false, 0);
+ File::NotFoundInfo info(filename, "File not present in test", nullptr, false, 0);
onNotFound(info);
return false;
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2012,2013,2014,2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
"\nYou can use the following GROMACS-specific command-line flags\n"
"to control the behavior of the tests:\n\n");
TextWriter writer(&TextOutputFile::standardError());
- CommandLineHelpContext context(&writer, eHelpOutputFormat_Console, NULL, program);
+ CommandLineHelpContext context(&writer, eHelpOutputFormat_Console, nullptr, program);
context.setModuleDisplayName(program);
CommandLineHelpWriter(options).writeHelp(context);
}
setProgramContext(g_testContext.get());
// Use the default finder that does not respect GMXLIB, since the tests
// generally can only get confused by a different set of data files.
- setLibraryFileFinder(NULL);
+ setLibraryFileFinder(nullptr);
::testing::InitGoogleMock(argc, *argv);
- if (dataPath != NULL)
+ if (dataPath != nullptr)
{
TestFileManager::setInputDataDirectory(
Path::join(CMAKE_SOURCE_DIR, dataPath));
}
- if (tempPath != NULL)
+ if (tempPath != nullptr)
{
TestFileManager::setGlobalOutputTempDirectory(tempPath);
}
void finalizeTestUtils()
{
- setProgramContext(NULL);
+ setProgramContext(nullptr);
g_testContext.reset();
finalizeForCommandLine();
}
/*
* 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,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.
//! Helper function for HandlesSequenceOfCustomData
void checkCustomVector(TestReferenceChecker *checker, const dvec &value)
{
- checker->checkVector(value, NULL);
+ checker->checkVector(value, nullptr);
}
TEST(ReferenceDataTest, HandlesSequenceOfCustomData)
TestReferenceChecker checker(data.rootChecker());
for (const auto &s : strings)
{
- checker.checkString(s, NULL);
- checker.checkTextBlock(s, NULL);
+ checker.checkString(s, nullptr);
+ checker.checkTextBlock(s, nullptr);
}
}
{
TestReferenceChecker checker(data.rootChecker());
for (const auto &s : strings)
{
- checker.checkString(s, NULL);
- checker.checkTextBlock(s, NULL);
+ checker.checkString(s, nullptr);
+ checker.checkTextBlock(s, nullptr);
}
}
}
{
TestReferenceData data(gmx::test::erefdataUpdateAll);
TestReferenceChecker checker(data.rootChecker());
- checker.checkString("Test", NULL);
- checker.checkString("Test2", NULL);
+ checker.checkString("Test", nullptr);
+ checker.checkString("Test2", nullptr);
}
{
TestReferenceData data(gmx::test::erefdataCompare);
TestReferenceChecker checker(data.rootChecker());
- checker.checkString("Test", NULL);
- checker.checkString("Test2", NULL);
- EXPECT_NONFATAL_FAILURE(checker.checkString("Test", NULL), "");
+ checker.checkString("Test", nullptr);
+ checker.checkString("Test2", nullptr);
+ EXPECT_NONFATAL_FAILURE(checker.checkString("Test", nullptr), "");
}
}
TestReferenceData data(gmx::test::erefdataUpdateAll);
TestReferenceChecker checker(data.rootChecker());
checker.checkInteger(1, "int1");
- checker.checkString("Test", NULL);
- checker.checkString("Test2", NULL);
+ checker.checkString("Test", nullptr);
+ checker.checkString("Test2", nullptr);
checker.checkInteger(2, "int2");
- EXPECT_NONFATAL_FAILURE(checker.checkString("Test3", NULL), "");
- checker.checkString("Test2", NULL);
+ EXPECT_NONFATAL_FAILURE(checker.checkString("Test3", nullptr), "");
+ checker.checkString("Test2", nullptr);
}
{
TestReferenceData data(gmx::test::erefdataCompare);
TestReferenceChecker checker(data.rootChecker());
checker.checkInteger(1, "int1");
- checker.checkString("Test", NULL);
- checker.checkString("Test2", NULL);
+ checker.checkString("Test", nullptr);
+ checker.checkString("Test2", nullptr);
checker.checkInteger(2, "int2");
- EXPECT_NONFATAL_FAILURE(checker.checkString("Test3", NULL), "");
+ EXPECT_NONFATAL_FAILURE(checker.checkString("Test3", nullptr), "");
checker.checkInteger(1, "int1");
- checker.checkString("Test", NULL);
- checker.checkString("Test2", NULL);
- EXPECT_NONFATAL_FAILURE(checker.checkString("Test", NULL), "");
+ checker.checkString("Test", nullptr);
+ checker.checkString("Test2", nullptr);
+ EXPECT_NONFATAL_FAILURE(checker.checkString("Test", nullptr), "");
checker.checkInteger(2, "int2");
- EXPECT_NONFATAL_FAILURE(checker.checkString("Test3", NULL), "");
+ EXPECT_NONFATAL_FAILURE(checker.checkString("Test3", nullptr), "");
}
}
/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2015,2016, by the GROMACS development team, led by
+ * Copyright (c) 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.
//! Helper function to check a single xvg value in a sequence.
void checkXvgDataPoint(TestReferenceChecker *checker, const std::string &value)
{
- checker->checkRealFromString(value, NULL);
+ checker->checkRealFromString(value, nullptr);
}
} // namespace