Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consider Walls when inserting or removing particles for the MuVT updater #1711

Merged
merged 5 commits into from Feb 5, 2024

Conversation

Tobias-Dwyer
Copy link
Contributor

Description

Changes to the MuVT updater to calculate the energy of a particle insertion or removal for both hard walls and CPP potential field.

Required implementation of an energy function for hard walls that checks if an inserted particle overlaps with the walls, and returns infinity.

Required adding energy contributed by the wall to change in energy from inserting or removing a particle from the system.

Motivation and context

This solves the issue that hoomd does not consider walls when adding or removing particles in MuVT. Before this bug fix this means that when walls are added in a MuVT system, particles can be inserted intside the walls of the system where insertions should not be allowed or be otherwise highly energetically unfavoable in the case of jit.

How has this been tested?

I indepentently tested each hard wall geometry available in hoomd (sphere, cylinder, and plane) by starting with a single sphere inside the wall and testing whether particles would only be inserted inside the cylinder wall. I also test whether insertion and removal moves are performed. Finally, I test at a high fugacity meaning that more that just the starting particle should be inserted within the wall. I checked that these tests passed for the bug fix and didn't pass without them.

To test the jit funtionality of the code I built the code with LLVM enabled on cheme-hodges. I then build a box with an energy constraint that any particle in the bottom half of the box would return an energy of Infinity. I then started the simulation with a single particle in the lower half of the box and a high fugacity. If hoomd considers the jit walls, the particle in the bottom part of the box will be removed and particles will only be inserted into the top of the box, which is what I tested for: At least one successful accepted removal move, no particles in the bottom half of the box, and particles inserted into the top half of the box.

Change log

MuVT ensembles considers walls when inserting or removing particles. 

Checklist:

@Tobias-Dwyer Tobias-Dwyer requested review from a team as code owners January 30, 2024 20:02
@Tobias-Dwyer Tobias-Dwyer requested review from joaander, tommy-waltmann and seoulfood and removed request for a team January 30, 2024 20:02
Copy link
Contributor

@tommy-waltmann tommy-waltmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start on this! I just have a few small comments and a quick question.

Has this code be verified to work on a "real" system?

hoomd/hpmc/ExternalFieldWall.h Show resolved Hide resolved
hoomd/hpmc/ExternalField.h Show resolved Hide resolved
hoomd/hpmc/ExternalFieldWall.h Show resolved Hide resolved
hoomd/hpmc/ExternalFieldWall.h Show resolved Hide resolved
hoomd/hpmc/PatchEnergyJIT.cc Outdated Show resolved Hide resolved
hoomd/hpmc/UpdaterMuVT.h Outdated Show resolved Hide resolved
hoomd/hpmc/UpdaterMuVT.h Outdated Show resolved Hide resolved
hoomd/hpmc/pytest/test_muvt.py Outdated Show resolved Hide resolved
hoomd/hpmc/pytest/test_muvt.py Show resolved Hide resolved
@Tobias-Dwyer
Copy link
Contributor Author

Great start on this! I just have a few small comments and a quick question.

Has this code be verified to work on a "real" system?

Thanks for the compliments! :D This code has been verified on a real system: here's a snapshot of a system with wall in middle and on top. Previously particles would be inserted in the bottom of the box but now insertion moves only happen on the top! So looks like everything's working great.
wall_trajectory

Copy link
Contributor

@tommy-waltmann tommy-waltmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good now, thanks for making those changes and showing the real system snapshot!

@tommy-waltmann tommy-waltmann added the validate Execute long running validation tests on pull requests label Feb 2, 2024
@joaander joaander merged commit 37f6348 into trunk-patch Feb 5, 2024
72 of 73 checks passed
@joaander joaander deleted the wall_in_MuVT branch February 5, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
validate Execute long running validation tests on pull requests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants