本文整理汇总了C++中MolAtomPtr::getParentUID方法的典型用法代码示例。如果您正苦于以下问题:C++ MolAtomPtr::getParentUID方法的具体用法?C++ MolAtomPtr::getParentUID怎么用?C++ MolAtomPtr::getParentUID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MolAtomPtr
的用法示例。
在下文中一共展示了MolAtomPtr::getParentUID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: appendAtomScrHelper
int MolCoord::appendAtomScrHelper(MolAtomPtr pAtom, const LString &ch,
ResidIndex resid, const LString &resn)
{
qlib::uid_t nuid = pAtom->getParentUID();
if (nuid!=qlib::invalid_uid) {
// pAtom has been already belonged to other mol
// --> ERROR!!
MB_DPRINTLN("MolCoord.appendAtom> ERROR, pAtom already belongs to mol %d ().", nuid);
return -1;
}
pAtom->setParentUID(getUID());
pAtom->setChainName(ch);
pAtom->setResIndex(resid);
if (resn.isEmpty()) {
// res name is determined by chain name and resindex
MolResiduePtr pRes = getResidue(ch, resid);
if (pRes.isnull()) {
// ERROR!! cannot determine the residue to append to
return -1;
}
pAtom->setResName(pRes->getName());
}
else {
pAtom->setResName(resn);
}
return appendAtom(pAtom);
}
示例2: removeAtom
bool MolCoord::removeAtom(int atomid)
{
MolAtomPtr pAtom = getAtom(atomid);
if (pAtom.isnull() || pAtom->getParentUID()!=getUID())
return false;
m_atomPool.remove(atomid);
// invalidate ID
pAtom->setID(-1);
const LString &aname = pAtom->getName();
char cConfID = pAtom->getConfID();
ResidIndex nresid = pAtom->getResIndex();
const LString &cname = pAtom->getChainName();
MolChainPtr pCh = getChain(cname);
if (pCh.isnull())
return false;
MolResiduePtr pRes = getResidue(cname, nresid);
if (pRes.isnull())
return false;
// remove atom
if (!pRes->removeAtom(aname, cConfID))
return false;
if (pRes->getAtomSize()>0)
return true;
// purge the empty residue
if (!pCh->removeResidue(nresid))
return false;
// delete pRes;
if (pCh->getSize()>0)
return true;
// purge the empty chain
if (!removeChain(cname))
return false;
// delete pCh;
return true;
}