Skip to content
Snippets Groups Projects
Commit 3dc5ef08 authored by Gareth Tribello's avatar Gareth Tribello
Browse files

Fixed a bug and added a check on input to stop users making mistakes

parent bd949730
No related branches found
No related tags found
No related merge requests found
...@@ -88,6 +88,8 @@ public: ...@@ -88,6 +88,8 @@ public:
void applyBridgeForces( const std::vector<double>& bb ); void applyBridgeForces( const std::vector<double>& bb );
Vector getCentralAtomPos( const unsigned& curr ); Vector getCentralAtomPos( const unsigned& curr );
CatomPack getCentralAtomPack( const unsigned& basn, const unsigned& curr ); CatomPack getCentralAtomPack( const unsigned& basn, const unsigned& curr );
void normalizeVector( std::vector<double>& vals ) const ;
void normalizeVectorDerivatives( MultiValue& myvals ) const ;
}; };
inline inline
...@@ -130,6 +132,16 @@ AtomNumber BridgedMultiColvarFunction::getAbsoluteIndexOfCentralAtom(const unsig ...@@ -130,6 +132,16 @@ AtomNumber BridgedMultiColvarFunction::getAbsoluteIndexOfCentralAtom(const unsig
return mycolv->getAbsoluteIndexOfCentralAtom(i); return mycolv->getAbsoluteIndexOfCentralAtom(i);
} }
inline
void BridgedMultiColvarFunction::normalizeVector( std::vector<double>& vals ) const {
mycolv->normalizeVector( vals );
}
inline
void BridgedMultiColvarFunction::normalizeVectorDerivatives( MultiValue& myvals ) const {
mycolv->normalizeVectorDerivatives( myvals );
}
} }
} }
#endif #endif
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
You should have received a copy of the GNU Lesser General Public License You should have received a copy of the GNU Lesser General Public License
along with plumed. If not, see <http://www.gnu.org/licenses/>. along with plumed. If not, see <http://www.gnu.org/licenses/>.
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */ +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ */
#include "core/PlumedMain.h"
#include "core/ActionSet.h"
#include "VolumeGradientBase.h" #include "VolumeGradientBase.h"
#include "CatomPack.h" #include "CatomPack.h"
...@@ -37,6 +39,15 @@ BridgedMultiColvarFunction(ao) ...@@ -37,6 +39,15 @@ BridgedMultiColvarFunction(ao)
void VolumeGradientBase::requestAtoms( const std::vector<AtomNumber>& atoms ){ void VolumeGradientBase::requestAtoms( const std::vector<AtomNumber>& atoms ){
ActionAtomistic::requestAtoms(atoms); bridgeVariable=3*atoms.size(); ActionAtomistic::requestAtoms(atoms); bridgeVariable=3*atoms.size();
std::map<std::string,bool> checklabs; Dependencies dd( getDependencies() );
for(Dependencies::iterator p=dd.begin();p!=dd.end();++p) checklabs.insert(std::pair<std::string,bool>((*p)->getLabel(),false));
for(ActionSet::const_iterator p=plumed.getActionSet().begin();p!=plumed.getActionSet().end();++p){
if( (*p)->getLabel()==getPntrToMultiColvar()->getLabel() ) break;
if( checklabs.count((*p)->getLabel()) ) checklabs[(*p)->getLabel()]=true;
}
for(std::map<std::string,bool>::iterator p=checklabs.begin();p!=checklabs.end();++p){
if( !p->second ) error("the input for the virtual atoms used in the input for this action must appear in the input file before the input multicolvar");
}
addDependency( getPntrToMultiColvar() ); addDependency( getPntrToMultiColvar() );
tmpforces.resize( 3*atoms.size()+9 ); tmpforces.resize( 3*atoms.size()+9 );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment