Sphere

class hoomd.wall.Sphere(radius, origin=(0.0, 0.0, 0.0), inside=True, open=True)

Bases: WallGeometry

A sphere.

Parameters:
  • radius (float) – The radius of the sphere \([\mathrm{length}]\).

  • origin (tuple [float, float, float], optional) – The origin of the sphere, defaults to (0, 0, 0) \([\mathrm{length}]\).

  • inside (bool, optional) – Whether positive signed distances are inside or outside the sphere, defaults to True.

  • open (bool, optional) – Whether to include the surface of the sphere in the space. True means do not include the surface, defaults to True.

The signed distance from the wall surface is:

\[d = \left( R - \lvert \vec{r} - \vec{r}_o \rvert \right)\]

for inside=True, where \(r\) is the particle position, \(r_o\) is the origin of the sphere, and \(R\) is the sphere’s radius. The distance is negated when inside=False.

Warning

When running MD simulations in 2D simulation boxes, set origin[2]=(x,y,0). Otherwise, the wall force will push particles off the xy plane.

Note

Sphere objects are immutable.

Example:

sphere = hoomd.wall.Sphere(radius=10.0)
radius

The radius of the sphere \([\mathrm{length}]\).

Type:

float

origin

The origin of the sphere \([\mathrm{length}]\).

Type:

tuple [float, float, float]

inside

Whether positive signed distances are inside or outside the sphere.

Type:

bool

open

Whether to include the surface of the sphere in the space. Open means do not include the surface.

Type:

bool

__repr__()

A string representation of the Sphere.

__str__()

A string representation of the Sphere.

to_dict()

Convert the wall geometry to a dictionary defining the sphere.

Returns:

The geometry in a Python dictionary.

Return type:

dict