/*
* This file is part of the GROMACS molecular simulation package.
*
- * Copyright (c) 2019, by the GROMACS development team, led by
+ * Copyright (c) 2019,2020, by the GROMACS development team, led by
* Mark Abraham, David van der Spoel, Berk Hess, and 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_.stepsSinceLastCalculation_ = 1;
- // do nothing if there are no density fitting atoms on this node
- if (localAtomSet_.numAtomsLocal() == 0)
- {
- return;
- }
transformedCoordinates_.resize(localAtomSet_.numAtomsLocal());
// pick and copy atom coordinates
std::transform(std::cbegin(localAtomSet_.localIndex()), std::cend(localAtomSet_.localIndex()),
if (parameters_.normalizeDensities_)
{
real sum = std::accumulate(std::begin(amplitudes), std::end(amplitudes), 0.);
- if (PAR(&forceProviderInput.cr_))
+ if (havePPDomainDecomposition(&forceProviderInput.cr_))
{
gmx_sum(1, &sum, &forceProviderInput.cr_);
}
}
// communicate grid
- if (PAR(&forceProviderInput.cr_))
+ if (havePPDomainDecomposition(&forceProviderInput.cr_))
{
// \todo update to real once GaussTransform class returns real
gmx_sumf(gaussTransform_.view().mapping().required_span_size(),
++densityForceIterator;
}
- // calculate corresponding potential energy
const float similarity = measure_.similarity(gaussTransform_.constView());
- const real energy = -similarity * parameters_.forceConstant_ * state_.adaptiveForceConstantScale_;
- forceProviderOutput->enerd_.term[F_DENSITYFITTING] += energy;
+ if (MASTER(&(forceProviderInput.cr_)))
+ {
+ // calculate corresponding potential energy
+ const real energy = -similarity * parameters_.forceConstant_ * state_.adaptiveForceConstantScale_;
+ forceProviderOutput->enerd_.term[F_DENSITYFITTING] += energy;
+ }
if (expAverageSimilarity_.has_value())
{
}
else
{
- state_.adaptiveForceConstantScale_ *= 1._real + expAverageSimilarity_->inverseTimeConstant();
+ state_.adaptiveForceConstantScale_ *=
+ 1._real + 2 * expAverageSimilarity_->inverseTimeConstant();
}
}
}