dem.pair¶
Overview
WCA 

SWCA 
Details
DEM pair potentials.

class
hoomd.dem.pair.
SWCA
(nlist, radius=1.0, d_max=None)¶ Specify a purely repulsive WeeksChandlerAndersen DEM force with a particlevarying rounding radius.
Parameters:  nlist (
hoomd.md.nlist
) – Neighbor list to use  radius (float) – Unshifted rounding radius \(r\) to apply to the shape vertices
 d_max (float) – maximum rounding diameter among all particles in the system
The SWCA potential enables simulation of particles with heterogeneous rounding radii. The effect is as if a
hoomd.md.pair.slj
interaction with \(r_{cut}=2^{1/6}\sigma\) and \(\sigma=2\cdot r\) were applied between the contact points of each pair of particles.Examples:
# 2D system of squares squares = hoomd.dem.pair.SWCA(radius=.5) squares.setParams('A', [[1, 1], [1, 1], [1, 1], [1, 1]]) # 3D system of rounded square plates squarePlates = hoomd.dem.pair.SWCA(radius=.5) squarePlates.setParams('A', vertices=[[1, 1, 0], [1, 1, 0], [1, 1, 0], [1, 1, 0]], faces=[[0, 1, 2, 3]], center=False) # 3D system of some convex shape specified by vertices (vertices, faces) = hoomd.dem.utils.convexHull(vertices) shapes = hoomd.dem.pair.SWCA(radius=.5) shapes.setParams('A', vertices=vertices, faces=faces)

disable
(log=False)¶ Disable the force.
Parameters: log (bool) – Set to True if you plan to continue logging the potential energy associated with this force. Examples:
force.disable() force.disable(log=True)
Executing the disable command will remove the force from the simulation. Any
hoomd.run()
command executed after disabling a force will not calculate or use the force during the simulation. A disabled force can be reenabled withenable()
.By setting log to True, the values of the force can be logged even though the forces are not applied in the simulation. For forces that use cutoff radii, setting log=True will cause the correct r_cut values to be used throughout the simulation, and therefore possibly drive the neighbor list size larger than it otherwise would be. If log is left False, the potential energy associated with this force will not be available for logging.

get_energy
(group)¶ Get the energy of a particle group.
Parameters: group ( hoomd.group
) – The particle group to query the energy for.Returns: The last computed energy for the members in the group. Examples:
g = group.all() energy = force.get_energy(g)

get_net_force
(group)¶ Get the force of a particle group.
Parameters: group ( hoomd.group
) – The particle group to query the force for.Returns: The last computed force for the members in the group. Examples
g = group.all() force = force.get_net_force(g)

get_net_virial
(group)¶ Get the virial of a particle group.
Parameters: group ( hoomd.group
) – The particle group to query the virial for.Returns: The last computed virial for the members in the group. Examples
g = group.all() virial = force.get_net_virial(g)

get_type_shapes
()¶ Get all the types of shapes in the current simulation.
This assumes all 3D shapes are convex.
Examples
Types depend on the number of shape vertices and system dimensionality. One vertex will yield a Sphere (2D and 3D), while multiple vertices will give a Polygon (2D) or ConvexPolyhedron (3D).
>>> mc.get_type_shapes() # one vertex in 3D [{'type': 'Sphere', 'diameter': 1.0}] >>> mc.get_type_shapes() # one vertex in 2D [{'type': 'Sphere', 'diameter': 1.5}] >>> mc.get_type_shapes() # multiple vertices in 3D [{'type': 'ConvexPolyhedron', 'rounding_radius': 0.1, 'vertices': [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [0.5, 0.5, 0.5]]}] >>> mc.get_type_shapes() # multiple vertices in 2D [{'type': 'Polygon', 'rounding_radius': 0.1, 'vertices': [[0.5, 0.5], [0.5, 0.5], [0.5, 0.5], [0.5, 0.5]]}]
Returns: A list of dictionaries, one for each particle type in the system.

setParams2D
(type, vertices, center=False)¶ Set the vertices for a given particle type.
Parameters: Shapes are specified as a list of 2D coordinates. Edges will be made between all adjacent pairs of vertices, including one between the last and first vertex.

setParams3D
(type, vertices, faces, center=False)¶ Set the vertices for a given particle type.
Parameters:  type (str) – Name of the type to set the shape of
 vertices (list) – List of (3D) points specifying the coordinates of the shape
 faces (list) – List of lists of indices specifying which coordinates comprise each face of a shape.
 center (bool) – If True, subtract the center of mass of the shape from the vertices before setting them for the shape
Shapes are specified as a list of coordinates (vertices) and another list containing one list for each polygonal face (faces). The elements of each list inside faces are integer indices specifying which vertex in vertices comprise the face.

