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:

    [Girls] study under the paralyzing idea that their acquirements cannot be brought into practical use. They may subserve the purposes of promoting individual domestic pleasure and social enjoyment in conversation, but what are they in comparison with the grand stimulation of independence and self- reliance, of the capability of contributing to the comfort and happiness of those whom they love as their own souls?
    Sarah M. Grimke (1792–1873)

    Every society consists of men in the process of developing from children into parents. To assure continuity of tradition, society must early prepare for parenthood in its children; and it must take care of the unavoidable remnants of infantility in its adults. This is a large order, especially since a society needs many beings who can follow, a few who can lead, and some who can do both, alternately or in different areas of life.
    Erik H. Erikson (1904–1994)

    After decades of unappreciated drudgery, American women just don’t do housework any more—that is, beyond the minimum that is required in order to clear a path from the bedroom to the front door so they can get off to work in the mourning.
    Barbara Ehrenreich (20th century)

    Woman is the future of man. That means that the world which was once formed in man’s image will now be transformed to the image of woman. The more technical and mechanical, cold and metallic it becomes, the more it will need the kind of warmth that only the woman can give it. If we want to save the world, we must adapt to the woman, let ourselves be led by the woman, let ourselves be penetrated by the Ewigweiblich, the eternally feminine!
    Milan Kundera (b. 1929)

    The metaphor of the king as the shepherd of his people goes back to ancient Egypt. Perhaps the use of this particular convention is due to the fact that, being stupid, affectionate, gregarious, and easily stampeded, the societies formed by sheep are most like human ones.
    Northrop Frye (b. 1912)