glotzerlab / hoomd-blue

Molecular dynamics and Monte Carlo soft matter simulation on GPUs.
http://glotzerlab.engin.umich.edu/hoomd-blue
BSD 3-Clause "New" or "Revised" License
335 stars 130 forks source link

Typo in documentation for md.pair.aniso.ALJ #1801

Closed josephburkhart closed 3 months ago

josephburkhart commented 4 months ago

Description

In the documentation for the shape parameter of md.pair.aniso.ALJ, the key rounding_radii is labelled "required", but the description says "defaults to (0.0, 0.0, 0.0)" and the key is omitted in the example code: alj.shape["A"] = dict(vertices=cube_verts, faces=cube_faces). The description and example code should be modified to reflect the fact that the key is required.

Motivation and context

Making sure the documentation is internally consistent will help prevent confusion on implementing the ALJ, which is already a complicated potential to use correctly.

When trying to assign the shape parameter dictionary without specifying the rounding_radii key, I get the following error, which indicates that the key is indeed required:

Traceback (most recent call last):
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/operation.py", line 316, in _attach
    self._apply_typeparam_dict(self._cpp_obj, self._simulation)
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/operation.py", line 350, in _apply_typeparam_dict
    typeparam._attach(cpp_obj, simulation.state)
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/data/typeparam.py", line 171, in _attach
    self.param_dict._attach(cpp_obj, self.name,
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/data/parameterdicts.py", line 518, in _attach
    self._single_setitem(key, parameters[key])
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/data/parameterdicts.py", line 461, in _single_setitem
    getattr(self._cpp_obj, self._setter)(key, item)
KeyError: 'rounding_radii'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/home/joseph/GlotzerGroup/pentagonal-nanorods/actions.py", line 66, in <module>
    globals()[args.action](*jobs)
  File "/home/joseph/GlotzerGroup/pentagonal-nanorods/actions.py", line 46, in run
    utils.run(simulation=simulation, nsteps=1e6)
  File "/home/joseph/GlotzerGroup/pentagonal-nanorods/utils.py", line 576, in run
    simulation.run(nsteps)
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/simulation.py", line 555, in run
    self.operations._schedule()
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/operations.py", line 211, in _schedule
    self.integrator._attach(sim)
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/operation.py", line 310, in _attach
    self._attach_hook()
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/md/integrate.py", line 307, in _attach_hook
    super()._attach_hook()
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/md/integrate.py", line 48, in _attach_hook
    self._forces._sync(self._simulation, self._cpp_obj.forces)
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/data/syncedlist.py", line 246, in _sync
    raise err
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/data/syncedlist.py", line 242, in _sync
    self._register_item(item)
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/data/syncedlist.py", line 190, in _register_item
    value._attach(self._simulation)
  File "/home/joseph/miniconda3/envs/glotzergroup/lib/python3.11/site-packages/hoomd/operation.py", line 318, in _attach
    raise type(err)(
KeyError: "Error applying parameters for object of type <class 'hoomd.md.pair.aniso.ALJ'>."
josephburkhart commented 4 months ago

For clarity, here's a link to the section in the documentation that I am referring to: https://hoomd-blue.readthedocs.io/en/v4.7.0/module-md-pair-aniso.html#hoomd.md.pair.aniso.ALJ.shape

joaander commented 3 months ago

Fixed in #1808.