Support for 2D slices of surfaces

I recently used MultiWFN for the first time (and hopefully the last time…) to plot some electron densities in 2D topographical maps.

This made me think about when I used to use Spartan in undergrad, which had a very nice feature that let you display a slice of the electron density as a contour diagram and had a box that you could click and drag and rotate however you wanted.

This feature doesn’t seem too hard to implement, especially with volumetric rendering seemingly right around the corner, so I’m creating this post in the hopes that there can be a bit of discussion around this, and to check if there are any pre-existing plans for making a tool like this.

Yes, it can be a nice feature for some uses. I don’t think there’s anything filed over on the issue tracker to get on the roadmap.

From the coding perspective, it’s fairly easy to color map the “cube” onto a rectangle (e.g., we already map electrostatic potential onto surface meshes).

I think the bigger question is the interface towards manipulating the surface / plane. Is it something you can “grab” with the manipulate tool? Does it only interact with the surface dialogs? Something else? Are they more general “plane” objects that can be used for measurements?

So yes, it sounds useful, but sketching out how these would work in the interface is the next step.

I think the interface should have a few options for users. Perhaps the simplest is to use 2-3 atoms to define a plane. The 3-atom case should be easy, since 3 points always defines a plane. The 2-atom case could probably reuse the code from the bond-centric manipulation tool that creates a plane around a bond (blue rectangle below).

That plane is already rotatable by clicking and dragging, which I think would be nice to have for a slice tool.

Those would get the ball rolling, and I think it’d also be very nice to use some of the molecule’s symmetry elements to define planes, e.g. a σ_v reflection plane.

For a more general case, I think letting users pick a rectangle and then giving sliders on it to indicate translation versus rotation in each direction. For example a little arrow for each of the faces (in the corners I think would be best) that you can click and drag to translate/slide the box around, then perhaps some keybind to show a draggable wheel for rotation.

That’s just my initial ideas, so obviously subject to change.