Changing Rigid body type not reflected in output gsd #1770
-
Hello, We are using HOOMD to simulate assembly of rigid subunits with allostery. Our simplest model consists of rigid bodies with binding sites that can be active or inactive, and change conformation during a simulation. We have two different rigid body representations, one is active and the other is inactive, with the only difference between them being binding sites have type 'A' for the active subunit and "I" for the inactive subunit. We have a Monte Carlo algorithm for switching between these two states, which is run every t_swap integration time steps. To perform a swap, we update the typeid for each particle with a given bodyid to match the types of the opposite state. For example, if the types are ['Active', 'A', 'Inactive', I], we would change the typeids from [0,1] to [2,3] for a hypothetical subunit with 1 binding site. I find that the simulation itself handles these type changes correctly; if I start with all inactive particles and swap them all to active during the simulation, they will assemble as expected. However, when I go to analyze the output gsd file from the simulation, all of the particle typeids reflect what they were in the first frame that was written to the gsd file. This makes visualizing how the type changes affect the dynamics very difficult. I have included a simplified example of this behavior in the attached script. It uses the dimer example from the rigid body tutorial, and I swap between two of them that are identical except for their particle types. Every time I perform a swap, I print out snap.particles.typeid for the current simulation state to show that they are indeed being changed correctly. I then open the gsd file and print the same array in the first and last frame, finding that they are the same. My output looks like this: The attached code was written for HOOMD version 3.9.0, but I also had a colleague run it on 4.1 and got the same results that I did. You'll have to remove the charges and diameters keys if running on 4. Thanks for your assistance! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
HOOMD-blue's GSD writer only writes the box, number of particles, positions, and orientations on every frame by default. Set the |
Beta Was this translation helpful? Give feedback.
HOOMD-blue's GSD writer only writes the box, number of particles, positions, and orientations on every frame by default. Set the
dynamic
argument ofwrite.GSD
to whichever quantities you want it to write out on every frame. See https://hoomd-blue.readthedocs.io/en/latest/module-hoomd-write.html#hoomd.write.GSD.