How to count specific particles within the surface defined by ConstructSurfaceModifier?

Hello,

I’m using OVITO’s ConstructSurfaceModifier to generate a surface (using the AlphaShape method) that defines the volume of a gel region in my system. I would like to go a step further and count the number of a specific particle type (e.g., Na⁺ ions) within this defined surface region.

I’ve tried a few approaches to determine if these Na⁺ particles are inside the constructed surface mesh, but I haven’t found a direct way to count the Na⁺ ions within this surface region. Could anyone advise if there is a more straightforward or recommended method for counting specific particles inside a region defined by ConstructSurfaceModifier? Any suggestions or example code would be greatly appreciated!

Hi,
In case your particles haven’t been mapped to any regions yet, you can use the locate_point() method of the SurfaceMesh class to identify particles that are inside a specific region.
Feel free to contact OVITO Pro support if you need further guidance.

Thank you very much! I will try it.