From c71a5e3b2468ef454eaed680038ba0ed9d550748 Mon Sep 17 00:00:00 2001
From: Carlo Camilloni <carlo.camilloni@gmail.com>
Date: Tue, 26 Apr 2016 10:07:06 +0200
Subject: [PATCH] GRID: more informative error message when looking for values
 outside the grid [makedoc]

---
 CHANGES/v2.2.txt   | 2 ++
 src/tools/Grid.cpp | 2 +-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/CHANGES/v2.2.txt b/CHANGES/v2.2.txt
index 38cb1138f..076495368 100644
--- a/CHANGES/v2.2.txt
+++ b/CHANGES/v2.2.txt
@@ -143,6 +143,8 @@ Version 2.2.3 ()
 For users:
 - Updated patch for gromacs 5.1.x to fix a problem when plumed was trying to write to an already
   closed gromacs log file.
+- When looking for a value outside the GRID now the error include the name of the responsible 
+  collective variable
 
 For developers:
 
diff --git a/src/tools/Grid.cpp b/src/tools/Grid.cpp
index 52b97fe9b..f46462c94 100644
--- a/src/tools/Grid.cpp
+++ b/src/tools/Grid.cpp
@@ -171,7 +171,7 @@ Grid::index_t Grid::getIndex(const vector<unsigned> & indices) const {
   if(indices[i]>=nbin_[i]) {
     std::string is;
     Tools::convert(i,is);
-    std::string msg="ERROR: the system is looking for a value outside the grid along the " + is;
+    std::string msg="ERROR: the system is looking for a value outside the grid along the " + is + " ("+getArgNames()[i]+")";
     plumed_merror(msg+" index!");
   }
  index_t index=indices[dimension_-1];
-- 
GitLab