How to use make_ndx for multiple atom ranges?

GROMACS version: 2022
GROMACS modification: No

I am trying to use make_ndx to make a group with multiple atom ranges.
E.g.
a 1-50 80-120 150-200

I can not use the minus symbol “-” twice when doing so. I tried using & or | and I am not able to do so. Do I have to list each atom # individually after the first minus sign or is there an easier way. I have a long list of ranges for the atoms I need to group.

You need an “or” operator between the different ranges.

a 1-50 | 80-120 | …

That did not work for me. I tried entering ranges a 4018-4044 | 4159-4176, but I get this notification Syntax error: “-4176”. When I try a 4159-4176 alone then it works fine.

Sorry, I typed too quickly. Every range of atom numbers (including after each pipe) must be prefixed with a so make_ndx knows what the selection is.