# DMD:Background:Periodic Boundary Conditions

Introduction |

Background |

Basic Layout |

Examples |

Problems |

Run Simulation |

Assessment |

Credits |

Etomica Modules |

The description above assumes that collisions occur either between atoms or with the wall. Note that walls would represent a substantial surface to volume ratio for a system of, say, 4 particles that are close together. In such a system, interactions with the walls would comprise a substantial portion of all the interactions. In a real fluid, the fraction of molecules interacting with the walls is actually extremely small, so this wall issue is really somewhat artificial. How can we avoid it?

If you think about it, the molecules inside our simulation box should be interacting with other molecules, not walls. We can mimic this effect through “periodic boundary conditions” (PBCs). All of the forces, collisions, position updates, etc. should be conducted such that molecules on one side of the box interact with molecules on the other side of the box. An illustration of the PBCs is given below and the dynamic applet on the SWMD page. Try clicking on the buttons there and reading the relevant text if you have any trouble understanding the figures below.

Briefly, you can get the idea by looking carefully at the central square and its magnified image to the right. Two small slivers of disks are entering through the northern boundary, just as the remaining portions of the same disks are leaving from the southern boundary. This is easy to do in a computer simulation. The point is that it eliminates the smooth walls and creates boundaries that look indistinguishable from the rest of the fluid. You can run into trouble if you make the box too small, but you get reasonable results when the simulation box is more than five times the disk diameter, as it is in this illustration.

The problem that arises in the absence of walls is how to compute the pressure. The derivation begins with the virial theorem, dating back to Clausius.

Erpenbeck and Wood show that

With the final result that

Qualitatively, this equation says that the forces within a spherical volume element sum up to a pressure over the surface of that volume element. If we average over all possible sizes of that volume element (ie. ), then we get the total pressure. Knowing more about this particular derivation is beyond the scope of this discussion, but you might recognize some similarity to the pressure equation discussed with the macroscopic equations (EL p212). Note, however, that is a change velocity, whereas is a change in potential energy.

Exercise: Example_4

Homework: Problem 1.2.5, Problem 1.3.4,