# What is the relationship between periodic boundary and the simulation box?

Suppose, the size of my simulation box is:

• Width = 200
• Height = 100

Where,

• 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?

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.

• Your units are a little funny since (0,0) is top left --- This is how computer screens work. Isn't it? May 1, 2022 at 2:28
• 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 May 1, 2022 at 2:46
• 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. May 1, 2022 at 3:05
• @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/… 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.