Fix selection of xtc groups not starting at index 0
authorErik Lindahl <erik@kth.se>
Sun, 27 Jul 2014 08:54:33 +0000 (10:54 +0200)
committerErik Lindahl <erik@kth.se>
Sun, 27 Jul 2014 08:54:33 +0000 (10:54 +0200)
The code to select atoms to write to the xtc file
only looped over the number of atoms selected for
output rather than all atoms. This meant that xtc
group selections that were not located at the start
of the atom indices would not be written correctly.

Fixes #1561.

Change-Id: I48886a75c682e38122dadcb2f752507b14b308fe

src/gromacs/fileio/mdoutf.c

index 4b50c2a6c08302a9646fa1a96852a4769a4704e9..2c19cdfe36deb1be69b26f71a6c6871c8679c682 100644 (file)
@@ -341,7 +341,7 @@ void mdoutf_write_to_trajectory_files(FILE *fplog, t_commrec *cr,
                 int i, j;
 
                 snew(xxtc, of->natoms_x_compressed);
-                for (i = 0, j = 0; (i < of->natoms_x_compressed); i++)
+                for (i = 0, j = 0; (i < of->natoms_global); i++)
                 {
                     if (ggrpnr(of->groups, egcCompressedX, i) == 0)
                     {