compressing system in cylindrical confinement

39 views
Skip to first unread message

azam cheraghi

unread,
Mar 13, 2023, 5:33:25 PM3/13/23
to hoomd...@googlegroups.com
I was able to generate  a randomized system of 19 octahedrons confined in a cylindrical wall, using HPMC. Next step is to compress it and then equilibrium. In compression somehow it looks like that system doesn't know what the box size is and wall condition. I played with it in different ways but still couldn't figure out how to fix it. File named p1.gsd id my randomized system and it shows particles confined in a cylinder.

cpu = hoomd.device.CPU()

sim = hoomd.Simulation(device=cpu, seed=20)

mc = hoomd.hpmc.integrate.ConvexPolyhedron()

sim.operations.integrator = mc

mc.shape['octahedron'] = dict(vertices=[

    (-0.5, 0, 0),

    (0.5, 0, 0),

    (0, -0.5, 0),

    (0, 0.5, 0),

    (0, 0, -0.5),

    (0, 0, 0.5),

])

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

a = math.sqrt(2) / 2

V_particle = 1 / 3 * math.sqrt(2) * a**3

initial_volume_fraction = (sim.state.N_particles * V_particle / sim.state.box.volume)

initial_box = sim.state.box

final_box = hoomd.Box.from_box(initial_box)

final_volume_fraction = 0.57

final_box.volume = sim.state.N_particles * V_particle / final_volume_fraction

compress = hoomd.hpmc.update.QuickCompress(trigger=hoomd.trigger.Periodic(10),                                         target_box=final_box)

sim.operations.updaters.append(compress)

periodic = hoomd.trigger.Periodic(10)

tune = hoomd.hpmc.tune.MoveSize.scale_solver(moves=['a', 'd'],

                                             target=0.2,

                                             trigger=periodic,

                                             max_translation_move=0.2,

                                             max_rotation_move=0.2)

sim.operations.tuners.append(tune)

while not compress.complete and sim.timestep < 1e6:

    sim.run(1000)

if not compress.complete:

    raise RuntimeError("Compression failed to complete")

hoomd.write.GSD.write(state=sim.state, mode='xb', filename='pc.gsd')

Brandon Butler

unread,
Mar 14, 2023, 1:05:17 PM3/14/23
to hoomd...@googlegroups.com
Hey,

You don’t set the wall on the sent script so the simulation does not know about it. Also, walls are not meant to be used in compression simulations.

Best,
Brandon

--
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/CAKfCtRPO0B5QMaJv-S7fPUgW%2BAsm59XoUFgxo%3DRP-zw%3Dx90r3g%40mail.gmail.com.
--
Brandon Butler
PhD Candidate Glotzer Lab
Department of Chemical Engineering
University of Michigan, Ann Arbor

azam cheraghi

unread,
Mar 14, 2023, 1:54:12 PM3/14/23
to hoomd...@googlegroups.com

Joshua Anderson

unread,
Mar 15, 2023, 8:04:28 AM3/15/23
to hoomd...@googlegroups.com
Walls in HOOMD do not change when you change the box. QuickCompress will therefore not take into account changing walls as it changes the box size.

To compress HPMC systems with walls, implement your own compression algorithm in Python where you adjust the walls, adjust the box (if needed), run the simulation for a number of steps, and check for the number of overlaps.
------
Joshua A. Anderson, Ph.D.
Research Area Specialist, Chemical Engineering, University of Michigan

Reply all
Reply to author
Forward
0 new messages