Closed josephburkhart closed 1 month ago
TypeParameter
documents that parameters for all types (or type pairs) must be set in an important block: https://hoomd-blue.readthedocs.io/en/v4.7.0/module-hoomd-data.html#hoomd.data.typeparam.TypeParameter. ALJ.shape
links directly to the TypeParameter
documentation, as to all other attributes that are type parameters. How could this be documented more clearly?
And yes, there should be a user-friendly error message for this. I will investigate why it is not issued.
Also, I think you would want to set empty lists for vertices/faces and a r_cut=0 to implement a non-interacting type.
alj.shape["B"] = dict(vertices=[], faces=[], rounding_radii=0.0)
alj.r_cut[("B", ["A", "B"])] = 0
Description
When using an ALJ force in a binary system (two types of particles), it is necessary to set the
shape
parameter for both types of particles. This requirement is not clearly communicated in the documentation. (Or at least, it wasn't clear to me.) When the user fails to setshape
for both types, the simulation throws an error that is either incorrect or extremely unclear.The MWE below demonstrates the error I'm referring to. Uncomment
alj.shape["B"] = dict(vertices=vertices_a, faces=faces_a, rounding_radii=0.0)
to prevent the error.Script
Input files
N/A
Output
Expected output
Instead of
TypeParameterDict._single_setitem()
throwingValueError: dictionary update sequence element #0 has length 3; 2 is required
, I would expect some class higher up to throw an error saying something likeshape dictionary has not been provided for particle type 'B'
.Platform
CPU, Linux
Installation method
Conda-forge package
HOOMD-blue version
4.1.0
Python version
3.11.7