Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Voronoi diagram with missing cells #1295

Open
michaelmaalouly opened this issue Nov 23, 2024 · 2 comments
Open

Voronoi diagram with missing cells #1295

michaelmaalouly opened this issue Nov 23, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@michaelmaalouly
Copy link

michaelmaalouly commented Nov 23, 2024

Description

Hello,

I am trying to create a Voronoi diagram from a lagrangian simulation where I have particles. The expectations for the particles in terms of the PDF of the Voronoi cell areas are good; however when I look at the diagram I see some empty spaces.

Here is an example:
Figure_1_test

Steps to Reproduce

L=2*pi
path_npz=appendpath+'lagr/output/npz/'
coord_tra=np.load(path_npz+'./xycoord.%.2d.npz'%(irun))
xtra=coord_tra['x']
ytra=coord_tra['y']
flatxy=zip_xy(xtra,ytra,ifr)
voro = freud.locality.Voronoi()
flatxy3d=flat2dto3d_shift(flatxy,-pi)

box = freud.box.Box.square(L)

voro.compute((box, flatxy3d))
vol=voro.volumes
# Plot Voronoi with points and a custom cmap
plt.figure()
ax = plt.gca()
voro.plot(ax=ax, cmap="RdBu")
ax.scatter(flatxy3d[:, 0], flatxy3d[:, 1], s=2, c="k")
plt.savefig('./lagr/output/img/vordiag.png')
plt.show()

Error Output

There is no output error, just a visualization issue.

freud Version

v3.1.0

Python Version

v3.13.0

System Platform

MacOS

Installation method

Download from conda-forge

Developer

None

@michaelmaalouly michaelmaalouly added the bug Something isn't working label Nov 23, 2024
@DomFijan
Copy link
Contributor

I see that you are converting your points from 2D to 3D. Can you confirm that this is done correctly in your snippet? z values should all be zero if system is 2D.

@michaelmaalouly
Copy link
Author

Yes that is exactly what is done with all the values of z set to zero.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants