diff --git a/src/analysis/OutputColvarFile.cpp b/src/analysis/OutputColvarFile.cpp
index 3278688a726d03295afa4cedb6c162bff6ccacc9..759e41549d53945977b4d7ca61ab2f7634e32c0d 100644
--- a/src/analysis/OutputColvarFile.cpp
+++ b/src/analysis/OutputColvarFile.cpp
@@ -24,7 +24,6 @@
 #include "reference/ReferenceArguments.h"
 #include "core/ActionRegister.h"
 #include "core/PlumedMain.h"
-#include "core/Atoms.h"
 
 namespace PLMD {
 namespace analysis {
diff --git a/src/dimred/Makefile b/src/dimred/Makefile
index 5d5eaab8eb4624680b2168b412eceef3da7c40eb..75c16104402a9c44104357b6245b402959adcc2a 100644
--- a/src/dimred/Makefile
+++ b/src/dimred/Makefile
@@ -1,4 +1,4 @@
-USE=core tools reference analysis
+USE=core tools reference gridtools analysis
 
 # generic makefile
 include ../maketools/make.module
diff --git a/src/dimred/SketchMapConjGrad.cpp b/src/dimred/SketchMapConjGrad.cpp
index 46ffdfa37b6dfcc90211896421a78abf0d51c1cd..129db324b0599135879a7944cf1f8fb578971bd2 100644
--- a/src/dimred/SketchMapConjGrad.cpp
+++ b/src/dimred/SketchMapConjGrad.cpp
@@ -22,7 +22,6 @@
 #include "core/ActionRegister.h"
 #include "SketchMapBase.h"
 #include "tools/ConjugateGradient.h"
-#include "tools/GridSearch.h"
 
 //+PLUMEDOC DIMRED SKETCHMAP_CONJGRAD
 /*
diff --git a/src/dimred/SketchMapPointwise.cpp b/src/dimred/SketchMapPointwise.cpp
index 8640c5e8a0894878f04937737d6a7a80ae4ffa4f..d99ef3e473e13005c68ecb11c74cf0e453b85ff3 100644
--- a/src/dimred/SketchMapPointwise.cpp
+++ b/src/dimred/SketchMapPointwise.cpp
@@ -22,7 +22,7 @@
 #include "core/ActionRegister.h"
 #include "SketchMapBase.h"
 #include "tools/ConjugateGradient.h"
-#include "tools/GridSearch.h"
+#include "gridtools/GridSearch.h"
 
 //+PLUMEDOC DIMRED SKETCHMAP_POINTWISE
 /*
@@ -101,7 +101,7 @@ void SketchMapPointwise::minimise( Matrix<double>& projections ){
 
   // And do the search
   ConjugateGradient<SketchMapPointwise> mycgminimise( this );
-  GridSearch<SketchMapPointwise> mygridsearch( gmin, gmax, npoints, nfgrid, this );
+  gridtools::GridSearch<SketchMapPointwise> mygridsearch( gmin, gmax, npoints, nfgrid, this );
   // Run multiple loops over all projections
   for(unsigned i=0;i<ncycles;++i){
       for(unsigned j=0;j<getNumberOfDataPoints();++j){
diff --git a/src/dimred/SketchMapRead.cpp b/src/dimred/SketchMapRead.cpp
index 66aa075fdaac7f0bc178848f7d7a0ecbc44b37ab..d049075a25e89b897bb27ae6930e87cff1c49614 100644
--- a/src/dimred/SketchMapRead.cpp
+++ b/src/dimred/SketchMapRead.cpp
@@ -23,8 +23,6 @@
 #include "SketchMapBase.h"
 #include "reference/ReferenceConfiguration.h"
 #include "reference/MetricRegister.h"
-#include "tools/ConjugateGradient.h"
-#include "tools/GridSearch.h"
 #include "core/PlumedMain.h"
 #include "core/Atoms.h"
 #include "tools/PDB.h"
diff --git a/src/tools/GridSearch.cpp b/src/gridtools/GridSearch.cpp
similarity index 100%
rename from src/tools/GridSearch.cpp
rename to src/gridtools/GridSearch.cpp
diff --git a/src/gridtools/GridSearch.h b/src/gridtools/GridSearch.h
new file mode 100644
index 0000000000000000000000000000000000000000..8e8966bbc1592c3108672201b63d93b5e75f94db
--- /dev/null
+++ b/src/gridtools/GridSearch.h
@@ -0,0 +1,111 @@
+/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+   Copyright (c) 2013 The plumed team
+   (see the PEOPLE file at the root of the distribution for a list of names)
+
+   See http://www.plumed-code.org for more information.
+
+   This file is part of plumed, version 2.
+
+   plumed is free software: you can redistribute it and/or modify
+   it under the terms of the GNU Lesser General Public License as published by
+   the Free Software Foundation, either version 3 of the License, or
+   (at your option) any later version.
+
+   plumed is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public License
+   along with plumed.  If not, see <http://www.gnu.org/licenses/>.
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
+#ifndef __PLUMED_gridtools_GridSearch_h
+#define __PLUMED_gridtools_GridSearch_h
+
+#include "tools/MinimiseBase.h"
+#include "GridVessel.h"
+#include <iostream>
+
+namespace PLMD{
+namespace gridtools {
+
+template <class FCLASS>
+class GridSearch { 
+private:
+/// This is the pointer to the member funciton in the energy
+/// calculating class that calculates the energy
+   typedef double(FCLASS::*engf_pointer)( const std::vector<double>& p, std::vector<double>& der );
+   FCLASS* myclass_func;
+   GridVessel* mygrid; 
+   GridVessel* myfgrid;
+public:
+   GridSearch( const std::vector<double>& mmin, const std::vector<double>& mmax, const std::vector<unsigned>& ng, const std::vector<unsigned>& nfg, FCLASS* funcc ) : 
+     myclass_func( funcc ), 
+     myfgrid(NULL)
+     {
+        // Create the grid objects
+        std::string nstr, vstring="COMPONENTS=func COORDINATES=x1";
+        for(unsigned i=1;i<mmin.size();++i){ Tools::convert(i+1,nstr); vstring += ",x" + nstr; }  
+        vstring += " PBC=F"; for(unsigned i=1;i<mmin.size();++i) vstring += ",F";
+        vesselbase::VesselOptions da("mygrid","",-1,vstring,NULL);
+        Keywords keys; gridtools::GridVessel::registerKeywords( keys );
+        vesselbase::VesselOptions dar( da, keys );
+        mygrid = new GridVessel(dar);
+        if( nfg[0]>0 ) myfgrid = new GridVessel(dar);
+
+        // Now setup the min and max values for the grid
+        std::vector<std::string> gmin( nfg.size() ), gmax( nfg.size() ); std::vector<double> dummy_spacing;
+        for(unsigned i=0;i<nfg.size();++i){ Tools::convert(mmin[i],gmin[i]); Tools::convert(mmax[i],gmax[i]); }  
+        mygrid->setBounds( gmin, gmax, ng, dummy_spacing ); mygrid->resize();
+        if( myfgrid ) myfgrid->setBounds( gmin, gmax, nfg, dummy_spacing ); 
+     }
+     ~GridSearch(){ delete mygrid; if(myfgrid) delete myfgrid; }
+     bool minimise( std::vector<double>& p, engf_pointer myfunc );
+};
+
+template <class FCLASS>
+bool GridSearch<FCLASS>::minimise( std::vector<double>& p, engf_pointer myfunc ){
+   std::vector<double> der( p.size() ); std::vector<double> coords( p.size() ); 
+   double initial_eng = (myclass_func->*myfunc)( p, der );
+   mygrid->getGridPointCoordinates( 0, coords );
+   double emin=(myclass_func->*myfunc)( coords, der );
+   mygrid->setValueAndDerivatives( 0, 0, emin, der ); unsigned pmin=0;
+   for(unsigned i=1;i<mygrid->getNumberOfPoints();++i){
+      mygrid->getGridPointCoordinates( i, coords );
+      double eng = (myclass_func->*myfunc)( coords, der );
+      mygrid->setValueAndDerivatives( i, 0, eng, der );
+      if( eng<emin ){ emin=eng; pmin=i; }
+   }
+   // This prevents division by zero
+   mygrid->setNorm( 1.0 );
+
+   if( myfgrid ){
+       myfgrid->getGridPointCoordinates( 0, coords ); pmin=0; 
+       double emin=mygrid->getValueAndDerivatives( coords, 0, der );
+       for(unsigned i=1;i<myfgrid->getNumberOfPoints();++i){
+           myfgrid->getGridPointCoordinates( i, coords );
+           double eng = mygrid->getValueAndDerivatives( coords, 0, der );
+           if( eng<emin ){ emin=eng; pmin=i; }
+       } 
+       myfgrid->getGridPointCoordinates( pmin, coords ); 
+       double checkEng = (myclass_func->*myfunc)( coords, der );
+       if( checkEng<initial_eng ){
+           myfgrid->getGridPointCoordinates( pmin, p ); 
+           return true; 
+       } else {
+           return false;
+       }
+   }
+  
+   if( emin<initial_eng ){
+      mygrid->getGridPointCoordinates( pmin, p );
+      return true;
+   } else {
+      return false;
+   }
+}
+
+} 
+}
+#endif
+
diff --git a/src/gridtools/GridVessel.cpp b/src/gridtools/GridVessel.cpp
index 08b9bb19d29ada0f93dcc5fd51ccfd321a6a1272..92df38b4bd484e1c61cd1c3026b342ad5e6b86c2 100644
--- a/src/gridtools/GridVessel.cpp
+++ b/src/gridtools/GridVessel.cpp
@@ -121,7 +121,7 @@ std::string GridVessel::description(){
 
 void GridVessel::resize(){
   plumed_massert( nper>0, "Number of datapoints at each grid point has not been set");
-  resizeBuffer( getNumberOfBufferPoints()*nper + 1 + 2*getAction()->getNumberOfDerivatives() ); 
+  if( getAction() ) resizeBuffer( getNumberOfBufferPoints()*nper + 1 + 2*getAction()->getNumberOfDerivatives() ); 
   setDataSize( npoints*nper ); forces.resize( npoints );
   if( active.size()!=npoints) active.resize( npoints, true );
 }
@@ -173,22 +173,27 @@ void GridVessel::getGridPointCoordinates( const unsigned& ipoint , std::vector<d
   for(unsigned i=0;i<dimension;++i) x[i] = min[i] + dx[i]*tindices[i];
 }
 
-void GridVessel::getSplineNeighbors( const unsigned& mybox, std::vector<unsigned>& mysneigh ) const {
-  mysneigh.resize( static_cast<unsigned>(pow(2.,dimension)) );
+void GridVessel::getSplineNeighbors( const unsigned& mybox, unsigned& nneighbors, std::vector<unsigned>& mysneigh ) const {
+  unsigned nneigh=unsigned(pow(2.0,int(dimension)));
+  if( mysneigh.size()!=nneigh ) mysneigh.resize(nneigh);
 
-  std::vector<unsigned> tmp_indices( dimension );
-  std::vector<unsigned> my_indices( dimension );
+  unsigned inind; nneighbors = 0;
+  static std::vector<unsigned> tmp_indices( dimension );
+  static std::vector<unsigned> my_indices( dimension );
   getIndices( mybox, my_indices );
-  for(unsigned i=0;i<mysneigh.size();++i){
-     unsigned tmp=i;
+  for(unsigned i=0;i<nneigh;++i){
+     unsigned tmp=i; inind=0;
      for(unsigned j=0;j<dimension;++j){
         unsigned i0=tmp%2+my_indices[j]; tmp/=2;
-        if(!pbc[j] && i0==nbin[j]) getAction()->error("Extrapolating function on grid");
+        if(!pbc[j] && i0==nbin[j]) continue;
         if( pbc[j] && i0==nbin[j]) i0=0;
-        tmp_indices[j]=i0;
+        tmp_indices[inind++]=i0;
      }
-     mysneigh[i]=getIndex( tmp_indices );
-     plumed_massert( active[mysneigh[i]], "inactive grid point required for splines"); 
+     if(inind==dimension ){
+        unsigned findex=getIndex( tmp_indices );
+        mysneigh[nneighbors++]=findex;
+        plumed_massert( active[findex], "inactive grid point required for splines"); 
+    }
   }
 }
 
@@ -202,6 +207,11 @@ void GridVessel::setGridElement( const unsigned& ipoint, const unsigned& jelemen
   setDataElement( nper*ipoint + jelement, value );
 }
 
+void GridVessel::setValueAndDerivatives( const unsigned& ipoint, const unsigned& jelement, const double& value, const std::vector<double>& der ){
+  plumed_dbg_assert( !noderiv && jelement<getNumberOfComponents() && der.size()==nbin.size() );
+  setGridElement( ipoint, jelement, value ); for(unsigned i=0;i<der.size();++i) setGridElement( ipoint, jelement+1+i, der[i] ); 
+}
+
 void GridVessel::calculate( const unsigned& current, MultiValue& myvals, std::vector<double>& buffer, std::vector<unsigned>& der_list ) const {
   plumed_dbg_assert( myvals.getNumberOfValues()==(nper+1) );
   for(unsigned i=0;i<nper;++i) buffer[bufstart + nper*current + i] += myvals.get(i+1);
@@ -308,13 +318,13 @@ double GridVessel::getValueAndDerivatives( const std::vector<double>& x, const u
   std::vector<double> D(dimension);
   std::vector<double> dder(dimension);
 
-  std::vector<unsigned> nindices(dimension);
+  std::vector<unsigned> nindices(dimension); unsigned n_neigh;
   std::vector<unsigned> indices(dimension); getIndices( x, indices );
-  std::vector<unsigned> neigh; getSplineNeighbors( getIndex(indices), neigh );
+  std::vector<unsigned> neigh; getSplineNeighbors( getIndex(indices), n_neigh, neigh );
   std::vector<double> xfloor(dimension); getGridPointCoordinates( getIndex(x), xfloor );
 
 // loop over neighbors
-  for(unsigned int ipoint=0;ipoint<neigh.size();++ipoint){
+  for(unsigned int ipoint=0;ipoint<n_neigh;++ipoint){
      double grid=getGridElement(neigh[ipoint], ind*(1+dimension) );          
      for(unsigned j=0;j<dimension;++j) dder[j] = getGridElement( neigh[ipoint], ind*(1+dimension) + 1 + j );
  
diff --git a/src/gridtools/GridVessel.h b/src/gridtools/GridVessel.h
index 7fe9953b10cb52dcab00169ed7d511edb7d0021e..4b6b4f754fd309801123d78e4207efffc7818dbf 100644
--- a/src/gridtools/GridVessel.h
+++ b/src/gridtools/GridVessel.h
@@ -102,6 +102,8 @@ public:
 /// Operations on one of the elements of grid point specified by vector
  double getGridElement( const std::vector<unsigned>&, const unsigned& ) const ;
  void setGridElement( const std::vector<unsigned>&, const unsigned&, const double& );
+/// Set the values and derivatives of a particular element
+ void setValueAndDerivatives( const unsigned& , const unsigned& , const double&, const std::vector<double>& );
 /// Set the size of the buffer equal to nper*npoints
  virtual void resize();
 /// Get the number of points in the grid
@@ -139,7 +141,7 @@ public:
  void getNeighbors( const std::vector<unsigned>& indices, const std::vector<unsigned>& nneigh,
                     unsigned& num_neighbors, std::vector<unsigned>& neighbors ) const ;
 /// Get the points neighboring a particular spline point
- void getSplineNeighbors( const unsigned& mybox, std::vector<unsigned>& mysneigh ) const ;
+ void getSplineNeighbors( const unsigned& mybox, unsigned& nneighbors, std::vector<unsigned>& mysneigh ) const ;
 /// Get the spacing between grid points
  const std::vector<double>& getGridSpacing() const ;
 /// Get the extent of the grid in one of the axis
diff --git a/src/gridtools/InterpolateGrid.cpp b/src/gridtools/InterpolateGrid.cpp
index 4d454fed69633b7a7d38be78eb1c414f1790ea1c..5d0dbbf9f8f6a00aaa7ba380b86587917a665c6a 100644
--- a/src/gridtools/InterpolateGrid.cpp
+++ b/src/gridtools/InterpolateGrid.cpp
@@ -21,7 +21,6 @@
 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
 #include "core/ActionRegister.h"
 #include "core/PlumedMain.h"
-#include "core/Atoms.h"
 #include "ActionWithInputGrid.h"
 
 //+PLUMEDOC GRIDANALYSIS INTERPOLATE_GRID
diff --git a/src/secondarystructure/AlphaRMSD.cpp b/src/secondarystructure/AlphaRMSD.cpp
index 0f29dc024cbc48ac818741d837659523f1b43f51..88a15578f1a8885bc4ba3ddd1f1585de7278cb34 100644
--- a/src/secondarystructure/AlphaRMSD.cpp
+++ b/src/secondarystructure/AlphaRMSD.cpp
@@ -22,7 +22,6 @@
 #include "SecondaryStructureRMSD.h"
 #include "core/ActionRegister.h"
 #include "core/PlumedMain.h"
-#include "core/Atoms.h"
 
 namespace PLMD {
 namespace secondarystructure {
diff --git a/src/secondarystructure/AntibetaRMSD.cpp b/src/secondarystructure/AntibetaRMSD.cpp
index 4a1fa335aadb6581f48865a2d4dff8845f4d2359..aec1c853bc9c8273cefcadebd38c197d9f7b4aed 100644
--- a/src/secondarystructure/AntibetaRMSD.cpp
+++ b/src/secondarystructure/AntibetaRMSD.cpp
@@ -22,7 +22,6 @@
 #include "SecondaryStructureRMSD.h"
 #include "core/ActionRegister.h"
 #include "core/PlumedMain.h"
-#include "core/Atoms.h"
 
 namespace PLMD {
 namespace secondarystructure {
diff --git a/src/secondarystructure/ParabetaRMSD.cpp b/src/secondarystructure/ParabetaRMSD.cpp
index b4849062db2a3879ffea6952c965b192738559f9..b61337de447e10ae99f34f5db025da151f7bec53 100644
--- a/src/secondarystructure/ParabetaRMSD.cpp
+++ b/src/secondarystructure/ParabetaRMSD.cpp
@@ -22,7 +22,6 @@
 #include "SecondaryStructureRMSD.h"
 #include "core/ActionRegister.h"
 #include "core/PlumedMain.h"
-#include "core/Atoms.h"
 
 namespace PLMD {
 namespace secondarystructure {
diff --git a/src/setup/Restart.cpp b/src/setup/Restart.cpp
index cb46256d0e47daf5dd42eac62bb3b369e3127adc..e12e76a5dc6f74679a7dc029ae49e05e24dc76a9 100644
--- a/src/setup/Restart.cpp
+++ b/src/setup/Restart.cpp
@@ -22,7 +22,6 @@
 #include "core/ActionSetup.h"
 #include "core/ActionRegister.h"
 #include "core/PlumedMain.h"
-#include "core/Atoms.h"
 #include "tools/Exception.h"
 
 using namespace std;
diff --git a/src/tools/GridSearch.h b/src/tools/GridSearch.h
deleted file mode 100644
index 58b416c504581976b02f0ab9318cb071a8194de2..0000000000000000000000000000000000000000
--- a/src/tools/GridSearch.h
+++ /dev/null
@@ -1,97 +0,0 @@
-/* +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
-   Copyright (c) 2013 The plumed team
-   (see the PEOPLE file at the root of the distribution for a list of names)
-
-   See http://www.plumed-code.org for more information.
-
-   This file is part of plumed, version 2.
-
-   plumed is free software: you can redistribute it and/or modify
-   it under the terms of the GNU Lesser General Public License as published by
-   the Free Software Foundation, either version 3 of the License, or
-   (at your option) any later version.
-
-   plumed is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU Lesser General Public License for more details.
-
-   You should have received a copy of the GNU Lesser General Public License
-   along with plumed.  If not, see <http://www.gnu.org/licenses/>.
-+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
-#ifndef __PLUMED_tools_GridSearch_h
-#define __PLUMED_tools_GridSearch_h
-
-#include "MinimiseBase.h"
-#include "Grid.h"
-#include <iostream>
-
-namespace PLMD{
-
-template <class FCLASS>
-class GridSearch { 
-private:
-/// This is the pointer to the member funciton in the energy
-/// calculating class that calculates the energy
-   typedef double(FCLASS::*engf_pointer)( const std::vector<double>& p, std::vector<double>& der );
-   FCLASS* myclass_func;
-   Grid* mygrid; 
-   Grid* myfgrid;
-public:
-   GridSearch( const std::vector<double>& mmin, const std::vector<double>& mmax, const std::vector<unsigned>& ng, const std::vector<unsigned>& nfg, FCLASS* funcc ) : 
-     myclass_func( funcc ), 
-     myfgrid(NULL)
-     {
-        std::vector<std::string> fake_args( nfg.size() ), gmin( nfg.size() ), gmax( nfg.size() );
-        for(unsigned i=0;i<nfg.size();++i){
-            Tools::convert(i+1,fake_args[i]); 
-            Tools::convert(mmin[i],gmin[i]); 
-            Tools::convert(mmax[i],gmax[i]);
-        }  
-        std::vector<bool> isperiodic( nfg.size(), false );
-        mygrid = new Grid("searcher",fake_args,gmin,gmax,ng,true,true,true,isperiodic,gmin,gmax);  
-        if( nfg[0]>0 ) myfgrid = new Grid("searcher",fake_args,gmin,gmax,nfg,false,false,true,isperiodic,gmin,gmax);
-     }
-     ~GridSearch(){ delete mygrid; if(myfgrid) delete myfgrid; }
-     bool minimise( std::vector<double>& p, engf_pointer myfunc );
-};
-
-template <class FCLASS>
-bool GridSearch<FCLASS>::minimise( std::vector<double>& p, engf_pointer myfunc ){
-   std::vector<double> der( p.size() ); 
-   double initial_eng = (myclass_func->*myfunc)( p, der );
-
-   double emin=(myclass_func->*myfunc)( mygrid->getPoint(0), der );
-   mygrid->setValueAndDerivatives( 0, emin, der ); unsigned pmin=0;
-   for(unsigned i=1;i<mygrid->getSize();++i){
-      double eng = (myclass_func->*myfunc)( mygrid->getPoint(i), der );
-      mygrid->setValueAndDerivatives( i, eng, der );
-      if( eng<emin ){ emin=eng; pmin=i; }
-   }
-
-   if( myfgrid ){
-       pmin=0; double emin=mygrid->getValueAndDerivatives( myfgrid->getPoint(0), der );
-       for(unsigned i=1;i<myfgrid->getSize();++i){
-           double eng = mygrid->getValueAndDerivatives( myfgrid->getPoint(i), der );
-           if( eng<emin ){ emin=eng; pmin=i; }
-       } 
-       double checkEng = (myclass_func->*myfunc)( myfgrid->getPoint(pmin), der );
-       if( checkEng<initial_eng ){
-           p=myfgrid->getPoint(pmin);
-           return true; 
-       } else {
-           return false;
-       }
-   }
-  
-   if( emin<initial_eng ){
-      p=mygrid->getPoint(pmin);
-      return true;
-   } else {
-      return false;
-   }
-}
-  
-}
-#endif
-
diff --git a/src/vesselbase/AveragingVessel.cpp b/src/vesselbase/AveragingVessel.cpp
index 7d8933bd6c80e49b218bc92d63b0a2136ab7025f..eddb5fd6e28839fe46b9f38c7487cfedb1e0a839 100644
--- a/src/vesselbase/AveragingVessel.cpp
+++ b/src/vesselbase/AveragingVessel.cpp
@@ -33,8 +33,10 @@ AveragingVessel::AveragingVessel( const vesselbase::VesselOptions& vo ):
 Vessel(vo),
 wascleared(true)
 {
-  ActionWithAveraging* myav = dynamic_cast<ActionWithAveraging*>( getAction() );
-  plumed_assert( myav ); unormalised = myav->unormalised;
+  if( getAction() ){
+      ActionWithAveraging* myav = dynamic_cast<ActionWithAveraging*>( getAction() );
+      plumed_assert( myav ); unormalised = myav->unormalised;
+  }
 }
 
 void AveragingVessel::finish( const std::vector<double>& buffer ){
diff --git a/src/vesselbase/Vessel.cpp b/src/vesselbase/Vessel.cpp
index deec8b036dfb3cf4d7d593cc2b1bdd4e32a76b7f..5277d40c9f86ffe82e243e641ef811fa909b9a92 100644
--- a/src/vesselbase/Vessel.cpp
+++ b/src/vesselbase/Vessel.cpp
@@ -74,9 +74,7 @@ numlab(da.numlab),
 action(da.action),
 line(Tools::getWords( da.parameters )),
 keywords(da.keywords),
-finished_read(false),
-comm(da.action->comm),
-log((da.action)->log)
+finished_read(false)
 {
   if( da.mylabel.length()>0){
       mylabel=da.mylabel;
@@ -132,13 +130,17 @@ void Vessel::checkRead(){
   }
   finished_read=true;
   std::string describe=description();
-  if( describe.length()>0 ) log.printf("  %s\n", describe.c_str() );
+  if( describe.length()>0 && action ) action->log.printf("  %s\n", describe.c_str() );
 }
 
 void Vessel::error( const std::string& msg ){
-  action->log.printf("ERROR for keyword %s in action %s with label %s : %s \n \n",myname.c_str(), (action->getName()).c_str(), (action->getLabel()).c_str(), msg.c_str() );
-  if(finished_read) keywords.print( log );
-  plumed_merror("ERROR for keyword " + myname + " in action "  + action->getName() + " with label " + action->getLabel() + " : " + msg );
+  if( action ){
+     action->log.printf("ERROR for keyword %s in action %s with label %s : %s \n \n",myname.c_str(), (action->getName()).c_str(), (action->getLabel()).c_str(), msg.c_str() );
+     if(finished_read) keywords.print( action->log );
+     plumed_merror("ERROR for keyword " + myname + " in action "  + action->getName() + " with label " + action->getLabel() + " : " + msg );
+  } else {
+     plumed_merror("ERROR: " + msg);
+  }
 }
 
 }
diff --git a/src/vesselbase/Vessel.h b/src/vesselbase/Vessel.h
index f193e264c0214738b7a5cde5e6a703a0d0ee57bf..933e45a1b1674ea4cad1d10ae2e450fafb7f408a 100644
--- a/src/vesselbase/Vessel.h
+++ b/src/vesselbase/Vessel.h
@@ -96,8 +96,6 @@ private:
 protected:
 /// The start of this Vessel's buffer in buffer in the underlying ActionWithVessel
   unsigned bufstart;
-/// A copy of the communicator
-  Communicator& comm;
 /// Return the numerical label
   int getNumericalLabel() const ;
 /// Report an error 
@@ -123,8 +121,6 @@ protected:
 /// Set the size of the data buffer
   void resizeBuffer( const unsigned& n );
 public:
-/// Reference to the log on which to output details
-  Log& log;
 /// Reserve any keywords for this particular vessel  
   static void registerKeywords( Keywords& keys );
 /// Convert the name to the label of the component