Suppose, the size of my simulation box is:

  • Width = 200
  • Height = 100


  • Top-left corner = (0, 0)
  • Bottom-right corner = (200,100)
  • Center of the coordinate is at (100, 50)

What would be the size of the periodic boundary?

Is that the same size as the dimensions of the simulation box, or is it different?


2 Answers 2


Some pseudo-code

x_length = 200
y_length = 100

if x < 0: x += x_length
if x > x_length: x -= x_length
if y < 0: y += y_length
if y > y_length: y -= y_length

As you have alluded to, periodic boundary conditions adjust a coordinate by the size of the simulation box in that dimension.

I recommend Understanding Molecular Simulation Algorithms by Frenkel & Smit and Computer Simulation of Liquids by Allen & Tildesley. They are a rich source of simulation knowledge.

  • $\begingroup$ Your units are a little funny since (0,0) is top left --- This is how computer screens work. Isn't it? $\endgroup$
    – user366312
    Commented May 1, 2022 at 2:28
  • 1
    $\begingroup$ I don't know, positive x values usually go to the right, positive y values usually go up, but in the end, it doesn't matter $\endgroup$
    – B. Kelly
    Commented May 1, 2022 at 2:46
  • $\begingroup$ positive x values usually go to the right, positive y values usually go up --- Not always. Especially if you are drawing on a Win32 GUI-based form. $\endgroup$
    – user366312
    Commented May 1, 2022 at 3:05
  • $\begingroup$ @user366312 you may appreciate The Art of Molecular Dynamics Simulation by D.C. Rapaport. My impression is you have no issue coding, but are new to the application of molecular simulation. Rapaport has alot of really insightful code written in C. cambridge.org/core/books/art-of-molecular-dynamics-simulation/… $\endgroup$
    – B. Kelly
    Commented May 2, 2022 at 13:56
  • Simulation box/cell: It is the box or the defined region with specified dimension that you build to study your system with specific number of molecules (based on density). Your system size should be large enough to avoid the finite size effect but small enough to avoid undue computation time.

  • Periodic Boundary: In terms of dimension, as you asked it will be the same. But in technical sense, periodic boundary is a method which replicates your simulation cell into an infinite lattice.

Dimension will be the same of your simulation box size but two are different in technical meaning.

As @B.kelly answered, you could go through number of good reference books to understand the concept well (Computer Simulation of Liquids by Allen and Tidsley). This book is well known among those working with MD simulations.

  • 2
    $\begingroup$ As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. $\endgroup$
    – Community Bot
    Commented Dec 30, 2022 at 13:38

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .