本文整理汇总了C++中AtomMask::ConvertToCharMask方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomMask::ConvertToCharMask方法的具体用法?C++ AtomMask::ConvertToCharMask怎么用?C++ AtomMask::ConvertToCharMask使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AtomMask
的用法示例。
在下文中一共展示了AtomMask::ConvertToCharMask方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetupExcluded
/** Set up exclusion lists for selected atoms. */
void Ewald::SetupExcluded(Topology const& topIn, AtomMask const& maskIn)
{
Excluded_.clear();
Excluded_.resize( maskIn.Nselected() );
// Create a character mask so we can see if atoms in excluded lists are
// also selected.
CharMask Cmask(maskIn.ConvertToCharMask(), maskIn.Nselected());
// Create a map of atom number to maskIn index.
int selectedIdx = 0;
Iarray atToIdx( Cmask.Natom(), -1 );
for (int cidx = 0; cidx != Cmask.Natom(); cidx++)
if (Cmask.AtomInCharMask(cidx))
atToIdx[cidx] = selectedIdx++;
// Loop over selected atoms
for (int idx = 0; idx != maskIn.Nselected(); idx++)
{
// Always exclude self
Excluded_[idx].insert( idx );
int at = maskIn[idx];
for (Atom::excluded_iterator excluded_atom = topIn[at].excludedbegin();
excluded_atom != topIn[at].excludedend();
++excluded_atom)
{
if (Cmask.AtomInCharMask(*excluded_atom))
{
// Find excluded atoms index in maskIn
int excluded_idx = atToIdx[*excluded_atom];
Excluded_[idx ].insert( excluded_idx );
Excluded_[excluded_idx].insert( idx );
}
}
}
unsigned int ex_size = 0;
for (Iarray2D::const_iterator it = Excluded_.begin(); it != Excluded_.end(); ++it)
ex_size += it->size();
mprintf("\tMemory used by full exclusion list: %s\n",
ByteString(ex_size * sizeof(int), BYTE_DECIMAL).c_str());
}
示例2: SetupBondList
/** Set up bond parameters for bonds for which both atoms present in mask. */
void Action_CheckStructure::SetupBondList(AtomMask const& iMask, Topology const& top) {
CharMask cMask( iMask.ConvertToCharMask(), iMask.Nselected() );
ProcessBondArray(top.Bonds(), top.BondParm(), cMask);
ProcessBondArray(top.BondsH(), top.BondParm(), cMask);
}