-
Dear HOOMD users, I am trying to implement a movable wall in my current simulation (HOOMD 4.4.1). As of now I am trying to implement this by using wall_potential.walls = [# new walls as a function of the current simulation state, timestep, etc...] I have tried to implement that, but I get a Here is a snippet of my attempted implementation, where I employ two walls (planes) parallel to each other separated by 70 units of distance in the x-direction. I attempt to move the left wall towards the right (+x-direction) 10 units of distance during a time span of 20,000 timesteps. left_wall = hoomd.wall.Plane(origin=(-35, 0, 0), normal=(1, 0, 0))
right_wall = hoomd.wall.Plane(origin=(35, 0, 0), normal=(-1, 0, 0))
lj_wall = hoomd.md.external.wall.ForceShiftedLJ(walls=[left_wall, right_wall])
lj_wall.params[['W']] = {"epsilon": 1.0, "sigma": 1.0, "r_cut": 2.0 ** (1 / 6)}
integrator.forces.append(lj_wall)
sim.operations.integrator = integrator
# Step 1: Subclass hoomd.custom.Action.
class WallParameterModifier(hoomd.custom.Action):
def __init__(self, lj_wall):
super().__init__()
self.lj_wall = lj_wall
def act(self, timestep):
wall_position = -35 + timestep * 0.0005
left = hoomd.wall.Plane(origin=(wall_position, 0, 0), normal=(1, 0, 0))
self.lj_wall.walls = [left, right_wall]
# Step 2: Create a hoomd.update.CustomUpdater
wall_parameter_modifier = WallParameterModifier(lj_wall)
wall_parameter_updater = hoomd.update.CustomUpdater(
trigger=hoomd.trigger.Periodic(1), action=wall_parameter_modifier)
# Step 3: Add the updater to the operations
sim.operations.updaters.append(wall_parameter_updater) I also tried different things in the def act(self, timestep):
wall_position = -35 + timestep * 0.0005
left = hoomd.wall.Plane(origin=(wall_position, 0, 0), normal=(1, 0, 0))
self.lj_wall = hoomd.md.external.wall.ForceShiftedLJ(walls=[left, right_wall]) Could someone point in the right direction as to how implement a movable wall in HOOMD? I will leave a front-facing image of the simulation box (80x60x60) I am using, where I left extra space in the x-direction to be able to test if the walls were working. Thank you, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Use:
Your original script should have worked. I am able to reproduce the |
Beta Was this translation helpful? Give feedback.
Use:
Your original script should have worked. I am able to reproduce the
Buffer is full
error message but did not see an obvious reason for the error. I have opened #1879 to track the defect.