本文整理汇总了C++中MolAtomPtr::getName方法的典型用法代码示例。如果您正苦于以下问题:C++ MolAtomPtr::getName方法的具体用法?C++ MolAtomPtr::getName怎么用?C++ MolAtomPtr::getName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MolAtomPtr
的用法示例。
在下文中一共展示了MolAtomPtr::getName方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: toStrAID
/// Convert aid to (persistent) string representation
LString MolCoord::toStrAID(int atomid) const
{
MolAtomPtr pAtom = getAtom(atomid);
if (pAtom.isnull()) return LString();
LString value = LString::format("%s.%s.%s",
pAtom->getChainName().c_str(),
pAtom->getResIndex().toString().c_str(),
pAtom->getName().c_str());
char conf_id = pAtom->getConfID();
if (conf_id)
value += ":" + LString(conf_id);
return value;
}
示例3: 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;
*/
}
示例4: 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;
}
示例5: setup
void MolArrayMap::setup(MolCoordPtr pRefMol)
{
m_data.erase(m_data.begin(), m_data.end());
int i = 0;
AtomIterator iter(pRefMol);
for (iter.first(); iter.hasMore(); iter.next(), ++i) {
MolAtomPtr pa = iter.get();
MolArrayMapElem a;
a.chain = pa->getChainName().c_str();
a.resid = pa->getResIndex().toInt();
a.atom = pa->getName().c_str();
a.pA = pa;
m_data.insert(data_t::value_type(a, -1));
//MB_DPRINTLN("fitref %s %d %s", a.chain.c_str(), a.resid, a.atom.c_str());
}
setupIndex();
}
示例6: formatAtomName
LString PDBFileWriter::formatAtomName(MolAtomPtr pAtom)
{
LString atomnam = pAtom->getName();
char cConfID = pAtom->getConfID();
int elem = pAtom->getElement();
if (cConfID=='\0')
cConfID = ' ';
// invalid name case
if (atomnam.length()>=4||
elem==ElemSym::XX) {
return LString::format("%4s%c", atomnam.c_str(), cConfID);
}
LString elenam = ElemSym::symID2Str(elem);
elenam = elenam.toUpperCase();
int elepos = atomnam.indexOf(elenam);
if (elepos<0) {
return LString::format("%4s%c", atomnam.c_str(), cConfID);
}
LString atommod;
// if (atomnam.equals(elenam)) {
// // atom name==elem name
// shead += LString::format(" %2s ", elenam.c_str());
// break;
// }
elepos += elenam.length();
atommod = atomnam.substr(elepos);
elenam = atomnam.substr(0, elepos);
if (atommod.length()<=2) {
return LString::format("%2s%-2s%c",
elenam.c_str(), atommod.c_str(), cConfID);
}
return LString::format("%4s%c", atomnam.c_str(), cConfID);
}
示例7: drawRingImpl
void BallStickRenderer::drawRingImpl(const std::list<int> atoms, DisplayContext *pdl)
{
MolCoordPtr pMol = getClientMol();
double len;
int i, nsize = atoms.size();
Vector4D *pvecs = MB_NEW Vector4D[nsize];
Vector4D cen;
std::list<int>::const_iterator iter = atoms.begin();
std::list<int>::const_iterator eiter = atoms.end();
MolAtomPtr pPivAtom, pAtom;
for (i=0; iter!=eiter; ++iter, i++) {
MolAtomPtr pAtom = pMol->getAtom(*iter);
if (pAtom.isnull()) return;
MolResiduePtr pres = pAtom->getParentResidue();
MolChainPtr pch = pAtom->getParentChain();
MB_DPRINTLN("RING %s %s", pres->toString().c_str(), pAtom->getName().c_str());
pvecs[i] = pAtom->getPos();
cen += pvecs[i];
if (pPivAtom.isnull() && pAtom->getElement()==ElemSym::C)
pPivAtom = pAtom;
}
if (pPivAtom.isnull())
pPivAtom = pAtom; // no carbon atom --> last atom becomes pivot
cen = cen.divide(nsize);
// calculate the normal vector
Vector4D norm;
for (i=0; i<nsize; i++) {
int ni = (i+1)%nsize;
Vector4D v1 = pvecs[ni] - pvecs[i];
Vector4D v2 = cen - pvecs[i];
Vector4D ntmp;
ntmp = v1.cross(v2);
len = ntmp.length();
if (len<=F_EPS8) {
LOG_DPRINTLN("BallStick> *****");
return;
}
//ntmp.scale(1.0/len);
ntmp = ntmp.divide(len);
norm += ntmp;
}
len = norm.length();
norm = norm.divide(len);
Vector4D dv = norm.scale(m_tickness);
ColorPtr col = evalMolColor(m_ringcol, ColSchmHolder::getColor(pPivAtom));
/*
ColorPtr col = m_ringcol;
// check molcol reference
gfx::MolColorRef *pMolCol = dynamic_cast<gfx::MolColorRef *>(col.get());
if (pMolCol!=NULL) {
// molcol ref case --> resolve the pivot's color
col = ColSchmHolder::getColor(pPivAtom);
}
*/
pdl->setPolygonMode(gfx::DisplayContext::POLY_FILL_NOEGLN);
pdl->startTriangleFan();
pdl->normal(norm);
pdl->color(col);
pdl->vertex(cen+dv);
for (i=0; i<=nsize; i++) {
pdl->vertex(pvecs[i%nsize]+dv);
}
pdl->end();
pdl->startTriangleFan();
pdl->normal(-norm);
pdl->color(col);
pdl->vertex(cen-dv);
for (i=nsize; i>=0; i--) {
pdl->vertex(pvecs[i%nsize]-dv);
}
pdl->end();
pdl->setPolygonMode(gfx::DisplayContext::POLY_FILL);
delete [] pvecs;
}
示例8: writeAtomLine
bool PDBFileWriter::writeAtomLine(int nserial, const ResidIndex &rindex,
const char *resnam, char chainch,
MolAtomPtr pa, qlib::PrintStream &prs)
{
int resind = rindex.first;
char inscode = rindex.second;
LString atomnam = pa->getName().c_str();
// atomnam = atomnam.toUpperCase();
// conv ILE's CD name
// (CD is converted to CD1 in PDBFileReader, so this should not occur)
if (LChar::equals(resnam, "ILE") && atomnam.equals("CD"))
atomnam = "CD1";
#ifdef QTL_CONV
// conv nucl's prime to aster
atomnam.replace('\'', '*');
// convert THY's C5A to C5M
if (LChar::equals(resnam, "THY") &&
atomnam.equals("C5A")) {
atomnam = "C5M";
}
// conv nucl name
if (LChar::equals(resnam, "ADE")) {
resnam = " A";
}
else if (LChar::equals(resnam, "THY")) {
resnam = " T";
}
else if (LChar::equals(resnam, "GUA")) {
resnam = " G";
}
else if (LChar::equals(resnam, "CYT")) {
resnam = " C";
}
else if (LChar::equals(resnam, "URI")) {
resnam = " U";
}
#endif
LString shead;
shead = LString::format("%5d ", nserial);
// format atom name
shead += formatAtomName(pa);
shead += LString::format("%3s "
"%c"
"%4d"
"%c",
resnam,
chainch,
resind,
(inscode=='\0') ? ' ' : inscode);
//////////
// output to the stream
prs.print("ATOM ");
prs.print(shead);
// Get atom position before applying xformMat, if xformMat is set
Vector4D pos = pa->getRawPos();
prs.formatln(" "
"%8.3f"
"%8.3f"
"%8.3f"
"%6.2f"
"%6.2f"
" "
" ",
pos.x(),
pos.y(),
pos.z(),
pa->getOcc(),
pa->getBfac());
if (pa->hasAnIsoU()) {
prs.print("ANISOU");
prs.print(shead);
int u11 = int(pa->getU(0,0) * 1.0e4);
int u22 = int(pa->getU(1,1) * 1.0e4);
int u33 = int(pa->getU(2,2) * 1.0e4);
int u12 = int(pa->getU(0,1) * 1.0e4);
int u13 = int(pa->getU(0,2) * 1.0e4);
int u23 = int(pa->getU(1,2) * 1.0e4);
prs.formatln(" "
" %6d"
" %6d"
" %6d"
" %6d"
" %6d"
" %6d"
" ",
//.........这里部分代码省略.........
示例9: 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;
}