Periodic Boundary Conditions - Practical Implementation: Continuity and The Minimum Image Convention

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/(0.5*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.

Read more about this topic:  Periodic Boundary Conditions

Famous quotes containing the words practical, continuity, minimum, image and/or convention:

    One of the great triumphs of the nineteenth century was to limit the connotation of the word “immoral” in such a way that, for practical purposes, only those were immoral who drank too much or made too copious love. Those who indulged in any or all of the other deadly sins could look down in righteous indignation on the lascivious and the gluttonous.... In the name of all lechers and boozers I most solemnly protest against the invidious distinction made to our prejudice.
    Aldous Huxley (1894–1963)

    The dialectic between change and continuity is a painful but deeply instructive one, in personal life as in the life of a people. To “see the light” too often has meant rejecting the treasures found in darkness.
    Adrienne Rich (b. 1929)

    There are ... two minimum conditions necessary and sufficient for the existence of a legal system. On the one hand those rules of behavior which are valid according to the system’s ultimate criteria of validity must be generally obeyed, and on the other hand, its rules of recognition specifying the criteria of legal validity and its rules of change and adjudication must be effectively accepted as common public standards of official behavior by its officials.
    —H.L.A. (Herbert Lionel Adolphus)

    With a new familiarity and a flesh-creeping “homeliness” entirely of this unreal, materialistic world, where all “sentiment” is coarsely manufactured and advertised in colossal sickly captions, disguised for the sweet tooth of a monstrous baby called “the Public,” the family as it is, broken up on all hands by the agency of feminist and economic propaganda, reconstitutes itself in the image of the state.
    Percy Wyndham Lewis (1882–1957)

    No convention gets to be a convention at all except by grace of a lot of clever and powerful people first inventing it, and then imposing it on others. You can be pretty sure, if you are strictly conventional, that you are following genius—a long way off. And unless you are a genius yourself, that is a good thing to do.
    Katharine Fullerton Gerould (1879–1944)