Avoid Repeating Yourself: Add Custom Index Groups Once for All Your Molecular Simulations

When preparing molecular dynamics simulations in GROMACS, many modelers use gmx make_ndx to create custom index groups. You might want to separate domains, pull particular atoms, or track specific regions of a protein. However, repeating the same selection operations for each project—or worse, each subproject in a batch—can be tedious and error-prone.

Thankfully, SAMSON’s GROMACS Wizard offers a way to streamline this process by allowing you to define custom index groups directly during the preparation step. This means you can create your custom selections once at the start, and they’re automatically propagated across all subsequent simulations, including batch jobs. This small investment of time during preparation can save you hours later.

Why Add Index Groups at the Preparation Step?

In SAMSON, when you’re dealing with batch projects (a set of related simulations that share core parameters), adding custom index groups early on ensures that every subproject shares the same input setup. This is particularly useful if you’re:

  • Running steered MD simulations with consistent pull groups
  • Tracking specific ligand or protein regions
  • Defining solvent or ion shells for analysis

By adding the groups at the preparation stage, you avoid duplicating selections in each step or subproject.

How to Do It

The custom index groups are incorporated into the simulation using the gmx make_ndx command, and the result is saved in the project’s index.ndx file. You can define your index groups using two methods:

  1. Using GROMACS selection syntax: Combine existing groups using operators such as &, |, and !. For example:
    "protein" & ! "C-alpha" selects all non-C-alpha atoms in the protein.
  2. Using SAMSON’s selection tools: Visually select atoms or residues (e.g., neutral side chains) via the GUI, and let GROMACS Wizard translate the selection into a GROMACS-compatible string.

Create a custom index group

After defining your group, assign it a name, click Add index group to the list and then click Apply. That’s it—the group is saved and will be available throughout the simulation workflow.

Caveats to Keep in Mind

Because GROMACS doesn’t generate default index groups until its preparation step is completed, any group you define at that moment cannot rely on default GROMACS groups. So if your selection depends on them, it’s better to wait for the equilibration or simulation step to define such groups instead. Also, if your system has non-unique or non-consecutive indices, verify that the groups were correctly created to avoid issues downstream.

When Is This Most Useful?

This approach is especially helpful for:

  • Large-scale screening simulations
  • Repetitive simulation protocols with minimal changes
  • Academic courses or workshops where standardized setup is essential

Setting up custom index groups early gives you more control and consistency, while reducing the likelihood of manual errors.

To learn more about how to set this up step-by-step, check the full documentation here: 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.

Comments are closed.