Merge release-5-0 into master
[alexxy/gromacs.git] / src / gromacs / gmxana / gmx_covar.c
index fef28b3195a4c09c01603b08644fe3e8701d5c4d..bc77018c309458cab2b539e8e688c5787e0644f1 100644 (file)
@@ -552,7 +552,7 @@ int gmx_covar(int argc, char *argv[])
     out = xvgropen(eigvalfile,
                    "Eigenvalues of the covariance matrix",
                    "Eigenvector index", str, oenv);
-    for (i = 0; (i < ndim); i++)
+    for (i = 0; (i < end); i++)
     {
         fprintf (out, "%10d %g\n", (int)i+1, eigenvalues[ndim-1-i]);
     }
@@ -563,6 +563,9 @@ int gmx_covar(int argc, char *argv[])
         if (nframes-1 < ndim)
         {
             end = nframes-1;
+            fprintf(out, "WARNING: there are fewer frames in your trajectory than there are\n");
+            fprintf(out, "degrees of freedom in your system. Only generating the first\n");
+            fprintf(out, "%d out of %d eigenvectors and eigenvalues.\n", end, (int)ndim);
         }
         else
         {
@@ -637,7 +640,7 @@ int gmx_covar(int argc, char *argv[])
     fprintf(out, "Trace of the covariance matrix after diagonalizing: %g\n\n",
             sum);
 
-    fprintf(out, "Wrote %d eigenvalues to %s\n", (int)ndim, eigvalfile);
+    fprintf(out, "Wrote %d eigenvalues to %s\n", (int)end, eigvalfile);
     if (WriteXref == eWXR_YES)
     {
         fprintf(out, "Wrote reference structure to %s\n", eigvecfile);