From 4f2317af2815acd82cfc47d099403669d4419ec9 Mon Sep 17 00:00:00 2001
From: Gareth Tribello <gareth.tribello@gmail.com>
Date: Sat, 4 Mar 2017 11:54:58 +0000
Subject: [PATCH] Added check on whether point is within bounds in GridVessel

---
 src/gridtools/GridVessel.cpp | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/gridtools/GridVessel.cpp b/src/gridtools/GridVessel.cpp
index 750b06c8e..42ec3c172 100644
--- a/src/gridtools/GridVessel.cpp
+++ b/src/gridtools/GridVessel.cpp
@@ -139,6 +139,7 @@ void GridVessel::getIndices( const std::vector<double>& point, std::vector<unsig
   for(unsigned i=0;i<dimension;++i){
       indices[i]=std::floor( (point[i] - min[i])/dx[i] );
       if( pbc[i] ) indices[i]=indices[i]%nbin[i];
+      else if( indices[i]>nbin[i] ) plumed_merror("point is outside grid range");
   }
 }
 
-- 
GitLab