glotzerlab / freud

Powerful, efficient particle trajectory analysis in scientific Python.
https://freud.readthedocs.io
BSD 3-Clause "New" or "Revised" License
270 stars 49 forks source link

Voronoi duplicate error terminates code #1008

Open michaelmaalouly opened 2 years ago

michaelmaalouly commented 2 years ago

Describe the bug I am using freud’s locality module specifically Voronoi to get Voronoi cell volumes for some scattered particles. I’ve been using it seamlessly until my latest simulation started giving the following output: "Duplicate: 45311 (2.34494,2.91141,0) matches 41483 (2.34494,2.9114,0)”. After this output the code terminates, I get it after applying "voro.compute((box, flatxy3d))". I was unable to find anything related to this message in the documentation. For a simulation of duration time = 30, I am able to calculate volumes up until time = 25, and after time = 25 I start getting the mentioned error (if it is an error). Is there a workaround?

To Reproduce Steps to reproduce the behavior:

    voro = freud.locality.Voronoi()
    box = freud.box.Box.square(L)
    voro.compute((box, flatxy))
    vol=voro.volumes

The data is tracers advected by a 2D turbulent flow

Error output Duplicate: 45311 (2.34494,2.91141,0) matches 41483 (2.34494,2.9114,0)

System configuration (please complete the following information):

bdice commented 2 years ago

@michaelmaalouly This error is probably specific to your data, and might be an issue with numerical precision (those have come up a few times in the Voronoi code and are very tough to reproduce). I'd be happy to take a look but you'll need to share the raw data file that causes this error before we can diagnose the cause and fix the bug. It'd be fine to include just two frames: one frame that works, and one that raises the error. Thanks!

michaelmaalouly commented 2 years ago

@bdice thank you for the swift reply. Here's a link for two npz files, one containing a good frame and the other a frame that triggers the error with a script that treats both using voronoi (test.py). I hope it helps. https://drive.google.com/drive/folders/1ZnI4QpiXJ8RfBST7WQVdyzL550N7efZ2?usp=sharing

Thanks!