Selection.only_mainchain() — select only mainchain atoms

only_mainchain()
This returns a new selection containing only mainchain atoms (i.e., atom types O, OT1, OT2, OXT, C, CA, N) from the current selection.