OpenBabel::OBMol Schuffenhauer::Rule_1(OpenBabel::OBMol& oldMol) { if (oldMol.GetSSSR().size() <= _ringsToBeRetained) { return oldMol; } OpenBabel::OBMol newMol(oldMol); std::vector<OpenBabel::OBAtom*>::iterator avi; OpenBabel::OBBondIterator bi; OpenBabel::OBAtom* atom; OpenBabel::OBAtom* nbrAtom[2]; for (atom = newMol.BeginAtom(avi); atom; atom = newMol.NextAtom(avi)) { if ((atom->MemberOfRingSize() == 3) && (atom->IsNitrogen() || atom->IsOxygen()) && (atom->MemberOfRingCount() == 1) && (atom->GetHvyValence() == 2)) { nbrAtom[0] = atom->BeginNbrAtom(bi); nbrAtom[1] = atom->NextNbrAtom(bi); if (nbrAtom[0] && nbrAtom[1]) { newMol.DeleteAtom(atom); newMol.GetBond(nbrAtom[0], nbrAtom[1])->SetBondOrder(2); } } } return newMol; }
void hDonFuncCalc(OpenBabel::OBMol* mol, Pharmacophore* pharmacophore) { // Create for every hydrogen donor a pharmacophore point std::vector<OpenBabel::OBAtom*>::iterator ai; for (OpenBabel::OBAtom* a = mol->BeginAtom(ai); a; a = mol->NextAtom(ai)) { if (a->GetAtomicNum() == 7 || a->GetAtomicNum() == 8) { if (a->GetFormalCharge() >= 0 && ((a->GetImplicitValence() - a->GetHvyValence()) !=0)) { PharmacophorePoint p; p.func = HDON; p.point.x = a->x(); p.point.y = a->y(); p.point.z = a->z(); p.hasNormal = true; p.alpha = funcSigma[HDON]; p.normal = _hDonCalcNormal(a); pharmacophore->push_back(p); } } } }