update_coeffs
()¶ Noop for this potential
 nlist (

class
hoomd.dem.pair.
WCA
(nlist, radius=1.0)¶ Specify a purely repulsive WeeksChandlerAndersen DEM force with a constant rounding radius.
Parameters:  nlist (
hoomd.md.nlist
) – Neighbor list to use  radius (float) – Rounding radius \(r\) to apply to the shape vertices
The effect is as if a
hoomd.md.pair.lj
interaction with \(r_{cut}=2^{1/6}\sigma\) and \(\sigma=2\cdot r\) were applied between the contact points of each pair of particles.Examples:
# 2D system of squares squares = hoomd.dem.pair.WCA(radius=.5) squares.setParams('A', [[1, 1], [1, 1], [1, 1], [1, 1]]) # 3D system of rounded square plates squarePlates = hoomd.dem.pair.WCA(radius=.5) squarePlates.setParams('A', vertices=[[1, 1, 0], [1, 1, 0], [1, 1, 0], [1, 1, 0]], faces=[[0, 1, 2, 3]], center=False) # 3D system of some convex shape specified by vertices (vertices, faces) = hoomd.dem.utils.convexHull(vertices) shapes = hoomd.dem.pair.WCA(radius=.5) shapes.setParams('A', vertices=vertices, faces=faces)

disable
(log=False)¶ Disable the force.
Parameters: log (bool) – Set to True if you plan to continue logging the potential energy associated with this force. Examples:
force.disable() force.disable(log=True)
Executing the disable command will remove the force from the simulation. Any
hoomd.run()
command executed after disabling a force will not calculate or use the force during the simulation. A disabled force can be reenabled withenable()
.By setting log to True, the values of the force can be logged even though the forces are not applied in the simulation. For forces that use cutoff radii, setting log=True will cause the correct r_cut values to be used throughout the simulation, and therefore possibly drive the neighbor list size larger than it otherwise would be. If log is left False, the potential energy associated with this force will not be available for logging.

get_energy
(group)¶ Get the energy of a particle group.
Parameters: group ( hoomd.group
) – The particle group to query the energy for.Returns: The last computed energy for the members in the group. Examples:
g = group.all() energy = force.get_energy(g)

get_net_force
(group)¶ Get the force of a particle group.
Parameters: group ( hoomd.group
) – The particle group to query the force for.Returns: The last computed force for the members in the group. Examples
g = group.all() force = force.get_net_force(g)

get_net_virial
(group)¶ Get the virial of a particle group.
Parameters: group ( hoomd.group
) – The particle group to query the virial for.Returns: The last computed virial for the members in the group. Examples
g = group.all() virial = force.get_net_virial(g)

get_type_shapes
()¶ Get all the types of shapes in the current simulation.
This assumes all 3D shapes are convex.
Examples
Types depend on the number of shape vertices and system dimensionality. One vertex will yield a Sphere (2D and 3D), while multiple vertices will give a Polygon (2D) or ConvexPolyhedron (3D).
>>> mc.get_type_shapes() # one vertex in 3D [{'type': 'Sphere', 'diameter': 1.0}] >>> mc.get_type_shapes() # one vertex in 2D [{'type': 'Sphere', 'diameter': 1.5}] >>> mc.get_type_shapes() # multiple vertices in 3D [{'type': 'ConvexPolyhedron', 'rounding_radius': 0.1, 'vertices': [[0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [0.5, 0.5, 0.5], [0.5, 0.5, 0.5]]}] >>> mc.get_type_shapes() # multiple vertices in 2D [{'type': 'Polygon', 'rounding_radius': 0.1, 'vertices': [[0.5, 0.5], [0.5, 0.5], [0.5, 0.5], [0.5, 0.5]]}]
Returns: A list of dictionaries, one for each particle type in the system.

setParams2D
(type, vertices, center=False)¶ Set the vertices for a given particle type.
Parameters: Shapes are specified as a list of 2D coordinates. Edges will be made between all adjacent pairs of vertices, including one between the last and first vertex.

setParams3D
(type, vertices, faces, center=False)¶ Set the vertices for a given particle type.
Parameters:  type (str) – Name of the type to set the shape of
 vertices (list) – List of (3D) points specifying the coordinates of the shape
 faces (list) – List of lists of indices specifying which coordinates comprise each face of a shape.
 center (bool) – If True, subtract the center of mass of the shape from the vertices before setting them for the shape
Shapes are specified as a list of coordinates (vertices) and another list containing one list for each polygonal face (faces). The elements of each list inside faces are integer indices specifying which vertex in vertices comprise the face.

update_coeffs
()¶ Noop for this potential
 nlist (