Exemplo n.º 1
0
std::list<OpenBabel::OBAtom*>
_hAccGetNeighbors(OpenBabel::OBAtom* a)
{
   std::list<OpenBabel::OBAtom*> aList;
   OpenBabel::OBMol* parent(a->GetParent());

   double r;
   OpenBabel::OBElementTable et;
   std::vector<OpenBabel::OBAtom*>::iterator ai;
   for (OpenBabel::OBAtom* aa = parent->BeginAtom(ai); aa; aa = parent->NextAtom(ai))
   {
      if (*aa == a)
      {
         continue;
      }
    
      r = et.GetVdwRad(aa->GetAtomicNum());
      double delta(H_BOND_DIST + H_RADIUS + r);
      double maxDistSq(delta*delta);
      double distSq((a->x() - aa->x()) * (a->x() - aa->x()) +
                    (a->y() - aa->y()) * (a->y() - aa->y()) +
                    (a->z() - aa->z()) * (a->z() - aa->z()));
    
      if (distSq <= maxDistSq)
      {
         aList.push_back(aa);
      }
   }
   return aList;
}
Exemplo n.º 2
0
Coordinate
_hDonCalcNormal(OpenBabel::OBAtom* a)
{
   int nbrBonds(0);
   Coordinate normal;

   std::vector<OpenBabel::OBBond*>::iterator bi;
   for (OpenBabel::OBBond* b = a->BeginBond(bi); b; b = a->NextBond(bi))
   {
      OpenBabel::OBAtom* aa = b->GetNbrAtom(a);
      if (aa->GetAtomicNum() == 1)
      {
         continue;
      }
      ++nbrBonds;
      normal.x += (aa->x() - a->x());
      normal.y += (aa->y() - a->y());
      normal.z += (aa->z() - a->z());
   }
   double length(sqrt(normal.x*normal.x + normal.y*normal.y + normal.z*normal.z));
   normal.x /= length;
   normal.y /= length;
   normal.z /= length;
  
   normal.x = -normal.x;
   normal.y = -normal.y;
   normal.z = -normal.z;
  
   normal.x += a->x();
   normal.y += a->y();
   normal.z += a->z();
  
   return normal;
}
Exemplo n.º 3
0
void
hAccFuncCalc(OpenBabel::OBMol* mol, Pharmacophore* pharmacophore)
{
   // Create for every hydrogen acceptor a pharmacophore point
   std::vector<OpenBabel::OBAtom*>::iterator ai;
   for (OpenBabel::OBAtom* atom = mol->BeginAtom(ai); atom; atom = mol->NextAtom(ai))
   {
      if (atom->GetAtomicNum() == 7 || atom->GetAtomicNum() == 8)
      {
         if (atom->GetFormalCharge() <= 0)
         {        
            if(_hAccDelocalized(atom) || (_hAccCalcAccSurf(atom) < 0.02))
            {
               continue;
            }
            PharmacophorePoint p;
            p.func = HACC;
            p.point.x = atom->x();
            p.point.y = atom->y();
            p.point.z = atom->z();
            p.hasNormal = true;
            p.alpha = funcSigma[HACC];
            p.normal = _hAccCalcNormal(atom);
            pharmacophore->push_back(p);
         }
      }
   }
}
Exemplo n.º 4
0
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);
         }
      }
   }
}