Shape Definitions

Shape definitions contain information about the shape of individual particles. Some shapes define a type_shape property, which returns a dict for consumption by visualization tools, in the format of hoomd.hpmc.integrate.mode_hpmc.get_type_shapes().

class garnett.shapes.FallbackShape[source]

This shape definition class is used when no specialized Shape class can be applied.

The fallback shape definition is a string containing the definition.

class garnett.shapes.Shape(shape_class=None, color=None)[source]

Parent class of all shape objects.

Parameters:
  • shape_class (str) – Shape class directive, used for POS format (default: None).
  • color (str) – Hexadecimal color string in format RRGGBBAA (default: None).
pos_string
type_shape
class garnett.shapes.SphereShape(diameter, orientable=False, color=None)[source]

Shape class for spheres of a specified diameter.

Parameters:
  • diameter (float) – Diameter of the sphere.
  • orientable (bool) – Set to True for spheres with orientation (default: False).
  • color (str) – Hexadecimal color string in format RRGGBBAA (default: None).
pos_string
type_shape
class garnett.shapes.ArrowShape(thickness=0.1, color=None)[source]

Shape class for arrows of a specified thickness.

Parameters:
  • thickness (float) – Thickness of the arrow.
  • color (str) – Hexadecimal color string in format RRGGBBAA (default: None).
pos_string
type_shape
class garnett.shapes.SphereUnionShape(diameters, centers, colors=None)[source]

Shape class for sphere unions, such as rigid bodies of many spheres.

Parameters:
  • diameters (list) – List of sphere diameters.
  • centers (list) – List of 3D center vectors.
  • colors (list) – List of hexadecimal color strings in format RRGGBBAA (default: None).
pos_string
type_shape
class garnett.shapes.PolygonShape(vertices, color=None)[source]

Shape class for polygons in a 2D plane.

Parameters:
  • vertices (list) – List of 2D vertex vectors.
  • color (str) – Hexadecimal color string in format RRGGBBAA (default: None).
pos_string
type_shape
class garnett.shapes.SpheropolygonShape(vertices, rounding_radius=0, color=None)[source]

Shape class for rounded polygons in a 2D plane.

Parameters:
  • vertices (list) – List of 2D vertex vectors.
  • rounding_radius (float) – Rounding radius applied to the spheropolygon (default: 0).
  • color (str) – Hexadecimal color string in format RRGGBBAA (default: None).
pos_string
type_shape
class garnett.shapes.ConvexPolyhedronShape(vertices, color=None)[source]

Shape class for convex polyhedra.

Parameters:
  • vertices (list) – List of 3D vertex vectors.
  • color (str) – Hexadecimal color string in format RRGGBBAA (default: None).
pos_string
type_shape
class garnett.shapes.ConvexPolyhedronUnionShape(vertices, centers, orientations, colors=None)[source]

Shape class for unions of convex polyhedra.

Parameters:
  • vertices (list) – List of lists of 3D vertex vectors in particle coordinates (each polyhedron, each vertex).
  • centers (list) – List of 3D polyhedra center vectors.
  • orientations (list) – Orientations of the polyhedra, as a list of quaternions.
  • colors (list) – List of hexadecimal color strings in format RRGGBBAA (default: None).
pos_string
type_shape
class garnett.shapes.ConvexSpheropolyhedronShape(vertices, rounding_radius=0, color=None)[source]

Shape class for a convex polyhedron extended by a rounding radius.

Parameters:
  • vertices (list) – List of 3D vertex vectors.
  • rounding_radius (float) – Rounding radius applied to the spheropolyhedron (default: 0).
  • color (str) – Hexadecimal color string in format RRGGBBAA (default: None).
pos_string
type_shape
class garnett.shapes.GeneralPolyhedronShape(vertices, faces, color=None, facet_colors=None)[source]

Shape class for general polyhedra, such as arbitrary meshes.

Parameters:
  • vertices (list) – List of 3D vertex vectors.
  • faces (list) – List of lists of integers representing vertex indices for each face.
  • color (str) – Hexadecimal color string in format RRGGBBAA (default: None).
  • facet_colors (list) – List of hexadecimal color strings in format RRGGBBAA for each facet (default: None).
pos_string
type_shape
class garnett.shapes.EllipsoidShape(a, b, c, color=None)[source]

Shape class for ellipsoids of with principal axes a, b, and c.

Parameters:
  • a (float) – Principal axis a of the ellipsoid (radius in the x direction).
  • b (float) – Principal axis b of the ellipsoid (radius in the y direction).
  • c (float) – Principal axis c of the ellipsoid (radius in the z direction).
  • color (str) – Hexadecimal color string in format RRGGBBAA (default: None).
pos_string
type_shape