# Distance between particles does not match for deformed box

Dear Lammps developers,

I am simulating a 2D system of particles with granular hooke contact force:

pair_style gran/hooke {knAbs} 0 {gammanAbs} 0 0 0
pair_coeff * *

fix integr all nve/sphere
fix stick_id all enforce2d

To apply shearing, I deform the box with a shear rate shearRate:

fix boxDeform all deform 1 xy erate \${shearRate} remap v

Then I dump particles that have overlap:

compute 1 all property/local patom1 patom2 cutoff radius

and I dump distance and force between them:

compute 2 all pair/local dist force fx fy fz cutoff radius

I also dump position of all particles

dump dmp3 all custom \${dumpSteps} dump.all.* id radius mass x y z vx vy vz omegax omegay omegaz

After all, I get positions of contacting particles from the dump
files (x1, y1) and (x2, y2), then I calculate the distance between them. I consider
periodic distance between them if they have an over-boundary
contacts (this is simply done by adding/subtracting the box
length):

dx = x1 - x2

dy = y1 - y2

## for over-boundary contacts

dx = periodic(dx)

dy = periodic(dy)

and the calculate the distance

dist = sqrt( dx * dx + dy * dy )

Then I compare this distance with the one which is provided by
Lammps in the dump file.

I am surprised that they are very different!

The difference starts from 10% up to 100%. The latter for
contacts that are over boundaries.

I have cross-checked my calculations more than a week!

Apparently for the deformed box the distance is calculated via a
different formula, maybe something like

dx = x1 - x2 -/+ shearRate * (some time scale) * (box length)

Would you mind please let me know how the distance in deformed
box is calculated.

Can you refer me to to that line in the code so I can see it exactly.

I would like to update my latest email.

I re-installed my lammps.

Now problem with over-boundary contacts persists, I can not get the distance which is calculated by lammps

Example : P1 position (-280.372, -299.835, 0.0), P2 position ( (-97.0773, 299.141, 0.0) Box length = 600

calculated distance by myself : 183.297560333 distance by lammps: 1.39993

Contacts that are inside bulk they have only a rounding difference

for example: P1 at (246.817, -272.008, 0.0), P2 at (247.666, -273.121, 0.0)
calculated distance is 1.39984642015 lammps distance is 1.39996

So contacts over boundary are doing something else!