From cca21bb732fb6255bfb39276c0c1fa0204b5f516 Mon Sep 17 00:00:00 2001 From: Gareth Tribello <gt@eider.phy.qub.ac.uk> Date: Mon, 20 Apr 2015 14:42:33 +0100 Subject: [PATCH] Fixed virial in PCARMSD Also had to avoid using vector.clear with a std::vector<Vector> as the code complains when the code is compiled with g++ and more excessive debug options --- src/colvar/PCARMSD.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/colvar/PCARMSD.cpp b/src/colvar/PCARMSD.cpp index 2b37a229e..7cae2f76d 100644 --- a/src/colvar/PCARMSD.cpp +++ b/src/colvar/PCARMSD.cpp @@ -190,12 +190,11 @@ void PCARMSD::calculate(){ Value* value=getPntrToComponent(pca_names[i].c_str()); double val;val=0.; for(unsigned iat=0;iat<getNumberOfAtoms();iat++){ - val+=dotProduct(alignedpos[iat]-centeredref[iat],eigenvectors[i][iat]); + val+=dotProduct(alignedpos[iat]-centeredref[iat],eigenvectors[i][iat]); der[iat].zero(); } value->set(val); // here the loop is reversed to better suit the structure of the derivative of the rotation matrix double tmp1; - der.clear(); for(unsigned a=0;a<3;a++){ for(unsigned b=0;b<3;b++){ for(unsigned iat=0;iat<getNumberOfAtoms();iat++){ @@ -217,7 +216,7 @@ void PCARMSD::calculate(){ } } - setBoxDerivativesNoPbc(); + for(unsigned i=0;i<getNumberOfComponents();++i) setBoxDerivativesNoPbc( getPntrToComponent(i) ); } -- GitLab