The Right Group at the Right Stage: Building Custom GROMACS Index Groups

A molecular simulation can be perfectly prepared and still get stuck on a small but important detail: the atoms you need for pulling or analysis are not in the default GROMACS index groups. Building a custom group solves that problem—but when you create it matters. Choose the wrong stage, and you may miss access to groups you wanted to reuse, or find yourself repeating work across a batch.

In SAMSON’s GROMACS Wizard, custom index groups are added to the project’s index.ndx file. You can define them with GROMACS selection syntax or make a selection in SAMSON and let the Wizard generate the corresponding GROMACS selection string. Here’s a practical way to decide where to create groups and how to check that they contain what you intended.

First, choose the right workflow stage

For a batch project, consider creating groups during preparation. A group made at this stage can be created once and reused by the later stages and subprojects. This is especially useful when the group is based directly on the structure—for example, a selected set of residues.

There is a trade-off: default GROMACS index groups are generated during preparation, so they are not yet available as building blocks when you create custom groups at that step. If your new group needs to be defined relative to those defaults, wait until equilibration or simulation, after the system has been prepared.

For a single project, you can add groups during preparation, equilibration, or simulation. Later stages can be more convenient when you want to build a selection from groups that GROMACS has already generated.

Use selections you can inspect

At equilibration or simulation, load the system in SAMSON if needed, then open the GROMACS Index Groups window with Edit index groups. Existing default groups are listed there. Although you cannot modify those groups, you can use Select in document based on selection string to see which atoms or other nodes they correspond to. This makes the defaults easier to understand before you use them in a new selection.

You can also inspect the same groups in the document by double-clicking them. Seeing the selected structure is a useful check: a group name alone may not make its membership obvious, especially in a complex system.

Default GROMACS index groups shown in the GROMACS Wizard

Build a group from a SAMSON selection

If you can describe the atoms or residues visually or through SAMSON’s selection tools, start there. Select the desired nodes in the document, then in the GROMACS Index Groups window click + and choose Generate based on current selection in document. The Wizard generates a GROMACS selection string from the current selection. Give the group a clear name, then click Add index group to the list and Apply to save the change.

For example, the tutorial demonstrates selecting amino-acid residues with neutral side-chain charge using Select > Residues > Amino acids > Side chain charge > Neutral. The key benefit of this approach is that you can make the selection with SAMSON’s tools rather than composing the entire GROMACS expression yourself.

Creating a custom index group from a SAMSON selection

Or define the group with GROMACS syntax

When you already know the selection you need, you can enter GROMACS selection syntax directly. Existing index-group names can be used in quotes, with & for AND, | for OR, and ! for NOT. The documentation’s example combines the protein group with a condition that excludes C-alpha atoms, producing a selection of non-C-alpha protein atoms.

Before adding a group, use Test selection string to check the expression, then use Select in document based on selection string to inspect the resulting selection in SAMSON. Treat this as a practical verification step—not just a syntax check. Confirm that the highlighted atoms match the group’s intended purpose before saving it.

Adding a custom index group using existing GROMACS index groups

A preparation-stage caution

If residue or atom indices in your structure are non-unique or non-consecutive, groups created during preparation can sometimes have indexing issues. Verify the generated groups afterward. For a single project, another option is to create them during equilibration or simulation, once preparation has taken place.

A simple decision rule: create structure-based groups early when you want to reuse them across a batch; create groups later when they depend on GROMACS defaults. In either case, inspect the selection before relying on it in a pulling or analysis workflow.

For the full walkthrough, see the GROMACS Wizard guide to adding custom index groups.

Note: SAMSON and all SAMSON Extensions are free for non-commercial use. Get SAMSON.

Comments are closed.