Getting atoms inside a .stl object
-

I was wondering if it was possible to use a .stl object to carve crystals in SAMSON. I've been trying out different python snippets provided by the AI assistant which seem like they are just on the verge of doing it, but ultimately are missing some capability I can't quite find a way to add. SAMSON_STL.sam
The idea is it you could position a solid mesh object on your crystal model, do some a test to see if an atom is inside the mesh, and then delete that atom. For simple meshes the test could be if it is inside the bounding box of the mesh.
This could be a cool feature. SAMSON file attached of the system in the image.
Thanks,
Tom
-
I went back and tried to open the file I uploaded here and I get an error that it can't be loaded. Maybe .stls cannot be saved in a .sam?
-
Hi Tom, it might be possible to use some computational geometry libraries that would determine whether a point in inside a triangulated object (it's non trivial for non-convex objects, but they can often be decomposed into convex parts). I'll look into the serialization of the STL objects but I don't immediately see any issues.
-
This one might help: https://github.com/quant-sci/compute-geometry. If you have a convex object like the one in the image, I guess you'd first compute its convex hull thanks to this library, and you'd then use the resulting convex hull to determine whether an atom is inside or not.