ShapeSpace¶
- class hoomd.hpmc.shape_move.ShapeSpace(callback, default_step_size=None, param_move_probability=1)¶
Bases:
ShapeMove
Apply shape moves in a \(N\) dimensional shape space.
- Parameters:
callback (
callable
[str
,list
],dict
]) – The python callable that will be called to map the given shape parameters to a shape definition. The callable takes the particle type and a list of parameters as arguments and return a dictionary with the shape definition whose keys must match the shape definition of the integrator:callable[[str, list], dict]
. There is no type validation of the callback.default_step_size (
float
, optional) – Default maximum size of shape trial moves (default: None). By default requires setting step size for all types.param_move_probability (
float
, optional) – Average fraction of shape parameters to change each timestep (default: 1).
Shape support.
The following shapes are supported:
Attention
ShapeSpace
only works with spheropolyhedra that have zero rounding or are spheres.Note
Parameters must be given for every particle type and must be between 0 and 1. The class does not performs any consistency checks internally. Therefore, any shape constraint (e.g. constant volume, etc) must be performed within the callback.
Example:
mc = hoomd.hpmc.integrate.ConvexPolyhedron() mc.shape["A"] = dict(vertices=[(1, 1, 1), (-1, -1, 1), (1, -1, -1), (-1, 1, -1)]) # example callback class ExampleCallback: def __init__(self): default_dict = dict(sweep_radius=0, ignore_statistics=True) def __call__(self, type, param_list): # do something with params and define verts return dict("vertices":verts, **self.default_dict)) move = hpmc.shape_move.ShapeSpace(callback = ExampleCallback)
Members inherited from
ShapeMove
:- step_size¶
Maximum size of the shape trial moves.
Read more...
Members defined in
ShapeSpace
:- callback¶
The python function that will be called to map the given shape parameters to a shape definition. The function takes the particle type and a list of parameters as arguments and return a dictionary with the shape definition whose keys must match the shape definition of the integrator:
callable[[str, list], dict]
.
- params¶
List of tunable parameters to be updated. The length of the list defines the dimension of the shape space for each particle type.
- Type:
TypeParameter
[particle type
,list
]