void getchain(unsigned short chain_id, Residue *reslist, Residue* &nter, Residue* &cter) { nter = cter = NULL; Residue *res = reslist; while ((res != NULL) && res->chain_id() != chain_id) { res = res->next(); } nter = res; while ((res != NULL) && res->chain_id() == chain_id) { cter = res; res = res->next(); } }
bool LSQFitDialog::MatchOK(MATCH *m) { Residue *res = m->target; int n = 0; while ((res != NULL) && n < m->length) { if (!atom_from_name(m->atomtype.c_str(), *res)) { break; } n++; res = res->next(); } if (n < m->length) { m->length = n; } if (m->length <= 0) { return false; } res = m->source; n = 0; while ((res != NULL) && n < m->length) { if (!atom_from_name(m->atomtype.c_str(), *res)) { break; } n++; res = res->next(); } if (n < m->length) { m->length = n; } if (m->length <= 0) { return false; } return true; }
void LSQFitDialog::ListTarget() { if (m_target) { Residue *res = m_target->residuesBegin(); QListWidget *list = targetListWidget; list->clear(); while (res != NULL) { list->addItem(resid(res).c_str()); res = res->next(); } } }
void LSQFitDialog::on_targetListWidget_currentTextChanged(const QString &str) { if (m_target == NULL || str.size()==0) { targetres = NULL; targetTextCtrl->setText(""); return; } std::string resstr = str.toStdString(); Residue *res = m_target->residuesBegin(); while (res != NULL) { if (resid(res) == resstr) { targetres = res; } res = res->next(); } targetTextCtrl->setText(resstr.c_str()); }
void LSQFitDialog::ListSource() { if (m_source) { Residue *res = m_source->residuesBegin(); QListWidget *list = sourceListWidget; QComboBox *chains = chainsChoice; list->clear(); chains->clear(); int chainid = -9921; while (res != NULL) { if (res->chain_id() != chainid) { chainid = res->chain_id(); char cid = (char) chainid; chains->addItem(QString(cid)); } list->addItem(resid(res).c_str()); res = res->next(); } } }
void Displaylist::ProbeSurface(Residue *reslist, MIAtomList a) { vector<SURFDOT>::iterator p; MIAtom_iter pa; Residue *res = reslist; float r1, dx, dy, dz, dr; int i; MIAtomList b; MIAtom *atom; while (res != NULL) { for (i = 0; i < res->atomCount(); i++) { atom = res->atom(i); for (pa = a.begin(); pa != a.end(); pa++) { if (atom == *pa) { continue; } } r1 = atom->getRadius(); for (pa = a.begin(); pa != a.end(); pa++) { if (AtomDist(**pa, *atom) < (r1 + (*pa)->getRadius())) { b.push_back(atom); break; } } } res = res->next(); } for (p = CurrentDots.begin(); p != CurrentDots.end(); p++) { dr = 0.0; for (pa = b.begin(); pa != b.end(); pa++) { r1 = (*pa)->getRadius(); r1 = r1*r1; dx = (*pa)->x() - (*p).x; dx = dx*dx; if (dx < r1) { dy = (*pa)->y() - (*p).y; dy = dy*dy; if (dx+dy < r1) { dz = (*pa)->z() - (*p).z; dz = dz*dz; dr = (dx+dy+dz*dz)-r1; } } } if (dr < -0.4) { (*p).color = Colors::WHITE; if (dr < -1.2) { (*p).color = Colors::PINK; if (dr < -2.4) { (*p).color = Colors::RED; } } } else { (*p).color = -abs((*p).color); } } }