amepproject / amep

The Active Matter Evaluation Package (AMEP) - a Python library for the analysis of particle-based and continuum simulation data of soft and active matter systems
https://amepproject.de/
GNU General Public License v3.0
12 stars 2 forks source link

BUG: pbc.pbc_diff_rect incorrect #79

Closed kay-ro closed 1 week ago

kay-ro commented 1 month ago

Description:

The calculation of the distance while considering periodic boundaries, is incorrect.

Code for reproduction:

a=np.array([[196.975,138.612, 0.], [196.409, 137.663, 0.]])
b=np.array([196.69200403, 138.13750941,   0.        ])
box_boundary=np.array([[  0.,  223.6], [  0.,  223.6], [ -0.5,   0.5]])
print(amep.pbc.pbc_diff_rect(a,b,box_boundary))

Error message:

[[  0.28299597   0.47449059   0.        ]
 [223.31699597 223.12549059   0.        ]]

the distance should be very small instead of almost the whole box size.

Python and AMEP versions:

1.0.3

Additional information:

No response

How did you install AMEP?

from source