本文整理汇总了C++中MolAtomPtr::getBfac方法的典型用法代码示例。如果您正苦于以下问题:C++ MolAtomPtr::getBfac方法的具体用法?C++ MolAtomPtr::getBfac怎么用?C++ MolAtomPtr::getBfac使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MolAtomPtr
的用法示例。
在下文中一共展示了MolAtomPtr::getBfac方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: beginRend
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);
}
示例2: init
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;
}
示例3: getAtomColor
bool BfacColoring::getAtomColor(MolAtomPtr pAtom, gfx::ColorPtr &col)
{
double par;
if (m_nMode==BFC_OCC)
par = pAtom->getOcc();
else if (m_nMode==BFC_CENTER)
par = (pAtom->getPos()-m_vCenter).length();
else
par = pAtom->getBfac();
col = m_colLow;
double parLo = m_parLow;
double parHi = m_parHigh;
if (isAutoMode()) {
parLo = m_parAutoLo;
parHi = m_parAutoHi;
}
if (par<parLo)
col = m_colLow;
else if (par>parHi)
col = m_colHigh;
else {
double ratio;
if (qlib::isNear4(parHi, parLo))
ratio = 1.0;
else
ratio = (par-parLo)/(parHi-parLo);
col = ColorPtr(MB_NEW gfx::GradientColor(m_colHigh, m_colLow, ratio));
}
return true;
}
示例4: 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"
" ",
//.........这里部分代码省略.........