Since Gromacs doesn't care about the residue number in gro files, they are not stored in the tpr files and thus have to be reproduced by hand. This solution increases the residue index with each new molecule.