Inconsistency with splitres behaviour of gmx make_ndx

GROMACS version: 2021.6/2023.2/2024
GROMACS modification: Yes/No/No

I am quite confused about the behaviour of gmx make_ndx, specifically of splitres. I have a .pdb file with a protein embedded in a lipid bilayer, and I am trying to study some properties as a function of the residue type and position. As such, I prepare an index file simply by using gmx make_ndx and specifying splitres 1, where 1 is the (default) Protein group. This returns a list of residues, as expected, but each one has just one atom.

I did this with GROMACS2024. I have several installations, so I changed to 23.2 and I got the same result, while with 21.6 I get the list of residues AND each one has the correct number of atoms. I embedded the protein with CHARMM-GUI and run everything with GROMACS 2024. Am I missing something? Why one version is working and others don’t?


To reiterate, with GROMACS 2023 and 2024, running gmx make_ndx with splitres N command produces one group per residue from group N, with each group containing one atom from that residue. With GROMACS 2021, each group contains all atoms from the respective residue. Right?

If so, it indeed looks like a bug in the new versions. I will open an issue, hopefully will be fixed in the next release

Exactly! Like, this is the output for a protein:

218 Protein_chain1_THR_186:     1 atoms
219 Protein_chain1_ILE_187:     1 atoms
220 Protein_chain1_TRP_188:     1 atoms
221 Protein_chain1_LYS_189:     1 atoms
222 Protein_chain1_LYS_190:     1 atoms
223 Protein_chain1_MET_191:     1 atoms
224 Protein_chain1_GLY_192:     1 atoms

I get the same even with more “regolar groups”, like if I select only the POPC which are all same number of atoms each:

975 POPC_POPC_1148      :     1 atoms
976 POPC_POPC_1149      :     1 atoms
977 POPC_POPC_1150      :     1 atoms
978 POPC_POPC_1151      :     1 atoms
979 POPC_POPC_1152      :     1 atoms

This happens with all the options I tried in the -f flag (.pdb/.gro/.tpr).

Could you check if Fix make_ndx splitres behavior (!4217) · Merge requests · GROMACS / GROMACS · GitLab fixes it for you?

It does!

220 �_TRP_188          :    24 atoms
221 �_LYS_189          :    22 atoms
222 �_LYS_190          :    22 atoms
223 �_MET_191          :    17 atoms
224 �_GLY_192          :     8 atoms

A minor point is that if I use GROMACS naming (like the name of the group Protein or the derived names from splitch) I get weird naming characters like % or what you see here in the latter. If I rename the group then it works fine, like here I renamed the group as “test” before calling splitres on it

133 test_TRP_188        :    24 atoms
134 test_LYS_189        :    22 atoms
135 test_LYS_190        :    22 atoms
136 test_MET_191        :    17 atoms
137 test_GLY_192        :     8 atoms

And for that, Fix invalid memory access in `gmx make_ndx` when using splitres/splitat (!4218) · Merge requests · GROMACS / GROMACS · GitLab should help :)

P.S.: note that it’s a separate patch; you need to apply both this one and the previous one.

If I git apply the patch it fails with the following:

error: patch failed: docs/release-notes/2023/2023.5.rst:73
error: docs/release-notes/2023/2023.5.rst: patch does not apply
error: patch failed: src/gromacs/tools/make_ndx.cpp:728
error: src/gromacs/tools/make_ndx.cpp: patch does not apply
error: patch failed: src/gromacs/tools/tests/make_ndx.cpp:114
error: src/gromacs/tools/tests/make_ndx.cpp: patch does not apply

This was the already patched 2023.5 which was now giving the correct atom splitting in the residues.

Argh, the patches clash a bit :(

I rebased the second patch (about mangled names), so it should apply cleanly on top of the first one (about missing atoms). If you have time, would be great if you could try out the updated version (Fix invalid memory access in `gmx make_ndx` when using splitres/splitat (!4218) · Merge requests · GROMACS / GROMACS · GitLab; only src/gromacs/tools/make_ndx.cpp change is really needed, the rest is documentation and a new test).

The fix for splitres missing atoms will be in GROMACS 2023.5 / 2024.2 released at the end of April. Thanks for reporting the problem and testing the patch!

Fixed! Both names and splitting look fine

219 Protein_chain3_ILE_187:    19 atoms
220 Protein_chain3_TRP_188:    24 atoms
221 Protein_chain3_LYS_189:    22 atoms
222 Protein_chain3_LYS_190:    22 atoms
223 Protein_chain3_MET_191:    17 atoms
224 Protein_chain3_GLY_192:     8 atoms

Thank you for the patch! :)