mdanalysis icon indicating copy to clipboard operation
mdanalysis copied to clipboard

feat: add `RelPropertySelection` to select atoms based on positions relative to a given selection

Open ChiahsinChu opened this issue 11 months ago • 5 comments

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.

ChiahsinChu avatar Dec 16 '24 07:12 ChiahsinChu

Sounds like an interesting selection operator.

Do other tools provide similar functionality?

orbeckst avatar Dec 17 '24 20:12 orbeckst

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.

ChiahsinChu avatar Dec 18 '24 01:12 ChiahsinChu

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.

orbeckst avatar Dec 18 '24 04:12 orbeckst

@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).

orbeckst avatar Dec 19 '24 20:12 orbeckst

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?

RMeli avatar Dec 19 '24 20:12 RMeli