marrink-lab / vermouth-martinize

Describe and apply transformation on molecular structures and topologies
Apache License 2.0
86 stars 38 forks source link

Unable to combine criteria for elastic network selection #467

Open pckroon opened 1 year ago

pckroon commented 1 year ago

465 fixed #459, but it disabled the ability to combine elastic network criteria. Currently (after #465 gets merged at least) users can select as -eunit either chain, molecule, all, or a region defined by a range of resids. It is currently not possible to obtain an elastic network where the elastic bonds are only within chain and only in the region resid 200-400.

The elastic network processor evaluates the criterion on every node individually, and an elastic bond is added for every pair of nodes where the criterion is True for both.

The options chain, molecule and all are semantically mutually exclusive; the region selection is the odd one out. Option 1 is therefor to restore the region option as an independent CLI flag, and implying a logical AND between -eunit and -region. This was the intended behaviour of #422. This would be a 1-banana solution.

Option 2 is more involved: expand the -eunit option to take a selection syntax, consisting of the existing options and logical operators AND, OR and NOT. There would be no change in current CLI behaviour, and the desired functionality can be achieved with for example -eunit "chain AND 100-300". This would also enable useful behaviour of easily excluding regions or chains (e.g. -eunit "NOT 200-400"). This would be a 2-3 banana solution.