# Range checking error (gmx covar)

**URL:** <https://gromacs.bioexcel.eu/t/range-checking-error-gmx-covar/1542>\
**Category:** User discussions\
**Created:** [February 4, 2021, 1:23pm UTC](https://gromacs.bioexcel.eu/t/range-checking-error-gmx-covar/1542 "2021-02-04T13:23:43Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![purvi.gupta](https://avatars.discourse-cdn.com/v4/letter/p/6a8cbe/32.png) [@purvi.gupta](https://gromacs.bioexcel.eu/u/purvi.gupta)\
**Post date:** [February 4, 2021, 1:23pm UTC](https://gromacs.bioexcel.eu/t/range-checking-error-gmx-covar/1542/1 "2021-02-04T13:23:43Z")

</div>

GROMACS version: 2020.5  
Dear,

I am trying to calculate the covariance for my system using gmx covar and C-alpha for the least squares fit. However, it gives me the following error:  
“Range checking error (possible bug):  
The provided structure file only contains 55028 coordinates, but coordinate index 3771 was requested for fitting. Make sure to update structure files and index files if you store only a part of the system”

While applying PBC, I save the whole system in the trajectory. Therefore, I do not understand why this error shows up.

Regards  
Purvi

---

<div class="post-metadata">

**Author:** ![alevilla](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/alevilla/32/439_2.png) [@alevilla](https://gromacs.bioexcel.eu/u/alevilla)\
**Post date:** [February 5, 2021, 2:58pm UTC](https://gromacs.bioexcel.eu/t/range-checking-error-gmx-covar/1542/2 "2021-02-05T14:58:48Z")

</div>

Hi  
I can not understand what can be the problem. Can you provide more information on the command line, you used?  
Thank you  
Alessandra

---

<div class="post-metadata">

**Author:** ![purvi.gupta](https://avatars.discourse-cdn.com/v4/letter/p/6a8cbe/32.png) [@purvi.gupta](https://gromacs.bioexcel.eu/u/purvi.gupta)\
**Post date:** [February 8, 2021, 9:36am UTC](https://gromacs.bioexcel.eu/t/range-checking-error-gmx-covar/1542/3 "2021-02-08T09:36:42Z")

</div>

Hi Alessandra,

Thank you for the reply.  
I use the command “gmx covar -s md.tpr -f md.xtc” for calculating the covariance matrix. The system consists of a protein in a cubic box with tip3p water model.  
It works if I run the same command on supercomputer where the production MD was performed but not on my personal system.

Kindest Regards  
Purvi Gupta

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [February 8, 2021, 10:14am UTC](https://gromacs.bioexcel.eu/t/range-checking-error-gmx-covar/1542/4 "2021-02-08T10:14:01Z")

</div>

This is a bug in src/gromacs/gmxana/gmx\_covar.cpp. Line 92 is:  
if (largestIndex \< largestOkayIndex)  
But should be:  
if (largestIndex \>= largestOkayIndex)  
If you installed Gromacs yourself, you can change this yourself, recompile and install.

---

<div class="post-metadata">

**Author:** ![purvi.gupta](https://avatars.discourse-cdn.com/v4/letter/p/6a8cbe/32.png) [@purvi.gupta](https://gromacs.bioexcel.eu/u/purvi.gupta)\
**Post date:** [February 8, 2021, 1:57pm UTC](https://gromacs.bioexcel.eu/t/range-checking-error-gmx-covar/1542/5 "2021-02-08T13:57:34Z")

</div>

Dear Hess,

Thank you so much. It works now. :)

Kindest Regards  
Purvi Gupta

---

<div class="post-metadata">

**Author:** ![Santhosh\_Tomm](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@Santhosh\_Tomm](https://gromacs.bioexcel.eu/u/Santhosh_Tomm)\
**Post date:** [September 23, 2025, 7:44am UTC](https://gromacs.bioexcel.eu/t/range-checking-error-gmx-covar/1542/6 "2025-09-23T07:44:28Z")

</div>

Hi,

Recently in the GROMACS 2025.2 version, during COVAR analysis, i encountered the same error, which is as follows:

My command line: gmx covar -s protein\_whole.gro -f trajector\_conv\_forlig\_final\_whole.xtc -b 110 -e 490 -tu ns -o eigenvalues\_NAP\_whole.xvg -av average\_structure\_NAP\_whole.pdb -v eigenvectors\_NAP\_whole.trr -xpma covapic\_NAP\_whole.xpm -n index\_classification.ndx

Program: gmx covar, version 2025.2  
Source file: src/gromacs/gmxana/gmx\_covar.cpp (line 108)  
Function: void gmx::{anonymous}::throwErrorIfIndexOutOfBounds(gmx::ArrayRef, int, const std::string&)

Range checking error (possible bug):  
The provided structure file only contains 30872 coordinates, but coordinate  
index 31684 was requested for fitting. Make sure to update the structure files and  
index files if you store only a part of your system.

My trajectory and structure are created out of the same index group. Please let me know, how to fix this.

---

<div class="post-metadata">

**Author:** ![hess](https://dub1.discourse-cdn.com/flex017/user_avatar/gromacs.bioexcel.eu/hess/32/416_2.png) [@hess](https://gromacs.bioexcel.eu/u/hess)\
**Post date:** [September 25, 2025, 7:09am UTC](https://gromacs.bioexcel.eu/t/range-checking-error-gmx-covar/1542/7 "2025-09-25T07:09:16Z")

</div>

If you reduced you trajectory and structure file using an index group, you should create a new index file for that new structure file.

---

<div class="post-metadata">

**Author:** ![Santhosh\_Tomm](https://avatars.discourse-cdn.com/v4/letter/s/c5a1d2/32.png) [@Santhosh\_Tomm](https://gromacs.bioexcel.eu/u/Santhosh_Tomm)\
**Post date:** [September 25, 2025, 9:34am UTC](https://gromacs.bioexcel.eu/t/range-checking-error-gmx-covar/1542/8 "2025-09-25T09:34:35Z")

</div>

Thanks for the reply. I will try it out.
