diff --git a/src/pamm/PAMM.cpp b/src/pamm/PAMM.cpp
index 6b3827c82f960826543f07adac44c18ef6f1e1da..2d530ee8ece4a39f154534f00b24312d0ec2a9f3 100644
--- a/src/pamm/PAMM.cpp
+++ b/src/pamm/PAMM.cpp
@@ -188,7 +188,7 @@ void PAMM::calculateWeight( multicolvar::AtomValuePack& myatoms ){
    // Weight of point is average of weights of input colvars?
    std::vector<double> tval(2); double ww=0;
    for(unsigned i=0;i<nvars;++i){
-       getVectorForTask( myatoms.getIndex(i), false, tval ); ww+=tval[i];
+       getVectorForTask( myatoms.getIndex(i), false, tval ); ww+=tval[0];
    }
    myatoms.setValue( 0, ww / static_cast<double>( nvars ) );