hpmc.data.param_dict Manage shape parameters.


Shape data structures.

class hoomd.hpmc.data.param_dict(mc)

Manage shape parameters.

The parameters for all hpmc integrator shapes (hoomd.hpmc.integrate) are specified using this class. Parameters are specified per particle type. Every HPMC integrator has a member shape_param that can read and set parameters of the shapes.

param_dict can be used as a dictionary to access parameters by type. You can read individual parameters or set parameters with set().


mc = hpmc.integrate.sphere();
dA = mc.shape_param['A'].diameter
dB = mc.shape_param['B'].diameter
set(types, **params)

Sets parameters for particle type(s).

  • type (str) – Particle type (string) or list of types
  • params – Named parameters (see specific integrator for required parameters - hoomd.hpmc.integrate)

Calling set() results in one or more parameters being set for a shape. Types are identified by name, and parameters are also added by name. Which parameters you need to specify depends on the hpmc integrator you are setting these coefficients for, see the corresponding documentation.

All possible particle types types defined in the simulation box must be specified before executing hoomd.run(). You will receive an error if you fail to do so. It is an error to specify coefficients for particle types that do not exist in the simulation.

To set the same parameters for many particle types, provide a list of type names instead of a single one. All types in the list will be set to the same parameters. A convenient wildcard that lists all types of particles in the simulation can be gotten from a saved sysdef from the init command.


mc.shape_param.set('A', diameter=1.0)
mc.shape_param.set('B', diameter=2.0)
mc.shape_param.set(['A', 'B'], diameter=2.0)


Single parameters can not be updated. If both diameter and length are requred for a particle type, then executing coeff.set(‘A’, diameter=1.5) will fail one must call coeff.set(‘A’, diameter=1.5, length=2.0)