next up previous

2.2 Periodic boundary conditions (PBC) and nearest image convention (NIC)

To avoid ``wall effects''we surround the basic cell containing the $N$ particles by periodic images of itself.

Spin lattices: In each coordinate direction the last (``rightmost'') spin in a row interacts also with a right neighbor, which is taken to be identical to the first (leftmost) spin in that row, and vice versa (see Figure).

Figure 2.1: Periodic boundary conditions on a spin lattice
\begin{figure}\includegraphics[width=180pt]{figures/f6perbb.ps}
\end{figure}


Fluid: Apply the following rule:
For each particle $i$ store, instead of any coordinate $x_{i}$, the quantity

\begin{displaymath}
(x_{i}+2L)  \mbox{mod} L
\end{displaymath}

(with $L$ the side length of the cell). When a particle leaves the cell to the right, it is automatically replaced by a particle entering from the left, etc.


Nearest Image Convention: In computing pair vectors between two particles $i$ and $j$ one needs only differences of coordinate values. If this coordinate difference $\Delta x_{ij} \equiv x_{j}-x_{i}$ is larger than $L/2$, then the particle $j$ will not be regarded as an interaction partner of $i$; instead, its left periodic image with coordinate $x_{j}-L$ interacts with $i$.

The NIC rule may be implemented by a sequence of IF commands or by the more compact code line

\begin{displaymath}
\Delta x = \Delta x - L \cdot \mbox{nint}\left( \frac{\Delta x}{L}\right)
\end{displaymath}

where nint($a$) denotes the rounded value of $a$, i.e. the integer nearest to $a$. This formulation of NIC is also better suited for vectorising compilers.
next up previous
F. J. Vesely / University of Vienna