Once you've created one or more atom selections, you can combine them to create new ones.
>>> CA = AtomSel('name CA') >>> resid5 = AtomSel('resid 5') >>> CA name CA >>> resid5 resid 5 >>> ANDsel = CA & resid5 >>> ORsel = CA | resid5 >>> NOTsel = -CA >>> ANDsel (name CA) and (resid 5) >>> ORsel (name CA) or (resid 5) >>> NOTsel not (name CA) >>>
When the combined atom selections are from different molecules or have different frame numbers, the molecule and frame from the first atom selection are used.