本文整理汇总了C++中MolAtomPtr::setName方法的典型用法代码示例。如果您正苦于以下问题:C++ MolAtomPtr::setName方法的具体用法?C++ MolAtomPtr::setName怎么用?C++ MolAtomPtr::setName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MolAtomPtr
的用法示例。
在下文中一共展示了MolAtomPtr::setName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: if
//.........这里部分代码省略.........
MB_THROW(MOL2FormatException, "Invalid SYBYL atom type");
}
iresid = 0;
if (!slist[6].toInt(&iresid)) {
MB_THROW(MOL2FormatException, "Invalid atom resid record");
}
res_name = slist[7];
if (res_name.equals("<0>"))
res_name = cmpd_name;
if (bApplyTopo) {
// protein or nucleic acid
// strip residue number from res_name
int ntmp;
if (res_name.substr(3).toInt(&ntmp)) {
res_name = res_name.substr(0, 3);
iresid = ntmp;
}
if (iresid!=prev_resid)
// residue is changed --> clear atom name count
aname_counts.clear();
}
eleid = ElemSym::str2SymID(satom);
// LOG_DPRINTLN("Atom: %f, %f, %f, <%s> %d", xx, yy, zz, aname.c_str(), eleid);
if (!bskip) {
MolAtomPtr pAtom = MolAtomPtr(MB_NEW MolAtom());
pAtom->setParentUID(m_pMol->getUID());
pAtom->setName(aname);
pAtom->setElement(eleid);
pAtom->setChainName(m_sCurrChName);
pAtom->setResIndex(iresid);
pAtom->setResName(res_name);
pAtom->setPos(Vector4D(xx,yy,zz));
pAtom->setBfac(0.0);
pAtom->setOcc(1.0);
naid = m_pMol->appendAtom(pAtom);
if (naid<0)
MB_THROW(MOL2FormatException, "appendAtom() failed");
atommap.insert(std::pair<int,int>(ind, naid));
m_nReadAtoms++;
}
prev_resid = iresid;
}
// Search BOND record
for (;;) {
sline = lin.readLine().chomp();
if (sline.isEmpty() && !lin.ready())
return false; // EOF
if (sline.equals("@<TRIPOS>BOND")) {
break;
}
}
示例2: read
//.........这里部分代码省略.........
for (i=0; i<ncomment; ++i) {
readLine();
m_line = m_line.trim("\r\n ");
LOG_DPRINTLN("%s", m_line.c_str());
}
readLine();
///////////////////
// read atoms
readLine();
removeComment();
if (!m_line.toInt(&m_natom)) {
MB_THROW(qlib::FileFormatException, "Cannot read natom line");
return;
}
MB_DPRINTLN("natoms=%d", m_natom);
LString stmp;
for (i=0; i<m_natom; ++i) {
readLine();
// LOG_DPRINTLN("%s", m_line.c_str());
// chain name
stmp = m_line.substr(9, 3);
stmp = stmp.trim(" ");
// stmp = stmp.toLowerCase();
LString chain(stmp.c_str());
// residue number
stmp = m_line.substr(14, 4);
int nresi;
if (!stmp.toInt(&nresi)) {
LString msg = LString::format("cannot convert resid number: %s", stmp.c_str());
MB_THROW(qlib::FileFormatException, msg);
return;
}
ResidIndex residx(nresi);
// residue name
stmp = m_line.substr(19, 4);
stmp = stmp.trim(" ");
// stmp = stmp.toLowerCase();
LString resn(stmp.c_str());
// atom name
stmp = m_line.substr(24, 4);
stmp = stmp.trim(" ");
// stmp = stmp.toLowerCase();
LString name(stmp.c_str());
// charge
stmp = m_line.substr(34, 10);
double charge;
if (!stmp.toDouble(&charge)) {
LString msg = LString::format("cannot convert charge %s", stmp.c_str());
MB_THROW(qlib::FileFormatException, msg);
return;
}
// mass
stmp = m_line.substr(50, 8);
double mass;
if (!stmp.toDouble(&mass)) {
LString msg = LString::format("cannot convert mass <%s>", stmp.c_str());
MB_THROW(qlib::FileFormatException, msg);
return;
}
ElemID eleid = convMassElem(mass);
//LOG_DPRINTLN("ATOM %s %s %d %s",
//(*pAtoms)[i].name.c_str(),
//(*pAtoms)[i].resn.c_str(),
//(*pAtoms)[i].resid,
//(*pAtoms)[i].chain.c_str());
MolAtomPtr pAtom = MolAtomPtr(MB_NEW MolAtom());
pAtom->setParentUID(m_pMol->getUID());
pAtom->setName(name);
pAtom->setElement(eleid);
pAtom->setChainName(chain);
pAtom->setResIndex(residx);
pAtom->setResName(resn);
if (m_pMol->appendAtom(pAtom)<0) {
LString stmp = m_line;
stmp = stmp.chomp();
// stmp = stmp.toUpperCase();
// m_nErrCount ++;
// if (m_nErrCount<m_nErrMax)
LOG_DPRINTLN("PsfReader> read ATOM line failed: %s", stmp.c_str());
}
}
readLine();
}