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

RuntimeError: Buffer is full. when resetting MD walls. #1879

Open
joaander opened this issue Sep 3, 2024 · 1 comment
Open

RuntimeError: Buffer is full. when resetting MD walls. #1879

joaander opened this issue Sep 3, 2024 · 1 comment
Labels
bug Something isn't working

Comments

@joaander
Copy link
Member

joaander commented Sep 3, 2024

Description

The script below should run to completion but does not.

Script

import hoomd

sim = hoomd.util.make_example_simulation(particle_types=['W'])

integrator = hoomd.md.Integrator(dt=0.005)
integrator.methods.append(hoomd.md.methods.Langevin(filter=hoomd.filter.All(), kT=1.5))
sim.state.set_box(hoomd.Box.cube(L=80))

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):
        print(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)

sim.run(60_000)
print(lj_wall.walls[0])

Input files

No response

Output

0
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
Traceback (most recent call last):
  File "/Users/joaander/test/hoomd-wall-change/test.py", line 36, in <module>
    sim.run(60_000)
  File "/Users/joaander/build/hoomd/hoomd/simulation.py", line 562, in run
    self._cpp_sys.run(steps_int, write_at_start)
  File "/Users/joaander/test/hoomd-wall-change/test.py", line 26, in act
    self.lj_wall.walls = [left, right_wall]
    ^^^^^^^^^^^^^^^^^^
  File "/Users/joaander/build/hoomd/hoomd/operation.py", line 92, in __setattr__
    self._setattr_hook(attr, value)
  File "/Users/joaander/build/hoomd/hoomd/operation.py", line 96, in _setattr_hook
    super().__setattr__(attr, value)
  File "/Users/joaander/build/hoomd/hoomd/md/external/wall.py", line 221, in walls
    self._walls._sync({
  File "/Users/joaander/build/hoomd/hoomd/wall.py", line 475, in _sync
    self._backend_lists[wall_type]._sync(None, wall_list)
  File "/Users/joaander/build/hoomd/hoomd/data/syncedlist.py", line 246, in _sync
    raise err
  File "/Users/joaander/build/hoomd/hoomd/data/syncedlist.py", line 243, in _sync
    self._synced_list.append(self._to_synced_list_conversion(item))
  File "/Users/joaander/build/hoomd/hoomd/data/array_view.py", line 18, in wrapped_method
    return getattr(self._get_array_view(), method.__name__)(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
RuntimeError: Buffer is full.

Expected output

...
...
59997
59998
59999
Plane(origin=_HOOMDTuple(-5.000499999999999, 0.0, 0.0), normal=_HOOMDTuple(1.0, 0.0, 0.0),

Platform

CPU, GPU, Linux, macOS

Installation method

Compiled from source

HOOMD-blue version

trunk-patch

Python version

3.12.5

@joaander joaander added the bug Something isn't working label Sep 3, 2024
@joaander
Copy link
Member Author

joaander commented Sep 3, 2024

Originally posted as a discussion in #1874.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant