Jump to content

Talk:Periodic boundary conditions

Page contents not supported in other languages.
From Wikipedia, the free encyclopedia


Untitled

[edit]

Way too specific. periodic boundary conditions are way more general than the specific applications of molecular dynamics simulations. Most of the text is irrelevant. —Preceding unsigned comment added by 128.101.142.157 (talk) 19:18, 16 February 2008 (UTC)[reply]


implementation trick

[edit]

For something like MD, when looping through each particle, conventional wisdom is that any "if" statement is slow. I don't know if this is still true on modern CPUs and with good compilers. But, if you want to avoid an "if" statement, then here's an old trick:

"if" statement version:

 (loop over particles)
  if (x <  -xsize/2.0) x=x+xsize
  if (x >=  xsize/2.0) x=x-xsize
 (end loop)

version without "if" statements:

 (loop over particles)
  BC = xsize * f( x / xSize );
  x -= BC
 (end loop)

where f is a function defined such that f(x) = 1 if x > 1/2, f(x) = 0 if -1/2 < x < 1/2, and f(x) = -1 if x < -1/2 (with the assumption that the particle is never more than one box-length away).

Of course, if "f" is defined using an "if" statement, then there's no benefit, but if you have a clever implementation of f, using, e.g. bit-shifts, or a bit-mask, etc., then the code can see a real speed improvement. Lavaka (talk) 16:09, 23 October 2008 (UTC)[reply]

Assessment comment

[edit]

The comment(s) below were originally left at Talk:Periodic boundary conditions/Comments, and are posted here for posterity. Following several discussions in past years, these subpages are now deprecated. The comments may be irrelevant or outdated; if so, please feel free to remove this section.

I am afraid that "periodic boundary conditions" and "Born-von Karman boundary conditions" have in fact same meaning. Thus, these two Wikipedia articles should be merged.

In my opinion (I am solid state physicist) it is possible and will lead to a more general nature of the topic.

Regards, Kristof Lebecki

Last edited at 07:51, 27 July 2007 (UTC). Substituted at 02:39, 30 April 2016 (UTC)