本文整理汇总了C++中AtomMask::None方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomMask::None方法的具体用法?C++ AtomMask::None怎么用?C++ AtomMask::None使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomMask
的用法示例。
在下文中一共展示了AtomMask::None方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: CheckSameResidue
/** Check that all atoms in mask belong to same residue. */
int Action_NMRrst::CheckSameResidue(Topology const& top, AtomMask const& mask) const {
if (mask.None()) return -1;
int resnum = top[mask[0]].ResNum();
for (AtomMask::const_iterator at = mask.begin(); at != mask.end(); ++at) {
int r = top[*at].ResNum();
if (r != resnum) {
mprintf("Warning: Mask atom %i %s not in same residue as %i %s\n",
*at + 1, top.AtomMaskName(*at).c_str(),
mask[0] + 1, top.AtomMaskName(mask[0]).c_str());
}
}
return resnum;
}
示例3: mprintf
/** Set up masks. */
int Cpptraj::MaskArray::SetupMasks(AtomMask const& maskIn, Topology const& topIn)
{
if (type_ == BY_MOLECULE && topIn.Nmol() < 1) {
mprintf("Warning: '%s' has no molecule information, cannot setup by molecule.\n",
topIn.c_str());
return 1;
}
masks_.clear();
if ( maskIn.None() ) {
mprintf("Warning: Nothing selected by mask '%s'\n", maskIn.MaskString());
return 0;
}
int last = -1;
int current = 0;
maxAtomsPerMask_ = 0;
sameNumAtomsPerMask_ = true;
for (AtomMask::const_iterator atm = maskIn.begin(); atm != maskIn.end(); ++atm)
{
switch (type_) {
case BY_ATOM : current = *atm; break;
case BY_RESIDUE : current = topIn[*atm].ResNum(); break;
case BY_MOLECULE : current = topIn[*atm].MolNum(); break;
}
if (current != last) {
if (!masks_.empty())
checkAtomsPerMask( masks_.back().Nselected() );
masks_.push_back( AtomMask() );
masks_.back().SetNatoms( topIn.Natom() );
}
masks_.back().AddSelectedAtom( *atm );
last = current;
}
if (!masks_.empty())
checkAtomsPerMask( masks_.back().Nselected() );
return 0;
}
示例4: SetupBlock
/** Set up each mask/integer loop. */
int ControlBlock_For::SetupBlock(CpptrajState& State, ArgList& argIn) {
mprintf(" Setting up 'for' loop.\n");
Vars_.clear();
Topology* currentTop = 0;
static const char* TypeStr[] = { "ATOMS ", "RESIDUES ", "MOLECULES ",
"MOL_FIRST_RES ", "MOL_LAST_RES " };
static const char* OpStr[] = {"+=", "-=", "<", ">"};
description_.assign("for (");
int MaxIterations = -1;
int iarg = 0;
while (iarg < argIn.Nargs())
{
// Advance to next unmarked argument.
while (iarg < argIn.Nargs() && argIn.Marked(iarg)) iarg++;
if (iarg == argIn.Nargs()) break;
// Determine 'for' type
ForType ftype = UNKNOWN;
bool isMaskFor = true;
int argToMark = iarg;
if ( argIn[iarg] == "atoms" ) ftype = ATOMS;
else if ( argIn[iarg] == "residues" ) ftype = RESIDUES;
else if ( argIn[iarg] == "molecules" ) ftype = MOLECULES;
else if ( argIn[iarg] == "molfirstres" ) ftype = MOLFIRSTRES;
else if ( argIn[iarg] == "mollastres" ) ftype = MOLLASTRES;
else if ( argIn[iarg].find(";") != std::string::npos ) {
isMaskFor = false;
ftype = INTEGER;
}
// If type is still unknown, check for list.
if (ftype == UNKNOWN) {
if (iarg+1 < argIn.Nargs() && argIn[iarg+1] == "in") {
ftype = LIST;
isMaskFor = false;
argToMark = iarg+1;
}
}
// Exit if type could not be determined.
if (ftype == UNKNOWN) {
mprinterr("Error: for loop type not specfied.\n");
return 1;
}
argIn.MarkArg(argToMark);
Vars_.push_back( LoopVar() );
LoopVar& MH = Vars_.back();
int Niterations = -1;
// Set up for specific type
if (description_ != "for (") description_.append(", ");
// -------------------------------------------
if (isMaskFor)
{
// {atoms|residues|molecules} <var> inmask <mask> [TOP KEYWORDS]
if (argIn[iarg+2] != "inmask") {
mprinterr("Error: Expected 'inmask', got %s\n", argIn[iarg+2].c_str());
return 1;
}
AtomMask currentMask;
if (currentMask.SetMaskString( argIn.GetStringKey("inmask") )) return 1;
MH.varType_ = ftype;
Topology* top = State.DSL().GetTopByIndex( argIn );
if (top != 0) currentTop = top;
if (currentTop == 0) return 1;
MH.varname_ = argIn.GetStringNext();
if (MH.varname_.empty()) {
mprinterr("Error: 'for inmask': missing variable name.\n");
return 1;
}
MH.varname_ = "$" + MH.varname_;
// Set up mask
if (currentTop->SetupIntegerMask( currentMask )) return 1;
currentMask.MaskInfo();
if (currentMask.None()) return 1;
// Set up indices
if (MH.varType_ == ATOMS)
MH.Idxs_ = currentMask.Selected();
else if (MH.varType_ == RESIDUES) {
int curRes = -1;
for (AtomMask::const_iterator at = currentMask.begin(); at != currentMask.end(); ++at) {
int res = (*currentTop)[*at].ResNum();
if (res != curRes) {
MH.Idxs_.push_back( res );
curRes = res;
}
}
} else if (MH.varType_ == MOLECULES ||
MH.varType_ == MOLFIRSTRES ||
MH.varType_ == MOLLASTRES)
{
int curMol = -1;
for (AtomMask::const_iterator at = currentMask.begin(); at != currentMask.end(); ++at) {
int mol = (*currentTop)[*at].MolNum();
if (mol != curMol) {
if (MH.varType_ == MOLECULES)
MH.Idxs_.push_back( mol );
else {
int res;
if (MH.varType_ == MOLFIRSTRES)
res = (*currentTop)[ currentTop->Mol( mol ).BeginAtom() ].ResNum();
else // MOLLASTRES
res = (*currentTop)[ currentTop->Mol( mol ).EndAtom()-1 ].ResNum();
//.........这里部分代码省略.........