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:

    Whether there be any such moral principles, wherein all men do agree, I appeal to any, who have been but moderately conversant in the history of mankind, and looked abroad beyond the smoke of their own chimneys. Where is that practical truth, that is universally received without doubt or question, as it must be, if innate?
    John Locke (1632–1704)

    There is never a beginning, there is never an end, to the inexplicable continuity of this web of God, but always circular power returning into itself.
    Ralph Waldo Emerson (1803–1882)

    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)

    No man hath any quarrel to me. My remembrance is very free and clear from any image of offence done to any man.
    William Shakespeare (1564–1616)

    “We’ll encounter opposition, won’t we, if we give women the same education that we give to men,” Socrates says to Galucon. “For then we’d have to let women ... exercise in the company of men. And we know how ridiculous that would seem.” ... Convention and habit are women’s enemies here, and reason their ally.
    Martha Nussbaum (b. 1947)