本文整理汇总了C++中PDB::setArgumentValue方法的典型用法代码示例。如果您正苦于以下问题:C++ PDB::setArgumentValue方法的具体用法?C++ PDB::setArgumentValue怎么用?C++ PDB::setArgumentValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDB
的用法示例。
在下文中一共展示了PDB::setArgumentValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update
void AdaptivePath::update() {
double weight2 = -1.*mypathv->dx;
double weight1 = 1.0 + mypathv->dx;
if( weight1>1.0 ) {
weight1=1.0; weight2=0.0;
} else if( weight2>1.0 ) {
weight1=0.0; weight2=1.0;
}
// Add projections to dispalcement accumulators
ReferenceConfiguration* myref = getReferenceConfiguration( mypathv->iclose1 );
myref->extractDisplacementVector( getPositions(), getArguments(), mypathv->cargs, false, displacement );
getReferenceConfiguration( mypathv->iclose2 )->extractDisplacementVector( myref->getReferencePositions(), getArguments(), myref->getReferenceArguments(), false, displacement2 );
displacement.addDirection( -mypathv->dx, displacement2 );
pdisplacements[mypathv->iclose1].addDirection( weight1, displacement );
pdisplacements[mypathv->iclose2].addDirection( weight2, displacement );
// Update weight accumulators
wsum[mypathv->iclose1] *= fadefact;
wsum[mypathv->iclose2] *= fadefact;
wsum[mypathv->iclose1] += weight1;
wsum[mypathv->iclose2] += weight2;
// This does the update of the path if it is time to
if( (getStep()>0) && (getStep()%update_str==0) ) {
wsum[fixedn[0]]=wsum[fixedn[1]]=0.;
for(unsigned inode=0; inode<getNumberOfReferencePoints(); ++inode) {
if( wsum[inode]>0 ) {
// First displace the node by the weighted direction
getReferenceConfiguration( inode )->displaceReferenceConfiguration( 1./wsum[inode], pdisplacements[inode] );
// Reset the displacement
pdisplacements[inode].zeroDirection();
}
}
// Now ensure all the nodes of the path are equally spaced
PathReparameterization myspacings( getPbc(), getArguments(), getAllReferenceConfigurations() );
myspacings.reparameterize( fixedn[0], fixedn[1], tolerance );
}
if( (getStep()>0) && (getStep()%wstride==0) ) {
pathfile.printf("# PATH AT STEP %d TIME %f \n", getStep(), getTime() );
std::vector<std::unique_ptr<ReferenceConfiguration>>& myconfs=getAllReferenceConfigurations();
std::vector<SetupMolInfo*> moldat=plumed.getActionSet().select<SetupMolInfo*>();
if( moldat.size()>1 ) error("you should only have one MOLINFO action in your input file");
SetupMolInfo* mymoldat=NULL; if( moldat.size()==1 ) mymoldat=moldat[0];
std::vector<std::string> argument_names( getNumberOfArguments() );
for(unsigned i=0; i<getNumberOfArguments(); ++i) argument_names[i] = getPntrToArgument(i)->getName();
PDB mypdb; mypdb.setArgumentNames( argument_names );
for(unsigned i=0; i<myconfs.size(); ++i) {
pathfile.printf("REMARK TYPE=%s\n", myconfs[i]->getName().c_str() );
mypdb.setAtomPositions( myconfs[i]->getReferencePositions() );
for(unsigned j=0; j<getNumberOfArguments(); ++j) mypdb.setArgumentValue( getPntrToArgument(j)->getName(), myconfs[i]->getReferenceArgument(j) );
mypdb.print( atoms.getUnits().getLength()/0.1, mymoldat, pathfile, ofmt );
}
pathfile.flush();
}
}
示例2: transferDataToPDB
bool DataCollectionObject::transferDataToPDB( PDB& mypdb ) {
// Check if PDB contains argument names
std::vector<std::string> pdb_args( mypdb.getArgumentNames() );
// Now set the argument values
std::map<std::string,double>::iterator it;
for(unsigned i=0; i<pdb_args.size(); ++i) {
it=args.find( pdb_args[i] );
if( it==args.end() ) return false;
mypdb.setArgumentValue( pdb_args[i], it->second );
}
// Now set the atomic positions
std::vector<AtomNumber> pdb_pos( mypdb.getAtomNumbers() );
if( pdb_pos.size()==positions.size() ) mypdb.setAtomPositions( positions );
else if( pdb_pos.size()>0 ) plumed_merror("This feature is currently not ready");
return true;
}