# How do I calculate atomic displacements after relaxation?

I have relaxed a 64-atom structure and would like to calculate the min/mean/max displacements relative to a defect center at the origin. In principle this is simple, but I am confused about how to deal with the periodic boundary conditions (PBC) in my unit cell. I am using Python to run all my calculations and would greatly appreciate any guidance on how to undo the PBCs before determining the displacements.

• If you have the input/output files, just compare the atoms inside the unit cells. Something like $\Delta x_1 = x_{1(output)} - x_{1(input)}$ for atom 1 and X coordinate, etc. Or you can calculate the RMSD value for the whole cell.
– Camps
Commented Jun 3 at 19:10
• What if the displacement magnitude is larger than half the lattice of the unit cell? Doesn't there need to be some sort of a minimum image distance convention enforced in the calculations? Commented Jun 3 at 19:47
• Well, as you have PBC, if an atom "fly-away" from one side of your unit cell with such big displacement, it will "appear" at the other side.
– Camps
Commented Jun 3 at 20:39
• If it appears on the other side, it will appear to have jumped discontinuously by a lattice constant... I have had to handle this situation before for MD trajectories. Solution: calculate the displacement at every step relative to the 0th step and, if at any given step the distance jumps by more than half a box vector, apply minimum image convention. This way, the displacements vary smoothly over time Commented Jun 13 at 16:04