{
ensureNoPendingCudaError("In CUDA version of LINCS");
+ // Early exit if no constraints
+ if (kernelParams_.numConstraintsThreads == 0)
+ {
+ return;
+ }
+
if (computeVirial)
{
// Fill with zeros so the values can be reduced to it
t_iatom *iatoms = idef.il[F_CONSTR].iatoms;
const int stride = NRAL(F_CONSTR) + 1;
const int numConstraints = idef.il[F_CONSTR].nr/stride;
+
+ // Early exit if no constraints
+ if (numConstraints == 0)
+ {
+ kernelParams_.numConstraintsThreads = 0;
+ return;
+ }
+
// Constructing adjacency list --- usefull intermediate structure
std::vector<std::vector<std::tuple<int, int, int> > > atomsAdjacencyList(numAtoms);
for (int c = 0; c < numConstraints; c++)
ensureNoPendingCudaError("In CUDA version SETTLE");
+ // Early exit if no settles
+ if (numSettles_ == 0)
+ {
+ return;
+ }
+
if (computeVirial)
{
// Fill with zeros so the values can be reduced to it
static_assert(c_threadsPerBlock > 0 && ((c_threadsPerBlock & (c_threadsPerBlock - 1)) == 0),
"Number of threads per block should be a power of two in order for reduction to work.");
+ // This is to prevent the assertion failure for the systems without water
+ int totalSettles = 0;
+ for (unsigned mt = 0; mt < mtop.moltype.size(); mt++)
+ {
+ const int nral1 = 1 + NRAL(F_SETTLE);
+ InteractionList interactionList = mtop.moltype.at(mt).ilist[F_SETTLE];
+ std::vector<int> iatoms = interactionList.iatoms;
+ totalSettles += iatoms.size()/nral1;
+ }
+ if (totalSettles == 0)
+ {
+ return;
+ }
+
// TODO This should be lifted to a separate subroutine that gets the values of Oxygen and Hydrogen
// masses, checks if they are consistent across the topology and if there is no more than two values
// for each mass if the free energy perturbation is enabled. In later case, masses may need to be
SettleCuda::Impl::~Impl()
{
+ // Early exit if there is no settles
+ if (numSettles_ == 0)
+ {
+ return;
+ }
freeDeviceBuffer(&d_virialScaled_);
if (h_atomIds_.size() > 0)
{