fix wall/region command


fix ID group-ID wall/region region-ID style epsilon sigma cutoff
  • ID, group-ID are documented in fix command
  • wall/region = style name of this fix command
  • region-ID = region whose boundary will act as wall
  • style = lj93 or lj126 or colloid or harmonic
  • epsilon = strength factor for wall-particle interaction (energy or energy/distance^2 units)
  • sigma = size factor for wall-particle interaction (distance units)
  • cutoff = distance from wall at which wall-particle interaction is cut off (distance units)


fix wall all wall/region mySphere lj93 1.0 1.0 2.5


Treat the surface of the geometric region defined by the region-ID as a bounding wall which interacts with nearby particles according to the specified style.

The distance between a particle and the surface is the distance to the nearest point on the surface and the force the wall exerts on the particle is along the direction between that point and the particle, which is the direction normal to the surface at that point. Note that if the region surface is comprised of multiple “faces”, then each face can exert a force on the particle if it is close enough. E.g. for region_style block, a particle in the interior, near a corner of the block, could feel wall forces from 1, 2, or 3 faces of the block.

Regions are defined using the region command. Note that the region volume can be interior or exterior to the bounding surface, which will determine in which direction the surface interacts with particles, i.e. the direction of the surface normal. The surface of the region only exerts forces on particles “inside” the region; if a particle is “outside” the region it will generate an error, because it has moved through the wall.

Regions can either be primitive shapes (block, sphere, cylinder, etc) or combinations of primitive shapes specified via the union or intersect region styles. These latter styles can be used to construct particle containers with complex shapes. Regions can also change over time via the region command keywords (move) and rotate. If such a region is used with this fix, then the of region surface will move over time in the corresponding manner.


As discussed on the region command doc page, regions in LAMMPS do not get wrapped across periodic boundaries. It is up to you to insure that periodic or non-periodic boundaries are specified appropriately via the boundary command when using a region as a wall that bounds particle motion. This also means that if you embed a region in your simulation box and want it to repulse particles from its surface (using the “side out” option in the region command), that its repulsive force will not be felt across a periodic boundary.


For primitive regions with sharp corners and/or edges (e.g. a block or cylinder), wall/particle forces are computed accurately for both interior and exterior regions. For union and intersect regions, additional sharp corners and edges may be present due to the intersection of the surfaces of 2 or more primitive volumes. These corners and edges can be of two types: concave or convex. Concave points/edges are like the corners of a cube as seen by particles in the interior of a cube. Wall/particle forces around these features are computed correctly. Convex points/edges are like the corners of a cube as seen by particles exterior to the cube, i.e. the points jut into the volume where particles are present. LAMMPS does NOT compute the location of these convex points directly, and hence wall/particle forces in the cutoff volume around these points suffer from inaccuracies. The basic problem is that the outward normal of the surface is not continuous at these points. This can cause particles to feel no force (they don’t “see” the wall) when in one location, then move a distance epsilon, and suddenly feel a large force because they now “see” the wall. In a worst-case scenario, this can blow particles out of the simulation box. Thus, as a general rule you should not use the fix wall/gran/region command with union or interesect regions that have convex points or edges resulting from the union/intersection (convex points/edges in the union/intersection due to a single sub-region are still OK).


Similarly, you should not define union or intersert regions for use with this command that share an overlapping common face that is part of the overall outer boundary (interior boundary is OK), even if the face is smooth. E.g. two regions of style block in a union region, where the two blocks overlap on one or more of their faces. This is because LAMMPS discards points that are part of multiple sub-regions when calculating wall/particle interactions, to avoid double-counting the interaction. Having two coincident faces could cause the face to become invisible to the particles. The solution is to make the two faces differ by epsilon in their position.

The energy of wall-particle interactions depends on the specified style.

For style lj93, the energy E is given by the 9/3 potential:


For style lj126, the energy E is given by the 12/6 potential:


For style colloid, the energy E is given by an integrated form of the pair_style colloid potential:


For style wall/harmonic, the energy E is given by a harmonic spring potential:


In all cases, r is the distance from the particle to the region surface, and Rc is the cutoff distance at which the particle and surface no longer interact. The energy of the wall potential is shifted so that the wall-particle interaction energy is 0.0 at the cutoff distance.

For the lj93 and lj126 styles, epsilon and sigma are the usual Lennard-Jones parameters, which determine the strength and size of the particle as it interacts with the wall. Epsilon has energy units. Note that this epsilon and sigma may be different than any epsilon or sigma values defined for a pair style that computes particle-particle interactions.

The lj93 interaction is derived by integrating over a 3d half-lattice of Lennard-Jones 12/6 particles. The lj126 interaction is effectively a harder, more repulsive wall interaction.

For the colloid style, epsilon is effectively a Hamaker constant with energy units for the colloid-wall interaction, R is the radius of the colloid particle, D is the distance from the surface of the colloid particle to the wall (r-R), and sigma is the size of a constituent LJ particle inside the colloid particle. Note that the cutoff distance Rc in this case is the distance from the colloid particle center to the wall.

The colloid interaction is derived by integrating over constituent LJ particles of size sigma within the colloid particle and a 3d half-lattice of Lennard-Jones 12/6 particles of size sigma in the wall.

For the wall/harmonic style, epsilon is effectively the spring constant K, and has units (energy/distance^2). The input parameter sigma is ignored. The minimum energy position of the harmonic spring is at the cutoff. This is a repulsive-only spring since the interaction is truncated at the cutoff


For all of the styles, you must insure that r is always > 0 for all particles in the group, or LAMMPS will generate an error. This means you cannot start your simulation with particles on the region surface (r = 0) or with particles on the wrong side of the region surface (r < 0). For the wall/lj93 and wall/lj126 styles, the energy of the wall/particle interaction (and hence the force on the particle) blows up as r -> 0. The wall/colloid style is even more restrictive, since the energy blows up as D = r-R -> 0. This means the finite-size particles of radius R must be a distance larger than R from the region surface. The harmonic style is a softer potential and does not blow up as r -> 0, but you must use a large enough epsilon that particles always reamin on the correct side of the region surface (r > 0).

Restart, fix_modify, output, run start/stop, minimize info:

No information about this fix is written to binary restart files.

The fix_modify energy option is supported by this fix to add the energy of interaction between atoms and the wall to the system’s potential energy as part of thermodynamic output.

The fix_modify respa option is supported by this fix. This allows to set at which level of the r-RESPA integrator the fix is adding its forces. Default is the outermost level.

This fix computes a global scalar energy and a global 3-length vector of forces, which can be accessed by various output commands. The scalar energy is the sum of energy interactions for all particles interacting with the wall represented by the region surface. The 3 vector quantities are the x,y,z components of the total force acting on the wall due to the particles. The scalar and vector values calculated by this fix are “extensive”.

No parameter of this fix can be used with the start/stop keywords of the run command.

The forces due to this fix are imposed during an energy minimization, invoked by the minimize command.


If you want the atom/wall interaction energy to be included in the total potential energy of the system (the quantity being minimized), you MUST enable the fix_modify energy option for this fix.