diff --git a/src/crystdistrib/QuaternionBondProductMatrix.cpp b/src/crystdistrib/QuaternionBondProductMatrix.cpp index cf21f81f0b..dfada2bfe2 100644 --- a/src/crystdistrib/QuaternionBondProductMatrix.cpp +++ b/src/crystdistrib/QuaternionBondProductMatrix.cpp @@ -122,7 +122,7 @@ unsigned QuaternionBondProductMatrix::getNumberOfDerivatives() { } unsigned QuaternionBondProductMatrix::getNumberOfColumns() const { - const ActionWithMatrix* am=dynamic_cast( getPntrToArgument(4)->getPntrToAction() ); plumed_assert( am ); + const ActionWithMatrix* am=dynamic_cast( getPntrToArgument(4)->getPntrToAction() ); plumed_assert( am ); if( getPntrToArgument(4)->isSymmetric() && am->getNumberOfColumns()==getPntrToArgument(4)->getShape()[1]-1 ) return am->getNumberOfColumns() + 1; return am->getNumberOfColumns(); } @@ -245,15 +245,15 @@ void QuaternionBondProductMatrix::performTask( const std::string& controller, co } //had to split because bond's derivatives depend on the value of the overall quaternion component if( !doNotCalculateDerivatives() ) { - unsigned ostrn = getConstPntrToComponent(0)->getPositionInStream(); - for(unsigned i=0; i<4; ++i) { - tempDot=dotProduct(Vector4d(quat[0],-quat[1],-quat[2],-quat[3]), dqt[1].getCol(i))*normFac; - if( i>0 ) { - plumed_assert( !stored[4+i] ); unsigned find = getPntrToArgument(4+i)->getIndexInStore( index1*getPntrToArgument(4+i)->getShape()[1] + ind2 ); - myvals.addDerivative( ostrn, base + find, tempDot ); myvals.updateIndex( ostrn, base + find ); - } - base += getPntrToArgument(4+i)->getNumberOfStoredValues(); + unsigned ostrn = getConstPntrToComponent(0)->getPositionInStream(); + for(unsigned i=0; i<4; ++i) { + tempDot=dotProduct(Vector4d(quat[0],-quat[1],-quat[2],-quat[3]), dqt[1].getCol(i))*normFac; + if( i>0 ) { + plumed_assert( !stored[4+i] ); unsigned find = getPntrToArgument(4+i)->getIndexInStore( index1*getPntrToArgument(4+i)->getShape()[1] + ind2 ); + myvals.addDerivative( ostrn, base + find, tempDot ); myvals.updateIndex( ostrn, base + find ); } + base += getPntrToArgument(4+i)->getNumberOfStoredValues(); + } } //i component @@ -269,19 +269,19 @@ void QuaternionBondProductMatrix::performTask( const std::string& controller, co if( doNotCalculateDerivatives() ) continue ; tempDot=(dotProduct(Vector4d(quat[1],quat[0],quat[3],-quat[2]), dqt[0].getCol(i)) + pref2*quatTemp[(5-i)%4])*normFac; addDerivativeOnVectorArgument( stored[i], 1, i, index1, tempDot, myvals); - base += getPntrToArgument(i)->getNumberOfStoredValues(); + base += getPntrToArgument(i)->getNumberOfStoredValues(); } - if( !doNotCalculateDerivatives() ) { - unsigned ostrn = getConstPntrToComponent(1)->getPositionInStream(); - for(unsigned i=0; i<4; ++i) { - tempDot=dotProduct(Vector4d(quat[1],quat[0],quat[3],-quat[2]), dqt[1].getCol(i))*normFac; - if( i>0 ) { - plumed_assert( !stored[4+i] ); unsigned find = getPntrToArgument(4+i)->getIndexInStore( index1*getPntrToArgument(4+i)->getShape()[1] + ind2 ); - myvals.addDerivative( ostrn, base + find, tempDot+(-bond[i]*normFac*normFac*xf) ); myvals.updateIndex( ostrn, base + find ); - } - base += getPntrToArgument(4+i)->getNumberOfStoredValues(); + if( !doNotCalculateDerivatives() ) { + unsigned ostrn = getConstPntrToComponent(1)->getPositionInStream(); + for(unsigned i=0; i<4; ++i) { + tempDot=dotProduct(Vector4d(quat[1],quat[0],quat[3],-quat[2]), dqt[1].getCol(i))*normFac; + if( i>0 ) { + plumed_assert( !stored[4+i] ); unsigned find = getPntrToArgument(4+i)->getIndexInStore( index1*getPntrToArgument(4+i)->getShape()[1] + ind2 ); + myvals.addDerivative( ostrn, base + find, tempDot+(-bond[i]*normFac*normFac*xf) ); myvals.updateIndex( ostrn, base + find ); } + base += getPntrToArgument(4+i)->getNumberOfStoredValues(); + } } @@ -303,15 +303,15 @@ void QuaternionBondProductMatrix::performTask( const std::string& controller, co } if( !doNotCalculateDerivatives() ) { - unsigned ostrn = getConstPntrToComponent(2)->getPositionInStream(); - for(unsigned i=0; i<4; ++i) { - tempDot=dotProduct(Vector4d(quat[2],-quat[3],quat[0],quat[1]), dqt[1].getCol(i))*normFac; - if( i>0 ) { - plumed_assert( !stored[4+i] ); unsigned find = getPntrToArgument(4+i)->getIndexInStore( index1*getPntrToArgument(4+i)->getShape()[1] + ind2 ); - myvals.addDerivative( ostrn, base + find, tempDot+(-bond[i]*normFac*normFac*yf) ); myvals.updateIndex( ostrn, base + find ); - } - base += getPntrToArgument(4+i)->getNumberOfStoredValues(); + unsigned ostrn = getConstPntrToComponent(2)->getPositionInStream(); + for(unsigned i=0; i<4; ++i) { + tempDot=dotProduct(Vector4d(quat[2],-quat[3],quat[0],quat[1]), dqt[1].getCol(i))*normFac; + if( i>0 ) { + plumed_assert( !stored[4+i] ); unsigned find = getPntrToArgument(4+i)->getIndexInStore( index1*getPntrToArgument(4+i)->getShape()[1] + ind2 ); + myvals.addDerivative( ostrn, base + find, tempDot+(-bond[i]*normFac*normFac*yf) ); myvals.updateIndex( ostrn, base + find ); } + base += getPntrToArgument(4+i)->getNumberOfStoredValues(); + } } //k component @@ -337,8 +337,8 @@ void QuaternionBondProductMatrix::performTask( const std::string& controller, co for(unsigned i=0; i<4; ++i) { tempDot=dotProduct(Vector4d(quat[3],quat[2],-quat[1],quat[0]), dqt[1].getCol(i))*normFac; if( i>0 ) { - plumed_assert( !stored[4+i] ); unsigned find = getPntrToArgument(4+i)->getIndexInStore( index1*getPntrToArgument(4+i)->getShape()[1] + ind2 ); - myvals.addDerivative( ostrn, base + find, tempDot+(-bond[i]*normFac*normFac*zf) ); myvals.updateIndex( ostrn, base + find ); + plumed_assert( !stored[4+i] ); unsigned find = getPntrToArgument(4+i)->getIndexInStore( index1*getPntrToArgument(4+i)->getShape()[1] + ind2 ); + myvals.addDerivative( ostrn, base + find, tempDot+(-bond[i]*normFac*normFac*zf) ); myvals.updateIndex( ostrn, base + find ); } base += getPntrToArgument(4+i)->getNumberOfStoredValues(); } diff --git a/src/secondarystructure/AlphaRMSD.cpp b/src/secondarystructure/AlphaRMSD.cpp index 9a5d6e7214..285b17d8e7 100644 --- a/src/secondarystructure/AlphaRMSD.cpp +++ b/src/secondarystructure/AlphaRMSD.cpp @@ -169,9 +169,9 @@ AlphaRMSD::AlphaRMSD(const ActionOptions&ao): readInputLine( lab + ": SECONDARY_STRUCTURE_RMSD BONDLENGTH=0.17" + seglist + structure + " " + atoms + " TYPE=" + type + nopbcstr ); // Create the less than object if( ltmap.length()>0 ) { - readInputLine( getShortcutLabel() + "_lt: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"}"); - if( uselessthan ) readInputLine( getShortcutLabel() + "_lessthan: SUM ARG=" + getShortcutLabel() + "_lt PERIODIC=NO"); - else readInputLine( getShortcutLabel() + ": SUM ARG=" + getShortcutLabel() + "_lt PERIODIC=NO"); + readInputLine( getShortcutLabel() + "_lt: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"}"); + if( uselessthan ) readInputLine( getShortcutLabel() + "_lessthan: SUM ARG=" + getShortcutLabel() + "_lt PERIODIC=NO"); + else readInputLine( getShortcutLabel() + ": SUM ARG=" + getShortcutLabel() + "_lt PERIODIC=NO"); } } diff --git a/src/secondarystructure/AntibetaRMSD.cpp b/src/secondarystructure/AntibetaRMSD.cpp index d12fad3aa4..19cbada1ba 100644 --- a/src/secondarystructure/AntibetaRMSD.cpp +++ b/src/secondarystructure/AntibetaRMSD.cpp @@ -233,22 +233,22 @@ AntibetaRMSD::AntibetaRMSD(const ActionOptions&ao): std::string atoms="ATOMS=" + all_atoms[0]; for(unsigned i=1; i0 ) { - readInputLine( scutoff_action ); std::string str_cut; Tools::convert( strands_cutoff, str_cut ); - readInputLine( getShortcutLabel() + "_cut: CUSTOM ARG=" + getShortcutLabel() + "_cut_dists FUNC=step(" + str_cut + "-x) PERIODIC=NO"); - readInputLine( lab + ": SECONDARY_STRUCTURE_RMSD ALIGN_STRANDS MASK=" + getShortcutLabel() + "_cut BONDLENGTH=0.17" + seglist + structure + " " + atoms + " TYPE=" + type + nopbcstr ); - if( ltmap.length()>0 ) { - readInputLine( getShortcutLabel() + "_ltu: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"} MASK=" + getShortcutLabel() + "_cut"); - readInputLine( getShortcutLabel() + "_lt: CUSTOM ARG=" + getShortcutLabel() + "_ltu," + getShortcutLabel() + "_cut FUNC=x*y PERIODIC=NO"); - } + readInputLine( scutoff_action ); std::string str_cut; Tools::convert( strands_cutoff, str_cut ); + readInputLine( getShortcutLabel() + "_cut: CUSTOM ARG=" + getShortcutLabel() + "_cut_dists FUNC=step(" + str_cut + "-x) PERIODIC=NO"); + readInputLine( lab + ": SECONDARY_STRUCTURE_RMSD ALIGN_STRANDS MASK=" + getShortcutLabel() + "_cut BONDLENGTH=0.17" + seglist + structure + " " + atoms + " TYPE=" + type + nopbcstr ); + if( ltmap.length()>0 ) { + readInputLine( getShortcutLabel() + "_ltu: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"} MASK=" + getShortcutLabel() + "_cut"); + readInputLine( getShortcutLabel() + "_lt: CUSTOM ARG=" + getShortcutLabel() + "_ltu," + getShortcutLabel() + "_cut FUNC=x*y PERIODIC=NO"); + } } else { - readInputLine( lab + ": SECONDARY_STRUCTURE_RMSD ALIGN_STRANDS BONDLENGTH=0.17" + seglist + structure + " " + atoms + " TYPE=" + type + nopbcstr ); - if( ltmap.length()>0 ) readInputLine( getShortcutLabel() + "_lt: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"}"); + readInputLine( lab + ": SECONDARY_STRUCTURE_RMSD ALIGN_STRANDS BONDLENGTH=0.17" + seglist + structure + " " + atoms + " TYPE=" + type + nopbcstr ); + if( ltmap.length()>0 ) readInputLine( getShortcutLabel() + "_lt: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"}"); } // Create the less than object if( ltmap.length()>0 ) { - if( uselessthan ) readInputLine( getShortcutLabel() + "_lessthan: SUM ARG=" + getShortcutLabel() + "_lt PERIODIC=NO"); - else readInputLine( getShortcutLabel() + ": SUM ARG=" + getShortcutLabel() + "_lt PERIODIC=NO"); - } + if( uselessthan ) readInputLine( getShortcutLabel() + "_lessthan: SUM ARG=" + getShortcutLabel() + "_lt PERIODIC=NO"); + else readInputLine( getShortcutLabel() + ": SUM ARG=" + getShortcutLabel() + "_lt PERIODIC=NO"); + } } } diff --git a/src/secondarystructure/ParabetaRMSD.cpp b/src/secondarystructure/ParabetaRMSD.cpp index cf13cc9492..8e539a7b0e 100644 --- a/src/secondarystructure/ParabetaRMSD.cpp +++ b/src/secondarystructure/ParabetaRMSD.cpp @@ -275,25 +275,25 @@ ParabetaRMSD::ParabetaRMSD(const ActionOptions&ao): std::string atoms="ATOMS=" + all_atoms[0]; for(unsigned i=1; i0 ) { - readInputLine( scutoff_action ); std::string str_cut; Tools::convert( strands_cutoff, str_cut ); - readInputLine( getShortcutLabel() + "_cut: CUSTOM ARG=" + getShortcutLabel() + "_cut_dists FUNC=step(" + str_cut + "-x) PERIODIC=NO"); - readInputLine( getShortcutLabel() + "_both: SECONDARY_STRUCTURE_RMSD ALIGN_STRANDS MASK=" + getShortcutLabel() + "_cut BONDLENGTH=0.17" + seglist + structure + " " + atoms + " TYPE=" + type + nopbcstr ); - if( ltmap.length()>0 ) { - // Create the lowest line - readInputLine( lab + ": LOWEST ARG=" + getShortcutLabel() + "_both.struct-1," + getShortcutLabel() + "_both.struct-2" ); - // Create the less than object - readInputLine( getShortcutLabel() + "_ltu: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"} MASK=" + getShortcutLabel() + "_cut"); - // Multiply by the strands cutoff - readInputLine( getShortcutLabel() + "_lt: CUSTOM ARG=" + getShortcutLabel() + "_ltu," + getShortcutLabel() + "_cut FUNC=x*y PERIODIC=NO"); - } + readInputLine( scutoff_action ); std::string str_cut; Tools::convert( strands_cutoff, str_cut ); + readInputLine( getShortcutLabel() + "_cut: CUSTOM ARG=" + getShortcutLabel() + "_cut_dists FUNC=step(" + str_cut + "-x) PERIODIC=NO"); + readInputLine( getShortcutLabel() + "_both: SECONDARY_STRUCTURE_RMSD ALIGN_STRANDS MASK=" + getShortcutLabel() + "_cut BONDLENGTH=0.17" + seglist + structure + " " + atoms + " TYPE=" + type + nopbcstr ); + if( ltmap.length()>0 ) { + // Create the lowest line + readInputLine( lab + ": LOWEST ARG=" + getShortcutLabel() + "_both.struct-1," + getShortcutLabel() + "_both.struct-2" ); + // Create the less than object + readInputLine( getShortcutLabel() + "_ltu: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"} MASK=" + getShortcutLabel() + "_cut"); + // Multiply by the strands cutoff + readInputLine( getShortcutLabel() + "_lt: CUSTOM ARG=" + getShortcutLabel() + "_ltu," + getShortcutLabel() + "_cut FUNC=x*y PERIODIC=NO"); + } } else { - readInputLine( getShortcutLabel() + "_both: SECONDARY_STRUCTURE_RMSD ALIGN_STRANDS BONDLENGTH=0.17" + seglist + structure + " " + atoms + " TYPE=" + type + nopbcstr ); - if( ltmap.length()>0 ) { - // Create the lowest line - readInputLine( lab + ": LOWEST ARG=" + getShortcutLabel() + "_both.struct-1," + getShortcutLabel() + "_both.struct-2" ); - // Create the less than object - readInputLine( getShortcutLabel() + "_lt: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"}"); - } + readInputLine( getShortcutLabel() + "_both: SECONDARY_STRUCTURE_RMSD ALIGN_STRANDS BONDLENGTH=0.17" + seglist + structure + " " + atoms + " TYPE=" + type + nopbcstr ); + if( ltmap.length()>0 ) { + // Create the lowest line + readInputLine( lab + ": LOWEST ARG=" + getShortcutLabel() + "_both.struct-1," + getShortcutLabel() + "_both.struct-2" ); + // Create the less than object + readInputLine( getShortcutLabel() + "_lt: LESS_THAN ARG=" + lab + " SWITCH={" + ltmap +"}"); + } } if( ltmap.length()>0 ) { if( uselessthan ) readInputLine( getShortcutLabel() + "_lessthan: SUM ARG=" + getShortcutLabel() + "_lt PERIODIC=NO"); diff --git a/src/secondarystructure/SecondaryStructureRMSD.cpp b/src/secondarystructure/SecondaryStructureRMSD.cpp index 69c1b92506..f92e7b594c 100644 --- a/src/secondarystructure/SecondaryStructureRMSD.cpp +++ b/src/secondarystructure/SecondaryStructureRMSD.cpp @@ -122,7 +122,7 @@ SecondaryStructureRMSD::SecondaryStructureRMSD(const ActionOptions&ao): log<<" Bibliography "< all_atoms; parseAtomList("ATOMS",all_atoms); requestAtoms( all_atoms ); diff --git a/src/valtools/VStack.cpp b/src/valtools/VStack.cpp index e767fa85df..7d155cd263 100644 --- a/src/valtools/VStack.cpp +++ b/src/valtools/VStack.cpp @@ -49,7 +49,7 @@ class VStack : public ActionWithMatrix { unsigned getNumberOfColumns() const override { return getNumberOfArguments(); } /// void setupForTask( const unsigned& task_index, std::vector& indices, MultiValue& myvals ) const override ; -/// +/// int checkTaskIsActive( const unsigned& itask ) const override ; /// void performTask( const std::string& controller, const unsigned& index1, const unsigned& index2, MultiValue& myvals ) const override ; @@ -135,7 +135,7 @@ void VStack::setupForTask( const unsigned& task_index, std::vector& in int VStack::checkTaskIsActive( const unsigned& itask ) const { return 1; -} +} void VStack::performTask( const std::string& controller, const unsigned& index1, const unsigned& index2, MultiValue& myvals ) const { unsigned ind2 = index2; if( index2>=getConstPntrToComponent(0)->getShape()[0] ) ind2 = index2 - getConstPntrToComponent(0)->getShape()[0];