When GROMACS’s Default Groups Don’t Fit: Build the Selection You Need

A molecular system is ready for simulation, but the group you need is missing. Perhaps you want to define a specific set of atoms for pulling, focus an analysis on selected residues, or carry a carefully chosen subset into a later workflow. Rebuilding the selection by hand at every stage is tedious—and choosing the wrong atoms can undermine the result.

GROMACS Wizard lets you add custom index groups using either GROMACS selection syntax or selections made directly in SAMSON. The key decision is when to create the group: during preparation, or later during equilibration or simulation. That choice affects which existing groups you can use and whether the work can be reused across a batch.

Choose the right point in the workflow

For a single project, custom groups can be added during preparation, equilibration, or simulation. If you are working with a batch project, creating the group during preparation is generally preferable because it is done once for the project’s subprojects.

There is a trade-off. At preparation time, GROMACS has not yet generated its default index groups, so you cannot base your new group on those defaults. Later, during equilibration or simulation, the generated groups are available, making it possible to build a custom selection from them. If your intended group depends on a default group, wait until the system has been prepared.

Default index groups generated by GROMACS

Create a group from the prepared system

  1. Make sure the system is loaded in SAMSON. If it is not, click Load next to the input path.
  2. Click Edit index groups to open the GROMACS Index Groups window. You can inspect the default groups there. They are not editable, but you can use Select in document based on selection string to see which nodes correspond to a group.
  3. Choose how to define the new group. Enter a GROMACS selection string directly, or select nodes in SAMSON and let GROMACS Wizard generate the corresponding selection string.
  4. In the index-groups window, click +, then choose Generate based on current selection in document if you are using your current SAMSON selection. Give the group a clear name.
  5. Click Add index group to the list, then click Apply to save the changes.

For example, you can select neutrally charged amino-acid side chains in SAMSON using Select > Residues > Amino acids > Side chain charge > Neutral, then generate a GROMACS group from that selection. This is useful when the selection is easier to express visually than as a text query. Alternatively, GROMACS syntax supports combining groups with AND, OR, and NOT operators; the window’s Test selection string and Select in document based on selection string controls let you check what a query matches before adding it.

Creating a custom group from a SAMSON selection

Verify before relying on the group

Selection mistakes are easier to catch before a group is used in a simulation or analysis. Test text-based selections, or inspect the corresponding nodes in the document. Take particular care if your structure has unusual residue or atom numbering. When groups are created during preparation, non-unique or non-consecutive indices can cause indexing issues in some cases. Verify that the resulting group contains what you intended. For a single project, creating the group later can be a practical alternative if you need to avoid that preparation-time limitation.

The new groups are added with gmx make_ndx and saved in the project folder’s index.ndx file. This gives you a simple check on where the changes are stored and makes the group available to the relevant workflow steps.

Custom index groups are most useful when they make a specific workflow decision explicit: which atoms should be pulled, compared, or analyzed? Choose the creation step based on whether you need default groups or batch reuse, then verify the selection before proceeding.

Read the full GROMACS Wizard tutorial on adding custom index groups.

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

Comments are closed.