From 6f6b7ce296c501b228a9e5cc5ab8e67c89204c0c Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Tue, 6 Oct 2015 18:41:19 +0200
Subject: [PATCH] Allow metad.bias to be biased

This is required because of the limitations of the previous commit
---
 src/bias/MetaD.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/bias/MetaD.cpp b/src/bias/MetaD.cpp
index 271c37083..db1b1995d 100644
--- a/src/bias/MetaD.cpp
+++ b/src/bias/MetaD.cpp
@@ -650,7 +650,7 @@ last_step_warn_grid(0)
    if(walkers_mpi) log.printf("  Multiple walkers active using MPI communnication\n"); 
   }
 
-  addComponent("bias"); componentIsNotPeriodic("bias");
+  addComponentWithDerivatives("bias"); componentIsNotPeriodic("bias");
   if( rewf_grid_.size()>0 ){ 
    addComponent("rbias"); componentIsNotPeriodic("rbias");
    addComponent("rct"); componentIsNotPeriodic("rct"); 
@@ -1155,6 +1155,7 @@ void MetaD::calculate()
   for(unsigned i=0;i<ncv;++i){
    const double f=-der[i];
    setOutputForce(i,f);
+   getPntrToComponent("bias")->addDerivative(i,der[i]);
   }
 
   delete [] der;
-- 
GitLab