Merge release-5-0 into master
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_make_ndx.c
index 686ee49aaa59611fee725941e93d7eeb7159aac9..7bdccbefff8c4cf25f7fbfa4eecc912779abbf97 100644 (file)
 #include <ctype.h>
 #include <string.h>
 
-#include "sysstuff.h"
-#include "gromacs/fileio/futil.h"
+#include "gromacs/utility/futil.h"
 #include "macros.h"
-#include "gromacs/utility/cstringutil.h"
-#include "gromacs/commandline/pargs.h"
 #include "gromacs/fileio/confio.h"
 #include "typedefs.h"
-#include "index.h"
-#include "gromacs/utility/smalloc.h"
-#include "vec.h"
-#include "index.h"
+#include "gromacs/topology/index.h"
+#include "gromacs/math/vec.h"
 
-#include "gromacs/legacyheaders/gmx_fatal.h"
+#include "gromacs/commandline/pargs.h"
+#include "gromacs/topology/block.h"
+#include "gromacs/utility/cstringutil.h"
+#include "gromacs/utility/fatalerror.h"
+#include "gromacs/utility/smalloc.h"
 
 /* It's not nice to have size limits, but we should not spend more time
  * on this ancient tool, but instead use the new selection library.
@@ -850,8 +849,12 @@ static int split_chain(t_atoms *atoms, rvec *x,
                 {
                     rvec_sub(x[ca_end], x[i], vec);
                 }
+                else
+                {
+                    break;
+                }
             }
-            while ((i < natoms) && (norm(vec) < 0.45));
+            while (norm(vec) < 0.45);
 
             end[nchain] = ca_end;
             while ((end[nchain]+1 < natoms) &&