This document serves to explain how the minimum distances are calculated by working through an example of a cube in a periodic box.
First, we need to define our system. For this example, we will have a single cube of position (3, 3, 3) inside a cubic periodic box of size 10x10x10.
We will define the vertices of the cube as:
Delete later:
The vertices of any shape are user defined. In this example, the vertices are defined with the origin as the center of the cube, but it is not a requirement to have the origin as the center of the shape when defining the vertices.
From the vertices, we can get the edge vectors, which are taken to be the difference between the two corresponding vertices for each edge. We define two variables: edge-vertex neighbors (
(Note: In the code, the edge-vertex neighbors variable contains only integer values, which correspond to the indices of the vertices)
For a cube, the normals of the faces are calculated by taking the cross product of two adjacent edges. In the code, the software package, Coxeter, is used to calculate the normals. For this example, the normals of the faces are:
We also define another variable, edge-face neighbors (
(Note: In the code, the edge-face neighbors variable contains only integer values, which correspond to the indices of the faces)
We define a zone such that these two variables,
The matrix,
(Note: The magnitudes of the normals in matrix
We will now work through how a vertex zone is created and how the minimum distance calculations are done for the grid points that exist within this vertex zone.
For this example, we will look at the zone created by vertex
Now we can calculate the corresponding
(Note: __magnitudes)
Edge zones + dist calc
Face zones + dist calc
Image bounds