Fix memory-usage error in g_chi
[alexxy/gromacs.git] / src / tools / anadih.c
index 5f5da0eefba94486a9cf09ebfc4f653ca0e5e3bc..1c0e9000dd9a08a4cd0da1ffd5d56d0fd17b44d2 100644 (file)
@@ -417,7 +417,8 @@ void mk_chi_lookup (int **lookup, int maxchi, real **dih,
     int i, j, Dih, Chi;
 
     j = 0;
-    for (Dih = 0; (Dih < NONCHI+maxchi); Dih++)
+    /* NONCHI points to chi1, therefore we have to start counting there. */
+    for (Dih = NONCHI; (Dih < NONCHI+maxchi); Dih++)
     {
         for (i = 0; (i < nlist); i++)
         {