mdanalysis
mdanalysis copied to clipboard
feat: add `RelPropertySelection` to select atoms based on positions relative to a given selection
Is your feature request related to a problem?
When investigating the solid/liquid interface, I would like to take the outermost solid atoms as the reference and analyse the liquid close to the surface (e.g., <= 5 angstroms away from the surface in the direction perpendicular to the surface). However, the reference might shifts during the simulation, and I would like to find a selection updated on-the-fly.
Describe the solution you'd like
I'd like to add a new selection class RelPropertySelection, which can be used in the following way:
relprop [abs] property operator value selection
For example, if I want to choose the water with the z distances to the surface smaller than 3 ang, I can use:
relprop z < 3.0 surface
where surface is the selection of the outermost surface atoms.
Sounds like an interesting selection operator.
Do other tools provide similar functionality?
As far as I know, no. I have implemented this feature (though in v2.3.0) in my own mda fork. The implementation is simple, and it should not influence the functionality of other modules in the selection.
If you already have an implementation then please feel free to put up a PR. It's easier to discuss concrete code than code in the abstract.
@MDAnalysis/coredevs what do you think about adding a relprop selection operator to the selection language?
You can just 👍 or 👎 this comment (and of course add any comments of your own).
It could be useful, so why not. However, relprop doesn't say anything to me; is this a standard name? If not, can we thing of something more explicit?