Implementing Cubic Periodic Boundaries 1.
Details vary with representation of coordinates
- Box size
unit box, coordinates scaled by edge length
dr.x = dimensions.x * (r1.x - r2.x); //difference in x coordinates
full-size box, coordinates represent actual values
- Box origin
center of box, coordinates range from -L/2 to +L/2
corner of box, coordinates range from 0 to L
Two approaches
- decision based (“if” statements)
- function based (rounding (nint), truncation, modulo)
- relative speed of each approach may vary substantially from one computer platform to another