Error compiling gromacs 2020.5 patched with Colvar module

Hi Geo, index files are read internally by a Colvars internal function. We have discussed that for the case of GROMACS it would be simpler all around to just read directly the index groups that GROMACS itself has defined in memory, but this is not available yet:

Was the index file that you are providing produced with “gmx make_ndx”? Or if it isn’t, can you check that at least GROMACS can read it when you pass it as input to the same command?

If GROMACS can read it but Colvars cannot, can you put it online somewhere and paste a public link? (It is likely too big to paste in the message itself and the format will also change)

FYI should you need GCC 11 for any reason, apply this patch, which fixes a missing include in the GROMACS files.

diff --git a/src/gromacs/awh/biasparams.cpp b/src/gromacs/awh/biasparams.cpp
index 6f9b0d387d..2bcc711a62 100644
--- a/src/gromacs/awh/biasparams.cpp
+++ b/src/gromacs/awh/biasparams.cpp
@@ -47,6 +47,7 @@
 #include "biasparams.h"
 #include <cmath>
+#include <limits>
 #include <algorithm>
diff --git a/src/gromacs/modularsimulator/modularsimulator.cpp b/src/gromacs/modularsimulator/modularsimulator.cpp
index 2d785ab50f..8a94e9f106 100644
--- a/src/gromacs/modularsimulator/modularsimulator.cpp
+++ b/src/gromacs/modularsimulator/modularsimulator.cpp
@@ -39,6 +39,8 @@
  * \ingroup module_modularsimulator
+#include <limits>
 #include "gmxpre.h"
 #include "modularsimulator.h"

Thanks so much Prof. Giacomo,

With respecto to IndexFile I’ve create it with write_export from MDAnalysis, and check if it is same that these create with make_ndx tool is same for me (not know if I’m missing anything)

With respect to gcc 11 I’ve same error and should apply it suggest for you!.

Thanks so much.

Well, I can read from Colvars an index file generated by MDAnalysis without problems, so that rules out an issue with MDA. You also mentioned that you can read the same index file with GROMACS.

Does the group name contain spaces by any chance? That looks like the only way that the Colvars parser could be throwing the message “Error: in parsing index file”

Dear Prof.

Mu error result when make

indexFile rest_index.ndx

And group name containing space example : [ PROB ] , as it.

I’m attach imagen from my index file generate with MDAnalysis.

Ok, I see. Just replace spaces in the middle of a group’s name with something else, e.g. underscores, and you will be fine.

Thanks so much prof. It fix problem with index file.

Dear Prof.

A trivial questions, force and position into colvar gromcs are into kj/mol*nm^2 ; nanometros?

Or is same what in NAMD?



Hi, Colvars uses the same units as the MD engine, in this case GROMACS. If you’re adapting a configuration file from NAMD, you should convert force constants and positions/distances accordingly. XYZ files are assumed to be in Å for consistency with what VMD expects.


Prof. Giacomo thanks so much for advice.


Professor Giacomo,

I want to compile gromacs 2020.6 with colvar, but I only have the code for 2020.5 available, so can I copy the colvar folder from 2020.5 to the same path in the 2020.6 folder?

Or do I need to do something else so that the compilation is correct?



Hi Geo, thanks for pointing that out. I just updated the patching mechanism so that 2020.6 is the original GROMACS release used for reference.

For the record, you can’t just copy over the colvars folder because there are also some small edits to the GROMACS files to integrate Colvars in the workflow. You should re-run the patching procedure described in the Colvars README, or alternatively use a Git branch instead of a specific release tag.

For example, bugfix and small updates to the standard 2020 release are available here before they get included in a minor release (next one being 2020.7):

and this is the corresponding branch with the Colvars patch:


Thanks so much Prof. Giacomo for reply.

For case of update patching only following step documented into Github , right?



I don’t understand the question completely. You can download the patched 2020.6 release here:

Patching by yourself the standard GROMACS release also works, but it takes more work and it is sensitive to future changes. The GROMACS files used in the interface also happen to be heavily revised between different standard GROMACS versions. Unless you are following the GitHub conversation, it’s just easier to use a pre-patched release.


Prof. Giacomo I’ve found into collars web 2020.6 version , I’ve and question can use it same to patch too with plumed?, them can I’ve un gromacs version with plumed and collars same time (plumed support to patch with 2020.6 version)



Yes, Prof. Giacomo,

I’ve download gromacs 2020.6 patched with colvars, may question is is I can patch too it with plumed a same time?



Hi Geo,

Yes, you can apply the Plumed patch the the Colvars-patched version. Just make sure that the patch applies cleanly - you will see warnings if it doesn’t (“hunk #… failed”).


Thanks so much Prof Jhenin!



Dear Prof. Giacomo,

I’m pulling in the direction of Z, so I want to apply harmicWalls so that the protein confines in a certain radius, but I don’t really understand what values ​​to give to lowwall and upperwall

my protein has as COM in Z 6.4 nm and as maximum length in x and 6.2 nm, and my colvar is “distanceXY”

the radius could be 5.7 nm (0.5 nm less than the original length)



Hi, this last question is more dependent on your specific system. I can only clarify that distanceXY is always computed between two points, so if you want to restrain a group near a specific absolute position, you can make one of the two groups a dummyAtom. For GROMACS specifically, you would need to use the coordinates (Lx/2, Ly/2, Lz/2) to express the center of the box.

If you have further questions about Colvars that aren’t specific to GROMACS, those may go beyond this specific forum category. We’ll discuss between developers of both codes what would be the best place for this type of question.

To summarize this conversation: your initial compilation error with GCC 11 is unrelated to Colvars, and it is instead an issue of the standard GROMACS 2020 release series, which will eventually be addressed in a GROMACS patch release (probably 2020.7?).