Cylinder¶
- 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.Example:
cylinder = hoomd.wall.Cylinder(radius=10.0, axis=(0, 0, 1))
- 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.