From f19f5be156f9c409b02e5ca299c7693a32b7db9f Mon Sep 17 00:00:00 2001
From: Gareth Tribello <gareth.tribello@gmail.com>
Date: Fri, 18 Mar 2016 16:44:02 +0000
Subject: [PATCH] Fixed warning about DotProductDistance in compilation

---
 src/reference/DotProductDistance.cpp | 6 ++++--
 src/reference/ReferenceArguments.h   | 6 +++---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/reference/DotProductDistance.cpp b/src/reference/DotProductDistance.cpp
index 5340689cc..bfda1290c 100644
--- a/src/reference/DotProductDistance.cpp
+++ b/src/reference/DotProductDistance.cpp
@@ -29,7 +29,7 @@ class DotProductDistance : public ArgumentOnlyDistance {
 public:
   explicit DotProductDistance( const ReferenceConfigurationOptions& ro );
   void read( const PDB& );
-  double calc( const std::vector<Value*>& vals, const std::vector<double>& arg, const bool& squared );
+  double calculateArgumentDistance( const std::vector<Value*> & vals, const std::vector<double>& arg, ReferenceValuePack& myder, const bool& squared ) const ;
 };
 
 PLUMED_REGISTER_METRIC(DotProductDistance,"DOTPRODUCT")
@@ -44,9 +44,11 @@ void DotProductDistance::read( const PDB& pdb ){
   readArgumentsFromPDB( pdb );
 }
 
-double DotProductDistance::calc( const std::vector<Value*>& vals, const std::vector<double>& arg, const bool& squared ){
+double DotProductDistance::calculateArgumentDistance( const std::vector<Value*> & vals, const std::vector<double>& arg, 
+                                                      ReferenceValuePack& myder, const bool& squared ) const {
   double dot=0.0; 
   for (unsigned long i=0; i<vals.size(); ++i) dot+=getReferenceArgument(i)*arg[i];
+  for (unsigned long i=0; i<vals.size(); ++i) myder.setArgumentDerivatives( i, -getReferenceArgument(i)/dot );
   return -log(dot);
 }
 
diff --git a/src/reference/ReferenceArguments.h b/src/reference/ReferenceArguments.h
index 96b7a3ce9..af56b08c8 100644
--- a/src/reference/ReferenceArguments.h
+++ b/src/reference/ReferenceArguments.h
@@ -64,9 +64,6 @@ protected:
   void readArgumentsFromPDB( const PDB& pdb );
 /// Set the values of the colvars based on their current instantanous values (used in Analysis)
   void setReferenceArguments();
-/// Calculate the euclidean/malanobius distance the atoms have moved from the reference
-/// configuration in CV space
-  double calculateArgumentDistance( const std::vector<Value*> & vals, const std::vector<double>& arg, ReferenceValuePack& myder, const bool& squared ) const ;
 public:
   explicit ReferenceArguments( const ReferenceConfigurationOptions& ro );
 /// Get the number of reference arguments
@@ -86,6 +83,9 @@ public:
   const std::vector<double>& getReferenceMetric();
 /// Return names
   const std::vector<std::string>& getArgumentNames();
+/// Calculate the euclidean/malanobius distance the atoms have moved from the reference
+/// configuration in CV space
+  virtual double calculateArgumentDistance( const std::vector<Value*> & vals, const std::vector<double>& arg, ReferenceValuePack& myder, const bool& squared ) const ;
 };
 
 inline
-- 
GitLab