Polyhedron

class hoomd.hpmc.integrate.Polyhedron(default_d=0.1, default_a=0.1, translation_move_probability=0.5, nselect=4, kT=1.0)

Bases: HPMCIntegrator

Polyhedron hard particle Monte Carlo integrator.

Parameters:
  • default_d (float) – Default maximum size of displacement trial moves \([\mathrm{length}]\).

  • default_a (float) – Default maximum size of rotation trial moves \([\mathrm{dimensionless}]\).

  • translation_move_probability (float) – Fraction of moves that are translation moves.

  • nselect (int) – Number of trial moves to perform per particle per timestep.

  • kT (hoomd.variant.variant_like) – Temperature set point \([\mathrm{energy}]\).

Perform hard particle Monte Carlo of general polyhedra. The shape \(S\) contains the points inside the polyhedron defined by vertices and faces (see shape). Polyhedron supports triangle meshes and spheres only. The mesh must be free of self-intersections.

See also

Use ConvexPolyhedron for faster performance with convex polyhedra.

Note

This shape uses an internal OBB tree for fast collision queries. Depending on the number of constituent faces in the tree, different values of the number of faces per leaf node may yield different optimal performance. The capacity of leaf nodes is configurable.

Wall support.

Polyhedron supports no hoomd.wall geometries.

Example:

mc = hpmc.integrate.Polyhedron(default_d=0.3, default_a=0.4)
mc.shape["A"] = dict(
    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),
        (0.5, -0.5, -0.5),
        (0.5, -0.5, 0.5),
        (0.5, 0.5, -0.5),
        (0.5, 0.5, 0.5),
    ],
    faces=[
        [0, 2, 6],
        [6, 4, 0],
        [5, 0, 4],
        [5, 1, 0],
        [5, 4, 6],
        [5, 6, 7],
        [3, 2, 0],
        [3, 0, 1],
        [3, 6, 2],
        [3, 7, 6],
        [3, 1, 5],
        [3, 5, 7],
    ],
)
print("vertices = ", mc.shape["A"]["vertices"])
print("faces = ", mc.shape["A"]["faces"])

Members inherited from AutotunedObject:

property kernel_parameters

Kernel parameters. Read more...

property is_tuning_complete

Check if kernel parameter tuning is complete. Read more...

tune_kernel_parameters()

Start tuning kernel parameters. Read more...


Members inherited from HPMCIntegrator:

a

Maximum size of the rotation trial moves. Read more...

d

Maximum size of displacement trial moves Read more...

interaction_matrix

Set which types interact with other types. Read more...

translation_move_probability

Fraction of moves to be selected as translation moves. Read more...

nselect

Number of trial moves to perform per particle per timestep. Read more...

kT

Temperature set point. Read more...

property counters

Trial move counters. Read more...

property external_energy

Total external energy contributed by all external potentials. Read more...

property external_potentials

External potentials to apply. Read more...

property map_overlaps

List of overlapping particles. Read more...

property mps

Number of trial moves performed per second. Read more...

property overlaps

Number of overlapping particle pairs. Read more...

property pair_energy

Total potential energy contributed by all pair potentials. Read more...

property pair_potentials

Pair potentials to apply. Read more...

property rotate_moves

Count of the accepted and rejected rotate moves. Read more...

property translate_moves

Count of the accepted and rejected translate moves. Read more...


Members defined in Polyhedron:

shape

The shape parameters for each particle type. The dictionary has the following keys:

  • vertices (list [tuple [float, float, float]], required) - vertices of the polyhedron \([\mathrm{length}]\).

    • The origin MUST strictly be contained in the generally nonconvex volume defined by the vertices and faces.

    • The origin centered sphere that encloses all vertices should be of minimal size for optimal performance.

  • faces (list [tuple [int, int, int], required) - Vertex indices for every triangle in the mesh.

    • For visualization purposes, the faces MUST be defined with a counterclockwise winding order to produce an outward normal.

  • ignore_statistics (bool, default: False) - set to True to ignore tracked statistics.

  • sweep_radius (float, default: 0.0) - radius of the sphere swept around the surface of the polyhedron \([\mathrm{length}]\). Set a non-zero sweep_radius to create a spheropolyhedron.

  • overlap (list [int], default: None) - Check for overlaps between faces when overlap [i] & overlap[j] is nonzero (& is the bitwise AND operator). When not None, overlap must have a length equal to that of faces. When None (the default), overlap is initialized with all 1’s.

  • capacity (int, default: 4) - set the maximum number of particles per leaf node to adjust performance.

  • origin (tuple [float, float, float], default: (0,0,0)) - a point strictly inside the shape, needed for correctness of overlap checks.

  • hull_only (bool, default: False) - When True, only check for intersections between the convex hulls.

Warning

HPMC does not check that all vertex requirements are met. Undefined behavior will result when they are violated.

Type:

TypeParameter [particle type, dict]

property type_shapes

Description of shapes in type_shapes format.

Example

>>> mc.type_shapes()
[{'type': 'Mesh', '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]],
  'faces': [[0, 1, 2], [0, 3, 1], [0, 2, 3], [1, 3, 2]]}]

(Loggable: category=”object”)

Type:

list[dict]