hoomd.wall¶
Overview
A right circular cylinder. 

A plane. 

A sphere. 

Abstract base class for a HOOMD wall geometry. 
Details
Wall geometries.
Walls define an oriented surface in space. Walls exist only in the primary box image and are not replicated across the periodic boundary conditions. Points on one side of the surface have a positive signed distance to that surface, and points on the other side have a negative signed distance.
Define individual walls with Cylinder
, Plane
, and Sphere
. Create lists of
these WallGeometry
objects to describe more complex geometries. Use walls to
confine particles to specific regions of space in HPMC and MD simulations.
 class hoomd.wall.Cylinder(radius, axis, origin=(0.0, 0.0, 0.0), inside=True, open=True)¶
Bases:
WallGeometry
A right circular cylinder.
 Parameters
radius (float) – The radius of the circle faces of the cylinder \([\mathrm{length}]\).
axis (
tuple
[float
,float
,float
]) – A vector perpendicular to the circular faces.origin (
tuple
[float
,float
,float
], optional) – The origin of the cylinder defined as the center of the circle along the cylinder’s axis \([\mathrm{length}]\).inside (
bool
, optional) – Whether positive signed distances are inside or outside the cylinder.open (
bool
, optional) – Whether to include the surface of the cylinder in the space.True
means do not include the surface, defaults toTrue
.
Cylinder walls in HOOMD span the simulation box in the direction given by the
axis
attribute.The signed distance from the wall surface is
\[d = \left( R  \lvert \left( \vec{r}  \vec{r}_o \right)  \left( \left( \vec{r}  \vec{r}_o \right) \cdot \hat{n} \right) \hat{n} \rvert \right)\]for
inside=True
, where \(r\) is the particle position, \(\vec{r}_o\) is the origin of the cylinder, \(\hat{n}\) is the cylinder’s unit axis, and \(R\) is the cylinder’s radius. The distance is negated wheninside=False
.Warning
When running MD simulations in 2D simulation boxes, set
axis=(0,0,1)
. Otherwise, the wall force will push particles off the xy plane.Note
Cylinder
objects are immutable. origin¶
The origin of the cylinder defined as the center of the circle along the cylinder’s axis \([\mathrm{length}]\).
 open¶
Whether to include the surface of the cylinder in the space.
True
means do not include the surface. Type
bool
, optional
 __repr__()¶
A string representation of the Cylinder.
 __str__()¶
A string representation of the Cylinder.
 class hoomd.wall.Plane(origin, normal, open=True)¶
Bases:
WallGeometry
A plane.
 Parameters
origin (
tuple
[float
,float
,float
]) – A point that lies on the plane \([\mathrm{length}]\).normal (
tuple
[float
,float
,float
]) – The normal vector to the plane. The vector will be converted to a unit vector \([\mathrm{dimensionless}]\).open (
bool
, optional) – Whether to include the surface of the plane in the space.True
means do not include the surface, defaults toTrue
.
The signed distance from the wall surface is:
\[d = \hat{n} \cdot \left( \vec{r}  \vec{r}_o \right)\]where \(\vec{r}\) is the particle position, \(\vec{r}_o\) is the origin of the plane, and \(\hat{n}\) is the plane’s unit normal. The normal points toward the points with a positive signed distance to the plane.
Warning
When running MD simulations in 2D simulation boxes, set
normal=(nx,ny,0)
. Otherwise, the wall force will push particles off the xy plane.Note
Plane
objects are immutable. open¶
Whether to include the surface of the plane in the space.
True
means do not include the surface. Type
 __repr__()¶
A string representation of the Plane.
 __str__()¶
A string representation of the Plane.
 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. 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.
 class hoomd.wall.WallGeometry¶
Bases:
ABC
Abstract base class for a HOOMD wall geometry.
Walls are used in both HPMC and MD subpackages. Subclasses of
WallGeometry
abstract over the wall geometries for both use cases.