Hello.
I would like to use the VoronoiAnalysisModifier
to identify the neighbors for each atom. Specifically, I want to find three neighbors that share a vertex of a Voronoi cell; together with the central atom, these three neighbors form a tetrahedron. Therefore, I need to know which neighbors form each face of the Voronoi cell.
However, when I used the VoronoiAnalysisModifier
to obtain the vertex coordinates for each face, I noticed that the vertex coordinates provided by OVITO
seem to have issues. For instance, below is the Voronoi cell I obtained from the OVITO
graphical interface, and it is clear that the z-coordinates of the vertices cannot exceed the box length (which is 27.1).
While processing with the following code, I found that some of the printed z-components exceed 30.
Could you please explain what might be happening here? Additionally, if I want to know which neighbors form each face, can OVITO directly provide this information? I noticed that it does not seem to be mentioned in the manual.
Thank you in advance for your assistance.
Codes and Data
from ovito.io import import_file
from ovito.modifiers import VoronoiAnalysisModifier, ExpressionSelectionModifier, DeleteSelectedModifier, WrapPeriodicImagesModifier
file = "./particle_id_532_movecenter.colloid"
atom_id = 532
pipeline = import_file(file)
pipeline.modifiers.append(WrapPeriodicImagesModifier())
pipeline.modifiers.append(VoronoiAnalysisModifier(generate_polyhedra=True, ))
pipeline.modifiers.append(ExpressionSelectionModifier(operate_on="surface_regions", expression="ParticleIdentifier!=%s" % atom_id))
pipeline.modifiers.append(DeleteSelectedModifier())
pipeline_atoms = pipeline.compute(0)
mesh = pipeline_atoms.surfaces["voronoi-polyhedra"]
face_vertices = mesh.get_face_vertices()
vertices = mesh.vertices["Position"]
print("face ver pos")
for one_face_ver in face_vertices:
print(vertices[one_face_ver])
particle_id_532_movecenter.colloid (29.5 KB)