本文整理汇总了C++中MolAtomPtr::getResName方法的典型用法代码示例。如果您正苦于以下问题:C++ MolAtomPtr::getResName方法的具体用法?C++ MolAtomPtr::getResName怎么用?C++ MolAtomPtr::getResName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MolAtomPtr
的用法示例。
在下文中一共展示了MolAtomPtr::getResName方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: getVdwRadius
double TopparManager::getVdwRadius(MolAtomPtr pAtom, bool bExplH)
{
LString resn = pAtom->getResName();
TopoDB *pDB = getTopoDB();
// Resolve alias name
ResiToppar *pTop = pDB->get(resn);
if (pTop==NULL)
return elemBasedVdw(pAtom->getElement());
LString aname = pAtom->getName();
TopAtom *pTA = pTop->getAtom(aname);
if (pTA==NULL)
return elemBasedVdw(pAtom->getElement());
LString atype = pTA->type;
ParamDB *pPDB = getParamDB();
param::AtomVal *pPA = pPDB->getAtom(atype);
if (pPA==NULL)
return elemBasedVdw(pAtom->getElement());
if (bExplH)
return pPA->vdwr;
if (pPA->vdwhr > 0.0)
return pPA->vdwhr;
return pPA->vdwr;
}
示例2: getCharge
bool TopparManager::getCharge(MolAtomPtr pAtom, bool bExplH,
const LString &ns, double &rval)
{
LString resn = pAtom->getResName();
TopoDB *pDB = getTopoDB();
// Resolve alias name
ResiToppar *pTop = pDB->get(resn);
if (pTop==NULL)
return false;
LString aname = pAtom->getName();
return getChargeImpl(pTop, aname, ns, bExplH, rval);
/*
LString ns_aname = aname;
if (!ns.isEmpty())
ns_aname = ns + ":" + aname;
TopAtom *pTA = pTop->getAtom(ns_aname);
if (pTA==NULL)
return false;
if (bExplH) {
rval = pTA->charge;
return true;
}
double prot_chg = 0.0;
ResiToppar::BondList *pBL= pTop->getBondList();
BOOST_FOREACH (const TopBond *pBond,
*pBL) {
if (pBond->a1==pTA) {
if (pBond->a2->elem.equals("H"))
prot_chg += pBond->a2->charge;
}
else if (pBond->a2==pTA) {
if (pBond->a1->elem.equals("H"))
prot_chg += pBond->a1->charge;
}
}
rval = pTA->charge + prot_chg;
return true;
*/
}
示例3: appendAtom
int MolCoord::appendAtom(MolAtomPtr pAtom)
{
pAtom->setParentUID(getUID());
const LString &cname = pAtom->getChainName();
const LString &rname = pAtom->getResName();
const LString &aname = pAtom->getName();
ResidIndex nresid = pAtom->getResIndex();
if (cname.length()<=0 ||
aname.length()<=0) {
LString msg =
LString::format("MolCoord> ERROR: appending atom with invalid properties"
" (c:'%s' rn:'%s' ri:'%s' an:'%s')",
cname.c_str(), rname.c_str(), nresid.toString().c_str(),
aname.c_str());
MB_DPRINTLN(msg);
MB_THROW(qlib::IllegalArgumentException, msg);
return -1;
}
MolChainPtr pCh = getChain(cname);
if (pCh.isnull()) {
pCh = MolChainPtr(MB_NEW MolChain());
pCh->setParentUID(getUID());
pCh->setName(cname);
appendChain(pCh);
}
MolResiduePtr pRes = pCh->getResidue(nresid);
if (pRes.isnull()) {
pRes = MolResiduePtr(MB_NEW MolResidue());
pRes->setParentUID(getUID());
pRes->setIndex(nresid);
pRes->setName(rname);
// pRes->setChainName(cname);
pCh->appendResidue(pRes);
}
else {
const LString &pre_rname = pRes->getName();
if (!pre_rname.equals(rname)) {
MB_DPRINTLN("MolCoord> ERROR: appending an atom (%s %s%s %s) with inconsistent residue (%s)",
cname.c_str(), rname.c_str(),
nresid.toString().c_str(), aname.c_str(),
pre_rname.c_str());
// TO DO: throw exception (???)
// This is often the case, so is not an exception.
// return -1;
}
}
//
// Append to the atompool --> assign the atom ID
//
int atomid = m_atomPool.put(pAtom);
if (atomid<0) {
// This isn't fail in normal situation.
MB_THROW(qlib::RuntimeException, "append to the atompool failed");
return -1;
}
pAtom->setID(atomid);
// MolResidue::appendAtom() must be called after setID(),
// because MolResidue makes map from name to AID, which requires "AID".
if (!pRes->appendAtom(pAtom)) {
// This is often the case with malformed PDB files, so is not an exception.
MB_DPRINTLN("MolCoord> ERROR: appending duplicated atom (%s %s%s %s)",
cname.c_str(), rname.c_str(), nresid.toString().c_str(),
aname.c_str());
// Remove the mis-appended atom from the pool.
m_atomPool.remove(atomid);
return -1;
}
// Update the cached xform matrix if required
pAtom->resetXformMatrix();
if (!getXformMatrix().isIdent())
pAtom->setXformMatrix(getXformMatrix());
return atomid;
}