[lammps-users] Boundary Conditions Question


I’ve got some questions concerning the boundary conditions in LAMMPS.

(1) What exactly is the behaviour of the boundary conditions “f” and “m”? If one applies fixed boundary conditions, I’d expect the particles not to cross the fixed boundaries. But it seems like this happens if the boundary condition “f” is used. With the boundary condition “m” the particles are not leaving the simulation box. My condensed question is: What is the exact definition of “f” and “m”.

(2) The 2nd question is: Where are the boundary conditions evaluated in the source code? Only in domain.cpp with void Domain::minimum_image(double &dx, double &dy, double &dz) ? So far I was not able to track down where exactly the particle positions are updated in regard to the fixed boundaries. With fixed in this case I mean boundaries, which cannot be crossed such that the particles will stay in the inner of the simulation box.

Best regards:


I normally only use periodic boundary conditions, so I will defer your first question. With respect to your second question: particles are mapped back on every reneighboring through domain.cpp: Domain::pbc(). Domain::reset_box() applies wrapping when needed.


@Pieter: Thanks for the very quick reply. If this is the only code-sniplet, where the nonperiodic boundaries are applied: I cannot see anything for the conditions “f” in this function. Is “f” not handled at all? :confused:

@all: While reading domain.cpp I realized some magic numbers identifying the boundary conditions. A patch for cleaning up this section is attached. Maybe it can be inserted to the main branch after a cross-check.

Best regards: Gerolf

diff --git a/src/domain.cpp b/src/domain.cpp
old mode 100755
new mode 100644
index 3f285fd…b4cb491
— a/src/domain.cpp
+++ b/src/domain.cpp
@@ -40,6 +40,9 @@ using namespace LAMMPS_NS;
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#define MAX(a,b) ((a) > (b) ? (a) : (b))


The various boundary options are explained on the boundary command doc
page. Both 'f' and 'm' are non-periodic, so atoms at the other end of the
box should not be seen across the boundary in a perioidic sense. However,
non-periodic does not mean the atoms are constrained from moving beyond
the box boundary. If the 'f' case, if they do that, they will be
lost. If you don't
want to happen, use 's', 'M' is the same as 's' except the shrink wrapping will
not occur beyond a certain threshhold value.

Hope that helps,