“within” finds atoms in the first selection within a cutoff distance of atoms in the second selection.
selection within distance of selection
chain A within 5.0 of chain B
By default, this operation is performed over all states. However, when a state number is provided to the select operator, the operation can be restricted to a single state.
If the two selections overlap, “within” will return atoms in both selections which meet the geometric criteria. Note that this behavior is different than that of near_to, which will only return atoms in the first selection that are not present in the second.