Periodic boundary conditions
In mathematical models and computer simulations, periodic boundary conditions (PBC) are a set of boundary conditions that are often used to simulate a large system by modelling a small part that is far from its edge. Periodic boundary conditions resemble the topologies of some video games; a unit cell or simulation box of a geometry suitable for perfect three-dimensional tiling is defined, and when an object passes through one face of the unit cell, it reappears on the opposite face with the same velocity. The simulation is of an infinite perfect tiling of the system. In topological terms, the space can be thought of as being mapped onto a torus (compactification). The tiled copies of the unit cell are called images, of which there are infinitely many. During the simulation, only the properties of the unit cell need be recorded and propagated. The minimum-image convention is a common form of PBC particle bookkeeping in which each individual particle in the simulation interacts with the closest image of the remaining particles in the system.
An example occurs in molecular dynamics, where PBC are usually applied to simulate bulk gasses, liquids, crystals or mixtures. A common application uses PBCs to simulate solvated macromolecules in a bath of explicit solvent. Born-von Karman boundary conditions are periodic boundary conditions for a special system.
PBC requirements and artifacts
Periodic boundary conditions are particularly useful for simulating a part of a bulk system with no surfaces present. Moreover, in simulations of planar surfaces, it is very often useful to simulate two dimensions (e.g. x and y) with periodic boundaries, while leaving the third (z) direction with different boundary conditions, such as remaining vacuum to infinity. This setup is known as slab boundary conditions.
PBC can be used in conjunction with Ewald summation methods (usually particle mesh Ewald) of accounting for electrostatic forces in the system. However, PBC also introduces correlational artifacts that do not respect the translational invariance of the system, and requires constraints on the composition and size of the simulation box.
In simulations of solid systems, the strain field arising from any inhomogenuity in the system will be artificially truncated and modified by the periodic boundary. Similarly, the wavelength of sound or shock waves and phonons in the system is limited by the box size.
In simulations containing ionic (Coulomb) interactions, the net electrostatic charge of the system must be zero to avoid summing to an infinite charge when PBC is applied. In some applications it is appropriate to obtain neutrality by adding ions such as sodium or chloride (as counterions) in appropriate numbers if the molecules of interest are charged. Sometimes ions are even added to a system in which the molecules of interest are neutral, to approximate the ionic strength of the solution in which the molecules naturally appear. Maintenance of the minimum-image convention also generally requires that a spherical cutoff radius for nonbonded forces be at most half the length of one side of a cubic box. Even in electrostatically neutral systems, a net dipole moment of the unit cell can introduce a spurious bulk-surface energy, equivalent to pyroelectricity in polar crystals.
The size of the simulation box must also be large enough to prevent periodic artifacts from occurring due to the unphysical topology of the simulation. In a box that is too small, a macromolecule may interact with its own image in a neighboring box, which is functionally equivalent to a molecule's "head" interacting with its own "tail". This produces highly unphysical dynamics in most macromolecules, although the magnitude of the consequences and thus the appropriate box size relative to the size of the macromolecules depends on the intended length of the simulation, the desired accuracy, and the anticipated dynamics. For example, simulations of protein folding that begin from the native state may undergo smaller fluctuations, and therefore may not require as large a box, as simulations that begin from a random coil conformation. However, the effects of solvation shells on the observed dynamics – in simulation or in experiment – are not well understood. A common recommendation based on simulations of DNA is to require at least 1 nm of solvent around the molecules of interest in every dimension.
Practical implementation: continuity and the minimum image convention
To implement periodic boundary conditions in practice, at least two steps are needed.
The first is to make an object which leaves the simulation cell on one side enter back on the other. This is of course a simple operation, and could in code be e.g. (for the x dimension, assuming an orthogonal unit cell centered on the origin):
if (periodicx) then if (x < -xsize*0.5) x=x+xsize if (x >= xsize*0.5) x=x-xsize endif
The second is to make sure that every distance between atoms, or other vector calculated from one atom to another, has a length and direction which corresponds to the minimum image criterion. This can be achieved as follows to calculate e.g. the x direction distance component from atom i to atom j:
if (periodicx) then dx = x(j) - x(i) if (abs(dx) > xsize*0.5) dx = dx - sign(xsize,dx) endif
Naturally both operations should be repeated in all 3 dimensions.
These operations can be written in much more compact form for orthorhombic cells if the origin is shifted to a corner of the box. Then we have, in one dimension, for positions and distances respectively:
! After x(i) update without regard to PBC: x(i)=x(i)-floor(x(i)/xsize)*xsize !For a box with the origin at the lower left vertex ! Works for xs lying in any image. dx=x(j)-x(i) dx=dx-nint(dx/xsize)*xsize
For non-orthorhombic cells the situation can be considerably more complicated.
In simulations of ionic systems considerably more complicated operations may be needed to handle the long-range Coulomb interactions.
Unit cell geometries
PBC requires the unit cell to be a shape that will tile perfectly into a three-dimensional crystal. Thus, a spherical or elliptical droplet cannot be used. A cube or rectangular prism is the most intuitive and common choice, but can be computationally expensive due to unnecessary amounts of solvent molecules in the corners, distant from the central macromolecules. A common alternative that requires less volume is the truncated octahedron.
Under periodic boundary conditions, the linear momentum of the system will be conserved. Angular momentum is not conserved because the PBC system is not rotationally symmetric. When applied to the microcanonical ensemble (constant particle number, volume, and energy, abbreviated NVE), using PBC rather than reflecting walls slightly alters the sampling of the simulation due to the conservation of total linear momentum and the position of the center of mass; this ensemble has been termed the "molecular dynamics ensemble" or the NVEPG ensemble. These additional conserved quantities introduce minor artifacts related to the statistical mechanical definition of temperature, the departure of the velocity distributions from a Boltzmann distribution, and violations of equipartition for systems containing particles with heterogeneous masses. The simplest of these effects is that a system of N particles will behave, in the molecular dynamics ensemble, as a system of N-1 particles. These artifacts have quantifiable consequences for small toy systems containing only perfectly hard particles; they have not been studied in depth for standard biomolecular simulations, but given the size of such systems, the effects will be largely negligible.
- Cheatham TE, Miller JH, Fox T, Darden PA, Kollman PA. (1995). Molecular Dynamics Simulations on Solvated Biomolecular Systems: The Particle Mesh Ewald Method Leads to Stable Trajectories of DNA, RNA, and Proteins. J Am Chem Soc 117:4193.
- de Souza ON, Ornstein RL. (1997). Effect of periodic box size on aqueous molecular dynamics simulation of a DNA dodecamer with particle-mesh Ewald method. Biophys J 72(6):2395-7. PMID 9168016
- Minimum image convention in non-cubic simulation cells
- Erpenbeck JJ, Wood WW. (1977). Statistical Mechanics, Part B: Time-dependent Processes, Modern Theoretical Chemistry Vol 6. ed. Berne BJ. Plenum, New York, USA. See pp1-40.
- Shirts RB, Burt SR, Johnson AM. (2006). Periodic boundary condition induced breakdown of the equipartition principle and other kinetic effects of finite sample size in classical hard-sphere molecular dynamics simulation. J Chem Phys 125(16):164102. PMID 17092058
- Schlick T. (2002). Molecular Modeling and Simulation: An Interdisciplinary Guide. Interdisciplinary Applied Mathematics series, vol. 21. Springer: New York, NY, USA. ISBN 0-387-95404-X. See esp. pp272–6.
- Rapaport DC. (2004). The Art of Molecular Dynamics Simulation. 2nd ed. Cambridge University Press. ISBN 0-521-82568-7. See esp. pp15–20.