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 toTrue
.open (
bool
, optional) – Whether to include the surface of the sphere in the space.True
means do not include the surface, defaults toTrue
.
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 wheninside=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)
- open¶
Whether to include the surface of the sphere in the space. Open means do not include the surface.
- Type:
- __repr__()¶
A string representation of the Sphere.
- __str__()¶
A string representation of the Sphere.