From 33c16cf276bcb50b868e6b9cbc88246b17a754bb Mon Sep 17 00:00:00 2001 From: Tim Moore Date: Wed, 18 Dec 2024 00:39:35 -0500 Subject: [PATCH] Do not wrap particles until rebuilding the tree This was causing the tree to never be rebuilt because the particles were wrapped back into the primary image before the displacement check was performed. And since the diaplacement check used the minimum plane-to-plane distance, the particle could never really move far enough to trigger a rebuild. This may have been leading to rare overlaps. --- hoomd/hpmc/UpdaterVirtualMoveMonteCarlo.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/hoomd/hpmc/UpdaterVirtualMoveMonteCarlo.h b/hoomd/hpmc/UpdaterVirtualMoveMonteCarlo.h index 3a7040d8f5..672e41b3b4 100644 --- a/hoomd/hpmc/UpdaterVirtualMoveMonteCarlo.h +++ b/hoomd/hpmc/UpdaterVirtualMoveMonteCarlo.h @@ -1128,7 +1128,6 @@ template void UpdaterVMMC::update(uint64_t timestep) vec3 new_pos = m_positions_after_move[idx]; h_postype.data[idx] = make_scalar4(new_pos.x, new_pos.y, new_pos.z, postype_idx.w); - box.wrap(h_postype.data[idx], h_image.data[idx]); vec3 displacement = vec3(h_postype.data[idx]) - vec3(h_pos_last_tree_build.data[idx]); @@ -1149,13 +1148,16 @@ template void UpdaterVMMC::update(uint64_t timestep) // update pos_last_tree_build for (unsigned int idx = 0; idx < m_pdata->getN(); idx++) { + box.wrap(h_postype.data[idx], h_image.data[idx]); h_pos_last_tree_build.data[idx] = h_postype.data[idx]; } + m_count_total.num_aabbtree_builds++; } else { for (unsigned int idx = 0; idx < m_pdata->getN(); idx++) { + // TODO: only loop over the m_cluster_data elements if (!(m_cluster_data.m_linkers_added.find(idx) == m_cluster_data.m_linkers_added.end())) {