dem.pair

Overview

WCA Specify a purely repulsive Weeks-Chandler-Andersen DEM force with a constant rounding radius.
SWCA Specify a purely repulsive Weeks-Chandler-Andersen DEM force with a particle-varying rounding radius.

Details

DEM pair potentials.

class hoomd.dem.pair.SWCA(nlist, radius=1.0, d_max=None)

Specify a purely repulsive Weeks-Chandler-Andersen DEM force with a particle-varying 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 re-enabled with enable().

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.

enable()

Enable the force.

Examples:

force.enable()

See disable().

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_type_shapes()

Returns a list of shape descriptions with one element for each unique particle type in the system. Currently assumes that all 3D shapes are convex.

setParams2D(type, vertices, 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 (2D) points specifying the coordinates of the 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 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

class hoomd.dem.pair.WCA(nlist, radius=1.0)

Specify a purely repulsive Weeks-Chandler-Andersen 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 re-enabled with enable().

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.

enable()

Enable the force.

Examples:

force.enable()

See disable().

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_type_shapes()

Returns a list of shape descriptions with one element for each unique particle type in the system. Currently assumes that all 3D shapes are convex.

setParams2D(type, vertices, 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 (2D) points specifying the coordinates of the 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 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