+ }
+
+ if (bNS)
+ {
+ for (int a = a_tp0; a < a_tp1; a++)
+ {
+ x[a] = x_init;
+ }
+
+ /* Put the inserted molecule on it's own search grid */
+ nbnxn_put_on_grid(fr->nbv.get(), box,
+ 1, x_init, x_init,
+ nullptr, a_tp0, a_tp1, -1,
+ fr->cginfo, x,
+ 0, nullptr);
+
+ /* TODO: Avoid updating all atoms at every bNS step */
+ fr->nbv->setAtomProperties(*mdatoms, fr->cginfo);
+
+ fr->nbv->constructPairlist(Nbnxm::InteractionLocality::Local,
+ &top.excls, step, nrnb);
+
+ bNS = FALSE;
+ }
+
+ /* Add random displacement uniformly distributed in a sphere
+ * of radius rtpi. We don't need to do this is we generate
+ * a new center location every step.
+ */
+ rvec x_tp;
+ if (bCavity || inputrec->nstlist > 1)
+ {