removing writer from simulation in hoomd v3

24 views
Skip to first unread message

Ali Ehlen

unread,
Aug 24, 2021, 1:43:24 PMAug 24
to hoomd...@googlegroups.com
Hello! I am playing around with switching one of my projects over to hoomd v3 to test it out and came up on a question.

What is the right way to remove a writer from a simulation and replace it with a new one? Based on the current documentation, it seems that this should be
```sim.operations.writers.remove(writer_object)```, but that does not give me the behavior I expect.

For context, I am trying to run a simulation which has an equilibration phase and a production phase (as usual). I'd like to write simulation progress to stdout the whole time, but save a log file and a gsd file for the equilibration phase, then close those and start a new log file and a new gsd file for the production phase. Base on my tests, it seems that the command that should remove the writer of the equilibration log file is actually removing the stdout writer of simulation progress.

Apologies if this is a repeat---I've looked in open issues to see if this has been discussed but I haven't seen anything similar. I've attached a script that reproduces the behavior.

Thank you!

Ali

PS. I really like a lot of the new structures in hoomd v3! Thanks for all the work you're putting in to make this happen!
minimal_example.py

Brandon Butler

unread,
Aug 25, 2021, 11:25:20 AMAug 25
to hoomd...@googlegroups.com

Hey Ali,

You have found a real bug. In essence, one of the `__eq__` methods is incorrectly returning `True` leading to remove removing the wrong object. For now, clearing the list and adding the desired writers back, or simply setting `sim.operations.writers = new_writers` to a new list should work. (I am going to work on merging the appropriate fix soon, but in the current beta release my suggestions will be required.)

Also, thanks for the complement on the new v3 API. :)

Best,

--
Brandon Butler
MolSSI Fellow
PhD Candidate, Chemical Engineering and Scientific Computing | Glotzer Lab, University of Michigan
Email: butl...@umich.edu

--
You received this message because you are subscribed to the Google Groups "hoomd-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoomd-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/CAEP6-6vT58ns3hEqw0vg7i6oM%3DYSHyWRT-bx9zrLYT-ZyWFnDg%40mail.gmail.com.

annaliese...@u.northwestern.edu

unread,
Aug 25, 2021, 11:49:18 AMAug 25
to hoomd-users
Hi Brandon,

Ah, got it, that makes sense. And yep, that workaround will be fine for now. Thank you!!

Ali
Reply all
Reply to author
Forward
0 new messages