本文整理汇总了C++中PDB::getArgumentNames方法的典型用法代码示例。如果您正苦于以下问题:C++ PDB::getArgumentNames方法的具体用法?C++ PDB::getArgumentNames怎么用?C++ PDB::getArgumentNames使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PDB
的用法示例。
在下文中一共展示了PDB::getArgumentNames方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: readArgumentsFromPDB
void ReferenceArguments::readArgumentsFromPDB( const PDB& pdb ) {
ReferenceAtoms* aref=dynamic_cast<ReferenceAtoms*>( this );
arg_names.resize( pdb.getArgumentNames().size() );
for(unsigned i=0; i<arg_names.size(); ++i) arg_names[i]=pdb.getArgumentNames()[i];
if( !aref && arg_names.size()==0 ) error("no arguments in input PDB file");
reference_args.resize( arg_names.size() ); arg_der_index.resize( arg_names.size() );
for(unsigned i=0; i<arg_names.size(); ++i) {
if( !pdb.getArgumentValue(arg_names[i], reference_args[i]) ) error("argument " + arg_names[i] + " was not set in pdb input");
arg_der_index[i]=i;
}
if( hasweights ) {
plumed_massert( !hasmetric, "should not have weights if we are using metric");
weights.resize( arg_names.size() ); sqrtweight.resize( arg_names.size() );
for(unsigned i=0; i<reference_args.size(); ++i) {
if( !pdb.getArgumentValue("sigma_" + arg_names[i], weights[i]) ) error("value sigma_" + arg_names[i] + " was not set in pdb input");
sqrtweight[i] = sqrt( weights[i] );
}
} else if( hasmetric ) {
plumed_massert( !hasweights, "should not have weights if we are using metric");
double thissig; metric.resize( arg_names.size(), arg_names.size() );
for(unsigned i=0; i<reference_args.size(); ++i) {
for(unsigned j=i; j<reference_args.size(); ++j) {
if( !pdb.getArgumentValue("sigma_" + arg_names[i] + "_" + arg_names[j], thissig) ) {
error("value sigma_" + arg_names[i] + "_" + arg_names[j] + " was not set in pdb input");
}
metric(i,j)=metric(j,i)=thissig;
}
}
} else {
weights.resize( arg_names.size() ); sqrtweight.resize( arg_names.size() );
for(unsigned i=0; i<weights.size(); ++i) sqrtweight[i]=weights[i]=1.0;
}
}
示例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;
}