GmxBackendData(const NBKernelOptions& options,
int numEnergyGroups,
gmx::ArrayRef<int> exclusionRanges,
- gmx::ArrayRef<int> exclusionElements)
+ gmx::ArrayRef<int> exclusionElements) :
+ numThreads_(options.numOpenMPThreads)
{
// Set hardware params from the execution context
setGmxNonBondedNThreads(options.numOpenMPThreads);
//! Non-bonded flop counter; currently only needed as an argument for dispatchNonbondedKernel
t_nrnb nrnb_;
+ //! Number of OpenMP threads to use
+ int numThreads_;
+
//! Keep track of whether updatePairlist has been called at least once
bool updatePairlistCalled{ false };
};
const NBKernelOptions& options);
//! calculates a new pair list based on new coordinates (for every NS step)
- void updatePairlist(gmx::ArrayRef<const gmx::RVec> coordinates, const Box& box);
+ void updatePairlist(gmx::ArrayRef<gmx::RVec> coordinates, const Box& box);
//! Compute forces and return
void compute(gmx::ArrayRef<const gmx::RVec> coordinateInput,
system_.nonBondedParams_);
}
-void GmxNBForceCalculatorCpu::CpuImpl::updatePairlist(gmx::ArrayRef<const gmx::RVec> coordinates,
- const Box& box)
+void GmxNBForceCalculatorCpu::CpuImpl::updatePairlist(gmx::ArrayRef<gmx::RVec> coordinates, const Box& box)
{
if (coordinates.size() != system_.numParticles_)
{
const real particleDensity = static_cast<real>(coordinates.size()) / det(legacyBox);
+ // If particles are too far outside the box, the grid setup can fail
+ put_atoms_in_box_omp(PbcType::Xyz, box.legacyMatrix(), coordinates, backend_.numThreads_);
+
// Put particles on a grid based on bounds specified by the box
nbnxn_put_on_grid(backend_.nbv_.get(),
legacyBox,
GmxNBForceCalculatorCpu::~GmxNBForceCalculatorCpu() = default;
//! calculates a new pair list based on new coordinates (for every NS step)
-void GmxNBForceCalculatorCpu::updatePairlist(gmx::ArrayRef<const gmx::RVec> coordinates, const Box& box)
+void GmxNBForceCalculatorCpu::updatePairlist(gmx::ArrayRef<gmx::RVec> coordinates, const Box& box)
{
impl_->updatePairlist(coordinates, box);
}
~GmxNBForceCalculatorCpu();
//! calculates a new pair list based on new coordinates (for every NS step)
- void updatePairlist(gmx::ArrayRef<const gmx::RVec> coordinates, const Box& box);
+ void updatePairlist(gmx::ArrayRef<gmx::RVec> coordinates, const Box& box);
//! Compute forces and return
void compute(gmx::ArrayRef<const gmx::RVec> coordinateInput,
}
}
+LeapFrog::LeapFrog(gmx::ArrayRef<const real> inverseMasses, const Box& box) :
+ inverseMasses_(inverseMasses.begin(), inverseMasses.end()), box_(box)
+{
+}
+
void LeapFrog::integrate(const real dt, gmx::ArrayRef<Vec3> x, gmx::ArrayRef<Vec3> v, gmx::ArrayRef<const Vec3> f)
{
for (size_t i = 0; i < x.size(); i++)
x[i][dim] += v[i][dim] * dt;
}
}
- put_atoms_in_box(PbcType::Xyz, box_.legacyMatrix(), x);
}
} // namespace nblib
*/
LeapFrog(const Topology& topology, const Box& box);
+ /*! \brief Constructor.
+ *
+ * \param[in] masses List of inverse masses.
+ * \param[in] box Box object for ensuring that coordinates remain within bounds
+ */
+ LeapFrog(gmx::ArrayRef<const real> inverseMasses, const Box& box);
+
/*! \brief Integrate
*
* Integrates the equation of motion using Leap-Frog algorithm.