coxeter.shape_getters module

This module defines various convenience functions for generating shapes.

The methods here provide routes for generating instances of Shape based on certain pre-specified mappings.

Classes:

Circle(radius[, center])

A circle with the given radius.

ConvexPolygon(vertices[, normal, …])

A convex polygon.

ConvexPolyhedron(vertices)

A convex polyhedron.

ConvexSpheropolygon(vertices, radius[, normal])

A convex spheropolygon.

ConvexSpheropolyhedron(vertices, radius)

A convex spheropolyhedron.

Ellipse(a, b[, center])

An ellipse with principal axes a and b.

Ellipsoid(a, b, c[, center])

An ellipsoid with principal axes a, b, and c.

Polygon(vertices[, normal, …])

A simple (non-self-overlapping) polygon.

Polyhedron(vertices, faces[, faces_are_convex])

A three-dimensional polytope.

Sphere(radius[, center])

A sphere with the given radius.

Functions:

from_gsd_type_shapes(params[, dimensions])

Create a Shape from a dict conforming to the GSD schema.

coxeter.shape_getters.from_gsd_type_shapes(params, dimensions=3)

Create a Shape from a dict conforming to the GSD schema.

See here for the specification of the schema. Note that the schema does not differentiate between 2D and 3D shapes for spheres (vs. circles) and ellipsoids (vs. ellipses) because in context the dimensionality of those shapes can be inferred from simulation boxes. To address this ambiguity, this function accepts a dimensions parameter that can be used to disambiguate explicitly between these two cases.

Parameters
  • params (dict) – The parameters of the shape to construct.

  • dimensions (int) – The dimensionality of the shape (either 2 or 3). Ignored except when the shape is a sphere or an ellipsoid, in which case a value of 2 is used to indicate generating a Circle or Ellipse instead of a Sphere or Ellipsoid (Default value: 3).

Returns

The desired shape.

Return type

Shape