Compressing Walls in HOOMD 3

161 views
Skip to first unread message

Rachael Skye

unread,
Sep 29, 2022, 3:11:19 PM9/29/22
to hoomd-users
Hi all,

I have a question about the implementation of HPMC walls in HOOMD 3. I worked quite a bit with walls in 2.x, and now I'm trying to upgrade those simulations to 3.x but running into problems.

In 2.x, I was able to perform NPT simulations with a BoxMC and, when the box changed size, the walls automatically scaled in position (or, in the case of spherical walls, in radius). However, in 3.x, it seems that walls don't change position when a BoxMC is active. I can turn on the walls and BoxMC, and watch the box shrink such that the walls move outside the box and are no longer effecting the particles. The precise code snippets I used for both versions are below.

Is there a way to apply NPT updates to a wall in HOOMD 3.x? Is there a parameter to set that I haven't found? Thank you for the help!

HOOMD 2.x (specifically, 2.7.2)
#go through system set-up
    lx = system.box.Lx
    margin = 0.001

    ext_wall = hpmc.field.wall(mc)
    ext_wall.add_plane_wall(normal=[1,0,0], origin=[-lx/2+margin,0,0])
    ext_wall.add_plane_wall(normal=[-1,0,0], origin=[lx/2-margin,0,0])

    boxMC = hpmc.update.boxmc(mc, betaP, seed)

    boxMC.volume(delta=init_dv, weight=1.0)
    boxMC.length(delta=(5.0,5.0,5.0),weight=1.0)
    boxMC.shear(delta=(0.1,0.1,0.1), weight = 1.0)

hoomd.run(timeSteps)
#this causes walls to scale with the box so they are always margin away from the edge

HOOMD 3.x (specifically, 3.4.0)
#go through system setup

wall1 = hoomd.wall.Plane(origin=(lx/2-margin,0,0), normal=(-1,0,0))
wall2 = hoomd.wall.Plane(origin=(-lx/2+margin,0,0), normal=(1,0,0)) hoomd.hpmc.external.wall.WallPotential([wall1,wall2])
mc.external_potential = wall_potential

betaPcurve = hoomd.variant.Power(A=1, B=10, power=1/2, t_start=0, t_ramp=int(1e5)) BoxMC = hoomd.hpmc.update.BoxMC(trigger=hoomd.trigger.Periodic(10), betaP=betaPcurve)
BoxMC.shear = dict(weight=1, delta=(.05,.05,.05), reduce=.8)
BoxMC.aspect = dict(weight=1, delta=.05)
BoxMC.volume = dict(weight=1, mode='standard', delta=L/20) sim.operations.updaters.append(BoxMC)

sim.run(timeSteps)
#this sets up walls but they are frozen in place as the box shrinks

Joshua Anderson

unread,
Sep 29, 2022, 4:34:13 PM9/29/22
to hoomd...@googlegroups.com
Rachael,

There were a number of problems with the consistency of variable walls in v2, so we removed that functionality in v3. In its place, we made the walls mutable objects at the python level so you can update them with a custom updater every timestep:
```
wall_potential.walls = [# new walls as a function of the current simulation state, timestep, etc...]
```

However, this will not apply the changed walls during the BoxMC trial moves as I suspect v2 did. I'm not sure because the wall code in v2 was very complex and difficult to understand.

Even if it did, note that BoxMC in combination with walls would not sample the NPT ensemble exactly - the box size change acceptance uses the volume of the periodic simulation box, not the volume available to your constrained system: see https://hoomd-blue.readthedocs.io/en/v3.5.0/module-hpmc-update.html#hoomd.hpmc.update.BoxMC (in the Acceptance section). This is true for both v2 and v3.
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan

--
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/3b4a40dd-327b-4c6b-a9f4-4cc1ee551bf3n%40googlegroups.com.

Rachael Skye

unread,
Sep 29, 2022, 5:53:32 PM9/29/22
to hoomd-users
Hi Joshua,
Thank you for the advice, this helps a lot. I was aware that using Walls together with NPT ensembles had some problems in v2, so that should be okay. I'll work on how I want to proceed with these simulations now that I know I'm using the code correctly. Thank you!
Rachael

azam cheraghi

unread,
Jun 7, 2023, 12:08:28 PM6/7/23
to hoomd-users
Hi Rachael,

I am currently dealing with the same problem that you had based on your question. I am trying to adjust the code in a way that as I update my box, the wall adapt to it and particles cannot ran away from wall. I realized that Joshua mentioned that you can add wall for each timestep , as you chanign the box. I wonder how did you continue your codeing? May I ask you to share your code regarding that?

Regards
Azam

Rachael Skye

unread,
Jun 12, 2023, 11:13:43 AM6/12/23
to hoomd-users
Hi Azam,
Thanks for asking. For me, this question came at the end of an earlier project that was originally implemented in HOOMD 2.9. It made the most sense to conclude that project in HOOMD 2.9 (in which the wall updates are built-in) and change my plans for future simulations using the wall updater code. So I have not implemented wall updates in HOOMD 3; sorry I can't help you more.

Good luck,
Rachael

azam cheraghi

unread,
Jun 12, 2023, 11:56:03 AM6/12/23
to hoomd...@googlegroups.com
Hi Rachael,

Thanks for your response.

Regards
Azam

You received this message because you are subscribed to a topic in the Google Groups "hoomd-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/hoomd-users/oh1enxNoJ3Y/unsubscribe.
To unsubscribe from this group and all its topics, send an email to hoomd-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hoomd-users/229cb805-e0f1-43cf-8ac8-dcd0f306de6en%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages