Custom index groups are a key ingredient in many GROMACS workflows, especially when preparing for advanced analyses like pulling simulations or restraining specific atoms or residues. But when exactly should you add them? If you’re using the GROMACS Wizard in SAMSON, the answer might not be as straightforward as you think.
Many users naturally add custom index groups during the preparation step, alongside other setup tasks. That’s totally fine—but it comes with a caveat that could lead to subtle errors.
Why timing matters when adding custom index groups
When GROMACS prepares your system files, it automatically creates standard index groups (such as Protein, Water, Ions, etc.). However, if you add custom index groups before these are generated—specifically, during the preparation step—you won’t be able to rely on those default groups in your selection strings. They simply don’t exist yet.
If you’re using advanced selection strings like:
|
1 |
"Protein" & ! "C-alpha" |
they will fail at the preparation stage because "Protein" is not yet registered in the index.ndx file.
What’s the safer approach?
For most workflows—especially those involving default groups or complex selections—it’s safer to add your custom index groups during the equilibration or simulation steps. By then, the default GROMACS groups are available and can be used directly in your custom selections.

Plus, the GROMACS Wizard makes it easy to:
- Select parts of your system using SAMSON’s graphical tools (like selecting all neutral amino acid residues).
- Automatically generate the correct GROMACS selection strings from your current selection.
- Add and name your custom index group, apply it, and save the update directly to
index.ndx.
When you might still want to add groups in preparation
If you’re working on a batch project with many subprojects, adding custom index groups during the preparation step can save time. In this case, you define your group once and reuse it across all subprojects. Just make sure you don’t require any default index groups in your custom selections.
A word of caution
If your system has non-unique or non-consecutive residue or atom indices, defining index groups at the preparation stage could lead to indexing errors. So, always verify that your custom group matches your intended selection. If in doubt, wait until the equilibration or simulation step to create the groups.
To learn more about the timing and mechanics of creating custom index groups, visit the full documentation here: https://documentation.samson-connect.net/tutorials/gromacs-wizard/adding-custom-index-groups/.
SAMSON and all SAMSON Extensions are free for non-commercial use. You can download SAMSON at https://www.samson-connect.net.
