本文整理汇总了C++中AtomMask::AddAtom方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomMask::AddAtom方法的具体用法?C++ AtomMask::AddAtom怎么用?C++ AtomMask::AddAtom使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomMask
的用法示例。
在下文中一共展示了AtomMask::AddAtom方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PrintCutAtoms
/** Print atoms for which the cumulative energy satisfies the given
* cutoffs. Also create MOL2 files containing those atoms.
*/
int Action_Pairwise::PrintCutAtoms(Frame const& frame, int frameNum, EoutType ctype,
Darray const& Earray, double cutIn)
{
AtomMask CutMask; // Hold atoms that satisfy the cutoff
Darray CutCharges; // Hold evdw/eelec corresponding to CutMask atoms.
if (Eout_ != 0) {
if (nb_calcType_==COMPARE_REF)
Eout_->Printf("\tPAIRWISE: Cumulative d%s:", CalcString[ctype]);
else
Eout_->Printf("\tPAIRWISE: Cumulative %s:", CalcString[ctype]);
Eout_->Printf(" %s < %.4f, %s > %.4f\n", CalcString[ctype], -cutIn,
CalcString[ctype], cutIn);
}
for (AtomMask::const_iterator atom = Mask0_.begin(); atom != Mask0_.end(); ++atom)
{
if (fabs(Earray[*atom]) > cutIn)
{
if (Eout_ != 0)
Eout_->Printf("\t\t%[email protected]%s: %12.4f\n", *atom+1,
(*CurrentParm_)[*atom].c_str(), Earray[*atom]);
CutMask.AddAtom(*atom);
CutCharges.push_back(Earray[*atom]);
}
}
// Write mol2 with atoms satisfying cutoff
if (!mol2Prefix_.empty() && !CutMask.None()) {
if (WriteCutFrame(frameNum, *CurrentParm_, CutMask, CutCharges,
frame, mol2Prefix_ + CutName[ctype]))
return 1;
}
return 0;
}
示例2: Setup
Action::RetType Action_AtomicCorr::Setup(ActionSetup& setup) {
if (setup.Top().SetupIntegerMask( mask_ )) return Action::ERR;
mask_.MaskInfo();
if (mask_.None()) return Action::SKIP;
if (acorr_mode_ == ATOM) {
// Setup output array; labels and index
atom_vectors_.clear();
for (AtomMask::const_iterator atom = mask_.begin(); atom != mask_.end(); ++atom)
atom_vectors_.push_back( AtomVector(integerToString( *atom + 1 ), *atom) );
} else {
std::map<int,AtomMask> rmaskmap;
// Find which residues selected atoms belong to.
for (AtomMask::const_iterator atom = mask_.begin(); atom != mask_.end(); ++atom)
{
int current_res = setup.Top()[*atom].ResNum();
std::map<int,AtomMask>::iterator rmask = rmaskmap.find( current_res );
if ( rmask == rmaskmap.end() ) {
// Residue not yet in map.
AtomMask newmask;
newmask.AddAtom( *atom );
rmaskmap.insert( std::pair<int,AtomMask>( current_res, newmask ) );
} else {
// Residue is already in map. Add this atom.
rmask->second.AddAtom( *atom );
}
}
// Place selected residues in mask vector and setup output array; labels and index.
resmasks_.clear();
atom_vectors_.clear();
for (std::map<int,AtomMask>::const_iterator rmask = rmaskmap.begin();
rmask != rmaskmap.end(); ++rmask)
{
if (debug_ > 0)
mprintf("DBG:\tRes mask for %i has %i atoms\n", rmask->first, rmask->second.Nselected());
resmasks_.push_back( rmask->second );
atom_vectors_.push_back( AtomVector( setup.Top().TruncResNameNum( rmask->first ),
rmask->first ) );
}
mprintf("\tSelected %zu residues.\n", resmasks_.size());
}
return Action::OK;
}