NPT simulations using hoomd.hpmc.update.BoxMC

129 views
Skip to first unread message

uet tey

unread,
Oct 10, 2022, 12:59:08 PM10/10/22
to hoomd-users
Dear HOOMD-developers,

I am confused about how to set the NPT ensemble using hoomd.hpmc.update.BoxMC command. Below is my script:

 import math

import hoomd
   
gpu = hoomd.device.GPU()
sim = hoomd.Simulation(device=gpu, seed=1234)

mc = hoomd.hpmc.integrate.Sphere(default_a=0.4)
mc.shape["A"] = dict(diameter=1.0)
boxmc = hoomd.hpmc.update.BoxMC(trigger=1, betaP=3)
boxmc.volume = dict(mode='standard',weight=1.0)

sim.operations.integrator = mc

sim.create_state_from_gsd(filename='initial.gsd')

tune1 = hoomd.hpmc.tune.MoveSize.scale_solver(
    moves = ['a'],
    target = 0.2,
    trigger = 1
    )
sim.operations.tuners.append(tune1)

tune2 = hoomd.hpmc.tune.BoxMCMoveSize.scale_solver(
    trigger = 1,
    boxmc = boxmc,
    moves=['volume'],
    target=0.2
     )
sim.operations.tuners.append(tune2)

logger = hoomd.logging.Logger()
logger.add(mc, quantities=['type_shapes'])

gsd_writer = hoomd.write.GSD(filename='tra.gsd',
                             trigger=hoomd.trigger.Periodic(1000),
                             mode='xb',
                             filter=hoomd.filter.All(),
                             log=logger)
sim.operations.writers.append(gsd_writer)

sim.run(1*1e5)

When I change betaP in hoomd.hpmc.update.BoxMC, it's strange that the box size doesn't change. Could you please tell me how to improve my script to call the correct NPT ensemble? I searched a lot to find a solution, however, there is no template using v3.5.0 Hoomd-blue. Thanks in advance.

sincerely,
James.

run.py

Joshua Anderson

unread,
Oct 11, 2022, 9:03:39 AM10/11/22
to hoomd...@googlegroups.com
James,

You need to add `boxmc` to the simulation's operations for it to take effect. After running the simulation, check boxmc's `volume_moves` property to see how many moves it accepted and rejected. Also, you should use a larger period trigger for the BoxMCMoveSize tuner. It will need many samples of volume moves to determine the acceptance ratio - with a trigger of 1, the acceptance will either be 100% or 0% which does not provide enough resolution for tuning.
------
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/b8a5808a-9ea4-418b-a71f-6e569b44dbean%40googlegroups.com.
<run.py>

uet tey

unread,
Oct 11, 2022, 10:56:07 PM10/11/22
to hoomd-users
Dear Joshua, 

 Thanks for your advice. I have solved this problem. 

 Sincerely, 
James
Reply all
Reply to author
Forward
0 new messages