hoomd.custom.Action issue with MPI

36 views
Skip to first unread message

Xinyan Yang

unread,
Dec 10, 2023, 11:44:54 AM12/10/23
to hoomd-users
Hi,

I wrote a hoomd.custom.Action and updater. Here is a simpler version of my action code:
-----------------------------------------------------------------------------------
class TestAction(hoomd.custom.Action):

    def act(self, timestep):
        # get snapshot by all ranks
        snap = self._state.get_snapshot()

         # update particle positions with root rank
        if rank==0:
            snap.particles.position[[10,20]] = np.vstack([snap.particles.position[[10,20]][:,0] + 0.1*timestep
            snap.particles.position[[10,20]][:,1],
            snap.particles.position[[10,20]][:,2]]).T

        communicator.barrier_all()
        # set new snapshot by all ranks after the position update is complete
        self._state.set_snapshot(snap)    
        pass
-----------------------------------------------------------------------------------
It updates some particle positions every timestep. The particles to be updated are bonded to some center particles of rigid bodies.

 It runs well for 1-core simulation. However, when I turned to MPI run with many cores, there is always an error message "RuntimeError: Error while updating constituent particles:Composite particle with body tag xxx incomplete ..." Did I use get_snapshot() and set_snapshot() incorrectly? Any help would be appreciated. Thank you!

Best,
Xinyan

Reply all
Reply to author
Forward
0 new messages