Error compiling gromacs 2020.5 patched with Colvar module

GROMACS version: 2020.5
GROMACS modification: Yes

I’m try install gromacs using steps decription on official website on linux but get error, it error is related to Make[2] Error 1 or Make[ ]error 2.

Can any given good step to compile gromacs with it patched module?

best,

Geo

Hello Geo, can you please provide a few details:

  1. First and foremost please confirm that you can build the unpatched GROMACS 2020.5 with identical commands.
  2. Where did you get the code from? You mention “official website”, which is vague. Because it’s a version patched with Colvars it can’t be from the GROMACS website. Is it from GitHub - Colvars/gromacs: Clone of the main GROMACS repository, containing additional releases featuring Colvars. (Not suitable for pull requests.)?
  3. What is the exact error message (and you should cross-reference them with warnings from CMake as well)?

Giacomo

Dear Prof. Giacomo,

I run compilation with gcc 11 version and them I’ve changed to gcc 7 and it compile well.

Dear Prof. Giacomo,

I’m try pass

indexFile name.ndx into clovar dat file, but it given an error: Error in parsing index file

What’s is right form to pass it option?

Best,

Geo.

Hi Geo, since you didn’t mention whether standard/unpatched GROMACS 2020 builds correctly, I checked myself, and in fact with GCC 11.2 (Fedora 35) I get the following.

In file included from /home/fioring2/sources/gromacs/2020.6/src/gromacs/modularsimulator/modularsimulator.cpp:44:
/home/fioring2/sources/gromacs/2020.6/src/gromacs/modularsimulator/modularsimulator.h:269:31: error: ‘numeric_limits’ is not a member of ‘std’
  269 |         Step lastStep_ = std::numeric_limits<Step>::max();
      |                               ^~~~~~~~~~~~~~
/home/fioring2/sources/gromacs/2020.6/src/gromacs/modularsimulator/modularsimulator.h:269:50: error: expected primary-expression before ‘>’ token
  269 |         Step lastStep_ = std::numeric_limits<Step>::max();
      |                                                  ^
/home/fioring2/sources/gromacs/2020.6/src/gromacs/modularsimulator/modularsimulator.h:269:53: error: ‘::max’ has not been declared; did you mean ‘std::max’?
  269 |         Step lastStep_ = std::numeric_limits<Step>::max();
      |                                                     ^~~
      |                                                     std::max
In file included from /usr/include/c++/11/algorithm:62,
                 from /home/fioring2/sources/gromacs/2020.6/src/gromacs/math/vectypes.h:42,
                 from /home/fioring2/sources/gromacs/2020.6/src/gromacs/mdlib/vcm.h:44,
                 from /home/fioring2/sources/gromacs/2020.6/src/gromacs/mdlib/md_support.h:40,
                 from /home/fioring2/sources/gromacs/2020.6/src/gromacs/modularsimulator/modularsimulator.h:46,
                 from /home/fioring2/sources/gromacs/2020.6/src/gromacs/modularsimulator/modularsimulator.cpp:44:
/usr/include/c++/11/bits/stl_algo.h:3467:5: note: ‘std::max’ declared here
 3467 |     max(initializer_list<_Tp> __l, _Compare __comp)
      |     ^~~
gmake[2]: *** [src/gromacs/modularsimulator/CMakeFiles/modularsimulator.dir/build.make:188: src/gromacs/modularsimulator/CMakeFiles/modularsimulator.dir/modularsimulator.cpp.o] Error 1

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?

best.

Geo.

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.

https://colvars.github.io/colvars-refman-gromacs/colvars-refman-gromacs.html#sec:units

Giacomo

Prof. Giacomo thanks so much for advice.

Geo.

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?

best,

Geo

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:

Giacomo

Thanks so much Prof. Giacomo for reply.

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

Best,

Geo.

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.

Giacomo

Prof. Giacomo I’ve found into collars web https://github.com/Colvars/colvars 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)

Best

Geo