[gmx-developers] make_ndx & empty groups edge case

Kyle Huston khuston at gmail.com
Sat May 31 07:19:52 CEST 2014


Hi —

make_ndx appears to mishandle an edge case.

If R1 contains 10 atoms and R2 contains 0 atoms, the selection command

    r R1 & r R2

creates a group with all 10 atoms in residue R1. 

    r R2 & r R1

gives a “Syntax error”.

The expected behavior is to create a group with 0 atoms for both selection commands, because 0 atoms are in both R1 and R2. This looks to happen because parse_entry returns value 0 for an empty group, and & is only evaluated if parse_entry is nonzero.

Removing the if statements with condition parse_entry in tools/gmx_make_ndx.c seems to fix the problem, and I can’t find any selection commands that this breaks. However, it seems there should’ve been a reason the if statements existed in the first place. Is there any reason the code needs a

	if (parse_entry(&string, natoms, atoms, block, gn, &nr, index, gnome))
	{
		[…]
	}

rather than just

	parse_entry(&string, natoms, atoms, block, gn, &nr, index, gnome);
	[…]

?

Thanks,
Kyle Huston


More information about the gromacs.org_gmx-developers mailing list