本文整理汇总了C++中AtomMask::back方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomMask::back方法的具体用法?C++ AtomMask::back怎么用?C++ AtomMask::back使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomMask
的用法示例。
在下文中一共展示了AtomMask::back方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupSymmRMSD
/** Find potential symmetric atoms. All residues up to the last selected
* residue are considered.
*/
int SymmetricRmsdCalc::SetupSymmRMSD(Topology const& topIn, AtomMask const& tgtMask, bool remapIn)
{
// Allocate space for remapping selected atoms in target frame. This will
// also put the correct masses in based on the mask.
tgtRemap_.SetupFrameFromMask(tgtMask, topIn.Atoms());
// Create map of original atom numbers to selected indices
Iarray SelectedIdx( topIn.Natom(), -1 );
int tgtIdx = 0;
for (int originalAtom = 0; originalAtom != topIn.Natom(); ++originalAtom)
if ( originalAtom == tgtMask[tgtIdx] )
SelectedIdx[originalAtom] = tgtIdx++;
if (debug_ > 0) {
mprintf("DEBUG: Original atom -> Selected Index mapping:\n");
for (int originalAtom = 0; originalAtom != topIn.Natom(); ++originalAtom)
mprintf("\t%8i -> %8i\n", originalAtom + 1, SelectedIdx[originalAtom] + 1);
}
// Create initial 1 to 1 atom map for all selected atoms; indices in
// SymmetricAtomIndices will correspond to positions in AMap.
AMap_.resize( tgtRemap_.Natom() );
// Determine last selected residue.
int last_res = topIn[tgtMask.back()].ResNum() + 1;
mprintf("\tResidues up to %s will be considered for symmetry correction.\n",
topIn.TruncResNameNum(last_res-1).c_str());
// In each residue, determine which selected atoms are symmetric.
SymmetricAtomIndices_.clear();
AtomMap resmap;
if (debug_ > 1) resmap.SetDebug(1);
for (int res = 0; res < last_res; ++res) {
AtomMap::AtomIndexArray residue_SymmetricGroups;
if (resmap.SymmetricAtoms(topIn, residue_SymmetricGroups, res)) {
mprinterr("Error: Finding symmetric atoms in residue '%s'\n",
topIn.TruncResNameNum(res).c_str());
return 1;
}
if (!residue_SymmetricGroups.empty()) {
// Which atoms in symmetric groups are selected?
bool resHasSelectedSymmAtoms = false;
for (AtomMap::AtomIndexArray::const_iterator symmGroup = residue_SymmetricGroups.begin();
symmGroup != residue_SymmetricGroups.end();
++symmGroup)
{
Iarray selectedAtomIndices;
for (Iarray::const_iterator atnum = symmGroup->begin();
atnum != symmGroup->end(); ++atnum)
{
if ( SelectedIdx[*atnum] != -1 )
selectedAtomIndices.push_back( SelectedIdx[*atnum] ); // Store tgtMask indices
}
if (!selectedAtomIndices.empty()) {
SymmetricAtomIndices_.push_back( selectedAtomIndices );
resHasSelectedSymmAtoms = true;
}
}
// If remapping and not all atoms in a residue are selected, warn user.
// TODO: Should they just be considered even if not selected?
if (remapIn && resHasSelectedSymmAtoms) {
for (int atom = topIn.Res(res).FirstAtom(); atom != topIn.Res(res).LastAtom(); ++atom)
if (SelectedIdx[atom] == -1) {
mprintf("Warning: Not all atoms selected in residue '%s'. Re-mapped\n"
"Warning: structures may appear distorted.\n",
topIn.TruncResNameNum(res).c_str());
break;
}
}
}
}
if (debug_ > 0) {
mprintf("DEBUG: Potential Symmetric Atom Groups:\n");
for (AtomIndexArray::const_iterator symmatoms = SymmetricAtomIndices_.begin();
symmatoms != SymmetricAtomIndices_.end();
++symmatoms)
{
mprintf("\t%8u) ", symmatoms - SymmetricAtomIndices_.begin());
for (Iarray::const_iterator atom = symmatoms->begin();
atom != symmatoms->end(); ++atom)
mprintf(" %s(%i)", topIn.AtomMaskName(tgtMask[*atom]).c_str(), tgtMask[*atom] + 1);
mprintf("\n");
}
}
return 0;
}