From eb649c5966719aaf74b7d1d4fba76c0ff8ebe049 Mon Sep 17 00:00:00 2001
From: Giovanni Bussi <giovanni.bussi@gmail.com>
Date: Thu, 4 Sep 2014 10:42:06 +0200
Subject: [PATCH] Added total bias

A component called "bias" is needed for replica exchange to work properly
---
 src/bias/Value.cpp | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/bias/Value.cpp b/src/bias/Value.cpp
index 1707afd0a..171cdc78c 100644
--- a/src/bias/Value.cpp
+++ b/src/bias/Value.cpp
@@ -97,6 +97,7 @@ void BiasValue::registerKeywords(Keywords& keys){
                                             "these quantities will named with  the arguments of the bias followed by "
                                             "the character string _bias. These quantities tell the user how much the bias is "
                                             "due to each of the colvars.");
+  keys.addOutputComponent("bias","default","total bias");
 }
 
 BiasValue::BiasValue(const ActionOptions&ao):
@@ -112,15 +113,19 @@ PLUMED_BIAS_INIT(ao)
 //        ss=getPntrToArgument(i)->getName()+"_bias";
 	addComponent(ss); componentIsNotPeriodic(ss);
   }
+  addComponent("bias"); componentIsNotPeriodic("bias");
 }
 
 void BiasValue::calculate(){
+  double bias=0.0;
 for(unsigned i=0;i< getNumberOfArguments() ;++i){
   double val; val=getArgument(i); 
 //  log<<"BIAS "<<val<<"\n";
   getPntrToComponent(i)->set(val);
   setOutputForce(i,-1.);
+  bias+=val;
 }
+  getPntrToComponent(getNumberOfArguments())->set(bias);
 }
 
 }
-- 
GitLab