本文整理汇总了C++中MolAtomPtr类的典型用法代码示例。如果您正苦于以下问题:C++ MolAtomPtr类的具体用法?C++ MolAtomPtr怎么用?C++ MolAtomPtr使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了MolAtomPtr类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aiter
bool MolSurfBuilder::init(MolCoordPtr pmol)
{
AtomIterator aiter(pmol);
int i, natoms=0;
// count atom number
for (aiter.first(); aiter.hasMore(); aiter.next()) {
MolAtomPtr pAtom = aiter.get();
MB_ASSERT(!pAtom.isnull());
++natoms;
}
// copy to the m_data
m_data.resize(natoms);
m_tree.alloc(natoms);
for (i=0,aiter.first(); aiter.hasMore()&&i<natoms; aiter.next(),++i) {
MolAtomPtr pAtom = aiter.get();
m_data[i].pos = pAtom->getPos();
m_data[i].rad = 1.5;
m_data[i].aid = pAtom->getID();
m_tree.setAt(i, m_data[i].pos, i);
}
// build BSP tree
m_tree.build();
m_rmax = 1.5;
m_rprobe = 1.2;
return true;
}
示例2: 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;
}
示例3: drawSelInterAtomLine
static void drawSelInterAtomLine(MolAtomPtr pAtom1, MolAtomPtr pAtom2,
DisplayContext *pdl)
{
if (pAtom1.isnull() || pAtom2.isnull()) return;
pdl->vertex(pAtom1->getPos());
pdl->vertex(pAtom2->getPos());
}
示例4: rendAtom
void BallStickRenderer::rendAtom(DisplayContext *pdl, MolAtomPtr pAtom, bool)
{
if (m_sphr>0.0) {
pdl->color(ColSchmHolder::getColor(pAtom));
pdl->sphere(m_sphr, pAtom->getPos());
}
checkRing(pAtom->getID());
}
示例5: 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;
*/
}
示例6: drawAtom
void SimpleRenderer::drawAtom(MolAtomPtr pAtom, DisplayContext *pdl)
{
pdl->color(ColSchmHolder::getColor(pAtom));
const Vector4D pos = pAtom->getPos();
const double rad = 0.25;
pdl->drawAster(pos, rad);
++m_nAtomDrawn;
}
示例7: LOG_DPRINTLN
/// Convert from (persistent) string representation to aid
int MolCoord::fromStrAID(const LString &strid) const
{
if (!m_reAid.match(strid)) {
LOG_DPRINTLN("MolCoord> Invalid aid strid=%s (re match failed)", strid.c_str());
return -1;
}
// text type aid
int nsc = m_reAid.getSubstrCount();
if (nsc<4) {
LOG_DPRINTLN("MolCoord> Invalid aid strid=%s", strid.c_str());
return -1;
}
//elem.setAtomID(-1);
LString sChainName = m_reAid.getSubstr(1);
LString sResInd = m_reAid.getSubstr(2);
ResidIndex nResInd;
if (!sResInd.toInt(&nResInd.first)) {
LOG_DPRINTLN("MolCoord> Invalid aid resid value=%s", sResInd.c_str());
return -1;
}
LString sInsCode = m_reAid.getSubstr(3);
if (sInsCode.isEmpty())
nResInd.second = '\0';
else
nResInd.second = sInsCode.getAt(0);
LString sAtomName = m_reAid.getSubstr(4);
char cAltLoc = '\0';
if (nsc>6) {
LString sAltLoc = m_reAid.getSubstr(6);
if (!sAltLoc.isEmpty())
cAltLoc = sAltLoc.getAt(0);
}
MolAtomPtr pAtom = getAtom(sChainName, nResInd, sAtomName, cAltLoc);
if (pAtom.isnull()) {
LOG_DPRINTLN("MolCoord> fromStrAID/ atom <%s %s %s %c> not found in %s",
sChainName.c_str(), nResInd.toString().c_str(), sAtomName.c_str(),
cAltLoc=='\0'?' ':cAltLoc,
getName().c_str());
return -1;
}
return pAtom->getID();
}
示例8: getClientMol
void TubeRenderer::beginRend(DisplayContext *pdl)
{
if (!m_pts->isValid())
m_pts->setupSectionTable();
super_t::beginRend(pdl);
if (m_nPuttyMode==TBR_PUTTY_OFF) {
return;
}
// calc max bfac/occ in the putty mode
SelectionPtr pSel;
MolCoordPtr pMol = getClientMol();
//MolRenderer *pMolRend = dynamic_cast<MolRenderer *>(pRend);
//if (pMolRend!=NULL && m_nAuto==BFA_REND)
pSel = getSelection();
double dmin = 1.0e100, dmax = -1.0e100, val, dsum = 0.0;
int nadd=0;
ResidIterator iter(pMol, pSel);
for (iter.first(); iter.hasMore(); iter.next()) {
MolResiduePtr pRes = iter.get();
MolAtomPtr pAtom = getPivotAtom(pRes);
if (pAtom.isnull()) continue;
if (m_nPuttyMode==TBR_PUTTY_OCC)
val = pAtom->getOcc();
else
val = pAtom->getBfac();
dsum += val;
dmin = qlib::min(dmin, val);
dmax = qlib::max(dmax, val);
++nadd;
}
m_dParHi = dmax;
m_dParLo = dmin;
m_dParAver = dsum/double(nadd);
MB_DPRINTLN("Tube> init high=%f, low=%f, aver=%f OK.", dmax, dmin, m_dParAver);
}
示例9: iter
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();
}
示例10: iter
bool BfacColoring::init(MolCoordPtr pMol, Renderer *pRend)
{
if (m_nMode!=BFC_CENTER && !isAutoMode()) return true;
m_parAutoLo = m_parAutoHi = 0.0;
// MolCoordPtr pMol(pRend->getClientObj(), qlib::no_throw_tag());
if (pMol.isnull()) {
return false;
}
if (m_nMode==BFC_CENTER) {
m_vCenter = pMol->getCenterPos(false);
if (!isAutoMode())
return true;
}
SelectionPtr pSel;
MolRenderer *pMolRend = dynamic_cast<MolRenderer *>(pRend);
if (pMolRend!=NULL && m_nAuto==BFA_REND)
pSel = pMolRend->getSelection();
{
double dmin = 1.0e100, dmax = -1.0e100, val;
AtomIterator iter(pMol, pSel);
for (iter.first(); iter.hasMore(); iter.next()) {
MolAtomPtr pAtom = iter.get();
if (m_nMode==BFC_OCC)
val = pAtom->getOcc();
else if (m_nMode==BFC_CENTER)
val = (pAtom->getPos()-m_vCenter).length();
else
val = pAtom->getBfac();
dmin = qlib::min(dmin, val);
dmax = qlib::max(dmax, val);
}
MB_DPRINTLN("BfaxColoring> init high=%f, low=%f, OK.", dmax, dmin);
m_parAutoHi = dmax;
m_parAutoLo = dmin;
}
return true;
}
示例11: rendAtom
void SelectionRenderer::rendAtom(DisplayContext *pdl, MolAtomPtr pAtom, bool fbonded)
{
if (m_nMode==0) {
if (!fbonded)
drawSelAtom(pAtom, pdl);
}
else {
pdl->vertex(pAtom->getPos());
//Vector4D pos = pAtom->getPos();
//pdl->drawPixels(pos, m_boximg, *(m_color.get()));
}
}
示例12: 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);
}
示例13: 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);
}
示例14: getAtomColor
bool AtomPropColoring::getAtomColor(MolAtomPtr pAtom, gfx::ColorPtr &col)
{
MB_DPRINTLN("***** AtomPropCol getAtomColor called");
try {
int ccode = pAtom->getAtomPropInt(m_propname);
col = gfx::SolidColorPtr(new gfx::SolidColor(ccode));
}
catch (...) {
col = SolidColor::createRGB(0.5,0.5,0.5);
//return false;
}
return true;
}
示例15: drawInterAtomLine
void BallStickRenderer::drawInterAtomLine(MolAtomPtr pAtom1, MolAtomPtr pAtom2,
DisplayContext *pdl)
{
if (pAtom1.isnull() || pAtom2.isnull()) return;
const Vector4D pos1 = pAtom1->getPos();
const Vector4D pos2 = pAtom2->getPos();
ColorPtr pcol1 = ColSchmHolder::getColor(pAtom1);
ColorPtr pcol2 = ColSchmHolder::getColor(pAtom2);
if ( pcol1->equals(*pcol2.get()) ) {
pdl->color(pcol1);
pdl->cylinder(m_bondw, pos1, pos2);
}
else {
const Vector4D mpos = (pos1 + pos2).divide(2.0);
pdl->color(pcol1);
pdl->cylinder(m_bondw, pos1, mpos);
pdl->color(pcol2);
pdl->cylinder(m_bondw, pos2, mpos);
}
}