Wall geometries¶
Overview¶
Questions¶
How can I define smooth wall surfaces?
Objectives¶
Show how to create wall geometries.
Explain that wall geometries are surfaces.
Boilerplate Code¶
[1]:
import hoomd
Sphere, Cylinder, and Planar Walls¶
The previous section of this tutorial showed how to place particles to form barriers. You can use this technique to place arbitrarily shaped barriers with rough surfaces. To define a smooth surface, use one or more of the wall geometry classes: Sphere
, Cylinder
, and/or Plane
.
Each of these classes describes a two dimensional surface in a three dimensional space. Each surface separates the space into two regions: One where particles are expected (described by a positive signed distance to the surface) and one where particles are not (described by a negative signed distance).
As described in Barriers, the particles are always wrapped into the primary simulation box image. Thus, particles will interact only with the portions of the wall geometries that lie in (or just outside) the primary box image.
Sphere Wall Geometry¶
The Sphere
wall geometry defines a spherical surface. You can place a Sphere
wall where particles are expected on the inside of the sphere:
[2]:
sphere = hoomd.wall.Sphere(radius=10, inside=True)
or on the outside:
[3]:
sphere = hoomd.wall.Sphere(radius=5, inside=False)
Cylinder Wall Geometry¶
The Cylinder
wall geometry defines the surface of an infinite right circular cylinder along a given axis. Typically, you should align the cylinder to the x, y, or z axis to match the periodic boundary conditions:
[4]:
cylinder = hoomd.wall.Cylinder(radius=10, axis=(0, 0, 1), inside=True)
As with spheres, you can also place a Cylinder
where particles are expected on the outside:
[5]:
cylinder = hoomd.wall.Cylinder(radius=10, axis=(1, 0, 0), inside=False)
Plane Wall Geometry¶
The Plane
wall geometry defines an infinite plane. The normal vector points toward the region where the particles are expected:
[6]:
plane = hoomd.wall.Plane(origin=(0, 0, 0), normal=(0, 1, 0))
Box Size Scaling¶
Wall geometries are surfaces defined by the given parameters. They are not part of the system state and are not defined in proportion to the simulation box. No operations in HOOMD-blue scale or move wall geometries. For example, BoxResize
will scale the periodic box and the particle positions but leave all wall geometries fixed with the parameters you defined. When needed, you should provide code that changes the parameters of your wall geometries.
Conclusion¶
This tutorial gave examples of several wall geometries. The next two sections will demonstrate using these to confine particles in MD and HPMC simulations.